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 | |
parent | 9b52ae2e6491bb5d6c59e1799449f6268baf6f89 (diff) | |
download | ruby-287a34ae0dfc23e4158f67cb7783d239f202c368.tar.gz |
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
856 files changed, 13989 insertions, 13989 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','warning') diff --git a/ext/tk/sample/demos-en/button.rb b/ext/tk/sample/demos-en/button.rb index 5c03bd499b..f63a2f3b06 100644 --- a/ext/tk/sample/demos-en/button.rb +++ b/ext/tk/sample/demos-en/button.rb @@ -6,20 +6,20 @@ # button widget demo (called by 'widget') # -# toplevel widget +# toplevel widget if defined?($button_demo) && $button_demo - $button_demo.destroy + $button_demo.destroy $button_demo = nil end -# demo toplevel widget +# demo toplevel widget $button_demo = TkToplevel.new {|w| title("Button Demonstration") iconname("button") positionWindow(w) } -# label +# label msg = TkLabel.new($button_demo) { font $kanji_font wraplength '4i' @@ -28,7 +28,7 @@ msg = TkLabel.new($button_demo) { } msg.pack('side'=>'top') -# frame +# frame $button_buttons = Tk::Frame.new($button_demo) {|frame| TkButton.new(frame) { text 'Dismiss' diff --git a/ext/tk/sample/demos-en/check.rb b/ext/tk/sample/demos-en/check.rb index 2951962a79..bf0b73476a 100644 --- a/ext/tk/sample/demos-en/check.rb +++ b/ext/tk/sample/demos-en/check.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($check_demo) && $check_demo - $check_demo.destroy + $check_demo.destroy $check_demo = nil end @@ -21,7 +21,7 @@ $check_demo = TkToplevel.new {|w| base_frame = TkFrame.new($check_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '4i' @@ -30,12 +30,12 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# wipers = TkVariable.new(0) brakes = TkVariable.new(0) sober = TkVariable.new(0) -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -56,7 +56,7 @@ TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'See Variables' command proc{ - showVars(base_frame, + showVars(base_frame, ['wipers', wipers], ['brakes', brakes], ['sober', sober]) } }.pack('side'=>'left', 'expand'=>'yes') diff --git a/ext/tk/sample/demos-en/check2.rb b/ext/tk/sample/demos-en/check2.rb index faea748a87..4f7b1f07bc 100644 --- a/ext/tk/sample/demos-en/check2.rb +++ b/ext/tk/sample/demos-en/check2.rb @@ -4,7 +4,7 @@ # delete old toplevel widget if defined?($check2_demo) && $check2_demo - $check2_demo.destroy + $check2_demo.destroy $check2_demo = nil end @@ -34,35 +34,35 @@ sober = TkVariable.new(0) # frame TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars($check2_demo, - ['safety', safety], ['wipers', wipers], + showVars($check2_demo, + ['safety', safety], ['wipers', wipers], ['brakes', brakes], ['sober', sober]) - }), - TkButton.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'check2'}), - TkButton.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + TkButton.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'check2'}), + TkButton.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $check2_demo $check2_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) }.pack('side'=>'bottom', 'fill'=>'x') # checkbutton -TkCheckButton.new(base_frame, :text=>'Safety Check', :variable=>safety, - :relief=>:flat, :onvalue=>'all', :offvalue=>'none', +TkCheckButton.new(base_frame, :text=>'Safety Check', :variable=>safety, + :relief=>:flat, :onvalue=>'all', :offvalue=>'none', :tristatevalue=>'partial'){ pack('side'=>'top', 'pady'=>2, 'anchor'=>'w') } @@ -70,7 +70,7 @@ TkCheckButton.new(base_frame, :text=>'Safety Check', :variable=>safety, [ TkCheckButton.new(base_frame, 'text'=>'Wipers OK', 'variable'=>wipers), TkCheckButton.new(base_frame, 'text'=>'Brakes OK', 'variable'=>brakes), TkCheckButton.new(base_frame, 'text'=>'Driver Sober', 'variable'=>sober) -].each{|w| +].each{|w| w.relief('flat') w.pack('side'=>'top', 'padx'=>15, 'pady'=>2, 'anchor'=>'w') } diff --git a/ext/tk/sample/demos-en/clrpick.rb b/ext/tk/sample/demos-en/clrpick.rb index 431439d55d..6da28cb112 100644 --- a/ext/tk/sample/demos-en/clrpick.rb +++ b/ext/tk/sample/demos-en/clrpick.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($clrpick_demo) && $clrpick_demo - $clrpick_demo.destroy + $clrpick_demo.destroy $clrpick_demo = nil end @@ -47,10 +47,10 @@ Tk::Frame.new($clrpick_demo) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# button +# button # TkButton.new($clrpick_demo, 'text'=>'Set background color ...') {|b| Tk::Button.new($clrpick_demo, 'text'=>'Set background color ...') {|b| - command(proc{setColor $clrpick_demo, b, 'background', + command(proc{setColor $clrpick_demo, b, 'background', ['background', 'highlightbackground']}) pack('side'=>'top', 'anchor'=>'c', 'pady'=>'2m') } @@ -64,7 +64,7 @@ Tk::Button.new($clrpick_demo, 'text'=>'Set foreground color ...') {|b| def setColor(w,button,name,options) w.grab initialColor = button[name] - color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, + color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, 'initialcolor'=>initialColor) if color != "" setColor_helper(w,options,color) diff --git a/ext/tk/sample/demos-en/colors.rb b/ext/tk/sample/demos-en/colors.rb index 4300a660ae..b0ef9590b9 100644 --- a/ext/tk/sample/demos-en/colors.rb +++ b/ext/tk/sample/demos-en/colors.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($colors_demo) && $colors_demo - $colors_demo.destroy + $colors_demo.destroy $colors_demo = nil end diff --git a/ext/tk/sample/demos-en/combo.rb b/ext/tk/sample/demos-en/combo.rb index 0907d9e8ec..d77660095c 100644 --- a/ext/tk/sample/demos-en/combo.rb +++ b/ext/tk/sample/demos-en/combo.rb @@ -5,7 +5,7 @@ # based on "Id: combo.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($combo_demo) && $combo_demo - $combo_demo.destroy + $combo_demo.destroy $combo_demo = nil end @@ -17,7 +17,7 @@ $combo_demo = TkToplevel.new {|w| base_frame = TkFrame.new($combo_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><<EOL).pack(:side=>:top, :fill=>:x) Three different combo-boxes are displayed below. \ You can add characters to the first \ @@ -40,24 +40,24 @@ ozCity = TkVariable.new Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, - ['firstVariable', firstValue], - ['secondVariable', secondValue], + showVars(base_frame, + ['firstVariable', firstValue], + ['secondVariable', secondValue], ['ozCity', ozCity]) - }), - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'combo'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'combo'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $combo_demo.destroy $combo_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -66,7 +66,7 @@ Ttk::Frame.new(base_frame) {|frame| frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true) australianCities = [ - 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', + 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', 'Hobart', 'Darwin', 'Alice Springs' ] @@ -80,17 +80,17 @@ Tk.pack(Ttk::Labelframe.new(frame, :text=>'Fully Editable'){|f| w.values <<= w.value unless w.values.include?(w.value) } }.pack(:pady=>5, :padx=>10) - }, + }, Ttk::LabelFrame.new(frame, :text=>'Disabled'){|f| Ttk::Combobox.new(f, :textvariable=>secondValue, :state=>:disabled) . pack(:pady=>5, :padx=>10) - }, + }, Ttk::LabelFrame.new(frame, :text=>'Defined List Only'){|f| - Ttk::Combobox.new(f, :textvariable=>ozCity, :state=>:readonly, + Ttk::Combobox.new(f, :textvariable=>ozCity, :state=>:readonly, :values=>australianCities) . pack(:pady=>5, :padx=>10) - }, + }, :side=>:top, :pady=>5, :padx=>10) diff --git a/ext/tk/sample/demos-en/cscroll.rb b/ext/tk/sample/demos-en/cscroll.rb index 259ed3bd8c..40a3afc0ad 100644 --- a/ext/tk/sample/demos-en/cscroll.rb +++ b/ext/tk/sample/demos-en/cscroll.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($cscroll_demo) && $cscroll_demo - $cscroll_demo.destroy + $cscroll_demo.destroy $cscroll_demo = nil end @@ -22,7 +22,7 @@ $cscroll_demo = TkToplevel.new {|w| base_frame = TkFrame.new($cscroll_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', 'text'=>"This window displays a canvas widget that can be scrolled either using the scrollbars or by dragging with button 2 in the canvas. If you click button 1 on one of the rectangles, its indices will be printed on stdout."){ pack('side'=>'top') } @@ -45,7 +45,7 @@ $cscroll_buttons = TkFrame.new(base_frame) {|frame| } $cscroll_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame +# frame unless $tk_version =~ /^4\.[01]/ $cscroll_grid = TkFrame.new(base_frame) { pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1) @@ -55,14 +55,14 @@ unless $tk_version =~ /^4\.[01]/ end # canvas -$cscroll_canvas = TkCanvas.new(base_frame, +$cscroll_canvas = TkCanvas.new(base_frame, 'relief'=>'sunken', 'borderwidth'=>2, 'scrollregion'=>['-11c', '-11c', '50c', '20c'] ) {|c| if $tk_version =~ /^4\.[01]/ - pack('expand'=>'yes', 'fill'=>'both') + pack('expand'=>'yes', 'fill'=>'both') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end @@ -71,18 +71,18 @@ $cscroll_canvas = TkCanvas.new(base_frame, if $tk_version =~ /^4\.[01]/ pack('side'=>'right', 'fill'=>'y') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end } - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}) {|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) if $tk_version =~ /^4\.[01]/ - pack('side'=>'bottom', 'fill'=>'x') + pack('side'=>'bottom', 'fill'=>'x') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end } @@ -93,9 +93,9 @@ bg = $cscroll_canvas.configinfo('bg')[4] x = -10+3*i y = -10 (0..9).each{|j| - TkcRectangle.new($cscroll_canvas, "#{x}c", "#{y}c", "#{x+2}c", "#{y+2}c", + TkcRectangle.new($cscroll_canvas, "#{x}c", "#{y}c", "#{x+2}c", "#{y+2}c", 'outline'=>'black', 'fill'=>bg, 'tags'=>'rect') - TkcText.new($cscroll_canvas, "#{x+1}c", "#{y+1}c", + TkcText.new($cscroll_canvas, "#{x+1}c", "#{y+1}c", 'text'=>"#{i},#{j}", 'anchor'=>'center', 'tags'=>'text') y += 3 } @@ -106,7 +106,7 @@ $cscroll_canvas.itembind('all', 'Any-Leave', proc{scrollLeave $cscroll_canvas}) $cscroll_canvas.itembind('all', '1', proc{scrollButton $cscroll_canvas}) $cscroll_canvas.itembind('all', 'Any-Enter', proc{scrollEnter $cscroll_canvas}) $cscroll_canvas.bind('2', proc{|x,y| $cscroll_canvas.scan_mark(x,y)}, '%x %y') -$cscroll_canvas.bind('B2-Motion', +$cscroll_canvas.bind('B2-Motion', proc{|x,y| $cscroll_canvas.scan_dragto(x,y)}, '%x %y') def scrollEnter(c) diff --git a/ext/tk/sample/demos-en/ctext.rb b/ext/tk/sample/demos-en/ctext.rb index 01374b0321..e04cb283f0 100644 --- a/ext/tk/sample/demos-en/ctext.rb +++ b/ext/tk/sample/demos-en/ctext.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($ctext_demo) && $ctext_demo - $ctext_demo.destroy + $ctext_demo.destroy $ctext_demo = nil end @@ -22,7 +22,7 @@ $ctext_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ctext_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 window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification. The text also supports the following simple bindings for editing: 1. You can point, click, and type. 2. You can also select with button 1. @@ -52,20 +52,20 @@ $ctext_buttons = TkFrame.new(base_frame) {|frame| } $ctext_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# canvas -$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat', +# canvas +$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat', 'borderwidth'=>0, 'width'=>500, 'height'=>350) $ctext_canvas.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'both') -# font +# font if $tk_version =~ /^4.*/ textFont = '-*-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*' else textFont = 'Helvetica 24' end -# canvas -TkcRectangle.new($ctext_canvas, 245, 195, 255, 205, +# canvas +TkcRectangle.new($ctext_canvas, 245, 195, 255, 205, 'outline'=>'black', 'fill'=>'red') ctag_text_param = { @@ -83,24 +83,24 @@ $ctag_text.withtag(TkcText.new($ctext_canvas, 250, 200, ctag_text_param)) $ctag_text.bind('1', proc{|x,y| textB1Press $ctext_canvas,x,y}, "%x %y") $ctag_text.bind('B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y") -$ctag_text.bind('Shift-1', - proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"}, +$ctag_text.bind('Shift-1', + proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"}, "%x %y") -$ctag_text.bind('Shift-B1-Motion', +$ctag_text.bind('Shift-B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y") $ctag_text.bind('KeyPress', proc{|a| textInsert $ctext_canvas,a}, "%A") $ctag_text.bind('Return', proc{textInsert $ctext_canvas,"\n"}) $ctag_text.bind('Control-h', proc{textBs $ctext_canvas}) $ctag_text.bind('BackSpace', proc{textBs $ctext_canvas}) $ctag_text.bind('Delete', proc{textDel $ctext_canvas}) -$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"}, +$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"}, "%x %y") -# Next, create some items that allow the text's anchor position +# Next, create some items that allow the text's anchor position # to be edited. def mkTextConfig(w,x,y,option,value,color) - item = TkcRectangle.new(w, x, y, x+30, y+30, + item = TkcRectangle.new(w, x, y, x+30, y+30, 'outline'=>'black', 'fill'=>color, 'width'=>1) item.bind('1', proc{$ctag_text.configure option, value}) w.addtag_withtag('config', item) @@ -118,15 +118,15 @@ mkTextConfig $ctext_canvas, x+60, y+30, 'anchor', 'w', color mkTextConfig $ctext_canvas, x, y+60, 'anchor', 'ne', color mkTextConfig $ctext_canvas, x+30, y+60, 'anchor', 'n', color mkTextConfig $ctext_canvas, x+60, y+60, 'anchor', 'nw', color -item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50, +item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50, 'outline'=>'black', 'fill'=>'red') item.bind('1', proc{$ctag_text.configure 'anchor', 'center'}) if $tk_version =~ /^4.*/ - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', - 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', + 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', 'anchor'=>'s', 'fill'=>'brown') else - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', 'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown') end @@ -140,18 +140,18 @@ mkTextConfig $ctext_canvas, x, y, 'justify', 'left', color mkTextConfig $ctext_canvas, x+30, y, 'justify', 'center', color mkTextConfig $ctext_canvas, x+60, y, 'justify', 'right', color if $tk_version =~ /^4.*/ - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', - 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', + 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', 'anchor'=>'s', 'fill'=>'brown') else - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', 'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown') end $ctext_canvas.itembind('config', 'Enter', proc{textEnter $ctext_canvas}) -$ctext_canvas.itembind('config', 'Leave', +$ctext_canvas.itembind('config', 'Leave', proc{$ctext_canvas\ - .itemconfigure('current', + .itemconfigure('current', 'fill'=>$textConfigFill)}) $textConfigFill = '' diff --git a/ext/tk/sample/demos-en/entry1.rb b/ext/tk/sample/demos-en/entry1.rb index 6f5b10fb71..fac0afc243 100644 --- a/ext/tk/sample/demos-en/entry1.rb +++ b/ext/tk/sample/demos-en/entry1.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($entry1_demo) && $entry1_demo - $entry1_demo.destroy + $entry1_demo.destroy $entry1_demo = nil end @@ -43,13 +43,13 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# +# e1 = TkEntry.new(base_frame, 'relief'=>'sunken') e2 = TkEntry.new(base_frame, 'relief'=>'sunken') e3 = TkEntry.new(base_frame, 'relief'=>'sunken') [e1,e2,e3].each{|w| w.pack('side'=>'top', 'padx'=>10, 'pady'=>5, 'fill'=>'x')} -# +# e1.insert(0, 'Initial value') e2.insert('end', "This entry contains a long value, much too long ") e2.insert('end', "to fit in the window at one time, so long in fact ") diff --git a/ext/tk/sample/demos-en/entry2.rb b/ext/tk/sample/demos-en/entry2.rb index d67d04b56d..05a6c83cfd 100644 --- a/ext/tk/sample/demos-en/entry2.rb +++ b/ext/tk/sample/demos-en/entry2.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($entry2_demo) && $entry2_demo - $entry2_demo.destroy + $entry2_demo.destroy $entry2_demo = nil end @@ -82,7 +82,7 @@ TkFrame.new(base_frame, 'borderwidth'=>10) {|w| e3.pack('side'=>'top', 'fill'=>'x') s3.pack('side'=>'top', 'fill'=>'x') - # + # e1.insert(0, 'Initial value') e2.insert('end', "This entry contains a long value, much too long ") e2.insert('end', "to fit in the window at one time, so long in fact ") diff --git a/ext/tk/sample/demos-en/entry3.rb b/ext/tk/sample/demos-en/entry3.rb index f7df3a5653..d3bc629fdf 100644 --- a/ext/tk/sample/demos-en/entry3.rb +++ b/ext/tk/sample/demos-en/entry3.rb @@ -7,7 +7,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($entry3_demo) && $entry3_demo - $entry3_demo.destroy + $entry3_demo.destroy $entry3_demo = nil end @@ -19,8 +19,8 @@ $entry3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($entry3_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><<EOL).pack(:side=>:top) Four different entries are displayed below. You can add characters \ by pointing, clicking and typing, though each is constrained in what \ @@ -63,8 +63,8 @@ TkFrame.new(base_frame){|f| def focusAndFlash(widget, fg, bg, count=5) return if count <= 0 if fg && !fg.empty? && bg && !bg.empty? - TkTimer.new(200, count, - proc{widget.configure(:foreground=>bg, :background=>fg)}, + TkTimer.new(200, count, + proc{widget.configure(:foreground=>bg, :background=>fg)}, proc{widget.configure(:foreground=>fg, :background=>bg)} ).start else @@ -86,7 +86,7 @@ def focusAndFlash(widget, fg, bg, count=5) end l1 = TkLabelFrame.new(base_frame, :text=>"Integer Entry") -TkEntry.new(l1, :validate=>:focus, +TkEntry.new(l1, :validate=>:focus, :vcmd=>[ proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' ]) {|e| @@ -97,7 +97,7 @@ TkEntry.new(l1, :validate=>:focus, } l2 = TkLabelFrame.new(base_frame, :text=>"Length-Constrained Entry") -TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell}, +TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell}, :vcmd=>[proc{|s| s.length < 10}, '%P'] ).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m') @@ -171,7 +171,7 @@ end def validatePhoneChange(widget, vmode, idx, char) return true if idx == nil - Tk.after_idle(proc{widget.configure(:validate=>vmode, + Tk.after_idle(proc{widget.configure(:validate=>vmode, :invcmd=>proc{Tk.bell})}) if !(idx<3 || idx==6 || idx==7 || idx==11 || idx>15) && char =~ /[0-9A-Za-z]/ widget.delete(idx) @@ -179,17 +179,17 @@ def validatePhoneChange(widget, vmode, idx, char) Tk.after_idle(proc{phoneSkipRight(widget, -1)}) return true # Tk.update(true) # <- Don't work 'update' inter validation callback. - # It depends on Tcl/Tk side (tested on Tcl/Tk8.5a1). + # It depends on Tcl/Tk side (tested on Tcl/Tk8.5a1). end return false end l3 = TkLabelFrame.new(base_frame, :text=>"US Phone-Number Entry") -TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, - :textvariable=>entry3content, +TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, + :textvariable=>entry3content, :vcmd=>[ - proc{|w,v,i,s| validatePhoneChange(w,v,i,s)}, + proc{|w,v,i,s| validatePhoneChange(w,v,i,s)}, "%W %v %i %S" ]){|e| # Click to focus goes to the first editable character... @@ -205,9 +205,9 @@ TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, } l4 = TkLabelFrame.new(base_frame, :text=>"Password Entry") -TkEntry.new(l4, :validate=>:key, :show=>'*', +TkEntry.new(l4, :validate=>:key, :show=>'*', :vcmd=>[ - proc{|s| s.length <= 8}, + proc{|s| s.length <= 8}, '%P' ]).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m') diff --git a/ext/tk/sample/demos-en/filebox.rb b/ext/tk/sample/demos-en/filebox.rb index 676c347409..0c284c11d4 100644 --- a/ext/tk/sample/demos-en/filebox.rb +++ b/ext/tk/sample/demos-en/filebox.rb @@ -6,7 +6,7 @@ # toplevel widget if defined?($filebox_demo) && $filebox_demo - $filebox_demo.destroy + $filebox_demo.destroy $filebox_demo = nil end @@ -49,7 +49,7 @@ TkFrame.new(base_frame) {|frame| TkEntry.new(f, 'width'=>20) {|e| pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x') - TkButton.new(f, 'text'=>'Browse ...', + TkButton.new(f, 'text'=>'Browse ...', 'command'=>proc{fileDialog base_frame,e,type})\ .pack('side'=>'left') } @@ -60,9 +60,9 @@ TkFrame.new(base_frame) {|frame| $tk_strictMotif = TkVarAccess.new('tk_strictMotif') if ($tk_platform['platform'] == 'unix') - TkCheckButton.new(base_frame, - 'text'=>'Use Motif Style Dialog', - 'variable'=>$tk_strictMotif, + TkCheckButton.new(base_frame, + 'text'=>'Use Motif Style Dialog', + 'variable'=>$tk_strictMotif, 'onvalue'=>1, 'offvalue'=>0 ).pack('anchor'=>'c') end @@ -71,23 +71,23 @@ def fileDialog(w,ent,operation) # #-------------------------------------------------------- types = [ - ['Text files', ['.txt','.doc'] ], - ['Text files', [], 'TEXT' ], - ['Ruby Scripts', ['.rb'], 'TEXT' ], - ['Tcl Scripts', ['.tcl'], 'TEXT' ], - ['C Source Files', ['.c','.h'] ], - ['All Source Files', ['.rb','.tcl','.c','.h'] ], - ['Image Files', ['.gif'] ], - ['Image Files', ['.jpeg','.jpg'] ], - ['Image Files', [], ['GIFF','JPEG']], + ['Text files', ['.txt','.doc'] ], + ['Text files', [], 'TEXT' ], + ['Ruby Scripts', ['.rb'], 'TEXT' ], + ['Tcl Scripts', ['.tcl'], 'TEXT' ], + ['C Source Files', ['.c','.h'] ], + ['All Source Files', ['.rb','.tcl','.c','.h'] ], + ['Image Files', ['.gif'] ], + ['Image Files', ['.jpeg','.jpg'] ], + ['Image Files', [], ['GIFF','JPEG']], ['All files', '*' ] ] if operation == 'open' file = Tk.getOpenFile('filetypes'=>types, 'parent'=>w) else - file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, - 'initialfile'=>'Untitled', + file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, + 'initialfile'=>'Untitled', 'defaultextension'=>'.txt') end if file != "" diff --git a/ext/tk/sample/demos-en/floor.rb b/ext/tk/sample/demos-en/floor.rb index 7023f2a72e..eb8b23eb7d 100644 --- a/ext/tk/sample/demos-en/floor.rb +++ b/ext/tk/sample/demos-en/floor.rb @@ -21,7 +21,7 @@ def floorDisplay(w,active) w.delete('all') $activeFloor = active - # First go through the three floors, displaying the backgrounds for + # First go through the three floors, displaying the backgrounds for # each floor. floor_bg1(w,$floor_colors['bg1'],$floor_colors['outline1']) @@ -32,12 +32,12 @@ def floorDisplay(w,active) w.raise("floor#{active}") - # Create a dummy item just to mark this point in the display list, + # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. TkcRectangle.new(w,0,100,1,101, 'fill'=>'', 'outline'=>'', 'tags'=>'marker') - # Add the walls and labels for the active floor, along with + # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. @@ -302,7 +302,7 @@ def floor_bg3(w,fill,outline) TkcLine.new(w,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) - TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, + TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end @@ -316,316 +316,316 @@ end # color - Color to use for drawing foreground information. def floor_fg1(w,color) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '101' $floorItems['101'] = i - TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Pub Lift1' $floorItems['Pub Lift1'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Priv Lift1' $floorItems['Priv Lift1'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, + i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '110' $floorItems['110'] = i - TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, + TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, + i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '109' $floorItems['109'] = i - TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, + TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, + i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '111' $floorItems['111'] = i - TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, + TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, + i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117B' $floorItems['117B'] = i - TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, + TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, + i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '112' $floorItems['112'] = i - TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, + TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, + i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '113' $floorItems['113'] = i - TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, + TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, + i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117A' $floorItems['117A'] = i - TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, + TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, + i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117' $floorItems['117'] = i - TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, + TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, + i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '114' $floorItems['114'] = i - TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, + TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, + i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '115' $floorItems['115'] = i - TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, + TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, + i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '116' $floorItems['116'] = i - TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, + TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, + i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '118' $floorItems['118'] = i - TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, + TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, - 163,91,163,112,149,112,149,128, + 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '120' $floorItems['120'] = i - TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, + TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, - 156,192,156,169,175,169,175,246,79,246, + 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '122' $floorItems['122'] = i - TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, + TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, + i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '121' $floorItems['121'] = i - TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, + TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, + i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106A' $floorItems['106A'] = i - TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, + TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, + i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '105' $floorItems['105'] = i - TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, + TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, + i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106B' $floorItems['106B'] = i - TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, + TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, + i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '104' $floorItems['104'] = i - TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, + TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, + i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '108' $floorItems['108'] = i - TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, + TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, + i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '107' $floorItems['107'] = i - TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, + TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, + i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Smoking' $floorItems['Smoking'] = i - TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, + TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, + i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '123' $floorItems['123'] = i - TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, + TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, + i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '103' $floorItems['103'] = i - TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, + TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, + i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '124' $floorItems['124'] = i - TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, + TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, + i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '125' $floorItems['125'] = i - TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, + TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, + i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '126' $floorItems['126'] = i - TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, + TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, - 486,253,486,239,474,239,474,209, + 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '127' $floorItems['127'] = i - TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, + TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, - 490,188,490,204,476,204,476,164, + 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'MShower' $floorItems['MShower'] = i - TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, + TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, + i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Closet' $floorItems['Closet'] = i - TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, + TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, + i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'WShower' $floorItems['WShower'] = i - TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, + TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, - 515,174,503,174,503,161,486,161, + 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '130' $floorItems['130'] = i - TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, + TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, - 393,309,300,309,300,248,308,248, + 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '102' $floorItems['102'] = i - TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, + TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, + i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '128' $floorItems['128'] = i - TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, + TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '129' $floorItems['129'] = i - TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, + TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, - 642,389,561,389,561,277,696,277, + 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '133' $floorItems['133'] = i - TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, + TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, + i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '132' $floorItems['132'] = i - TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, + TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, + i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '134' $floorItems['134'] = i - TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, + TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, + i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '135' $floorItems['135'] = i - TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, + TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, - 331,347,332,351,334,354,336,357,341,359, + 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Ramona Stair' $floorItems['Ramona Stair'] = i - TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, + TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, - 122,28,123,32,123,68,220,68,220,87,90,87,90,23, + 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'University Stair' $floorItems['University Stair'] = i - TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, + TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, - 227,13,223,17,221,22,220,34,260,34, + 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Stair' $floorItems['Plaza Stair'] = i - TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, + TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, - 386,104,386,128,220,128, + 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Deck' $floorItems['Plaza Deck'] = i - TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, + TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106' $floorItems['106'] = i - TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, + TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, - 112,130,97,130,97,168,175,168,175,131,146,131, + 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '119' $floorItems['119'] = i - TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, + TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) TkcLine.new(w,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) @@ -798,321 +798,321 @@ end def floor_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, - 800,222,800,168,748,168, + 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '238' $floorItems['238'] = i - TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, + TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '237' $floorItems['237'] = i - TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, + TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, - 715,205,755,205,755,190,724,190,724,187, + 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '246' $floorItems['246'] = i - TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, + TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, + i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '247' $floorItems['247'] = i - TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, + TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, - 559,274,482,274,482,278,396,278,396,274,232,274, + 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '202' $floorItems['202'] = i - TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, + TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, - 156,196,176,196,176,228, + 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '206' $floorItems['206'] = i - TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, + TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, + i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '212' $floorItems['212'] = i - TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, + TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, + i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '245' $floorItems['245'] = i - TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, + TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, + i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '244' $floorItems['244'] = i - TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, + TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, + i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '243' $floorItems['243'] = i - TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, + TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, + i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '242' $floorItems['242'] = i - TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, + TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, + i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Barbecue Deck' $floorItems['Barbecue Deck'] = i - TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, + TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, + i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '240' $floorItems['240'] = i - TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, + TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, + i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '241' $floorItems['241'] = i - TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, + TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, + i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '239' $floorItems['239'] = i - TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, + TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, + i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '248' $floorItems['248'] = i - TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, + TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, + i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '236' $floorItems['236'] = i - TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, + TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, + i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '235' $floorItems['235'] = i - TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, + TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, - 572,143,579,143,579,185,626,185, + 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '234' $floorItems['234'] = i - TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, + TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, - 578,185,527,185,527,131,557,131, + 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '233' $floorItems['233'] = i - TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, + TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '230' $floorItems['230'] = i - TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, + TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, + i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '232' $floorItems['232'] = i - TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, + TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, + i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '229' $floorItems['229'] = i - TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, + TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, + i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '227' $floorItems['227'] = i - TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, + TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, + i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '228' $floorItems['228'] = i - TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, + TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, + i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '226' $floorItems['226'] = i - TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, + TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, + i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '225' $floorItems['225'] = i - TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, + TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, + i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '224' $floorItems['224'] = i - TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, + TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, + i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '223' $floorItems['223'] = i - TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, + TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, + i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '222' $floorItems['222'] = i - TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, + TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, + i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '221' $floorItems['221'] = i - TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, + TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, + i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '204' $floorItems['204'] = i - TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, + TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, + i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '205' $floorItems['205'] = i - TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, + TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '207' $floorItems['207'] = i - TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, + TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, + i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '208' $floorItems['208'] = i - TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, + TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, + i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '209' $floorItems['209'] = i - TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, + TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, + i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217' $floorItems['217'] = i - TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, + TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, + i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217A' $floorItems['217A'] = i - TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, + TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, + i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '216' $floorItems['216'] = i - TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, + TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, + i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '215' $floorItems['215'] = i - TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, + TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, + i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '214' $floorItems['214'] = i - TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, + TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, + i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '213' $floorItems['213'] = i - TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, + TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, + i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '210' $floorItems['210'] = i - TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, + TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, + i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '211' $floorItems['211'] = i - TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, + TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, + i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '203' $floorItems['203'] = i - TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, + TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, - 154,198,154,192,109,192,109,169,99,169, + 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '220' $floorItems['220'] = i - TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, + TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Priv Lift2' $floorItems['Priv Lift2'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Pub Lift 2' $floorItems['Pub Lift 2'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '218' $floorItems['218'] = i - TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, + TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '219' $floorItems['219'] = i - TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, + TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '201' $floorItems['201'] = i - TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) TkcLine.new(w,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) @@ -1283,206 +1283,206 @@ def floor_fg3(w,color) 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316' $floorItems['316'] = i - TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, + TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, + i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '309' $floorItems['309'] = i - TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, + TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, + i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '308' $floorItems['308'] = i - TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, + TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, + i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '307' $floorItems['307'] = i - TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, + TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, + i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '305' $floorItems['305'] = i - TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, + TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324B' $floorItems['324B'] = i - TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, + TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, + i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324A' $floorItems['324A'] = i - TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, + TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, + i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '320' $floorItems['320'] = i - TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, + TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, + i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '310' $floorItems['310'] = i - TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, + TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, + i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '312' $floorItems['312'] = i - TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, + TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, + i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '313' $floorItems['313'] = i - TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, + TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, + i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '314' $floorItems['314'] = i - TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, + TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, + i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '315' $floorItems['315'] = i - TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, + TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, + i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316B' $floorItems['316B'] = i - TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, + TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, + i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316A' $floorItems['316A'] = i - TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, + TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, - 174,198,174,226,101,226,101,179,97,179, + 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '319' $floorItems['319'] = i - TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, + TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, + i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '311' $floorItems['311'] = i - TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, + TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '318' $floorItems['318'] = i - TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, + TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '317' $floorItems['317'] = i - TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, + TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, + i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '323' $floorItems['323'] = i - TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, + TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, + i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '325' $floorItems['325'] = i - TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, + TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, + i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '321' $floorItems['321'] = i - TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, + TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, - 264,181,264,135,314,135, + 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '322' $floorItems['322'] = i - TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, + TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Pub Lift3' $floorItems['Pub Lift3'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Priv Lift3' $floorItems['Priv Lift3'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, + i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '303' $floorItems['303'] = i - TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, + TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, - 244,230,244,221,252,221,252,203, + 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324' $floorItems['324'] = i - TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, + TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, + i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '304' $floorItems['304'] = i - TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, + TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '301' $floorItems['301'] = i - TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, + i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '327' $floorItems['327'] = i - TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, + TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, + i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '326' $floorItems['326'] = i - TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, + TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, - 375,274,397,274,397,248,339,248,339,242,308,242, + 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '302' $floorItems['302'] = i - TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, + TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, - 107,248,160,248,160,301,107,301,107,275,70,275, + 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '306' $floorItems['306'] = i - TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, + TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) TkcLine.new(w,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) @@ -1577,7 +1577,7 @@ end # toplevel widget if defined?($floor_demo) && $floor_demo - $floor_demo.destroy + $floor_demo.destroy $floor_demo = nil end @@ -1593,7 +1593,7 @@ $floor_demo = TkToplevel.new {|w| base_frame = TkFrame.new($floor_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', 'text'=>"This window contains a canvas widget showing the floorplan of Digital Equipment Corporation's Western Research Laboratory. It has three levels. At any given time one of the levels is active, meaning that you can see its room structure. To activate a level, click the left mouse button anywhere on it. As the mouse moves over the active level, the room under the mouse lights up and its room number appears in the \"Room:\" entry. You can also type a room number in the entry and the room will light up."){ pack('side'=>'top') } @@ -1616,18 +1616,18 @@ $floor_buttons = TkFrame.new(base_frame) {|frame| } $floor_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# +# $floorLabels = {} $floorItems = {} -# canvas +# canvas if $tk_version =~ /^4\.[01]/ $floor_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken', 'highlightthickness'=>2) - $floor_canvas = TkCanvas.new($floor_canvas_frame, - 'width'=>900, 'height'=>500, 'borderwidth'=>0, + $floor_canvas = TkCanvas.new($floor_canvas_frame, + 'width'=>900, 'height'=>500, 'borderwidth'=>0, 'highlightthickness'=>0) {|c| - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}){|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) pack('side'=>'bottom', 'fill'=>'x') @@ -1648,20 +1648,20 @@ else v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical') TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1| - $floor_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, - 'borderwidth'=>0, + $floor_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, + 'borderwidth'=>0, 'highlightthickness'=>0) { xscrollcommand(proc{|first,last| h.set first,last}) yscrollcommand(proc{|first,last| v.set first,last}) pack('expand'=>'yes', 'fill'=>'both') } - grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') } - v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) @@ -1678,7 +1678,7 @@ end # Create an entry for displaying and typing in current room. $currentRoom = TkVariable.new -$floor_entry = TkEntry.new($floor_canvas, 'width'=>10, 'relief'=>'sunken', +$floor_entry = TkEntry.new($floor_canvas, 'width'=>10, 'relief'=>'sunken', 'bd'=>2, 'textvariable'=>$currentRoom) # Choose colors, then fill in the floorplan. @@ -1715,7 +1715,7 @@ $floor_canvas.itembind('floor3', '1', proc{floorDisplay $floor_canvas,3}) $floor_canvas.itembind('room', 'Enter', proc{newRoom $floor_canvas}) $floor_canvas.itembind('room', 'Leave', proc{$currentRoom.value = ''}) $floor_canvas.bind('2', proc{|x,y| $floor_canvas.scan_mark x,y}, '%x %y') -$floor_canvas.bind('B2-Motion', +$floor_canvas.bind('B2-Motion', proc{|x,y| $floor_canvas.scan_dragto x,y}, '%x %y') $floor_canvas.bind('Destroy', proc{$currentRoom.unset}) $currentRoom.value = '' diff --git a/ext/tk/sample/demos-en/floor2.rb b/ext/tk/sample/demos-en/floor2.rb index 88b07aeee4..3bfa89a920 100644 --- a/ext/tk/sample/demos-en/floor2.rb +++ b/ext/tk/sample/demos-en/floor2.rb @@ -21,7 +21,7 @@ def floorDisplay2(w,active) w.delete('all') $activeFloor2 = active - # First go through the three floors, displaying the backgrounds for + # First go through the three floors, displaying the backgrounds for # each floor. floor2_bg1(w,$floor2_colors['bg1'],$floor2_colors['outline1']) @@ -32,12 +32,12 @@ def floorDisplay2(w,active) w.raise("floor#{active}") - # Create a dummy item just to mark this point in the display list, + # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. w.create(TkcRectangle,0,100,1,101,'fill'=>'','outline'=>'','tags'=>'marker') - # Add the walls and labels for the active floor, along with + # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. @@ -302,7 +302,7 @@ def floor2_bg3(w,fill,outline) w.create(TkcLine,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) - w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, + w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end @@ -316,316 +316,316 @@ end # color - Color to use for drawing foreground information. def floor2_fg1(w,color) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '101' $floorItems2['101'] = i - w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Pub Lift1' $floorItems2['Pub Lift1'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Priv Lift1' $floorItems2['Priv Lift1'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, + i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '110' $floorItems2['110'] = i - w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, + w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, + i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '109' $floorItems2['109'] = i - w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, + w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, + i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '111' $floorItems2['111'] = i - w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, + w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, + i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117B' $floorItems2['117B'] = i - w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, + w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, + i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '112' $floorItems2['112'] = i - w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, + w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, + i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '113' $floorItems2['113'] = i - w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, + w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, + i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117A' $floorItems2['117A'] = i - w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, + w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, + i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117' $floorItems2['117'] = i - w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, + w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, + i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '114' $floorItems2['114'] = i - w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, + w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, + i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '115' $floorItems2['115'] = i - w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, + w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, + i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '116' $floorItems2['116'] = i - w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, + w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, + i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '118' $floorItems2['118'] = i - w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, + w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, - 163,91,163,112,149,112,149,128, + 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '120' $floorItems2['120'] = i - w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, + w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, - 156,192,156,169,175,169,175,246,79,246, + 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '122' $floorItems2['122'] = i - w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, + w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, + i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '121' $floorItems2['121'] = i - w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, + w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, + i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106A' $floorItems2['106A'] = i - w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, + w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, + i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '105' $floorItems2['105'] = i - w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, + w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, + i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106B' $floorItems2['106B'] = i - w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, + w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, + i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '104' $floorItems2['104'] = i - w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, + w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, + i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '108' $floorItems2['108'] = i - w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, + w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, + i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '107' $floorItems2['107'] = i - w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, + w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, + i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Smoking' $floorItems2['Smoking'] = i - w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, + w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, + i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '123' $floorItems2['123'] = i - w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, + w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, + i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '103' $floorItems2['103'] = i - w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, + w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, + i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '124' $floorItems2['124'] = i - w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, + w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, + i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '125' $floorItems2['125'] = i - w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, + w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, + i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '126' $floorItems2['126'] = i - w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, + w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, - 486,253,486,239,474,239,474,209, + 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '127' $floorItems2['127'] = i - w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, + w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, - 490,188,490,204,476,204,476,164, + 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'MShower' $floorItems2['MShower'] = i - w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, + w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, + i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Closet' $floorItems2['Closet'] = i - w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, + w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, + i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'WShower' $floorItems2['WShower'] = i - w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, + w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, - 515,174,503,174,503,161,486,161, + 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '130' $floorItems2['130'] = i - w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, + w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, - 393,309,300,309,300,248,308,248, + 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '102' $floorItems2['102'] = i - w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, + w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, + i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '128' $floorItems2['128'] = i - w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, + w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '129' $floorItems2['129'] = i - w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, + w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, - 642,389,561,389,561,277,696,277, + 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '133' $floorItems2['133'] = i - w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, + w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, + i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '132' $floorItems2['132'] = i - w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, + w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, + i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '134' $floorItems2['134'] = i - w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, + w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, + i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '135' $floorItems2['135'] = i - w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, + w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, - 331,347,332,351,334,354,336,357,341,359, + 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Ramona Stair' $floorItems2['Ramona Stair'] = i - w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, + w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, - 122,28,123,32,123,68,220,68,220,87,90,87,90,23, + 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'University Stair' $floorItems2['University Stair'] = i - w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, + w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, - 227,13,223,17,221,22,220,34,260,34, + 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Stair' $floorItems2['Plaza Stair'] = i - w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, + w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, - 386,104,386,128,220,128, + 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Deck' $floorItems2['Plaza Deck'] = i - w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, + w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106' $floorItems2['106'] = i - w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, + w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, - 112,130,97,130,97,168,175,168,175,131,146,131, + 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '119' $floorItems2['119'] = i - w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, + w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) w.create(TkcLine,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) @@ -798,321 +798,321 @@ end def floor2_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, - 800,222,800,168,748,168, + 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '238' $floorItems2['238'] = i - w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, + w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '237' $floorItems2['237'] = i - w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, + w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, - 715,205,755,205,755,190,724,190,724,187, + 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '246' $floorItems2['246'] = i - w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, + w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, + i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '247' $floorItems2['247'] = i - w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, + w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, - 559,274,482,274,482,278,396,278,396,274,232,274, + 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '202' $floorItems2['202'] = i - w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, + w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, - 156,196,176,196,176,228, + 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '206' $floorItems2['206'] = i - w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, + w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, + i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '212' $floorItems2['212'] = i - w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, + w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, + i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '245' $floorItems2['245'] = i - w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, + w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, + i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '244' $floorItems2['244'] = i - w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, + w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, + i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '243' $floorItems2['243'] = i - w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, + w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, + i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '242' $floorItems2['242'] = i - w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, + w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, + i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Barbecue Deck' $floorItems2['Barbecue Deck'] = i - w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, + w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, + i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '240' $floorItems2['240'] = i - w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, + w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, + i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '241' $floorItems2['241'] = i - w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, + w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, + i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '239' $floorItems2['239'] = i - w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, + w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, + i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '248' $floorItems2['248'] = i - w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, + w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, + i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '236' $floorItems2['236'] = i - w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, + w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, + i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '235' $floorItems2['235'] = i - w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, + w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, - 572,143,579,143,579,185,626,185, + 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '234' $floorItems2['234'] = i - w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, + w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, - 578,185,527,185,527,131,557,131, + 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '233' $floorItems2['233'] = i - w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, + w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '230' $floorItems2['230'] = i - w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, + w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, + i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '232' $floorItems2['232'] = i - w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, + w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, + i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '229' $floorItems2['229'] = i - w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, + w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, + i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '227' $floorItems2['227'] = i - w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, + w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, + i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '228' $floorItems2['228'] = i - w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, + w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, + i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '226' $floorItems2['226'] = i - w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, + w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, + i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '225' $floorItems2['225'] = i - w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, + w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, + i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '224' $floorItems2['224'] = i - w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, + w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, + i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '223' $floorItems2['223'] = i - w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, + w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, + i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '222' $floorItems2['222'] = i - w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, + w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, + i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '221' $floorItems2['221'] = i - w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, + w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, + i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '204' $floorItems2['204'] = i - w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, + w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, + i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '205' $floorItems2['205'] = i - w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, + w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '207' $floorItems2['207'] = i - w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, + w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, + i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '208' $floorItems2['208'] = i - w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, + w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, + i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '209' $floorItems2['209'] = i - w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, + w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, + i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217' $floorItems2['217'] = i - w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, + w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, + i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217A' $floorItems2['217A'] = i - w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, + w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, + i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '216' $floorItems2['216'] = i - w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, + w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, + i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '215' $floorItems2['215'] = i - w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, + w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, + i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '214' $floorItems2['214'] = i - w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, + w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, + i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '213' $floorItems2['213'] = i - w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, + w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, + i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '210' $floorItems2['210'] = i - w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, + w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, + i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '211' $floorItems2['211'] = i - w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, + w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, + i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '203' $floorItems2['203'] = i - w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, + w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, - 154,198,154,192,109,192,109,169,99,169, + 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '220' $floorItems2['220'] = i - w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, + w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Priv Lift2' $floorItems2['Priv Lift2'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Pub Lift 2' $floorItems2['Pub Lift 2'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '218' $floorItems2['218'] = i - w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, + w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '219' $floorItems2['219'] = i - w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, + w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '201' $floorItems2['201'] = i - w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) w.create(TkcLine,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) @@ -1283,206 +1283,206 @@ def floor2_fg3(w,color) 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316' $floorItems2['316'] = i - w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, + w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, + i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '309' $floorItems2['309'] = i - w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, + w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, + i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '308' $floorItems2['308'] = i - w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, + w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, + i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '307' $floorItems2['307'] = i - w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, + w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, + i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '305' $floorItems2['305'] = i - w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, + w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324B' $floorItems2['324B'] = i - w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, + w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, + i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324A' $floorItems2['324A'] = i - w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, + w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, + i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '320' $floorItems2['320'] = i - w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, + w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, + i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '310' $floorItems2['310'] = i - w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, + w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, + i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '312' $floorItems2['312'] = i - w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, + w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, + i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '313' $floorItems2['313'] = i - w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, + w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, + i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '314' $floorItems2['314'] = i - w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, + w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, + i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '315' $floorItems2['315'] = i - w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, + w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, + i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316B' $floorItems2['316B'] = i - w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, + w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, + i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316A' $floorItems2['316A'] = i - w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, + w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, - 174,198,174,226,101,226,101,179,97,179, + 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '319' $floorItems2['319'] = i - w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, + w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, + i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '311' $floorItems2['311'] = i - w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, + w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '318' $floorItems2['318'] = i - w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, + w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '317' $floorItems2['317'] = i - w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, + w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, + i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '323' $floorItems2['323'] = i - w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, + w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, + i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '325' $floorItems2['325'] = i - w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, + w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, + i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '321' $floorItems2['321'] = i - w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, + w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, - 264,181,264,135,314,135, + 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '322' $floorItems2['322'] = i - w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, + w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Pub Lift3' $floorItems2['Pub Lift3'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Priv Lift3' $floorItems2['Priv Lift3'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, + i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '303' $floorItems2['303'] = i - w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, + w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, - 244,230,244,221,252,221,252,203, + 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324' $floorItems2['324'] = i - w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, + w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, + i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '304' $floorItems2['304'] = i - w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, + w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '301' $floorItems2['301'] = i - w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, + i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '327' $floorItems2['327'] = i - w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, + w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, + i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '326' $floorItems2['326'] = i - w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, + w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, - 375,274,397,274,397,248,339,248,339,242,308,242, + 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '302' $floorItems2['302'] = i - w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, + w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, - 107,248,160,248,160,301,107,301,107,275,70,275, + 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '306' $floorItems2['306'] = i - w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, + w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) @@ -1577,7 +1577,7 @@ end # toplevel widget if defined?($floor2_demo) && $floor2_demo - $floor2_demo.destroy + $floor2_demo.destroy $floor2_demo = nil end @@ -1593,7 +1593,7 @@ $floor2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($floor2_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', 'text'=>"This window contains a canvas widget showing the floorplan of Digital Equipment Corporation's Western Research Laboratory. It has three levels. At any given time one of the levels is active, meaning that you can see its room structure. To activate a level, click the left mouse button anywhere on it. As the mouse moves over the active level, the room under the mouse lights up and its room number appears in the \"Room:\" entry. You can also type a room number in the entry and the room will light up."){ pack('side'=>'top') } @@ -1616,18 +1616,18 @@ $floor2_buttons = TkFrame.new(base_frame) {|frame| } $floor2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# +# $floorLabels2 = {} $floorItems2 = {} -# canvas +# canvas if $tk_version =~ /^4\.[01]/ $floor2_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken', 'highlightthickness'=>2) - $floor2_canvas = TkCanvas.new($floor2_canvas_frame, - 'width'=>900, 'height'=>500, 'borderwidth'=>0, + $floor2_canvas = TkCanvas.new($floor2_canvas_frame, + 'width'=>900, 'height'=>500, 'borderwidth'=>0, 'highlightthickness'=>0) {|c| - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}){|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) pack('side'=>'bottom', 'fill'=>'x') @@ -1648,20 +1648,20 @@ else v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical') TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1| - $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, - 'borderwidth'=>0, + $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, + 'borderwidth'=>0, 'highlightthickness'=>0) { xscrollcommand(proc{|first,last| h.set first,last}) yscrollcommand(proc{|first,last| v.set first,last}) pack('expand'=>'yes', 'fill'=>'both') } - grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') } - v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) @@ -1678,7 +1678,7 @@ end # Create an entry for displaying and typing in current room. $currentRoom2 = TkVariable.new -$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken', +$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken', 'bd'=>2, 'textvariable'=>$currentRoom2) # Choose colors, then fill in the floorplan. @@ -1715,7 +1715,7 @@ $floor2_canvas.itembind('floor3', '1', proc{floorDisplay2 $floor2_canvas,3}) $floor2_canvas.itembind('room', 'Enter', proc{newRoom2 $floor2_canvas}) $floor2_canvas.itembind('room', 'Leave', proc{$currentRoom2.value = ''}) $floor2_canvas.bind('2', proc{|x,y| $floor2_canvas.scan_mark x,y}, '%x %y') -$floor2_canvas.bind('B2-Motion', +$floor2_canvas.bind('B2-Motion', proc{|x,y| $floor2_canvas.scan_dragto x,y}, '%x %y') $floor2_canvas.bind('Destroy', proc{$currentRoom2.unset}) $currentRoom2.value = '' diff --git a/ext/tk/sample/demos-en/form.rb b/ext/tk/sample/demos-en/form.rb index 3119752b1c..abb3e0e10e 100644 --- a/ext/tk/sample/demos-en/form.rb +++ b/ext/tk/sample/demos-en/form.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($form_demo) && $form_demo - $form_demo.destroy + $form_demo.destroy $form_demo = nil end @@ -43,7 +43,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# entry +# entry form_data = [] (1..5).each{|i| f = TkFrame.new(base_frame, 'bd'=>2) @@ -54,7 +54,7 @@ form_data = [] form_data[i] = {'frame'=>f, 'entry'=>e, 'label'=>l} } -# +# form_data[1]['label'].text('Name:') form_data[2]['label'].text('Address:') form_data[5]['label'].text('Phone:') diff --git a/ext/tk/sample/demos-en/goldberg.rb b/ext/tk/sample/demos-en/goldberg.rb index c6fa37c09c..d3956ef78c 100644 --- a/ext/tk/sample/demos-en/goldberg.rb +++ b/ext/tk/sample/demos-en/goldberg.rb @@ -43,7 +43,7 @@ #>># lots of canvas create and move calls. if defined?($goldberg_demo) && $goldberg_demo - $goldberg_demo.destroy + $goldberg_demo.destroy $goldberg_demo = nil end @@ -101,7 +101,7 @@ class TkGoldberg_Demo @S['pause'] = TkVariable.new @S['details'] = TkVariable.new(true) - @S['mode'] = TkVariable.new(:MSTART, :symbol) + @S['mode'] = TkVariable.new(:MSTART, :symbol) # :MSTART, :MGO, :MPAUSE, :MSSTEP, :MBSTEP, :MDONE, :MDEBUG # 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 @@ -132,19 +132,19 @@ class TkGoldberg_Demo @XY = {} @XY6 = { - '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], + '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], '-5'=>[340, 190], '-6'=>[349, 177], '-7'=>[366, 177], '-8'=>[380, 176], - '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], - '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], - '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], - '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], - '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], - '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], - '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], - '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], - '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], - '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], - '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], + '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], + '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], + '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], + '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], + '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], + '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], + '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], + '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], + '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], + '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], + '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], '13,15'=>[376, 410], '13,16'=>[360, 403] } @@ -161,11 +161,11 @@ class TkGoldberg_Demo def do_display() @ctrl = TkFrame.new(@parent, :relief=>:ridge, :bd=>2, :padx=>5, :pady=>5) - @screen = TkFrame.new(@parent, :bd=>2, - :relief=>:raised).pack(:side=>:left, :fill=>:both, + @screen = TkFrame.new(@parent, :bd=>2, + :relief=>:raised).pack(:side=>:left, :fill=>:both, :expand=>true) - @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, + @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, :bg=>@C['bg'], :highlightthickness=>0){ scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up yview_moveto(0.05) @@ -204,8 +204,8 @@ class TkGoldberg_Demo command proc{showCode 'goldberg'} }.pack('side'=>'left', 'padx'=>5) - # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, - @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, :bg=>@C['bg'], :activebackground=>@C['bg']) @show.pack('side'=>'left') frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) @@ -214,34 +214,34 @@ class TkGoldberg_Demo end def do_ctrl_frame - @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, + @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, :command=>proc{do_button(0)}) if font = @start['font'] @start.font(font.weight('bold')) end - @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, - :command=>proc{do_button(1)}, :relief=>:raised, + @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, + :command=>proc{do_button(1)}, :relief=>:raised, :variable=>@S['pause']) - @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, + @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, :command=>proc{do_button(2)}) - @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, + @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, :command=>proc{do_button(4)}) - @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, + @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, :command=>proc{do_button(3)}) @details = TkFrame.new(@parent, :bd=>2, :relief=>:ridge) - @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, + @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, :relief=>:raised, :variable=>@S['details']) - @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], + @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], :justify=>:center) - @speed_scale = TkScale.new(@parent, :orient=>:horizontal, - :from=>1, :to=>10, :font=>font, - :variable=>@S['speed'], :bd=>2, + @speed_scale = TkScale.new(@parent, :orient=>:horizontal, + :from=>1, :to=>10, :font=>font, + :variable=>@S['speed'], :bd=>2, :relief=>:ridge, :showvalue=>false) - @about = TkButton.new(@parent, :text=>'About', + @about = TkButton.new(@parent, :text=>'About', :command=>proc{about}, :font=>font) Tk.grid(@start, :in=>@ctrl, :row=>0, :sticky=>:ew) @@ -269,17 +269,17 @@ class TkGoldberg_Demo def do_detail_frame @f_details = TkFrame.new(@details) - @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], + @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], :bd=>1, :relief=>:solid, :bg=>'white') Tk.grid(@label, '-', '-', '-', :sticky=>:ew, :row=>0) idx = 1 loop { break unless respond_to?("move#{idx}") - l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, + l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, :width=>2, :bd=>1, :relief=>:solid, :bg=>'white') @STEP[idx] = 0 - ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), + ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), :width=>5, :bd=>1, :relief=>:solid, :bg=>'white') row = (idx + 1)/2 col = ((idx + 1) & 1) * 2 @@ -383,7 +383,7 @@ class TkGoldberg_Demo who = who.to_i n = send("move#{who}") if (n & 1).nonzero? # This guy still alive - alive << who + alive << who end if (n & 2).nonzero? # Next guy is active alive << (who + 1) @@ -416,10 +416,10 @@ class TkGoldberg_Demo # START HERE! banner def draw0 color = @C['0'] - TkcText.new(@canvas, [579, 119], :text=>'START HERE!', - :fill=>color, :anchor=>:w, + TkcText.new(@canvas, [579, 119], :text=>'START HERE!', + :fill=>color, :anchor=>:w, :tag=>'I0', :font=>['Times Roman', 12, :italic, :bold]) - TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, + TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, :width=>5, :arrow=>:last, :arrowshape=>[18, 18, 5]) @canvas.itembind('I0', '1'){ start } end @@ -433,7 +433,7 @@ class TkGoldberg_Demo end pos = [ - [673, 119], [678, 119], [683, 119], [688, 119], + [673, 119], [678, 119], [683, 119], [688, 119], [693, 119], [688, 119], [683, 119], [678, 119] ] step = step % pos.length @@ -445,15 +445,15 @@ class TkGoldberg_Demo def draw1 color = @C['1a'] color2 = @C['1b'] - TkcPolygon.new(@canvas, - [ 844, 133, 800, 133, 800, 346, 820, 346, - 820, 168, 844, 168, 844, 133 ], + TkcPolygon.new(@canvas, + [ 844, 133, 800, 133, 800, 346, 820, 346, + 820, 168, 844, 168, 844, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcPolygon.new(@canvas, - [ 771, 133, 685, 133, 685, 168, 751, 168, - 751, 346, 771, 346, 771, 133 ], + TkcPolygon.new(@canvas, + [ 771, 133, 685, 133, 685, 168, 751, 168, + 751, 346, 771, 346, 771, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcOval.new(@canvas, box(812, 122, 9), + TkcOval.new(@canvas, box(812, 122, 9), :tag=>'I1', :fill=>color2, :outline=>'') @canvas.itembind('I1', '1'){ start } @@ -462,9 +462,9 @@ class TkGoldberg_Demo def move1(step = nil) step = get_step(1, step) pos = [ - [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], - [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], - [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], + [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], + [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], + [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], [-100, -100] ] return 0 if step >= pos.length @@ -480,40 +480,40 @@ class TkGoldberg_Demo color = @C['2'] # Fulcrum - TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], + TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], :fill=>@C['fg'], :outline=>@C['fg']) # Strike box - TkcRectangle.new(@canvas, [628, 335, 660, 383], + TkcRectangle.new(@canvas, [628, 335, 660, 383], :fill=>'', :outline=>@C['fg']) (0..2).each{|y| yy = 335 + y*16 - TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) - TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) } # Lever - TkcLine.new(@canvas, [702, 366, 798, 366], + TkcLine.new(@canvas, [702, 366, 798, 366], :fill=>@C['fg'], :width=>6, :tag=>'I2_0') # R strap - TkcLine.new(@canvas, [712, 363, 712, 355], + TkcLine.new(@canvas, [712, 363, 712, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_1') # L strap - TkcLine.new(@canvas, [705, 363, 705, 355], + TkcLine.new(@canvas, [705, 363, 705, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_2') # Match stick - TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], + TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], :fill=>@C['fg'], :width=>3, :tag=>'I2_3') # Match head - TkcPolygon.new(@canvas, - [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, - 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], + TkcPolygon.new(@canvas, + [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, + 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], :fill=>color, :outline=>color, :tag=>'I2_4') end @@ -523,15 +523,15 @@ class TkGoldberg_Demo stages = [0, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 1] xy = [] xy[0] = [ - 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, + 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, 662, 318, 662, 328, 671, 336 ] xy[1] = [ - 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, + 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, 661, 327, 671, 335 ] xy[2] = [ - 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, + 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, 666, 309, 660, 324, 672, 336 ] @@ -542,7 +542,7 @@ class TkGoldberg_Demo if step == 0 # Rotate the match beta = 20 - + ox, oy = anchor('I2_0', :s) # Where to pivot i = 0 @@ -567,23 +567,23 @@ class TkGoldberg_Demo xy = [ [602, 296], [577, 174], [518, 174] ] xy.each{|x, y| # 3 Pulleys - TkcOval.new(@canvas, box(x, y, 13), + TkcOval.new(@canvas, box(x, y, 13), :fill=>color, :outline=>@C['fg'], :width=>3) TkcOval.new(@canvas, box(x, y, 2), :fill=>@C['fg'], :outline=>@C['fg']) } # Wall to flame - TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', + TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', :width=>3, :fill=>@C['fg'], :smooth=>true) # Flame to pulley 1 - TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', + TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', :width=>3, :fill=>@C['fg'], :smooth=>true) - TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', + TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', :width=>3, :fill=>@C['fg'], :smooth=>true) # Pulley 1 half way to 2 - TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', + TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', :width=>3, :fill=>@C['fg']) # Pulley 1 other half to 2 @@ -593,26 +593,26 @@ class TkGoldberg_Demo TkcLine.new(@canvas, [577, 161, 518, 161], :width=>3, :fill=>@C['fg']) # Down to weight - TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', + TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', :width=>3, :fill=>@C['fg']) # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle x1, y1, x2, y2 = [515, 207, 495, 207] - TkcOval.new(@canvas, box(x1, y1, 6), + TkcOval.new(@canvas, box(x1, y1, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcOval.new(@canvas, box(x2, y2, 6), + TkcOval.new(@canvas, box(x2, y2, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, + TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, :tag=>'I3_', :fill=>color2, :outline=>color2) - - TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), + + TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), :smooth=>true, :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcLine.new(@canvas, [500, 217, 511, 217], + TkcLine.new(@canvas, [500, 217, 511, 217], :tag=>'I3_', :fill=>color2, :width=>10) # Bottom weight target - TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], + TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], :tag=>'I3__', :fill=>@C['fg'], :joinstyle=>:miter, :width=>10) end @@ -655,7 +655,7 @@ class TkGoldberg_Demo } # Swing gate - TkcLine.new(@canvas, [518, 464, 518, 428], + TkcLine.new(@canvas, [518, 464, 518, 428], :tag=>'I4', :fill=>color, :width=>1) end @@ -682,7 +682,7 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3) xy = [ - 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, + 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, 575, 452, 574, 454, 566, 456, 554, 456, 545, 456, 537, 454, 530, 452 ] TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_0'], :fill=>color) @@ -692,7 +692,7 @@ class TkGoldberg_Demo xy = box(540, 446, 2) # Eye xy = [540, 444, 541, 445, 541, 447, 540, 448, 538, 447, 538, 445] - TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], + TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], :outline=>'', :smooth=>true) xy = [538, 454, 535, 461] # Front leg @@ -712,9 +712,9 @@ class TkGoldberg_Demo step = get_step(5, step) pos = [ - [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], - [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], - [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], + [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], + [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], + [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], [422, 274, -30], [422, 260.5, -30, :x], [422.5, 248.5, -28], [425, 237] ] @@ -735,16 +735,16 @@ class TkGoldberg_Demo color = @C['6'] xy = [324, 130, 391, 204] # Ball holder xy = round_rect(xy, 10) - TkcPolygon.new(@canvas, xy, :smooth=>true, + TkcPolygon.new(@canvas, xy, :smooth=>true, :outline=>@C['fg'], :width=>3, :fill=>color) xy = [339, 204, 376, 253] # Below the ball holder - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>color, :tag=>'I6c') xy = box(346, 339, 28) TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') # Roter - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>80, :extent=>205) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>-41, :extent=>85) xy = box(346, 339, 15) # Center of rotor @@ -759,10 +759,10 @@ class TkGoldberg_Demo TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'') xy = [ - 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, + 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, 352, 403, 352, 366 ] - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2) # Below rotor TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2) xy = box(275, 342, 7) # On/off rotor @@ -787,7 +787,7 @@ class TkGoldberg_Demo loc = -i color = colors[i] x, y = @XY6["#{loc}"] - TkcOval.new(@canvas, box(x, y, 5), + TkcOval.new(@canvas, box(x, y, 5), :fill=>color, :outline=>color, :tag=>"I6_b#{i}") } draw6a(12) # The wheel @@ -813,7 +813,7 @@ class TkGoldberg_Demo @canvas.move('I6_', -7, 0) if step == 1 # Poke a hole xy = [348, 226, 365, 240] - TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), + TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), :outline=>'') end return 1 @@ -853,24 +853,24 @@ class TkGoldberg_Demo def draw7 color = @C['7'] xy = [198, 306, 277, 374] # Box - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :fill=>color, :tag=>'I7z') @canvas.lower('I7z') xy = [275, 343, 230, 349] - TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, + TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, :arrowshape=>[23, 23, 8], :width=>6) xy = [225, 324] # On button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 323] # On text font = ['Times Roman', 8] - TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, :fill=>@C['fg'], :font=>font) xy = [225, 350] # Off button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 349] # Off text - TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, :fill=>@C['fg'], :font=>font) end @@ -915,7 +915,7 @@ class TkGoldberg_Demo xy = [280, 209, 296, 248] TkcOval.new(@canvas, xy, :outline=>color, :fill=>color) xy = [ - 288, 249, 252, 249, 260, 240, 280, 234, + 288, 249, 252, 249, 260, 240, 280, 234, 296, 234, 316, 240, 324, 249, 288, 249 ] TkcPolygon.new(@canvas, xy, :fill=>color, :smooth=>true) @@ -924,16 +924,16 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color) xy = [255, 206, 265, 234] # Fan blades - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 176, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 206, 265, 220] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') xy = [255, 190, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') end @@ -958,17 +958,17 @@ class TkGoldberg_Demo color = @C['10a'] color2 = @C['10b'] xy = [191, 230, 233, 230, 233, 178, 191, 178] # Sail - TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], :tag=>'I10') xy = box(209, 204, 31) # Front - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = box(249, 204, 31) # Back - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = [200, 171, 200, 249] # Mast @@ -988,10 +988,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(239, 262, 17) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>95, :extent=>103) xy = box(76, 266, 21) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>190) end @@ -999,9 +999,9 @@ class TkGoldberg_Demo step = get_step(10, step) pos = [ - [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], - [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], - [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], + [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], + [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], + [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], [116, 212], [111, 212] ] @@ -1028,21 +1028,21 @@ class TkGoldberg_Demo xy = [55, 504, 55, 591] # Bottom right side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(71, 460, 48) # Outer loop - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>110, :extent=>-290, :tag=>'I11i') xy = box(71, 460, 16) # Inner loop - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', :width=>3, :tag=>'I11i') TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['bg'], :width=>3) xy = [23, 264, 23, 591] # Left side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(1, 266, 23) # Top left curve - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>90) xy = box(75, 235, 9) # The ball - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', :width=>3, :tag=>'I11') end @@ -1050,8 +1050,8 @@ class TkGoldberg_Demo step = get_step(11, step) pos = [ - [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], - [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], + [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], + [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], [100, 437], [65, 423], [-100, -100], [38, 505], [38, 527, :x], [38, 591] ] @@ -1065,11 +1065,11 @@ class TkGoldberg_Demo # Hand def draw12 xy = [ - 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, + 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, 60, 590, 60, 610, 60, 610 ] xy.concat([60, 610, 65, 620, 60, 631]) # Thumb - xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, + xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, 56, 669, 50, 669, 50, 662, 50, 637]) y0 = 637 # Bumps for fingers @@ -1079,7 +1079,7 @@ class TkGoldberg_Demo x2 = x - 10 xy << x << y0 << x1 << y1 << x2 << y0 } - TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], :smooth=>true, :tag=>'I12', :width=>3) end @@ -1103,25 +1103,25 @@ class TkGoldberg_Demo ] radii = [2, 9, 9, 8, 5, 5, 2] - round_poly(@canvas, xy, radii, :width=>3, + round_poly(@canvas, xy, radii, :width=>3, :outline=>@C['fg'], :fill=>color) - round_poly(@canvas, xy2, radii, :width=>3, + round_poly(@canvas, xy2, radii, :width=>3, :outline=>@C['fg'], :fill=>color) xy = [56, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13') xy = [809, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13R') xy = [112, 687] # Label - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [762, 687] - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [138, 663, 148, 636, 178, 636] # Paper guide @@ -1129,7 +1129,7 @@ class TkGoldberg_Demo xy = [732, 663, 722, 636, 692, 636] TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3) - sine([149, 688, 720, 688], 5, 15, + sine([149, 688, 720, 688], 5, 15, :tag=>'I13_s', :fill=>@C['fg'], :width=>3) end @@ -1159,17 +1159,17 @@ class TkGoldberg_Demo def draw14 color = @C['14'] xy = [102, 661, 113, 632, 130, 618] # Left paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_0') xy = [148, 629, 125, 640, 124, 662] # Right paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_1') draw14a('L') xy = [ 768.0, 662.5, 767.991316225, 662.433786215, 767.926187912, 662.396880171 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_0') @canvas.lower('I14R_0') # NB. these numbers are VERY sensitive, you must start with final size @@ -1177,7 +1177,7 @@ class TkGoldberg_Demo xy = [ 745.947897349, 662.428358855, 745.997829056, 662.452239237, 746.0, 662.5 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_1') @canvas.lower('I14R_1') end @@ -1190,11 +1190,11 @@ class TkGoldberg_Demo x3, y3, x4, y4, x5, y5 = xy2 zz = [ - x0, y0, x0, y0, xy, x2, y2, x2, y2, + x0, y0, x0, y0, xy, x2, y2, x2, y2, x3, y3, x3, y3, xy2, x5, y5, x5, y5 ].flatten @canvas.delete("I14#{side}") - TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, + TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, :fill=>color, :outline=>color, :width=>3) @canvas.lower("I14#{side}") end @@ -1247,7 +1247,7 @@ class TkGoldberg_Demo xy = [765, 557, 784, 583] TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2) - sine([658, 580, 765, 580], 3, 15, + sine([658, 580, 765, 580], 3, 15, :tag=>'I15_s', :fill=>@C['fg'], :width=>3) end @@ -1286,7 +1286,7 @@ class TkGoldberg_Demo xy = [722, 485, 791, 556] TkcRectangle.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3) xy = box(752, 515, 25) # Bell - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', :tag=>'I16b', :width=>2) xy = box(752, 515, 5) # Bell button TkcOval.new(@canvas, xy, :fill=>'black', :outline=>'black', :tag=>'I16b') @@ -1325,24 +1325,24 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = [664, 523, 717, 549] # Body - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :style=>:chord, :start=>128, :extent=>260, :tag=>'I17') xy = [709, 554, 690, 543] # Paw - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = [657, 544, 676, 555] - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = box(660, 535, 15) # Lower face - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>150, :extent=>240, :tag=>'I17_') - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:chord, :start=>150, :extent=>240, :tag=>'I17_') xy = [674, 529, 670, 513, 662, 521, 658, 521, 650, 513, 647, 529] # Ears TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, :tag=>['I17_', 'I17_c']) xy = [652, 542, 628, 539] # Whiskers TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') @@ -1352,23 +1352,23 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [668, 543, 687, 538] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 544, 688, 546] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 547, 688, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [649, 530, 654, 538, 659, 530] # Left eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [671, 530, 666, 538, 661, 530] # Right eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [655, 543, 660, 551, 665, 543] # Mouth - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') end @@ -1381,10 +1381,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = box(654, 530, 4) # Left eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') xy = box(666, 530, 4) # Right eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') @canvas.move('I17_', 0, -20) # Move face up @@ -1394,19 +1394,19 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [ # Body - 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, - 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, + 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, + 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, 668, 527, 668, 527, 675, 522, 676, 517, 677, 512 ] - TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), - :outline=>@C['fg'], :width=>3, :smooth=>true, + TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), + :outline=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = [716, 514, 716, 554] # Back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [694, 532, 694, 554] # 2nd back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [715, 514, 718, 506, 719, 495, 716, 488] # Tail - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') @canvas.raise('I17w') # Make whiskers visible @@ -1435,14 +1435,14 @@ class TkGoldberg_Demo step = get_step(18, step) pos = [ - [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], + [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], [136, 506], [16, 506], [-100, -100] ] b = [] b[0] = [490, 502, 719, 507, 524, 512] # Band collapsing b[1] = [ - 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, + 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, 553, 536, 538, 534, 532, 519, 529, 499 ] b[2] = [ @@ -1473,54 +1473,54 @@ class TkGoldberg_Demo color = @C['19'] xx = [[249, 181], [155, 118], [86, 55], [22, 0]] xx.each{|x1, x2| - TkcRectangle.new(@canvas, x1, 453, x2, 467, + TkcRectangle.new(@canvas, x1, 453, x2, 467, :fill=>color, :outline=>'', :tag=>'I19') - TkcLine.new(@canvas, x1, 453, x2, 453, + TkcLine.new(@canvas, x1, 453, x2, 453, :fill=>@C['fg'], :width=>1) # Pipe top - TkcLine.new(@canvas, x1, 467, x2, 467, + TkcLine.new(@canvas, x1, 467, x2, 467, :fill=>@C['fg'], :width=>1) # Pipe bottom } @canvas.raise('I11i') xy = box(168, 460, 16) # Bulge by the joint TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>21, :extent=>136) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>-21, :extent=>-130) xy = [249, 447, 255, 473] # First joint 26x6 TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1) xy = box(257, 433, 34) # Bend up - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>-91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 433, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>-92) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 421, 34) # Bend left - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(257, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(243, 421, 34) # Bend down - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = box(243, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = [270, 427, 296, 433] # 2nd joint bottom @@ -1562,7 +1562,7 @@ class TkGoldberg_Demo pos = [451, 462, 473, 484, 496, 504, 513, 523, 532] freq = [20, 40, 40, 40, 40, 40, 40, 40, 40] pos = [ - [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], + [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], [504, 40], [513, 40], [523, 40], [532, 40, :x] ] return 0 if step >= pos.length @@ -1579,11 +1579,11 @@ class TkGoldberg_Demo color = @C['20'] @canvas.delete('I20') - sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], + sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], :width=>3, :fill=>color, :smooth=>true) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20a']) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20b']) @canvas.move('I20a', 8, 0) @canvas.move('I20b', 16, 0) @@ -1599,18 +1599,18 @@ class TkGoldberg_Demo xy = [245, 490, 237, 535] # Right side xy2 = [189, 535, 181, 490] # Left side - TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', :tag=>['I21', 'I21f']) TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21') TkcLine.new(@canvas, xy2, :fill=>@C['fg'], :width=>2, :tag=>'I21') xy = [182, 486, 244, 498] # Top - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, :tag=>['I21', 'I21f']) - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21t']) xy = [189, 532, 237, 540] # Bottom - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21b']) end @@ -1633,7 +1633,7 @@ class TkGoldberg_Demo @canvas.itemconfigure('I21b', :fill=>@C['20']) @canvas.delete('I21w') - TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, + TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, :tag=>['I21', 'I21w'], :outline=>'', :fill=>@C['20']) @canvas.lower('I21w', 'I21') @canvas.raise('I21b') @@ -1669,21 +1669,21 @@ class TkGoldberg_Demo color3 = @C['23c'] xy = [185, 623, 253, 650] # Block - TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], + TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], :width=>2, :tag=>'I23a') xy = [187, 592, 241, 623] # Balloon TkcOval.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', :style=>:arc, :start=>12, :extent=>336) xy = [239, 604, 258, 589, 258, 625, 239, 610] # Balloon nozzle TkcPolygon.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23b') xy = [285, 611, 250, 603] # Dart body - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 596, 249, 618, 264, 607, 249, 596] # Dart tail - TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 607, 268, 607] # Dart detail TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d') @@ -1695,7 +1695,7 @@ class TkGoldberg_Demo step = get_step(23, step) pos = [ - [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], + [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], [487, 607], [587, 607], [687, 607], [787, 607], [-100, -100] ] @@ -1715,7 +1715,7 @@ class TkGoldberg_Demo def draw24 color = @C['24a'] xy = [366, 518, 462, 665] # Balloon - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3, :tag=>'I24') xy = [414, 666, 414, 729] # String TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I24') @@ -1724,16 +1724,16 @@ class TkGoldberg_Demo :width=>3, :tag=>'I24') xy = [387, 567, 390, 549, 404, 542] # Reflections - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [395, 568, 399, 554, 413, 547] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [403, 570, 396, 555, 381, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [408, 564, 402, 547, 386, 545] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') end @@ -1746,16 +1746,16 @@ class TkGoldberg_Demo if step == 0 @canvas.delete('I24') # Exploding balloon xy = [ - 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, - 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, - 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, - 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, + 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, + 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, + 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, + 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, 431, 441, 431, 440, 400, 502, 347, 465, 347, 465 ] - TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], + TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], :outline=>@C['24a'], :width=>10, :smooth=>true) msg = Tk.subst(@S['message'].value) - TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], + TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], :justify=>:center, :font=>['Times Roman', 18, :bold]) return 1 end @@ -1786,8 +1786,8 @@ class TkGoldberg_Demo if step >= 3 @canvas.delete('I24', 'I26') - TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26', - :text=>'click to continue', + TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26', + :text=>'click to continue', :font=>['Times Roman', 24, :bold]) @canvas.bind('1', proc{reset}) return 4 @@ -1967,11 +1967,11 @@ class TkGoldberg_Demo def sparkle(oxy, tag) xy = [ - [299, 283], [298, 302], [295, 314], [271, 331], + [299, 283], [298, 302], [295, 314], [271, 331], [239, 310], [242, 292], [256, 274], [281, 273] ] xy.each{|x, y| - TkcLine.new(@canvas, 271, 304, x, y, + TkcLine.new(@canvas, 271, 304, x, y, :fill=>'white', :width=>3, :tag=>tag) } move_abs(tag, oxy) diff --git a/ext/tk/sample/demos-en/icon.rb b/ext/tk/sample/demos-en/icon.rb index a3921d2333..bab40da214 100644 --- a/ext/tk/sample/demos-en/icon.rb +++ b/ext/tk/sample/demos-en/icon.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($icon_demo) && $icon_demo - $icon_demo.destroy + $icon_demo.destroy $icon_demo = nil end @@ -48,7 +48,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# image +# image flagup = \ TkBitmapImage.new('file'=>[$demo_dir,'..', 'images','flagup.xbm'].join(File::Separator), diff --git a/ext/tk/sample/demos-en/image1.rb b/ext/tk/sample/demos-en/image1.rb index a9072bb308..233cb963d1 100644 --- a/ext/tk/sample/demos-en/image1.rb +++ b/ext/tk/sample/demos-en/image1.rb @@ -7,7 +7,7 @@ # toplevel widget if defined?($image1_demo) && $image1_demo - $image1_demo.destroy + $image1_demo.destroy $image1_demo = nil end diff --git a/ext/tk/sample/demos-en/image2.rb b/ext/tk/sample/demos-en/image2.rb index 1975dd6b02..13098af1b6 100644 --- a/ext/tk/sample/demos-en/image2.rb +++ b/ext/tk/sample/demos-en/image2.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($image2_demo) && $image2_demo - $image2_demo.destroy + $image2_demo.destroy $image2_demo = nil end @@ -87,13 +87,13 @@ TkFrame.new(base_frame){|w| }.pack('side'=>'top', 'anchor'=>'w') -# image +# image [ TkFrame.new(base_frame, 'height'=>'3m', 'width'=>20), TkLabel.new(base_frame, 'text'=>'Image:'), TkLabel.new(base_frame, 'image'=>$image2a) ].each{|w| w.pack('side'=>'top', 'anchor'=>'w')} -# +# def loadDir(w) w.delete(0,'end') Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f| diff --git a/ext/tk/sample/demos-en/image3.rb b/ext/tk/sample/demos-en/image3.rb index 43afab7ecd..edb6d231bf 100644 --- a/ext/tk/sample/demos-en/image3.rb +++ b/ext/tk/sample/demos-en/image3.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($image3_demo) && $image3_demo - $image3_demo.destroy + $image3_demo.destroy $image3_demo = nil end @@ -21,7 +21,7 @@ $image3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($image3_demo).pack(:fill=>:both, :expand=>true) -# +# def loadDir3(w) w.delete(0,'end') Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f| @@ -37,10 +37,10 @@ end # Arguments: # w - Name of the toplevel window of the demo. def selectAndLoadDir3(w, lbox) - dir = Tk.chooseDirectory(:initialdir=>$dirName.value, + dir = Tk.chooseDirectory(:initialdir=>$dirName.value, :parent=>w, :mustexist=>true) if dir.length > 0 - $dirName.value = dir + $dirName.value = dir loadDir3(lbox) end end @@ -92,11 +92,11 @@ image3_f = TkFrame.new(base_frame).pack(:fill=>:both, :expand=>true) image3_df = TkLabelFrame.new(base_frame, :text=>'Directory:') -image3_ff = TkLabelFrame.new(base_frame, :text=>'File:', +image3_ff = TkLabelFrame.new(base_frame, :text=>'File:', :padx=>'2m', :pady=>'2m') image3_lbx = TkListbox.new(image3_ff, :width=>20, :height=>10) { pack(:side=>:left, :fill=>:y, :expand=>true) - yscrollbar(TkScrollbar.new(image3_ff).pack(:side=>:left, :fill=>:y, + yscrollbar(TkScrollbar.new(image3_ff).pack(:side=>:left, :fill=>:y, :expand=>true)) insert(0, *(%w(earth.gif earthris.gif teapot.ppm))) bind('Double-1', proc{|x,y| loadImage(self, x, y)}, '%x %y') @@ -107,7 +107,7 @@ image3_ent = TkEntry.new(image3_df, :width=>30, :textvariable=>$dirName){ bind('Return', proc{loadDir3(image3_lbx)}) } -TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"Select Dir.", +TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"Select Dir.", :command=>proc{selectAndLoadDir3(image3_ent, image3_lbx)}) { pack(:side=>:left, :fill=>:y, :padx=>[0, '2m'], :pady=>'2m') } @@ -119,7 +119,7 @@ image3_if = TkLabelFrame.new(base_frame, :text=>'Image:') {|f| Tk.grid(image3_df, '-', :sticky=>:ew, :padx=>'1m', :pady=>'1m', :in=>image3_f) -Tk.grid(image3_ff, image3_if, +Tk.grid(image3_ff, image3_if, :sticky=>:nw, :padx=>'1m', :pady=>'1m', :in=>image3_f) TkGrid.columnconfigure(image3_f, 1, :weight=>1) diff --git a/ext/tk/sample/demos-en/items.rb b/ext/tk/sample/demos-en/items.rb index 3fd44fd4f4..01a4072cb7 100644 --- a/ext/tk/sample/demos-en/items.rb +++ b/ext/tk/sample/demos-en/items.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($items_demo) && $items_demo - $items_demo.destroy + $items_demo.destroy $items_demo = nil end @@ -49,7 +49,7 @@ TkFrame.new(base_frame) {|frame| # frame cvs = nil TkFrame.new(base_frame) {|cf| - # canvas + # canvas cvs = TkCanvas.new(cf) {|c| focus scrollregion '0c 0c 30c 24c' @@ -75,11 +75,11 @@ TkFrame.new(base_frame) {|cf| c.pack('in'=>cf, 'expand'=>'yes', 'fill'=>'both') else - c.grid('in'=>cf, 'row'=>0, 'column'=>0, + c.grid('in'=>cf, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - vs.grid('row'=>0, 'column'=>1, + vs.grid('row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - hs.grid('row'=>1, 'column'=>0, + hs.grid('row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(cf, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(cf, 0, 'weight'=>1, 'minsize'=>0) @@ -115,13 +115,13 @@ else green = 'black' end -# tag +# tag $tag_item = TkcGroup.new(cvs) # Set up demos within each of the areas of the grid. TkcText.new(cvs, '5c', '.2c', 'text'=>'Lines', 'anchor'=>'n') -TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c', - 'width'=>2, 'fill'=>blue, 'capstyle'=>'butt', +TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c', + 'width'=>2, 'fill'=>blue, 'capstyle'=>'butt', 'join'=>'miter', 'tags'=>$tag_item ) TkcLine.new(cvs, '4.67c','1c','4.67c','4c', 'arrow'=>'last', 'tags'=>$tag_item) TkcLine.new(cvs, '6.33c','1c','6.33c','4c', 'arrow'=>'both', 'tags'=>$tag_item) @@ -129,38 +129,38 @@ TkcLine.new(cvs, '5c','6c','9c','6c','9c','1c','8c','1c','8c','4.8c','8.8c', '4.8c','8.8c','1.2c','8.2c','1.2c','8.2c','4.6c','8.6c','4.6c', '8.6c','1.4c','8.4c','1.4c','8.4c','4.4c', 'width'=>3, 'fill'=>red, 'tags'=>$tag_item ) -TkcLine.new(cvs, '1c','5c','7c','5c','7c','7c','9c','7c', 'width'=>'.5c', +TkcLine.new(cvs, '1c','5c','7c','5c','7c','7c','9c','7c', 'width'=>'.5c', 'stipple'=>'@'+[$demo_dir,'..', - 'images','gray25.xbm'].join(File::Separator), + 'images','gray25.xbm'].join(File::Separator), 'arrow'=>'both', 'arrowshape'=>'15 15 7', 'tags'=>$tag_item ) TkcLine.new(cvs, '1c','7c','1.75c','5.8c','2.5c','7c','3.25c','5.8c','4c','7c', - 'width'=>'.5c', 'capstyle'=>'round', 'join'=>'round', + 'width'=>'.5c', 'capstyle'=>'round', 'join'=>'round', 'tags'=>$tag_item ) -TkcText.new(cvs, '15c', '.2c', +TkcText.new(cvs, '15c', '.2c', 'text'=>'Curves (smoothed lines)', 'anchor'=>'n') -TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c', +TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c', 'smooth'=>'on', 'fill'=>blue, 'tags'=>$tag_item ) -TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c', +TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c', 'smooth'=>'on', 'arrow'=>'both', 'width'=>3, 'tags'=>$tag_item ) -TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c', +TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c', '16.5c','4.5c','13.5c','7.5c','12c','6c', - 'smooth'=>'on', 'width'=>'3m', 'capstyle'=>'round', + 'smooth'=>'on', 'width'=>'3m', 'capstyle'=>'round', 'stipple'=>'@'+[$demo_dir, '..', - 'images', 'gray25.xbm'].join(File::Separator), + 'images', 'gray25.xbm'].join(File::Separator), 'fill'=>red, 'tags'=>$tag_item ) TkcText.new(cvs, '25c', '.2c', 'text'=>'Polygons', 'anchor'=>'n') TkcPolygon.new(cvs, '21c','1.0c','22.5c','1.75c','24c','1.0c','23.25c','2.5c', '24c','4.0c','22.5c','3.25c','21c','4.0c','21.75c','2.5c', - 'fill'=>'green', 'outline'=>'black', 'width'=>4, + 'fill'=>'green', 'outline'=>'black', 'width'=>4, 'tags'=>$tag_item ) TkcPolygon.new(cvs, '25c','4c','25c','4c','25c','1c','26c','1c','27c','4c', '28c','1c','29c','1c','29c','4c','29c','4c', 'fill'=>red, 'smooth'=>'on', 'tags'=> $tag_item) TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c', '28c','5.25c','24c','5.25c','24c','6.0c','26c','6c','26c', - '7.5c','22c','7.5c', + '7.5c','22c','7.5c', 'stipple'=>'@' + [$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator), 'outline'=>'black', 'tags'=>$tag_item ) @@ -168,7 +168,7 @@ TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c', TkcText.new(cvs, '5c', '8.2c', 'text'=>'Rectangles', 'anchor'=>'n') TkcRectangle.new(cvs, '1c','9.5c','4c','12.5c', 'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item) -TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c', +TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c', 'fill'=>green, 'tags'=>$tag_item ) TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'', 'stipple'=>'@'+[$demo_dir,'..', @@ -178,7 +178,7 @@ TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'', TkcText.new(cvs, '15c', '8.2c', 'text'=>'Ovals', 'anchor'=>'n') TkcOval.new(cvs, '11c','9.5c','14c','12.5c', 'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item) -TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c', +TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c', 'fill'=>green, 'tags'=>$tag_item ) TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', 'stipple'=>'@'+[$demo_dir,'..', @@ -187,40 +187,40 @@ TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', TkcText.new(cvs, '25c', '8.2c', 'text'=>'Text', 'anchor'=>'n') TkcRectangle.new(cvs, '22.4c','8.9c','22.6c','9.1c') -TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', +TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', 'text'=>'A short string of text, word-wrapped, justified left, and anchored north (at the top). The rectangles show the anchor points for each piece of text.', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '25.4c','10.9c','25.6c','11.1c') -TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, +TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, 'text'=>"Several lines,\n each centered\nindividually,\nand all anchored\nat the left edge.", 'justify'=>'center', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '24.9c','13.9c','25.1c','14.1c') if $tk_version =~ /^4\.[01]/ - TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, + TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, 'stipple'=>'@' + [$demo_dir, '..', 'images', 'grey.5'].join(File::Separator), 'text'=>'Stippled characters', 'tags'=>$tag_item ) else - TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, - 'stipple'=>'gray50', 'text'=>'Stippled characters', + TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, + 'stipple'=>'gray50', 'text'=>'Stippled characters', 'tags'=>$tag_item ) end TkcText.new(cvs, '5c', '16.2c', 'text'=>'Arcs', 'anchor'=>'n') -TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black', +TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black', 'start'=>45, 'extent'=>270, 'style'=>'pieslice', 'tags'=>$tag_item) -#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', -# 'outline'=>blue, 'start'=>135, 'extent'=>270, +#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', +# 'outline'=>blue, 'start'=>135, 'extent'=>270, # 'outlinestipple'=>'@' + ['images', 'grey.25'].join(File::Separator), # 'tags'=>$tag_item) -TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', - 'outline'=>blue, 'start'=>135, 'extent'=>270, +TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', + 'outline'=>blue, 'start'=>135, 'extent'=>270, 'outlinestipple'=>'@'+[$demo_dir, '..', 'images','gray25.xbm'].join(File::Separator), 'tags'=>$tag_item) -TkcArc.new(cvs, '0.5c','20c','9.5c','24c', 'width'=>'4m', 'style'=>'pieslice', - 'fill'=>'', 'outline'=>red, 'start'=>225, 'extent'=>90, +TkcArc.new(cvs, '0.5c','20c','9.5c','24c', 'width'=>'4m', 'style'=>'pieslice', + 'fill'=>'', 'outline'=>red, 'start'=>225, 'extent'=>90, 'tags'=>$tag_item) TkcArc.new(cvs, '5.5c','20.5c','9.5c','23.5c', 'width'=>'4m', 'style'=>'chord', - 'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270, + 'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270, 'tags'=>$tag_item) TkcText.new(cvs, '15c', '16.2c', 'text'=>'Bitmaps', 'anchor'=>'n') @@ -241,7 +241,7 @@ TkcBitmap.new(cvs, '17c','18.5c', #TkcBitmap.new(cvs, '17c','21.5c', # 'bitmap'=>'@' + ['images', 'letters'].join(File::Separator), # 'tags'=>$tag_item) -# +# TkcBitmap.new(cvs, '17c','21.5c') { bitmap '@' + [$demo_dir, '..', 'images', 'letters.xbm'].join(File::Separator) tags $tag_item @@ -255,17 +255,17 @@ TkcText.new(cvs, '25c', '16.2c', 'text'=>'Windows', 'anchor'=>'n') TkButton.new(cvs) {|b| text 'Press Me' command proc{butPress cvs, red} - TkcWindow.new(cvs, '21c','18c', + TkcWindow.new(cvs, '21c','18c', 'window'=>b, 'anchor'=>'nw', 'tags'=>$tag_item) } TkEntry.new(cvs, 'width'=>20, 'relief'=>'sunken') {|e| insert 'end', 'Edit this text' - TkcWindow.new(cvs, '21c','21c', + TkcWindow.new(cvs, '21c','21c', 'window'=>e, 'anchor'=>'nw', 'tags'=>$tag_item) } -TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c', +TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c', 'width'=>'.5c', 'tickinterval'=>0 ) {|scl| - TkcWindow.new(cvs, '28.5c','17.5c', + TkcWindow.new(cvs, '28.5c','17.5c', 'window'=>scl, 'anchor'=>'n', 'tags'=>$tag_item) } TkcText.new(cvs, '21c', '17.9c', 'text'=>'Button:', 'anchor'=>'sw') @@ -316,7 +316,7 @@ def itemLeave(c) $restoreCmd.call if $restoreCmd end -# Utility methods for stroking out a rectangle and printing what's +# Utility methods for stroking out a rectangle and printing what's # underneath the rectangle's area. def itemMark(c,x,y) @@ -330,7 +330,7 @@ def itemStroke(c,x,y) y = c.canvasy(y) if $areaX1 != x && $areaY1 != y c.delete 'area' - c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, + c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, '-outline', 'black') $areaX2 = x $areaY2 = y @@ -371,11 +371,11 @@ def itemDrag(c,x,y) $lastY = y end -# Method that's invoked when the button embedded in the canvas +# Method that's invoked when the button embedded in the canvas # is invoked. def butPress(w,color) - i = TkcText.new(w, '25c', '18.1c', + i = TkcText.new(w, '25c', '18.1c', 'text'=>'Ouch!!', 'fill'=>color, 'anchor'=>'n') Tk.after(500, proc{w.delete i}) end diff --git a/ext/tk/sample/demos-en/knightstour.rb b/ext/tk/sample/demos-en/knightstour.rb index 618fce5f02..6f96a5be10 100644 --- a/ext/tk/sample/demos-en/knightstour.rb +++ b/ext/tk/sample/demos-en/knightstour.rb @@ -155,16 +155,16 @@ class Knights_Tour frame = Ttk::Frame.new($knightstour) sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'knightstour'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'knightstour'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $knightstour.destroy $knightstour = nil - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) frame @@ -176,7 +176,7 @@ class Knights_Tour $knightstour.withdraw base_f = Ttk::Frame.new($knightstour) @board = Tk::Canvas.new(base_f, :width=>240, :height=>240) - @log = Tk::Text.new(base_f, :width=>12, :height=>1, + @log = Tk::Text.new(base_f, :width=>12, :height=>1, :font=>'Arial 8', :background=>'white') scr = @log.yscrollbar(Ttk::Scrollbar.new(base_f)) @@ -186,13 +186,13 @@ class Knights_Tour tool_f = Ttk::Frame.new($knightstour) label = Ttk::Label.new(tool_f, :text=>'Speed') - scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay, + scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay, :command=>proc{|n| set_delay(n)}) - check = Ttk::Checkbutton.new(tool_f, :text=>'Repeat', + check = Ttk::Checkbutton.new(tool_f, :text=>'Repeat', :variable=>@continuous) - @start_btn = Ttk::Button.new(tool_f, :text=>'Start', + @start_btn = Ttk::Button.new(tool_f, :text=>'Start', :command=>proc{tour()}) - @exit_btn = Ttk::Button.new(tool_f, :text=>'Exit', + @exit_btn = Ttk::Button.new(tool_f, :text=>'Exit', :command=>proc{_exit()}) 7.downto(0){|row| @@ -205,16 +205,16 @@ class Knights_Tour dfill = 'tan4' end coords = [col * 30 + 4, row * 30 + 4, col * 30 + 30, row * 30 + 30] - @board.create(TkcRectangle, coords, + @board.create(TkcRectangle, coords, :fill=>fill, :disabledfill=>dfill, :width=>2, :state=>:disabled) } } @knight_font = TkFont.new(:size=>-24) - @knight = TkcText.new(@board, 0, 0, :font=>@knight_font, - :text=>Tk::UTF8_String.new('\u265e'), - :anchor=>'nw', # :tags=>'knight', + @knight = TkcText.new(@board, 0, 0, :font=>@knight_font, + :text=>Tk::UTF8_String.new('\u265e'), + :anchor=>'nw', # :tags=>'knight', :fill=>'black', :activefill=>'#600000') @knight.coords(@board.coords(rand(64)+1)[0..1]) @knight.bind('ButtonPress-1', '%W %x %y'){|w,x,y| drag_start(w,x,y)} diff --git a/ext/tk/sample/demos-en/label.rb b/ext/tk/sample/demos-en/label.rb index 91e41e4a22..5be06eafee 100644 --- a/ext/tk/sample/demos-en/label.rb +++ b/ext/tk/sample/demos-en/label.rb @@ -8,11 +8,11 @@ # toplevel widget if defined?($label_demo) && $label_demo - $label_demo.destroy + $label_demo.destroy $label_demo = nil end -# demo toplevel widget +# demo toplevel widget $label_demo = TkToplevel.new {|w| title("Label Demonstration") iconname("label") @@ -21,7 +21,7 @@ $label_demo = TkToplevel.new {|w| base_frame = TkFrame.new($label_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '4i' @@ -30,7 +30,7 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -48,15 +48,15 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# label demo +# label demo f_left = TkFrame.new(base_frame) f_right = TkFrame.new(base_frame) -[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', +[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', 'padx'=>10, 'pady'=>10, 'fill'=>'both')} -# label +# label [ TkLabel.new(f_left, 'text'=>'First label'), - TkLabel.new(f_left, 'text'=>'Second label, raised', + TkLabel.new(f_left, 'text'=>'Second label, raised', 'relief'=>'raised'), TkLabel.new(f_left, 'text'=>'Third label, sunken', 'relief'=>'sunken') ].each{|w| w.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'anchor'=>'w')} diff --git a/ext/tk/sample/demos-en/labelframe.rb b/ext/tk/sample/demos-en/labelframe.rb index c912ff4c52..ad968bc061 100644 --- a/ext/tk/sample/demos-en/labelframe.rb +++ b/ext/tk/sample/demos-en/labelframe.rb @@ -7,7 +7,7 @@ if defined?($labelframe_demo) && $labelframe_demo - $labelframe_demo.destroy + $labelframe_demo.destroy $labelframe_demo = nil end @@ -20,8 +20,8 @@ $labelframe_demo = TkToplevel.new {|w| base_frame = TkFrame.new($labelframe_demo).pack(:fill=>:both, :expand=>true) # Some information -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top) Labelframes are used to group related widgets together. \ The label may be either plain text or another widget. \ @@ -45,17 +45,17 @@ TkFrame.new(base_frame){|f| } # Demo area -w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both, +w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both, :expand=>true) # A group of radiobuttons in a labelframe -TkLabelFrame.new(w, :text=>'Value', +TkLabelFrame.new(w, :text=>'Value', :padx=>2, :pady=>2) {|f| grid(:row=>0, :column=>0, :pady=>'2m', :padx=>'2m') v = TkVariable.new (1..4).each{|i| - TkRadiobutton.new(f, :text=>"This is value #{i}", + TkRadiobutton.new(f, :text=>"This is value #{i}", :variable=>v, :value=>i) { pack(:side=>:top, :fill=>:x, :pady=>2) } @@ -78,7 +78,7 @@ def lfEnableButtons(w) end TkLabelFrame.new(w, :pady=>2, :padx=>2){|f| - TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy, + TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy, :text=>"Use this option.", :padx=>0) {|cb| command proc{lfEnableButtons(f)} f.labelwidget(cb) diff --git a/ext/tk/sample/demos-en/mclist.rb b/ext/tk/sample/demos-en/mclist.rb index a849eba515..17019bb15b 100644 --- a/ext/tk/sample/demos-en/mclist.rb +++ b/ext/tk/sample/demos-en/mclist.rb @@ -6,7 +6,7 @@ # based on "Id: mclist.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($mclist_demo) && $mclist_demo - $mclist_demo.destroy + $mclist_demo.destroy $mclist_demo = nil end @@ -19,8 +19,8 @@ $mclist_demo = TkToplevel.new {|w| base_frame = TkFrame.new($mclist_demo).pack(:fill=>:both, :expand=>true) ## Explanatory text -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', - :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', + :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><<EOL).pack(:fill=>:x) Ttk is the new Tk themed widget set. \ One of the widgets it includes is a tree widget, \ @@ -36,23 +36,23 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'mclist'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'mclist'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $mclist_demo.destroy $mclist_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) } container = Ttk::Frame.new(base_frame) -tree = Ttk::Treeview.new(base_frame, :columns=>%w(country capital currency), +tree = Ttk::Treeview.new(base_frame, :columns=>%w(country capital currency), :show=>:headings) if Tk.windowingsystem != 'aqua' vsb = tree.yscrollbar(Ttk::Scrollbar.new(base_frame)) @@ -70,20 +70,20 @@ container.grid_rowconfigure(0, :weight=>1) ## The data we're going to insert data = [ - ['Argentina', 'Buenos Aires', 'ARS'], - ['Australia', 'Canberra', 'AUD'], - ['Brazil', 'Brazilia', 'BRL'], - ['Canada', 'Ottawa', 'CAD'], - ['China', 'Beijing', 'CNY'], - ['France', 'Paris', 'EUR'], - ['Germany', 'Berlin', 'EUR'], - ['India', 'New Delhi', 'INR'], - ['Italy', 'Rome', 'EUR'], - ['Japan', 'Tokyo', 'JPY'], - ['Mexico', 'Mexico City', 'MXN'], - ['Russia', 'Moscow', 'RUB'], - ['South Africa', 'Pretoria', 'ZAR'], - ['United Kingdom', 'London', 'GBP'], + ['Argentina', 'Buenos Aires', 'ARS'], + ['Australia', 'Canberra', 'AUD'], + ['Brazil', 'Brazilia', 'BRL'], + ['Canada', 'Ottawa', 'CAD'], + ['China', 'Beijing', 'CNY'], + ['France', 'Paris', 'EUR'], + ['Germany', 'Berlin', 'EUR'], + ['India', 'New Delhi', 'INR'], + ['Italy', 'Rome', 'EUR'], + ['Japan', 'Tokyo', 'JPY'], + ['Mexico', 'Mexico City', 'MXN'], + ['Russia', 'Moscow', 'RUB'], + ['South Africa', 'Pretoria', 'ZAR'], + ['United Kingdom', 'London', 'GBP'], ['United States', 'Washington, D.C.', 'USD'], ] @@ -91,7 +91,7 @@ data = [ font = Ttk::Style.lookup(tree[:style], :font) cols = %w(country capital currency) cols.zip(%w(Country Capital Currency)).each{|col, name| - tree.heading_configure(col, :text=>name, + tree.heading_configure(col, :text=>name, :command=>proc{sort_by(tree, col, false)}) tree.column_configure(col, :width=>TkFont.measure(font, name)) } @@ -109,8 +109,8 @@ data.each{|country, capital, currency| ## Code to do the sorting of the tree contents when clicked on def sort_by(tree, col, direction) - tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . - sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . + tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . + sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . each_with_index{|info, idx| tree.move(info[1], nil, idx)} tree.heading_configure(col, :command=>proc{sort_by(tree, col, ! direction)}) diff --git a/ext/tk/sample/demos-en/menu.rb b/ext/tk/sample/demos-en/menu.rb index bf6c22cb9d..a458dbbc14 100644 --- a/ext/tk/sample/demos-en/menu.rb +++ b/ext/tk/sample/demos-en/menu.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($menu_demo) && $menu_demo - $menu_demo.destroy + $menu_demo.destroy $menu_demo = nil end @@ -54,7 +54,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# menu +# menu TkMenubutton.new($menu_frame, 'text'=>'File', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|file_menu| @@ -86,8 +86,8 @@ TkMenubutton.new($menu_frame, 'text'=>'Basic', 'underline'=>0) {|m| m.configure('menu'=>basic_menu) add('command', 'label'=>'Long entry that does nothing') ['A','B','C','D','E','F','G'].each{|c| - add('command', 'label'=>"Print letter \"#{c}\"", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + add('command', 'label'=>"Print letter \"#{c}\"", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -98,17 +98,17 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|cascade_menu| m.configure('menu'=>cascade_menu) - add('command', 'label'=>'Print hello', - 'command'=>proc{print "Hello\n"}, + add('command', 'label'=>'Print hello', + 'command'=>proc{print "Hello\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu_demo.bind("#{modifier}-h", proc{print "Hello\n"}) - add('command', 'label'=>'Print goodbye', - 'command'=>proc{print "Goodbye\n"}, + add('command', 'label'=>'Print goodbye', + 'command'=>proc{print "Goodbye\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu_demo.bind("#{modifier}-g", proc{print "Goodbye\n"}) TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_check| - cascade_menu.add('cascade', 'label'=>'Check buttons', + cascade_menu.add('cascade', 'label'=>'Check buttons', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'Oil checked', 'variable'=>oil) @@ -119,18 +119,18 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| lights = TkVariable.new(0) add('check', 'label'=>'Lights checked', 'variable'=>lights) add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu_demo, - ['oil', oil], - ['trans', trans], - ['brakes', brakes], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu_demo, + ['oil', oil], + ['trans', trans], + ['brakes', brakes], ['lights', lights])} ) invoke 1 invoke 3 } TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_radio| - cascade_menu.add('cascade', 'label'=>'Radio buttons', + cascade_menu.add('cascade', 'label'=>'Radio buttons', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 point', 'variable'=>pointSize, 'value'=>10) @@ -144,9 +144,9 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| add('radio', 'label'=>'Bold', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'Italic', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu_demo, - ['pointSize', pointSize], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu_demo, + ['pointSize', pointSize], ['style', style])} ) invoke 1 invoke 7 @@ -158,15 +158,15 @@ TkMenubutton.new($menu_frame, 'text'=>'Icons', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|icon_menu| m.configure('menu'=>icon_menu) - add('command', + add('command', 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'The menu entry you invoked displays a bitmap rather than a text string. Other than this, it is just like any other menu entry.', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'Dismiss')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, + add('command', 'bitmap'=>icon, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } } @@ -178,7 +178,7 @@ TkMenubutton.new($menu_frame, 'text'=>'More', 'underline'=>0) {|m| m.configure('menu'=>more_menu) [ 'An entry','Another entry','Does nothing','Does almost nothing', 'Make life meaningful' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } } @@ -189,7 +189,7 @@ TkMenubutton.new($menu_frame, 'text'=>'Colors', 'underline'=>0) {|m| TkMenu.new(m) {|colors_menu| m.configure('menu'=>colors_menu) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } diff --git a/ext/tk/sample/demos-en/menu84.rb b/ext/tk/sample/demos-en/menu84.rb index 4029ce5541..4fc53962e7 100644 --- a/ext/tk/sample/demos-en/menu84.rb +++ b/ext/tk/sample/demos-en/menu84.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($menu84_demo) && $menu84_demo - $menu84_demo.destroy + $menu84_demo.destroy $menu84_demo = nil end @@ -36,9 +36,9 @@ TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') { menustatus = TkVariable.new(" ") TkFrame.new(base_frame) {|frame| - TkLabel.new(frame, 'textvariable'=>menustatus, 'relief'=>'sunken', - 'bd'=>1, 'font'=>['Helvetica', '10'], - 'anchor'=>'w').pack('side'=>'left', 'padx'=>2, + TkLabel.new(frame, 'textvariable'=>menustatus, 'relief'=>'sunken', + 'bd'=>1, 'font'=>['Helvetica', '10'], + 'anchor'=>'w').pack('side'=>'left', 'padx'=>2, 'expand'=>true, 'fill'=>'both') pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2) } @@ -92,8 +92,8 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Basic', 'menu'=>m, 'underline'=>0) add('command', 'label'=>'Long entry that does nothing') ['A','B','C','D','E','F','G'].each{|c| - add('command', 'label'=>"Print letter \"#{c}\"", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + add('command', 'label'=>"Print letter \"#{c}\"", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu84_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -101,17 +101,17 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Cascades', 'menu'=>m, 'underline'=>0) - add('command', 'label'=>'Print hello', - 'command'=>proc{print "Hello\n"}, + add('command', 'label'=>'Print hello', + 'command'=>proc{print "Hello\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu84_demo.bind("#{modifier}-h", proc{print "Hello\n"}) - add('command', 'label'=>'Print goodbye', - 'command'=>proc{print "Goodbye\n"}, + add('command', 'label'=>'Print goodbye', + 'command'=>proc{print "Goodbye\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu84_demo.bind("#{modifier}-g", proc{print "Goodbye\n"}) TkMenu.new(m, 'tearoff'=>false) {|cascade_check| - m.add('cascade', 'label'=>'Check buttons', + m.add('cascade', 'label'=>'Check buttons', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'Oil checked', 'variable'=>oil) @@ -122,18 +122,18 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| lights = TkVariable.new(0) add('check', 'label'=>'Lights checked', 'variable'=>lights) add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu84_demo, - ['oil', oil], - ['trans', trans], - ['brakes', brakes], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu84_demo, + ['oil', oil], + ['trans', trans], + ['brakes', brakes], ['lights', lights])} ) invoke 1 invoke 3 } TkMenu.new(m, 'tearoff'=>false) {|cascade_radio| - m.add('cascade', 'label'=>'Radio buttons', + m.add('cascade', 'label'=>'Radio buttons', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 point', 'variable'=>pointSize, 'value'=>10) @@ -147,9 +147,9 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| add('radio', 'label'=>'Bold', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'Italic', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu84_demo, - ['pointSize', pointSize], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu84_demo, + ['pointSize', pointSize], ['style', style])} ) invoke 1 invoke 7 @@ -158,15 +158,15 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Icons', 'menu'=>m, 'underline'=>0) - add('command', 'hidemargin'=>1, + add('command', 'hidemargin'=>1, 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'The menu entry you invoked displays a bitmap rather than a text string. Other than this, it is just like any other menu entry.', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'Dismiss')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, 'hidemargin'=>1, + add('command', 'bitmap'=>icon, 'hidemargin'=>1, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } @@ -177,19 +177,19 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'More', 'menu'=>m, 'underline'=>0) [ 'An entry','Another entry','Does nothing','Does almost nothing', 'Make life meaningful' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } - m.entryconfigure('Does almost nothing', - 'bitmap'=>'questhead', 'compound'=>'left', + m.entryconfigure('Does almost nothing', + 'bitmap'=>'questhead', 'compound'=>'left', 'command'=>proc{ - TkDialog.new('title'=>'Compound Menu Entry', + TkDialog.new('title'=>'Compound Menu Entry', 'message'=>'The menu entry you invoked'+ 'displays both a bitmap and '+ 'a text string. Other than '+ 'this, it isjust like any '+ - 'other menu entry.', + 'other menu entry.', 'buttons'=>['OK'], 'bitmap'=>'') }) } @@ -197,7 +197,7 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame) {|m| $menu84_frame.add('cascade', 'label'=>'Colors', 'menu'=>m, 'underline'=>0) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } diff --git a/ext/tk/sample/demos-en/menubu.rb b/ext/tk/sample/demos-en/menubu.rb index b37367e515..6e28e813b3 100644 --- a/ext/tk/sample/demos-en/menubu.rb +++ b/ext/tk/sample/demos-en/menubu.rb @@ -21,7 +21,7 @@ def optionMenu(menubutton, varName, firstValue, *rest) for i in rest menu.add 'radio', 'label'=>i, 'variable'=>varName end - + return menu end @@ -188,7 +188,7 @@ msg.pack('side'=>'top', 'padx'=>25, 'pady'=>25) TkFrame.new(center) {|f| menubuttonoptions = TkVariable.new mbutton = TkMenubutton.new(f) - options = optionMenu(mbutton, menubuttonoptions, + options = optionMenu(mbutton, menubuttonoptions, 'one', 'two', 'three') mbutton.pack('side'=>'left', 'padx'=>25, 'pady'=>25) paletteColor = TkVariable.new diff --git a/ext/tk/sample/demos-en/msgbox.rb b/ext/tk/sample/demos-en/msgbox.rb index 62b1f2b985..d3d66bfeb0 100644 --- a/ext/tk/sample/demos-en/msgbox.rb +++ b/ext/tk/sample/demos-en/msgbox.rb @@ -7,7 +7,7 @@ # toplevel widget if defined?($msgbox_demo) && $msgbox_demo - $msgbox_demo.destroy + $msgbox_demo.destroy $msgbox_demo = nil end @@ -49,9 +49,9 @@ TkFrame.new(base_frame) {|frame| # frame $msgbox_leftframe = TkFrame.new(base_frame) $msgbox_rightframe = TkFrame.new(base_frame) -$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') -$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') TkLabel.new($msgbox_leftframe, 'text'=>'Icon').pack('side'=>'top') @@ -60,9 +60,9 @@ TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ $msgboxIcon = TkVariable.new('info') ['error', 'info', 'question', 'warning'].each {|icon| - TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, - 'relief'=>'flat', 'value'=>icon, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, + 'relief'=>'flat', 'value'=>icon, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } @@ -71,20 +71,20 @@ TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ .pack('side'=>'top', 'fill'=>'x', 'expand'=>'no') $msgboxType = TkVariable.new('ok') -['abortretryignore', 'ok', 'okcancel', +['abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel'].each {|type| - TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, - 'relief'=>'flat', 'value'=>type, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, + 'relief'=>'flat', 'value'=>type, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } def showMessageBox(w) - button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, + button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, 'message'=>"This is a \"#{$msgboxType.value}\" type messagebox with the \"#{$msgboxIcon.value}\" icon") - Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, + Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"You have selected \"#{button}\"") end diff --git a/ext/tk/sample/demos-en/msgbox2.rb b/ext/tk/sample/demos-en/msgbox2.rb index 136a723c73..c227b59bb1 100644 --- a/ext/tk/sample/demos-en/msgbox2.rb +++ b/ext/tk/sample/demos-en/msgbox2.rb @@ -7,7 +7,7 @@ # toplevel widget if defined?($msgbox2_demo) && $msgbox2_demo - $msgbox2_demo.destroy + $msgbox2_demo.destroy $msgbox2_demo = nil end @@ -49,9 +49,9 @@ TkFrame.new(base_frame) {|frame| # frame $msgbox_leftframe = TkFrame.new(base_frame) $msgbox_rightframe = TkFrame.new(base_frame) -$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') -$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') TkLabel.new($msgbox_leftframe, 'text'=>'Icon').pack('side'=>'top') @@ -60,9 +60,9 @@ TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ $msgboxIcon = TkVariable.new('info') ['error', 'info', 'question', 'warning'].each {|icon| - TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, - 'relief'=>'flat', 'value'=>icon, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, + 'relief'=>'flat', 'value'=>icon, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } @@ -71,21 +71,21 @@ TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ .pack('side'=>'top', 'fill'=>'x', 'expand'=>'no') $msgboxType = TkVariable.new('ok') -['abortretryignore', 'ok', 'okcancel', +['abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel'].each {|type| - TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, - 'relief'=>'flat', 'value'=>type, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, + 'relief'=>'flat', 'value'=>type, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } def showMessageBox2(w) - button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, + button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, 'message'=>"\"#{$msgboxType.value}\" Type MessageBox", 'detail'=>"This is a \"#{$msgboxType.value}\" type messagebox with the \"#{$msgboxIcon.value}\" icon. Please click one of the following button.") - Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, + Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"You have selected \"#{button}\"") end diff --git a/ext/tk/sample/demos-en/paned1.rb b/ext/tk/sample/demos-en/paned1.rb index 26941b84a8..d3d66d1b16 100644 --- a/ext/tk/sample/demos-en/paned1.rb +++ b/ext/tk/sample/demos-en/paned1.rb @@ -6,7 +6,7 @@ # based on "Id: paned1.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp" if defined?($paned1_demo) && $paned1_demo - $paned1_demo.destroy + $paned1_demo.destroy $paned1_demo = nil end @@ -18,8 +18,8 @@ $paned1_demo = TkToplevel.new {|w| base_frame = TkFrame.new($paned1_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top) The sash between the two coloured windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.) If your Tk library linked to Ruby doesn't include a 'panedwindow', this demo doesn't work. Please use later version of Tk which supports a 'panedwindow'. @@ -40,7 +40,7 @@ TkFrame.new(base_frame){|f| } TkPanedwindow.new(base_frame, :orient=>:horizontal){|f| - add(Tk::Label.new(f, :text=>"This is the\nleft side", :bg=>'yellow'), + add(Tk::Label.new(f, :text=>"This is the\nleft side", :bg=>'yellow'), Tk::Label.new(f, :text=>"This is the\nright side", :bg=>'cyan')) pack(:side=>:top, :expand=>true, :fill=>:both, :pady=>2, :padx=>'2m') diff --git a/ext/tk/sample/demos-en/paned2.rb b/ext/tk/sample/demos-en/paned2.rb index 0e62013886..02293b0309 100644 --- a/ext/tk/sample/demos-en/paned2.rb +++ b/ext/tk/sample/demos-en/paned2.rb @@ -6,7 +6,7 @@ # based on "Id: paned2.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp" if defined?($paned2_demo) && $paned2_demo - $paned2_demo.destroy + $paned2_demo.destroy $paned2_demo = nil end @@ -18,8 +18,8 @@ $paned2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($paned2_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top) The sash between the two scrolled windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.) If your Tk library linked to Ruby doesn't include a 'panedwindow', this demo doesn't work. Please use later version of Tk which supports a 'panedwindow'. @@ -42,23 +42,23 @@ TkFrame.new(base_frame){|f| paneList = TkVariable.new # define as normal variable (not array) paneList.value = [ # ruby's array --> tcl's list 'List of Ruby/Tk Widgets', - 'TkButton', - 'TkCanvas', - 'TkCheckbutton', - 'TkEntry', - 'TkFrame', - 'TkLabel', - 'TkLabelframe', - 'TkListbox', - 'TkMenu', - 'TkMenubutton', - 'TkMessage', - 'TkPanedwindow', - 'TkRadiobutton', - 'TkScale', - 'TkScrollbar', - 'TkSpinbox', - 'TkText', + 'TkButton', + 'TkCanvas', + 'TkCheckbutton', + 'TkEntry', + 'TkFrame', + 'TkLabel', + 'TkLabelframe', + 'TkListbox', + 'TkMenu', + 'TkMenubutton', + 'TkMessage', + 'TkPanedwindow', + 'TkRadiobutton', + 'TkScale', + 'TkScrollbar', + 'TkSpinbox', + 'TkText', 'TkToplevel' ] @@ -69,13 +69,13 @@ TkPanedwindow.new(base_frame, :orient=>:vertical){|f| add(TkFrame.new(f){|paned2_top| TkListbox.new(paned2_top, :listvariable=>paneList) { # Invert the first item to highlight it - itemconfigure(0, :background=>self.cget(:foreground), + itemconfigure(0, :background=>self.cget(:foreground), :foreground=>self.cget(:background) ) - yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right, + yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right, :fill=>:y)) pack(:fill=>:both, :expand=>true) } - }, + }, TkFrame.new(f, :height=>120) {|paned2_bottom| # The bottom window is a text widget with scrollbar diff --git a/ext/tk/sample/demos-en/pendulum.rb b/ext/tk/sample/demos-en/pendulum.rb index 5f7d361170..306ac94a21 100644 --- a/ext/tk/sample/demos-en/pendulum.rb +++ b/ext/tk/sample/demos-en/pendulum.rb @@ -7,7 +7,7 @@ # destroy toplevel widget for this demo script if defined?($pendulum_demo) && $pendulum_demo - $pendulum_demo.destroy + $pendulum_demo.destroy $pendulum_demo = nil end @@ -59,14 +59,14 @@ class PendulumAnimationDemo # Create the canvas containing the graphical representation of the # simulated system. - @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white', + @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white', :borderwidth=>2, :relief=>:sunken) - TkcText.new(@c, 5, 5, :anchor=>:nw, + TkcText.new(@c, 5, 5, :anchor=>:nw, :text=>'Click to Adjust Bob Start Position') # Coordinates of these items don't matter; they will be set properly below @plate = TkcLine.new(@c, 0, 25, 320, 25, :width=>2, :fill=>'grey50') @rod = TkcLine.new(@c, 1, 1, 1, 1, :width=>3, :fill=>'black') - @bob = TkcOval.new(@c, 1, 1, 2, 2, + @bob = TkcOval.new(@c, 1, 1, 2, 2, :width=>3, :fill=>'yellow', :outline=>'black') TkcOval.new(@c, 155, 20, 165, 30, :fill=>'grey50', :outline=>'') @@ -76,22 +76,22 @@ class PendulumAnimationDemo # Create the canvas containing the phase space graph; this consists of # a line that gets gradually paler as it ages, which is an extremely # effective visual trick. - @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white', + @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white', :borderwidth=>2, :relief=>:sunken) @y_axis = TkcLine.new(@k, 160, 200, 160, 0, :fill=>'grey75', :arrow=>:last) @x_axis = TkcLine.new(@k, 0, 100, 320, 100, :fill=>'grey75', :arrow=>:last) @graph = {} 90.step(0, -10){|i| - # Coordinates of these items don't matter; + # Coordinates of these items don't matter; # they will be set properly below @graph[i] = TkcLine.new(@k, 0, 0, 1, 1, :smooth=>true, :fill=>"grey#{i}") } # labels - @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne, + @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne, :text=>'q', :font=>'Symbol 8') - @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne, + @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne, :text=>'dq', :font=>'Symbol 8') # pack @@ -109,19 +109,19 @@ class PendulumAnimationDemo # binding @c.bindtags_unshift(btag = TkBindTag.new) btag.bind('Destroy'){ @timer.stop } - btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x.to_i, y.to_i)}, + btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x.to_i, y.to_i)}, '%x %y') btag.bind('B1-Motion', proc{|x, y| showPendulum(x.to_i, y.to_i)}, '%x %y') - btag.bind('ButtonRelease-1', - proc{|x, y| showPendulum(x.to_i, y.to_i); @timer.start }, + btag.bind('ButtonRelease-1', + proc{|x, y| showPendulum(x.to_i, y.to_i); @timer.start }, '%x %y') btag.bind('Configure', proc{|w| @plate.coords(0, 25, w.to_i, 25)}, '%w') - @k.bind('Configure', proc{|h, w| + @k.bind('Configure', proc{|h, w| h = h.to_i w = w.to_i - @psh = h/2; + @psh = h/2; @psw = w/2 @x_axis.coords(2, @psh, w-2, @psh) @y_axis.coords(@psw, h-2, @psw, 2) @@ -142,9 +142,9 @@ class PendulumAnimationDemo end # This procedure makes the pendulum appear at the correct place on the - # canvas. If the additional arguments x, y are passed instead of computing - # the position of the pendulum from the length of the pendulum rod and its - # angle, the length and angle are computed in reverse from the given + # canvas. If the additional arguments x, y are passed instead of computing + # the position of the pendulum from the length of the pendulum rod and its + # angle, the length and angle are computed in reverse from the given # location (which is taken to be the centre of the pendulum bob.) def showPendulum(x=nil, y=nil) if x && y && (x != 160 || y != 25) diff --git a/ext/tk/sample/demos-en/plot.rb b/ext/tk/sample/demos-en/plot.rb index 628c9df584..f70daa3fb2 100644 --- a/ext/tk/sample/demos-en/plot.rb +++ b/ext/tk/sample/demos-en/plot.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($plot_demo) && $plot_demo - $plot_demo.destroy + $plot_demo.destroy $plot_demo = nil end @@ -22,7 +22,7 @@ $plot_demo = TkToplevel.new {|w| base_frame = TkFrame.new($plot_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 a canvas widget containing a simple 2-dimensional plot. You can doctor the data by dragging any of the points with mouse button 1."){ pack('side'=>'top') } @@ -45,55 +45,55 @@ $plot_buttons = TkFrame.new(base_frame) {|frame| } $plot_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# font +# font plotFont = '-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*' -# canvas +# canvas $plot_canvas = TkCanvas.new(base_frame,'relief'=>'raised','width'=>450,'height'=>300) $plot_canvas.pack('side'=>'top', 'fill'=>'x') -# plot +# plot TkcLine.new($plot_canvas, 100, 250, 400, 250, 'width'=>2) TkcLine.new($plot_canvas, 100, 250, 100, 50, 'width'=>2) -TkcText.new($plot_canvas, 225, 20, +TkcText.new($plot_canvas, 225, 20, 'text'=>"A Simple Plot", 'font'=>plotFont, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($plot_canvas, x, 250, x, 245, 'width'=>2) - TkcText.new($plot_canvas, x, 254, + TkcText.new($plot_canvas, x, 254, 'text'=>10*i, 'font'=>plotFont, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($plot_canvas, 100, y, 105, y, 'width'=>2) - TkcText.new($plot_canvas, 96, y, + TkcText.new($plot_canvas, 96, y, 'text'=>"#{i*50}.0", 'font'=>plotFont, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6, + item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end -$plot_canvas.itembind('point', 'Any-Enter', +$plot_canvas.itembind('point', 'Any-Enter', proc{$plot_canvas.itemconfigure 'current','fill','red'}) -$plot_canvas.itembind('point', 'Any-Leave', +$plot_canvas.itembind('point', 'Any-Leave', proc{$plot_canvas.itemconfigure 'current','fill','SkyBlue2'}) -$plot_canvas.itembind('point', '1', +$plot_canvas.itembind('point', '1', proc{|x,y| plotDown $plot_canvas,x,y}, "%x %y") -$plot_canvas.itembind('point', 'ButtonRelease-1', +$plot_canvas.itembind('point', 'ButtonRelease-1', proc{$plot_canvas.dtag 'selected'}) -$plot_canvas.bind('B1-Motion', +$plot_canvas.bind('B1-Motion', proc{|x,y| plotMove $plot_canvas,x,y}, "%x %y") $plot = {'lastX'=>0, 'lastY'=>0} # plotDown -- -# This method is invoked when the mouse is pressed over one of the +# This method is invoked when the mouse is pressed over one of the # data points. It sets up state to allow the point to be dragged. # # Arguments: diff --git a/ext/tk/sample/demos-en/puzzle.rb b/ext/tk/sample/demos-en/puzzle.rb index 43c61f519f..f16414aa4c 100644 --- a/ext/tk/sample/demos-en/puzzle.rb +++ b/ext/tk/sample/demos-en/puzzle.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($puzzle_demo) && $puzzle_demo - $puzzle_demo.destroy + $puzzle_demo.destroy $puzzle_demo = nil end @@ -70,7 +70,7 @@ end # depend_on_button_width = true depend_on_button_width = false - + s = TkScrollbar.new(base_frame) base = TkFrame.new(base_frame) { width frameWidth @@ -101,7 +101,7 @@ order = [3,1,6,2,5,7,15,13,4,11,8,9,14,10,12] if depend_on_button_width && (w.winfo_reqwidth * 4 > base.width) base.width = w.winfo_reqwidth * 4 end - }.place('relx'=>$xpos[num], 'rely'=>$ypos[num], + }.place('relx'=>$xpos[num], 'rely'=>$ypos[num], 'relwidth'=>0.25, 'relheight'=>0.25) } $xpos['space'] = 0.75 diff --git a/ext/tk/sample/demos-en/radio.rb b/ext/tk/sample/demos-en/radio.rb index 25cfac2134..bde31508e1 100644 --- a/ext/tk/sample/demos-en/radio.rb +++ b/ext/tk/sample/demos-en/radio.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($radio_demo) && $radio_demo - $radio_demo.destroy + $radio_demo.destroy $radio_demo = nil end @@ -21,7 +21,7 @@ $radio_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '4i' @@ -30,11 +30,11 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# size = TkVariable.new color = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -59,13 +59,13 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame +# frame f_left = TkFrame.new(base_frame) f_right = TkFrame.new(base_frame) f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') -# radiobutton +# radiobutton [10, 12, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "Point Size #{sz}" diff --git a/ext/tk/sample/demos-en/radio2.rb b/ext/tk/sample/demos-en/radio2.rb index 6c02aef0cf..72fc2c610c 100644 --- a/ext/tk/sample/demos-en/radio2.rb +++ b/ext/tk/sample/demos-en/radio2.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($radio2_demo) && $radio2_demo - $radio2_demo.destroy + $radio2_demo.destroy $radio2_demo = nil end @@ -21,7 +21,7 @@ $radio2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio2_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '5i' @@ -30,12 +30,12 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# size = TkVariable.new color = TkVariable.new align = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -55,24 +55,24 @@ TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'See Variables' command proc{ - showVars(base_frame, + showVars(base_frame, ['size', size], ['color', color], ['compound', align]) } }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame -f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', +# frame +f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', 'pady'=>2, 'padx'=>2) -f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', +f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', 'pady'=>2, 'padx'=>2) -f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', +f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', 'pady'=>2, 'padx'=>2) f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_mid.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') -# radiobutton +# radiobutton [10, 12, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "Point Size #{sz}" @@ -92,15 +92,15 @@ f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x') } -# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', -label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', 'compound'=>'left') label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top') label.height(TkWinfo.reqheight(label)) abtn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a| lower = a.downcase - TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', - 'value'=>lower, 'indicatoron'=>0, 'width'=>7, + TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', + 'value'=>lower, 'indicatoron'=>0, 'width'=>7, 'command'=>proc{label.compound(align.value)}) } diff --git a/ext/tk/sample/demos-en/radio3.rb b/ext/tk/sample/demos-en/radio3.rb index 9c9d75ef4a..8a147edda7 100644 --- a/ext/tk/sample/demos-en/radio3.rb +++ b/ext/tk/sample/demos-en/radio3.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($radio3_demo) && $radio3_demo - $radio3_demo.destroy + $radio3_demo.destroy $radio3_demo = nil end @@ -21,7 +21,7 @@ $radio3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio3_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '5i' @@ -35,50 +35,50 @@ size = TkVariable.new color = TkVariable.new align = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, ['size', size], + showVars(base_frame, ['size', size], ['color', color], ['compound', align]) - }), - TkButton.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'radio3'}), - TkButton.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + TkButton.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'radio3'}), + TkButton.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $radio3_demo $radio3_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) TkGrid(frame, :row=>3, :column=>0, :columnspan=>3, :sticky=>'nsew') } -# frame -f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', +# frame +f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', 'pady'=>2, 'padx'=>2) -f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', +f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', 'pady'=>2, 'padx'=>2) -f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', +f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', 'pady'=>2, 'padx'=>2) f_left .grid('column'=>0, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2) f_mid .grid('column'=>1, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2) f_right.grid('column'=>2, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c') -TkButton.new(base_frame, 'text'=>'Tristate', +TkButton.new(base_frame, 'text'=>'Tristate', 'command'=>proc{size.value = 'multi'; color.value = 'multi'}){ grid('column'=>2, 'row'=>2, 'pady'=>'.5c', 'padx'=>'.5c') } -# radiobutton +# radiobutton [10, 12, 14, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "Point Size #{sz}" @@ -101,14 +101,14 @@ TkButton.new(base_frame, 'text'=>'Tristate', }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x') } -# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', -label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', 'compound'=>'left') label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top') label.height(TkWinfo.reqheight(label)) a_btn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a| - TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', - 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7, + TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', + 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7, 'command'=>proc{label.compound(align.value)}) } diff --git a/ext/tk/sample/demos-en/ruler.rb b/ext/tk/sample/demos-en/ruler.rb index 26cd4f3b1c..a9773699f7 100644 --- a/ext/tk/sample/demos-en/ruler.rb +++ b/ext/tk/sample/demos-en/ruler.rb @@ -21,7 +21,7 @@ end # toplevel widget if defined?($ruler_demo) && $ruler_demo - $ruler_demo.destroy + $ruler_demo.destroy $ruler_demo = nil end @@ -35,7 +35,7 @@ $ruler_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ruler_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 canvas widget shows a mock-up of a ruler. You can create tab stops by dragging them out of the well to the right of the ruler. You can also drag existing tab stops. If you drag a tab stop far enough up or down so that it turns dim, it will be deleted when you release the mouse button."){ pack('side'=>'top') } @@ -58,14 +58,14 @@ $ruler_buttons = TkFrame.new(base_frame) {|frame| } $ruler_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# canvas +# canvas $ruler_canvas = TkCanvas.new(base_frame, 'width'=>'14.8c', 'height'=>'2.5c') $ruler_canvas.pack('side'=>'top', 'fill'=>'x') -# +# unless Struct.const_defined?("RulerInfo") - $demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y, - :top, :bottom, :size, :normalStyle, + $demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y, + :top, :bottom, :size, :normalStyle, :activeStyle, :deleteStyle).new end $demo_rulerInfo.grid = '.25c' @@ -77,17 +77,17 @@ $demo_rulerInfo.size = TkWinfo.fpixels($ruler_canvas, '.2c') $demo_rulerInfo.normalStyle = {'fill'=>'black'} if TkWinfo.depth($ruler_canvas) > 1 $demo_rulerInfo.activeStyle = {'fill'=>'red', 'stipple'=>''} - $demo_rulerInfo.deleteStyle = {'fill'=>'red', - 'stipple'=>'@'+[$demo_dir, '..', + $demo_rulerInfo.deleteStyle = {'fill'=>'red', + 'stipple'=>'@'+[$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator)} else $demo_rulerInfo.activeStyle = {'fill'=>'black', 'stipple'=>''} - $demo_rulerInfo.deleteStyle = {'fill'=>'black', - 'stipple'=>'@'+[$demo_dir, '..', + $demo_rulerInfo.deleteStyle = {'fill'=>'black', + 'stipple'=>'@'+[$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator)} end -TkcLine.new($ruler_canvas, +TkcLine.new($ruler_canvas, '1c', '0.5c', '1c', '1c', '13c', '1c', '13c', '0.5c', 'width'=>1) (0..11).each{|i| x = i+1 @@ -101,21 +101,21 @@ TkcLine.new($ruler_canvas, $rulerTag_well = TkcTag.new($ruler_canvas) $ruler_canvas\ .addtag_withtag($rulerTag_well, - TkcRectangle.new($ruler_canvas, - '13.2c', '1c', '13.8c', '0.5c', - 'outline'=>'black', + TkcRectangle.new($ruler_canvas, + '13.2c', '1c', '13.8c', '0.5c', + 'outline'=>'black', 'fill'=>($ruler_canvas\ .configinfo('background'))[4]) ) $ruler_canvas\ .addtag_withtag($rulerTag_well, - rulerMkTab($ruler_canvas, - TkWinfo.pixels($ruler_canvas, '13.5c'), + rulerMkTab($ruler_canvas, + TkWinfo.pixels($ruler_canvas, '13.5c'), TkWinfo.pixels($ruler_canvas, '.65c') ) ) $rulerTag_well.bind('1', proc{|x,y| rulerNewTab($ruler_canvas,x,y)}, '%x %y') -$ruler_canvas.itembind('tab', '1', +$ruler_canvas.itembind('tab', '1', proc{|x,y| rulerSelectTab($ruler_canvas,x,y)}, '%x %y') -$ruler_canvas.bind('B1-Motion', +$ruler_canvas.bind('B1-Motion', proc{|x,y| rulerMoveTab($ruler_canvas,x,y)}, '%x %y') $ruler_canvas.bind('Any-ButtonRelease-1', proc{rulerReleaseTab($ruler_canvas)}) diff --git a/ext/tk/sample/demos-en/sayings.rb b/ext/tk/sample/demos-en/sayings.rb index 06ec7c1e75..a4dcf37cdc 100644 --- a/ext/tk/sample/demos-en/sayings.rb +++ b/ext/tk/sample/demos-en/sayings.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($sayings_demo) && $sayings_demo - $sayings_demo.destroy + $sayings_demo.destroy $sayings_demo = nil end @@ -70,11 +70,11 @@ TkFrame.new(base_frame, 'borderwidth'=>10) {|w| sayings_lbox.pack('expand'=>'yes', 'fill'=>'y') else - sayings_lbox.grid('row'=>0, 'column'=>0, + sayings_lbox.grid('row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - sv.grid('row'=>0, 'column'=>1, + sv.grid('row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - sh.grid('row'=>1, 'column'=>0, + sh.grid('row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(w, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(w, 0, 'weight'=>1, 'minsize'=>0) diff --git a/ext/tk/sample/demos-en/search.rb b/ext/tk/sample/demos-en/search.rb index e1fc565e9d..7fb40d88b2 100644 --- a/ext/tk/sample/demos-en/search.rb +++ b/ext/tk/sample/demos-en/search.rb @@ -62,13 +62,13 @@ end def textToggle(cmd1,sleep1,cmd2,sleep2) sleep_list = [sleep2, sleep1] - TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, + TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, -1, cmd1, cmd2).start(sleep1) end # toplevel widget if defined?($search_demo) && $search_demo - $search_demo.destroy + $search_demo.destroy $search_demo = nil end @@ -101,35 +101,35 @@ $search_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame TkFrame.new(base_frame) {|f| - TkLabel.new(f, 'text'=>'File name:', + TkLabel.new(f, 'text'=>'File name:', 'width'=>13, 'anchor'=>'w').pack('side'=>'left') $search_fileName = TkVariable.new - TkEntry.new(f, 'width'=>40, + TkEntry.new(f, 'width'=>40, 'textvariable'=>$search_fileName) { pack('side'=>'left') bind('Return', proc{textLoadFile($search_text, $search_fileName.value) $search_string_entry.focus}) focus } - TkButton.new(f, 'text'=>'Load File', - 'command'=>proc{textLoadFile($search_text, + TkButton.new(f, 'text'=>'Load File', + 'command'=>proc{textLoadFile($search_text, $search_fileName.value)})\ .pack('side'=>'left', 'pady'=>5, 'padx'=>10) }.pack('side'=>'top', 'fill'=>'x') TkFrame.new(base_frame) {|f| - TkLabel.new(f, 'text'=>'Search string:', + TkLabel.new(f, 'text'=>'Search string:', 'width'=>13, 'anchor'=>'w').pack('side'=>'left') $search_searchString = TkVariable.new - $search_string_entry = TkEntry.new(f, 'width'=>40, + $search_string_entry = TkEntry.new(f, 'width'=>40, 'textvariable'=>$search_searchString) { pack('side'=>'left') - bind('Return', proc{textSearch($search_text, $search_searchString.value, + bind('Return', proc{textSearch($search_text, $search_searchString.value, $search_Tag)}) } - TkButton.new(f, 'text'=>'Highlight', - 'command'=>proc{textSearch($search_text, - $search_searchString.value, + TkButton.new(f, 'text'=>'Highlight', + 'command'=>proc{textSearch($search_text, + $search_searchString.value, $search_Tag)}) { pack('side'=>'left', 'pady'=>5, 'padx'=>10) } @@ -148,20 +148,20 @@ $search_text = TkText.new(base_frame, 'setgrid'=>true, 'wrap'=>'word') {|t| if TkWinfo.depth($search_demo) > 1 textToggle(proc{ - $search_Tag.configure('background'=>'#ce5555', + $search_Tag.configure('background'=>'#ce5555', 'foreground'=>'white') }, - 800, + 800, proc{ $search_Tag.configure('background'=>'', 'foreground'=>'') }, 200 ) else textToggle(proc{ - $search_Tag.configure('background'=>'black', + $search_Tag.configure('background'=>'black', 'foreground'=>'white') }, - 800, + 800, proc{ $search_Tag.configure('background'=>'', 'foreground'=>'') }, diff --git a/ext/tk/sample/demos-en/spin.rb b/ext/tk/sample/demos-en/spin.rb index c2a3a8949b..d51b7e6619 100644 --- a/ext/tk/sample/demos-en/spin.rb +++ b/ext/tk/sample/demos-en/spin.rb @@ -5,7 +5,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($spin_demo) && $spin_demo - $spin_demo.destroy + $spin_demo.destroy $spin_demo = nil end @@ -17,8 +17,8 @@ $spin_demo = TkToplevel.new {|w| base_frame = TkFrame.new($spin_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><<EOL).pack(:side=>:top) Three different spin-boxes are displayed below. \ You can add characters by pointing, clicking and typing. \ @@ -50,16 +50,16 @@ TkFrame.new(base_frame){|f| } australianCities = [ - 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', + 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', 'Hobart', 'Darwin', 'Alice Springs' ] [ - TkSpinbox.new(base_frame, :from=>1, :to=>10, :width=>10, :validate=>:key, + TkSpinbox.new(base_frame, :from=>1, :to=>10, :width=>10, :validate=>:key, :validatecommand=>[ proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' - ]), - TkSpinbox.new(base_frame, :from=>0, :to=>3, :increment=>0.5, - :format=>'%05.2f', :width=>10), + ]), + TkSpinbox.new(base_frame, :from=>0, :to=>3, :increment=>0.5, + :format=>'%05.2f', :width=>10), TkSpinbox.new(base_frame, :values=>australianCities, :width=>10) ].each{|sbox| sbox.pack(:side=>:top, :pady=>5, :padx=>10)} diff --git a/ext/tk/sample/demos-en/states.rb b/ext/tk/sample/demos-en/states.rb index add0e84800..a5c01a867c 100644 --- a/ext/tk/sample/demos-en/states.rb +++ b/ext/tk/sample/demos-en/states.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($states_demo) && $states_demo - $states_demo.destroy + $states_demo.destroy $states_demo = nil end @@ -63,16 +63,16 @@ TkFrame.new(base_frame, 'borderwidth'=>'.5c') {|w| }.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'y') ins_data = [ - 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', - 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', - 'Hawaii', 'Idaho', 'Illinois', - 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', - 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', - 'Montana', 'Nebraska', 'Nevada', 'New_Hampshire', 'New_Jersey', 'New_Mexico', - 'New_York', 'North_Carolina', 'North_Dakota', - 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode_Island', - 'South_Carolina', 'South_Dakota', - 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', + 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', + 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', + 'Hawaii', 'Idaho', 'Illinois', + 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', + 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', + 'Montana', 'Nebraska', 'Nevada', 'New_Hampshire', 'New_Jersey', 'New_Mexico', + 'New_York', 'North_Carolina', 'North_Dakota', + 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode_Island', + 'South_Carolina', 'South_Dakota', + 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West_Virginia', 'Wisconsin', 'Wyoming' ] diff --git a/ext/tk/sample/demos-en/style.rb b/ext/tk/sample/demos-en/style.rb index c2fed23926..5c8777379e 100644 --- a/ext/tk/sample/demos-en/style.rb +++ b/ext/tk/sample/demos-en/style.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($style_demo) && $style_demo - $style_demo.destroy + $style_demo.destroy $style_demo = nil end @@ -38,9 +38,9 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# text +# text txt = TkText.new(base_frame){|t| - # + # setgrid 'true' #width 70 #height 32 @@ -53,7 +53,7 @@ txt = TkText.new(base_frame){|t| } pack('expand'=>'yes', 'fill'=>'both') - # + # family = 'Courier' if $tk_version =~ /^4.*/ @@ -76,44 +76,44 @@ txt = TkText.new(base_frame){|t| # when /^8.*/ # unless $style_demo_do_first # $style_demo_do_first = true -# Tk.tk_call('font', 'create', '@bigascii', +# Tk.tk_call('font', 'create', '@bigascii', # '-copy', '-*-Courier-Bold-R-Normal--*-140-*-*-*-*-*-*') -# Tk.tk_call('font', 'create', '@smallascii', +# Tk.tk_call('font', 'create', '@smallascii', # '-copy', '-Adobe-Helvetica-Bold-R-Normal-*-100-*') -# Tk.tk_call('font', 'create', '@cBigFont', +# Tk.tk_call('font', 'create', '@cBigFont', # '-compound', '@bigascii @msg_knj') -# Tk.tk_call('font', 'create', '@cSmallFont', +# Tk.tk_call('font', 'create', '@cSmallFont', # '-compound', '@smallascii @kanji') # end # style_tag_big = TkTextTag.new(t, 'font'=>'@cBigFont') # style_tag_small = TkTextTag.new(t, 'font'=>'@cSmallFont') # end - # + # if TkWinfo.depth($root).to_i > 1 style_tag_color1 = TkTextTag.new(t, 'background'=>'#a0b7ce') style_tag_color2 = TkTextTag.new(t, 'foreground'=>'red') style_tag_raised = TkTextTag.new(t, 'relief'=>'raised', 'borderwidth'=>1) style_tag_sunken = TkTextTag.new(t, 'relief'=>'sunken', 'borderwidth'=>1) else - style_tag_color1 = TkTextTag.new(t, 'background'=>'black', + style_tag_color1 = TkTextTag.new(t, 'background'=>'black', 'foreground'=>'white') - style_tag_color2 = TkTextTag.new(t, 'background'=>'black', + style_tag_color2 = TkTextTag.new(t, 'background'=>'black', 'foreground'=>'white') - style_tag_raised = TkTextTag.new(t, 'background'=>'white', + style_tag_raised = TkTextTag.new(t, 'background'=>'white', 'relief'=>'raised', 'borderwidth'=>1) - style_tag_sunken = TkTextTag.new(t, 'background'=>'white', + style_tag_sunken = TkTextTag.new(t, 'background'=>'white', 'relief'=>'sunken', 'borderwidth'=>1) end - # + # if $tk_version =~ /^4\.[01]/ - style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', - 'borderwidth'=>0, + style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', + 'borderwidth'=>0, 'bgstipple'=>'gray25') else - style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', - 'borderwidth'=>0, + style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', + 'borderwidth'=>0, 'bgstipple'=>'gray12') end style_tag_fgstipple = TkTextTag.new(t, 'fgstipple'=>'gray50') @@ -134,7 +134,7 @@ txt = TkText.new(base_frame){|t| 'lmargin1'=>'12m', 'lmargin2'=>'6m', 'rmargin'=>'10m') - # + # insert('end', 'Text widgets like this one allow you to display information in a variety of styles. Display styles are controlled using a mechanism called ') diff --git a/ext/tk/sample/demos-en/text.rb b/ext/tk/sample/demos-en/text.rb index 3ce8cdfda8..5794a85e87 100644 --- a/ext/tk/sample/demos-en/text.rb +++ b/ext/tk/sample/demos-en/text.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($text_demo) && $text_demo - $text_demo.destroy + $text_demo.destroy $text_demo = nil end @@ -45,7 +45,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# text +# text TkText.new(base_frame){|t| relief 'sunken' bd 2 @@ -62,7 +62,7 @@ TkText.new(base_frame){|t| } pack('expand'=>'yes', 'fill'=>'both') - # + # insert('0.0', <<EOT) This window is a text widget. It displays one or more lines of text and allows you to edit the text. Here is a summary of the things you diff --git a/ext/tk/sample/demos-en/textpeer.rb b/ext/tk/sample/demos-en/textpeer.rb index c25ce15e5c..20192fcd05 100644 --- a/ext/tk/sample/demos-en/textpeer.rb +++ b/ext/tk/sample/demos-en/textpeer.rb @@ -4,7 +4,7 @@ # based on Tcl/Tk8.5.0 widget demos if defined?($textpeer_demo) && $textpeer_demo - $textpeer_demo.destroy + $textpeer_demo.destroy $textpeer_demo = nil end @@ -39,9 +39,9 @@ def makeClone(count, win, txt) peer = TkText::Peer.new(txt, win, :widgetname=>"text#{cnt}") sbar = TkScrollbar.new(win, :widgetname=>"sb#{cnt}") peer.yscrollbar sbar - b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", :text=>'Make Peer', + b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", :text=>'Make Peer', :command=>proc{makeClone(count, win, peer)}) - b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", :text=>'Delete Peer', + b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", :text=>'Delete Peer', :command=>proc{killClone(win, cnt)}) row = cnt * 2 TkGrid.configure(peer, sbar, b1, :sticky=>'nsew', :row=>row) @@ -51,7 +51,7 @@ def makeClone(count, win, txt) end def killClone(win, cnt) - Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", + Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", "#{win.path}.clone#{cnt}", "#{win.path}.kill#{cnt}") end diff --git a/ext/tk/sample/demos-en/toolbar.rb b/ext/tk/sample/demos-en/toolbar.rb index 633c52c15d..e7cbeb4235 100644 --- a/ext/tk/sample/demos-en/toolbar.rb +++ b/ext/tk/sample/demos-en/toolbar.rb @@ -5,7 +5,7 @@ # based on "Id: toolbar.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($toolbar_demo) && $toolbar_demo - $toolbar_demo.destroy + $toolbar_demo.destroy $toolbar_demo = nil end @@ -18,7 +18,7 @@ $toolbar_demo = TkToplevel.new {|w| base_frame = Ttk::Frame.new($toolbar_demo).pack(:fill=>:both, :expand=>true) if Tk.windowingsystem != 'aqua' - msg = Ttk::Label.new(base_frame, :wraplength=>'4i', + msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=>Tk::UTF8_String.new(<<EOL)) This is a demonstration of how to do \ a toolbar that is styled correctly \ @@ -32,7 +32,7 @@ toolbar is no longer needed, just close it like any normal toplevel \ and it will reattach to the window it was torn off from. EOL else - msg = Ttk::Label.new(base_frame, :wraplength=>'4i', + msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=>Tk::UTF8_String.new(<<EOL)) This is a demonstration of how to do \ a toolbar that is styled correctly. The buttons are configured to \ @@ -83,25 +83,25 @@ end text = TkText.new(base_frame, :width=>40, :height=>10) ## Toolbar contents -tb_btn = Ttk::Button.new(tbar_base, :text=>'Button', :style=>'Toolbutton', +tb_btn = Ttk::Button.new(tbar_base, :text=>'Button', :style=>'Toolbutton', :command=>proc{text.insert(:end, "Button Pressed\n")}) -tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'Check', :style=>'Toolbutton', - :variable=>(check = TkVariable.new), +tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'Check', :style=>'Toolbutton', + :variable=>(check = TkVariable.new), :command=>proc{ text.insert(:end, "Check is #{check.value}\n") }) tb_mbtn = Ttk::Menubutton.new(tbar_base, :text=>'Menu') -tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families, +tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families, :state=>:readonly) tb_mbtn.menu(menu = Tk::Menu.new(tb_mbtn)) menu.add(:command, :label=>'Just', :command=>proc{text.insert(:end, "Just\n")}) menu.add(:command, :label=>'An', :command=>proc{text.insert(:end, "An\n")}) -menu.add(:command, :label=>'Example', +menu.add(:command, :label=>'Example', :command=>proc{text.insert(:end, "Example\n")}) tb_combo.bind('<ComboboxSelected>'){ text.font.family = tb_combo.get } ## Arrange contents -Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, +Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, :in=>contents, :padx=>2, :sticky=>'ns') Tk.grid(tbar_base, :sticky=>'ew') Tk.grid(sep, :sticky=>'ew') @@ -114,16 +114,16 @@ base_frame.grid_columnconfigure(text, :weight=>1) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'toolbar'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'toolbar'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $toolbar_demo.destroy $toolbar_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) Tk.grid(frame, :sticky=>'ew') diff --git a/ext/tk/sample/demos-en/tree.rb b/ext/tk/sample/demos-en/tree.rb index 0c7f0e71a2..cd62ba8c9b 100644 --- a/ext/tk/sample/demos-en/tree.rb +++ b/ext/tk/sample/demos-en/tree.rb @@ -6,7 +6,7 @@ # based on "Id: tree.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp" if defined?($tree_demo) && $tree_demo - $tree_demo.destroy + $tree_demo.destroy $tree_demo = nil end @@ -19,8 +19,8 @@ $tree_demo = TkToplevel.new {|w| base_frame = TkFrame.new($tree_demo).pack(:fill=>:both, :expand=>true) ## Explanatory text -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', - :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', + :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><<EOL).pack(:fill=>:x) Ttk is the new Tk themed widget set. \ One of the widgets it includes is a tree widget, \ @@ -37,16 +37,16 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'tree'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'tree'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $tree_demo.destroy $tree_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -55,7 +55,7 @@ Ttk::Frame.new(base_frame) {|frame| ## Code to populate the roots of the tree (can be more than one on Windows) def populate_roots(tree) TkComm.simplelist(Tk.tk_call('file', 'volumes')).sort.each{|dir| - populate_tree(tree, tree.insert(nil, :end, :text=>dir, + populate_tree(tree, tree.insert(nil, :end, :text=>dir, :values=>[dir, 'directory'])) } end @@ -68,7 +68,7 @@ def populate_tree(tree, node) tree.delete(tree.children(node)) Dir.glob("#{path}/*").sort.each{|f| type = File.ftype(f) - id = tree.insert(node, :end, + id = tree.insert(node, :end, :text=>File.basename(f), :values=>[f, type]).id if type == 'directory' ## Make it so that this node is openable @@ -94,7 +94,7 @@ def populate_tree(tree, node) end ## Create the tree and set it up -tree = Ttk::Treeview.new(base_frame, :columns=>%w(fullpath type size), +tree = Ttk::Treeview.new(base_frame, :columns=>%w(fullpath type size), :displaycolumns=>['size']) if Tk.windowingsystem != 'aqua' vsb = tree.yscrollbar(Ttk::Scrollbar.new(base_frame)) diff --git a/ext/tk/sample/demos-en/ttkbut.rb b/ext/tk/sample/demos-en/ttkbut.rb index b5780f589a..a784efcc08 100644 --- a/ext/tk/sample/demos-en/ttkbut.rb +++ b/ext/tk/sample/demos-en/ttkbut.rb @@ -7,7 +7,7 @@ # based on "Id: ttkbut.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp" if defined?($ttkbut_demo) && $ttkbut_demo - $ttkbut_demo.destroy + $ttkbut_demo.destroy $ttkbut_demo = nil end @@ -19,7 +19,7 @@ $ttkbut_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkbut_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top, :fill=>:x) Ttk is the new Tk themed widget set. This is a Ttk themed label, \ and below are three groups of Ttk widgets in Ttk labelframes. \ @@ -34,11 +34,11 @@ EOL ## Add buttons for setting the theme buttons = Ttk::Labelframe.new(base_frame, :text=>'Buttons') # Ttk::Style.theme_names.each{|theme| -# Ttk::Button.new(buttons, :text=>theme, +# Ttk::Button.new(buttons, :text=>theme, # :command=>proc{Ttk::Style.theme_use theme}).pack(:pady=>2) # } Ttk.themes.each{|theme| - Ttk::Button.new(buttons, :text=>theme, + Ttk::Button.new(buttons, :text=>theme, :command=>proc{Ttk.set_theme theme}).pack(:pady=>2) } @@ -62,9 +62,9 @@ end ## Set up the checkbutton group checks = Ttk::Labelframe.new(base_frame, :text=>'Checkbuttons') enabled = TkVariable.new(true) -e = Ttk::Checkbutton.new(checks, :text=>'Enabled', :variable=>enabled, +e = Ttk::Checkbutton.new(checks, :text=>'Enabled', :variable=>enabled, :command=>proc{ - setState($ttkbut_demo, + setState($ttkbut_demo, ((enabled.bool)? "!disabled" : "disabled"), e) }) @@ -90,15 +90,15 @@ radios = Ttk::Labelframe.new(base_frame, :text=>'Radiobuttons') happyness = TkVariable.new -r1 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r1 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Great', :value=>'great') -r2 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r2 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Good', :value=>'good') -r3 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r3 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Ok', :value=>'ok') -r4 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r4 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Poor', :value=>'poor') -r5 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r5 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Awful', :value=>'awful') Tk.pack(r1, r2, r3, r4, r5, :fill=>:x, :padx=>3, :pady=>2) @@ -107,26 +107,26 @@ Tk.pack(r1, r2, r3, r4, r5, :fill=>:x, :padx=>3, :pady=>2) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, ['enabled', enabled], - ['cheese', cheese], ['tomato', tomato], - ['basil', basil], ['oregano', oregano], + showVars(base_frame, ['enabled', enabled], + ['cheese', cheese], ['tomato', tomato], + ['basil', basil], ['oregano', oregano], ['happyness', happyness]) - }), - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkbut'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkbut'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $ttkbut_demo $ttkbut_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x, :expand=>true) diff --git a/ext/tk/sample/demos-en/ttkmenu.rb b/ext/tk/sample/demos-en/ttkmenu.rb index 75ecdb09c4..9399568313 100644 --- a/ext/tk/sample/demos-en/ttkmenu.rb +++ b/ext/tk/sample/demos-en/ttkmenu.rb @@ -6,7 +6,7 @@ # based on "Id: ttkmenu.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkmenu_demo) && $ttkmenu_demo - $ttkmenu_demo.destroy + $ttkmenu_demo.destroy $ttkmenu_demo = nil end @@ -18,7 +18,7 @@ $ttkmenu_demo = TkToplevel.new {|w| base_frame = Ttk::Frame.new($ttkmenu_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top, :fill=>:x) Ttk is the new Tk themed widget set, \ and one widget that is available in themed form is the menubutton. \ @@ -39,16 +39,16 @@ Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x) Ttk::Frame.new($ttkmenu_demo) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkmenu'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkmenu'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkmenu_demo.destroy $ttkmenu_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) diff --git a/ext/tk/sample/demos-en/ttknote.rb b/ext/tk/sample/demos-en/ttknote.rb index c2a22b447a..bc0c7b369a 100644 --- a/ext/tk/sample/demos-en/ttknote.rb +++ b/ext/tk/sample/demos-en/ttknote.rb @@ -6,7 +6,7 @@ # based on "Id: ttknote.tcl,v 1.5 2007/12/13 15:27:07 dgp Exp" if defined?($ttknote_demo) && $ttknote_demo - $ttknote_demo.destroy + $ttknote_demo.destroy $ttknote_demo = nil end @@ -20,16 +20,16 @@ $ttknote_demo = TkToplevel.new {|w| Ttk::Frame.new($ttknote_demo) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttknote'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttknote'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttknote_demo.destroy $ttknote_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -38,13 +38,13 @@ Ttk::Frame.new($ttknote_demo) {|frame| base_frame = Ttk::Frame.new($ttknote_demo).pack(:fill=>:both, :expand=>true) ## Make the notebook and set up Ctrl+Tab traversal -notebook = Ttk::Notebook.new(base_frame).pack(:fill=>:both, :expand=>true, +notebook = Ttk::Notebook.new(base_frame).pack(:fill=>:both, :expand=>true, :padx=>2, :pady=>3) notebook.enable_traversal ## Popuplate the first pane f_msg = Ttk::Frame.new(notebook) -msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'4i', +msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'4i', :justify=>:left, :anchor=>'n', :text=><<EOL) Ttk is the new Tk themed widget set. \ One of the widgets it includes is the notebook widget, \ @@ -58,7 +58,7 @@ Note that the second tab is disabled, and cannot be selected. EOL neat = TkVariable.new after_id = nil -msg_b = Ttk::Button.new(f_msg, :text=>'Neat!', :underline=>0, +msg_b = Ttk::Button.new(f_msg, :text=>'Neat!', :underline=>0, :command=>proc{ neat.value = 'Yeah, I know...' Tk.after_cancel(after_id) if after_id diff --git a/ext/tk/sample/demos-en/ttkpane.rb b/ext/tk/sample/demos-en/ttkpane.rb index 56df613db4..87c4dedeb2 100644 --- a/ext/tk/sample/demos-en/ttkpane.rb +++ b/ext/tk/sample/demos-en/ttkpane.rb @@ -5,7 +5,7 @@ # based on "Id: ttkpane.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkpane_demo) && $ttkpane_demo - $ttkpane_demo.destroy + $ttkpane_demo.destroy $ttkpane_demo = nil end @@ -17,7 +17,7 @@ $ttkpane_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkpane_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top, :fill=>:x) This demonstration shows off a nested set of themed paned windows. \ Their sizes can be changed by grabbing the area \ @@ -30,16 +30,16 @@ Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkpane'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkpane'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkpane_demo.destroy $ttkpane_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -59,25 +59,25 @@ if Tk.windowingsystem == 'aqua' end # Fill the button pane -Ttk::Button.new(left_top, :text=>'Press Me', +Ttk::Button.new(left_top, :text=>'Press Me', :command=>proc{ - Tk.messageBox(:type=>'ok', :icon=>'info', :message=>'Ouch!', - :detail=>'That hurt...', :parent=>base_frame, + Tk.messageBox(:type=>'ok', :icon=>'info', :message=>'Ouch!', + :detail=>'That hurt...', :parent=>base_frame, :title=>'Button Pressed') }).pack(:padx=>2, :pady=>5) zones_list = [ - [':Europe/Berlin'], - [':America/Argentina/Buenos_Aires', ':America/Buenos_Aires'], - [':Africa/Johannesburg'], - [':Europe/London'], - [':America/Los_Angeles'], + [':Europe/Berlin'], + [':America/Argentina/Buenos_Aires', ':America/Buenos_Aires'], + [':Africa/Johannesburg'], + [':Europe/London'], + [':America/Los_Angeles'], [':Europe/Moscow'], - [':America/New_York'], - [':Asia/Singapore'], - [':Australia/Sydney'], - [':Asia/Tokyo'], + [':America/New_York'], + [':Asia/Singapore'], + [':Australia/Sydney'], + [':Asia/Tokyo'], ] zones = [] @@ -155,7 +155,7 @@ time = TkVariable.new_hash case tzinfo when :tcl update_proc = proc{|now, tz, label| - time[label] = Tk.tk_call('clock', 'format', now.tv_sec, + time[label] = Tk.tk_call('clock', 'format', now.tv_sec, '-timezone', tz, '-format', '%T') } when :tzinfo @@ -176,7 +176,7 @@ end zones.each_with_index{|(zone, label), idx| Ttk::Separator.new(left_bot).pack(:fill=>:x) if idx > 0 Ttk::Label.new(left_bot, :text=>label, :anchor=>'w').pack(:fill=>:x) - Ttk::Label.new(left_bot, :textvariable=>time.ref(label), + Ttk::Label.new(left_bot, :textvariable=>time.ref(label), :anchor=>'w').pack(:fill=>:x) } diff --git a/ext/tk/sample/demos-en/ttkprogress.rb b/ext/tk/sample/demos-en/ttkprogress.rb index 3eb9a64a4a..c341a9385f 100644 --- a/ext/tk/sample/demos-en/ttkprogress.rb +++ b/ext/tk/sample/demos-en/ttkprogress.rb @@ -5,7 +5,7 @@ # based on "Id: ttkprogress.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkprogress_demo) && $ttkprogress_demo - $ttkprogress_demo.destroy + $ttkprogress_demo.destroy $ttkprogress_demo = nil end @@ -17,7 +17,7 @@ $ttkprogress_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkprogress_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=>Tk::UTF8_String.new(<<EOL)).pack(:side=>:top, :fill=>:x) Below are two progress bars. \ The top one is a \\u201Cdeterminate\\u201D progress bar, \ @@ -32,16 +32,16 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkprogress'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkprogress'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkprogress_demo.destroy $ttkprogress_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -52,9 +52,9 @@ frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true) p1 = Ttk::Progressbar.new(frame, :mode=>:determinate) p2 = Ttk::Progressbar.new(frame, :mode=>:indeterminate) -start = Ttk::Button.new(frame, :text=>'Start Progress', +start = Ttk::Button.new(frame, :text=>'Start Progress', :command=>proc{ p1.start; p2.start }) -stop = Ttk::Button.new(frame, :text=>'Stop Progress', +stop = Ttk::Button.new(frame, :text=>'Stop Progress', :command=>proc{ p1.stop; p2.stop }) Tk.grid(p1, '-', :pady=>5, :padx=>10) diff --git a/ext/tk/sample/demos-en/twind.rb b/ext/tk/sample/demos-en/twind.rb index 65ee712ff7..60a345d0b4 100644 --- a/ext/tk/sample/demos-en/twind.rb +++ b/ext/tk/sample/demos-en/twind.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($twind_demo) && $twind_demo - $twind_demo.destroy + $twind_demo.destroy $twind_demo = nil end @@ -41,10 +41,10 @@ $twind_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame $twind_text = nil -TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, +TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, 'relief'=>'sunken') {|f| - $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font, - 'width'=>'70', 'height'=>35, 'wrap'=>'word', + $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font, + 'width'=>'70', 'height'=>35, 'wrap'=>'word', 'highlightthickness'=>0, 'borderwidth'=>0 ){|t| TkScrollbar.new(f) {|s| command proc{|*args| t.yview(*args)} @@ -53,12 +53,12 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, }.pack('expand'=>'yes', 'fill'=>'both') }.pack('expand'=>'yes', 'fill'=>'both') -# -$tag_center = TkTextTag.new($twind_text, +# +$tag_center = TkTextTag.new($twind_text, 'justify' =>'center', 'spacing1'=>'5m', 'spacing3'=>'5m' ) -$tag_buttons = TkTextTag.new($twind_text, +$tag_buttons = TkTextTag.new($twind_text, 'lmargin1'=>'1c', 'lmargin2'=>'1c', 'rmargin' =>'1c', @@ -71,7 +71,7 @@ $twind_text.insert('end', "it. These are called \"embedded windows\", ") $twind_text.insert('end', "and they can consist of arbitrary widgets. ") $twind_text.insert('end', "For example, here are two embedded button ") $twind_text.insert('end', "widgets. You can click on the first button to ") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { #text 'ON' text 'Turn On' @@ -81,7 +81,7 @@ TkTextWindow.new($twind_text, 'end', $twind_text.insert('end', " horizontal scrolling, which also turns off ") $twind_text.insert('end', "word wrapping. Or, you can click on the second ") $twind_text.insert('end', "button to\n") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { #text 'OFF' text 'Turn Off' @@ -91,7 +91,7 @@ TkTextWindow.new($twind_text, 'end', $twind_text.insert('end', " horizontal scrolling and turn back on word wrapping.\n\n") $twind_text.insert('end', "Or, here is another example. If you ") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text 'Click Here' command proc{textWindPlot $twind_text} @@ -102,7 +102,7 @@ $mark_plot = TkTextMark.new($twind_text, 'insert') $mark_plot.gravity='left' $twind_text.insert('end', " You can drag the data points around with the mouse, ") $twind_text.insert('end', "or you can click here to ") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text 'Delete' command proc{textWindDel $twind_text} @@ -124,7 +124,7 @@ $twind_text.insert('end', "changes the layout. Click on the button again ") $twind_text.insert('end', "to restore the short string.\n") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) {|b| text 'Default' command proc{embDefBg $twind_text} @@ -133,7 +133,7 @@ TkTextWindow.new($twind_text, 'end', }, 'padx'=>3 ) embToggle = TkVariable.new('Short') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkCheckButton.new($twind_text) { textvariable embToggle indicatoron 0 @@ -144,25 +144,25 @@ TkTextWindow.new($twind_text, 'end', pady 5 padx 2 }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) -[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', - 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', - 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', - 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' +[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', + 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', + 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', + 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' ].each{|twind_color| - TkTextWindow.new($twind_text, 'end', + TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text twind_color cursor 'top_left_arrow' command proc{$twind_text.bg twind_color} }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) } -# +# def textWindOn (w,f) if defined? $twind_scroll begin @@ -216,39 +216,39 @@ def textWindPlot (t) TkcLine.new($twind_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind_plot, 100, 250, 100, 50, 'width'=>2) - TkcText.new($twind_plot, 225, 20, + TkcText.new($twind_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind_plot, x, 250, x, 245, 'width'=>2) - TkcText.new($twind_plot, x, 254, + TkcText.new($twind_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind_plot, 100, y, 105, y, 'width'=>2) - TkcText.new($twind_plot, 96, y, + TkcText.new($twind_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, + item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end - $twind_plot.itembind('point', 'Any-Enter', + $twind_plot.itembind('point', 'Any-Enter', proc{$twind_plot.itemconfigure 'current', 'fill', 'red'}) - $twind_plot.itembind('point', 'Any-Leave', + $twind_plot.itembind('point', 'Any-Leave', proc{$twind_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) - $twind_plot.itembind('point', '1', + $twind_plot.itembind('point', '1', proc{|x,y| embPlotDown $twind_plot,x,y}, "%x %y") - $twind_plot.itembind('point', 'ButtonRelease-1', + $twind_plot.itembind('point', 'ButtonRelease-1', proc{$twind_plot.dtag 'selected'}) - $twind_plot.bind('B1-Motion', + $twind_plot.bind('B1-Motion', proc{|x,y| embPlotMove $twind_plot,x,y}, "%x %y") while ($twind_text.get($mark_plot) =~ /[ \t\n]/) $twind_text.delete $mark_plot diff --git a/ext/tk/sample/demos-en/twind2.rb b/ext/tk/sample/demos-en/twind2.rb index 43990c1151..af7313dd82 100644 --- a/ext/tk/sample/demos-en/twind2.rb +++ b/ext/tk/sample/demos-en/twind2.rb @@ -4,7 +4,7 @@ # delete toplevel widget if defined?($twind2_demo) && $twind2_demo - $twind2_demo.destroy + $twind2_demo.destroy $twind2_demo = nil end @@ -19,20 +19,20 @@ base_frame = TkFrame.new($twind2_demo).pack(:fill=>:both, :expand=>true) # frame $twind2_buttons = TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'twind2'}), - TkButton.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'twind2'}), + TkButton.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $twind2_demo $twind2_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) } @@ -40,11 +40,11 @@ $twind2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame $twind2_text = nil -TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, +TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, 'relief'=>'sunken') {|f| $twind2_text = TkText.new(f, 'setgrid'=>true, 'font'=>$font, - # 'width'=>'70', 'height'=>35, 'wrap'=>'word', - 'width'=>'70', 'height'=>35, 'wrap'=>'char', + # 'width'=>'70', 'height'=>35, 'wrap'=>'word', + 'width'=>'70', 'height'=>35, 'wrap'=>'char', 'highlightthickness'=>0, 'borderwidth'=>0 ){|t| TkScrollbar.new(f) {|s| command proc{|*args| t.yview(*args)} @@ -54,11 +54,11 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, }.pack('expand'=>'yes', 'fill'=>'both') # text tags -$tag2_center = TkTextTag.new($twind2_text, +$tag2_center = TkTextTag.new($twind2_text, 'justify' =>'center', 'spacing1'=>'5m', 'spacing3'=>'5m' ) -$tag2_buttons = TkTextTag.new($twind2_text, +$tag2_buttons = TkTextTag.new($twind2_text, 'lmargin1'=>'1c', 'lmargin2'=>'1c', 'rmargin' =>'1c', @@ -67,7 +67,7 @@ $tag2_buttons = TkTextTag.new($twind2_text, 'spacing3'=>0 ) # insert text -$twind2_text.insert('end', +$twind2_text.insert('end', 'A text widget can contain many different kinds of items, ') $twind2_text.insert('end', "both active and passive. It can lay these out in various ") @@ -82,7 +82,7 @@ $twind2_text.insert('end', "it. These are called \"embedded windows\", ") $twind2_text.insert('end', "and they can consist of arbitrary widgets. ") $twind2_text.insert('end', "For example, here are two embedded button ") $twind2_text.insert('end', "widgets. You can click on the first button to ") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'ON' command proc{textWindOn2 $twind2_text,$twind2_buttons} @@ -91,30 +91,30 @@ TkTextWindow.new($twind2_text, 'end', $twind2_text.insert('end', " horizontal scrolling, which also turns off ") $twind2_text.insert('end', "word wrapping. Or, you can click on the second ") $twind2_text.insert('end', "button to\n") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'OFF' command proc{textWindOff2 $twind2_text} cursor 'top_left_arrow' }) -$twind2_text.insert('end', +$twind2_text.insert('end', " horizontal scrolling and turn back on word wrapping.\n\n") $twind2_text.insert('end', "Or, here is another example. If you ") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'Click Here' command proc{textWindPlot2 $twind2_text} cursor 'top_left_arrow' }) -$twind2_text.insert('end', +$twind2_text.insert('end', " a canvas displaying an x-y plot will appear right here.") $mark2_plot = TkTextMark.new($twind2_text, 'insert') $mark2_plot.gravity='left' -$twind2_text.insert('end', +$twind2_text.insert('end', " You can drag the data points around with the mouse, ") $twind2_text.insert('end', "or you can click here to ") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'Delete' command proc{textWindDel2 $twind2_text} @@ -122,19 +122,19 @@ TkTextWindow.new($twind2_text, 'end', }) $twind2_text.insert('end', " the plot again.\n\n") -$twind2_text.insert('end', +$twind2_text.insert('end', "You may also find it useful to put embedded windows in ") -$twind2_text.insert('end', +$twind2_text.insert('end', "a text without any actual text. In this case the ") $twind2_text.insert('end', "text widget acts like a geometry manager. For ") -$twind2_text.insert('end', +$twind2_text.insert('end', "example, here is a collection of buttons laid out ") -$twind2_text.insert('end', +$twind2_text.insert('end', "neatly into rows by the text widget. These buttons ") -$twind2_text.insert('end', +$twind2_text.insert('end', "can be used to change the background color of the ") $twind2_text.insert('end', "text widget (\"Default\" restores the color to ") -$twind2_text.insert('end', +$twind2_text.insert('end', "its default). If you click on the button labeled ") $twind2_text.insert('end', "\"Short\", it changes to a longer string so that ") $twind2_text.insert('end', "you can see how the text widget automatically ") @@ -148,7 +148,7 @@ btn_default = TkButton.new($twind2_text) {|b| } TkTextWindow.new($twind2_text, 'end', 'window'=>btn_default, 'padx'=>3) embToggle = TkVariable.new('Short') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkCheckButton.new($twind2_text) { textvariable embToggle indicatoron 0 @@ -159,21 +159,21 @@ TkTextWindow.new($twind2_text, 'end', pady 5 padx 2 }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) -[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', - 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', - 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', - 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' +[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', + 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', + 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', + 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' ].each{|twind_color| - TkTextWindow.new($twind2_text, 'end', + TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text twind_color cursor 'top_left_arrow' command proc{$twind2_text.bg twind_color} }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) } @@ -187,54 +187,54 @@ $text_normal2['pad'] = $twind2_text.cget('padx') $twind2_text.insert('end', "\nYou can also change the usual border width and ") $twind2_text.insert('end', "highlightthickness and padding.\n") -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big borders", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big borders", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigB2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Small borders", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Small borders", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallB2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big highlight", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big highlight", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigH2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text, :text=>"Small highlight", - :cursor=>'top_left_arrow', + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallH2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big pad", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big pad", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigP2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Small pad", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Small pad", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallP2 $twind2_text })) -$twind2_text.insert('end', +$twind2_text.insert('end', "\n\nFinally, images fit comfortably in text widgets too:") -TkTextImage.new($twind2_text, 'end', +TkTextImage.new($twind2_text, 'end', 'image'=>TkBitmapImage.new(:file=>[ - $demo_dir, '..', + $demo_dir, '..', 'images', 'face.xbm' ].join(File::Separator))) @@ -309,39 +309,39 @@ def textWindPlot2 (t) TkcLine.new($twind2_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind2_plot, 100, 250, 100, 50, 'width'=>2) - TkcText.new($twind2_plot, 225, 20, + TkcText.new($twind2_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind2_plot, x, 250, x, 245, 'width'=>2) - TkcText.new($twind2_plot, x, 254, + TkcText.new($twind2_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind2_plot, 100, y, 105, y, 'width'=>2) - TkcText.new($twind2_plot, 96, y, + TkcText.new($twind2_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, + item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end - $twind2_plot.itembind('point', 'Any-Enter', + $twind2_plot.itembind('point', 'Any-Enter', proc{$twind2_plot.itemconfigure 'current', 'fill', 'red'}) - $twind2_plot.itembind('point', 'Any-Leave', + $twind2_plot.itembind('point', 'Any-Leave', proc{$twind2_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) - $twind2_plot.itembind('point', '1', + $twind2_plot.itembind('point', '1', proc{|x,y| embPlotDown2 $twind2_plot,x,y}, "%x %y") - $twind2_plot.itembind('point', 'ButtonRelease-1', + $twind2_plot.itembind('point', 'ButtonRelease-1', proc{$twind2_plot.dtag 'selected'}) - $twind2_plot.bind('B1-Motion', + $twind2_plot.bind('B1-Motion', proc{|x,y| embPlotMove2 $twind2_plot,x,y}, "%x %y") while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/) $twind2_text.delete $mark2_plot diff --git a/ext/tk/sample/demos-en/unicodeout.rb b/ext/tk/sample/demos-en/unicodeout.rb index 9c230a2536..ee7b5afa15 100644 --- a/ext/tk/sample/demos-en/unicodeout.rb +++ b/ext/tk/sample/demos-en/unicodeout.rb @@ -6,7 +6,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($unicodeout_demo) && $unicodeout_demo - $unicodeout_demo.destroy + $unicodeout_demo.destroy $unicodeout_demo = nil end @@ -18,8 +18,8 @@ $unicodeout_demo = TkToplevel.new {|w| base_frame = TkFrame.new($unicodeout_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5.4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5.4i', :justify=>:left, :text=><<EOL).pack(:side=>:top) This is a sample of Tk's support for languages that use non-Western \ character sets. However, what you will actually see below depends \ @@ -32,10 +32,10 @@ the definition of @@font on the Unicodeout_SampleFrame class. The strings are written in Tcl using UNICODE characters \ using the \\uXXXX escape so as to do so in a portable fashion. -ATTENTION: +ATTENTION: The strings are converted to the encoded string objects \ (completed to rewrite Tcl's escapes) by Tk::UTF8_String method. \ -And the Tk::UTF8_String objects are passed to the label widgets. +And the Tk::UTF8_String objects are passed to the label widgets. EOL TkFrame.new(base_frame){|f| @@ -51,8 +51,8 @@ TkFrame.new(base_frame){|f| }).pack(:side=>:left, :expand=>true) } -wait_msg = TkLabel.new(base_frame, - :text=>"Please wait while loading fonts...", +wait_msg = TkLabel.new(base_frame, + :text=>"Please wait while loading fonts...", :font=>"Helvetica 12 italic").pack class Unicodeout_SampleFrame < TkFrame @@ -72,10 +72,10 @@ class Unicodeout_SampleFrame < TkFrame def add_sample(lang, *args) sample_txt = Tk::UTF8_String(args.join('')) - l = TkLabel.new(self, :font=>@@font, :text=>lang+':', + l = TkLabel.new(self, :font=>@@font, :text=>lang+':', :anchor=>:nw, :pady=>0) - #s = TkLabel.new(self, :font=>@@font, :text=>sample_txt, - s = TkLabel.new(self, :font=>TkFont.new(@@font), :text=>sample_txt, + #s = TkLabel.new(self, :font=>@@font, :text=>sample_txt, + s = TkLabel.new(self, :font=>TkFont.new(@@font), :text=>sample_txt, :anchor=>:nw, :width=>30, :pady=>0) Tk.grid(l, s, :sticky=>:ew, :pady=>0) l.grid_config(:padx, '1m') @@ -91,23 +91,23 @@ oldCursor = $unicodeout_demo.cursor $unicodeout_demo.cursor('watch') Tk.update -f.add_sample('Arabic', - '\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94', +f.add_sample('Arabic', + '\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94', '\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D') f.add_sample('Trad. Chinese', '\u4E2D\u570B\u7684\u6F22\u5B57') f.add_sample('Simpl. Chinese', '\u6C49\u8BED') -f.add_sample('Greek', - '\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE ', +f.add_sample('Greek', + '\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE ', '\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1') -f.add_sample('Hebrew', - '\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 ', +f.add_sample('Hebrew', + '\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 ', '\u05DC\u05D9\u05D0\u05E8\u05E9\u05D9') -f.add_sample('Japanese', - '\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, ', +f.add_sample('Japanese', + '\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, ', '\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA') f.add_sample('Korean', '\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00') -f.add_sample('Russian', - '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 ', +f.add_sample('Russian', + '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 ', '\u044F\u0437\u044B\u043A') wait_msg.destroy diff --git a/ext/tk/sample/demos-jp/anilabel.rb b/ext/tk/sample/demos-jp/anilabel.rb index aee57f9f6a..d2f5b12041 100644 --- a/ext/tk/sample/demos-jp/anilabel.rb +++ b/ext/tk/sample/demos-jp/anilabel.rb @@ -6,7 +6,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($anilabel_demo) && $anilabel_demo - $anilabel_demo.destroy + $anilabel_demo.destroy $anilabel_demo = nil end @@ -50,7 +50,7 @@ TkFrame.new(base_frame) {|frame| # 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 @@ -88,7 +88,7 @@ class AnimatedImageLabel < AnimatedTextLabel @btag.bind_append('Destroy'){ if @destroy_image begin - self.image.delete + self.image.delete rescue end end @@ -124,13 +124,13 @@ class AnimatedImageLabel < AnimatedTextLabel end # label À¸À® -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-jp/aniwave.rb b/ext/tk/sample/demos-jp/aniwave.rb index 8fa14f65fe..973c1be1e9 100644 --- a/ext/tk/sample/demos-jp/aniwave.rb +++ b/ext/tk/sample/demos-jp/aniwave.rb @@ -6,7 +6,7 @@ # destroy toplevel widget for this demo script if defined?($aniwave_demo) && $aniwave_demo - $aniwave_demo.destroy + $aniwave_demo.destroy $aniwave_demo = nil end @@ -53,11 +53,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 @@ -69,10 +69,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-jp/arrow.rb b/ext/tk/sample/demos-jp/arrow.rb index 3c49e67b09..a1694d019d 100644 --- a/ext/tk/sample/demos-jp/arrow.rb +++ b/ext/tk/sample/demos-jp/arrow.rb @@ -25,65 +25,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 @@ -93,7 +93,7 @@ end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($arrow_demo) && $arrow_demo - $arrow_demo.destroy + $arrow_demo.destroy $arrow_demo = nil end @@ -107,7 +107,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'=>"¤³¤Î widget ¤Ç¡¢¥¥ã¥ó¥Ð¥¹¤Ç»È¤ï¤ì¤ë¥é¥¤¥ó¤Ë¤Ä¤¤¤ÆÍÍ¡¹¤ÊÉý¤äÌð°õ¤ÎƬ¤Î·Á¤ò»î¤·¤Æ¤ß¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£Àþ¤ÎÉý¤äÌð°õ¤Î·Á¤òÊѤ¨¤ë¤Ë¤Ï¡¢³ÈÂ礵¤ì¤¿Ìð°õ¤Ë¤Ä¤¤¤Æ¤¤¤ë 3¤Ä¤Î»Í³Ñ¤ò¥É¥é¥Ã¥°¤·¤Æ¤¯¤À¤µ¤¤¡£±¦Â¦¤ÎÌð°õ¤ÏÉáÄ̤ÎÂ礤µ¤Ç¤Î¥µ¥ó¥×¥ë¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£²¼¤Î¥Æ¥¥¹¥È¤Ï¥é¥¤¥ó¥¢¥¤¥Æ¥à¤ËÂФ¹¤ëÀßÄꥪ¥×¥·¥ç¥ó¤Ç¤¹¡£"){ pack('side'=>'top') } @@ -132,14 +132,14 @@ $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, +$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 @@ -157,7 +157,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} @@ -168,16 +168,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-jp/bind.rb b/ext/tk/sample/demos-jp/bind.rb index a1bcfdd2e7..99e5c1718c 100644 --- a/ext/tk/sample/demos-jp/bind.rb +++ b/ext/tk/sample/demos-jp/bind.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($bind_demo) && $bind_demo - $bind_demo.destroy + $bind_demo.destroy $bind_demo = nil end @@ -59,7 +59,7 @@ txt = TkText.new(base_frame){|t| # ¥¹¥¿¥¤¥ëÀßÄê 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 @@ -75,44 +75,44 @@ txt = TkText.new(base_frame){|t| insert('end', "\n\n") insert('end', '2. ´Êñ¤Ê 2¼¡¸µ¤Î¥×¥í¥Ã¥È¡£¥Ç¡¼¥¿¤òɽ¤¹ÅÀ¤òÆ°¤«¤¹¤³¤È¤¬¤Ç¤¤ë¡£', (d2 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '3. ¥Æ¥¥¹¥È¥¢¥¤¥Æ¥à¤Î¥¢¥ó¥«¡¼¤È¹Ô·¤¨¡£', + insert('end', '3. ¥Æ¥¥¹¥È¥¢¥¤¥Æ¥à¤Î¥¢¥ó¥«¡¼¤È¹Ô·¤¨¡£', (d3 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '4. ¥é¥¤¥ó¥¢¥¤¥Æ¥à¤Î¤¿¤á¤ÎÌð°õ¤ÎƬ¤Î·Á¤Î¥¨¥Ç¥£¥¿¡£', + insert('end', '4. ¥é¥¤¥ó¥¢¥¤¥Æ¥à¤Î¤¿¤á¤ÎÌð°õ¤ÎƬ¤Î·Á¤Î¥¨¥Ç¥£¥¿¡£', (d4 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '5. ¥¿¥Ö¥¹¥È¥Ã¥×¤òÊѹ¹¤¹¤ë¤¿¤á¤Îµ¡Ç½¤Ä¤¤Î¥ë¡¼¥é¡¼¡£', + insert('end', '5. ¥¿¥Ö¥¹¥È¥Ã¥×¤òÊѹ¹¤¹¤ë¤¿¤á¤Îµ¡Ç½¤Ä¤¤Î¥ë¡¼¥é¡¼¡£', (d5 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', - '6. ¥¥ã¥ó¥Ð¥¹¤¬¤É¤¦¤ä¤Ã¤Æ¥¹¥¯¥í¡¼¥ë¤¹¤ë¤Î¤«¤ò¼¨¤¹¥°¥ê¥Ã¥É¡£', + insert('end', + '6. ¥¥ã¥ó¥Ð¥¹¤¬¤É¤¦¤ä¤Ã¤Æ¥¹¥¯¥í¡¼¥ë¤¹¤ë¤Î¤«¤ò¼¨¤¹¥°¥ê¥Ã¥É¡£', (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-jp/bitmap.rb b/ext/tk/sample/demos-jp/bitmap.rb index b6b0e54bbe..1193e8de24 100644 --- a/ext/tk/sample/demos-jp/bitmap.rb +++ b/ext/tk/sample/demos-jp/bitmap.rb @@ -15,7 +15,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') @@ -27,7 +27,7 @@ end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($bitmap_demo) && $bitmap_demo - $bitmap_demo.destroy + $bitmap_demo.destroy $bitmap_demo = nil end @@ -41,7 +41,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'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¡¢Tk ¤ËÁȤ߹þ¤Þ¤ì¤¿¤¹¤Ù¤Æ¤Î¥Ó¥Ã¥È¥Þ¥Ã¥×¤¬¡¢¤½¤ì¤é¤Î̾Á°¤È¶¦¤Ëɽ¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Tcl ¤Î¥¹¥¯¥ê¥×¥ÈÃæ¤Ç¤Ï¡¢¤½¤ì¤¾¤ì¤Î̾Á°¤òÍѤ¤¤Æ»²¾È¤·¤Þ¤¹¡£"){ pack('side'=>'top') } diff --git a/ext/tk/sample/demos-jp/button.rb b/ext/tk/sample/demos-jp/button.rb index 18e42008c9..87ced45810 100644 --- a/ext/tk/sample/demos-jp/button.rb +++ b/ext/tk/sample/demos-jp/button.rb @@ -6,7 +6,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($button_demo) && $button_demo - $button_demo.destroy + $button_demo.destroy $button_demo = nil end diff --git a/ext/tk/sample/demos-jp/check.rb b/ext/tk/sample/demos-jp/check.rb index b953e7f623..762b99778b 100644 --- a/ext/tk/sample/demos-jp/check.rb +++ b/ext/tk/sample/demos-jp/check.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($check_demo) && $check_demo - $check_demo.destroy + $check_demo.destroy $check_demo = nil end @@ -54,7 +54,7 @@ TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'ÊÑ¿ô»²¾È' command proc{ - showVars(base_frame, + showVars(base_frame, ['wipers', wipers], ['brakes', brakes], ['sober', sober]) } }.pack('side'=>'left', 'expand'=>'yes') diff --git a/ext/tk/sample/demos-jp/check2.rb b/ext/tk/sample/demos-jp/check2.rb index 7f7cb9e932..9f845183f3 100644 --- a/ext/tk/sample/demos-jp/check2.rb +++ b/ext/tk/sample/demos-jp/check2.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($check2_demo) && $check2_demo - $check2_demo.destroy + $check2_demo.destroy $check2_demo = nil end @@ -35,35 +35,35 @@ sober = TkVariable.new(0) # frame À¸À® TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars($check2_demo, - ['safety', safety], ['wipers', wipers], + showVars($check2_demo, + ['safety', safety], ['wipers', wipers], ['brakes', brakes], ['sober', sober]) - }), - TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'check2'}), - TkButton.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + }), + TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'check2'}), + TkButton.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $check2_demo $check2_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) }.pack('side'=>'bottom', 'fill'=>'x') # checkbutton À¸À® -TkCheckButton.new(base_frame, :text=>'°ÂÁ´À¸¡ºº', :variable=>safety, - :relief=>:flat, :onvalue=>'all', :offvalue=>'none', +TkCheckButton.new(base_frame, :text=>'°ÂÁ´À¸¡ºº', :variable=>safety, + :relief=>:flat, :onvalue=>'all', :offvalue=>'none', :tristatevalue=>'partial'){ pack('side'=>'top', 'pady'=>2, 'anchor'=>'w') } @@ -71,7 +71,7 @@ TkCheckButton.new(base_frame, :text=>'°ÂÁ´À¸¡ºº', :variable=>safety, [ TkCheckButton.new(base_frame, 'text'=>'¥ï¥¤¥Ñ¡¼ OK', 'variable'=>wipers), TkCheckButton.new(base_frame, 'text'=>'¥Ö¥ì¡¼¥ OK', 'variable'=>brakes), TkCheckButton.new(base_frame, 'text'=>'±¿Å¾¼ê ÁÇÌÌ', 'variable'=>sober) -].each{|w| +].each{|w| w.relief('flat') w.pack('side'=>'top', 'padx'=>15, 'pady'=>2, 'anchor'=>'w') } diff --git a/ext/tk/sample/demos-jp/clrpick.rb b/ext/tk/sample/demos-jp/clrpick.rb index ce6b99ab94..c188723c5a 100644 --- a/ext/tk/sample/demos-jp/clrpick.rb +++ b/ext/tk/sample/demos-jp/clrpick.rb @@ -7,7 +7,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($clrpick_demo) && $clrpick_demo - $clrpick_demo.destroy + $clrpick_demo.destroy $clrpick_demo = nil end @@ -47,7 +47,7 @@ Tk::Frame.new($clrpick_demo) {|frame| # button À¸À® # TkButton.new($clrpick_demo, 'text'=>'ÇØ·Ê¿§¤òÀßÄê ...') {|b| Tk::Button.new($clrpick_demo, 'text'=>'ÇØ·Ê¿§¤òÀßÄê ...') {|b| - command(proc{setColor $clrpick_demo, b, 'background', + command(proc{setColor $clrpick_demo, b, 'background', ['background', 'highlightbackground']}) pack('side'=>'top', 'anchor'=>'c', 'pady'=>'2m') } @@ -61,7 +61,7 @@ Tk::Button.new($clrpick_demo, 'text'=>'Á°·Ê¿§¤òÀßÄê ...') {|b| def setColor(w,button,name,options) w.grab initialColor = button[name] - color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, + color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, 'initialcolor'=>initialColor) if color != "" setColor_helper(w,options,color) diff --git a/ext/tk/sample/demos-jp/colors.rb b/ext/tk/sample/demos-jp/colors.rb index 91817a947b..9fcf0333b5 100644 --- a/ext/tk/sample/demos-jp/colors.rb +++ b/ext/tk/sample/demos-jp/colors.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($colors_demo) && $colors_demo - $colors_demo.destroy + $colors_demo.destroy $colors_demo = nil end diff --git a/ext/tk/sample/demos-jp/combo.rb b/ext/tk/sample/demos-jp/combo.rb index da00d712ba..2059662d48 100644 --- a/ext/tk/sample/demos-jp/combo.rb +++ b/ext/tk/sample/demos-jp/combo.rb @@ -7,7 +7,7 @@ # based on "Id: combo.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($combo_demo) && $combo_demo - $combo_demo.destroy + $combo_demo.destroy $combo_demo = nil end @@ -19,7 +19,7 @@ $combo_demo = TkToplevel.new {|w| base_frame = TkFrame.new($combo_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><<EOL).pack(:side=>:top, :fill=>:x) °Ê²¼¤Ç¤Ï3¼ïÎà¤Î¥³¥ó¥Ü¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥\ ºÇ½é¤Î¤â¤Î¤Ï¡¤¥¨¥ó¥È¥ê¥¦¥£¥¸¥§¥Ã¥È¤ÈƱ¤¸Íͤˡ¤\ @@ -42,24 +42,24 @@ ozCity = TkVariable.new Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'ÊÑ¿ô»²¾È', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'ÊÑ¿ô»²¾È', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, - ['firstVariable', firstValue], - ['secondVariable', secondValue], + showVars(base_frame, + ['firstVariable', firstValue], + ['secondVariable', secondValue], ['ozCity', ozCity]) - }), - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'combo'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + }), + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'combo'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $combo_demo.destroy $combo_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -68,7 +68,7 @@ Ttk::Frame.new(base_frame) {|frame| frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true) australianCities = [ - '¥¥ã¥ó¥Ù¥é', '¥·¥É¥Ë¡¼', '¥á¥ë¥Ü¥ë¥ó', '¥Ñ¡¼¥¹', '¥¢¥Ç¥ì¡¼¥É', + '¥¥ã¥ó¥Ù¥é', '¥·¥É¥Ë¡¼', '¥á¥ë¥Ü¥ë¥ó', '¥Ñ¡¼¥¹', '¥¢¥Ç¥ì¡¼¥É', '¥Ö¥ê¥¹¥Ù¡¼¥ó', '¥Û¥Ð¡¼¥È', '¥À¡¼¥¦¥£¥ó', '¥¢¥ê¥¹ ¥¹¥×¥ê¥ó¥°¥¹' ] @@ -82,17 +82,17 @@ Tk.pack(Ttk::Labelframe.new(frame, :text=>'Fully Editable'){|f| w.values <<= w.value unless w.values.include?(w.value) } }.pack(:pady=>5, :padx=>10) - }, + }, Ttk::LabelFrame.new(frame, :text=>'Disabled'){|f| Ttk::Combobox.new(f, :textvariable=>secondValue, :state=>:disabled) . pack(:pady=>5, :padx=>10) - }, + }, Ttk::LabelFrame.new(frame, :text=>'Defined List Only'){|f| - Ttk::Combobox.new(f, :textvariable=>ozCity, :state=>:readonly, + Ttk::Combobox.new(f, :textvariable=>ozCity, :state=>:readonly, :values=>australianCities) . pack(:pady=>5, :padx=>10) - }, + }, :side=>:top, :pady=>5, :padx=>10) diff --git a/ext/tk/sample/demos-jp/cscroll.rb b/ext/tk/sample/demos-jp/cscroll.rb index 845952679a..0a31f28b5e 100644 --- a/ext/tk/sample/demos-jp/cscroll.rb +++ b/ext/tk/sample/demos-jp/cscroll.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($cscroll_demo) && $cscroll_demo - $cscroll_demo.destroy + $cscroll_demo.destroy $cscroll_demo = nil end @@ -19,7 +19,7 @@ $cscroll_demo = TkToplevel.new {|w| base_frame = TkFrame.new($cscroll_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥¹¥¯¥í¡¼¥ë¥Ð¡¼¤ä¥Þ¥¦¥¹¤Î¥Ü¥¿¥ó2 ¤Ç¥¹¥¯¥í¡¼¥ë¤Ç¤¤ë¥¥ã¥ó¥Ð¥¹ widget ¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£»Í³Ñ¤Î¾å¤Ç¥Ü¥¿¥ó1 ¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢¤½¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬É¸½à½ÐÎϤ˽ÐÎϤµ¤ì¤Þ¤¹¡£"){ pack('side'=>'top') } @@ -53,14 +53,14 @@ unless $tk_version =~ /^4\.[01]/ end # canvas ÀßÄê -$cscroll_canvas = TkCanvas.new(base_frame, +$cscroll_canvas = TkCanvas.new(base_frame, 'relief'=>'sunken', 'borderwidth'=>2, 'scrollregion'=>['-11c', '-11c', '50c', '20c'] ) {|c| if $tk_version =~ /^4\.[01]/ - pack('expand'=>'yes', 'fill'=>'both') + pack('expand'=>'yes', 'fill'=>'both') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end @@ -69,18 +69,18 @@ $cscroll_canvas = TkCanvas.new(base_frame, if $tk_version =~ /^4\.[01]/ pack('side'=>'right', 'fill'=>'y') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end } - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}) {|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) if $tk_version =~ /^4\.[01]/ - pack('side'=>'bottom', 'fill'=>'x') + pack('side'=>'bottom', 'fill'=>'x') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end } @@ -91,9 +91,9 @@ bg = $cscroll_canvas.configinfo('bg')[4] x = -10+3*i y = -10 (0..9).each{|j| - TkcRectangle.new($cscroll_canvas, "#{x}c", "#{y}c", "#{x+2}c", "#{y+2}c", + TkcRectangle.new($cscroll_canvas, "#{x}c", "#{y}c", "#{x+2}c", "#{y+2}c", 'outline'=>'black', 'fill'=>bg, 'tags'=>'rect') - TkcText.new($cscroll_canvas, "#{x+1}c", "#{y+1}c", + TkcText.new($cscroll_canvas, "#{x+1}c", "#{y+1}c", 'text'=>"#{i},#{j}", 'anchor'=>'center', 'tags'=>'text') y += 3 } @@ -104,7 +104,7 @@ $cscroll_canvas.itembind('all', 'Any-Leave', proc{scrollLeave $cscroll_canvas}) $cscroll_canvas.itembind('all', '1', proc{scrollButton $cscroll_canvas}) $cscroll_canvas.itembind('all', 'Any-Enter', proc{scrollEnter $cscroll_canvas}) $cscroll_canvas.bind('2', proc{|x,y| $cscroll_canvas.scan_mark(x,y)}, '%x %y') -$cscroll_canvas.bind('B2-Motion', +$cscroll_canvas.bind('B2-Motion', proc{|x,y| $cscroll_canvas.scan_dragto(x,y)}, '%x %y') def scrollEnter(c) diff --git a/ext/tk/sample/demos-jp/ctext.rb b/ext/tk/sample/demos-jp/ctext.rb index 05ca732cfd..70c1cad1a7 100644 --- a/ext/tk/sample/demos-jp/ctext.rb +++ b/ext/tk/sample/demos-jp/ctext.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($ctext_demo) && $ctext_demo - $ctext_demo.destroy + $ctext_demo.destroy $ctext_demo = nil end @@ -19,7 +19,7 @@ $ctext_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ctext_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'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥¥ã¥ó¥Ð¥¹widget¤Î¥Æ¥¥¹¥Èµ¡Ç½¤ò¥Ç¥â¤¹¤ë¤¿¤á¤Î¥Æ¥¥¹¥Èʸ»úÎó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥Þ¥¦¥¹¤ò»Í³Ñ¤ÎÃæ¤Ë»ý¤Ã¤Æ¤¤¤¡¢¥¯¥ê¥Ã¥¯¤¹¤ë¤È°ÌÃÖ¤®¤áÍѤÎÅÀ¤«¤é¤ÎÁêÂаÌÃÖ¤òÊѤ¨¤¿¤ê¡¢¹Ô·¤¨¤òÊѤ¨¤¿¤ê¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¤Þ¤¿°Ê²¼¤Î¤è¤¦¤ÊÊÔ½¸¤Î¤¿¤á¤Î´Êñ¤Ê¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£ 1. ¥Þ¥¦¥¹¤ò»ý¤Ã¤Æ¤¤¤¡¢¥¯¥ê¥Ã¥¯¤·¡¢ÆþÎϤǤ¤Þ¤¹¡£ @@ -50,7 +50,7 @@ $ctext_buttons = TkFrame.new(base_frame) {|frame| $ctext_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # canvas À¸À® -$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat', +$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat', 'borderwidth'=>0, 'width'=>500, 'height'=>350) $ctext_canvas.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'both') @@ -62,7 +62,7 @@ else end # canvas ÀßÄê -TkcRectangle.new($ctext_canvas, 245, 195, 255, 205, +TkcRectangle.new($ctext_canvas, 245, 195, 255, 205, 'outline'=>'black', 'fill'=>'red') ctag_text_param = { @@ -80,24 +80,24 @@ $ctag_text.withtag(TkcText.new($ctext_canvas, 250, 200, ctag_text_param)) $ctag_text.bind('1', proc{|x,y| textB1Press $ctext_canvas,x,y}, "%x %y") $ctag_text.bind('B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y") -$ctag_text.bind('Shift-1', - proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"}, +$ctag_text.bind('Shift-1', + proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"}, "%x %y") -$ctag_text.bind('Shift-B1-Motion', +$ctag_text.bind('Shift-B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y") $ctag_text.bind('KeyPress', proc{|a| textInsert $ctext_canvas,a}, "%A") $ctag_text.bind('Return', proc{textInsert $ctext_canvas,"\n"}) $ctag_text.bind('Control-h', proc{textBs $ctext_canvas}) $ctag_text.bind('BackSpace', proc{textBs $ctext_canvas}) $ctag_text.bind('Delete', proc{textDel $ctext_canvas}) -$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"}, +$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"}, "%x %y") -# Next, create some items that allow the text's anchor position +# Next, create some items that allow the text's anchor position # to be edited. def mkTextConfig(w,x,y,option,value,color) - item = TkcRectangle.new(w, x, y, x+30, y+30, + item = TkcRectangle.new(w, x, y, x+30, y+30, 'outline'=>'black', 'fill'=>color, 'width'=>1) item.bind('1', proc{$ctag_text.configure option, value}) w.addtag_withtag('config', item) @@ -115,15 +115,15 @@ mkTextConfig $ctext_canvas, x+60, y+30, 'anchor', 'w', color mkTextConfig $ctext_canvas, x, y+60, 'anchor', 'ne', color mkTextConfig $ctext_canvas, x+30, y+60, 'anchor', 'n', color mkTextConfig $ctext_canvas, x+60, y+60, 'anchor', 'nw', color -item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50, +item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50, 'outline'=>'black', 'fill'=>'red') item.bind('1', proc{$ctag_text.configure 'anchor', 'center'}) if $tk_version =~ /^4.*/ - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', - 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', + 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', 'anchor'=>'s', 'fill'=>'brown') else - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', 'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown') end @@ -137,18 +137,18 @@ mkTextConfig $ctext_canvas, x, y, 'justify', 'left', color mkTextConfig $ctext_canvas, x+30, y, 'justify', 'center', color mkTextConfig $ctext_canvas, x+60, y, 'justify', 'right', color if $tk_version =~ /^4.*/ - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', - 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', + 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', 'anchor'=>'s', 'fill'=>'brown') else - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', 'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown') end $ctext_canvas.itembind('config', 'Enter', proc{textEnter $ctext_canvas}) -$ctext_canvas.itembind('config', 'Leave', +$ctext_canvas.itembind('config', 'Leave', proc{$ctext_canvas\ - .itemconfigure('current', + .itemconfigure('current', 'fill'=>$textConfigFill)}) $textConfigFill = '' diff --git a/ext/tk/sample/demos-jp/entry1.rb b/ext/tk/sample/demos-jp/entry1.rb index 2be29c18d3..eb71e87aec 100644 --- a/ext/tk/sample/demos-jp/entry1.rb +++ b/ext/tk/sample/demos-jp/entry1.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($entry1_demo) && $entry1_demo - $entry1_demo.destroy + $entry1_demo.destroy $entry1_demo = nil end diff --git a/ext/tk/sample/demos-jp/entry2.rb b/ext/tk/sample/demos-jp/entry2.rb index 2675b5d324..b5187ab508 100644 --- a/ext/tk/sample/demos-jp/entry2.rb +++ b/ext/tk/sample/demos-jp/entry2.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($entry2_demo) && $entry2_demo - $entry2_demo.destroy + $entry2_demo.destroy $entry2_demo = nil end diff --git a/ext/tk/sample/demos-jp/entry3.rb b/ext/tk/sample/demos-jp/entry3.rb index 6b9cd4cf37..2728de0b93 100644 --- a/ext/tk/sample/demos-jp/entry3.rb +++ b/ext/tk/sample/demos-jp/entry3.rb @@ -8,7 +8,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($entry3_demo) && $entry3_demo - $entry3_demo.destroy + $entry3_demo.destroy $entry3_demo = nil end @@ -20,8 +20,8 @@ $entry3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($entry3_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><<EOL).pack(:side=>:top) °Ê²¼¤Ë¤Ï£´¼ïÎà¤Î¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥³Æ¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤Ï¡¤\ ¥Þ¥¦¥¹¥¯¥ê¥Ã¥¯¤ÇÁªÂò¤·Ê¸»ú¤òÂǤÁ¹þ¤à¤³¤È¤¬²Äǽ¤Ç¤¹¤¬¡¤¤½¤ì¤¾¤ì¤¬¤É¤Î¤è¤¦¤Ê\ @@ -68,20 +68,20 @@ TkFrame.new(base_frame){|f| def focusAndFlash(widget, fg, bg, count=5) return if count <= 0 if fg && !fg.empty? && bg && !bg.empty? - TkTimer.new(200, count, - proc{widget.configure(:foreground=>bg, :background=>fg)}, + TkTimer.new(200, count, + proc{widget.configure(:foreground=>bg, :background=>fg)}, proc{widget.configure(:foreground=>fg, :background=>bg)} ).start else # TkTimer.new(150, 3){Tk.bell}.start Tk.bell - TkTimer.new(200, count, - proc{widget.configure(:foreground=>'white', - :background=>'black')}, - proc{widget.configure(:foreground=>'black', + TkTimer.new(200, count, + proc{widget.configure(:foreground=>'white', + :background=>'black')}, + proc{widget.configure(:foreground=>'black', :background=>'white')} ).at_end{begin - widget.configure(:foreground=>fg, + widget.configure(:foreground=>fg, :background=>bg) rescue # ignore @@ -91,7 +91,7 @@ def focusAndFlash(widget, fg, bg, count=5) end l1 = TkLabelFrame.new(base_frame, :text=>"À°¿ô¥¨¥ó¥È¥ê") -TkEntry.new(l1, :validate=>:focus, +TkEntry.new(l1, :validate=>:focus, :vcmd=>[ proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' ]) {|e| @@ -102,7 +102,7 @@ TkEntry.new(l1, :validate=>:focus, } l2 = TkLabelFrame.new(base_frame, :text=>"ŤµÀ©ÌóÉÕ¤¥¨¥ó¥È¥ê") -TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell}, +TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell}, :vcmd=>[proc{|s| s.length < 10}, '%P'] ).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m') @@ -176,7 +176,7 @@ end def validatePhoneChange(widget, vmode, idx, char) return true if idx == nil - Tk.after_idle(proc{widget.configure(:validate=>vmode, + Tk.after_idle(proc{widget.configure(:validate=>vmode, :invcmd=>proc{Tk.bell})}) if !(idx<3 || idx==6 || idx==7 || idx==11 || idx>15) && char =~ /[0-9A-Za-z]/ widget.delete(idx) @@ -191,10 +191,10 @@ end l3 = TkLabelFrame.new(base_frame, :text=>"ÊƹñÅÅÏÃÈֹ楨¥ó¥È¥ê") -TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, - :textvariable=>entry3content, +TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, + :textvariable=>entry3content, :vcmd=>[ - proc{|w,v,i,s| validatePhoneChange(w,v,i,s)}, + proc{|w,v,i,s| validatePhoneChange(w,v,i,s)}, "%W %v %i %S" ]){|e| # Click to focus goes to the first editable character... @@ -210,9 +210,9 @@ TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, } l4 = TkLabelFrame.new(base_frame, :text=>"¥Ñ¥¹¥ï¡¼¥É¥¨¥ó¥È¥ê") -TkEntry.new(l4, :validate=>:key, :show=>'*', +TkEntry.new(l4, :validate=>:key, :show=>'*', :vcmd=>[ - proc{|s| s.length <= 8}, + proc{|s| s.length <= 8}, '%P' ]).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m') diff --git a/ext/tk/sample/demos-jp/filebox.rb b/ext/tk/sample/demos-jp/filebox.rb index b8846d08a0..ffe5fbc5c6 100644 --- a/ext/tk/sample/demos-jp/filebox.rb +++ b/ext/tk/sample/demos-jp/filebox.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($filebox_demo) && $entry2_demo - $filebox_demo.destroy + $filebox_demo.destroy $filebox_demo = nil end @@ -49,7 +49,7 @@ TkFrame.new(base_frame) {|frame| TkEntry.new(f, 'width'=>20) {|e| pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x') - TkButton.new(f, 'text'=>'Browse ...', + TkButton.new(f, 'text'=>'Browse ...', 'command'=>proc{fileDialog base_frame,e,type})\ .pack('side'=>'left') } @@ -60,9 +60,9 @@ TkFrame.new(base_frame) {|frame| $tk_strictMotif = TkVarAccess.new('tk_strictMotif') if ($tk_platform['platform'] == 'unix') - TkCheckButton.new(base_frame, - 'text'=>'Motif¥¹¥¿¥¤¥ë¤Î¥À¥¤¥¢¥í¥°¤òÍѤ¤¤ë', - 'variable'=>$tk_strictMotif, + TkCheckButton.new(base_frame, + 'text'=>'Motif¥¹¥¿¥¤¥ë¤Î¥À¥¤¥¢¥í¥°¤òÍѤ¤¤ë', + 'variable'=>$tk_strictMotif, 'onvalue'=>1, 'offvalue'=>0 ).pack('anchor'=>'c') end @@ -71,23 +71,23 @@ def fileDialog(w,ent,operation) # #-------------------------------------------------------- types = [ - ['Text files', ['.txt','.doc'] ], - ['Text files', [], 'TEXT' ], - ['Ruby Scripts', ['.rb'], 'TEXT' ], - ['Tcl Scripts', ['.tcl'], 'TEXT' ], - ['C Source Files', ['.c','.h'] ], - ['All Source Files', ['.rb','.tcl','.c','.h'] ], - ['Image Files', ['.gif'] ], - ['Image Files', ['.jpeg','.jpg'] ], - ['Image Files', [], ['GIFF','JPEG']], + ['Text files', ['.txt','.doc'] ], + ['Text files', [], 'TEXT' ], + ['Ruby Scripts', ['.rb'], 'TEXT' ], + ['Tcl Scripts', ['.tcl'], 'TEXT' ], + ['C Source Files', ['.c','.h'] ], + ['All Source Files', ['.rb','.tcl','.c','.h'] ], + ['Image Files', ['.gif'] ], + ['Image Files', ['.jpeg','.jpg'] ], + ['Image Files', [], ['GIFF','JPEG']], ['All files', '*' ] ] if operation == '³«¤¯' file = Tk.getOpenFile('filetypes'=>types, 'parent'=>w) else - file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, - 'initialfile'=>'Untitled', + file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, + 'initialfile'=>'Untitled', 'defaultextension'=>'.txt') end if file != "" diff --git a/ext/tk/sample/demos-jp/floor.rb b/ext/tk/sample/demos-jp/floor.rb index a2ec2e9969..78cc23a245 100644 --- a/ext/tk/sample/demos-jp/floor.rb +++ b/ext/tk/sample/demos-jp/floor.rb @@ -18,7 +18,7 @@ def floorDisplay(w,active) w.delete('all') $activeFloor = active - # First go through the three floors, displaying the backgrounds for + # First go through the three floors, displaying the backgrounds for # each floor. floor_bg1(w,$floor_colors['bg1'],$floor_colors['outline1']) @@ -29,12 +29,12 @@ def floorDisplay(w,active) w.raise("floor#{active}") - # Create a dummy item just to mark this point in the display list, + # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. TkcRectangle.new(w,0,100,1,101, 'fill'=>'', 'outline'=>'', 'tags'=>'marker') - # Add the walls and labels for the active floor, along with + # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. @@ -299,7 +299,7 @@ def floor_bg3(w,fill,outline) TkcLine.new(w,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) - TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, + TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end @@ -313,316 +313,316 @@ end # color - Color to use for drawing foreground information. def floor_fg1(w,color) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '101' $floorItems['101'] = i - TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Pub Lift1' $floorItems['Pub Lift1'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Priv Lift1' $floorItems['Priv Lift1'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, + i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '110' $floorItems['110'] = i - TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, + TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, + i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '109' $floorItems['109'] = i - TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, + TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, + i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '111' $floorItems['111'] = i - TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, + TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, + i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117B' $floorItems['117B'] = i - TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, + TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, + i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '112' $floorItems['112'] = i - TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, + TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, + i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '113' $floorItems['113'] = i - TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, + TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, + i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117A' $floorItems['117A'] = i - TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, + TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, + i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117' $floorItems['117'] = i - TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, + TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, + i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '114' $floorItems['114'] = i - TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, + TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, + i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '115' $floorItems['115'] = i - TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, + TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, + i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '116' $floorItems['116'] = i - TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, + TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, + i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '118' $floorItems['118'] = i - TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, + TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, - 163,91,163,112,149,112,149,128, + 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '120' $floorItems['120'] = i - TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, + TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, - 156,192,156,169,175,169,175,246,79,246, + 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '122' $floorItems['122'] = i - TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, + TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, + i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '121' $floorItems['121'] = i - TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, + TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, + i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106A' $floorItems['106A'] = i - TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, + TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, + i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '105' $floorItems['105'] = i - TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, + TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, + i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106B' $floorItems['106B'] = i - TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, + TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, + i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '104' $floorItems['104'] = i - TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, + TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, + i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '108' $floorItems['108'] = i - TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, + TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, + i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '107' $floorItems['107'] = i - TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, + TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, + i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Smoking' $floorItems['Smoking'] = i - TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, + TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, + i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '123' $floorItems['123'] = i - TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, + TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, + i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '103' $floorItems['103'] = i - TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, + TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, + i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '124' $floorItems['124'] = i - TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, + TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, + i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '125' $floorItems['125'] = i - TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, + TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, + i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '126' $floorItems['126'] = i - TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, + TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, - 486,253,486,239,474,239,474,209, + 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '127' $floorItems['127'] = i - TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, + TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, - 490,188,490,204,476,204,476,164, + 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'MShower' $floorItems['MShower'] = i - TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, + TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, + i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Closet' $floorItems['Closet'] = i - TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, + TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, + i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'WShower' $floorItems['WShower'] = i - TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, + TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, - 515,174,503,174,503,161,486,161, + 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '130' $floorItems['130'] = i - TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, + TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, - 393,309,300,309,300,248,308,248, + 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '102' $floorItems['102'] = i - TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, + TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, + i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '128' $floorItems['128'] = i - TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, + TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '129' $floorItems['129'] = i - TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, + TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, - 642,389,561,389,561,277,696,277, + 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '133' $floorItems['133'] = i - TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, + TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, + i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '132' $floorItems['132'] = i - TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, + TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, + i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '134' $floorItems['134'] = i - TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, + TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, + i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '135' $floorItems['135'] = i - TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, + TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, - 331,347,332,351,334,354,336,357,341,359, + 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Ramona Stair' $floorItems['Ramona Stair'] = i - TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, + TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, - 122,28,123,32,123,68,220,68,220,87,90,87,90,23, + 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'University Stair' $floorItems['University Stair'] = i - TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, + TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, - 227,13,223,17,221,22,220,34,260,34, + 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Stair' $floorItems['Plaza Stair'] = i - TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, + TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, - 386,104,386,128,220,128, + 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Deck' $floorItems['Plaza Deck'] = i - TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, + TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106' $floorItems['106'] = i - TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, + TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, - 112,130,97,130,97,168,175,168,175,131,146,131, + 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '119' $floorItems['119'] = i - TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, + TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) TkcLine.new(w,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) @@ -795,321 +795,321 @@ end def floor_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, - 800,222,800,168,748,168, + 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '238' $floorItems['238'] = i - TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, + TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '237' $floorItems['237'] = i - TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, + TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, - 715,205,755,205,755,190,724,190,724,187, + 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '246' $floorItems['246'] = i - TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, + TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, + i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '247' $floorItems['247'] = i - TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, + TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, - 559,274,482,274,482,278,396,278,396,274,232,274, + 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '202' $floorItems['202'] = i - TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, + TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, - 156,196,176,196,176,228, + 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '206' $floorItems['206'] = i - TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, + TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, + i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '212' $floorItems['212'] = i - TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, + TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, + i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '245' $floorItems['245'] = i - TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, + TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, + i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '244' $floorItems['244'] = i - TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, + TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, + i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '243' $floorItems['243'] = i - TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, + TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, + i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '242' $floorItems['242'] = i - TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, + TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, + i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Barbecue Deck' $floorItems['Barbecue Deck'] = i - TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, + TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, + i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '240' $floorItems['240'] = i - TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, + TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, + i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '241' $floorItems['241'] = i - TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, + TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, + i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '239' $floorItems['239'] = i - TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, + TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, + i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '248' $floorItems['248'] = i - TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, + TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, + i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '236' $floorItems['236'] = i - TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, + TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, + i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '235' $floorItems['235'] = i - TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, + TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, - 572,143,579,143,579,185,626,185, + 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '234' $floorItems['234'] = i - TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, + TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, - 578,185,527,185,527,131,557,131, + 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '233' $floorItems['233'] = i - TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, + TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '230' $floorItems['230'] = i - TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, + TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, + i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '232' $floorItems['232'] = i - TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, + TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, + i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '229' $floorItems['229'] = i - TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, + TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, + i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '227' $floorItems['227'] = i - TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, + TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, + i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '228' $floorItems['228'] = i - TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, + TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, + i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '226' $floorItems['226'] = i - TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, + TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, + i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '225' $floorItems['225'] = i - TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, + TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, + i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '224' $floorItems['224'] = i - TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, + TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, + i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '223' $floorItems['223'] = i - TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, + TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, + i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '222' $floorItems['222'] = i - TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, + TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, + i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '221' $floorItems['221'] = i - TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, + TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, + i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '204' $floorItems['204'] = i - TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, + TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, + i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '205' $floorItems['205'] = i - TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, + TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '207' $floorItems['207'] = i - TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, + TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, + i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '208' $floorItems['208'] = i - TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, + TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, + i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '209' $floorItems['209'] = i - TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, + TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, + i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217' $floorItems['217'] = i - TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, + TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, + i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217A' $floorItems['217A'] = i - TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, + TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, + i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '216' $floorItems['216'] = i - TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, + TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, + i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '215' $floorItems['215'] = i - TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, + TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, + i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '214' $floorItems['214'] = i - TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, + TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, + i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '213' $floorItems['213'] = i - TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, + TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, + i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '210' $floorItems['210'] = i - TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, + TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, + i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '211' $floorItems['211'] = i - TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, + TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, + i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '203' $floorItems['203'] = i - TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, + TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, - 154,198,154,192,109,192,109,169,99,169, + 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '220' $floorItems['220'] = i - TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, + TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Priv Lift2' $floorItems['Priv Lift2'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Pub Lift 2' $floorItems['Pub Lift 2'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '218' $floorItems['218'] = i - TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, + TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '219' $floorItems['219'] = i - TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, + TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '201' $floorItems['201'] = i - TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) TkcLine.new(w,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) @@ -1280,206 +1280,206 @@ def floor_fg3(w,color) 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316' $floorItems['316'] = i - TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, + TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, + i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '309' $floorItems['309'] = i - TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, + TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, + i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '308' $floorItems['308'] = i - TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, + TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, + i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '307' $floorItems['307'] = i - TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, + TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, + i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '305' $floorItems['305'] = i - TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, + TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324B' $floorItems['324B'] = i - TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, + TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, + i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324A' $floorItems['324A'] = i - TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, + TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, + i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '320' $floorItems['320'] = i - TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, + TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, + i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '310' $floorItems['310'] = i - TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, + TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, + i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '312' $floorItems['312'] = i - TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, + TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, + i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '313' $floorItems['313'] = i - TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, + TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, + i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '314' $floorItems['314'] = i - TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, + TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, + i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '315' $floorItems['315'] = i - TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, + TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, + i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316B' $floorItems['316B'] = i - TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, + TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, + i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316A' $floorItems['316A'] = i - TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, + TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, - 174,198,174,226,101,226,101,179,97,179, + 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '319' $floorItems['319'] = i - TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, + TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, + i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '311' $floorItems['311'] = i - TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, + TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '318' $floorItems['318'] = i - TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, + TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '317' $floorItems['317'] = i - TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, + TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, + i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '323' $floorItems['323'] = i - TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, + TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, + i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '325' $floorItems['325'] = i - TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, + TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, + i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '321' $floorItems['321'] = i - TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, + TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, - 264,181,264,135,314,135, + 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '322' $floorItems['322'] = i - TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, + TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Pub Lift3' $floorItems['Pub Lift3'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Priv Lift3' $floorItems['Priv Lift3'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, + i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '303' $floorItems['303'] = i - TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, + TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, - 244,230,244,221,252,221,252,203, + 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324' $floorItems['324'] = i - TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, + TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, + i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '304' $floorItems['304'] = i - TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, + TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '301' $floorItems['301'] = i - TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, + i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '327' $floorItems['327'] = i - TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, + TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, + i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '326' $floorItems['326'] = i - TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, + TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, - 375,274,397,274,397,248,339,248,339,242,308,242, + 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '302' $floorItems['302'] = i - TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, + TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, - 107,248,160,248,160,301,107,301,107,275,70,275, + 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '306' $floorItems['306'] = i - TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, + TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) TkcLine.new(w,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) @@ -1574,7 +1574,7 @@ end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($floor_demo) && $floor_demo - $floor_demo.destroy + $floor_demo.destroy $floor_demo = nil end @@ -1590,7 +1590,7 @@ $floor_demo = TkToplevel.new {|w| base_frame = TkFrame.new($floor_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥Ç¥£¥¸¥¿¥ë¥¨¥¯¥¤¥Ã¥×¥á¥ó¥È¼Ò¤Î¥¦¥§¥¹¥¿¥ó¥ê¥µ¡¼¥Á¥é¥Ü¥é¥È¥ê (DECWRL) ¤Î´Ö¼è¤ê¤¬½ñ¤«¤ì¤¿¥¥ã¥ó¥Ð¥¹ widget ¤¬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ï 3³¬·ú¤Æ¤Ç¡¢¾ï¤Ë¤½¤Î¤¦¤Á¤Î1³¬Ê¬¤¬ÁªÂò¡¢¤Ä¤Þ¤ê¤½¤Î´Ö¼è¤ê¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¤¢¤ë³¬¤òÁªÂò¤¹¤ë¤Ë¤Ï¡¢¤½¤Î¾å¤Ç¥Þ¥¦¥¹¤Îº¸¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£¥Þ¥¦¥¹¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë³¬¤Î¾å¤òÆ°¤¯¤È¡¢¤½¤Î²¼¤Ë¤¢¤ëÉô²°¤Î¿§¤¬ÊѤï¤ê¡¢Éô²°Èֹ椬¡ÖÉô²°ÈÖ¹æ:¡×¥¨¥ó¥È¥ê¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¢¥¨¥ó¥È¥ê¤ËÉô²°ÈÖ¹æ¤ò½ñ¤¯¤È¤½¤ÎÉô²°¤Î¿§¤¬ÊѤï¤ê¤Þ¤¹¡£"){ pack('side'=>'top') } @@ -1622,10 +1622,10 @@ $floorItems = {} if $tk_version =~ /^4\.[01]/ $floor_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken', 'highlightthickness'=>2) - $floor_canvas = TkCanvas.new($floor_canvas_frame, - 'width'=>900, 'height'=>500, 'borderwidth'=>0, + $floor_canvas = TkCanvas.new($floor_canvas_frame, + 'width'=>900, 'height'=>500, 'borderwidth'=>0, 'highlightthickness'=>0) {|c| - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}){|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) pack('side'=>'bottom', 'fill'=>'x') @@ -1646,20 +1646,20 @@ else v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical') TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1| - $floor_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, - 'borderwidth'=>0, + $floor_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, + 'borderwidth'=>0, 'highlightthickness'=>0) { xscrollcommand(proc{|first,last| h.set first,last}) yscrollcommand(proc{|first,last| v.set first,last}) pack('expand'=>'yes', 'fill'=>'both') } - grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') } - v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) @@ -1676,7 +1676,7 @@ end # Create an entry for displaying and typing in current room. $currentRoom = TkVariable.new -$floor_entry = TkEntry.new($floor_canvas, 'width'=>10, 'relief'=>'sunken', +$floor_entry = TkEntry.new($floor_canvas, 'width'=>10, 'relief'=>'sunken', 'bd'=>2, 'textvariable'=>$currentRoom) # Choose colors, then fill in the floorplan. @@ -1713,7 +1713,7 @@ $floor_canvas.itembind('floor3', '1', proc{floorDisplay $floor_canvas,3}) $floor_canvas.itembind('room', 'Enter', proc{newRoom $floor_canvas}) $floor_canvas.itembind('room', 'Leave', proc{$currentRoom.value = ''}) $floor_canvas.bind('2', proc{|x,y| $floor_canvas.scan_mark x,y}, '%x %y') -$floor_canvas.bind('B2-Motion', +$floor_canvas.bind('B2-Motion', proc{|x,y| $floor_canvas.scan_dragto x,y}, '%x %y') $floor_canvas.bind('Destroy', proc{$currentRoom.unset}) $currentRoom.value = '' diff --git a/ext/tk/sample/demos-jp/floor2.rb b/ext/tk/sample/demos-jp/floor2.rb index d4381c5543..92ace6b51a 100644 --- a/ext/tk/sample/demos-jp/floor2.rb +++ b/ext/tk/sample/demos-jp/floor2.rb @@ -18,7 +18,7 @@ def floorDisplay2(w,active) w.delete('all') $activeFloor2 = active - # First go through the three floors, displaying the backgrounds for + # First go through the three floors, displaying the backgrounds for # each floor. floor2_bg1(w,$floor2_colors['bg1'],$floor2_colors['outline1']) @@ -29,12 +29,12 @@ def floorDisplay2(w,active) w.raise("floor#{active}") - # Create a dummy item just to mark this point in the display list, + # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. w.create(TkcRectangle,0,100,1,101,'fill'=>'','outline'=>'','tags'=>'marker') - # Add the walls and labels for the active floor, along with + # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. @@ -299,7 +299,7 @@ def floor2_bg3(w,fill,outline) w.create(TkcLine,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) - w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, + w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end @@ -313,316 +313,316 @@ end # color - Color to use for drawing foreground information. def floor2_fg1(w,color) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '101' $floorItems2['101'] = i - w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Pub Lift1' $floorItems2['Pub Lift1'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Priv Lift1' $floorItems2['Priv Lift1'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, + i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '110' $floorItems2['110'] = i - w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, + w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, + i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '109' $floorItems2['109'] = i - w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, + w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, + i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '111' $floorItems2['111'] = i - w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, + w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, + i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117B' $floorItems2['117B'] = i - w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, + w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, + i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '112' $floorItems2['112'] = i - w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, + w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, + i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '113' $floorItems2['113'] = i - w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, + w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, + i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117A' $floorItems2['117A'] = i - w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, + w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, + i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117' $floorItems2['117'] = i - w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, + w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, + i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '114' $floorItems2['114'] = i - w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, + w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, + i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '115' $floorItems2['115'] = i - w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, + w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, + i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '116' $floorItems2['116'] = i - w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, + w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, + i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '118' $floorItems2['118'] = i - w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, + w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, - 163,91,163,112,149,112,149,128, + 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '120' $floorItems2['120'] = i - w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, + w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, - 156,192,156,169,175,169,175,246,79,246, + 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '122' $floorItems2['122'] = i - w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, + w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, + i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '121' $floorItems2['121'] = i - w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, + w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, + i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106A' $floorItems2['106A'] = i - w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, + w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, + i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '105' $floorItems2['105'] = i - w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, + w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, + i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106B' $floorItems2['106B'] = i - w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, + w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, + i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '104' $floorItems2['104'] = i - w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, + w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, + i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '108' $floorItems2['108'] = i - w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, + w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, + i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '107' $floorItems2['107'] = i - w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, + w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, + i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Smoking' $floorItems2['Smoking'] = i - w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, + w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, + i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '123' $floorItems2['123'] = i - w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, + w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, + i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '103' $floorItems2['103'] = i - w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, + w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, + i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '124' $floorItems2['124'] = i - w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, + w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, + i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '125' $floorItems2['125'] = i - w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, + w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, + i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '126' $floorItems2['126'] = i - w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, + w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, - 486,253,486,239,474,239,474,209, + 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '127' $floorItems2['127'] = i - w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, + w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, - 490,188,490,204,476,204,476,164, + 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'MShower' $floorItems2['MShower'] = i - w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, + w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, + i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Closet' $floorItems2['Closet'] = i - w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, + w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, + i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'WShower' $floorItems2['WShower'] = i - w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, + w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, - 515,174,503,174,503,161,486,161, + 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '130' $floorItems2['130'] = i - w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, + w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, - 393,309,300,309,300,248,308,248, + 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '102' $floorItems2['102'] = i - w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, + w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, + i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '128' $floorItems2['128'] = i - w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, + w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '129' $floorItems2['129'] = i - w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, + w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, - 642,389,561,389,561,277,696,277, + 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '133' $floorItems2['133'] = i - w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, + w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, + i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '132' $floorItems2['132'] = i - w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, + w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, + i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '134' $floorItems2['134'] = i - w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, + w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, + i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '135' $floorItems2['135'] = i - w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, + w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, - 331,347,332,351,334,354,336,357,341,359, + 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Ramona Stair' $floorItems2['Ramona Stair'] = i - w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, + w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, - 122,28,123,32,123,68,220,68,220,87,90,87,90,23, + 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'University Stair' $floorItems2['University Stair'] = i - w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, + w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, - 227,13,223,17,221,22,220,34,260,34, + 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Stair' $floorItems2['Plaza Stair'] = i - w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, + w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, - 386,104,386,128,220,128, + 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Deck' $floorItems2['Plaza Deck'] = i - w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, + w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106' $floorItems2['106'] = i - w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, + w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, - 112,130,97,130,97,168,175,168,175,131,146,131, + 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '119' $floorItems2['119'] = i - w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, + w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) w.create(TkcLine,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) @@ -795,321 +795,321 @@ end def floor2_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, - 800,222,800,168,748,168, + 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '238' $floorItems2['238'] = i - w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, + w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '237' $floorItems2['237'] = i - w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, + w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, - 715,205,755,205,755,190,724,190,724,187, + 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '246' $floorItems2['246'] = i - w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, + w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, + i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '247' $floorItems2['247'] = i - w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, + w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, - 559,274,482,274,482,278,396,278,396,274,232,274, + 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '202' $floorItems2['202'] = i - w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, + w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, - 156,196,176,196,176,228, + 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '206' $floorItems2['206'] = i - w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, + w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, + i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '212' $floorItems2['212'] = i - w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, + w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, + i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '245' $floorItems2['245'] = i - w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, + w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, + i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '244' $floorItems2['244'] = i - w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, + w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, + i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '243' $floorItems2['243'] = i - w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, + w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, + i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '242' $floorItems2['242'] = i - w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, + w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, + i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Barbecue Deck' $floorItems2['Barbecue Deck'] = i - w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, + w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, + i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '240' $floorItems2['240'] = i - w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, + w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, + i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '241' $floorItems2['241'] = i - w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, + w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, + i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '239' $floorItems2['239'] = i - w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, + w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, + i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '248' $floorItems2['248'] = i - w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, + w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, + i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '236' $floorItems2['236'] = i - w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, + w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, + i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '235' $floorItems2['235'] = i - w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, + w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, - 572,143,579,143,579,185,626,185, + 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '234' $floorItems2['234'] = i - w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, + w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, - 578,185,527,185,527,131,557,131, + 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '233' $floorItems2['233'] = i - w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, + w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '230' $floorItems2['230'] = i - w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, + w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, + i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '232' $floorItems2['232'] = i - w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, + w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, + i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '229' $floorItems2['229'] = i - w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, + w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, + i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '227' $floorItems2['227'] = i - w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, + w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, + i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '228' $floorItems2['228'] = i - w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, + w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, + i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '226' $floorItems2['226'] = i - w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, + w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, + i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '225' $floorItems2['225'] = i - w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, + w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, + i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '224' $floorItems2['224'] = i - w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, + w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, + i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '223' $floorItems2['223'] = i - w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, + w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, + i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '222' $floorItems2['222'] = i - w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, + w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, + i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '221' $floorItems2['221'] = i - w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, + w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, + i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '204' $floorItems2['204'] = i - w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, + w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, + i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '205' $floorItems2['205'] = i - w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, + w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '207' $floorItems2['207'] = i - w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, + w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, + i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '208' $floorItems2['208'] = i - w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, + w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, + i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '209' $floorItems2['209'] = i - w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, + w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, + i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217' $floorItems2['217'] = i - w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, + w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, + i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217A' $floorItems2['217A'] = i - w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, + w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, + i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '216' $floorItems2['216'] = i - w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, + w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, + i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '215' $floorItems2['215'] = i - w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, + w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, + i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '214' $floorItems2['214'] = i - w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, + w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, + i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '213' $floorItems2['213'] = i - w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, + w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, + i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '210' $floorItems2['210'] = i - w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, + w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, + i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '211' $floorItems2['211'] = i - w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, + w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, + i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '203' $floorItems2['203'] = i - w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, + w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, - 154,198,154,192,109,192,109,169,99,169, + 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '220' $floorItems2['220'] = i - w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, + w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Priv Lift2' $floorItems2['Priv Lift2'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Pub Lift 2' $floorItems2['Pub Lift 2'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '218' $floorItems2['218'] = i - w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, + w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '219' $floorItems2['219'] = i - w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, + w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '201' $floorItems2['201'] = i - w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) w.create(TkcLine,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) @@ -1280,206 +1280,206 @@ def floor2_fg3(w,color) 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316' $floorItems2['316'] = i - w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, + w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, + i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '309' $floorItems2['309'] = i - w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, + w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, + i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '308' $floorItems2['308'] = i - w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, + w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, + i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '307' $floorItems2['307'] = i - w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, + w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, + i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '305' $floorItems2['305'] = i - w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, + w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324B' $floorItems2['324B'] = i - w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, + w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, + i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324A' $floorItems2['324A'] = i - w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, + w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, + i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '320' $floorItems2['320'] = i - w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, + w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, + i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '310' $floorItems2['310'] = i - w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, + w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, + i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '312' $floorItems2['312'] = i - w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, + w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, + i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '313' $floorItems2['313'] = i - w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, + w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, + i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '314' $floorItems2['314'] = i - w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, + w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, + i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '315' $floorItems2['315'] = i - w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, + w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, + i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316B' $floorItems2['316B'] = i - w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, + w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, + i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316A' $floorItems2['316A'] = i - w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, + w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, - 174,198,174,226,101,226,101,179,97,179, + 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '319' $floorItems2['319'] = i - w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, + w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, + i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '311' $floorItems2['311'] = i - w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, + w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '318' $floorItems2['318'] = i - w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, + w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '317' $floorItems2['317'] = i - w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, + w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, + i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '323' $floorItems2['323'] = i - w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, + w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, + i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '325' $floorItems2['325'] = i - w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, + w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, + i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '321' $floorItems2['321'] = i - w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, + w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, - 264,181,264,135,314,135, + 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '322' $floorItems2['322'] = i - w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, + w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Pub Lift3' $floorItems2['Pub Lift3'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Priv Lift3' $floorItems2['Priv Lift3'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, + i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '303' $floorItems2['303'] = i - w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, + w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, - 244,230,244,221,252,221,252,203, + 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324' $floorItems2['324'] = i - w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, + w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, + i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '304' $floorItems2['304'] = i - w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, + w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '301' $floorItems2['301'] = i - w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, + i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '327' $floorItems2['327'] = i - w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, + w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, + i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '326' $floorItems2['326'] = i - w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, + w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, - 375,274,397,274,397,248,339,248,339,242,308,242, + 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '302' $floorItems2['302'] = i - w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, + w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, - 107,248,160,248,160,301,107,301,107,275,70,275, + 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '306' $floorItems2['306'] = i - w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, + w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) @@ -1574,7 +1574,7 @@ end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($floor2_demo) && $floor2_demo - $floor2_demo.destroy + $floor2_demo.destroy $floor2_demo = nil end @@ -1590,7 +1590,7 @@ $floor2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($floor2_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥Ç¥£¥¸¥¿¥ë¥¨¥¯¥¤¥Ã¥×¥á¥ó¥È¼Ò¤Î¥¦¥§¥¹¥¿¥ó¥ê¥µ¡¼¥Á¥é¥Ü¥é¥È¥ê (DECWRL) ¤Î´Ö¼è¤ê¤¬½ñ¤«¤ì¤¿¥¥ã¥ó¥Ð¥¹ widget ¤¬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ï 3³¬·ú¤Æ¤Ç¡¢¾ï¤Ë¤½¤Î¤¦¤Á¤Î1³¬Ê¬¤¬ÁªÂò¡¢¤Ä¤Þ¤ê¤½¤Î´Ö¼è¤ê¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¤¢¤ë³¬¤òÁªÂò¤¹¤ë¤Ë¤Ï¡¢¤½¤Î¾å¤Ç¥Þ¥¦¥¹¤Îº¸¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£¥Þ¥¦¥¹¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë³¬¤Î¾å¤òÆ°¤¯¤È¡¢¤½¤Î²¼¤Ë¤¢¤ëÉô²°¤Î¿§¤¬ÊѤï¤ê¡¢Éô²°Èֹ椬¡ÖÉô²°ÈÖ¹æ:¡×¥¨¥ó¥È¥ê¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¢¥¨¥ó¥È¥ê¤ËÉô²°ÈÖ¹æ¤ò½ñ¤¯¤È¤½¤ÎÉô²°¤Î¿§¤¬ÊѤï¤ê¤Þ¤¹¡£"){ pack('side'=>'top') } @@ -1622,10 +1622,10 @@ $floorItems2 = {} if $tk_version =~ /^4\.[01]/ $floor2_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken', 'highlightthickness'=>2) - $floor2_canvas = TkCanvas.new($floor2_canvas_frame, - 'width'=>900, 'height'=>500, 'borderwidth'=>0, + $floor2_canvas = TkCanvas.new($floor2_canvas_frame, + 'width'=>900, 'height'=>500, 'borderwidth'=>0, 'highlightthickness'=>0) {|c| - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}){|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) pack('side'=>'bottom', 'fill'=>'x') @@ -1646,20 +1646,20 @@ else v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical') TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1| - $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, - 'borderwidth'=>0, + $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, + 'borderwidth'=>0, 'highlightthickness'=>0) { xscrollcommand(proc{|first,last| h.set first,last}) yscrollcommand(proc{|first,last| v.set first,last}) pack('expand'=>'yes', 'fill'=>'both') } - grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') } - v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) @@ -1675,7 +1675,7 @@ end # Create an entry for displaying and typing in current room. $currentRoom2 = TkVariable.new -$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken', +$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken', 'bd'=>2, 'textvariable'=>$currentRoom2) # Choose colors, then fill in the floorplan. @@ -1712,7 +1712,7 @@ $floor2_canvas.itembind('floor3', '1', proc{floorDisplay2 $floor2_canvas,3}) $floor2_canvas.itembind('room', 'Enter', proc{newRoom2 $floor2_canvas}) $floor2_canvas.itembind('room', 'Leave', proc{$currentRoom2.value = ''}) $floor2_canvas.bind('2', proc{|x,y| $floor2_canvas.scan_mark x,y}, '%x %y') -$floor2_canvas.bind('B2-Motion', +$floor2_canvas.bind('B2-Motion', proc{|x,y| $floor2_canvas.scan_dragto x,y}, '%x %y') $floor2_canvas.bind('Destroy', proc{$currentRoom2.unset}) $currentRoom2.value = '' diff --git a/ext/tk/sample/demos-jp/form.rb b/ext/tk/sample/demos-jp/form.rb index 4de7056764..84ed94de88 100644 --- a/ext/tk/sample/demos-jp/form.rb +++ b/ext/tk/sample/demos-jp/form.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($form_demo) && $form_demo - $form_demo.destroy + $form_demo.destroy $form_demo = nil end diff --git a/ext/tk/sample/demos-jp/goldberg.rb b/ext/tk/sample/demos-jp/goldberg.rb index a81c7ec70c..ea521b82ec 100644 --- a/ext/tk/sample/demos-jp/goldberg.rb +++ b/ext/tk/sample/demos-jp/goldberg.rb @@ -44,7 +44,7 @@ #>># lots of canvas create and move calls. if defined?($goldberg_demo) && $goldberg_demo - $goldberg_demo.destroy + $goldberg_demo.destroy $goldberg_demo = nil end @@ -103,7 +103,7 @@ class TkGoldberg_Demo @S['pause'] = TkVariable.new @S['details'] = TkVariable.new(true) - @S['mode'] = TkVariable.new(:MSTART, :symbol) + @S['mode'] = TkVariable.new(:MSTART, :symbol) # :MSTART, :MGO, :MPAUSE, :MSSTEP, :MBSTEP, :MDONE, :MDEBUG # 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 @@ -134,19 +134,19 @@ class TkGoldberg_Demo @XY = {} @XY6 = { - '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], + '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], '-5'=>[340, 190], '-6'=>[349, 177], '-7'=>[366, 177], '-8'=>[380, 176], - '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], - '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], - '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], - '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], - '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], - '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], - '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], - '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], - '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], - '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], - '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], + '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], + '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], + '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], + '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], + '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], + '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], + '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], + '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], + '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], + '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], + '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], '13,15'=>[376, 410], '13,16'=>[360, 403] } @@ -163,11 +163,11 @@ class TkGoldberg_Demo def do_display() @ctrl = TkFrame.new(@parent, :relief=>:ridge, :bd=>2, :padx=>5, :pady=>5) - @screen = TkFrame.new(@parent, :bd=>2, - :relief=>:raised).pack(:side=>:left, :fill=>:both, + @screen = TkFrame.new(@parent, :bd=>2, + :relief=>:raised).pack(:side=>:left, :fill=>:both, :expand=>true) - @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, + @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, :bg=>@C['bg'], :highlightthickness=>0){ scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up yview_moveto(0.05) @@ -206,8 +206,8 @@ class TkGoldberg_Demo command proc{showCode 'goldberg'} }.pack('side'=>'left', 'padx'=>5) - # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, - @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, :bg=>@C['bg'], :activebackground=>@C['bg']) @show.pack('side'=>'left') frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) @@ -216,34 +216,34 @@ class TkGoldberg_Demo end def do_ctrl_frame - @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, + @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, :command=>proc{do_button(0)}) if font = @start['font'] @start.font(font.weight('bold')) end - @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, - :command=>proc{do_button(1)}, :relief=>:raised, + @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, + :command=>proc{do_button(1)}, :relief=>:raised, :variable=>@S['pause']) - @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, + @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, :command=>proc{do_button(2)}) - @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, + @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, :command=>proc{do_button(4)}) - @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, + @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, :command=>proc{do_button(3)}) @details = TkFrame.new(@parent, :bd=>2, :relief=>:ridge) - @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, + @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, :relief=>:raised, :variable=>@S['details']) - @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], + @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], :justify=>:center) - @speed_scale = TkScale.new(@parent, :orient=>:horizontal, - :from=>1, :to=>10, :font=>font, - :variable=>@S['speed'], :bd=>2, + @speed_scale = TkScale.new(@parent, :orient=>:horizontal, + :from=>1, :to=>10, :font=>font, + :variable=>@S['speed'], :bd=>2, :relief=>:ridge, :showvalue=>false) - @about = TkButton.new(@parent, :text=>'About', + @about = TkButton.new(@parent, :text=>'About', :command=>proc{about}, :font=>font) Tk.grid(@start, :in=>@ctrl, :row=>0, :sticky=>:ew) @@ -271,17 +271,17 @@ class TkGoldberg_Demo def do_detail_frame @f_details = TkFrame.new(@details) - @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], + @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], :bd=>1, :relief=>:solid, :bg=>'white') Tk.grid(@label, '-', '-', '-', :sticky=>:ew, :row=>0) idx = 1 loop { break unless respond_to?("move#{idx}") - l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, + l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, :width=>2, :bd=>1, :relief=>:solid, :bg=>'white') @STEP[idx] = 0 - ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), + ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), :width=>5, :bd=>1, :relief=>:solid, :bg=>'white') row = (idx + 1)/2 col = ((idx + 1) & 1) * 2 @@ -385,7 +385,7 @@ class TkGoldberg_Demo who = who.to_i n = send("move#{who}") if (n & 1).nonzero? # This guy still alive - alive << who + alive << who end if (n & 2).nonzero? # Next guy is active alive << (who + 1) @@ -418,12 +418,12 @@ class TkGoldberg_Demo # START HERE! banner def draw0 color = @C['0'] - TkcText.new(@canvas, - # [579, 119], :text=>'START HERE!', - [558, 119], :text=>'¤³¤³¤«¤é¥¹¥¿¡¼¥È¡ª', - :fill=>color, :anchor=>:w, + TkcText.new(@canvas, + # [579, 119], :text=>'START HERE!', + [558, 119], :text=>'¤³¤³¤«¤é¥¹¥¿¡¼¥È¡ª', + :fill=>color, :anchor=>:w, :tag=>'I0', :font=>['Times Roman', 12, :italic, :bold]) - TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, + TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, :width=>5, :arrow=>:last, :arrowshape=>[18, 18, 5]) @canvas.itembind('I0', '1'){ start } end @@ -437,7 +437,7 @@ class TkGoldberg_Demo end pos = [ - [673, 119], [678, 119], [683, 119], [688, 119], + [673, 119], [678, 119], [683, 119], [688, 119], [693, 119], [688, 119], [683, 119], [678, 119] ] step = step % pos.length @@ -449,15 +449,15 @@ class TkGoldberg_Demo def draw1 color = @C['1a'] color2 = @C['1b'] - TkcPolygon.new(@canvas, - [ 844, 133, 800, 133, 800, 346, 820, 346, - 820, 168, 844, 168, 844, 133 ], + TkcPolygon.new(@canvas, + [ 844, 133, 800, 133, 800, 346, 820, 346, + 820, 168, 844, 168, 844, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcPolygon.new(@canvas, - [ 771, 133, 685, 133, 685, 168, 751, 168, - 751, 346, 771, 346, 771, 133 ], + TkcPolygon.new(@canvas, + [ 771, 133, 685, 133, 685, 168, 751, 168, + 751, 346, 771, 346, 771, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcOval.new(@canvas, box(812, 122, 9), + TkcOval.new(@canvas, box(812, 122, 9), :tag=>'I1', :fill=>color2, :outline=>'') @canvas.itembind('I1', '1'){ start } @@ -466,9 +466,9 @@ class TkGoldberg_Demo def move1(step = nil) step = get_step(1, step) pos = [ - [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], - [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], - [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], + [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], + [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], + [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], [-100, -100] ] return 0 if step >= pos.length @@ -484,40 +484,40 @@ class TkGoldberg_Demo color = @C['2'] # Fulcrum - TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], + TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], :fill=>@C['fg'], :outline=>@C['fg']) # Strike box - TkcRectangle.new(@canvas, [628, 335, 660, 383], + TkcRectangle.new(@canvas, [628, 335, 660, 383], :fill=>'', :outline=>@C['fg']) (0..2).each{|y| yy = 335 + y*16 - TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) - TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) } # Lever - TkcLine.new(@canvas, [702, 366, 798, 366], + TkcLine.new(@canvas, [702, 366, 798, 366], :fill=>@C['fg'], :width=>6, :tag=>'I2_0') # R strap - TkcLine.new(@canvas, [712, 363, 712, 355], + TkcLine.new(@canvas, [712, 363, 712, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_1') # L strap - TkcLine.new(@canvas, [705, 363, 705, 355], + TkcLine.new(@canvas, [705, 363, 705, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_2') # Match stick - TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], + TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], :fill=>@C['fg'], :width=>3, :tag=>'I2_3') # Match head - TkcPolygon.new(@canvas, - [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, - 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], + TkcPolygon.new(@canvas, + [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, + 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], :fill=>color, :outline=>color, :tag=>'I2_4') end @@ -527,15 +527,15 @@ class TkGoldberg_Demo stages = [0, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 1] xy = [] xy[0] = [ - 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, + 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, 662, 318, 662, 328, 671, 336 ] xy[1] = [ - 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, + 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, 661, 327, 671, 335 ] xy[2] = [ - 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, + 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, 666, 309, 660, 324, 672, 336 ] @@ -546,7 +546,7 @@ class TkGoldberg_Demo if step == 0 # Rotate the match beta = 20 - + ox, oy = anchor('I2_0', :s) # Where to pivot i = 0 @@ -571,23 +571,23 @@ class TkGoldberg_Demo xy = [ [602, 296], [577, 174], [518, 174] ] xy.each{|x, y| # 3 Pulleys - TkcOval.new(@canvas, box(x, y, 13), + TkcOval.new(@canvas, box(x, y, 13), :fill=>color, :outline=>@C['fg'], :width=>3) TkcOval.new(@canvas, box(x, y, 2), :fill=>@C['fg'], :outline=>@C['fg']) } # Wall to flame - TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', + TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', :width=>3, :fill=>@C['fg'], :smooth=>true) # Flame to pulley 1 - TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', + TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', :width=>3, :fill=>@C['fg'], :smooth=>true) - TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', + TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', :width=>3, :fill=>@C['fg'], :smooth=>true) # Pulley 1 half way to 2 - TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', + TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', :width=>3, :fill=>@C['fg']) # Pulley 1 other half to 2 @@ -597,26 +597,26 @@ class TkGoldberg_Demo TkcLine.new(@canvas, [577, 161, 518, 161], :width=>3, :fill=>@C['fg']) # Down to weight - TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', + TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', :width=>3, :fill=>@C['fg']) # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle x1, y1, x2, y2 = [515, 207, 495, 207] - TkcOval.new(@canvas, box(x1, y1, 6), + TkcOval.new(@canvas, box(x1, y1, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcOval.new(@canvas, box(x2, y2, 6), + TkcOval.new(@canvas, box(x2, y2, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, + TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, :tag=>'I3_', :fill=>color2, :outline=>color2) - - TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), + + TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), :smooth=>true, :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcLine.new(@canvas, [500, 217, 511, 217], + TkcLine.new(@canvas, [500, 217, 511, 217], :tag=>'I3_', :fill=>color2, :width=>10) # Bottom weight target - TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], + TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], :tag=>'I3__', :fill=>@C['fg'], :joinstyle=>:miter, :width=>10) end @@ -659,7 +659,7 @@ class TkGoldberg_Demo } # Swing gate - TkcLine.new(@canvas, [518, 464, 518, 428], + TkcLine.new(@canvas, [518, 464, 518, 428], :tag=>'I4', :fill=>color, :width=>1) end @@ -686,7 +686,7 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3) xy = [ - 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, + 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, 575, 452, 574, 454, 566, 456, 554, 456, 545, 456, 537, 454, 530, 452 ] TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_0'], :fill=>color) @@ -696,7 +696,7 @@ class TkGoldberg_Demo xy = box(540, 446, 2) # Eye xy = [540, 444, 541, 445, 541, 447, 540, 448, 538, 447, 538, 445] - TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], + TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], :outline=>'', :smooth=>true) xy = [538, 454, 535, 461] # Front leg @@ -716,9 +716,9 @@ class TkGoldberg_Demo step = get_step(5, step) pos = [ - [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], - [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], - [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], + [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], + [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], + [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], [422, 274, -30], [422, 260.5, -30, :x], [422.5, 248.5, -28], [425, 237] ] @@ -739,16 +739,16 @@ class TkGoldberg_Demo color = @C['6'] xy = [324, 130, 391, 204] # Ball holder xy = round_rect(xy, 10) - TkcPolygon.new(@canvas, xy, :smooth=>true, + TkcPolygon.new(@canvas, xy, :smooth=>true, :outline=>@C['fg'], :width=>3, :fill=>color) xy = [339, 204, 376, 253] # Below the ball holder - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>color, :tag=>'I6c') xy = box(346, 339, 28) TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') # Roter - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>80, :extent=>205) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>-41, :extent=>85) xy = box(346, 339, 15) # Center of rotor @@ -763,10 +763,10 @@ class TkGoldberg_Demo TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'') xy = [ - 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, + 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, 352, 403, 352, 366 ] - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2) # Below rotor TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2) xy = box(275, 342, 7) # On/off rotor @@ -791,7 +791,7 @@ class TkGoldberg_Demo loc = -i color = colors[i] x, y = @XY6["#{loc}"] - TkcOval.new(@canvas, box(x, y, 5), + TkcOval.new(@canvas, box(x, y, 5), :fill=>color, :outline=>color, :tag=>"I6_b#{i}") } draw6a(12) # The wheel @@ -817,7 +817,7 @@ class TkGoldberg_Demo @canvas.move('I6_', -7, 0) if step == 1 # Poke a hole xy = [348, 226, 365, 240] - TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), + TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), :outline=>'') end return 1 @@ -857,24 +857,24 @@ class TkGoldberg_Demo def draw7 color = @C['7'] xy = [198, 306, 277, 374] # Box - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :fill=>color, :tag=>'I7z') @canvas.lower('I7z') xy = [275, 343, 230, 349] - TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, + TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, :arrowshape=>[23, 23, 8], :width=>6) xy = [225, 324] # On button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 323] # On text font = ['Times Roman', 8] - TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, :fill=>@C['fg'], :font=>font) xy = [225, 350] # Off button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 349] # Off text - TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, :fill=>@C['fg'], :font=>font) end @@ -919,7 +919,7 @@ class TkGoldberg_Demo xy = [280, 209, 296, 248] TkcOval.new(@canvas, xy, :outline=>color, :fill=>color) xy = [ - 288, 249, 252, 249, 260, 240, 280, 234, + 288, 249, 252, 249, 260, 240, 280, 234, 296, 234, 316, 240, 324, 249, 288, 249 ] TkcPolygon.new(@canvas, xy, :fill=>color, :smooth=>true) @@ -928,16 +928,16 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color) xy = [255, 206, 265, 234] # Fan blades - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 176, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 206, 265, 220] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') xy = [255, 190, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') end @@ -962,17 +962,17 @@ class TkGoldberg_Demo color = @C['10a'] color2 = @C['10b'] xy = [191, 230, 233, 230, 233, 178, 191, 178] # Sail - TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], :tag=>'I10') xy = box(209, 204, 31) # Front - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = box(249, 204, 31) # Back - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = [200, 171, 200, 249] # Mast @@ -992,10 +992,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(239, 262, 17) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>95, :extent=>103) xy = box(76, 266, 21) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>190) end @@ -1003,9 +1003,9 @@ class TkGoldberg_Demo step = get_step(10, step) pos = [ - [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], - [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], - [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], + [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], + [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], + [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], [116, 212], [111, 212] ] @@ -1032,21 +1032,21 @@ class TkGoldberg_Demo xy = [55, 504, 55, 591] # Bottom right side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(71, 460, 48) # Outer loop - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>110, :extent=>-290, :tag=>'I11i') xy = box(71, 460, 16) # Inner loop - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', :width=>3, :tag=>'I11i') TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['bg'], :width=>3) xy = [23, 264, 23, 591] # Left side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(1, 266, 23) # Top left curve - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>90) xy = box(75, 235, 9) # The ball - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', :width=>3, :tag=>'I11') end @@ -1054,8 +1054,8 @@ class TkGoldberg_Demo step = get_step(11, step) pos = [ - [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], - [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], + [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], + [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], [100, 437], [65, 423], [-100, -100], [38, 505], [38, 527, :x], [38, 591] ] @@ -1069,11 +1069,11 @@ class TkGoldberg_Demo # Hand def draw12 xy = [ - 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, + 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, 60, 590, 60, 610, 60, 610 ] xy.concat([60, 610, 65, 620, 60, 631]) # Thumb - xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, + xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, 56, 669, 50, 669, 50, 662, 50, 637]) y0 = 637 # Bumps for fingers @@ -1083,7 +1083,7 @@ class TkGoldberg_Demo x2 = x - 10 xy << x << y0 << x1 << y1 << x2 << y0 } - TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], :smooth=>true, :tag=>'I12', :width=>3) end @@ -1107,25 +1107,25 @@ class TkGoldberg_Demo ] radii = [2, 9, 9, 8, 5, 5, 2] - round_poly(@canvas, xy, radii, :width=>3, + round_poly(@canvas, xy, radii, :width=>3, :outline=>@C['fg'], :fill=>color) - round_poly(@canvas, xy2, radii, :width=>3, + round_poly(@canvas, xy2, radii, :width=>3, :outline=>@C['fg'], :fill=>color) xy = [56, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13') xy = [809, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13R') xy = [112, 687] # Label - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [762, 687] - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [138, 663, 148, 636, 178, 636] # Paper guide @@ -1133,7 +1133,7 @@ class TkGoldberg_Demo xy = [732, 663, 722, 636, 692, 636] TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3) - sine([149, 688, 720, 688], 5, 15, + sine([149, 688, 720, 688], 5, 15, :tag=>'I13_s', :fill=>@C['fg'], :width=>3) end @@ -1163,17 +1163,17 @@ class TkGoldberg_Demo def draw14 color = @C['14'] xy = [102, 661, 113, 632, 130, 618] # Left paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_0') xy = [148, 629, 125, 640, 124, 662] # Right paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_1') draw14a('L') xy = [ 768.0, 662.5, 767.991316225, 662.433786215, 767.926187912, 662.396880171 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_0') @canvas.lower('I14R_0') # NB. these numbers are VERY sensitive, you must start with final size @@ -1181,7 +1181,7 @@ class TkGoldberg_Demo xy = [ 745.947897349, 662.428358855, 745.997829056, 662.452239237, 746.0, 662.5 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_1') @canvas.lower('I14R_1') end @@ -1194,11 +1194,11 @@ class TkGoldberg_Demo x3, y3, x4, y4, x5, y5 = xy2 zz = [ - x0, y0, x0, y0, xy, x2, y2, x2, y2, + x0, y0, x0, y0, xy, x2, y2, x2, y2, x3, y3, x3, y3, xy2, x5, y5, x5, y5 ].flatten @canvas.delete("I14#{side}") - TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, + TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, :fill=>color, :outline=>color, :width=>3) @canvas.lower("I14#{side}") end @@ -1251,7 +1251,7 @@ class TkGoldberg_Demo xy = [765, 557, 784, 583] TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2) - sine([658, 580, 765, 580], 3, 15, + sine([658, 580, 765, 580], 3, 15, :tag=>'I15_s', :fill=>@C['fg'], :width=>3) end @@ -1290,7 +1290,7 @@ class TkGoldberg_Demo xy = [722, 485, 791, 556] TkcRectangle.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3) xy = box(752, 515, 25) # Bell - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', :tag=>'I16b', :width=>2) xy = box(752, 515, 5) # Bell button TkcOval.new(@canvas, xy, :fill=>'black', :outline=>'black', :tag=>'I16b') @@ -1329,24 +1329,24 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = [664, 523, 717, 549] # Body - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :style=>:chord, :start=>128, :extent=>260, :tag=>'I17') xy = [709, 554, 690, 543] # Paw - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = [657, 544, 676, 555] - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = box(660, 535, 15) # Lower face - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>150, :extent=>240, :tag=>'I17_') - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:chord, :start=>150, :extent=>240, :tag=>'I17_') xy = [674, 529, 670, 513, 662, 521, 658, 521, 650, 513, 647, 529] # Ears TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, :tag=>['I17_', 'I17_c']) xy = [652, 542, 628, 539] # Whiskers TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') @@ -1356,23 +1356,23 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [668, 543, 687, 538] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 544, 688, 546] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 547, 688, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [649, 530, 654, 538, 659, 530] # Left eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [671, 530, 666, 538, 661, 530] # Right eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [655, 543, 660, 551, 665, 543] # Mouth - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') end @@ -1385,10 +1385,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = box(654, 530, 4) # Left eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') xy = box(666, 530, 4) # Right eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') @canvas.move('I17_', 0, -20) # Move face up @@ -1398,19 +1398,19 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [ # Body - 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, - 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, + 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, + 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, 668, 527, 668, 527, 675, 522, 676, 517, 677, 512 ] - TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), - :outline=>@C['fg'], :width=>3, :smooth=>true, + TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), + :outline=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = [716, 514, 716, 554] # Back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [694, 532, 694, 554] # 2nd back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [715, 514, 718, 506, 719, 495, 716, 488] # Tail - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') @canvas.raise('I17w') # Make whiskers visible @@ -1439,14 +1439,14 @@ class TkGoldberg_Demo step = get_step(18, step) pos = [ - [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], + [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], [136, 506], [16, 506], [-100, -100] ] b = [] b[0] = [490, 502, 719, 507, 524, 512] # Band collapsing b[1] = [ - 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, + 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, 553, 536, 538, 534, 532, 519, 529, 499 ] b[2] = [ @@ -1477,54 +1477,54 @@ class TkGoldberg_Demo color = @C['19'] xx = [[249, 181], [155, 118], [86, 55], [22, 0]] xx.each{|x1, x2| - TkcRectangle.new(@canvas, x1, 453, x2, 467, + TkcRectangle.new(@canvas, x1, 453, x2, 467, :fill=>color, :outline=>'', :tag=>'I19') - TkcLine.new(@canvas, x1, 453, x2, 453, + TkcLine.new(@canvas, x1, 453, x2, 453, :fill=>@C['fg'], :width=>1) # Pipe top - TkcLine.new(@canvas, x1, 467, x2, 467, + TkcLine.new(@canvas, x1, 467, x2, 467, :fill=>@C['fg'], :width=>1) # Pipe bottom } @canvas.raise('I11i') xy = box(168, 460, 16) # Bulge by the joint TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>21, :extent=>136) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>-21, :extent=>-130) xy = [249, 447, 255, 473] # First joint 26x6 TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1) xy = box(257, 433, 34) # Bend up - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>-91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 433, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>-92) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 421, 34) # Bend left - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(257, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(243, 421, 34) # Bend down - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = box(243, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = [270, 427, 296, 433] # 2nd joint bottom @@ -1566,7 +1566,7 @@ class TkGoldberg_Demo pos = [451, 462, 473, 484, 496, 504, 513, 523, 532] freq = [20, 40, 40, 40, 40, 40, 40, 40, 40] pos = [ - [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], + [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], [504, 40], [513, 40], [523, 40], [532, 40, :x] ] return 0 if step >= pos.length @@ -1583,11 +1583,11 @@ class TkGoldberg_Demo color = @C['20'] @canvas.delete('I20') - sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], + sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], :width=>3, :fill=>color, :smooth=>true) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20a']) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20b']) @canvas.move('I20a', 8, 0) @canvas.move('I20b', 16, 0) @@ -1603,18 +1603,18 @@ class TkGoldberg_Demo xy = [245, 490, 237, 535] # Right side xy2 = [189, 535, 181, 490] # Left side - TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', :tag=>['I21', 'I21f']) TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21') TkcLine.new(@canvas, xy2, :fill=>@C['fg'], :width=>2, :tag=>'I21') xy = [182, 486, 244, 498] # Top - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, :tag=>['I21', 'I21f']) - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21t']) xy = [189, 532, 237, 540] # Bottom - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21b']) end @@ -1637,7 +1637,7 @@ class TkGoldberg_Demo @canvas.itemconfigure('I21b', :fill=>@C['20']) @canvas.delete('I21w') - TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, + TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, :tag=>['I21', 'I21w'], :outline=>'', :fill=>@C['20']) @canvas.lower('I21w', 'I21') @canvas.raise('I21b') @@ -1673,21 +1673,21 @@ class TkGoldberg_Demo color3 = @C['23c'] xy = [185, 623, 253, 650] # Block - TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], + TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], :width=>2, :tag=>'I23a') xy = [187, 592, 241, 623] # Balloon TkcOval.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', :style=>:arc, :start=>12, :extent=>336) xy = [239, 604, 258, 589, 258, 625, 239, 610] # Balloon nozzle TkcPolygon.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23b') xy = [285, 611, 250, 603] # Dart body - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 596, 249, 618, 264, 607, 249, 596] # Dart tail - TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 607, 268, 607] # Dart detail TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d') @@ -1699,7 +1699,7 @@ class TkGoldberg_Demo step = get_step(23, step) pos = [ - [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], + [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], [487, 607], [587, 607], [687, 607], [787, 607], [-100, -100] ] @@ -1719,7 +1719,7 @@ class TkGoldberg_Demo def draw24 color = @C['24a'] xy = [366, 518, 462, 665] # Balloon - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3, :tag=>'I24') xy = [414, 666, 414, 729] # String TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I24') @@ -1728,16 +1728,16 @@ class TkGoldberg_Demo :width=>3, :tag=>'I24') xy = [387, 567, 390, 549, 404, 542] # Reflections - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [395, 568, 399, 554, 413, 547] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [403, 570, 396, 555, 381, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [408, 564, 402, 547, 386, 545] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') end @@ -1750,16 +1750,16 @@ class TkGoldberg_Demo if step == 0 @canvas.delete('I24') # Exploding balloon xy = [ - 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, - 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, - 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, - 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, + 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, + 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, + 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, + 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, 431, 441, 431, 440, 400, 502, 347, 465, 347, 465 ] - TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], + TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], :outline=>@C['24a'], :width=>10, :smooth=>true) msg = Tk.subst(@S['message'].value) - TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], + TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], :justify=>:center, :font=>['Times Roman', 18, :bold]) return 1 end @@ -1790,9 +1790,9 @@ class TkGoldberg_Demo if step >= 3 @canvas.delete('I24', 'I26') - TkcText.new(@canvas, 430, 735, :anchor=>:s, :tag=>'I26', - #:text=>'click to continue', - :text=>'¥¯¥ê¥Ã¥¯¤Ç¥ê¥»¥Ã¥È¤·¤Þ¤¹', + TkcText.new(@canvas, 430, 735, :anchor=>:s, :tag=>'I26', + #:text=>'click to continue', + :text=>'¥¯¥ê¥Ã¥¯¤Ç¥ê¥»¥Ã¥È¤·¤Þ¤¹', :font=>['Times Roman', 20, :bold]) @canvas.bind('1', proc{reset}) return 4 @@ -1972,11 +1972,11 @@ class TkGoldberg_Demo def sparkle(oxy, tag) xy = [ - [299, 283], [298, 302], [295, 314], [271, 331], + [299, 283], [298, 302], [295, 314], [271, 331], [239, 310], [242, 292], [256, 274], [281, 273] ] xy.each{|x, y| - TkcLine.new(@canvas, 271, 304, x, y, + TkcLine.new(@canvas, 271, 304, x, y, :fill=>'white', :width=>3, :tag=>tag) } move_abs(tag, oxy) diff --git a/ext/tk/sample/demos-jp/icon.rb b/ext/tk/sample/demos-jp/icon.rb index a2ca6651dc..935519435b 100644 --- a/ext/tk/sample/demos-jp/icon.rb +++ b/ext/tk/sample/demos-jp/icon.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($icon_demo) && $icon_demo - $icon_demo.destroy + $icon_demo.destroy $icon_demo = nil end diff --git a/ext/tk/sample/demos-jp/image1.rb b/ext/tk/sample/demos-jp/image1.rb index d9435cc1a2..10078c6c22 100644 --- a/ext/tk/sample/demos-jp/image1.rb +++ b/ext/tk/sample/demos-jp/image1.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($image1_demo) && $image1_demo - $image1_demo.destroy + $image1_demo.destroy $image1_demo = nil end diff --git a/ext/tk/sample/demos-jp/image2.rb b/ext/tk/sample/demos-jp/image2.rb index 1bb2c9e9c3..3e8b87461f 100644 --- a/ext/tk/sample/demos-jp/image2.rb +++ b/ext/tk/sample/demos-jp/image2.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($image2_demo) && $image2_demo - $image2_demo.destroy + $image2_demo.destroy $image2_demo = nil end diff --git a/ext/tk/sample/demos-jp/image3.rb b/ext/tk/sample/demos-jp/image3.rb index 12b8aafd8e..625e69a21d 100644 --- a/ext/tk/sample/demos-jp/image3.rb +++ b/ext/tk/sample/demos-jp/image3.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($image3_demo) && $image3_demo - $image3_demo.destroy + $image3_demo.destroy $image3_demo = nil end @@ -22,7 +22,7 @@ $image3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($image3_demo).pack(:fill=>:both, :expand=>true) -# +# def loadDir3(w) w.delete(0,'end') Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f| @@ -38,10 +38,10 @@ end # Arguments: # w - Name of the toplevel window of the demo. def selectAndLoadDir3(w, lbox) - dir = Tk.chooseDirectory(:initialdir=>$dirName.value, + dir = Tk.chooseDirectory(:initialdir=>$dirName.value, :parent=>w, :mustexist=>true) if dir.length > 0 - $dirName.value = dir + $dirName.value = dir loadDir3(lbox) end end @@ -94,11 +94,11 @@ image3_f = TkFrame.new(base_frame).pack(:fill=>:both, :expand=>true) image3_df = TkLabelFrame.new(base_frame, :text=>'¥Ç¥£¥ì¥¯¥È¥ê:') -image3_ff = TkLabelFrame.new(base_frame, :text=>'¥Õ¥¡¥¤¥ë:', +image3_ff = TkLabelFrame.new(base_frame, :text=>'¥Õ¥¡¥¤¥ë:', :padx=>'2m', :pady=>'2m') image3_lbx = TkListbox.new(image3_ff, :width=>20, :height=>10) { pack(:side=>:left, :fill=>:y, :expand=>true) - yscrollbar(TkScrollbar.new(image3_ff).pack(:side=>:left, :fill=>:y, + yscrollbar(TkScrollbar.new(image3_ff).pack(:side=>:left, :fill=>:y, :expand=>true)) insert(0, *(%w(earth.gif earthris.gif teapot.ppm))) bind('Double-1', proc{|x,y| loadImage3(self, x, y)}, '%x %y') @@ -109,7 +109,7 @@ image3_ent = TkEntry.new(image3_df, :width=>30, :textvariable=>$dirName){ bind('Return', proc{loadDir3(image3_lbx)}) } -TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"¥Ç¥£¥ì¥¯¥È¥êÁªÂò", +TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"¥Ç¥£¥ì¥¯¥È¥êÁªÂò", :command=>proc{selectAndLoadDir3(image3_ent, image3_lbx)}) { pack(:side=>:left, :fill=>:y, :padx=>[0, '2m'], :pady=>'2m') } @@ -121,7 +121,7 @@ image3_if = TkLabelFrame.new(base_frame, :text=>'¥¤¥á¡¼¥¸:') {|f| Tk.grid(image3_df, '-', :sticky=>:ew, :padx=>'1m', :pady=>'1m', :in=>image3_f) -Tk.grid(image3_ff, image3_if, +Tk.grid(image3_ff, image3_if, :sticky=>:nw, :padx=>'1m', :pady=>'1m', :in=>image3_f) TkGrid.columnconfigure(image3_f, 1, :weight=>1) diff --git a/ext/tk/sample/demos-jp/items.rb b/ext/tk/sample/demos-jp/items.rb index 64ceeff3ec..4440905db8 100644 --- a/ext/tk/sample/demos-jp/items.rb +++ b/ext/tk/sample/demos-jp/items.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($items_demo) && $items_demo - $items_demo.destroy + $items_demo.destroy $items_demo = nil end @@ -73,11 +73,11 @@ TkFrame.new(base_frame) {|cf| c.pack('in'=>cf, 'expand'=>'yes', 'fill'=>'both') else - c.grid('in'=>cf, 'row'=>0, 'column'=>0, + c.grid('in'=>cf, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - vs.grid('row'=>0, 'column'=>1, + vs.grid('row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - hs.grid('row'=>1, 'column'=>0, + hs.grid('row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(cf, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(cf, 0, 'weight'=>1, 'minsize'=>0) @@ -118,8 +118,8 @@ $tag_item = TkcGroup.new(cvs) # Set up demos within each of the areas of the grid. TkcText.new(cvs, '5c', '.2c', 'text'=>'¥é¥¤¥ó', 'anchor'=>'n') -TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c', - 'width'=>2, 'fill'=>blue, 'capstyle'=>'butt', +TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c', + 'width'=>2, 'fill'=>blue, 'capstyle'=>'butt', 'join'=>'miter', 'tags'=>$tag_item ) TkcLine.new(cvs, '4.67c','1c','4.67c','4c', 'arrow'=>'last', 'tags'=>$tag_item) TkcLine.new(cvs, '6.33c','1c','6.33c','4c', 'arrow'=>'both', 'tags'=>$tag_item) @@ -127,38 +127,38 @@ TkcLine.new(cvs, '5c','6c','9c','6c','9c','1c','8c','1c','8c','4.8c','8.8c', '4.8c','8.8c','1.2c','8.2c','1.2c','8.2c','4.6c','8.6c','4.6c', '8.6c','1.4c','8.4c','1.4c','8.4c','4.4c', 'width'=>3, 'fill'=>red, 'tags'=>$tag_item ) -TkcLine.new(cvs, '1c','5c','7c','5c','7c','7c','9c','7c', 'width'=>'.5c', +TkcLine.new(cvs, '1c','5c','7c','5c','7c','7c','9c','7c', 'width'=>'.5c', 'stipple'=>'@'+[$demo_dir,'..', - 'images','gray25.xbm'].join(File::Separator), + 'images','gray25.xbm'].join(File::Separator), 'arrow'=>'both', 'arrowshape'=>'15 15 7', 'tags'=>$tag_item ) TkcLine.new(cvs, '1c','7c','1.75c','5.8c','2.5c','7c','3.25c','5.8c','4c','7c', - 'width'=>'.5c', 'capstyle'=>'round', 'join'=>'round', + 'width'=>'.5c', 'capstyle'=>'round', 'join'=>'round', 'tags'=>$tag_item ) -TkcText.new(cvs, '15c', '.2c', +TkcText.new(cvs, '15c', '.2c', 'text'=>'¶ÊÀþ (³ê¤é¤«¤Ë¤Ä¤Ê¤¤¤ÀľÀþ)', 'anchor'=>'n') -TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c', +TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c', 'smooth'=>'on', 'fill'=>blue, 'tags'=>$tag_item ) -TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c', +TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c', 'smooth'=>'on', 'arrow'=>'both', 'width'=>3, 'tags'=>$tag_item ) -TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c', +TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c', '16.5c','4.5c','13.5c','7.5c','12c','6c', - 'smooth'=>'on', 'width'=>'3m', 'capstyle'=>'round', + 'smooth'=>'on', 'width'=>'3m', 'capstyle'=>'round', 'stipple'=>'@'+[$demo_dir, '..', - 'images', 'gray25.xbm'].join(File::Separator), + 'images', 'gray25.xbm'].join(File::Separator), 'fill'=>red, 'tags'=>$tag_item ) TkcText.new(cvs, '25c', '.2c', 'text'=>'¿³Ñ·Á', 'anchor'=>'n') TkcPolygon.new(cvs, '21c','1.0c','22.5c','1.75c','24c','1.0c','23.25c','2.5c', '24c','4.0c','22.5c','3.25c','21c','4.0c','21.75c','2.5c', - 'fill'=>'green', 'outline'=>'black', 'width'=>4, + 'fill'=>'green', 'outline'=>'black', 'width'=>4, 'tags'=>$tag_item ) TkcPolygon.new(cvs, '25c','4c','25c','4c','25c','1c','26c','1c','27c','4c', '28c','1c','29c','1c','29c','4c','29c','4c', 'fill'=>red, 'smooth'=>'on', 'tags'=> $tag_item) TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c', '28c','5.25c','24c','5.25c','24c','6.0c','26c','6c','26c', - '7.5c','22c','7.5c', + '7.5c','22c','7.5c', 'stipple'=>'@' + [$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator), 'outline'=>'black', 'tags'=>$tag_item ) @@ -166,7 +166,7 @@ TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c', TkcText.new(cvs, '5c', '8.2c', 'text'=>'¶ë·Á', 'anchor'=>'n') TkcRectangle.new(cvs, '1c','9.5c','4c','12.5c', 'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item) -TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c', +TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c', 'fill'=>green, 'tags'=>$tag_item ) TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'', 'stipple'=>'@'+[$demo_dir,'..', @@ -176,7 +176,7 @@ TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'', TkcText.new(cvs, '15c', '8.2c', 'text'=>'Âʱß', 'anchor'=>'n') TkcOval.new(cvs, '11c','9.5c','14c','12.5c', 'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item) -TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c', +TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c', 'fill'=>green, 'tags'=>$tag_item ) TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', 'stipple'=>'@'+[$demo_dir,'..', @@ -185,40 +185,40 @@ TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', TkcText.new(cvs, '25c', '8.2c', 'text'=>'¥Æ¥¥¹¥È', 'anchor'=>'n') TkcRectangle.new(cvs, '22.4c','8.9c','22.6c','9.1c') -TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', +TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', 'text'=>'û¤¤¥Æ¥¥¹¥È¡£¥ï¡¼¥É¥é¥Ã¥×¡¢º¸Â·¤¨¡¢¥¢¥ó¥«¡¼¤ÏËÌ(¾å)¡£¢¢¤Ï³Æ¥Æ¥¥¹¥È¤Î¥¢¥ó¥«¡¼¥Ý¥¤¥ó¥È¤ò¼¨¤¹¡£', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '25.4c','10.9c','25.6c','11.1c') -TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, +TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, 'text'=>"¤¤¤¯¤Ä¤«¤Î¹Ô¡£\n¤½¤ì¤¾¤ìÆÈΩ¤Ë\n¹Ô·¤¨¡£\nÁ´¤Æº¸Ã¼¤¬¥¢¥ó¥«¡¼¤µ¤ì¤Æ¤¤¤ë¡£", 'justify'=>'center', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '24.9c','13.9c','25.1c','14.1c') if $tk_version =~ /^4\.[01]/ - TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, + TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, 'stipple'=>'@' + [$demo_dir, '..', 'images', 'grey.5'].join(File::Separator), 'text'=>'Stippled characters', 'tags'=>$tag_item ) else - TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, - 'stipple'=>'gray50', 'text'=>'Stippled characters', + TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, + 'stipple'=>'gray50', 'text'=>'Stippled characters', 'tags'=>$tag_item ) end TkcText.new(cvs, '5c', '16.2c', 'text'=>'¸Ì', 'anchor'=>'n') -TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black', +TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black', 'start'=>45, 'extent'=>270, 'style'=>'pieslice', 'tags'=>$tag_item) -#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', -# 'outline'=>blue, 'start'=>135, 'extent'=>270, +#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', +# 'outline'=>blue, 'start'=>135, 'extent'=>270, # 'outlinestipple'=>'@' + ['images', 'grey.25'].join(File::Separator), # 'tags'=>$tag_item) -TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', - 'outline'=>blue, 'start'=>135, 'extent'=>270, +TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', + 'outline'=>blue, 'start'=>135, 'extent'=>270, 'outlinestipple'=>'@'+[$demo_dir, '..', 'images','gray25.xbm'].join(File::Separator), 'tags'=>$tag_item) -TkcArc.new(cvs, '0.5c','20c','9.5c','24c', 'width'=>'4m', 'style'=>'pieslice', - 'fill'=>'', 'outline'=>red, 'start'=>225, 'extent'=>90, +TkcArc.new(cvs, '0.5c','20c','9.5c','24c', 'width'=>'4m', 'style'=>'pieslice', + 'fill'=>'', 'outline'=>red, 'start'=>225, 'extent'=>90, 'tags'=>$tag_item) TkcArc.new(cvs, '5.5c','20.5c','9.5c','23.5c', 'width'=>'4m', 'style'=>'chord', - 'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270, + 'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270, 'tags'=>$tag_item) TkcText.new(cvs, '15c', '16.2c', 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×', 'anchor'=>'n') @@ -253,17 +253,17 @@ TkcText.new(cvs, '25c', '16.2c', 'text'=>'¥¦¥£¥ó¥É¥¦', 'anchor'=>'n') TkButton.new(cvs) {|b| text '²¡¤·¤Æ¤Í' command proc{butPress cvs, red} - TkcWindow.new(cvs, '21c','18c', + TkcWindow.new(cvs, '21c','18c', 'window'=>b, 'anchor'=>'nw', 'tags'=>$tag_item) } TkEntry.new(cvs, 'width'=>20, 'relief'=>'sunken') {|e| insert 'end', 'ÊÔ½¸¤·¤Æ¤Í' - TkcWindow.new(cvs, '21c','21c', + TkcWindow.new(cvs, '21c','21c', 'window'=>e, 'anchor'=>'nw', 'tags'=>$tag_item) } -TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c', +TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c', 'width'=>'.5c', 'tickinterval'=>0 ) {|scl| - TkcWindow.new(cvs, '28.5c','17.5c', + TkcWindow.new(cvs, '28.5c','17.5c', 'window'=>scl, 'anchor'=>'n', 'tags'=>$tag_item) } TkcText.new(cvs, '21c', '17.9c', 'text'=>'¥Ü¥¿¥ó:', 'anchor'=>'sw') @@ -314,7 +314,7 @@ def itemLeave(c) $restoreCmd.call if $restoreCmd end -# Utility methods for stroking out a rectangle and printing what's +# Utility methods for stroking out a rectangle and printing what's # underneath the rectangle's area. def itemMark(c,x,y) @@ -328,7 +328,7 @@ def itemStroke(c,x,y) y = c.canvasy(y) if $areaX1 != x && $areaY1 != y c.delete 'area' - c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, + c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, '-outline', 'black') $areaX2 = x $areaY2 = y @@ -369,11 +369,11 @@ def itemDrag(c,x,y) $lastY = y end -# Method that's invoked when the button embedded in the canvas +# Method that's invoked when the button embedded in the canvas # is invoked. def butPress(w,color) - i = TkcText.new(w, '25c', '18.1c', + i = TkcText.new(w, '25c', '18.1c', 'text'=>'¤¤¤Æ¤Æ!!', 'fill'=>color, 'anchor'=>'n') Tk.after(500, proc{w.delete i}) end diff --git a/ext/tk/sample/demos-jp/knightstour.rb b/ext/tk/sample/demos-jp/knightstour.rb index d4595ea441..ae0f13076e 100644 --- a/ext/tk/sample/demos-jp/knightstour.rb +++ b/ext/tk/sample/demos-jp/knightstour.rb @@ -157,16 +157,16 @@ class Knights_Tour frame = Ttk::Frame.new($knightstour) sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'knightstour'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'knightstour'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $knightstour.destroy $knightstour = nil - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) frame @@ -178,7 +178,7 @@ class Knights_Tour $knightstour.withdraw base_f = Ttk::Frame.new($knightstour) @board = Tk::Canvas.new(base_f, :width=>240, :height=>240) - @log = Tk::Text.new(base_f, :width=>12, :height=>1, + @log = Tk::Text.new(base_f, :width=>12, :height=>1, :font=>'Arial 8', :background=>'white') scr = @log.yscrollbar(Ttk::Scrollbar.new(base_f)) @@ -188,13 +188,13 @@ class Knights_Tour tool_f = Ttk::Frame.new($knightstour) label = Ttk::Label.new(tool_f, :text=>'¼Â¹Ô®ÅÙ') - scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay, + scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay, :command=>proc{|n| set_delay(n)}) - check = Ttk::Checkbutton.new(tool_f, :text=>'È¿Éü', + check = Ttk::Checkbutton.new(tool_f, :text=>'È¿Éü', :variable=>@continuous) - @start_btn = Ttk::Button.new(tool_f, :text=>'³«»Ï', + @start_btn = Ttk::Button.new(tool_f, :text=>'³«»Ï', :command=>proc{tour()}) - @exit_btn = Ttk::Button.new(tool_f, :text=>'½ªÎ»', + @exit_btn = Ttk::Button.new(tool_f, :text=>'½ªÎ»', :command=>proc{_exit()}) 7.downto(0){|row| @@ -207,16 +207,16 @@ class Knights_Tour dfill = 'tan4' end coords = [col * 30 + 4, row * 30 + 4, col * 30 + 30, row * 30 + 30] - @board.create(TkcRectangle, coords, + @board.create(TkcRectangle, coords, :fill=>fill, :disabledfill=>dfill, :width=>2, :state=>:disabled) } } @knight_font = TkFont.new(:size=>-24) - @knight = TkcText.new(@board, 0, 0, :font=>@knight_font, - :text=>Tk::UTF8_String.new('\u265e'), - :anchor=>'nw', # :tags=>'knight', + @knight = TkcText.new(@board, 0, 0, :font=>@knight_font, + :text=>Tk::UTF8_String.new('\u265e'), + :anchor=>'nw', # :tags=>'knight', :fill=>'black', :activefill=>'#600000') @knight.coords(@board.coords(rand(64)+1)[0..1]) @knight.bind('ButtonPress-1', '%W %x %y'){|w,x,y| drag_start(w,x,y)} diff --git a/ext/tk/sample/demos-jp/label.rb b/ext/tk/sample/demos-jp/label.rb index 2e6b3e7e57..19105e6f71 100644 --- a/ext/tk/sample/demos-jp/label.rb +++ b/ext/tk/sample/demos-jp/label.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($label_demo) && $label_demo - $label_demo.destroy + $label_demo.destroy $label_demo = nil end @@ -49,12 +49,12 @@ TkFrame.new(base_frame) {|frame| # label demo Íѥե졼¥àÀ¸À® f_left = TkFrame.new(base_frame) f_right = TkFrame.new(base_frame) -[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', +[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', 'padx'=>10, 'pady'=>10, 'fill'=>'both')} # label À¸À® [ TkLabel.new(f_left, 'text'=>'ºÇ½é¤Î¥é¥Ù¥ë'), - TkLabel.new(f_left, 'text'=>'2 ÈÖÌÜ¡£¤Á¤ç¤Ã¤ÈÉ⤾夬¤é¤»¤Æ¤ß¤Þ¤·¤¿', + TkLabel.new(f_left, 'text'=>'2 ÈÖÌÜ¡£¤Á¤ç¤Ã¤ÈÉ⤾夬¤é¤»¤Æ¤ß¤Þ¤·¤¿', 'relief'=>'raised'), TkLabel.new(f_left, 'text'=>'3 ÈÖÌÜ¡£ÄÀ¤ó¤Ç¤¤¤Þ¤¹ ', 'relief'=>'sunken') ].each{|w| w.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'anchor'=>'w')} diff --git a/ext/tk/sample/demos-jp/labelframe.rb b/ext/tk/sample/demos-jp/labelframe.rb index 11b0d27308..cee504f4b6 100644 --- a/ext/tk/sample/demos-jp/labelframe.rb +++ b/ext/tk/sample/demos-jp/labelframe.rb @@ -9,7 +9,7 @@ if defined?($labelframe_demo) && $labelframe_demo - $labelframe_demo.destroy + $labelframe_demo.destroy $labelframe_demo = nil end @@ -22,18 +22,18 @@ $labelframe_demo = TkToplevel.new {|w| base_frame = TkFrame.new($labelframe_demo).pack(:fill=>:both, :expand=>true) # Some information -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top) -TkLabelFrame ¥¦¥£¥¸¥§¥Ã¥È¤Ï´ØÏ¢¤¹¤ë widget +TkLabelFrame ¥¦¥£¥¸¥§¥Ã¥È¤Ï´ØÏ¢¤¹¤ë widget ·²¤ò¤Þ¤È¤á¤Æ¼è¤ê°·¤¦¤¿¤á¤ËÍѤ¤¤é¤ì¤Þ¤¹¡£¥é ¥Ù¥ë¤ÏÄ̾ï¤Îʸ»úÎó¤Ç¤â²¿¤é¤«¤Î¥¦¥£¥¸¥§¥Ã¥È -¤Ç¤â¤«¤Þ¤¤¤Þ¤»¤ó¡£¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë -Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬ +¤Ç¤â¤«¤Þ¤¤¤Þ¤»¤ó¡£¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë +Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬ labelframe ¥¦¥£¥¸¥§¥Ã¥È¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤ ¾ì¹ç¡¢¤³¤Î¥Ç¥â¤Ï¤¦¤Þ¤¯Æ°¤«¤Ê¤¤¤Ï¤º¤Ç¤¹¡£ ¤½¤Î¾ì¹ç¤Ë¤Ï labelframe ¥¦¥£¥¸¥§¥Ã¥È¤¬¼ÂÁõ -¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk +¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk ¤òÁȤ߹ç¤ï¤»¤Æ»î¤¹¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£ EOL @@ -52,17 +52,17 @@ TkFrame.new(base_frame){|f| } # Demo area -w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both, +w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both, :expand=>true) # A group of radiobuttons in a labelframe -TkLabelFrame.new(w, :text=>'ÁªÂòÃÍ', +TkLabelFrame.new(w, :text=>'ÁªÂòÃÍ', :padx=>2, :pady=>2) {|f| grid(:row=>0, :column=>0, :pady=>'2m', :padx=>'2m') v = TkVariable.new (1..4).each{|i| - TkRadiobutton.new(f, :text=>"This is value #{i}", + TkRadiobutton.new(f, :text=>"This is value #{i}", :variable=>v, :value=>i) { pack(:side=>:top, :fill=>:x, :pady=>2) } @@ -85,7 +85,7 @@ def lfEnableButtons(w) end TkLabelFrame.new(w, :pady=>2, :padx=>2){|f| - TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy, + TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy, :text=>"¥ª¥×¥·¥ç¥ó¤ò»ÈÍÑ", :padx=>0) {|cb| command proc{lfEnableButtons(f)} f.labelwidget(cb) diff --git a/ext/tk/sample/demos-jp/mclist.rb b/ext/tk/sample/demos-jp/mclist.rb index a7834d2668..37f5dfa8eb 100644 --- a/ext/tk/sample/demos-jp/mclist.rb +++ b/ext/tk/sample/demos-jp/mclist.rb @@ -8,7 +8,7 @@ # based on "Id: mclist.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($mclist_demo) && $mclist_demo - $mclist_demo.destroy + $mclist_demo.destroy $mclist_demo = nil end @@ -21,8 +21,8 @@ $mclist_demo = TkToplevel.new {|w| base_frame = TkFrame.new($mclist_demo).pack(:fill=>:both, :expand=>true) ## Explanatory text -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', - :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', + :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><<EOL).pack(:fill=>:x) Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\ Ttk::Treeview¥¦¥£¥¸¥§¥Ã¥È¤Ï\ @@ -40,23 +40,23 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'mclist'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'mclist'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $mclist_demo.destroy $mclist_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) } container = Ttk::Frame.new(base_frame) -tree = Ttk::Treeview.new(base_frame, :columns=>%w(country capital currency), +tree = Ttk::Treeview.new(base_frame, :columns=>%w(country capital currency), :show=>:headings) if Tk.windowingsystem != 'aquq' vsb = tree.yscrollbar(Ttk::Scrollbar.new(base_frame)) @@ -74,20 +74,20 @@ container.grid_rowconfigure(0, :weight=>1) ## The data we're going to insert data = [ - ['¥¢¥ë¥¼¥ó¥Á¥ó', '¥Ö¥¨¥Î¥¹¥¢¥¤¥ì¥¹', 'ARS'], - ['¥ª¡¼¥¹¥È¥é¥ê¥¢', '¥¥ã¥ó¥Ù¥é', 'AUD'], - ['¥Ö¥é¥¸¥ë', '¥Ö¥é¥¸¥ê¥¢', 'BRL'], - ['¥«¥Ê¥À', '¥ª¥¿¥ï', 'CAD'], - ['Ãæ¹ñ', 'Ë̵þ', 'CNY'], - ['¥Õ¥é¥ó¥¹', '¥Ñ¥ê', 'EUR'], - ['¥É¥¤¥Ä', '¥Ù¥ë¥ê¥ó', 'EUR'], - ['¥¤¥ó¥É', '¥Ë¥å¡¼¥Ç¥ê¡¼', 'INR'], - ['¥¤¥¿¥ê¥¢', '¥í¡¼¥Þ', 'EUR'], - ['ÆüËÜ', 'Åìµþ', 'JPY'], - ['¥á¥¥·¥³', '¥á¥¥·¥³¥·¥Æ¥£', 'MXN'], - ['¥í¥·¥¢', '¥â¥¹¥¯¥ï', 'RUB'], - ['Æ¥Õ¥ê¥«', '¥×¥ì¥È¥ê¥¢', 'ZAR'], - ['±Ñ¹ñ', '¥í¥ó¥É¥ó', 'GBP'], + ['¥¢¥ë¥¼¥ó¥Á¥ó', '¥Ö¥¨¥Î¥¹¥¢¥¤¥ì¥¹', 'ARS'], + ['¥ª¡¼¥¹¥È¥é¥ê¥¢', '¥¥ã¥ó¥Ù¥é', 'AUD'], + ['¥Ö¥é¥¸¥ë', '¥Ö¥é¥¸¥ê¥¢', 'BRL'], + ['¥«¥Ê¥À', '¥ª¥¿¥ï', 'CAD'], + ['Ãæ¹ñ', 'Ë̵þ', 'CNY'], + ['¥Õ¥é¥ó¥¹', '¥Ñ¥ê', 'EUR'], + ['¥É¥¤¥Ä', '¥Ù¥ë¥ê¥ó', 'EUR'], + ['¥¤¥ó¥É', '¥Ë¥å¡¼¥Ç¥ê¡¼', 'INR'], + ['¥¤¥¿¥ê¥¢', '¥í¡¼¥Þ', 'EUR'], + ['ÆüËÜ', 'Åìµþ', 'JPY'], + ['¥á¥¥·¥³', '¥á¥¥·¥³¥·¥Æ¥£', 'MXN'], + ['¥í¥·¥¢', '¥â¥¹¥¯¥ï', 'RUB'], + ['Æ¥Õ¥ê¥«', '¥×¥ì¥È¥ê¥¢', 'ZAR'], + ['±Ñ¹ñ', '¥í¥ó¥É¥ó', 'GBP'], ['¥¢¥á¥ê¥«', '¥ï¥·¥ó¥È¥ó D.C.', 'USD'], ] @@ -95,7 +95,7 @@ data = [ font = Ttk::Style.lookup(tree[:style], :font) cols = %w(country capital currency) cols.zip(%w(¹ñ̾ ¼óÅÔ Ä̲ß)).each{|col, name| - tree.heading_configure(col, :text=>name, + tree.heading_configure(col, :text=>name, :command=>proc{sort_by(tree, col, false)}) tree.column_configure(col, :width=>TkFont.measure(font, name)) } @@ -113,8 +113,8 @@ data.each{|country, capital, currency| ## Code to do the sorting of the tree contents when clicked on def sort_by(tree, col, direction) - tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . - sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . + tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . + sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . each_with_index{|info, idx| tree.move(info[1], nil, idx)} tree.heading_configure(col, :command=>proc{sort_by(tree, col, ! direction)}) diff --git a/ext/tk/sample/demos-jp/menu.rb b/ext/tk/sample/demos-jp/menu.rb index c3d95176b4..e38a467000 100644 --- a/ext/tk/sample/demos-jp/menu.rb +++ b/ext/tk/sample/demos-jp/menu.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($menu_demo) && $menu_demo - $menu_demo.destroy + $menu_demo.destroy $menu_demo = nil end @@ -88,9 +88,9 @@ TkMenubutton.new($menu_frame, 'text'=>'Basic', 'underline'=>0) {|m| m.configure('menu'=>basic_menu) add('command', 'label'=>'²¿¤â¤·¤Ê¤¤Ä¹¤¤¥¨¥ó¥È¥ê') ['A','B','C','D','E','F','G'].each{|c| - # add('command', 'label'=>"ʸ»ú \"#{c}\" ¤ò°õ»ú", 'underline'=>4, - add('command', 'label'=>"Print letter \"#{c}\" (ʸ»ú \"#{c}\" ¤ò°õ»ú)", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + # add('command', 'label'=>"ʸ»ú \"#{c}\" ¤ò°õ»ú", 'underline'=>4, + add('command', 'label'=>"Print letter \"#{c}\" (ʸ»ú \"#{c}\" ¤ò°õ»ú)", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -101,18 +101,18 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|cascade_menu| m.configure('menu'=>cascade_menu) - add('command', 'label'=>'Print hello(¤³¤ó¤Ë¤Á¤Ï)', - 'command'=>proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}, + add('command', 'label'=>'Print hello(¤³¤ó¤Ë¤Á¤Ï)', + 'command'=>proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu_demo.bind("#{modifier}-h", proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}) - add('command', 'label'=>'Print goodbye(¤µ¤è¤¦¤Ê¤é)', - 'command'=>proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}, + add('command', 'label'=>'Print goodbye(¤µ¤è¤¦¤Ê¤é)', + 'command'=>proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu_demo.bind("#{modifier}-g", proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}) # TkMenu.new(m, 'tearoff'=>false) {|cascade_check| TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_check| - cascade_menu.add('cascade', 'label'=>'Check buttons(¥Á¥§¥Ã¥¯¥Ü¥¿¥ó)', + cascade_menu.add('cascade', 'label'=>'Check buttons(¥Á¥§¥Ã¥¯¥Ü¥¿¥ó)', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'¥ª¥¤¥ëÅÀ¸¡', 'variable'=>oil) @@ -123,11 +123,11 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| lights = TkVariable.new(0) add('check', 'label'=>'¥é¥¤¥ÈÅÀ¸¡', 'variable'=>lights) add('separator') - add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', - 'command'=>proc{showVars($menu_demo, - ['¥ª¥¤¥ëÅÀ¸¡', oil], - ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', trans], - ['¥Ö¥ì¡¼¥ÅÀ¸¡', brakes], + add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', + 'command'=>proc{showVars($menu_demo, + ['¥ª¥¤¥ëÅÀ¸¡', oil], + ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', trans], + ['¥Ö¥ì¡¼¥ÅÀ¸¡', brakes], ['¥é¥¤¥ÈÅÀ¸¡', lights])} ) invoke 1 invoke 3 @@ -135,7 +135,7 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| #TkMenu.new(m, 'tearoff'=>false) {|cascade_radio| TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_radio| - cascade_menu.add('cascade', 'label'=>'Radio buttons(¥é¥¸¥ª¥Ü¥¿¥ó)', + cascade_menu.add('cascade', 'label'=>'Radio buttons(¥é¥¸¥ª¥Ü¥¿¥ó)', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>10) @@ -149,9 +149,9 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| add('radio', 'label'=>'¥Ü¡¼¥ë¥É', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'¥¤¥¿¥ê¥Ã¥¯', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', - 'command'=>proc{showVars($menu_demo, - ['¥Ý¥¤¥ó¥È¥µ¥¤¥º', pointSize], + add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', + 'command'=>proc{showVars($menu_demo, + ['¥Ý¥¤¥ó¥È¥µ¥¤¥º', pointSize], ['¥¹¥¿¥¤¥ë', style])} ) invoke 1 invoke 7 @@ -163,15 +163,15 @@ TkMenubutton.new($menu_frame, 'text'=>'Icons', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|icon_menu| m.configure('menu'=>icon_menu) - add('command', + add('command', 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'º£¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¤Î¹àÌܤϥƥ¥¹¥È¤Ç¤Ï¤Ê¤¯¥Ó¥Ã¥È¥Þ¥Ã¥×¤òɽ¼¨¤·¤Æ¤¤¤Þ¤·¤¿¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¾¤Î¥á¥Ë¥å¡¼¹àÌܤÈÊѤï¤ê¤Þ¤»¤ó¡£', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'λ²ò')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, + add('command', 'bitmap'=>icon, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } } @@ -183,7 +183,7 @@ TkMenubutton.new($menu_frame, 'text'=>'More', 'underline'=>0) {|m| m.configure('menu'=>more_menu) [ '¥¨¥ó¥È¥ê','Ê̤Υ¨¥ó¥È¥ê','²¿¤â¤·¤Ê¤¤','¤Û¤È¤ó¤É²¿¤â¤·¤Ê¤¤', '¿ÍÀ¸¤ò°ÕµÁ¤¢¤ë¤â¤Î¤Ë' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } } @@ -194,7 +194,7 @@ TkMenubutton.new($menu_frame, 'text'=>'Colors', 'underline'=>0) {|m| TkMenu.new(m) {|colors_menu| m.configure('menu'=>colors_menu) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } diff --git a/ext/tk/sample/demos-jp/menu84.rb b/ext/tk/sample/demos-jp/menu84.rb index a631bacd43..094853a728 100644 --- a/ext/tk/sample/demos-jp/menu84.rb +++ b/ext/tk/sample/demos-jp/menu84.rb @@ -5,7 +5,7 @@ # toplevel widget if defined?($menu84_demo) && $menu84_demo - $menu84_demo.destroy + $menu84_demo.destroy $menu84_demo = nil end @@ -37,9 +37,9 @@ TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') { menustatus = TkVariable.new(" ") TkFrame.new(base_frame) {|frame| - TkLabel.new(frame, 'textvariable'=>menustatus, 'relief'=>'sunken', - 'bd'=>1, 'font'=>['Helvetica', '10'], - 'anchor'=>'w').pack('side'=>'left', 'padx'=>2, + TkLabel.new(frame, 'textvariable'=>menustatus, 'relief'=>'sunken', + 'bd'=>1, 'font'=>['Helvetica', '10'], + 'anchor'=>'w').pack('side'=>'left', 'padx'=>2, 'expand'=>true, 'fill'=>'both') pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2) } @@ -94,8 +94,8 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Basic', 'menu'=>m, 'underline'=>0) add('command', 'label'=>'Long entry that does nothing') ['A','B','C','D','E','F','G'].each{|c| - add('command', 'label'=>"Print letter \"#{c}\"", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + add('command', 'label'=>"Print letter \"#{c}\"", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu84_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -103,17 +103,17 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Cascades', 'menu'=>m, 'underline'=>0) - add('command', 'label'=>'Print hello', - 'command'=>proc{print "Hello\n"}, + add('command', 'label'=>'Print hello', + 'command'=>proc{print "Hello\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu84_demo.bind("#{modifier}-h", proc{print "Hello\n"}) - add('command', 'label'=>'Print goodbye', - 'command'=>proc{print "Goodbye\n"}, + add('command', 'label'=>'Print goodbye', + 'command'=>proc{print "Goodbye\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu84_demo.bind("#{modifier}-g", proc{print "Goodbye\n"}) TkMenu.new(m, 'tearoff'=>false) {|cascade_check| - m.add('cascade', 'label'=>'Check button', + m.add('cascade', 'label'=>'Check button', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'¥ª¥¤¥ë¸¡ºº', 'variable'=>oil) @@ -124,18 +124,18 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| lights = TkVariable.new(0) add('check', 'label'=>'¥é¥¤¥È¸¡ºº', 'variable'=>lights) add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu84_demo, - ['¥ª¥¤¥ë', oil], - ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥ó', trans], - ['¥Ö¥ì¡¼¥', brakes], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu84_demo, + ['¥ª¥¤¥ë', oil], + ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥ó', trans], + ['¥Ö¥ì¡¼¥', brakes], ['¥é¥¤¥È', lights])} ) invoke 1 invoke 3 } TkMenu.new(m, 'tearoff'=>false) {|cascade_radio| - m.add('cascade', 'label'=>'Radio buttons', + m.add('cascade', 'label'=>'Radio buttons', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 point', 'variable'=>pointSize, 'value'=>10) @@ -149,9 +149,9 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| add('radio', 'label'=>'Bold', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'Italic', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'¸½ºßÃͤÎɽ¼¨', - 'command'=>proc{showVars($menu84_demo, - ['pointSize', pointSize], + add('command', 'label'=>'¸½ºßÃͤÎɽ¼¨', + 'command'=>proc{showVars($menu84_demo, + ['pointSize', pointSize], ['style', style])} ) invoke 1 invoke 7 @@ -160,15 +160,15 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Icons', 'menu'=>m, 'underline'=>0) - add('command', 'hidemargin'=>1, + add('command', 'hidemargin'=>1, 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¹àÌܤϡ¢Ê¸»úÎó¤ÎÂå¤ï¤ê¤Ë¥Ó¥Ã¥È¥Þ¥Ã¥×¥¤¥á¡¼¥¸¤Ç¹àÌܤòɽ¼¨¤·¤¿¤â¤Î¤Ç¤¹¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¡¢¤Û¤«¤Î¥á¥Ë¥å¡¼¹àÌܤȤδ֤ÇÆä˰㤤¤¬¤¢¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'ÊĤ¸¤ë')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, 'hidemargin'=>1, + add('command', 'bitmap'=>icon, 'hidemargin'=>1, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } @@ -179,14 +179,14 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'More', 'menu'=>m, 'underline'=>0) [ 'An entry','Another entry','Does nothing','Does almost nothing', 'Make life meaningful' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } - m.entryconfigure('Does almost nothing', - 'bitmap'=>'questhead', 'compound'=>'left', + m.entryconfigure('Does almost nothing', + 'bitmap'=>'questhead', 'compound'=>'left', 'command'=>proc{ - TkDialog.new('title'=>'Compound Menu Entry', + TkDialog.new('title'=>'Compound Menu Entry', 'message'=>'¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¹àÌܤϡ¢¥Ó¥Ã¥È¥Þ¥Ã¥×¥¤¥á¡¼¥¸¤Èʸ»úÎó¤È¤òƱ»þ¤Ë°ì¤Ä¤Î¹àÌܤËɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤¿¤â¤Î¤Ç¤¹¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¡¢¤Û¤«¤Î¥á¥Ë¥å¡¼¹àÌܤȤδ֤ÇÆä˰㤤¤¬¤¢¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£', 'buttons'=>['λ²ò'], 'bitmap'=>'') }) @@ -195,7 +195,7 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame) {|m| $menu84_frame.add('cascade', 'label'=>'Colors', 'menu'=>m, 'underline'=>0) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } diff --git a/ext/tk/sample/demos-jp/menu8x.rb b/ext/tk/sample/demos-jp/menu8x.rb index 9249f2491a..49aca6786d 100644 --- a/ext/tk/sample/demos-jp/menu8x.rb +++ b/ext/tk/sample/demos-jp/menu8x.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($menu8x_demo) && $menu8x_demo - $menu8x_demo.destroy + $menu8x_demo.destroy $menu8x_demo = nil end @@ -65,7 +65,7 @@ TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') { # ¾õÂÖɽ¼¨¤ÎÀ¸À® $menu8xstatus = TkVariable.new(" ") TkFrame.new(base_frame) {|frame| - TkLabel.new(frame, 'textvariable'=>$menu8xstatus, 'relief'=>'sunken', + TkLabel.new(frame, 'textvariable'=>$menu8xstatus, 'relief'=>'sunken', 'bd'=>1, 'font'=>['Helvetica', '10'], 'anchor'=>'w')\ .pack('side'=>'left', 'padx'=>2, 'expand'=>'yes', 'fill'=>'both') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2) @@ -116,9 +116,9 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| m.add('cascade', 'label'=>'Basic', 'menu'=>basic_menu, 'underline'=>0) add('command', 'label'=>'²¿¤â¤·¤Ê¤¤Ä¹¤¤¥¨¥ó¥È¥ê') ['A','B','C','D','E','F','G'].each{|c| - # add('command', 'label'=>"ʸ»ú \"#{c}\" ¤ò°õ»ú", 'underline'=>4, - add('command', 'label'=>"Print letter \"#{c}\" (ʸ»ú \"#{c}\" ¤ò°õ»ú)", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + # add('command', 'label'=>"ʸ»ú \"#{c}\" ¤ò°õ»ú", 'underline'=>4, + add('command', 'label'=>"Print letter \"#{c}\" (ʸ»ú \"#{c}\" ¤ò°õ»ú)", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu8x_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -126,17 +126,17 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| TkMenu.new(m, 'tearoff'=>false) {|cascade_menu| m.add('cascade', 'label'=>'Cascades', 'menu'=>cascade_menu, 'underline'=>0) - add('command', 'label'=>'Print hello(¤³¤ó¤Ë¤Á¤Ï)', - 'command'=>proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}, + add('command', 'label'=>'Print hello(¤³¤ó¤Ë¤Á¤Ï)', + 'command'=>proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu8x_demo.bind("#{modifier}-h", proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}) - add('command', 'label'=>'Print goodbye(¤µ¤è¤¦¤Ê¤é)', - 'command'=>proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}, + add('command', 'label'=>'Print goodbye(¤µ¤è¤¦¤Ê¤é)', + 'command'=>proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu8x_demo.bind("#{modifier}-g", proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}) TkMenu.new(m, 'tearoff'=>false) {|cascade_check| - cascade_menu.add('cascade', 'label'=>'Check buttons(¥Á¥§¥Ã¥¯¥Ü¥¿¥ó)', + cascade_menu.add('cascade', 'label'=>'Check buttons(¥Á¥§¥Ã¥¯¥Ü¥¿¥ó)', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'¥ª¥¤¥ëÅÀ¸¡', 'variable'=>oil) @@ -147,18 +147,18 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| lights = TkVariable.new(0) add('check', 'label'=>'¥é¥¤¥ÈÅÀ¸¡', 'variable'=>lights) add('separator') - add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', - 'command'=>proc{showVars($menu8x_demo, - ['¥ª¥¤¥ëÅÀ¸¡', oil], - ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', trans], - ['¥Ö¥ì¡¼¥ÅÀ¸¡', brakes], + add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', + 'command'=>proc{showVars($menu8x_demo, + ['¥ª¥¤¥ëÅÀ¸¡', oil], + ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', trans], + ['¥Ö¥ì¡¼¥ÅÀ¸¡', brakes], ['¥é¥¤¥ÈÅÀ¸¡', lights])} ) invoke 1 invoke 3 } TkMenu.new(m, 'tearoff'=>false) {|cascade_radio| - cascade_menu.add('cascade', 'label'=>'Radio buttons(¥é¥¸¥ª¥Ü¥¿¥ó)', + cascade_menu.add('cascade', 'label'=>'Radio buttons(¥é¥¸¥ª¥Ü¥¿¥ó)', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>10) @@ -172,9 +172,9 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| add('radio', 'label'=>'¥Ü¡¼¥ë¥É', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'¥¤¥¿¥ê¥Ã¥¯', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', - 'command'=>proc{showVars($menu8x_demo, - ['¥Ý¥¤¥ó¥È¥µ¥¤¥º', pointSize], + add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', + 'command'=>proc{showVars($menu8x_demo, + ['¥Ý¥¤¥ó¥È¥µ¥¤¥º', pointSize], ['¥¹¥¿¥¤¥ë', style])} ) invoke 1 invoke 7 @@ -183,16 +183,16 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| TkMenu.new(m, 'tearoff'=>false) {|icon_menu| m.add('cascade', 'label'=>'Icons', 'menu'=>icon_menu, 'underline'=>0) - add('command', + add('command', 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'hidemargin'=>1, - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'hidemargin'=>1, + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'º£¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¤Î¹àÌܤϥƥ¥¹¥È¤Ç¤Ï¤Ê¤¯¥Ó¥Ã¥È¥Þ¥Ã¥×¤òɽ¼¨¤·¤Æ¤¤¤Þ¤·¤¿¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¾¤Î¥á¥Ë¥å¡¼¹àÌܤÈÊѤï¤ê¤Þ¤»¤ó¡£', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'λ²ò')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, 'hidemargin'=>1, + add('command', 'bitmap'=>icon, 'hidemargin'=>1, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } @@ -203,7 +203,7 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| m.add('cascade', 'label'=>'More', 'menu'=>more_menu, 'underline'=>0) [ '¥¨¥ó¥È¥ê','Ê̤Υ¨¥ó¥È¥ê','²¿¤â¤·¤Ê¤¤','¤Û¤È¤ó¤É²¿¤â¤·¤Ê¤¤', '¿ÍÀ¸¤ò°ÕµÁ¤¢¤ë¤â¤Î¤Ë' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } } @@ -211,7 +211,7 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| TkMenu.new(m) {|colors_menu| m.add('cascade', 'label'=>'Colors', 'menu'=>colors_menu, 'underline'=>1) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } @@ -219,8 +219,8 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| $menu8x_demo.configure('menu'=>m) } -TkMenu.bind('<MenuSelect>', - proc{|w| +TkMenu.bind('<MenuSelect>', + proc{|w| begin label = w.entrycget('active', 'label') rescue diff --git a/ext/tk/sample/demos-jp/menubu.rb b/ext/tk/sample/demos-jp/menubu.rb index 90dc367305..78418ce3ea 100644 --- a/ext/tk/sample/demos-jp/menubu.rb +++ b/ext/tk/sample/demos-jp/menubu.rb @@ -17,7 +17,7 @@ def optionMenu(menubutton, varName, firstValue, *rest) for i in rest menu.add 'radio', 'label'=>i, 'variable'=>varName end - + return menu end @@ -189,7 +189,7 @@ msg.pack('side'=>'top', 'padx'=>25, 'pady'=>25) TkFrame.new(center) {|f| menubuttonoptions = TkVariable.new mbutton = TkMenubutton.new(f) - options = optionMenu(mbutton, menubuttonoptions, + options = optionMenu(mbutton, menubuttonoptions, 'one', 'two', 'three') mbutton.pack('side'=>'left', 'padx'=>25, 'pady'=>25) paletteColor = TkVariable.new diff --git a/ext/tk/sample/demos-jp/msgbox.rb b/ext/tk/sample/demos-jp/msgbox.rb index 88380e08bd..ed5d01252e 100644 --- a/ext/tk/sample/demos-jp/msgbox.rb +++ b/ext/tk/sample/demos-jp/msgbox.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($msgbox_demo) && $msgbox_demo - $msgbox_demo.destroy + $msgbox_demo.destroy $msgbox_demo = nil end @@ -48,9 +48,9 @@ TkFrame.new(base_frame) {|frame| # frame À¸À® $msgbox_leftframe = TkFrame.new(base_frame) $msgbox_rightframe = TkFrame.new(base_frame) -$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') -$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') TkLabel.new($msgbox_leftframe, 'text'=>'¥¢¥¤¥³¥ó').pack('side'=>'top') @@ -59,9 +59,9 @@ TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ $msgboxIcon = TkVariable.new('info') ['error', 'info', 'question', 'warning'].each {|icon| - TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, - 'relief'=>'flat', 'value'=>icon, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, + 'relief'=>'flat', 'value'=>icon, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } @@ -70,20 +70,20 @@ TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ .pack('side'=>'top', 'fill'=>'x', 'expand'=>'no') $msgboxType = TkVariable.new('ok') -['abortretryignore', 'ok', 'okcancel', +['abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel'].each {|type| - TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, - 'relief'=>'flat', 'value'=>type, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, + 'relief'=>'flat', 'value'=>type, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } def showMessageBox(w) - button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, + button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, 'message'=>"¤³¤ì¤Ï\"#{$msgboxType.value}\"¤È¤¤¤¦¼ïÎà¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹¤Ç¡¢\"#{$msgboxIcon.value}\"¤Î¥¢¥¤¥³¥ó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£") - Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, + Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"¤¢¤Ê¤¿¤Ï \"#{button}\" ¤ò²¡¤·¤Þ¤·¤¿¤Í¡£") end diff --git a/ext/tk/sample/demos-jp/msgbox2.rb b/ext/tk/sample/demos-jp/msgbox2.rb index e2944c59ed..8c80e08d70 100644 --- a/ext/tk/sample/demos-jp/msgbox2.rb +++ b/ext/tk/sample/demos-jp/msgbox2.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($msgbox2_demo) && $msgbox2_demo - $msgbox2_demo.destroy + $msgbox2_demo.destroy $msgbox2_demo = nil end @@ -48,9 +48,9 @@ TkFrame.new(base_frame) {|frame| # frame À¸À® $msgbox_leftframe = TkFrame.new(base_frame) $msgbox_rightframe = TkFrame.new(base_frame) -$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') -$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') TkLabel.new($msgbox_leftframe, 'text'=>'¥¢¥¤¥³¥ó').pack('side'=>'top') @@ -59,9 +59,9 @@ TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ $msgboxIcon = TkVariable.new('info') ['error', 'info', 'question', 'warning'].each {|icon| - TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, - 'relief'=>'flat', 'value'=>icon, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, + 'relief'=>'flat', 'value'=>icon, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } @@ -70,21 +70,21 @@ TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ .pack('side'=>'top', 'fill'=>'x', 'expand'=>'no') $msgboxType = TkVariable.new('ok') -['abortretryignore', 'ok', 'okcancel', +['abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel'].each {|type| - TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, - 'relief'=>'flat', 'value'=>type, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, + 'relief'=>'flat', 'value'=>type, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } def showMessageBox2(w) - button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, + button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, - 'message'=>"\"#{$msgboxType.value}\"¥¿¥¤¥×¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹", + 'message'=>"\"#{$msgboxType.value}\"¥¿¥¤¥×¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹", 'detail'=>"¤³¤ì¤Ï\"#{$msgboxType.value}\"¤È¤¤¤¦¼ïÎà¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹¤Ç¡¢\"#{$msgboxIcon.value}\"¤Î¥¢¥¤¥³¥ó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£²¼¤Î¥Ü¥¿¥ó¤Î¤¤¤º¤ì¤«¤òÁªÂò¤·¤Æ¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£") - Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, + Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"¤¢¤Ê¤¿¤Ï \"#{button}\" ¤ò²¡¤·¤Þ¤·¤¿¤Í¡£") end diff --git a/ext/tk/sample/demos-jp/paned1.rb b/ext/tk/sample/demos-jp/paned1.rb index f994e83ff1..987a073086 100644 --- a/ext/tk/sample/demos-jp/paned1.rb +++ b/ext/tk/sample/demos-jp/paned1.rb @@ -8,7 +8,7 @@ # based on "Id: paned1.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp" if defined?($paned1_demo) && $paned1_demo - $paned1_demo.destroy + $paned1_demo.destroy $paned1_demo = nil end @@ -20,8 +20,8 @@ $paned1_demo = TkToplevel.new {|w| base_frame = TkFrame.new($paned1_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top) ²¼¤Î¿§ÉÕ¤±¤µ¤ì¤¿Æó¤Ä¤Î¥¦¥£¥ó¥É¥¦¤Î´Ö¤Î»ÅÀÚ¤êÏȤϡ¢°ì¤Ä¤ÎÎΰè¤ò¤½¤ì¤¾¤ì¤Î¥¦¥£¥ó¥É¥¦¤Î¤¿¤á¤Ëʬ³ä¤¹¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¹¡£º¸¥Ü¥¿¥ó¤Ç»ÅÀÚ¤ê¤òÁàºî¤¹¤ë¤È¡¢Ê¬³ä¥µ¥¤¥ºÊѹ¹¤ÎÁàºîÅÓÃæ¤Ç¤ÏºÆɽ¼¨¤Ï¤Ê¤µ¤ì¤º¡¢³ÎÄꤵ¤»¤¿¤È¤¤Ëɽ¼¨¤¬¹¹¿·¤µ¤ì¤Þ¤¹¡£¥Þ¥¦¥¹¤Ë¤è¤ë»ÅÀÚ¤ê¤ÎÁàºî¤ËÄɿ路¤Æ¥µ¥¤¥º¤òÊѹ¹¤·¤¿É½¼¨¤¬¤Ê¤ï¤ì¤ë¤è¤¦¤Ë¤·¤¿¤¤¾ì¹ç¤Ï¡¢¥Þ¥¦¥¹¤ÎÃæ±û¥Ü¥¿¥ó¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£ ¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬ panedwindow ¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤ @@ -45,7 +45,7 @@ TkFrame.new(base_frame){|f| } TkPanedwindow.new(base_frame, :orient=>:horizontal){|f| - add(Tk::Label.new(f, :text=>"This is the\nleft side", :bg=>'yellow'), + add(Tk::Label.new(f, :text=>"This is the\nleft side", :bg=>'yellow'), Tk::Label.new(f, :text=>"This is the\nright side", :bg=>'cyan')) pack(:side=>:top, :expand=>true, :fill=>:both, :pady=>2, :padx=>'2m') diff --git a/ext/tk/sample/demos-jp/paned2.rb b/ext/tk/sample/demos-jp/paned2.rb index cdc8253402..a1aee81690 100644 --- a/ext/tk/sample/demos-jp/paned2.rb +++ b/ext/tk/sample/demos-jp/paned2.rb @@ -8,7 +8,7 @@ # based on "Id: paned2.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp" if defined?($paned2_demo) && $paned2_demo - $paned2_demo.destroy + $paned2_demo.destroy $paned2_demo = nil end @@ -20,8 +20,8 @@ $paned2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($paned2_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top) ²¼¤Î¥¹¥¯¥í¡¼¥ë¥Ð¡¼ÉÕ¤¤Î¥¦¥£¥¸¥§¥Ã¥È¤¬ÃÖ¤«¤ì¤¿Æó¤Ä¤Î¥¦¥£¥ó¥É¥¦¤Î´Ö¤Î»ÅÀÚ¤êÏȤϡ¢°ì¤Ä¤ÎÎΰè¤ò¤½¤ì¤¾¤ì¤Î¥¦¥£¥ó¥É¥¦¤Î¤¿¤á¤Ëʬ³ä¤¹¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¹¡£º¸¥Ü¥¿¥ó¤Ç»ÅÀÚ¤ê¤òÁàºî¤¹¤ë¤È¡¢Ê¬³ä¥µ¥¤¥ºÊѹ¹¤ÎÁàºîÅÓÃæ¤Ç¤ÏºÆɽ¼¨¤Ï¤Ê¤µ¤ì¤º¡¢³ÎÄꤵ¤»¤¿¤È¤¤Ëɽ¼¨¤¬¹¹¿·¤µ¤ì¤Þ¤¹¡£¥Þ¥¦¥¹¤Ë¤è¤ë»ÅÀÚ¤ê¤ÎÁàºî¤ËÄɿ路¤Æ¥µ¥¤¥º¤òÊѹ¹¤·¤¿É½¼¨¤¬¤Ê¤ï¤ì¤ë¤è¤¦¤Ë¤·¤¿¤¤¾ì¹ç¤Ï¡¢¥Þ¥¦¥¹¤ÎÃæ±û¥Ü¥¿¥ó¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£ ¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬ panedwindow ¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤ @@ -47,23 +47,23 @@ TkFrame.new(base_frame){|f| paneList = TkVariable.new # define as normal variable (not array) paneList.value = [ # ruby's array --> tcl's list 'Ruby/Tk ¤Î¥¦¥£¥¸¥§¥Ã¥È°ìÍ÷', - 'TkButton', - 'TkCanvas', - 'TkCheckbutton', - 'TkEntry', - 'TkFrame', - 'TkLabel', - 'TkLabelframe', - 'TkListbox', - 'TkMenu', - 'TkMenubutton', - 'TkMessage', - 'TkPanedwindow', - 'TkRadiobutton', - 'TkScale', - 'TkScrollbar', - 'TkSpinbox', - 'TkText', + 'TkButton', + 'TkCanvas', + 'TkCheckbutton', + 'TkEntry', + 'TkFrame', + 'TkLabel', + 'TkLabelframe', + 'TkListbox', + 'TkMenu', + 'TkMenubutton', + 'TkMessage', + 'TkPanedwindow', + 'TkRadiobutton', + 'TkScale', + 'TkScrollbar', + 'TkSpinbox', + 'TkText', 'TkToplevel' ] @@ -74,20 +74,20 @@ TkPanedwindow.new(base_frame, :orient=>:vertical){|f| add(TkFrame.new(f){|paned2_top| TkListbox.new(paned2_top, :listvariable=>paneList) { # Invert the first item to highlight it - itemconfigure(0, :background=>self.cget(:foreground), + itemconfigure(0, :background=>self.cget(:foreground), :foreground=>self.cget(:background) ) - yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right, + yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right, :fill=>:y)) pack(:fill=>:both, :expand=>true) } - }, + }, TkFrame.new(f, :height=>120) {|paned2_bottom| # The bottom window is a text widget with scrollbar paned2_xscr = TkScrollbar.new(paned2_bottom) paned2_yscr = TkScrollbar.new(paned2_bottom) paned2_text = TkText.new(paned2_bottom, :width=>30, :wrap=>:non) { - insert('1.0', '¤³¤³¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ï¡¢' + + insert('1.0', '¤³¤³¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ï¡¢' + '¤´¤¯ÉáÄ̤Υƥ¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ç¤¹¡£') xscrollbar(paned2_xscr) yscrollbar(paned2_yscr) diff --git a/ext/tk/sample/demos-jp/pendulum.rb b/ext/tk/sample/demos-jp/pendulum.rb index b115f5be2c..48839aa58a 100644 --- a/ext/tk/sample/demos-jp/pendulum.rb +++ b/ext/tk/sample/demos-jp/pendulum.rb @@ -8,7 +8,7 @@ # destroy toplevel widget for this demo script if defined?($pendulum_demo) && $pendulum_demo - $pendulum_demo.destroy + $pendulum_demo.destroy $pendulum_demo = nil end @@ -61,14 +61,14 @@ class PendulumAnimationDemo # Create the canvas containing the graphical representation of the # simulated system. - @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white', + @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white', :borderwidth=>2, :relief=>:sunken) - TkcText.new(@c, 5, 5, :anchor=>:nw, + TkcText.new(@c, 5, 5, :anchor=>:nw, :text=>'Click to Adjust Bob Start Position') # Coordinates of these items don't matter; they will be set properly below @plate = TkcLine.new(@c, 0, 25, 320, 25, :width=>2, :fill=>'grey50') @rod = TkcLine.new(@c, 1, 1, 1, 1, :width=>3, :fill=>'black') - @bob = TkcOval.new(@c, 1, 1, 2, 2, + @bob = TkcOval.new(@c, 1, 1, 2, 2, :width=>3, :fill=>'yellow', :outline=>'black') TkcOval.new(@c, 155, 20, 165, 30, :fill=>'grey50', :outline=>'') @@ -78,22 +78,22 @@ class PendulumAnimationDemo # Create the canvas containing the phase space graph; this consists of # a line that gets gradually paler as it ages, which is an extremely # effective visual trick. - @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white', + @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white', :borderwidth=>2, :relief=>:sunken) @y_axis = TkcLine.new(@k, 160, 200, 160, 0, :fill=>'grey75', :arrow=>:last) @x_axis = TkcLine.new(@k, 0, 100, 320, 100, :fill=>'grey75', :arrow=>:last) @graph = {} 90.step(0, -10){|i| - # Coordinates of these items don't matter; + # Coordinates of these items don't matter; # they will be set properly below @graph[i] = TkcLine.new(@k, 0, 0, 1, 1, :smooth=>true, :fill=>"grey#{i}") } # labels - @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne, + @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne, :text=>'q', :font=>'Symbol 8') - @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne, + @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne, :text=>'dq', :font=>'Symbol 8') # pack @@ -111,19 +111,19 @@ class PendulumAnimationDemo # binding @c.bindtags_unshift(btag = TkBindTag.new) btag.bind('Destroy'){ @timer.stop } - btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x.to_i, y.to_i)}, + btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x.to_i, y.to_i)}, '%x %y') btag.bind('B1-Motion', proc{|x, y| showPendulum(x.to_i, y.to_i)}, '%x %y') - btag.bind('ButtonRelease-1', - proc{|x, y| showPendulum(x.to_i, y.to_i); @timer.start }, + btag.bind('ButtonRelease-1', + proc{|x, y| showPendulum(x.to_i, y.to_i); @timer.start }, '%x %y') btag.bind('Configure', proc{|w| @plate.coords(0, 25, w.to_i, 25)}, '%w') - @k.bind('Configure', proc{|h, w| + @k.bind('Configure', proc{|h, w| h = h.to_i w = w.to_i - @psh = h/2; + @psh = h/2; @psw = w/2 @x_axis.coords(2, @psh, w-2, @psh) @y_axis.coords(@psw, h-2, @psw, 2) @@ -144,9 +144,9 @@ class PendulumAnimationDemo end # This procedure makes the pendulum appear at the correct place on the - # canvas. If the additional arguments x, y are passed instead of computing - # the position of the pendulum from the length of the pendulum rod and its - # angle, the length and angle are computed in reverse from the given + # canvas. If the additional arguments x, y are passed instead of computing + # the position of the pendulum from the length of the pendulum rod and its + # angle, the length and angle are computed in reverse from the given # location (which is taken to be the centre of the pendulum bob.) def showPendulum(x=nil, y=nil) if x && y && (x != 160 || y != 25) diff --git a/ext/tk/sample/demos-jp/plot.rb b/ext/tk/sample/demos-jp/plot.rb index 9ff71904cd..a49ed00df8 100644 --- a/ext/tk/sample/demos-jp/plot.rb +++ b/ext/tk/sample/demos-jp/plot.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($plot_demo) && $plot_demo - $plot_demo.destroy + $plot_demo.destroy $plot_demo = nil end @@ -19,7 +19,7 @@ $plot_demo = TkToplevel.new {|w| base_frame = TkFrame.new($plot_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'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ï´Êñ¤Ê2¼¡¸µ¤Î¥×¥í¥Ã¥È¤ò´Þ¤ó¤À¥¥ã¥ó¥Ð¥¹ widget¤Ç¤¹¡£É½¼¨¤µ¤ì¤¿ÅÀ¤ò¥Þ¥¦¥¹¥Ü¥¿¥ó1¤Ç¥É¥é¥Ã¥°¤·¤Æ¥Ç¡¼¥¿¤ò¤¤¤¸¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£"){ pack('side'=>'top') } @@ -57,45 +57,45 @@ $plot_canvas.pack('side'=>'top', 'fill'=>'x') # plot À¸À® TkcLine.new($plot_canvas, 100, 250, 400, 250, 'width'=>2) TkcLine.new($plot_canvas, 100, 250, 100, 50, 'width'=>2) -TkcText.new($plot_canvas, 225, 20, +TkcText.new($plot_canvas, 225, 20, 'text'=>"´Êñ¤Ê¥×¥í¥Ã¥È", 'font'=>plotFont, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($plot_canvas, x, 250, x, 245, 'width'=>2) - TkcText.new($plot_canvas, x, 254, + TkcText.new($plot_canvas, x, 254, 'text'=>10*i, 'font'=>plotFont, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($plot_canvas, 100, y, 105, y, 'width'=>2) - TkcText.new($plot_canvas, 96, y, + TkcText.new($plot_canvas, 96, y, 'text'=>"#{i*50}.0", 'font'=>plotFont, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6, + item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end -$plot_canvas.itembind('point', 'Any-Enter', +$plot_canvas.itembind('point', 'Any-Enter', proc{$plot_canvas.itemconfigure 'current','fill','red'}) -$plot_canvas.itembind('point', 'Any-Leave', +$plot_canvas.itembind('point', 'Any-Leave', proc{$plot_canvas.itemconfigure 'current','fill','SkyBlue2'}) -$plot_canvas.itembind('point', '1', +$plot_canvas.itembind('point', '1', proc{|x,y| plotDown $plot_canvas,x,y}, "%x %y") -$plot_canvas.itembind('point', 'ButtonRelease-1', +$plot_canvas.itembind('point', 'ButtonRelease-1', proc{$plot_canvas.dtag 'selected'}) -$plot_canvas.bind('B1-Motion', +$plot_canvas.bind('B1-Motion', proc{|x,y| plotMove $plot_canvas,x,y}, "%x %y") $plot = {'lastX'=>0, 'lastY'=>0} # plotDown -- -# This method is invoked when the mouse is pressed over one of the +# This method is invoked when the mouse is pressed over one of the # data points. It sets up state to allow the point to be dragged. # # Arguments: diff --git a/ext/tk/sample/demos-jp/puzzle.rb b/ext/tk/sample/demos-jp/puzzle.rb index 2febc2c55a..16d7ce497c 100644 --- a/ext/tk/sample/demos-jp/puzzle.rb +++ b/ext/tk/sample/demos-jp/puzzle.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($puzzle_demo) && $puzzle_demo - $puzzle_demo.destroy + $puzzle_demo.destroy $puzzle_demo = nil end @@ -49,7 +49,7 @@ TkFrame.new(base_frame) {|frame| # frame À¸À® # # Special trick: scrollbar widget ¤òÀ¸À®¤·¤Æ¤½¤Î trough color ¤òÍѤ¤¤ë¤³¤È¤Ç -# ¶õÇòÉôʬ¤Î¤¿¤á¤Î°Å¿§¤òÁªÂò¤·¡¤ÀßÄꤹ¤ë +# ¶õÇòÉôʬ¤Î¤¿¤á¤Î°Å¿§¤òÁªÂò¤·¡¤ÀßÄꤹ¤ë # begin if Tk.windowingsystem() == 'aqua' @@ -69,7 +69,7 @@ end # depend_on_button_width = true depend_on_button_width = false - + s = TkScrollbar.new(base_frame) base = TkFrame.new(base_frame) { width frameWidth @@ -103,7 +103,7 @@ order = [3,1,6,2,5,7,15,13,4,11,8,9,14,10,12] if depend_on_button_width && (w.winfo_reqwidth * 4 > base.width) base.width = w.winfo_reqwidth * 4 end - }.place('relx'=>$xpos[num], 'rely'=>$ypos[num], + }.place('relx'=>$xpos[num], 'rely'=>$ypos[num], 'relwidth'=>0.25, 'relheight'=>0.25) } $xpos['space'] = 0.75 diff --git a/ext/tk/sample/demos-jp/radio.rb b/ext/tk/sample/demos-jp/radio.rb index a61ad46d9b..3355f25116 100644 --- a/ext/tk/sample/demos-jp/radio.rb +++ b/ext/tk/sample/demos-jp/radio.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($radio_demo) && $radio_demo - $radio_demo.destroy + $radio_demo.destroy $radio_demo = nil end diff --git a/ext/tk/sample/demos-jp/radio2.rb b/ext/tk/sample/demos-jp/radio2.rb index cf53e3e485..91496beb6d 100644 --- a/ext/tk/sample/demos-jp/radio2.rb +++ b/ext/tk/sample/demos-jp/radio2.rb @@ -10,7 +10,7 @@ # toplevel widget if defined?($radio2_demo) && $radio2_demo - $radio2_demo.destroy + $radio2_demo.destroy $radio2_demo = nil end @@ -23,7 +23,7 @@ $radio2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio2_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '5i' @@ -32,12 +32,12 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# size = TkVariable.new color = TkVariable.new align = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { #text 'λ²ò' @@ -58,24 +58,24 @@ TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'ÊÑ¿ô»²¾È' command proc{ - showVars(base_frame, + showVars(base_frame, ['size', size], ['color', color], ['compound', align]) } }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame -f_left = TkLabelFrame.new(base_frame, 'text'=>'ʸ»ú¥µ¥¤¥º', +# frame +f_left = TkLabelFrame.new(base_frame, 'text'=>'ʸ»ú¥µ¥¤¥º', 'pady'=>2, 'padx'=>2) -f_mid = TkLabelFrame.new(base_frame, 'text'=>'¿§', +f_mid = TkLabelFrame.new(base_frame, 'text'=>'¿§', 'pady'=>2, 'padx'=>2) -f_right = TkLabelFrame.new(base_frame, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ', +f_right = TkLabelFrame.new(base_frame, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ', 'pady'=>2, 'padx'=>2) f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_mid.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') -# radiobutton +# radiobutton [10, 12, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "¥Ý¥¤¥ó¥È¥µ¥¤¥º #{sz}" @@ -95,15 +95,15 @@ f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x') } -# label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', -label = Tk::Label.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', +# label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', +label = Tk::Label.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', 'compound'=>'left') label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top') label.height(TkWinfo.reqheight(label)) abtn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a| lower = a.downcase - TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', - 'value'=>lower, 'indicatoron'=>0, 'width'=>7, + TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', + 'value'=>lower, 'indicatoron'=>0, 'width'=>7, 'command'=>proc{label.compound(align.value)}) } diff --git a/ext/tk/sample/demos-jp/radio3.rb b/ext/tk/sample/demos-jp/radio3.rb index 4bbc1b31f5..763c522448 100644 --- a/ext/tk/sample/demos-jp/radio3.rb +++ b/ext/tk/sample/demos-jp/radio3.rb @@ -10,7 +10,7 @@ # toplevel widget if defined?($radio3_demo) && $radio3_demo - $radio3_demo.destroy + $radio3_demo.destroy $radio3_demo = nil end @@ -23,7 +23,7 @@ $radio3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio3_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '5i' @@ -37,50 +37,50 @@ size = TkVariable.new color = TkVariable.new align = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, ['size', size], + showVars(base_frame, ['size', size], ['color', color], ['compound', align]) - }), - TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'radio3'}), - TkButton.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + }), + TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'radio3'}), + TkButton.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $radio3_demo $radio3_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) TkGrid(frame, :row=>3, :column=>0, :columnspan=>3, :sticky=>'nsew') } -# frame -f_left = TkLabelFrame.new(base_frame, 'text'=>'ʸ»ú¥µ¥¤¥º', +# frame +f_left = TkLabelFrame.new(base_frame, 'text'=>'ʸ»ú¥µ¥¤¥º', 'pady'=>2, 'padx'=>2) -f_mid = TkLabelFrame.new(base_frame, 'text'=>'¿§', +f_mid = TkLabelFrame.new(base_frame, 'text'=>'¿§', 'pady'=>2, 'padx'=>2) -f_right = TkLabelFrame.new(base_frame, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ', +f_right = TkLabelFrame.new(base_frame, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ', 'pady'=>2, 'padx'=>2) f_left .grid('column'=>0, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2) f_mid .grid('column'=>1, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2) f_right.grid('column'=>2, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c') -TkButton.new(base_frame, 'text'=>'¥È¥é¥¤¥¹¥Æ¡¼¥È', +TkButton.new(base_frame, 'text'=>'¥È¥é¥¤¥¹¥Æ¡¼¥È', 'command'=>proc{size.value = 'multi'; color.value = 'multi'}){ grid('column'=>2, 'row'=>2, 'pady'=>'.5c', 'padx'=>'.5c') } -# radiobutton +# radiobutton [10, 12, 14, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "¥Ý¥¤¥ó¥È¥µ¥¤¥º #{sz}" @@ -103,14 +103,14 @@ TkButton.new(base_frame, 'text'=>'¥È¥é¥¤¥¹¥Æ¡¼¥È', }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x') } -# label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', -label = Tk::Label.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', +# label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', +label = Tk::Label.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', 'compound'=>'left') label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top') label.height(TkWinfo.reqheight(label)) a_btn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a| - TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', - 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7, + TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', + 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7, 'command'=>proc{label.compound(align.value)}) } diff --git a/ext/tk/sample/demos-jp/ruler.rb b/ext/tk/sample/demos-jp/ruler.rb index d6bc9e76d1..a721b95a6a 100644 --- a/ext/tk/sample/demos-jp/ruler.rb +++ b/ext/tk/sample/demos-jp/ruler.rb @@ -18,7 +18,7 @@ end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($ruler_demo) && $ruler_demo - $ruler_demo.destroy + $ruler_demo.destroy $ruler_demo = nil end @@ -32,7 +32,7 @@ $ruler_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ruler_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'=>"¤³¤Î¥¥ã¥ó¥Ð¥¹widget¤Ï¥ë¡¼¥é¡¼¤ÎÌÏ·¿¤Ç¤¹¡£¥ë¡¼¥é¡¼¤Î±¦¤Ë¤¢¤ë¤Î¤Ï¥¿¥Ö¥¹¥È¥Ã¥×¤Î°æ¸Í¤Ç¡¢¤³¤³¤«¤é°ú¤ÃÄ¥¤Ã¤Æ¤¯¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥¿¥Ö¥¹¥È¥Ã¥×¤òºî¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¤Þ¤¿¡¢¤¹¤Ç¤Ë¤¢¤ë¥¿¥Ö¥¹¥È¥Ã¥×¤òÆ°¤«¤¹¤³¤È¤â¤Ç¤¤Þ¤¹¡£¥¿¥Ö¥¹¥È¥Ã¥×¤ò¾åÊý¤Þ¤¿¤Ï²¼Êý¤Ë¤«¤¹¤ì¤Æɽ¼¨¤µ¤ì¤ë¤Þ¤Ç¥É¥é¥Ã¥°¤¹¤ë¤È¡¢¥Þ¥¦¥¹¥Ü¥¿¥ó¤òÎ¥¤·¤¿»þ¤Ë¤½¤Î¥¿¥Ö¥¹¥È¥Ã¥×¤Ï¾Ã¤¨¤Þ¤¹¡£"){ pack('side'=>'top') } @@ -62,8 +62,8 @@ $ruler_canvas.pack('side'=>'top', 'fill'=>'x') # ÃÍÀßÄê unless Struct.const_defined?("RulerInfo") - $demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y, - :top, :bottom, :size, :normalStyle, + $demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y, + :top, :bottom, :size, :normalStyle, :activeStyle, :deleteStyle).new end $demo_rulerInfo.grid = '.25c' @@ -75,17 +75,17 @@ $demo_rulerInfo.size = TkWinfo.fpixels($ruler_canvas, '.2c') $demo_rulerInfo.normalStyle = {'fill'=>'black'} if TkWinfo.depth($ruler_canvas) > 1 $demo_rulerInfo.activeStyle = {'fill'=>'red', 'stipple'=>''} - $demo_rulerInfo.deleteStyle = {'fill'=>'red', - 'stipple'=>'@'+[$demo_dir, '..', + $demo_rulerInfo.deleteStyle = {'fill'=>'red', + 'stipple'=>'@'+[$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator)} else $demo_rulerInfo.activeStyle = {'fill'=>'black', 'stipple'=>''} - $demo_rulerInfo.deleteStyle = {'fill'=>'black', - 'stipple'=>'@'+[$demo_dir, '..', + $demo_rulerInfo.deleteStyle = {'fill'=>'black', + 'stipple'=>'@'+[$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator)} end -TkcLine.new($ruler_canvas, +TkcLine.new($ruler_canvas, '1c', '0.5c', '1c', '1c', '13c', '1c', '13c', '0.5c', 'width'=>1) (0..11).each{|i| x = i+1 @@ -99,21 +99,21 @@ TkcLine.new($ruler_canvas, $rulerTag_well = TkcTag.new($ruler_canvas) $ruler_canvas\ .addtag_withtag($rulerTag_well, - TkcRectangle.new($ruler_canvas, - '13.2c', '1c', '13.8c', '0.5c', - 'outline'=>'black', + TkcRectangle.new($ruler_canvas, + '13.2c', '1c', '13.8c', '0.5c', + 'outline'=>'black', 'fill'=>($ruler_canvas\ .configinfo('background'))[4]) ) $ruler_canvas\ .addtag_withtag($rulerTag_well, - rulerMkTab($ruler_canvas, - TkWinfo.pixels($ruler_canvas, '13.5c'), + rulerMkTab($ruler_canvas, + TkWinfo.pixels($ruler_canvas, '13.5c'), TkWinfo.pixels($ruler_canvas, '.65c') ) ) $rulerTag_well.bind('1', proc{|x,y| rulerNewTab($ruler_canvas,x,y)}, '%x %y') -$ruler_canvas.itembind('tab', '1', +$ruler_canvas.itembind('tab', '1', proc{|x,y| rulerSelectTab($ruler_canvas,x,y)}, '%x %y') -$ruler_canvas.bind('B1-Motion', +$ruler_canvas.bind('B1-Motion', proc{|x,y| rulerMoveTab($ruler_canvas,x,y)}, '%x %y') $ruler_canvas.bind('Any-ButtonRelease-1', proc{rulerReleaseTab($ruler_canvas)}) diff --git a/ext/tk/sample/demos-jp/sayings.rb b/ext/tk/sample/demos-jp/sayings.rb index aa24b3a2ad..b3bdbe0bc5 100644 --- a/ext/tk/sample/demos-jp/sayings.rb +++ b/ext/tk/sample/demos-jp/sayings.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($sayings_demo) && $sayings_demo - $sayings_demo.destroy + $sayings_demo.destroy $sayings_demo = nil end @@ -67,11 +67,11 @@ TkFrame.new(base_frame, 'borderwidth'=>10) {|w| sayings_lbox.pack('expand'=>'yes', 'fill'=>'y') else - sayings_lbox.grid('row'=>0, 'column'=>0, + sayings_lbox.grid('row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - sv.grid('row'=>0, 'column'=>1, + sv.grid('row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - sh.grid('row'=>1, 'column'=>0, + sh.grid('row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(w, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(w, 0, 'weight'=>1, 'minsize'=>0) diff --git a/ext/tk/sample/demos-jp/search.rb b/ext/tk/sample/demos-jp/search.rb index 9838ff5d19..293ae83910 100644 --- a/ext/tk/sample/demos-jp/search.rb +++ b/ext/tk/sample/demos-jp/search.rb @@ -58,13 +58,13 @@ end def textToggle(cmd1,sleep1,cmd2,sleep2) sleep_list = [sleep2, sleep1] - TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, + TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, -1, cmd1, cmd2).start(sleep1) end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($search_demo) && $search_demo - $search_demo.destroy + $search_demo.destroy $search_demo = nil end @@ -98,35 +98,35 @@ $search_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame À¸À® TkFrame.new(base_frame) {|f| - TkLabel.new(f, 'text'=>'¥Õ¥¡¥¤¥ë̾:', + TkLabel.new(f, 'text'=>'¥Õ¥¡¥¤¥ë̾:', 'width'=>13, 'anchor'=>'w').pack('side'=>'left') $search_fileName = TkVariable.new - TkEntry.new(f, 'width'=>40, + TkEntry.new(f, 'width'=>40, 'textvariable'=>$search_fileName) { pack('side'=>'left') bind('Return', proc{textLoadFile($search_text, $search_fileName.value) $search_string_entry.focus}) focus } - TkButton.new(f, 'text'=>'Æɤ߹þ¤ß', - 'command'=>proc{textLoadFile($search_text, + TkButton.new(f, 'text'=>'Æɤ߹þ¤ß', + 'command'=>proc{textLoadFile($search_text, $search_fileName.value)})\ .pack('side'=>'left', 'pady'=>5, 'padx'=>10) }.pack('side'=>'top', 'fill'=>'x') TkFrame.new(base_frame) {|f| - TkLabel.new(f, 'text'=>'¸¡º÷ʸ»úÎó:', + TkLabel.new(f, 'text'=>'¸¡º÷ʸ»úÎó:', 'width'=>13, 'anchor'=>'w').pack('side'=>'left') $search_searchString = TkVariable.new - $search_string_entry = TkEntry.new(f, 'width'=>40, + $search_string_entry = TkEntry.new(f, 'width'=>40, 'textvariable'=>$search_searchString) { pack('side'=>'left') - bind('Return', proc{textSearch($search_text, $search_searchString.value, + bind('Return', proc{textSearch($search_text, $search_searchString.value, $search_Tag)}) } - TkButton.new(f, 'text'=>'ȿž', - 'command'=>proc{textSearch($search_text, - $search_searchString.value, + TkButton.new(f, 'text'=>'ȿž', + 'command'=>proc{textSearch($search_text, + $search_searchString.value, $search_Tag)}) { pack('side'=>'left', 'pady'=>5, 'padx'=>10) } @@ -139,26 +139,26 @@ $search_text = TkText.new(base_frame, 'setgrid'=>true) {|t| pack('side'=>'right', 'fill'=>'y') } pack('expand'=>'yes', 'fill'=>'both') -} +} # Set up display styles for text highlighting. if TkWinfo.depth($search_demo) > 1 textToggle(proc{ - $search_Tag.configure('background'=>'#ce5555', + $search_Tag.configure('background'=>'#ce5555', 'foreground'=>'white') }, - 800, + 800, proc{ $search_Tag.configure('background'=>'', 'foreground'=>'') }, 200 ) else textToggle(proc{ - $search_Tag.configure('background'=>'black', + $search_Tag.configure('background'=>'black', 'foreground'=>'white') }, - 800, + 800, proc{ $search_Tag.configure('background'=>'', 'foreground'=>'') }, diff --git a/ext/tk/sample/demos-jp/spin.rb b/ext/tk/sample/demos-jp/spin.rb index 8d4e33cda0..2bcc3217e6 100644 --- a/ext/tk/sample/demos-jp/spin.rb +++ b/ext/tk/sample/demos-jp/spin.rb @@ -7,7 +7,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($spin_demo) && $spin_demo - $spin_demo.destroy + $spin_demo.destroy $spin_demo = nil end @@ -19,8 +19,8 @@ $spin_demo = TkToplevel.new {|w| base_frame = TkFrame.new($spin_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><<EOL).pack(:side=>:top) ²¼¤Ë¤Ï£³¼ïÎà¤Î¥¹¥Ô¥ó¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ ¤½¤ì¤¾¤ì¡¢¥Þ¥¦¥¹¤ÇÁªÂò¤·¤Æʸ»ú¤òÆþÎϤ¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ @@ -38,7 +38,7 @@ Backspace ¤È Control-h ¤È¤ÏÆþÎÏ¥«¡¼¥½¥ë¤Îº¸Â¦¤Îʸ»ú¤ò ¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤ ¥Ö¥é¥ê¤¬ spinbox ¥¦¥£¥¸¥§¥Ã¥È¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¤³¤Î ¥Ç¥â¤Ï¤¦¤Þ¤¯Æ°¤«¤Ê¤¤¤Ï¤º¤Ç¤¹¡£¤½¤Î¾ì¹ç¤Ë¤Ï spinbox ¥¦¥£ -¥¸¥§¥Ã¥È¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk +¥¸¥§¥Ã¥È¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk ¤òÁȤ߹ç¤ï¤»¤Æ»î¤¹¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£ EOL @@ -56,16 +56,16 @@ TkFrame.new(base_frame){|f| } australianCities = [ - 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', + 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', 'Hobart', 'Darwin', 'Alice Springs' ] [ - TkSpinbox.new(base_frame, :from=>1, :to=>10, :width=>10, :validate=>:key, + TkSpinbox.new(base_frame, :from=>1, :to=>10, :width=>10, :validate=>:key, :validatecommand=>[ proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' - ]), - TkSpinbox.new(base_frame, :from=>0, :to=>3, :increment=>0.5, - :format=>'%05.2f', :width=>10), + ]), + TkSpinbox.new(base_frame, :from=>0, :to=>3, :increment=>0.5, + :format=>'%05.2f', :width=>10), TkSpinbox.new(base_frame, :values=>australianCities, :width=>10) ].each{|sbox| sbox.pack(:side=>:top, :pady=>5, :padx=>10)} diff --git a/ext/tk/sample/demos-jp/states.rb b/ext/tk/sample/demos-jp/states.rb index 5e242b7c38..f354d28d84 100644 --- a/ext/tk/sample/demos-jp/states.rb +++ b/ext/tk/sample/demos-jp/states.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($states_demo) && $states_demo - $states_demo.destroy + $states_demo.destroy $states_demo = nil end diff --git a/ext/tk/sample/demos-jp/style.rb b/ext/tk/sample/demos-jp/style.rb index 66b6de0251..3189e1f6d8 100644 --- a/ext/tk/sample/demos-jp/style.rb +++ b/ext/tk/sample/demos-jp/style.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($style_demo) && $style_demo - $style_demo.destroy + $style_demo.destroy $style_demo = nil end @@ -76,13 +76,13 @@ txt = TkText.new(base_frame){|t| # when /^8.*/ # unless $style_demo_do_first # $style_demo_do_first = true -# Tk.tk_call('font', 'create', '@bigascii', +# Tk.tk_call('font', 'create', '@bigascii', # '-copy', '-*-Courier-Bold-R-Normal--*-140-*-*-*-*-*-*') -# Tk.tk_call('font', 'create', '@smallascii', +# Tk.tk_call('font', 'create', '@smallascii', # '-copy', '-Adobe-Helvetica-Bold-R-Normal-*-100-*') -# Tk.tk_call('font', 'create', '@cBigFont', +# Tk.tk_call('font', 'create', '@cBigFont', # '-compound', '@bigascii @msg_knj') -# Tk.tk_call('font', 'create', '@cSmallFont', +# Tk.tk_call('font', 'create', '@cSmallFont', # '-compound', '@smallascii @kanji') # end # style_tag_big = TkTextTag.new(t, 'font'=>'@cBigFont') @@ -96,24 +96,24 @@ txt = TkText.new(base_frame){|t| style_tag_raised = TkTextTag.new(t, 'relief'=>'raised', 'borderwidth'=>1) style_tag_sunken = TkTextTag.new(t, 'relief'=>'sunken', 'borderwidth'=>1) else - style_tag_color1 = TkTextTag.new(t, 'background'=>'black', + style_tag_color1 = TkTextTag.new(t, 'background'=>'black', 'foreground'=>'white') - style_tag_color2 = TkTextTag.new(t, 'background'=>'black', + style_tag_color2 = TkTextTag.new(t, 'background'=>'black', 'foreground'=>'white') - style_tag_raised = TkTextTag.new(t, 'background'=>'white', + style_tag_raised = TkTextTag.new(t, 'background'=>'white', 'relief'=>'raised', 'borderwidth'=>1) - style_tag_sunken = TkTextTag.new(t, 'background'=>'white', + style_tag_sunken = TkTextTag.new(t, 'background'=>'white', 'relief'=>'sunken', 'borderwidth'=>1) end # ¥Æ¥¥¹¥È¥¿¥°ÀßÄê (¤½¤Î¾) if $tk_version =~ /^4\.[01]/ - style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', - 'borderwidth'=>0, + style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', + 'borderwidth'=>0, 'bgstipple'=>'gray25') else - style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', - 'borderwidth'=>0, + style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', + 'borderwidth'=>0, 'bgstipple'=>'gray12') end style_tag_fgstipple = TkTextTag.new(t, 'fgstipple'=>'gray50') @@ -217,9 +217,9 @@ X') 9. ¥Þ¡¼¥¸¥ó', style_tag_big) insert('end', '¥Æ¥¥¹¥È¤Îº¸Â¦¤Ë;ʬ¤Ê¶õÇò¤òÃÖ¤¯¤³¤È¤¬¤Ç¤¤Þ¤¹: ') - insert('end', '¤³¤ÎÃÊÍî¤Ï¥Þ¡¼¥¸¥ó¤Î»ÈÍÑÎã¤Ç¤¹¡£¥¹¥¯¥ê¡¼¥ó', + insert('end', '¤³¤ÎÃÊÍî¤Ï¥Þ¡¼¥¸¥ó¤Î»ÈÍÑÎã¤Ç¤¹¡£¥¹¥¯¥ê¡¼¥ó', style_tag_margins) - insert('end', '¾å¤ÇÀÞ¤êÊÖ¤µ¤ì¤Æɽ¼¨¤µ¤ì¤Æ¤¤¤ë1¹Ô¤Î¥Æ¥¥¹¥È¤Ç¤¹¡£', + insert('end', '¾å¤ÇÀÞ¤êÊÖ¤µ¤ì¤Æɽ¼¨¤µ¤ì¤Æ¤¤¤ë1¹Ô¤Î¥Æ¥¥¹¥È¤Ç¤¹¡£', style_tag_margins) insert('end', 'º¸Â¦¤Ë¤Ï2¼ïÎà¤Î¥Þ¡¼¥¸¥ó¤ò»ý¤Á¤Þ¤¹¡£', style_tag_margins) insert('end', '1¹ÔÌܤËÂФ¹¤ë¤â¤Î¤È¡¢', style_tag_margins) @@ -241,9 +241,9 @@ spacing3') insert('end', '¤Î¶õ´Ö¤òÃÖ ¤¯¤«¤ò¼¨¤·¤Þ¤¹¡£ ') - insert('end', '¤³¤ì¤é¤Î¥¤¥ó¥Ç¥ó¥È¤µ¤ì¤¿ÃÊÍî¤Ï¤É¤Î¤è¤¦¤Ë', + insert('end', '¤³¤ì¤é¤Î¥¤¥ó¥Ç¥ó¥È¤µ¤ì¤¿ÃÊÍî¤Ï¤É¤Î¤è¤¦¤Ë', style_tag_spacing) - insert('end', '¥¹¥Ú¡¼¥·¥ó¥°¤¬¤¬¹Ô¤ï¤ì¤ë¤Î¤«¤ò¼¨¤·¤Þ¤¹¡£', + insert('end', '¥¹¥Ú¡¼¥·¥ó¥°¤¬¤¬¹Ô¤ï¤ì¤ë¤Î¤«¤ò¼¨¤·¤Þ¤¹¡£', style_tag_spacing) insert('end', '³ÆÃÊÍî¤Ï¼ÂºÝ¤Ï¥Æ¥¥¹¥Èwidget', style_tag_spacing) insert('end', '¤Î1¹Ô¤Ç¡¢widget¤Ë¤è¤Ã¤ÆÀÞ¤ê¾ö¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£ @@ -253,11 +253,11 @@ spacing3') insert('end', '¤³¤ì¤Ë¤è¤ê¡¢ÃÊÍî¤Î´Ö¤ËÂ礤ʴֳ֤¬', style_tag_spacing) insert('end', '¸ºß¤·¤Æ¤¤¤Þ¤¹¡£', style_tag_spacing) insert('end', 'Spacing2¤Ï2point¤ËÀßÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡£', style_tag_spacing) - insert('end', '¤³¤ì¤ÇÃÊÍî¤ÎÃæ¤Ë¤Û¤ó¤Î¾¯¤·´Ö³Ö¤¬Â¸ºß¤·¤Æ¤¤¤Þ¤¹¡£', + insert('end', '¤³¤ì¤ÇÃÊÍî¤ÎÃæ¤Ë¤Û¤ó¤Î¾¯¤·´Ö³Ö¤¬Â¸ºß¤·¤Æ¤¤¤Þ¤¹¡£', style_tag_spacing) insert('end', 'Spacing3¤Ï¤³¤ÎÎã¤Ç¤Ï»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ', style_tag_spacing) - insert('end', '´Ö³Ö¤¬¤É¤³¤Ë¤¢¤ë¤«¤ò¸«¤¿¤±¤ì¤Ð¡¢¤³¤ì¤é¤ÎÃÊÍî¤Î', + insert('end', '´Ö³Ö¤¬¤É¤³¤Ë¤¢¤ë¤«¤ò¸«¤¿¤±¤ì¤Ð¡¢¤³¤ì¤é¤ÎÃÊÍî¤Î', style_tag_spacing) insert('end', '¤Ê¤«¤Ç¥Æ¥¥¹¥È¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£ÁªÂò¤Î', style_tag_spacing) insert('end', 'ȿž¤·¤¿Éôʬ¤Ë¤Ï;ʬ¤Ë¤È¤é¤ì¤¿´Ö³Ö¤¬', style_tag_spacing) diff --git a/ext/tk/sample/demos-jp/text.rb b/ext/tk/sample/demos-jp/text.rb index 0ae480eb00..ea15064830 100644 --- a/ext/tk/sample/demos-jp/text.rb +++ b/ext/tk/sample/demos-jp/text.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($text_demo) && $text_demo - $text_demo.destroy + $text_demo.destroy $text_demo = nil end diff --git a/ext/tk/sample/demos-jp/textpeer.rb b/ext/tk/sample/demos-jp/textpeer.rb index 4967a99c92..de604f1940 100644 --- a/ext/tk/sample/demos-jp/textpeer.rb +++ b/ext/tk/sample/demos-jp/textpeer.rb @@ -5,7 +5,7 @@ # based on Tcl/Tk8.5.0 widget demos if defined?($textpeer_demo) && $textpeer_demo - $textpeer_demo.destroy + $textpeer_demo.destroy $textpeer_demo = nil end @@ -43,11 +43,11 @@ def makeClone(count, win, txt) peer = TkText::Peer.new(txt, win, :widgetname=>"text#{cnt}") sbar = TkScrollbar.new(win, :widgetname=>"sb#{cnt}") peer.yscrollbar sbar - b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", - :text=>'¥Ô¥¢(peer)¤ÎºîÀ®', + b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", + :text=>'¥Ô¥¢(peer)¤ÎºîÀ®', :command=>proc{makeClone(count, win, peer)}) - b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", - :text=>'¥Ô¥¢(peer)¤Î¾Ãµî', + b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", + :text=>'¥Ô¥¢(peer)¤Î¾Ãµî', :command=>proc{killClone(win, cnt)}) row = cnt * 2 TkGrid.configure(peer, sbar, b1, :sticky=>'nsew', :row=>row) @@ -57,7 +57,7 @@ def makeClone(count, win, txt) end def killClone(win, cnt) - Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", + Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", "#{win.path}.clone#{cnt}", "#{win.path}.kill#{cnt}") end diff --git a/ext/tk/sample/demos-jp/toolbar.rb b/ext/tk/sample/demos-jp/toolbar.rb index 1bb265d1f8..570d52704f 100644 --- a/ext/tk/sample/demos-jp/toolbar.rb +++ b/ext/tk/sample/demos-jp/toolbar.rb @@ -7,7 +7,7 @@ # based on "Id: toolbar.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($toolbar_demo) && $toolbar_demo - $toolbar_demo.destroy + $toolbar_demo.destroy $toolbar_demo = nil end @@ -86,28 +86,28 @@ end text = TkText.new(base_frame, :width=>40, :height=>10) ## Toolbar contents -tb_btn = Ttk::Button.new(tbar_base, :text=>'¥Ü¥¿¥ó', :style=>'Toolbutton', +tb_btn = Ttk::Button.new(tbar_base, :text=>'¥Ü¥¿¥ó', :style=>'Toolbutton', :command=>proc{ text.insert(:end, "¥Ü¥¿¥ó¤¬²¡¤µ¤ì¤Þ¤·¤¿¡¥\n") }) -tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'¥Á¥§¥Ã¥¯¥Ü¥¿¥ó', - :style=>'Toolbutton', - :variable=>(check = TkVariable.new), +tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'¥Á¥§¥Ã¥¯¥Ü¥¿¥ó', + :style=>'Toolbutton', + :variable=>(check = TkVariable.new), :command=>proc{ text.insert(:end, "¥Á¥§¥Ã¥¯¥Ü¥¿¥ó¤ÎÃͤÏ#{check.value}¤Ç¤¹¡¥\n") }) tb_mbtn = Ttk::Menubutton.new(tbar_base, :text=>'¥á¥Ë¥å¡¼') -tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families, +tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families, :state=>:readonly) tb_mbtn.menu(menu = Tk::Menu.new(tb_mbtn)) menu.add(:command, :label=>'Just', :command=>proc{text.insert(:end, "Just\n")}) menu.add(:command, :label=>'An', :command=>proc{text.insert(:end, "An\n")}) -menu.add(:command, :label=>'Example', +menu.add(:command, :label=>'Example', :command=>proc{text.insert(:end, "Example\n")}) tb_combo.bind('<ComboboxSelected>'){ text.font.family = tb_combo.get } ## Arrange contents -Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, +Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, :in=>contents, :padx=>2, :sticky=>'ns') Tk.grid(tbar_base, :sticky=>'ew') Tk.grid(sep, :sticky=>'ew') @@ -120,16 +120,16 @@ base_frame.grid_columnconfigure(text, :weight=>1) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'toolbar'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'toolbar'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $toolbar_demo.destroy $toolbar_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) Tk.grid(frame, :sticky=>'ew') diff --git a/ext/tk/sample/demos-jp/tree.rb b/ext/tk/sample/demos-jp/tree.rb index c3b4191144..00d715282b 100644 --- a/ext/tk/sample/demos-jp/tree.rb +++ b/ext/tk/sample/demos-jp/tree.rb @@ -8,7 +8,7 @@ # based on "Id: tree.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp" if defined?($tree_demo) && $tree_demo - $tree_demo.destroy + $tree_demo.destroy $tree_demo = nil end @@ -21,8 +21,8 @@ $tree_demo = TkToplevel.new {|w| base_frame = TkFrame.new($tree_demo).pack(:fill=>:both, :expand=>true) ## Explanatory text -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', - :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', + :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><<EOL).pack(:fill=>:x) Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\ ¤³¤Î¥µ¥ó¥×¥ë¤Ï¡¤¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¤è¤¦¤Ê³¬ÁØŪ¤Ê¥Ç¡¼¥¿½¸¹ç¤ò\ @@ -38,16 +38,16 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'tree'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'tree'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $tree_demo.destroy $tree_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -56,7 +56,7 @@ Ttk::Frame.new(base_frame) {|frame| ## Code to populate the roots of the tree (can be more than one on Windows) def populate_roots(tree) TkComm.simplelist(Tk.tk_call('file', 'volumes')).sort.each{|dir| - populate_tree(tree, tree.insert(nil, :end, :text=>dir, + populate_tree(tree, tree.insert(nil, :end, :text=>dir, :values=>[dir, 'directory'])) } end @@ -69,7 +69,7 @@ def populate_tree(tree, node) tree.delete(tree.children(node)) Dir.glob("#{path}/*").sort.each{|f| type = File.ftype(f) - id = tree.insert(node, :end, + id = tree.insert(node, :end, :text=>File.basename(f), :values=>[f, type]).id if type == 'directory' ## Make it so that this node is openable @@ -95,7 +95,7 @@ def populate_tree(tree, node) end ## Create the tree and set it up -tree = Ttk::Treeview.new(base_frame, :columns=>%w(fullpath type size), +tree = Ttk::Treeview.new(base_frame, :columns=>%w(fullpath type size), :displaycolumns=>['size']) if Tk.windowingsystem != 'aqua' vsb = tree.yscrollbar(Ttk::Scrollbar.new(base_frame)) diff --git a/ext/tk/sample/demos-jp/ttkbut.rb b/ext/tk/sample/demos-jp/ttkbut.rb index 4d577120bb..90ec3fce5b 100644 --- a/ext/tk/sample/demos-jp/ttkbut.rb +++ b/ext/tk/sample/demos-jp/ttkbut.rb @@ -9,7 +9,7 @@ # based on "Id: ttkbut.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp" if defined?($ttkbut_demo) && $ttkbut_demo - $ttkbut_demo.destroy + $ttkbut_demo.destroy $ttkbut_demo = nil end @@ -21,7 +21,7 @@ $ttkbut_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkbut_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top, :fill=>:x) Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\ º£¡¤¤¢¤Ê¤¿¤¬Ìܤˤ·¤Æ¤¤¤ë¤Î¤ÏTtk¤Î¥Æ¡¼¥Þ²½¥é¥Ù¥ë¤Ç¡¤\ @@ -40,11 +40,11 @@ EOL ## Add buttons for setting the theme buttons = Ttk::Labelframe.new(base_frame, :text=>'¥Ü¥¿¥ó') # Ttk::Style.theme_names.each{|theme| -# Ttk::Button.new(buttons, :text=>theme, +# Ttk::Button.new(buttons, :text=>theme, # :command=>proc{Ttk::Style.theme_use theme}).pack(:pady=>2) # } Ttk.themes.each{|theme| - Ttk::Button.new(buttons, :text=>theme, + Ttk::Button.new(buttons, :text=>theme, :command=>proc{Ttk.set_theme theme}).pack(:pady=>2) } @@ -68,9 +68,9 @@ end ## Set up the checkbutton group checks = Ttk::Labelframe.new(base_frame, :text=>'¥Á¥§¥Ã¥¯¥Ü¥¿¥ó') enabled = TkVariable.new(true) -e = Ttk::Checkbutton.new(checks, :text=>'͸ú²½', :variable=>enabled, +e = Ttk::Checkbutton.new(checks, :text=>'͸ú²½', :variable=>enabled, :command=>proc{ - setState($ttkbut_demo, + setState($ttkbut_demo, ((enabled.bool)? "!disabled" : "disabled"), e) }) @@ -96,15 +96,15 @@ radios = Ttk::Labelframe.new(base_frame, :text=>'¥é¥¸¥ª¥Ü¥¿¥ó') happyness = TkVariable.new -r1 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r1 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Great', :value=>'great') -r2 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r2 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Good', :value=>'good') -r3 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r3 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Ok', :value=>'ok') -r4 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r4 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Poor', :value=>'poor') -r5 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r5 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Awful', :value=>'awful') Tk.pack(r1, r2, r3, r4, r5, :fill=>:x, :padx=>3, :pady=>2) @@ -113,26 +113,26 @@ Tk.pack(r1, r2, r3, r4, r5, :fill=>:x, :padx=>3, :pady=>2) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'ÊÑ¿ô»²¾È', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'ÊÑ¿ô»²¾È', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, ['͸ú²½', enabled], - ['¥Á¡¼¥º', cheese], ['¥È¥Þ¥È', tomato], - ['¥Ð¥¸¥ë', basil], ['¥ª¥ì¥¬¥Î', oregano], + showVars(base_frame, ['͸ú²½', enabled], + ['¥Á¡¼¥º', cheese], ['¥È¥Þ¥È', tomato], + ['¥Ð¥¸¥ë', basil], ['¥ª¥ì¥¬¥Î', oregano], ['¹¬Ê¡ÅÙ', happyness]) - }), - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkbut'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + }), + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkbut'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $ttkbut_demo $ttkbut_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x, :expand=>true) diff --git a/ext/tk/sample/demos-jp/ttkmenu.rb b/ext/tk/sample/demos-jp/ttkmenu.rb index d349b42d11..9e78678c8e 100644 --- a/ext/tk/sample/demos-jp/ttkmenu.rb +++ b/ext/tk/sample/demos-jp/ttkmenu.rb @@ -8,7 +8,7 @@ # based on "Id: ttkmenu.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkmenu_demo) && $ttkmenu_demo - $ttkmenu_demo.destroy + $ttkmenu_demo.destroy $ttkmenu_demo = nil end @@ -20,7 +20,7 @@ $ttkmenu_demo = TkToplevel.new {|w| base_frame = Ttk::Frame.new($ttkmenu_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top, :fill=>:x) Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\ ¤³¤ì¤Ë¤è¤ê¥Æ¡¼¥Þ¤ËÂбþ¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¥¦¥£¥¸¥§¥Ã¥È¤Î¤Ò¤È¤Ä¤Ë\ @@ -45,16 +45,16 @@ Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x) Ttk::Frame.new($ttkmenu_demo) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkmenu'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkmenu'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkmenu_demo.destroy $ttkmenu_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) diff --git a/ext/tk/sample/demos-jp/ttknote.rb b/ext/tk/sample/demos-jp/ttknote.rb index 09cc7960a3..f0cd258893 100644 --- a/ext/tk/sample/demos-jp/ttknote.rb +++ b/ext/tk/sample/demos-jp/ttknote.rb @@ -8,7 +8,7 @@ # based on "Id: ttknote.tcl,v 1.5 2007/12/13 15:27:07 dgp Exp" if defined?($ttknote_demo) && $ttknote_demo - $ttknote_demo.destroy + $ttknote_demo.destroy $ttknote_demo = nil end @@ -22,16 +22,16 @@ $ttknote_demo = TkToplevel.new {|w| Ttk::Frame.new($ttknote_demo) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttknote'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttknote'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttknote_demo.destroy $ttknote_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -40,13 +40,13 @@ Ttk::Frame.new($ttknote_demo) {|frame| base_frame = Ttk::Frame.new($ttknote_demo).pack(:fill=>:both, :expand=>true) ## Make the notebook and set up Ctrl+Tab traversal -notebook = Ttk::Notebook.new(base_frame).pack(:fill=>:both, :expand=>true, +notebook = Ttk::Notebook.new(base_frame).pack(:fill=>:both, :expand=>true, :padx=>2, :pady=>3) notebook.enable_traversal ## Popuplate the first pane f_msg = Ttk::Frame.new(notebook) -msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'5i', +msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'5i', :justify=>:left, :anchor=>'n', :text=><<EOL) Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\ ¤½¤ÎÃæ¤Ë´Þ¤Þ¤ì¤ë¥¦¥£¥¸¥§¥Ã¥È¤Î¤Ò¤È¤Ä¤Ë¥Î¡¼¥È¥Ö¥Ã¥¯¥¦¥£¥¸¥§¥Ã¥È¤¬¤¢¤ê¤Þ¤¹¡¥\ @@ -64,7 +64,7 @@ Ctrl+Tab¥¡¼¤ÎÆþÎϤˤè¤Ã¤Æ¤â¹Ô¤¦¤³¤È¤¬¤Ç¤¤Þ¤¹¡¥\ EOL neat = TkVariable.new after_id = nil -msg_b = Ttk::Button.new(f_msg, :text=>'¤¹¤Æ¤¤À¡ª(Neat!)', :underline=>6, +msg_b = Ttk::Button.new(f_msg, :text=>'¤¹¤Æ¤¤À¡ª(Neat!)', :underline=>6, :command=>proc{ neat.value = '¤¢¤¡¡¤¤½¤Î¤È¤ª¤ê¤µ¡¥¡¥¡¥' Tk.after_cancel(after_id) if after_id diff --git a/ext/tk/sample/demos-jp/ttkpane.rb b/ext/tk/sample/demos-jp/ttkpane.rb index 96670c0e5c..a7b458a683 100644 --- a/ext/tk/sample/demos-jp/ttkpane.rb +++ b/ext/tk/sample/demos-jp/ttkpane.rb @@ -7,7 +7,7 @@ # based on "Id: ttkpane.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkpane_demo) && $ttkpane_demo - $ttkpane_demo.destroy + $ttkpane_demo.destroy $ttkpane_demo = nil end @@ -19,7 +19,7 @@ $ttkpane_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkpane_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top, :fill=>:x) ¤³¤Î¥Ç¥â¤Ï¡¤Ëä¤á¹þ¤ß´Ø·¸¤Ë¤¢¤ë¥Æ¡¼¥ÞÉÕ¤¥Ú¥¤¥ó¥É¥¦¥£¥ó¥É¥¦¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡¥\ ¤½¤ì¤¾¤ì¤ÎÂ礤µ¤Ï¡¤´Þ¤Þ¤ì¤Æ¤¤¤ë¥Ú¥¤¥ó¤Î´Ö¤Ë¤¢¤ë¥¨¥ê¥¢¤ò¤Ä¤«¤ó¤Ç\ @@ -32,16 +32,16 @@ Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkpane'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkpane'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkpane_demo.destroy $ttkpane_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -61,26 +61,26 @@ if Tk.windowingsystem == 'aqua' end # Fill the button pane -Ttk::Button.new(left_top, :text=>'²¡¤·¤Æ¤Í', +Ttk::Button.new(left_top, :text=>'²¡¤·¤Æ¤Í', :command=>proc{ - Tk.messageBox(:type=>'ok', :icon=>'info', - :message=>'¤¤¤Æ¤Æ¡ª', - :detail=>'That hurt...', :parent=>base_frame, + Tk.messageBox(:type=>'ok', :icon=>'info', + :message=>'¤¤¤Æ¤Æ¡ª', + :detail=>'That hurt...', :parent=>base_frame, :title=>'Button Pressed') }).pack(:padx=>2, :pady=>5) zones_list = [ - [':Europe/Berlin'], - [':America/Argentina/Buenos_Aires', ':America/Buenos_Aires'], - [':Africa/Johannesburg'], - [':Europe/London'], - [':America/Los_Angeles'], + [':Europe/Berlin'], + [':America/Argentina/Buenos_Aires', ':America/Buenos_Aires'], + [':Africa/Johannesburg'], + [':Europe/London'], + [':America/Los_Angeles'], [':Europe/Moscow'], - [':America/New_York'], - [':Asia/Singapore'], - [':Australia/Sydney'], - [':Asia/Tokyo'], + [':America/New_York'], + [':Asia/Singapore'], + [':Australia/Sydney'], + [':Asia/Tokyo'], ] zones = [] @@ -158,7 +158,7 @@ time = TkVariable.new_hash case tzinfo when :tcl update_proc = proc{|now, tz, label| - time[label] = Tk.tk_call('clock', 'format', now.tv_sec, + time[label] = Tk.tk_call('clock', 'format', now.tv_sec, '-timezone', tz, '-format', '%T') } when :tzinfo @@ -179,7 +179,7 @@ end zones.each_with_index{|(zone, label), idx| Ttk::Separator.new(left_bot).pack(:fill=>:x) if idx > 0 Ttk::Label.new(left_bot, :text=>label, :anchor=>'w').pack(:fill=>:x) - Ttk::Label.new(left_bot, :textvariable=>time.ref(label), + Ttk::Label.new(left_bot, :textvariable=>time.ref(label), :anchor=>'w').pack(:fill=>:x) } diff --git a/ext/tk/sample/demos-jp/ttkprogress.rb b/ext/tk/sample/demos-jp/ttkprogress.rb index 43a9cbcd7e..82898bf50e 100644 --- a/ext/tk/sample/demos-jp/ttkprogress.rb +++ b/ext/tk/sample/demos-jp/ttkprogress.rb @@ -7,7 +7,7 @@ # based on "Id: ttkprogress.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkprogress_demo) && $ttkprogress_demo - $ttkprogress_demo.destroy + $ttkprogress_demo.destroy $ttkprogress_demo = nil end @@ -19,7 +19,7 @@ $ttkprogress_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkprogress_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><<EOL).pack(:side=>:top, :fill=>:x) ²¼¤Ë¤¢¤ë¤Î¤ÏÆó¤Ä¤Î¥×¥í¥°¥ì¥¹¥Ð¡¼¤Ç¤¹¡¥\ ¾å¤Î¤â¤Î¤Ï"determinate"¥¿¥¤¥×¤Î¥×¥í¥°¥ì¥¹¥Ð¡¼¤Ç¡¤\ @@ -37,16 +37,16 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkprogress'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkprogress'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkprogress_demo.destroy $ttkprogress_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -57,9 +57,9 @@ frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true) p1 = Ttk::Progressbar.new(frame, :mode=>:determinate) p2 = Ttk::Progressbar.new(frame, :mode=>:indeterminate) -start = Ttk::Button.new(frame, :text=>'Start Progress', +start = Ttk::Button.new(frame, :text=>'Start Progress', :command=>proc{ p1.start; p2.start }) -stop = Ttk::Button.new(frame, :text=>'Stop Progress', +stop = Ttk::Button.new(frame, :text=>'Stop Progress', :command=>proc{ p1.stop; p2.stop }) Tk.grid(p1, '-', :pady=>5, :padx=>10) diff --git a/ext/tk/sample/demos-jp/twind.rb b/ext/tk/sample/demos-jp/twind.rb index faefaefd6e..bd0b060754 100644 --- a/ext/tk/sample/demos-jp/twind.rb +++ b/ext/tk/sample/demos-jp/twind.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($twind_demo) && $twind_demo - $twind_demo.destroy + $twind_demo.destroy $twind_demo = nil end @@ -39,10 +39,10 @@ $twind_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame À¸À® $twind_text = nil -TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, +TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, 'relief'=>'sunken') {|f| - $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font, - 'width'=>'70', 'height'=>35, 'wrap'=>'word', + $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font, + 'width'=>'70', 'height'=>35, 'wrap'=>'word', 'highlightthickness'=>0, 'borderwidth'=>0 ){|t| TkScrollbar.new(f) {|s| command proc{|*args| t.yview(*args)} @@ -52,11 +52,11 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, }.pack('expand'=>'yes', 'fill'=>'both') # ¥¿¥°À¸À® -$tag_center = TkTextTag.new($twind_text, +$tag_center = TkTextTag.new($twind_text, 'justify' =>'center', 'spacing1'=>'5m', 'spacing3'=>'5m' ) -$tag_buttons = TkTextTag.new($twind_text, +$tag_buttons = TkTextTag.new($twind_text, 'lmargin1'=>'1c', 'lmargin2'=>'1c', 'rmargin' =>'1c', @@ -65,14 +65,14 @@ $tag_buttons = TkTextTag.new($twind_text, 'spacing3'=>0 ) # ¥Æ¥¥¹¥È¤ÎÀ¸À® -$twind_text.insert('end', +$twind_text.insert('end', '¥Æ¥¥¹¥Èwidget¾å¤Ë¾¤Îwidget¤òÁȤ߹þ¤à¤³¤È¤¬¤Ç¤¤Þ¤¹¡£') $twind_text.insert('end', 'ÁȤ߹þ¤ß¥¦¥£¥ó¥É¥¦¤È¸Æ¤Ð¤ì¡¢Ç¤°Õ¤Îwidget¤¬²Äǽ¤Ç¤¹¡£') $twind_text.insert('end', 'Î㤨¤Ð¡¢¤³¤³¤Ë2¤Ä¤Î¥Ü¥¿¥ówidget¤¬ÁȤ߹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£') $twind_text.insert('end', 'ºÇ½é¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤È¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { #text 'ON' text '¥ª¥ó' @@ -81,7 +81,7 @@ TkTextWindow.new($twind_text, 'end', }) $twind_text.insert('end', "¤Ë¤·¤Þ¤¹¡£¤Þ¤¿2¤Ä¤á¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È\n") $twind_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { #text 'OFF' text '¥ª¥Õ' @@ -91,7 +91,7 @@ TkTextWindow.new($twind_text, 'end', $twind_text.insert('end', '¤Ë¤·¤Þ¤¹¡£') $twind_text.insert('end', '¤â¤¦¤Ò¤È¤Ä¤ÎÎã¤Ç¤¹¡£') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text '¤³¤³¤ò¥¯¥ê¥Ã¥¯' command proc{textWindPlot $twind_text} @@ -101,7 +101,7 @@ $twind_text.insert('end', '¤¹¤ë¤È¡¢x-y¥×¥í¥Ã¥È¤¬¤³¤³¤Ë¸½¤ì¤Þ¤¹¡£') $mark_plot = TkTextMark.new($twind_text, 'insert') $mark_plot.gravity='left' $twind_text.insert('end', '¥Þ¥¦¥¹¤Ç¥Ç¡¼¥¿¤òÉÁ²è¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text '¾Ãµî' command proc{textWindDel $twind_text} @@ -125,7 +125,7 @@ $twind_text.insert('end', '¤â¤¦°ìÅÙƱ¤¸¥Ü¥¿¥ó¤ò²¡¤¹¤È¸µ¤ËÌá¤ê¤Þ¤¹¡£ ') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) {|b| text '¥Ç¥Õ¥©¥ë¥È' command proc{embDefBg $twind_text} @@ -134,7 +134,7 @@ TkTextWindow.new($twind_text, 'end', }, 'padx'=>3 ) embToggle = TkVariable.new('Short') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkCheckButton.new($twind_text) { textvariable embToggle indicatoron 0 @@ -145,21 +145,21 @@ TkTextWindow.new($twind_text, 'end', pady 5 padx 2 }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) -[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', - 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', - 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', - 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' +[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', + 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', + 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', + 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' ].each{|twind_color| - TkTextWindow.new($twind_text, 'end', + TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text twind_color cursor 'top_left_arrow' command proc{$twind_text.bg twind_color} }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) } @@ -217,39 +217,39 @@ def textWindPlot (t) TkcLine.new($twind_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind_plot, 100, 250, 100, 50, 'width'=>2) - TkcText.new($twind_plot, 225, 20, + TkcText.new($twind_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind_plot, x, 250, x, 245, 'width'=>2) - TkcText.new($twind_plot, x, 254, + TkcText.new($twind_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind_plot, 100, y, 105, y, 'width'=>2) - TkcText.new($twind_plot, 96, y, + TkcText.new($twind_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, + item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end - $twind_plot.itembind('point', 'Any-Enter', + $twind_plot.itembind('point', 'Any-Enter', proc{$twind_plot.itemconfigure 'current', 'fill', 'red'}) - $twind_plot.itembind('point', 'Any-Leave', + $twind_plot.itembind('point', 'Any-Leave', proc{$twind_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) - $twind_plot.itembind('point', '1', + $twind_plot.itembind('point', '1', proc{|x,y| embPlotDown $twind_plot,x,y}, "%x %y") - $twind_plot.itembind('point', 'ButtonRelease-1', + $twind_plot.itembind('point', 'ButtonRelease-1', proc{$twind_plot.dtag 'selected'}) - $twind_plot.bind('B1-Motion', + $twind_plot.bind('B1-Motion', proc{|x,y| embPlotMove $twind_plot,x,y}, "%x %y") while ($twind_text.get($mark_plot) =~ /[ \t\n]/) $twind_text.delete $mark_plot diff --git a/ext/tk/sample/demos-jp/twind2.rb b/ext/tk/sample/demos-jp/twind2.rb index 2a26b28ef6..96000b0e14 100644 --- a/ext/tk/sample/demos-jp/twind2.rb +++ b/ext/tk/sample/demos-jp/twind2.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($twind2_demo) && $twind2_demo - $twind2_demo.destroy + $twind2_demo.destroy $twind2_demo = nil end @@ -20,20 +20,20 @@ base_frame = TkFrame.new($twind2_demo).pack(:fill=>:both, :expand=>true) # frame À¸À® $twind2_buttons = TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'twind2'}), - TkButton.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'twind2'}), + TkButton.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $twind2_demo $twind2_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) } @@ -41,11 +41,11 @@ $twind2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame À¸À® $twind2_text = nil -TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, +TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, 'relief'=>'sunken') {|f| $twind2_text = TkText.new(f, 'setgrid'=>true, 'font'=>$font, - # 'width'=>'70', 'height'=>35, 'wrap'=>'word', - 'width'=>'70', 'height'=>35, 'wrap'=>'char', + # 'width'=>'70', 'height'=>35, 'wrap'=>'word', + 'width'=>'70', 'height'=>35, 'wrap'=>'char', 'highlightthickness'=>0, 'borderwidth'=>0 ){|t| TkScrollbar.new(f) {|s| command proc{|*args| t.yview(*args)} @@ -55,11 +55,11 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, }.pack('expand'=>'yes', 'fill'=>'both') # ¥¿¥°À¸À® -$tag2_center = TkTextTag.new($twind2_text, +$tag2_center = TkTextTag.new($twind2_text, 'justify' =>'center', 'spacing1'=>'5m', 'spacing3'=>'5m' ) -$tag2_buttons = TkTextTag.new($twind2_text, +$tag2_buttons = TkTextTag.new($twind2_text, 'lmargin1'=>'1c', 'lmargin2'=>'1c', 'rmargin' =>'1c', @@ -86,7 +86,7 @@ $twind2_text.insert('end', 'Î㤨¤Ð¡¤¤³¤³¤Ë¤Ï£²¤Ä¤Î') $twind2_text.insert('end', '¥Ü¥¿¥ó¥¦¥£¥¸¥§¥Ã¥È¤¬Ëä¤á¹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£') $twind2_text.insert('end', 'ºÇ½é¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢') $twind2_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò ') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { #text 'ON' text '¥ª¥ó' @@ -95,7 +95,7 @@ TkTextWindow.new($twind2_text, 'end', }) $twind2_text.insert('end', "¤Ë¤·¤Þ¤¹¡£¤Þ¤¿¡¢£²¤Ä¤á¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È\n") $twind2_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { #text 'OFF' text '¥ª¥Õ' @@ -105,7 +105,7 @@ TkTextWindow.new($twind2_text, 'end', $twind2_text.insert('end', "¤Ë¤·¤Þ¤¹¡£\n\n") $twind2_text.insert('end', '¼¡¤Ï¤â¤¦¤Ò¤È¤Ä¤ÎÎã¤Ç¤¹¡£') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text '¤³¤³¤ò¥¯¥ê¥Ã¥¯' command proc{textWindPlot2 $twind2_text} @@ -116,7 +116,7 @@ $mark2_plot = TkTextMark.new($twind2_text, 'insert') $mark2_plot.gravity='left' $twind2_text.insert('end', '¥Þ¥¦¥¹¤Ç¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ç¡¢') $twind2_text.insert('end', '¥×¥í¥Ã¥È¾å¤Î¥Ç¡¼¥¿ÅÀ¤ò°ÜÆ°¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text '¾Ãµî' command proc{textWindDel2 $twind2_text} @@ -148,7 +148,7 @@ btn_default = TkButton.new($twind2_text) {|b| } TkTextWindow.new($twind2_text, 'end', 'window'=>btn_default, 'padx'=>3) embToggle = TkVariable.new('Short') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkCheckButton.new($twind2_text) { textvariable embToggle indicatoron 0 @@ -159,21 +159,21 @@ TkTextWindow.new($twind2_text, 'end', pady 5 padx 2 }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) -[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', - 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', - 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', - 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' +[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', + 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', + 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', + 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' ].each{|twind_color| - TkTextWindow.new($twind2_text, 'end', + TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text twind_color cursor 'top_left_arrow' command proc{$twind2_text.bg twind_color} }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) } @@ -187,44 +187,44 @@ $text_normal2['pad'] = $twind2_text.cget('padx') $twind2_text.insert('end', "\nborder width ¤ä highlightthickness, ") $twind2_text.insert('end', "padding ¤òÄ̾ï¤ÎÃͤ«¤éÊѹ¹¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£\n") -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big borders", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big borders", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigB2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Small borders", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Small borders", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallB2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big highlight", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big highlight", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigH2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text, :text=>"Small highlight", - :cursor=>'top_left_arrow', + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallH2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big pad", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big pad", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigP2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Small pad", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Small pad", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallP2 $twind2_text })) @@ -232,9 +232,9 @@ TkTextWindow.new($twind2_text, 'end', $twind2_text.insert('end', "\n\n¹¹¤Ë¥¤¥á¡¼¥¸¤â¥Æ¥¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ë") $twind2_text.insert('end', "¤¦¤Þ¤¯ÇÛÃ֤Ǥ¤Þ¤¹¡§") -TkTextImage.new($twind2_text, 'end', +TkTextImage.new($twind2_text, 'end', 'image'=>TkBitmapImage.new(:file=>[ - $demo_dir, '..', + $demo_dir, '..', 'images', 'face.xbm' ].join(File::Separator))) @@ -309,39 +309,39 @@ def textWindPlot2 (t) TkcLine.new($twind2_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind2_plot, 100, 250, 100, 50, 'width'=>2) - TkcText.new($twind2_plot, 225, 20, + TkcText.new($twind2_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind2_plot, x, 250, x, 245, 'width'=>2) - TkcText.new($twind2_plot, x, 254, + TkcText.new($twind2_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind2_plot, 100, y, 105, y, 'width'=>2) - TkcText.new($twind2_plot, 96, y, + TkcText.new($twind2_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, + item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end - $twind2_plot.itembind('point', 'Any-Enter', + $twind2_plot.itembind('point', 'Any-Enter', proc{$twind2_plot.itemconfigure 'current', 'fill', 'red'}) - $twind2_plot.itembind('point', 'Any-Leave', + $twind2_plot.itembind('point', 'Any-Leave', proc{$twind2_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) - $twind2_plot.itembind('point', '1', + $twind2_plot.itembind('point', '1', proc{|x,y| embPlotDown2 $twind2_plot,x,y}, "%x %y") - $twind2_plot.itembind('point', 'ButtonRelease-1', + $twind2_plot.itembind('point', 'ButtonRelease-1', proc{$twind2_plot.dtag 'selected'}) - $twind2_plot.bind('B1-Motion', + $twind2_plot.bind('B1-Motion', proc{|x,y| embPlotMove2 $twind2_plot,x,y}, "%x %y") while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/) $twind2_text.delete $mark2_plot diff --git a/ext/tk/sample/demos-jp/unicodeout.rb b/ext/tk/sample/demos-jp/unicodeout.rb index 178077ec08..4857cd131d 100644 --- a/ext/tk/sample/demos-jp/unicodeout.rb +++ b/ext/tk/sample/demos-jp/unicodeout.rb @@ -8,7 +8,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($unicodeout_demo) && $unicodeout_demo - $unicodeout_demo.destroy + $unicodeout_demo.destroy $unicodeout_demo = nil end @@ -20,8 +20,8 @@ $unicodeout_demo = TkToplevel.new {|w| base_frame = TkFrame.new($unicodeout_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5.4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5.4i', :justify=>:left, :text=><<EOL).pack(:side=>:top) ¤³¤ì¤Ï¡¤Tk¤Ë¤ª¤±¤ëÈó²¤ÊÆʸ»ú½¸¹ç¤òÍѤ¤¤ë¸À¸ì¤ËÂФ¹¤ë¥µ¥Ý¡¼¥È¤Ë¤Ä¤¤¤Æ¤Î\ ¥µ¥ó¥×¥ë¤Ç¤¹¡¥¤¿¤À¤·¡¤²¼¤Îɽ¼¨¤Ë¤ª¤¤¤Æ¤¢¤Ê¤¿¤¬¼ÂºÝ¤Ë¤É¤Î¤è¤¦¤Êɽ¼¨¤ò\ @@ -55,9 +55,9 @@ TkFrame.new(base_frame){|f| }).pack(:side=>:left, :expand=>true) } -wait_msg = TkLabel.new(base_frame, - :text=>"¥Õ¥©¥ó¥ÈÆɤ߹þ¤ß¤Î´°Î»¤Þ¤Ç" + - "¤·¤Ð¤é¤¯¤ªÂÔ¤Á²¼¤µ¤¤¡¥¡¥¡¥", +wait_msg = TkLabel.new(base_frame, + :text=>"¥Õ¥©¥ó¥ÈÆɤ߹þ¤ß¤Î´°Î»¤Þ¤Ç" + + "¤·¤Ð¤é¤¯¤ªÂÔ¤Á²¼¤µ¤¤¡¥¡¥¡¥", :font=>"Helvetica 12 italic").pack class Unicodeout_SampleFrame < TkFrame @@ -77,10 +77,10 @@ class Unicodeout_SampleFrame < TkFrame def add_sample(lang, *args) sample_txt = Tk::UTF8_String(args.join('')) - l = TkLabel.new(self, :font=>@@font, :text=>lang+':', + l = TkLabel.new(self, :font=>@@font, :text=>lang+':', :anchor=>:nw, :pady=>0) - #s = TkLabel.new(self, :font=>@@font, :text=>sample_txt, - s = TkLabel.new(self, :font=>TkFont.new(@@font), :text=>sample_txt, + #s = TkLabel.new(self, :font=>@@font, :text=>sample_txt, + s = TkLabel.new(self, :font=>TkFont.new(@@font), :text=>sample_txt, :anchor=>:nw, :width=>30, :pady=>0) Tk.grid(l, s, :sticky=>:ew, :pady=>0) l.grid_config(:padx, '1m') @@ -96,23 +96,23 @@ oldCursor = $unicodeout_demo.cursor $unicodeout_demo.cursor('watch') Tk.update -f.add_sample('Arabic', - '\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94', +f.add_sample('Arabic', + '\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94', '\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D') f.add_sample('Trad. Chinese', '\u4E2D\u570B\u7684\u6F22\u5B57') f.add_sample('Simpl. Chinese', '\u6C49\u8BED') -f.add_sample('Greek', - '\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE ', +f.add_sample('Greek', + '\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE ', '\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1') -f.add_sample('Hebrew', - '\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 ', +f.add_sample('Hebrew', + '\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 ', '\u05DC\u05D9\u05D0\u05E8\u05E9\u05D9') -f.add_sample('Japanese', - '\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, ', +f.add_sample('Japanese', + '\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, ', '\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA') f.add_sample('Korean', '\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00') -f.add_sample('Russian', - '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 ', +f.add_sample('Russian', + '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 ', '\u044F\u0437\u044B\u043A') wait_msg.destroy diff --git a/ext/tk/sample/editable_listbox.rb b/ext/tk/sample/editable_listbox.rb index 99345da380..553d400e24 100644 --- a/ext/tk/sample/editable_listbox.rb +++ b/ext/tk/sample/editable_listbox.rb @@ -3,7 +3,7 @@ # # When "DoubleClick-1" on a listbox item, the entry box is opend on the # item. And when hit "Return" key on the entry box after modifying the -# text, the entry box is closed and the item is changed. Or when hit +# text, the entry box is closed and the item is changed. Or when hit # "Escape" key, the entry box is closed without modification. # # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) @@ -14,8 +14,8 @@ class Editable_TkListbox < TkListbox def _ebox_placer(coord_y) idx = self.nearest(coord_y) x, y, w, h = self.bbox(idx) - @ebox.place(:x => 0, :relwidth => 1.0, - :y => y - self.selectborderwidth, + @ebox.place(:x => 0, :relwidth => 1.0, + :y => y - self.selectborderwidth, :height => h + 2 * self.selectborderwidth) @ebox.pos = idx @ebox.value = self.listvariable.list[idx] diff --git a/ext/tk/sample/encstr_usage.rb b/ext/tk/sample/encstr_usage.rb index b22c2504ac..39dc9c4018 100644 --- a/ext/tk/sample/encstr_usage.rb +++ b/ext/tk/sample/encstr_usage.rb @@ -13,12 +13,12 @@ t3 = TkText.new(:height=>5).pack src_str = IO.readlines(File.join(File.dirname(__FILE__),'iso2022-kr.txt')).join -t1.insert('end', +t1.insert('end', "use neither Tk::EncodedString class nor Tk.encoding= method\n\n") t1.insert('end', src_str) enc_str = Tk::EncodedString(src_str, 'iso2022-kr') -t2.insert('end', +t2.insert('end', "use Tk::EncodedString class (Tk.encoding => '#{Tk.encoding}')\n\n") t2.insert('end', enc_str) diff --git a/ext/tk/sample/figmemo_sample.rb b/ext/tk/sample/figmemo_sample.rb index 1b6979d2dd..25ec618fe8 100644 --- a/ext/tk/sample/figmemo_sample.rb +++ b/ext/tk/sample/figmemo_sample.rb @@ -55,14 +55,14 @@ class PhotoCanvas < TkScrolledCanvas USAGE = <<EOT --- WHAT IS --- -You can write comments on the loaded image, and save it as a Postscipt -file (original image file is not modified). Each comment is drawn as a -set of an indicator circle, an arrow, and a memo text. See the following +You can write comments on the loaded image, and save it as a Postscipt +file (original image file is not modified). Each comment is drawn as a +set of an indicator circle, an arrow, and a memo text. See the following how to write comments. -This can save the list of memo texts to another file. It may useful to +This can save the list of memo texts to another file. It may useful to search the saved Postscript file by the comments on them. -This may not support multibyte characters (multibyte texts are broken on -a Postscript file). It depends on features of canvas widgets of Tcl/Tk +This may not support multibyte characters (multibyte texts are broken on +a Postscript file). It depends on features of canvas widgets of Tcl/Tk libraries linked your Ruby/Tk. If you use Tcl/Tk8.0-jp (Japanized Tcl/Tk), you can (possibly) get a Japanese Postscript file. @@ -108,8 +108,8 @@ EOT @border = 2 @selectborder = 1 @delta = @border + @selectborder - @entry = TkEntry.new(self, :relief=>:ridge, :borderwidth=>@border, - :selectborderwidth=>@selectborder, + @entry = TkEntry.new(self, :relief=>:ridge, :borderwidth=>@border, + :selectborderwidth=>@selectborder, :highlightthickness=>0) @entry.bind('Return'){@state.value = 0} @@ -131,7 +131,7 @@ EOT x = w.canvasx(x) y = w.canvasy(y) tag = nil - w.find_overlapping(x - @overlap_d, y - @overlap_d, + w.find_overlapping(x - @overlap_d, y - @overlap_d, x + @overlap_d, y + @overlap_d).find{|item| ! (item.tags.find{|name| if name =~ /^(#{@memo_id_head}\d+)$/ @@ -161,8 +161,8 @@ EOT def _state1(x,y) # set center @mode = 1 - @target = TkcOval.new(self, - [canvasx(x), canvasy(y)], [canvasx(x), canvasy(y)], + @target = TkcOval.new(self, + [canvasx(x), canvasy(y)], [canvasx(x), canvasy(y)], :outline=>@col, :width=>3, :tags=>[@memo_id_tag]) @items << @target @mark = [x,y] @@ -175,16 +175,16 @@ EOT @mode = 2 r = Integer(Math.sqrt((x-@mark[0])**2 + (y-@mark[1])**2)) - @target.coords([canvasx(@mark[0] - r), canvasy(@mark[1] - r)], + @target.coords([canvasx(@mark[0] - r), canvasy(@mark[1] - r)], [canvasx(@mark[0] + r), canvasy(@mark[1] + r)]) end def _state3(x,y) # set line start @mode = 3 - @target = TkcLine.new(self, - [canvasx(x), canvasy(y)], [canvasx(x), canvasy(y)], - :arrow=>:first, :arrowshape=>[10, 14, 5], + @target = TkcLine.new(self, + [canvasx(x), canvasy(y)], [canvasx(x), canvasy(y)], + :arrow=>:first, :arrowshape=>[10, 14, 5], :fill=>@col, :tags=>[@memo_id_tag]) @items << @target @mark = [x, y] @@ -196,7 +196,7 @@ EOT def _state4(x,y) # create line @mode = 4 - @target.coords([canvasx(@mark[0]), canvasy(@mark[1])], + @target.coords([canvasx(@mark[0]), canvasy(@mark[1])], [canvasx(x), canvasy(y)]) end @@ -232,8 +232,8 @@ EOT @entry.value = '' @entry.configure(:justify=>justify, :font=>@font, :foreground=>@col) - ewin = TkcWindow.new(self, [canvasx(x)+dx, canvasy(y)+dy], - :window=>@entry, :state=>:normal, :anchor=>anchor, + ewin = TkcWindow.new(self, [canvasx(x)+dx, canvasy(y)+dy], + :window=>@entry, :state=>:normal, :anchor=>anchor, :tags=>[@memo_id_tag]) @entry.focus @@ -243,9 +243,9 @@ EOT ewin.delete - @target = TkcText.new(self, [canvasx(x), canvasy(y)], - :anchor=>anchor, :justify=>justify, - :fill=>@col, :font=>@font, :text=>@entry.value, + @target = TkcText.new(self, [canvasx(x), canvasy(y)], + :anchor=>anchor, :justify=>justify, + :fill=>@col, :font=>@font, :text=>@entry.value, :tags=>[@memo_id_tag]) _state0() @@ -305,9 +305,9 @@ def open_file(canvas, fname) end filetypes = [ - ['GIF Files', '.gif'], - ['GIF Files', [], 'GIFF'], - ['PPM Files', '.ppm'], + ['GIF Files', '.gif'], + ['GIF Files', [], 'GIFF'], + ['PPM Files', '.ppm'], ['PGM Files', '.pgm'] ] @@ -339,7 +339,7 @@ def open_file(canvas, fname) begin canvas.load_photo(fpath) rescue => e - Tk.messageBox(:icon=>'error', :type=>'ok', + Tk.messageBox(:icon=>'error', :type=>'ok', :message=>"Fail to read '#{fpath}'.\n#{e.message}") end @@ -354,11 +354,11 @@ def save_memo(canvas, fname) initname = fname.value if initname != '-' initname = File.basename(initname, File.extname(initname)) - fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'], - ['ALL Files', '*'] ], + fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'], + ['ALL Files', '*'] ], :initialfile=>initname) else - fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'], + fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'], ['ALL Files', '*'] ]) end return if fpath.empty? @@ -366,7 +366,7 @@ def save_memo(canvas, fname) begin fid = open(fpath, 'w') rescue => e - Tk.messageBox(:icon=>'error', :type=>'ok', + Tk.messageBox(:icon=>'error', :type=>'ok', :message=>"Fail to open '#{fname.value}'.\n#{e.message}") end @@ -384,24 +384,24 @@ def ps_print(canvas, fname) initname = fname.value if initname != '-' initname = File.basename(initname, File.extname(initname)) - fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'], - ['ALL Files', '*'] ], + fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'], + ['ALL Files', '*'] ], :initialfile=>initname) else - fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'], + fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'], ['ALL Files', '*'] ]) end return if fpath.empty? bbox = canvas.bbox('all') - canvas.postscript(:file=>fpath, :x=>bbox[0], :y=>bbox[1], + canvas.postscript(:file=>fpath, :x=>bbox[0], :y=>bbox[1], :width=>bbox[2] - bbox[0], :height=>bbox[3] - bbox[1]) end # -------------------------------- def quit(canvas) - ret = Tk.messageBox(:icon=>'warning', :type=>'okcancel', - :default=>'cancel', + ret = Tk.messageBox(:icon=>'warning', :type=>'okcancel', + :default=>'cancel', :message=>'Realy quit? ') exit if ret == 'ok' end @@ -413,11 +413,11 @@ root = TkRoot.new(:title=>'Fig Memo') # create canvas frame canvas = PhotoCanvas.new(root).pack(:fill=>:both, :expand=>true) usage_frame = TkFrame.new(root, :relief=>:ridge, :borderwidth=>2) -hide_btn = TkButton.new(usage_frame, :text=>'hide usage', - :font=>{:size=>8}, :pady=>1, +hide_btn = TkButton.new(usage_frame, :text=>'hide usage', + :font=>{:size=>8}, :pady=>1, :command=>proc{usage_frame.unpack}) hide_btn.pack(:anchor=>'e', :padx=>5) -usage = TkLabel.new(usage_frame, :text=>PhotoCanvas::USAGE, +usage = TkLabel.new(usage_frame, :text=>PhotoCanvas::USAGE, :font=>'Helvetica 8', :justify=>:left).pack show_usage = proc{ @@ -426,20 +426,20 @@ show_usage = proc{ fname = TkVariable.new('-') f = TkFrame.new(root, :relief=>:sunken, :borderwidth=>1).pack(:fill=>:x) -label = TkLabel.new(f, :textvariable=>fname, - :font=>{:size=>-12, :weight=>:bold}, +label = TkLabel.new(f, :textvariable=>fname, + :font=>{:size=>-12, :weight=>:bold}, :anchor=>'w').pack(:side=>:left, :fill=>:x, :padx=>10) # create menu mspec = [ - [ ['File', 0], - ['Show Usage', proc{show_usage.call}, 5], - '---', - ['Open Image File', proc{open_file(canvas, fname)}, 0], - ['Save Memo Texts', proc{save_memo(canvas, fname)}, 0], - '---', - ['Save Postscript', proc{ps_print(canvas, fname)}, 5], - '---', + [ ['File', 0], + ['Show Usage', proc{show_usage.call}, 5], + '---', + ['Open Image File', proc{open_file(canvas, fname)}, 0], + ['Save Memo Texts', proc{save_memo(canvas, fname)}, 0], + '---', + ['Save Postscript', proc{ps_print(canvas, fname)}, 5], + '---', ['Quit', proc{quit(canvas)}, 0] ] ] diff --git a/ext/tk/sample/irbtk.rb b/ext/tk/sample/irbtk.rb index 53ef10d0d1..70dd33e4da 100644 --- a/ext/tk/sample/irbtk.rb +++ b/ext/tk/sample/irbtk.rb @@ -4,8 +4,8 @@ # # If you want to use 'multi-tk.rb', give option '--multi-tk'. # And if you want to use 'remote-tk.rb', give option '--remote-tk'. -# If you want both, you don't need to give both options, because -# 'remote-tk.rb' includes 'multi-tk.rb'. +# If you want both, you don't need to give both options, because +# 'remote-tk.rb' includes 'multi-tk.rb'. # ( There is no trouble even if you give both options. ) # require 'remote-tk' if ARGV.delete('--remote-tk') diff --git a/ext/tk/sample/menubar1.rb b/ext/tk/sample/menubar1.rb index 9fa1201d41..a233c6e088 100644 --- a/ext/tk/sample/menubar1.rb +++ b/ext/tk/sample/menubar1.rb @@ -11,21 +11,21 @@ menu_spec = [ {: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, '', {:foreground=>'black'}], ['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], - ], - 0, '', - {:font=>'Courier 16 italic', + ['cascade', [ + ['sss', proc{p 'sss'}, 0], + ['ttt', proc{p 'ttt'}, 0], + ['uuu', proc{p 'uuu'}, 0], + ['vvv', proc{p 'vvv'}, 0], + ], + 0, '', + {:font=>'Courier 16 italic', :menu_config=>{:font=>'Times -18 bold', :foreground=>'black'}}], '---', ['Quit', proc{exit}, 0]], @@ -33,7 +33,7 @@ menu_spec = [ [['Edit', 0], ['Cut', proc{puts('Cut clicked')}, 2], ['Copy', proc{puts('Copy clicked')}, 0], - ['Paste', proc{puts('Paste clicked')}, 0]], + ['Paste', proc{puts('Paste clicked')}, 0]], [['Help', 0, {:menu_name=>'help'}], ['About This', proc{puts('Ruby/Tk menubar sample 1')}, 6]] diff --git a/ext/tk/sample/menubar2.rb b/ext/tk/sample/menubar2.rb index 4507d8b2fe..e3cd68eaef 100644 --- a/ext/tk/sample/menubar2.rb +++ b/ext/tk/sample/menubar2.rb @@ -11,21 +11,21 @@ menu_spec = [ {: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, '', {:foreground=>'black'}], ['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], - ], - 0, '', - {:font=>'Courier 16 italic', + ['cascade', [ + ['sss', proc{p 'sss'}, 0], + ['ttt', proc{p 'ttt'}, 0], + ['uuu', proc{p 'uuu'}, 0], + ['vvv', proc{p 'vvv'}, 0], + ], + 0, '', + {:font=>'Courier 16 italic', :menu_config=>{:font=>'Times -18 bold', :foreground=>'black'}}], '---', ['Quit', proc{exit}, 0]], @@ -33,16 +33,16 @@ menu_spec = [ [['Edit', 0], ['Cut', proc{puts('Cut clicked')}, 2], ['Copy', proc{puts('Copy clicked')}, 0], - ['Paste', proc{puts('Paste clicked')}, 0]], + ['Paste', proc{puts('Paste clicked')}, 0]], [['Help', 0, {:menu_name=>'help'}], ['About This', proc{puts('Ruby/Tk menubar sample 2')}, 6]] ] -mbar = Tk.root.add_menubar(menu_spec, +mbar = Tk.root.add_menubar(menu_spec, # followings are default configure options 'tearoff'=>'false', - 'foreground'=>'grey40', + 'foreground'=>'grey40', 'activeforeground'=>'red', 'font'=>'Helvetia 12 bold') # This (default configure options) is NOT same the following. diff --git a/ext/tk/sample/multi-ip_sample.rb b/ext/tk/sample/multi-ip_sample.rb index 8d6e1bc626..8150e69c73 100644 --- a/ext/tk/sample/multi-ip_sample.rb +++ b/ext/tk/sample/multi-ip_sample.rb @@ -85,14 +85,14 @@ TkTimer.new(2000, -1, proc{p ['safe1', safe_slave1.deleted?]}).start TkTimer.new(2000, -1, proc{p ['safe2', safe_slave2.deleted?]}).start TkTimer.new(2000, -1, proc{p ['trusted', trusted_slave.deleted?]}).start -TkTimer.new(5000, 1, +TkTimer.new(5000, 1, proc{ safe_slave1.eval_proc{Tk.root.destroy} safe_slave1.delete print "*** The safe_slave1 is deleted by the timer.\n" }).start -TkTimer.new(10000, 1, +TkTimer.new(10000, 1, proc{ trusted_slave.eval_proc{Tk.root.destroy} trusted_slave.delete diff --git a/ext/tk/sample/multi-ip_sample2.rb b/ext/tk/sample/multi-ip_sample2.rb index f4a45d8d9a..79c78dec4a 100644 --- a/ext/tk/sample/multi-ip_sample2.rb +++ b/ext/tk/sample/multi-ip_sample2.rb @@ -14,7 +14,7 @@ cmd = proc{|s| sleep s TkButton.new(:text=>'b2: p $SAFE', :command=>proc{p $SAFE}).pack(:fill=>:x) sleep s - TkButton.new(:text=>'b3: p MultiTkIp.ip_name', + TkButton.new(:text=>'b3: p MultiTkIp.ip_name', :command=>proc{p MultiTkIp.ip_name}).pack(:fill=>:x) sleep s TkButton.new(:text=>'EXIT', :command=>proc{exit}).pack(:fill=>:x) diff --git a/ext/tk/sample/optobj_sample.rb b/ext/tk/sample/optobj_sample.rb index cafacbdd17..a781254a28 100644 --- a/ext/tk/sample/optobj_sample.rb +++ b/ext/tk/sample/optobj_sample.rb @@ -12,13 +12,13 @@ b1 = TkButton.new(f, :text=>'AAA').pack(:fill=>:x) b2 = TkButton.new(f, :text=>'BBB').pack(:fill=>:x) b3 = TkButton.new(f, :text=>'CCC').pack(:fill=>:x) -optobj.assign( b1, - [ b2, 'configure', - { 'foreground'=>'background', - 'background'=>'foreground' } ], - [ b3, nil, - { 'foreground'=>'background', - 'activeforeground'=>nil, +optobj.assign( b1, + [ b2, 'configure', + { 'foreground'=>'background', + 'background'=>'foreground' } ], + [ b3, nil, + { 'foreground'=>'background', + 'activeforeground'=>nil, 'background'=>['foreground', 'activeforeground'] } ] ) optobj.update('activeforeground'=>'yellow') @@ -29,26 +29,26 @@ TkButton.new(f){ } TkButton.new(f){ - configure( optobj.assign([self, nil, - {'foreground'=>'activeforeground', - 'background'=>'foreground', + configure( optobj.assign([self, nil, + {'foreground'=>'activeforeground', + 'background'=>'foreground', 'activeforeground'=>'background'}]) \ + {:text=>'EEE', :relief=>:groove, :borderwidth=>5} ) pack(:fill=>:x) } -optobj.notify # To apply the convert_key ( 3rd element of widget info - # (that is, {'foreground'=>'activeforeground', ,,, } ) - # of the 'EEE' button +optobj.notify # To apply the convert_key ( 3rd element of widget info + # (that is, {'foreground'=>'activeforeground', ,,, } ) + # of the 'EEE' button -TkButton.new(f, :text=>'toggle', +TkButton.new(f, :text=>'toggle', :command=>proc{ fg = optobj['foreground'] bg = optobj['background'] optobj.configure('foreground'=>bg, 'background'=>fg) }).pack(:fill=>:x, :pady=>10) -TkButton.new(f, :text=>'exit', +TkButton.new(f, :text=>'exit', :command=>proc{exit}).pack(:fill=>:x, :pady=>10) TkFrame.new{|f| diff --git a/ext/tk/sample/propagate.rb b/ext/tk/sample/propagate.rb index 800cef553d..66f14aeb72 100644 --- a/ext/tk/sample/propagate.rb +++ b/ext/tk/sample/propagate.rb @@ -3,7 +3,7 @@ require 'tk' TkLabel.new(:text=>"Please click the bottom frame").pack -f = TkFrame.new(:width=>400, :height=>100, :background=>'yellow', +f = TkFrame.new(:width=>400, :height=>100, :background=>'yellow', :relief=>'ridge', :borderwidth=>5).pack # TkPack.propagate(f, false) # <== important!! diff --git a/ext/tk/sample/remote-ip_sample.rb b/ext/tk/sample/remote-ip_sample.rb index 3696a20852..f6eed9e985 100644 --- a/ext/tk/sample/remote-ip_sample.rb +++ b/ext/tk/sample/remote-ip_sample.rb @@ -3,8 +3,8 @@ require 'remote-tk' puts <<EOM This sample controls the other Tk interpreter (Ruby/Tk, Tcl/Tk, and so on) -which running on the other process. For this purpose, Ruby/Tk uses Tcl/Tk's -'send' command. Availability of the command depends on your GUI environment. +which running on the other process. For this purpose, Ruby/Tk uses Tcl/Tk's +'send' command. Availability of the command depends on your GUI environment. If this script doesn't work, please check your environment (see Tcl/Tk FAQ). EOM #' @@ -19,15 +19,15 @@ ip = RemoteTkIp.new(wish) ip.eval_proc{TkButton.new(:command=>proc{puts 'This procesure is on the controller-ip (Ruby/Tk)'}, :text=>'print on Ruby/Tk (controller-ip)').pack(:fill=>:x)} ip.eval_proc{TkButton.new(:command=>'puts {This procesure is on the remote-ip (wish)}', :text=>'print on wish (remote-ip)').pack(:fill=>:x)} -# If your remote-ip is Ruby/Tk, you can control the remote Ruby by -# 'ruby' or 'ruby_eval' or 'ruby_cmd' on the Tk interpreter. +# If your remote-ip is Ruby/Tk, you can control the remote Ruby by +# 'ruby' or 'ruby_eval' or 'ruby_cmd' on the Tk interpreter. if ip.is_rubytk? ip.eval_proc{TkButton.new(:command=>'ruby {p 111; p Array.new(3,"ruby")}', :text=>'ruby cmd on the remote-ip').pack(:fill=>:x)} end ip.eval_proc{TkButton.new(:command=>'exit', :text=>'QUIT').pack(:fill=>:x)} -TkButton.new(:command=>proc{exit}, :text=>'QUIT', +TkButton.new(:command=>proc{exit}, :text=>'QUIT', :padx=>10, :pady=>7).pack(:padx=>10, :pady=>7) Tk.mainloop diff --git a/ext/tk/sample/remote-ip_sample2.rb b/ext/tk/sample/remote-ip_sample2.rb index e12b2a96c9..d8cf3c7650 100644 --- a/ext/tk/sample/remote-ip_sample2.rb +++ b/ext/tk/sample/remote-ip_sample2.rb @@ -17,23 +17,23 @@ ip = RemoteTkIp.new(app) # setup remote-ip window btns = [] ip.eval_proc{ - btns << + btns << TkButton.new(:command=>proc{ puts 'This procesure is on the controller-ip (Ruby-side)' - }, + }, :text=>'print on controller-ip (Ruby-side)').pack(:fill=>:x) - btns << + btns << TkButton.new(:command=> 'puts {This procesure is on the remote-ip (Tk-side)}', :text=>'print on remote-ip (Tk-side)').pack(:fill=>:x) - btns << + btns << TkButton.new(:command=> 'ruby { puts "This procedure is on the remote-ip (Ruby-side)" p Array.new(3,"ruby") - }', + }', :text=>'ruby cmd on the remote-ip').pack(:fill=>:x) TkButton.new(:command=>'exit', :text=>'QUIT').pack(:fill=>:x) @@ -41,15 +41,15 @@ ip.eval_proc{ # setup controller-ip window btns.each_with_index{|btn, idx| - # The scope of the eval-block of 'eval_proc' method is different from - # the enternal. 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 enternal. If you want to pass local values to the eval-block, # use arguments of eval_proc method. They are passed to block-arguments. - TkButton.new(:command=>proc{ip.eval_proc(btn){|b| b.flash}}, - :text=>"flash button-#{idx}", + TkButton.new(:command=>proc{ip.eval_proc(btn){|b| b.flash}}, + :text=>"flash button-#{idx}", :padx=>10).pack(:padx=>10, :pady=>2) } -TkButton.new(:command=>proc{exit}, :text=>'QUIT', +TkButton.new(:command=>proc{exit}, :text=>'QUIT', :padx=>10, :pady=>7).pack(:padx=>10, :pady=>7) # start eventloop diff --git a/ext/tk/sample/safe-tk.rb b/ext/tk/sample/safe-tk.rb index e2289697e0..e2408480d1 100644 --- a/ext/tk/sample/safe-tk.rb +++ b/ext/tk/sample/safe-tk.rb @@ -7,7 +7,7 @@ require "multi-tk" TkLabel.new(:text=>'This is the Default Master Ipnterpreter').pack(:padx=>5, :pady=>3) TkButton.new(:text=>'QUIT', :command=>proc{exit}).pack(:pady=>3) -TkFrame.new(:borderwidth=>2, :height=>3, +TkFrame.new(:borderwidth=>2, :height=>3, :relief=>:sunken).pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>7) @@ -19,17 +19,17 @@ ip = MultiTkIp.new_safe_slave(1) puts "\n---- create procs ----------" puts 'x = proc{p [\'proc x\', "$SAFE==#{$SAFE}"]; exit}' x = proc{p ['proc x', "$SAFE==#{$SAFE}"]; exit} -TkLabel.new(:text=>'x = proc{p [\'proc x\', "$SAFE==#{$SAFE}"]; exit}', +TkLabel.new(:text=>'x = proc{p [\'proc x\', "$SAFE==#{$SAFE}"]; exit}', :anchor=>:w).pack(:fill=>:x) puts 'y = proc{|label| p [\'proc y\', "$SAFE==#{$SAFE}", label]; label.text($SAFE)}' y = proc{|label| p ['proc y', "$SAFE==#{$SAFE}", label]; label.text($SAFE)} -TkLabel.new(:text=>'y = proc{|label| p [\'proc y\', "$SAFE==#{$SAFE}", label]; label.text($SAFE)}', +TkLabel.new(:text=>'y = proc{|label| p [\'proc y\', "$SAFE==#{$SAFE}", label]; label.text($SAFE)}', :anchor=>:w).pack(:fill=>:x) puts 'z = proc{p [\'proc z\', "$SAFE==#{$SAFE}"]; exit}' z = proc{p ['proc z', "$SAFE==#{$SAFE}"]; exit} -TkLabel.new(:text=>'z = proc{p [\'proc z\', "$SAFE==#{$SAFE}"]; exit}', +TkLabel.new(:text=>'z = proc{p [\'proc z\', "$SAFE==#{$SAFE}"]; exit}', :anchor=>:w).pack(:fill=>:x) puts "\n---- call 1st eval_proc ----------" @@ -42,12 +42,12 @@ p lbl = ip.eval_proc{ # TkLabel.new(f, :text=>" (<-- 'lbl' widget is here)").pack(:side=>:right) l = TkLabel.new(f).pack(:side=>:right) - TkButton.new(:text=>':command=>proc{l.text($SAFE)}', + TkButton.new(:text=>':command=>proc{l.text($SAFE)}', :command=>proc{l.text($SAFE)}).pack(:fill=>:x, :padx=>5) TkButton.new(:text=>':command=>x', :command=>x).pack(:fill=>:x, :padx=>5) - TkButton.new(:text=>':command=>proc{exit}', + TkButton.new(:text=>':command=>proc{exit}', :command=>proc{exit}).pack(:fill=>:x, :padx=>5) - TkFrame.new(:borderwidth=>2, :height=>3, + TkFrame.new(:borderwidth=>2, :height=>3, :relief=>:sunken).pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>7) l # return the label widget @@ -62,19 +62,19 @@ p ip.eval_proc(proc{ f = TkFrame.new.pack TkLabel.new(f, :text=>"$SAFE == ").pack(:side=>:left) l = TkLabel.new(f, :text=>$SAFE).pack(:side=>:right) - TkButton.new(:text=>':command=>proc{l.text($SAFE)}', - :command=>proc{l.text($SAFE)}).pack(:fill=>:x, + TkButton.new(:text=>':command=>proc{l.text($SAFE)}', + :command=>proc{l.text($SAFE)}).pack(:fill=>:x, :padx=>5) - TkButton.new(:text=>':command=>proc{y.call(l)}', - :command=>proc{y.call(l)}).pack(:fill=>:x, + TkButton.new(:text=>':command=>proc{y.call(l)}', + :command=>proc{y.call(l)}).pack(:fill=>:x, :padx=>5) TkButton.new(:text=>':command=>proc{Thread.new(l, &y).value}', :command=>proc{ Thread.new(l, &y).value }).pack(:fill=>:x, :padx=>5) - TkButton.new(:text=>':command=>proc{z.call}', + TkButton.new(:text=>':command=>proc{z.call}', :command=>proc{z.call}).pack(:fill=>:x, :padx=>5) - TkFrame.new(:borderwidth=>2, :height=>3, + TkFrame.new(:borderwidth=>2, :height=>3, :relief=>:sunken).pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>7) }) @@ -85,15 +85,15 @@ p bind = ip.eval_str(' f = TkFrame.new.pack TkLabel.new(f, :text=>"$SAFE == ").pack(:side=>:left) l = TkLabel.new(f, :text=>$SAFE).pack(:side=>:right) - TkButton.new(:text=>":command=>proc{y.call(l)}", + TkButton.new(:text=>":command=>proc{y.call(l)}", :command=>proc{y.call(l)}).pack(:fill=>:x, :padx=>5) binding ', binding) p ip.eval_str(" - TkButton.new(:text=>':command=>proc{ l.text = $SAFE }', + TkButton.new(:text=>':command=>proc{ l.text = $SAFE }', :command=>proc{ l.text = $SAFE }).pack(:fill=>:x, :padx=>5) - TkFrame.new(:borderwidth=>2, :height=>3, + TkFrame.new(:borderwidth=>2, :height=>3, :relief=>:sunken).pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>7) ", bind) @@ -106,7 +106,7 @@ p ip.eval_proc{ TkLabel.new(:text=>"3rd and 4th eval_proc : $SAFE == #{$SAFE}").pack } p ip.eval_proc{ - TkButton.new(:text=>':command=>proc{ lbl.text = $SAFE }', + TkButton.new(:text=>':command=>proc{ lbl.text = $SAFE }', :command=>proc{ lbl.text = $SAFE }).pack(:fill=>:x, :padx=>5) } diff --git a/ext/tk/sample/scrollframe.rb b/ext/tk/sample/scrollframe.rb index b0ac6d3874..ab7a9ce24b 100644 --- a/ext/tk/sample/scrollframe.rb +++ b/ext/tk/sample/scrollframe.rb @@ -6,7 +6,7 @@ # When it is configured, scrollregion of the container is changed. # # Scrollbars can be toggled by Tk::ScrollFrame#vscroll & hscroll. -# If horizontal or virtical scrollbar is turned off, the horizontal +# If horizontal or virtical scrollbar is turned off, the horizontal # or virtical size of embedded widgets is propagated. # # Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) @@ -27,8 +27,8 @@ class Tk::ScrollFrame < TkFrame @v_scroll = TkScrollbar.new(@frame, 'orient'=>'vertical') # create a canvas widget - @canvas = TkCanvas.new(@frame, - :borderwidth=>0, :selectborderwidth=>0, + @canvas = TkCanvas.new(@frame, + :borderwidth=>0, :selectborderwidth=>0, :highlightthickness=>0) # allignment @@ -215,7 +215,7 @@ if __FILE__ == $0 TkButton.new(f, :text=>'foo button', :command=>proc{puts 'foo'}).pack TkButton.new(f, :text=>'baaar button', :command=>proc{puts 'baaar'}).pack TkButton.new(f, :text=>'baz button', :command=>proc{puts 'baz'}).pack - TkButton.new(f, :text=>'hoge hoge button', + TkButton.new(f, :text=>'hoge hoge button', :command=>proc{puts 'hoge hoge'}).pack(:side=>:bottom) # f.hscroll(false) diff --git a/ext/tk/sample/tcltklib/sample2.rb b/ext/tk/sample/tcltklib/sample2.rb index 110e81ebc4..f187d6ce1d 100644 --- a/ext/tk/sample/tcltklib/sample2.rb +++ b/ext/tk/sample/tcltklib/sample2.rb @@ -23,37 +23,37 @@ $button, $canvas, $checkbutton, $frame, $label, $pack, $update, $wm = "button", "canvas", "checkbutton", "frame", "label", "pack", "update", "wm") class Othello - + EMPTY = 0 BLACK = 1 WHITE = - BLACK - + attr :in_com_turn attr :game_over - + class Board - + include Observable - + DIRECTIONS = [ [-1, -1], [-1, 0], [-1, 1], [ 0, -1], [ 0, 1], [ 1, -1], [ 1, 0], [ 1, 1] ] - + attr_accessor :com_disk - + def initialize(othello) @othello = othello reset end - + def notify_observers(*arg) if @observer_peers != nil super(*arg) end end - + def reset @data = [ [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY], @@ -68,19 +68,19 @@ class Othello changed notify_observers end - + def man_disk return - @com_disk end - + def other_disk(disk) return - disk end - + def get_disk(row, col) return @data[row][col] end - + def reverse_to(row, col, my_disk, dir_y, dir_x) y = row x = col @@ -100,7 +100,7 @@ class Othello x -= dir_x end until y == row && x == col end - + def put_disk(row, col, disk) @data[row][col] = disk changed @@ -109,7 +109,7 @@ class Othello reverse_to(row, col, disk, *dir) end end - + def count_disk(disk) num = 0 @data.each do |rows| @@ -121,7 +121,7 @@ class Othello end return num end - + def count_point_to(row, col, my_disk, dir_y, dir_x) return 0 if @data[row][col] != EMPTY count = 0 @@ -140,7 +140,7 @@ class Othello end return 0 end - + def count_point(row, col, my_disk) count = 0 DIRECTIONS.each do |dir| @@ -148,14 +148,14 @@ class Othello end return count end - + def corner?(row, col) return (row == 0 && col == 0) || (row == 0 && col == 7) || (row == 7 && col == 0) || (row == 7 && col == 7) end - + def search(my_disk) max = 0 max_row = nil @@ -173,30 +173,30 @@ class Othello return max_row, max_col end end #--------------------------> class Board ends here - + class BoardView < TclTkWidget - + BACK_GROUND_COLOR = "DarkGreen" HILIT_BG_COLOR = "green" BORDER_COLOR = "black" BLACK_COLOR = "black" WHITE_COLOR = "white" STOP_COLOR = "red" - + attr :left attr :top attr :right attr :bottom - + class Square - + attr :oval, TRUE attr :row attr :col - + def initialize(view, row, col) @view = view - @id = @view.e("create rectangle", + @id = @view.e("create rectangle", *(view.tk_rect(view.left + col, view.top + row, view.left + col + 1, @@ -219,7 +219,7 @@ class Othello view.click_square(self) })) end - + def blink(color) @view.e("itemconfigure", @id, "-fill #{color}") $update.e() @@ -227,13 +227,13 @@ class Othello @view.e("itemconfigure", @id, "-fill #{BACK_GROUND_COLOR}") end end #-----------------------> class Square ends here - + def initialize(othello, board) super($ip, $root, $canvas) @othello = othello @board = board @board.add_observer(self) - + @squares = Array.new(8) for i in 0 .. 7 @squares[i] = Array.new(8) @@ -242,7 +242,7 @@ class Othello @top = 0.5 @right = @left + 8 @bottom = @top + 8 - + i = self.e("create rectangle", *tk_rect(@left, @top, @right, @bottom)) self.e("itemconfigure", i, "-width 1m -outline #{BORDER_COLOR} -fill #{BACK_GROUND_COLOR}") @@ -252,15 +252,15 @@ class Othello @squares[row][col] = Square.new(self, row, col) end end - + update end - + def tk_rect(left, top, right, bottom) return left.to_s + "c", top.to_s + "c", right.to_s + "c", bottom.to_s + "c" end - + def clear each_square do |square| if square.oval != nil @@ -269,7 +269,7 @@ class Othello end end end - + def draw_disk(row, col, disk) if disk == EMPTY if @squares[row][col].oval != nil @@ -278,7 +278,7 @@ class Othello end return end - + $update.e() sleep(0.05) oval = @squares[row][col].oval @@ -299,7 +299,7 @@ class Othello end self.e("itemconfigure", oval, "-outline #{color} -fill #{color}") end - + def update(row = nil, col = nil) if row && col draw_disk(row, col, @board.get_disk(row, col)) @@ -311,7 +311,7 @@ class Othello end @othello.show_point end - + def each_square @squares.each do |rows| rows.each do |square| @@ -319,7 +319,7 @@ class Othello end end end - + def click_square(square) if @othello.in_com_turn || @othello.game_over || @board.count_point(square.row, @@ -331,15 +331,15 @@ class Othello @board.put_disk(square.row, square.col, @board.man_disk) @othello.com_turn end - + private :draw_disk public :update end #----------------------> class BoardView ends here - + def initialize @msg_label = TclTkWidget.new($ip, $root, $label) $pack.e(@msg_label) - + @board = Board.new(self) @board_view = BoardView.new(self, @board) #### added by Y. Shigehiro @@ -352,39 +352,39 @@ class Othello "}") #### ¤³¤³¤Þ¤Ç $pack.e(@board_view, "-fill both -expand true") - + panel = TclTkWidget.new($ip, $root, $frame) - + @play_black = TclTkWidget.new($ip, panel, $checkbutton, "-text {com is black} -command", TclTkCallback.new($ip, proc{ switch_side })) $pack.e(@play_black, "-side left") - + quit = TclTkWidget.new($ip, panel, $button, "-text Quit -command", TclTkCallback.new($ip, proc{ exit })) $pack.e(quit, "-side right -fill x") - + reset = TclTkWidget.new($ip, panel, $button, "-text Reset -command", TclTkCallback.new($ip, proc{ reset_game })) $pack.e(reset, "-side right -fill x") - + $pack.e(panel, "-side bottom -fill x") - + # root = Tk.root $wm.e("title", $root, "Othello") $wm.e("iconname", $root, "Othello") - + @board.com_disk = WHITE @game_over = FALSE - + TclTk.mainloop end - + def switch_side if @in_com_turn @play_black.e("toggle") @@ -393,7 +393,7 @@ class Othello com_turn unless @game_over end end - + def reset_game if @board.com_disk == BLACK @board.com_disk = WHITE @@ -404,7 +404,7 @@ class Othello $wm.e("title", $root, "Othello") @game_over = FALSE end - + def com_turn @in_com_turn = TRUE $update.e() diff --git a/ext/tk/sample/tkalignbox.rb b/ext/tk/sample/tkalignbox.rb index 32915a5e69..dd82b50360 100644 --- a/ext/tk/sample/tkalignbox.rb +++ b/ext/tk/sample/tkalignbox.rb @@ -1,11 +1,11 @@ # # tkalignbox.rb : align widgets with same width/height -# +# # by Hidetoshi NAGAI # -# The box size depends on 'reqheight' and 'reqwidth' of contained widgets. -# If you want to give the box size when those requested sizes are 0, -# please set box.propagate = false (See the test routine at the tail of +# The box size depends on 'reqheight' and 'reqwidth' of contained widgets. +# If you want to give the box size when those requested sizes are 0, +# please set box.propagate = false (See the test routine at the tail of # this file). require 'tk' @@ -126,10 +126,10 @@ class TkHBox < TkAlignBox private :_set_framesize def _place_config(widget, idx, cnt) - widget.place_in(self, - 'relx'=>idx/cnt, 'x'=>@padx, - 'rely'=>0, 'y'=>@pady, - 'relwidth'=>1.0/cnt, 'width'=>-2*@padx, + widget.place_in(self, + 'relx'=>idx/cnt, 'x'=>@padx, + 'rely'=>0, 'y'=>@pady, + 'relwidth'=>1.0/cnt, 'width'=>-2*@padx, 'relheight'=>1.0, 'height'=>-2*@pady) end private :_place_config @@ -138,10 +138,10 @@ TkHLBox = TkHBox class TkHRBox < TkHBox def _place_config(widget, idx, cnt) - widget.place_in(self, - 'relx'=>(cnt - idx - 1)/cnt, 'x'=>@padx, - 'rely'=>0, 'y'=>@pady, - 'relwidth'=>1.0/cnt, 'width'=>-2*@padx, + widget.place_in(self, + 'relx'=>(cnt - idx - 1)/cnt, 'x'=>@padx, + 'rely'=>0, 'y'=>@pady, + 'relwidth'=>1.0/cnt, 'width'=>-2*@padx, 'relheight'=>1.0, 'height'=>-2*@pady) end private :_place_config @@ -156,10 +156,10 @@ class TkVBox < TkAlignBox private :_set_framesize def _place_config(widget, idx, cnt) - widget.place_in(self, - 'relx'=>0, 'x'=>@padx, - 'rely'=>idx/cnt, 'y'=>@pady, - 'relwidth'=>1.0, 'width'=>-2*@padx, + widget.place_in(self, + 'relx'=>0, 'x'=>@padx, + 'rely'=>idx/cnt, 'y'=>@pady, + 'relwidth'=>1.0, 'width'=>-2*@padx, 'relheight'=>1.0/cnt, 'height'=>-2*@pady) end private :_place_config @@ -168,10 +168,10 @@ TkVTBox = TkVBox class TkVBBox < TkVBox def _place_config(widget, idx, cnt) - widget.place_in(self, - 'relx'=>0, 'x'=>@padx, - 'rely'=>(cnt - idx - 1)/cnt, 'y'=>@pady, - 'relwidth'=>1.0, 'width'=>-2*@padx, + widget.place_in(self, + 'relx'=>0, 'x'=>@padx, + 'rely'=>(cnt - idx - 1)/cnt, 'y'=>@pady, + 'relwidth'=>1.0, 'width'=>-2*@padx, 'relheight'=>1.0/cnt, 'height'=>-2*@pady) end private :_place_config @@ -187,7 +187,7 @@ if __FILE__ == $0 TkButton.new(f, :text=>'aaa'), TkButton.new(f, :text=>'aaaa')) - f = TkHBox.new(:borderwidth=>3, :relief=>'ridge', + f = TkHBox.new(:borderwidth=>3, :relief=>'ridge', :padx=>7, :pady=>3, :background=>'yellow').pack f.add(TkButton.new(f, :text=>'a'), TkButton.new(f, :text=>'aa', :font=>'Helvetica 16'), @@ -202,22 +202,22 @@ if __FILE__ == $0 f = TkHRBox.new(:borderwidth=>3, :relief=>'raised').pack(:fill=>:x) f.add(TkButton.new(f, :text=>'a'), - TkButton.new(f, :text=>'aa'), + TkButton.new(f, :text=>'aa'), TkButton.new(f, :text=>'aaa')) f = TkVBBox.new(:borderwidth=>3, :relief=>'ridge').pack(:fill=>:x) f.propagate = false f.height 100 - f.add(TkFrame.new(f){|ff| - TkButton.new(ff, :text=>'a').pack(:pady=>4, :padx=>6, + f.add(TkFrame.new(f){|ff| + TkButton.new(ff, :text=>'a').pack(:pady=>4, :padx=>6, :fill=>:both, :expand=>true) - }, - TkFrame.new(f){|ff| - TkButton.new(ff, :text=>'aa').pack(:pady=>4, :padx=>6, + }, + TkFrame.new(f){|ff| + TkButton.new(ff, :text=>'aa').pack(:pady=>4, :padx=>6, :fill=>:both, :expand=>true) - }, - TkFrame.new(f){|ff| - TkButton.new(ff, :text=>'aaaa').pack(:pady=>4, :padx=>6, + }, + TkFrame.new(f){|ff| + TkButton.new(ff, :text=>'aaaa').pack(:pady=>4, :padx=>6, :fill=>:both, :expand=>true) }) diff --git a/ext/tk/sample/tkballoonhelp.rb b/ext/tk/sample/tkballoonhelp.rb index c2c95f771d..fc99753b81 100644 --- a/ext/tk/sample/tkballoonhelp.rb +++ b/ext/tk/sample/tkballoonhelp.rb @@ -2,12 +2,12 @@ # tkballoonhelp.rb : simple balloon help widget # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -# Add a balloon help to a widget. -# This widget has only poor featureas. If you need more useful features, +# Add a balloon help to a widget. +# This widget has only poor featureas. If you need more useful features, # please try to use the Tix extension of Tcl/Tk under Ruby/Tk. -# +# # The interval time to display a balloon help is defined 'interval' option -# (default is 1000ms). +# (default is 1000ms). # require 'tk' @@ -87,10 +87,10 @@ class TkBalloonHelp<TkLabel when 2 @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent)) when 3 - @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent), + @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent), self) else - @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent), + @command.call(x - TkWinfo.rootx(@parent), y - TkWinfo.rooty(@parent), self, @parent) end end @@ -99,11 +99,11 @@ class TkBalloonHelp<TkLabel @frame.raise @org_cursor = @parent['cursor'] - @parent.cursor('crosshair') + @parent.cursor('crosshair') end def erase - @parent.cursor(@org_cursor) + @parent.cursor(@org_cursor) @frame.withdraw end @@ -122,8 +122,8 @@ if __FILE__ == $0 } TkButton.new('text'=>'This button has another balloon help') {|b| pack('fill'=>'x') - TkBalloonHelp.new(b, 'text'=>'configured message', - 'interval'=>200, 'font'=>'courier', + TkBalloonHelp.new(b, 'text'=>'configured message', + 'interval'=>200, 'font'=>'courier', 'background'=>'gray', 'foreground'=>'red') } @@ -131,8 +131,8 @@ if __FILE__ == $0 sb.insert(:end, *%w(aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm)) =begin # CASE1 : command takes no arguemnt - bh = TkBalloonHelp.new(sb, :interval=>500, - :relief=>:ridge, :background=>'white', + bh = TkBalloonHelp.new(sb, :interval=>500, + :relief=>:ridge, :background=>'white', :command=>proc{ y = TkWinfo.pointery(sb) - TkWinfo.rooty(sb) bh.text "current index == #{sb.nearest(y)}" @@ -140,16 +140,16 @@ if __FILE__ == $0 =end =begin # CASE2 : command takes 2 arguemnts - bh = TkBalloonHelp.new(sb, :interval=>500, - :relief=>:ridge, :background=>'white', + bh = TkBalloonHelp.new(sb, :interval=>500, + :relief=>:ridge, :background=>'white', :command=>proc{|x, y| bh.text "current index == #{sb.nearest(y)}" }) =end =begin # CASE3 : command takes 3 arguemnts - TkBalloonHelp.new(sb, :interval=>500, - :relief=>:ridge, :background=>'white', + TkBalloonHelp.new(sb, :interval=>500, + :relief=>:ridge, :background=>'white', :command=>proc{|x, y, bhelp| bhelp.text "current index == #{sb.nearest(y)}" }) @@ -160,14 +160,14 @@ if __FILE__ == $0 bhelp.text "current index == #{parent.nearest(y)}" } - TkBalloonHelp.new(sb, :interval=>500, - :relief=>:ridge, :background=>'white', + TkBalloonHelp.new(sb, :interval=>500, + :relief=>:ridge, :background=>'white', :command=>cmd) sb2 = TkScrollbox.new.pack(:fill=>:x) sb2.insert(:end, *%w(AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM)) - TkBalloonHelp.new(sb2, :interval=>500, - :padx=>5, :relief=>:raised, + TkBalloonHelp.new(sb2, :interval=>500, + :padx=>5, :relief=>:raised, :background=>'gray25', :foreground=>'white', :command=>cmd) =end @@ -178,14 +178,14 @@ if __FILE__ == $0 end cmd = self.method(:set_msg) - TkBalloonHelp.new(sb, :interval=>500, - :relief=>:ridge, :background=>'white', + TkBalloonHelp.new(sb, :interval=>500, + :relief=>:ridge, :background=>'white', :command=>cmd) sb2 = TkScrollbox.new.pack(:fill=>:x) sb2.insert(:end, *%w(AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM)) - TkBalloonHelp.new(sb2, :interval=>500, - :padx=>5, :relief=>:raised, + TkBalloonHelp.new(sb2, :interval=>500, + :padx=>5, :relief=>:raised, :background=>'gray25', :foreground=>'white', :command=>cmd) #=end diff --git a/ext/tk/sample/tkbiff.rb b/ext/tk/sample/tkbiff.rb index c6699629cc..c0953a1b1b 100644 --- a/ext/tk/sample/tkbiff.rb +++ b/ext/tk/sample/tkbiff.rb @@ -11,10 +11,10 @@ end if ARGV.length == 0 if ENV['MAIL'] $spool = ENV['MAIL'] - else + else $spool = '/var/spool/mail/' + ENV['USER'] end -else +else $spool = ARGV[0] end @@ -40,7 +40,7 @@ class Mail @body = [] while line = f.gets() line.chop! - next if /^From / =~ line # skip From-line + next if /^From / =~ line # skip From-line break if /^$/ =~ line # end of header if /^(\S+):\s*(.*)/ =~ line @header[attr = $1.capitalize] = $2 diff --git a/ext/tk/sample/tkbrowse.rb b/ext/tk/sample/tkbrowse.rb index 4893f57f95..56d5a80fcf 100644 --- a/ext/tk/sample/tkbrowse.rb +++ b/ext/tk/sample/tkbrowse.rb @@ -69,7 +69,7 @@ end # Fill the listbox with a list of all the files in the directory (run # the "ls" command to get that information). -if ARGV.length>0 +if ARGV.length>0 dir = ARGV[0] else dir="." diff --git a/ext/tk/sample/tkcombobox.rb b/ext/tk/sample/tkcombobox.rb index 1840270951..e4d9592e7b 100644 --- a/ext/tk/sample/tkcombobox.rb +++ b/ext/tk/sample/tkcombobox.rb @@ -1,6 +1,6 @@ # # tkcombobox.rb : TkAutoScrollbox & TkCombobox -# +# # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # require 'tk' @@ -44,9 +44,9 @@ EOD @lbox.yscrollcommand(proc{|*args| @scr.set(*args); _config_proc}) @scr.command(proc{|*args| @lbox.yview(*args); _config_proc}) - @up_arrow = TkLabel.new(@lbox, :image=>@@up_bmp, + @up_arrow = TkLabel.new(@lbox, :image=>@@up_bmp, :relief=>:raised, :borderwidth=>1) - @down_arrow = TkLabel.new(@lbox, :image=>@@down_bmp, + @down_arrow = TkLabel.new(@lbox, :image=>@@down_bmp, :relief=>:raised, :borderwidth=>1) _init_binding @@ -78,7 +78,7 @@ EOD def _show_down_arrow unless @down_arrow.winfo_mapped? - @down_arrow.pack(:side=>:bottom, :fill=>:x) + @down_arrow.pack(:side=>:bottom, :fill=>:x) end end @@ -91,11 +91,11 @@ EOD def _check_sel(cidx, tidx = nil, bidx = nil) _set_sel(cidx) unless tidx - tidx = @lbox.nearest(0) + tidx = @lbox.nearest(0) tidx += 1 if tidx > 0 end unless bidx - bidx = @lbox.nearest(10000) + bidx = @lbox.nearest(10000) bidx -= 1 if bidx < @lbox.index('end') - 1 end if cidx > bidx @@ -197,7 +197,7 @@ EOD @lbox.bind('Configure', proc{_config_proc}) @lbox.bind('Enter', proc{|y| _set_sel(@lbox.nearest(y))}, '%y') - @lbox.bind('Motion', proc{|y| + @lbox.bind('Motion', proc{|y| @up_timer.stop if @up_timer.running? @down_timer.stop if @down_timer.running? _check_sel(@lbox.nearest(y)) @@ -298,8 +298,8 @@ EOD def initialize_composite(keys={}) keys = _symbolkey2str(keys) - @btn = TkLabel.new(@frame, :relief=>:raised, :borderwidth=>3, - :image=>@@down_btn_bmp).pack(:side=>:right, + @btn = TkLabel.new(@frame, :relief=>:raised, :borderwidth=>3, + :image=>@@down_btn_bmp).pack(:side=>:right, :ipadx=>2, :fill=>:y) @ent = TkEntry.new(@frame).pack(:side=>:left) @path = @ent.path @@ -312,9 +312,9 @@ EOD startwait = keys.delete('startwait'){300} interval = keys.delete('interval'){150} - @lst = TkAutoScrollbox.new(@top, - :startwait=>startwait, - :interval=>interval).pack(:fill=>:both, + @lst = TkAutoScrollbox.new(@top, + :startwait=>startwait, + :interval=>interval).pack(:fill=>:both, :expand=>true) @ent_list = [] @@ -396,8 +396,8 @@ end ################################################ if __FILE__ == $0 v = TkVariable.new - e = TkCombobox.new(:height=>7, :scrollbar=>true, :textvariable=>v, - :arrowrelief=>:flat, :arrowborderwidth=>0, + e = TkCombobox.new(:height=>7, :scrollbar=>true, :textvariable=>v, + :arrowrelief=>:flat, :arrowborderwidth=>0, :startwait=>400, :interval=>200).pack e.values(%w(aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu)) #e.see(e.list_index('end') - 2) @@ -408,17 +408,17 @@ if __FILE__ == $0 TkLabel.new(f, :font=>fnt, :textvariable=>v).pack(:side=>:left) }.pack - TkFrame.new(:relief=>:raised, :borderwidth=>2, + TkFrame.new(:relief=>:raised, :borderwidth=>2, :height=>3).pack(:fill=>:x, :expand=>true, :padx=>5, :pady=>3) - l = TkAutoScrollbox.new(nil, :relief=>:groove, :borderwidth=>4, + l = TkAutoScrollbox.new(nil, :relief=>:groove, :borderwidth=>4, :width=>20).pack(:fill=>:both, :expand=>true) (0..20).each{|i| l.insert('end', "line #{i}")} TkFrame.new(:relief=>:ridge, :borderwidth=>3){ - TkButton.new(self, :text=>'ON', + TkButton.new(self, :text=>'ON', :command=>proc{l.scrollbar(true)}).pack(:side=>:left) - TkButton.new(self, :text=>'OFF', + TkButton.new(self, :text=>'OFF', :command=>proc{l.scrollbar(false)}).pack(:side=>:right) pack(:fill=>:x) } diff --git a/ext/tk/sample/tkdialog.rb b/ext/tk/sample/tkdialog.rb index 00cc12ab11..eb8cd04796 100644 --- a/ext/tk/sample/tkdialog.rb +++ b/ext/tk/sample/tkdialog.rb @@ -8,7 +8,7 @@ top = TkFrame.new(root) { } msg = TkMessage.new(top) { text "File main.c hasn't been saved to disk since \ -it was last modified. What should I do?" +it was last modified. What should I do?" justify 'center' aspect 200 font '-Adobe-helvetica-medium-r-normal--*-240*' diff --git a/ext/tk/sample/tkextlib/ICONS/viewIcons.rb b/ext/tk/sample/tkextlib/ICONS/viewIcons.rb index fc88eb5c85..02ba19a629 100644 --- a/ext/tk/sample/tkextlib/ICONS/viewIcons.rb +++ b/ext/tk/sample/tkextlib/ICONS/viewIcons.rb @@ -4,7 +4,7 @@ # # -- Display icons from icon library. # -# -- Copy the clicked icon data (command string of creating +# -- Copy the clicked icon data (command string of creating # a TkPhotoImage instance) to the clipboard. # require 'tk' @@ -27,7 +27,7 @@ class ViewIcons ent_library = TkEntry.new(base, :width=>50, :textvariable=>@library) ent_groups = TkEntry.new(base, :width=>50, :textvariable=>@groups) - btn_browse = TkButton.new(base, :text=>'Browse', + btn_browse = TkButton.new(base, :text=>'Browse', :command=>method(:select_icons)) btn_view = TkButton.new(base, :text=>'View', :command=>method(:display_icons)) @@ -35,8 +35,8 @@ class ViewIcons @column_btns = {} 6.step(20, 2){|i| - @column_btns[i] = TkButton.new(columns, - :text=>i.to_s, :width=>2, + @column_btns[i] = TkButton.new(columns, + :text=>i.to_s, :width=>2, :command=>proc{set_columns(i)} ).pack(:side=>:left) } @@ -90,15 +90,15 @@ class ViewIcons end def _create_info_window - @info_window = TkToplevel.new(:background=>'lightyellow', :borderwidth=>1, + @info_window = TkToplevel.new(:background=>'lightyellow', :borderwidth=>1, :relief=>:solid){|w| - lbl_name = TkLabel.new(w, :text=>'Name', :background=>'lightyellow', + lbl_name = TkLabel.new(w, :text=>'Name', :background=>'lightyellow', :font=>@boldfont, :justify=>:left) - lbl_grps = TkLabel.new(w, :text=>'Groups', :background=>'lightyellow', + lbl_grps = TkLabel.new(w, :text=>'Groups', :background=>'lightyellow', :font=>@boldfont, :justify=>:left) - lbl_type = TkLabel.new(w, :text=>'Type', :background=>'lightyellow', + lbl_type = TkLabel.new(w, :text=>'Type', :background=>'lightyellow', :font=>@boldfont, :justify=>:left) - lbl_size = TkLabel.new(w, :text=>'Size', :background=>'lightyellow', + lbl_size = TkLabel.new(w, :text=>'Size', :background=>'lightyellow', :font=>@boldfont, :justify=>:left) lbl_name.grid(:row=>0, :column=>0, :sticky=>:w) @@ -192,7 +192,7 @@ class ViewIcons def cancel_info if @delay_timer - @delay_timer.cancel + @delay_timer.cancel @delay_timer = nil end @info_window.withdraw @@ -242,9 +242,9 @@ class ViewIcons TkClipboard.append(@command) if Tk::PLATFORM['platform'] == 'unix' - TkSelection.handle(Tk.root, method(:primary_transfer), + TkSelection.handle(Tk.root, method(:primary_transfer), :selection=>'PRIMARY') - TkSelection.set_owner(Tk.root, :selection=>'PRIMARY', + TkSelection.set_owner(Tk.root, :selection=>'PRIMARY', :command=>method(:lost_selection)) end @@ -256,17 +256,17 @@ class ViewIcons bbox = @icons_window.bbox('all') width = @controls.winfo_width - @icons_window.yscrollbar.winfo_width - 8 - @icons_window.configure(:width=>width, :scrollregion=>bbox, - :xscrollincrement=>'0.1i', + @icons_window.configure(:width=>width, :scrollregion=>bbox, + :xscrollincrement=>'0.1i', :yscrollincrement=>'0.1i') end def select_icons - new_lib = Tk.getOpenFile(:initialdir=>@initial_dir, - :initialfile=>'tkIcons', - :title=>'Select Icon Library', + new_lib = Tk.getOpenFile(:initialdir=>@initial_dir, + :initialfile=>'tkIcons', + :title=>'Select Icon Library', :filetypes=>[ - ['Icon Libraries', ['tkIcons*']], + ['Icon Libraries', ['tkIcons*']], ['All Files', ['*']] ]) @@ -280,7 +280,7 @@ class ViewIcons row = 0 unless File.exist?(@library.value) - Tk.messageBox(:icon=>'warning', :message=>'File does not exist', + Tk.messageBox(:icon=>'warning', :message=>'File does not exist', :title=>'viewIcons') return end diff --git a/ext/tk/sample/tkextlib/blt/barchart5.rb b/ext/tk/sample/tkextlib/blt/barchart5.rb index db181d10ca..86101b200d 100644 --- a/ext/tk/sample/tkextlib/blt/barchart5.rb +++ b/ext/tk/sample/tkextlib/blt/barchart5.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/blt' -load File.join(File.dirname(File.expand_path(__FILE__)), +load File.join(File.dirname(File.expand_path(__FILE__)), 'scripts', 'stipples.rb') TkOption.add('*graph.x.Title', 'X Axis Label') @@ -23,27 +23,27 @@ if visual != 'staticgray' && visual != 'grayscale' end htext = Tk::BLT::Htext.new(:widgetname=>'.htext', :text=><<EOD) - This is an example of the barchart widget. The barchart has - many components; x and y axis, legend, crosshairs, elements, etc. + This is an example of the barchart widget. The barchart has + many components; x and y axis, legend, crosshairs, elements, etc. To create a postscript file "bar.ps", press the %% ruby { - b = TkButton.new(Tk::BLT::Htext::Htext_Widget.window, - :widgetname=>'print', :text=>'Print', + b = TkButton.new(Tk::BLT::Htext::Htext_Widget.window, + :widgetname=>'print', :text=>'Print', :command=>proc{ $graph.postsript(:output=>'bar.ps') }) Tk::BLT::Htext::Htext_Widget.window.append(b) } -%% button. +%% button. %% ruby { - $graph = Tk::BLT::Barchart.new(:widgetname=>'.htext.graph', + $graph = Tk::BLT::Barchart.new(:widgetname=>'.htext.graph', :relief=>:raised, :borderwidth=>2) $graph.xaxis_configure(:rotate=>90, :stepsize=>0) - Tk::BLT::Htext::Htext_Widget.window.append($graph, + Tk::BLT::Htext::Htext_Widget.window.append($graph, :fill=>:both, :padx=>4) } @@ -51,8 +51,8 @@ htext = Tk::BLT::Htext.new(:widgetname=>'.htext', :text=><<EOD) Hit the %% ruby { - b = TkButton.new(Tk::BLT::Htext::Htext_Widget.window, - :widgetname=>'quit', :text=>'Quit', + b = TkButton.new(Tk::BLT::Htext::Htext_Widget.window, + :widgetname=>'quit', :text=>'Quit', :command=>proc{ exit }) Tk::BLT::Htext::Htext_Widget.window.append(b) } @@ -86,7 +86,7 @@ x.seq(-5.0, 5.0, 0.2) y.expr("sin(#{x})") barWidth = 0.19 -$graph.element_create('sin', :relief=>:raised, :borderwidth=>1, +$graph.element_create('sin', :relief=>:raised, :borderwidth=>1, :x=>x, :y=>y, :barwidth=>barWidth) Tk::BLT::Table.add(Tk.root, htext, :fill=>:both) diff --git a/ext/tk/sample/tkextlib/blt/calendar.rb b/ext/tk/sample/tkextlib/blt/calendar.rb index 4fc6d64d9e..86d34043dc 100644 --- a/ext/tk/sample/tkextlib/blt/calendar.rb +++ b/ext/tk/sample/tkextlib/blt/calendar.rb @@ -31,17 +31,17 @@ TkOption.add('*tile', texture2) class BLT_Calendar_sample @@monthInfo = [ nil, # dummy - ['January', 31], - ['February', 28], - ['March', 31], - ['April', 30], - ['May', 31], - ['June', 30], - ['July', 31], - ['August', 31], - ['Septembar', 30], - ['October', 31], - ['November', 30], + ['January', 31], + ['February', 28], + ['March', 31], + ['April', 30], + ['May', 31], + ['June', 30], + ['July', 31], + ['August', 31], + ['Septembar', 30], + ['October', 31], + ['November', 30], ['December', 31] ] @@ -53,23 +53,23 @@ class BLT_Calendar_sample if TkComm.bool(Tk.info(:commands, '.calendar')) Tk.destroy('.calendar') end - cal = Tk::BLT::Tile::Frame.new(:widgetname=>'.calendar', - :classname=>'Calendar', + cal = Tk::BLT::Tile::Frame.new(:widgetname=>'.calendar', + :classname=>'Calendar', :width=>'3i', :height=>'3i') - mon = Tk::BLT::Tile::Label.new(cal, :font=>'Courier 14 bold', - :text=>"#{@@monthInfo[today.month][0]} " + + mon = Tk::BLT::Tile::Label.new(cal, :font=>'Courier 14 bold', + :text=>"#{@@monthInfo[today.month][0]} " + "#{today.year}") Tk::BLT::Table.add(cal, mon, [1, 0], :cspan=>7, :pady=>10) - week_f = Tk::BLT::Tile::Frame.new(cal, :widgetname=>'weekframe', + week_f = Tk::BLT::Tile::Frame.new(cal, :widgetname=>'weekframe', :relief=>:sunken, :borderwidth=>1) Tk::BLT::Table.add(cal, week_f, [2, 0], :columnspan=>7, :fill=>:both) @@abbrDays.each_with_index{|dayName, idx| - Tk::BLT::Table.add(cal, - Tk::BLT::Tile::Label.new(cal, :text=>dayName, - :font=>'Helvetica 12'), + Tk::BLT::Table.add(cal, + Tk::BLT::Tile::Label.new(cal, :text=>dayName, + :font=>'Helvetica 12'), [2, idx], :pady=>2, :padx=>2) } @@ -83,11 +83,11 @@ class BLT_Calendar_sample wkday += 7 if wkday < 0 while cnt <= numDays - Tk::BLT::Table.add(cal, + Tk::BLT::Table.add(cal, Tk::BLT::Tile::Label.new(cal, :text=>cnt){ - self.configure(:borderwidth=>1, + self.configure(:borderwidth=>1, :relief=>:sunken) if cnt == today.day - }, + }, [week+3, wkday], :fill=>:both, :ipadx=>10, :ipady=>4) cnt += 1 wkday += 1 @@ -98,11 +98,11 @@ class BLT_Calendar_sample end Tk::BLT::Tile::Frame.new(cal, :borderwidth=>1, :relief=>:sunken){|f| - Tk::BLT::Table.add(f, - Tk::BLT::Tile::Button.new(f, :widgetname=>'button', - :command=>proc{exit}, - :borderwidth=>2, - :text=>'Quit'), + Tk::BLT::Table.add(f, + Tk::BLT::Tile::Button.new(f, :widgetname=>'button', + :command=>proc{exit}, + :borderwidth=>2, + :text=>'Quit'), :padx=>4, :pady=>4) Tk::BLT::Table.add(cal, f, [week+4, 5], :cspan=>2, :pady=>4) } diff --git a/ext/tk/sample/tkextlib/blt/graph6.rb b/ext/tk/sample/tkextlib/blt/graph6.rb index f899b44115..b3eeb81231 100644 --- a/ext/tk/sample/tkextlib/blt/graph6.rb +++ b/ext/tk/sample/tkextlib/blt/graph6.rb @@ -6,55 +6,55 @@ require 'tkextlib/blt' Tk::TCL_PRECISION.value = 15 [ - ['*Graph.Width', '10i'], - ['*Graph.leftMargin', '.75i'], - ['*Graph.Height', '6i'], - ['*Graph.plotBackground', 'black'], - ['*LineMarker.color', 'white'], - ['*LineMarker.Dashes', 5], - ['*TextMarker.foreground', 'white'], - ['*TextMarker.Background', ''], - - ['*Graph.x.hide', true], - ['*Graph.x.title', ''], - ['*Graph.y.rotate', 90], - # ['*Graph.y.stepSize', 2.0], - ['*Graph.title', ''], - ['*graph.Title', 'Example s27'], - ['*graph.x.hide', false], - ['*graph.topMargin', 0], - ['*graph.bottomMargin', 0], - ['*x.Title', 'Time'], - ['*y.Title', 'Signals'], - ['*Pixels', 1], - - ['*Reduce', 0.5], - ['*bufferElements', false], - - ['*Element.color', 'green4'], - ['*Element.ScaleSymbols', true], - ['*Element.Color', 'grey70'], - ['*Element.Symbol', :none], - ['*Element.LineWidth', 1], - # ['*Element.Smooth', :natural], - ['*Element.Smooth', :catrom], - - ['*activeLine.LineWidth', 2], - ['*activeLine.Color', 'white'], - ['*activeLine.Color', 'green1'], - - # ['*Legend.Hide', true], - ['*Legend.Position', :right], - ['*Legend.Relief', :flat], - ['*Legend.activeRelief', :sunken], - ['*Legend.borderWidth', 2], - #['*Legend.Font', '-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*'], - ['*Legend.Font', 'Helvetica -10'], - ['*Grid.hide', false], - ['*Grid.dashes', [1, 5]], - - # ['*foreground', 'white'], - ['*zoomOutline.outline', 'yellow'], + ['*Graph.Width', '10i'], + ['*Graph.leftMargin', '.75i'], + ['*Graph.Height', '6i'], + ['*Graph.plotBackground', 'black'], + ['*LineMarker.color', 'white'], + ['*LineMarker.Dashes', 5], + ['*TextMarker.foreground', 'white'], + ['*TextMarker.Background', ''], + + ['*Graph.x.hide', true], + ['*Graph.x.title', ''], + ['*Graph.y.rotate', 90], + # ['*Graph.y.stepSize', 2.0], + ['*Graph.title', ''], + ['*graph.Title', 'Example s27'], + ['*graph.x.hide', false], + ['*graph.topMargin', 0], + ['*graph.bottomMargin', 0], + ['*x.Title', 'Time'], + ['*y.Title', 'Signals'], + ['*Pixels', 1], + + ['*Reduce', 0.5], + ['*bufferElements', false], + + ['*Element.color', 'green4'], + ['*Element.ScaleSymbols', true], + ['*Element.Color', 'grey70'], + ['*Element.Symbol', :none], + ['*Element.LineWidth', 1], + # ['*Element.Smooth', :natural], + ['*Element.Smooth', :catrom], + + ['*activeLine.LineWidth', 2], + ['*activeLine.Color', 'white'], + ['*activeLine.Color', 'green1'], + + # ['*Legend.Hide', true], + ['*Legend.Position', :right], + ['*Legend.Relief', :flat], + ['*Legend.activeRelief', :sunken], + ['*Legend.borderWidth', 2], + #['*Legend.Font', '-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*'], + ['*Legend.Font', 'Helvetica -10'], + ['*Grid.hide', false], + ['*Grid.dashes', [1, 5]], + + # ['*foreground', 'white'], + ['*zoomOutline.outline', 'yellow'], ].each{|k, v| TkOption.add(k, v)} ############################## @@ -71,7 +71,7 @@ class BLT_Graph_Demo @top = Tk::BLT::Tile::Toplevel.new =begin - legend = Tk::BLT::Graph.new(@top, :widgetname=>'legend', + legend = Tk::BLT::Graph.new(@top, :widgetname=>'legend', :without_creating=>true) @graph.legend_configure(:position=>legend) =end @@ -81,7 +81,7 @@ class BLT_Graph_Demo Tk::BLT::Table.add(@root, @graph, [0,0], :fill=>:both) - @quit_btn = Tk::BLT::Tile::Button.new(:text=>' quit ', :background=>'red', + @quit_btn = Tk::BLT::Tile::Button.new(:text=>' quit ', :background=>'red', :command=>proc{exit}) Tk::BLT::Table.add(@root, @quit_btn, [1,0], :anchor=>:e, :padx=>10) @@ -90,9 +90,9 @@ class BLT_Graph_Demo @graph.closest_point @graph.print_key - @graph.legend_bind(:all, 'ButtonRelease-1', + @graph.legend_bind(:all, 'ButtonRelease-1', proc{|w| highlightTrace(w)}, '%W') - @graph.legend_bind(:all, 'ButtonRelease-3', + @graph.legend_bind(:all, 'ButtonRelease-3', proc{|w| w.legend_deactivate('*') active = w.element_activate @@ -108,2098 +108,2098 @@ class BLT_Graph_Demo (1..39).each{|i| @v[i] = Tk::BLT::Vector.new(:variable=>'')} @x.set(<<-'EOD') - 0 1e-10 2e-10 3e-10 4e-10 5e-10 6e-10 7e-10 8e-10 9e-10 - 1e-09 1.1e-09 1.2e-09 1.3e-09 1.4e-09 1.5e-09 1.6e-09 1.7e-09 - 1.8e-09 1.9e-09 2e-09 2.1e-09 2.2e-09 2.3e-09 2.4e-09 2.5e-09 - 2.6e-09 2.7e-09 2.8e-09 2.9e-09 3e-09 3.1e-09 3.2e-09 3.3e-09 - 3.4e-09 3.5e-09 3.6e-09 3.7e-09 3.8e-09 3.9e-09 4e-09 4.1e-09 - 4.2e-09 4.3e-09 4.4e-09 4.5e-09 4.6e-09 4.7e-09 4.8e-09 - 4.9e-09 5e-09 5.1e-09 5.2e-09 5.3e-09 5.4e-09 5.5e-09 5.6e-09 - 5.7e-09 5.8e-09 5.9e-09 6e-09 6.1e-09 6.2e-09 6.3e-09 6.4e-09 - 6.5e-09 6.6e-09 6.7e-09 6.8e-09 6.9e-09 7e-09 7.1e-09 7.2e-09 - 7.3e-09 7.4e-09 7.5e-09 7.6e-09 7.7e-09 7.8e-09 7.9e-09 - 8e-09 8.1e-09 8.2e-09 8.3e-09 8.4e-09 8.5e-09 8.6e-09 8.7e-09 - 8.8e-09 8.9e-09 9e-09 9.1e-09 9.2e-09 9.3e-09 9.4e-09 9.5e-09 - 9.6e-09 9.7e-09 9.8e-09 9.9e-09 1e-08 1.01e-08 1.02e-08 - 1.03e-08 1.04e-08 1.05e-08 1.06e-08 1.07e-08 1.08e-08 1.09e-08 - 1.1e-08 1.11e-08 1.12e-08 1.13e-08 1.14e-08 1.15e-08 1.16e-08 - 1.17e-08 1.18e-08 1.19e-08 1.2e-08 1.21e-08 1.22e-08 1.23e-08 - 1.24e-08 1.25e-08 1.26e-08 1.27e-08 1.28e-08 1.29e-08 1.3e-08 - 1.31e-08 1.32e-08 1.33e-08 1.34e-08 1.35e-08 1.36e-08 1.37e-08 - 1.38e-08 1.39e-08 1.4e-08 1.41e-08 1.42e-08 1.43e-08 1.44e-08 - 1.45e-08 1.46e-08 1.47e-08 1.48e-08 1.49e-08 1.5e-08 1.51e-08 - 1.52e-08 1.53e-08 1.54e-08 1.55e-08 1.56e-08 1.57e-08 1.58e-08 - 1.59e-08 1.6e-08 1.61e-08 1.62e-08 1.63e-08 1.64e-08 1.65e-08 - 1.66e-08 1.67e-08 1.68e-08 1.69e-08 1.7e-08 1.71e-08 1.72e-08 - 1.73e-08 1.74e-08 1.75e-08 1.76e-08 1.77e-08 1.78e-08 1.79e-08 - 1.8e-08 1.81e-08 1.82e-08 1.83e-08 1.84e-08 1.85e-08 1.86e-08 - 1.87e-08 1.88e-08 1.89e-08 1.9e-08 1.91e-08 1.92e-08 1.93e-08 - 1.94e-08 1.95e-08 1.96e-08 1.97e-08 1.98e-08 1.99e-08 2e-08 - 2.01e-08 2.02e-08 2.03e-08 2.04e-08 2.05e-08 2.06e-08 2.07e-08 - 2.08e-08 2.09e-08 2.1e-08 2.11e-08 2.12e-08 2.13e-08 2.14e-08 - 2.15e-08 2.16e-08 2.17e-08 2.18e-08 2.19e-08 2.2e-08 2.21e-08 - 2.22e-08 2.23e-08 2.24e-08 2.25e-08 2.26e-08 2.27e-08 2.28e-08 - 2.29e-08 2.3e-08 2.31e-08 2.32e-08 2.33e-08 2.34e-08 2.35e-08 - 2.36e-08 2.37e-08 2.38e-08 2.39e-08 2.4e-08 2.41e-08 2.42e-08 - 2.43e-08 2.44e-08 2.45e-08 2.46e-08 2.47e-08 2.48e-08 2.49e-08 - 2.5e-08 2.51e-08 2.52e-08 2.53e-08 2.54e-08 2.55e-08 2.56e-08 - 2.57e-08 2.58e-08 2.59e-08 2.6e-08 2.61e-08 2.62e-08 2.63e-08 - 2.64e-08 2.65e-08 2.66e-08 2.67e-08 2.68e-08 2.69e-08 2.7e-08 - 2.71e-08 2.72e-08 2.73e-08 2.74e-08 2.75e-08 2.76e-08 2.77e-08 - 2.78e-08 2.79e-08 2.8e-08 2.81e-08 2.82e-08 2.83e-08 2.84e-08 - 2.85e-08 2.86e-08 2.87e-08 2.88e-08 2.89e-08 2.9e-08 2.91e-08 - 2.92e-08 2.93e-08 2.94e-08 2.95e-08 2.96e-08 2.97e-08 2.98e-08 - 2.99e-08 3e-08 3.01e-08 3.02e-08 3.03e-08 3.04e-08 3.05e-08 - 3.06e-08 3.07e-08 3.08e-08 3.09e-08 3.1e-08 3.11e-08 3.12e-08 - 3.13e-08 3.14e-08 3.15e-08 3.16e-08 3.17e-08 3.18e-08 3.19e-08 - 3.2e-08 3.21e-08 3.22e-08 3.23e-08 3.24e-08 3.25e-08 3.26e-08 - 3.27e-08 3.28e-08 3.29e-08 3.3e-08 3.31e-08 3.32e-08 3.33e-08 - 3.34e-08 3.35e-08 3.36e-08 3.37e-08 3.38e-08 3.39e-08 3.4e-08 - 3.41e-08 3.42e-08 3.43e-08 3.44e-08 3.45e-08 3.46e-08 3.47e-08 - 3.48e-08 3.49e-08 3.5e-08 3.51e-08 3.52e-08 3.53e-08 3.54e-08 - 3.55e-08 3.56e-08 3.57e-08 3.58e-08 3.59e-08 3.6e-08 + 0 1e-10 2e-10 3e-10 4e-10 5e-10 6e-10 7e-10 8e-10 9e-10 + 1e-09 1.1e-09 1.2e-09 1.3e-09 1.4e-09 1.5e-09 1.6e-09 1.7e-09 + 1.8e-09 1.9e-09 2e-09 2.1e-09 2.2e-09 2.3e-09 2.4e-09 2.5e-09 + 2.6e-09 2.7e-09 2.8e-09 2.9e-09 3e-09 3.1e-09 3.2e-09 3.3e-09 + 3.4e-09 3.5e-09 3.6e-09 3.7e-09 3.8e-09 3.9e-09 4e-09 4.1e-09 + 4.2e-09 4.3e-09 4.4e-09 4.5e-09 4.6e-09 4.7e-09 4.8e-09 + 4.9e-09 5e-09 5.1e-09 5.2e-09 5.3e-09 5.4e-09 5.5e-09 5.6e-09 + 5.7e-09 5.8e-09 5.9e-09 6e-09 6.1e-09 6.2e-09 6.3e-09 6.4e-09 + 6.5e-09 6.6e-09 6.7e-09 6.8e-09 6.9e-09 7e-09 7.1e-09 7.2e-09 + 7.3e-09 7.4e-09 7.5e-09 7.6e-09 7.7e-09 7.8e-09 7.9e-09 + 8e-09 8.1e-09 8.2e-09 8.3e-09 8.4e-09 8.5e-09 8.6e-09 8.7e-09 + 8.8e-09 8.9e-09 9e-09 9.1e-09 9.2e-09 9.3e-09 9.4e-09 9.5e-09 + 9.6e-09 9.7e-09 9.8e-09 9.9e-09 1e-08 1.01e-08 1.02e-08 + 1.03e-08 1.04e-08 1.05e-08 1.06e-08 1.07e-08 1.08e-08 1.09e-08 + 1.1e-08 1.11e-08 1.12e-08 1.13e-08 1.14e-08 1.15e-08 1.16e-08 + 1.17e-08 1.18e-08 1.19e-08 1.2e-08 1.21e-08 1.22e-08 1.23e-08 + 1.24e-08 1.25e-08 1.26e-08 1.27e-08 1.28e-08 1.29e-08 1.3e-08 + 1.31e-08 1.32e-08 1.33e-08 1.34e-08 1.35e-08 1.36e-08 1.37e-08 + 1.38e-08 1.39e-08 1.4e-08 1.41e-08 1.42e-08 1.43e-08 1.44e-08 + 1.45e-08 1.46e-08 1.47e-08 1.48e-08 1.49e-08 1.5e-08 1.51e-08 + 1.52e-08 1.53e-08 1.54e-08 1.55e-08 1.56e-08 1.57e-08 1.58e-08 + 1.59e-08 1.6e-08 1.61e-08 1.62e-08 1.63e-08 1.64e-08 1.65e-08 + 1.66e-08 1.67e-08 1.68e-08 1.69e-08 1.7e-08 1.71e-08 1.72e-08 + 1.73e-08 1.74e-08 1.75e-08 1.76e-08 1.77e-08 1.78e-08 1.79e-08 + 1.8e-08 1.81e-08 1.82e-08 1.83e-08 1.84e-08 1.85e-08 1.86e-08 + 1.87e-08 1.88e-08 1.89e-08 1.9e-08 1.91e-08 1.92e-08 1.93e-08 + 1.94e-08 1.95e-08 1.96e-08 1.97e-08 1.98e-08 1.99e-08 2e-08 + 2.01e-08 2.02e-08 2.03e-08 2.04e-08 2.05e-08 2.06e-08 2.07e-08 + 2.08e-08 2.09e-08 2.1e-08 2.11e-08 2.12e-08 2.13e-08 2.14e-08 + 2.15e-08 2.16e-08 2.17e-08 2.18e-08 2.19e-08 2.2e-08 2.21e-08 + 2.22e-08 2.23e-08 2.24e-08 2.25e-08 2.26e-08 2.27e-08 2.28e-08 + 2.29e-08 2.3e-08 2.31e-08 2.32e-08 2.33e-08 2.34e-08 2.35e-08 + 2.36e-08 2.37e-08 2.38e-08 2.39e-08 2.4e-08 2.41e-08 2.42e-08 + 2.43e-08 2.44e-08 2.45e-08 2.46e-08 2.47e-08 2.48e-08 2.49e-08 + 2.5e-08 2.51e-08 2.52e-08 2.53e-08 2.54e-08 2.55e-08 2.56e-08 + 2.57e-08 2.58e-08 2.59e-08 2.6e-08 2.61e-08 2.62e-08 2.63e-08 + 2.64e-08 2.65e-08 2.66e-08 2.67e-08 2.68e-08 2.69e-08 2.7e-08 + 2.71e-08 2.72e-08 2.73e-08 2.74e-08 2.75e-08 2.76e-08 2.77e-08 + 2.78e-08 2.79e-08 2.8e-08 2.81e-08 2.82e-08 2.83e-08 2.84e-08 + 2.85e-08 2.86e-08 2.87e-08 2.88e-08 2.89e-08 2.9e-08 2.91e-08 + 2.92e-08 2.93e-08 2.94e-08 2.95e-08 2.96e-08 2.97e-08 2.98e-08 + 2.99e-08 3e-08 3.01e-08 3.02e-08 3.03e-08 3.04e-08 3.05e-08 + 3.06e-08 3.07e-08 3.08e-08 3.09e-08 3.1e-08 3.11e-08 3.12e-08 + 3.13e-08 3.14e-08 3.15e-08 3.16e-08 3.17e-08 3.18e-08 3.19e-08 + 3.2e-08 3.21e-08 3.22e-08 3.23e-08 3.24e-08 3.25e-08 3.26e-08 + 3.27e-08 3.28e-08 3.29e-08 3.3e-08 3.31e-08 3.32e-08 3.33e-08 + 3.34e-08 3.35e-08 3.36e-08 3.37e-08 3.38e-08 3.39e-08 3.4e-08 + 3.41e-08 3.42e-08 3.43e-08 3.44e-08 3.45e-08 3.46e-08 3.47e-08 + 3.48e-08 3.49e-08 3.5e-08 3.51e-08 3.52e-08 3.53e-08 3.54e-08 + 3.55e-08 3.56e-08 3.57e-08 3.58e-08 3.59e-08 3.6e-08 EOD @v[1].set(<<-'EOD') - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 EOD @v[2].set(<<-'EOD') - 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 - 5.32907e-15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 - 5 5 5 5 5 5 5 5 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 + 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 + 5.32907e-15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 + 5 5 5 5 5 5 5 5 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 EOD @v[3].set(<<-'EOD') - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 8.88178e-16 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 2.13718e-14 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 8.88178e-16 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 2.13718e-14 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 EOD @v[4].set(<<-'EOD') - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 EOD @v[5].set(<<-'EOD') - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 EOD @v[6].set(<<-'EOD') - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 8.88178e-16 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 2.13718e-14 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 8.88178e-16 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 2.13718e-14 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 EOD @v[7].set(<<-'EOD') - 5 5.16904 4.84159 3.34542 0.317102 0.103304 0.0275721 0.0221534 - 0.017689 0.0142639 0.0113974 0.00918238 0.00742541 0.00616602 - 0.00481195 0.00397049 -0.0659889 -0.025671 0.165495 0.986891 - 3.05229 4.55511 4.91611 4.98192 4.99428 4.99833 4.99095 - 4.97295 4.95493 4.93428 4.90723 4.94799 4.98584 4.99566 - 4.99813 4.99907 4.99947 4.99965 4.99976 4.99984 4.99989 - 4.99992 4.99994 4.99996 4.99998 5.00002 5.00006 5.00002 - 4.99996 4.99994 4.99999 5.00003 5.00002 5 4.99997 4.99997 - 4.99997 4.99997 4.99997 4.99996 4.99997 4.99997 4.99998 - 4.99998 4.99999 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99998 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5.16575 - 4.69986 2.43862 0.0230224 0.035229 -0.0210607 -0.0292766 - -0.0172693 -0.00271479 -0.000912251 -0.000349106 -0.000116866 - -4.24733e-05 -1.39536e-05 -3.01179e-05 -0.0657192 -0.0204835 - 0.183378 1.07181 3.118 4.46472 4.84158 4.94795 4.98173 4.99236 - 4.99762 5.01939 5.0433 5.05332 5.04959 5.03955 5.02851 5.02052 - 5.01422 5.00965 5.00631 5.00405 5.00248 5.00083 5.00012 - 5.00209 5.00387 5.00347 4.99917 4.99213 4.98411 4.97521 - 4.96332 4.94601 4.9304 4.94633 4.97936 4.99264 4.99685 4.99857 - 4.99925 4.99954 4.9997 4.99973 4.9997 4.99973 4.99979 4.99983 - 4.99986 4.99988 4.9999 4.9999 4.99992 4.99993 4.99994 4.99995 - 4.99996 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 - 5.00002 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 5 5 5.14242 4.76101 3.16003 0.299374 - 0.0645506 -0.000498424 -2.45108e-05 -2.27986e-05 -5.24401e-05 - -4.9884e-05 -4.92491e-05 -2.93354e-05 -3.21402e-05 -2.11851e-05 - -3.37925e-05 -0.0657892 -0.020563 0.182582 1.06058 3.12484 - 4.46552 4.84146 4.95102 4.98556 4.99472 4.99806 4.99909 - 4.99955 4.99976 4.99994 4.99992 5.00029 4.99967 4.99849 - 4.99736 4.99884 5.00099 5.00377 5.00215 4.99994 4.99893 - 4.99788 4.99862 5.00055 5.00134 5.00127 5.00073 5.00039 - 5.00018 5.00006 5.00001 4.99985 5.00026 5.00018 5.00003 - 4.99981 4.99985 4.99987 4.99985 4.99982 4.99982 4.99982 - 4.99983 4.99985 4.99987 4.99989 4.99991 4.99992 4.99994 - 4.99995 4.99995 4.99994 4.99994 4.99996 4.99999 5.00002 - 5.00008 5.00009 5.00006 5.00001 5 4.99999 4.99998 4.99997 - 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 4.99999 - 4.99999 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99998 4.99998 - 4.99998 + 5 5.16904 4.84159 3.34542 0.317102 0.103304 0.0275721 0.0221534 + 0.017689 0.0142639 0.0113974 0.00918238 0.00742541 0.00616602 + 0.00481195 0.00397049 -0.0659889 -0.025671 0.165495 0.986891 + 3.05229 4.55511 4.91611 4.98192 4.99428 4.99833 4.99095 + 4.97295 4.95493 4.93428 4.90723 4.94799 4.98584 4.99566 + 4.99813 4.99907 4.99947 4.99965 4.99976 4.99984 4.99989 + 4.99992 4.99994 4.99996 4.99998 5.00002 5.00006 5.00002 + 4.99996 4.99994 4.99999 5.00003 5.00002 5 4.99997 4.99997 + 4.99997 4.99997 4.99997 4.99996 4.99997 4.99997 4.99998 + 4.99998 4.99999 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99998 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5.16575 + 4.69986 2.43862 0.0230224 0.035229 -0.0210607 -0.0292766 + -0.0172693 -0.00271479 -0.000912251 -0.000349106 -0.000116866 + -4.24733e-05 -1.39536e-05 -3.01179e-05 -0.0657192 -0.0204835 + 0.183378 1.07181 3.118 4.46472 4.84158 4.94795 4.98173 4.99236 + 4.99762 5.01939 5.0433 5.05332 5.04959 5.03955 5.02851 5.02052 + 5.01422 5.00965 5.00631 5.00405 5.00248 5.00083 5.00012 + 5.00209 5.00387 5.00347 4.99917 4.99213 4.98411 4.97521 + 4.96332 4.94601 4.9304 4.94633 4.97936 4.99264 4.99685 4.99857 + 4.99925 4.99954 4.9997 4.99973 4.9997 4.99973 4.99979 4.99983 + 4.99986 4.99988 4.9999 4.9999 4.99992 4.99993 4.99994 4.99995 + 4.99996 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 + 5.00002 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 5 5 5.14242 4.76101 3.16003 0.299374 + 0.0645506 -0.000498424 -2.45108e-05 -2.27986e-05 -5.24401e-05 + -4.9884e-05 -4.92491e-05 -2.93354e-05 -3.21402e-05 -2.11851e-05 + -3.37925e-05 -0.0657892 -0.020563 0.182582 1.06058 3.12484 + 4.46552 4.84146 4.95102 4.98556 4.99472 4.99806 4.99909 + 4.99955 4.99976 4.99994 4.99992 5.00029 4.99967 4.99849 + 4.99736 4.99884 5.00099 5.00377 5.00215 4.99994 4.99893 + 4.99788 4.99862 5.00055 5.00134 5.00127 5.00073 5.00039 + 5.00018 5.00006 5.00001 4.99985 5.00026 5.00018 5.00003 + 4.99981 4.99985 4.99987 4.99985 4.99982 4.99982 4.99982 + 4.99983 4.99985 4.99987 4.99989 4.99991 4.99992 4.99994 + 4.99995 4.99995 4.99994 4.99994 4.99996 4.99999 5.00002 + 5.00008 5.00009 5.00006 5.00001 5 4.99999 4.99998 4.99997 + 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 4.99999 + 4.99999 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99998 4.99998 + 4.99998 EOD @v[8].set(<<-'EOD') - 5 5.03758 5.04711 4.96911 4.20882 3.96295 4.01117 4.15521 - 4.2967 4.42274 4.5295 4.6176 4.69014 4.74831 4.7966 4.83537 - 4.80526 4.787 4.79295 4.88588 5.08978 5.15615 5.10778 5.07718 - 5.06652 5.08225 4.9744 4.52977 3.77452 2.69426 1.15294 0.245509 - 0.0981544 0.0567527 0.0367487 0.0252578 0.0180599 0.0133837 - 0.0101497 0.0078616 0.00620186 0.00499056 0.0041027 0.00344223 - 0.00295808 0.00260089 0.00229887 0.00200817 0.00176397 0.00160116 - 0.00147381 0.00134645 0.00125029 0.00116043 0.00107371 0.00101981 - 0.000965921 0.000912028 0.000858135 0.000804242 0.000761669 - 0.00072672 0.000691771 0.000656823 0.000621874 0.000588722 - 0.00057041 0.000552098 0.000533785 0.000515473 0.000497162 - 0.00047885 0.000460537 0.000442226 0.000423914 0.000405601 - 0.000388399 0.000378694 0.000368989 0.000359284 0.00034958 - 0.000339875 0.00033017 0.000320465 0.00031076 0.000301055 - 0.00029135 0.000282207 0.000276247 0.000270287 0.000264327 - 0.000258367 0.000252407 0.000246447 0.000240487 0.000234527 - 0.000228567 0.000222607 0.000217086 0.000213696 0.000210307 - 0.000206918 0.000203528 0.000200139 0.00019675 0.00019336 - 0.000189971 0.000186582 0.000183192 0.000179803 0.000176414 - 0.000173025 0.000169635 0.000166246 0.000162857 0.000159467 - 0.000156078 0.000152689 0.000149299 0.00014591 0.00014255 - 0.0316021 0.163272 0.348732 0.603651 0.35745 0.135965 0.0707354 - 0.0314595 0.0201047 0.00994945 0.00389601 0.00138839 0.00060778 - 0.000329648 0.000492396 -0.0732035 -0.0844077 -0.0789062 - -0.0390837 0.0197559 0.0183094 -0.00180099 -0.0189565 -0.0424144 - -0.0735904 -0.0892423 0.285039 1.13702 2.10809 2.95826 3.60164 - 4.0435 4.35771 4.57254 4.71769 4.81329 4.87534 4.91487 4.94264 - 4.97375 5.01526 5.06517 5.10154 5.06259 4.89005 4.5787 4.12226 - 3.46151 2.49023 1.2586 0.32725 0.116753 0.0701865 0.0455509 - 0.0286914 0.0178176 0.0117599 0.00902715 0.00760583 0.00637745 - 0.00543811 0.00439377 0.00352448 0.0030151 0.00285771 0.002465 - 0.00203114 0.00173004 0.0014839 0.00125177 0.00105327 0.000894905 - 0.000766372 0.000658894 0.000569105 0.000492114 0.000427938 - 0.000370217 0.000314758 0.000266569 0.000233726 0.000209048 - 0.000191957 0.000177169 0.000166604 0.000161 0.000157314 - 0.000143828 0.000130342 0.000116857 0.000103371 8.98855e-05 - 7.63998e-05 6.29141e-05 5.76583e-05 5.30027e-05 4.8347e-05 - 4.36913e-05 3.90357e-05 3.438e-05 2.97243e-05 2.72507e-05 - 2.59083e-05 2.45659e-05 2.32235e-05 2.18811e-05 2.05387e-05 - 1.91963e-05 1.78539e-05 1.65115e-05 1.51691e-05 1.38267e-05 - 1.24843e-05 1.11419e-05 9.79954e-06 8.51574e-06 7.69807e-06 - 6.8804e-06 6.06273e-06 5.24506e-06 0.0287318 0.0317111 -0.0320087 - -0.103609 0.0369639 0.0121128 0.00961197 0.00934971 0.00820853 - 0.00699769 0.00607002 0.00535541 0.00476552 0.00427601 0.00376357 - -0.073012 -0.0866964 -0.0809538 -0.038005 0.0277001 0.0188906 - 0.00614597 0.00373629 0.00489787 0.0146573 0.0191052 0.0151708 - 0.0124224 0.0105859 0.00879272 0.00729464 0.0070047 0.00449575 - -0.00626652 -0.0252417 -0.0147287 0.022538 0.0822905 0.0947372 - 0.0657516 0.0445506 0.0316753 0.0220971 0.0158101 0.0140971 - 0.0161498 0.0139876 0.0122447 0.0106994 0.009397 0.00822236 - 0.00686509 0.00797431 0.00751269 0.00671173 0.00595243 0.00524633 - 0.00459528 0.00401688 0.00350109 0.00303954 0.00260569 0.00222792 - 0.00191033 0.00163917 0.00140949 0.00121464 0.0010471 0.000900638 - 0.000768847 0.000645236 0.000524807 0.000460275 0.000442237 - 0.000446775 0.000397026 0.000301585 0.000228994 0.000190894 - 0.000166569 0.000152261 0.000137953 0.000123644 0.000109336 - 9.50281e-05 8.56557e-05 7.78437e-05 7.00318e-05 6.22198e-05 - 5.44079e-05 4.87539e-05 4.57761e-05 4.27982e-05 3.98203e-05 - 3.68425e-05 3.38646e-05 3.08868e-05 2.79089e-05 2.4931e-05 - 2.19532e-05 1.89753e-05 1.75244e-05 1.64095e-05 1.52946e-05 - 1.41797e-05 1.30648e-05 1.19499e-05 1.0835e-05 9.72011e-06 - 8.60521e-06 7.4903e-06 6.5117e-06 6.10334e-06 5.69497e-06 - 5.2866e-06 4.87824e-06 4.46987e-06 4.06151e-06 3.65314e-06 - 3.24477e-06 + 5 5.03758 5.04711 4.96911 4.20882 3.96295 4.01117 4.15521 + 4.2967 4.42274 4.5295 4.6176 4.69014 4.74831 4.7966 4.83537 + 4.80526 4.787 4.79295 4.88588 5.08978 5.15615 5.10778 5.07718 + 5.06652 5.08225 4.9744 4.52977 3.77452 2.69426 1.15294 0.245509 + 0.0981544 0.0567527 0.0367487 0.0252578 0.0180599 0.0133837 + 0.0101497 0.0078616 0.00620186 0.00499056 0.0041027 0.00344223 + 0.00295808 0.00260089 0.00229887 0.00200817 0.00176397 0.00160116 + 0.00147381 0.00134645 0.00125029 0.00116043 0.00107371 0.00101981 + 0.000965921 0.000912028 0.000858135 0.000804242 0.000761669 + 0.00072672 0.000691771 0.000656823 0.000621874 0.000588722 + 0.00057041 0.000552098 0.000533785 0.000515473 0.000497162 + 0.00047885 0.000460537 0.000442226 0.000423914 0.000405601 + 0.000388399 0.000378694 0.000368989 0.000359284 0.00034958 + 0.000339875 0.00033017 0.000320465 0.00031076 0.000301055 + 0.00029135 0.000282207 0.000276247 0.000270287 0.000264327 + 0.000258367 0.000252407 0.000246447 0.000240487 0.000234527 + 0.000228567 0.000222607 0.000217086 0.000213696 0.000210307 + 0.000206918 0.000203528 0.000200139 0.00019675 0.00019336 + 0.000189971 0.000186582 0.000183192 0.000179803 0.000176414 + 0.000173025 0.000169635 0.000166246 0.000162857 0.000159467 + 0.000156078 0.000152689 0.000149299 0.00014591 0.00014255 + 0.0316021 0.163272 0.348732 0.603651 0.35745 0.135965 0.0707354 + 0.0314595 0.0201047 0.00994945 0.00389601 0.00138839 0.00060778 + 0.000329648 0.000492396 -0.0732035 -0.0844077 -0.0789062 + -0.0390837 0.0197559 0.0183094 -0.00180099 -0.0189565 -0.0424144 + -0.0735904 -0.0892423 0.285039 1.13702 2.10809 2.95826 3.60164 + 4.0435 4.35771 4.57254 4.71769 4.81329 4.87534 4.91487 4.94264 + 4.97375 5.01526 5.06517 5.10154 5.06259 4.89005 4.5787 4.12226 + 3.46151 2.49023 1.2586 0.32725 0.116753 0.0701865 0.0455509 + 0.0286914 0.0178176 0.0117599 0.00902715 0.00760583 0.00637745 + 0.00543811 0.00439377 0.00352448 0.0030151 0.00285771 0.002465 + 0.00203114 0.00173004 0.0014839 0.00125177 0.00105327 0.000894905 + 0.000766372 0.000658894 0.000569105 0.000492114 0.000427938 + 0.000370217 0.000314758 0.000266569 0.000233726 0.000209048 + 0.000191957 0.000177169 0.000166604 0.000161 0.000157314 + 0.000143828 0.000130342 0.000116857 0.000103371 8.98855e-05 + 7.63998e-05 6.29141e-05 5.76583e-05 5.30027e-05 4.8347e-05 + 4.36913e-05 3.90357e-05 3.438e-05 2.97243e-05 2.72507e-05 + 2.59083e-05 2.45659e-05 2.32235e-05 2.18811e-05 2.05387e-05 + 1.91963e-05 1.78539e-05 1.65115e-05 1.51691e-05 1.38267e-05 + 1.24843e-05 1.11419e-05 9.79954e-06 8.51574e-06 7.69807e-06 + 6.8804e-06 6.06273e-06 5.24506e-06 0.0287318 0.0317111 -0.0320087 + -0.103609 0.0369639 0.0121128 0.00961197 0.00934971 0.00820853 + 0.00699769 0.00607002 0.00535541 0.00476552 0.00427601 0.00376357 + -0.073012 -0.0866964 -0.0809538 -0.038005 0.0277001 0.0188906 + 0.00614597 0.00373629 0.00489787 0.0146573 0.0191052 0.0151708 + 0.0124224 0.0105859 0.00879272 0.00729464 0.0070047 0.00449575 + -0.00626652 -0.0252417 -0.0147287 0.022538 0.0822905 0.0947372 + 0.0657516 0.0445506 0.0316753 0.0220971 0.0158101 0.0140971 + 0.0161498 0.0139876 0.0122447 0.0106994 0.009397 0.00822236 + 0.00686509 0.00797431 0.00751269 0.00671173 0.00595243 0.00524633 + 0.00459528 0.00401688 0.00350109 0.00303954 0.00260569 0.00222792 + 0.00191033 0.00163917 0.00140949 0.00121464 0.0010471 0.000900638 + 0.000768847 0.000645236 0.000524807 0.000460275 0.000442237 + 0.000446775 0.000397026 0.000301585 0.000228994 0.000190894 + 0.000166569 0.000152261 0.000137953 0.000123644 0.000109336 + 9.50281e-05 8.56557e-05 7.78437e-05 7.00318e-05 6.22198e-05 + 5.44079e-05 4.87539e-05 4.57761e-05 4.27982e-05 3.98203e-05 + 3.68425e-05 3.38646e-05 3.08868e-05 2.79089e-05 2.4931e-05 + 2.19532e-05 1.89753e-05 1.75244e-05 1.64095e-05 1.52946e-05 + 1.41797e-05 1.30648e-05 1.19499e-05 1.0835e-05 9.72011e-06 + 8.60521e-06 7.4903e-06 6.5117e-06 6.10334e-06 5.69497e-06 + 5.2866e-06 4.87824e-06 4.46987e-06 4.06151e-06 3.65314e-06 + 3.24477e-06 EOD @v[9].set(<<-'EOD') - 1.86175 1.99708 2.07867 2.01211 2.43309 3.27194 3.63896 - 3.90426 4.11074 4.27932 4.41496 4.52543 4.61491 4.68862 - 4.7479 4.79666 4.72895 4.68886 4.70354 4.81353 5.01568 5.14184 - 5.10482 5.07362 5.05143 5.03638 5.02323 5.01465 5.00853 - 5.00383 4.99985 5.00454 5.00652 5.00546 5.00411 5.003 5.00214 - 5.00151 5.00106 5.00073 5.0005 5.00034 5.00023 5.00015 5.0001 - 5.00005 5 5.00001 5.00005 5.00005 5.00003 5 4.99998 4.99996 - 4.99994 4.99995 4.99997 4.99998 5 5.00001 5.00002 5.00002 - 5.00003 5.00003 5.00003 5.00003 5.00003 5.00003 5.00002 - 5.00002 5.00001 5.00001 5.00001 5 5 5 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 - 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 5 5 5 5 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.17392 4.94828 3.78491 - 1.52079 0.608874 0.244031 0.127087 0.0552995 0.0361032 0.0169025 - 0.006364 0.00217624 0.000921391 0.000457305 0.000786754 - -0.120016 -0.148054 -0.15898 -0.0801463 0.16463 0.174017 - 0.0799249 0.0318788 0.0129696 0.00483397 0.0025677 0.0042079 - 0.00350003 0.00178404 -8.72902e-05 -0.00128497 -0.00142213 - -0.00130018 -0.00106874 -0.000789207 -0.000824335 -0.00104518 - -0.00136799 -0.004366 -0.0102621 -0.0109254 -0.00649259 - -0.00194842 0.00029793 0.00148673 0.00221085 0.00228291 - 0.00185261 0.00139687 0.00148183 0.00562266 0.00844119 0.00754627 - 0.00657396 0.00591212 0.00539269 0.0049282 0.00448417 0.0040572 - 0.00363719 0.00320392 0.00279607 0.00243938 0.00211505 0.00182302 - 0.00156254 0.0013341 0.00113834 0.000971865 0.00082776 0.000706193 - 0.000602499 0.000515059 0.000441401 0.00037897 0.000325459 - 0.00028083 0.000242096 0.000207274 0.000176444 0.000150372 - 0.000126407 0.000103373 9.05522e-05 8.53555e-05 8.63685e-05 - 9.02593e-05 8.37346e-05 7.72099e-05 7.06852e-05 6.41605e-05 - 5.76358e-05 5.11112e-05 4.45865e-05 4.08176e-05 3.72497e-05 - 3.36818e-05 3.01138e-05 2.65459e-05 2.2978e-05 1.94101e-05 - 1.76154e-05 1.67399e-05 1.58645e-05 1.4989e-05 1.41136e-05 - 1.32381e-05 1.23626e-05 1.14872e-05 1.06117e-05 9.73629e-06 - 8.86083e-06 7.98538e-06 7.10993e-06 6.23447e-06 5.44363e-06 - 5.32578e-06 5.20792e-06 5.09007e-06 4.97222e-06 0.0784323 - 0.0474527 -0.0764232 -0.151146 0.0615785 0.0144489 0.00974161 - 0.00947176 0.00849005 0.00728201 0.00630581 0.00554032 0.00487809 - 0.00441504 0.00384139 -0.118943 -0.149894 -0.161173 -0.0825299 - 0.171686 0.176912 0.0816085 0.0335236 0.013791 0.0056976 - 0.00238833 0.00105348 0.000526199 0.00025969 0.000396026 - 0.000837835 0.00170131 0.00196699 -0.000553314 -0.0061621 - -0.0111895 -0.0142698 -0.0124608 -0.00795847 -0.00467822 - -0.0043058 -0.00874449 -0.0118584 -0.00871386 -0.00377892 - 1.95244e-05 0.00218952 0.00325486 0.00386497 0.00422837 - 0.00446883 0.00447065 0.00486647 0.00547838 0.00565398 0.00559092 - 0.00538752 0.00507015 0.00466305 0.00420756 0.00373465 0.00328404 - 0.00287059 0.00250057 0.00216124 0.00184861 0.00156815 0.00134624 - 0.00117857 0.00103412 0.0008948 0.000761012 0.000619853 - 0.000462614 0.000319965 0.000287666 0.000356415 0.000379946 - 0.000339183 0.00027972 0.000252982 0.000226244 0.000199507 - 0.000172769 0.000146031 0.000130097 0.000117578 0.000105059 - 9.25401e-05 8.00213e-05 7.11204e-05 6.67061e-05 6.22918e-05 - 5.78775e-05 5.34632e-05 4.90489e-05 4.46346e-05 4.02203e-05 - 3.5806e-05 3.13916e-05 2.69773e-05 2.4827e-05 2.31747e-05 - 2.15225e-05 1.98702e-05 1.8218e-05 1.65658e-05 1.49135e-05 - 1.32613e-05 1.1609e-05 9.95678e-06 8.50108e-06 7.86765e-06 - 7.23422e-06 6.60079e-06 5.96736e-06 5.33393e-06 4.7005e-06 - 4.06707e-06 3.43363e-06 + 1.86175 1.99708 2.07867 2.01211 2.43309 3.27194 3.63896 + 3.90426 4.11074 4.27932 4.41496 4.52543 4.61491 4.68862 + 4.7479 4.79666 4.72895 4.68886 4.70354 4.81353 5.01568 5.14184 + 5.10482 5.07362 5.05143 5.03638 5.02323 5.01465 5.00853 + 5.00383 4.99985 5.00454 5.00652 5.00546 5.00411 5.003 5.00214 + 5.00151 5.00106 5.00073 5.0005 5.00034 5.00023 5.00015 5.0001 + 5.00005 5 5.00001 5.00005 5.00005 5.00003 5 4.99998 4.99996 + 4.99994 4.99995 4.99997 4.99998 5 5.00001 5.00002 5.00002 + 5.00003 5.00003 5.00003 5.00003 5.00003 5.00003 5.00002 + 5.00002 5.00001 5.00001 5.00001 5 5 5 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 + 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 5 5 5 5 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.17392 4.94828 3.78491 + 1.52079 0.608874 0.244031 0.127087 0.0552995 0.0361032 0.0169025 + 0.006364 0.00217624 0.000921391 0.000457305 0.000786754 + -0.120016 -0.148054 -0.15898 -0.0801463 0.16463 0.174017 + 0.0799249 0.0318788 0.0129696 0.00483397 0.0025677 0.0042079 + 0.00350003 0.00178404 -8.72902e-05 -0.00128497 -0.00142213 + -0.00130018 -0.00106874 -0.000789207 -0.000824335 -0.00104518 + -0.00136799 -0.004366 -0.0102621 -0.0109254 -0.00649259 + -0.00194842 0.00029793 0.00148673 0.00221085 0.00228291 + 0.00185261 0.00139687 0.00148183 0.00562266 0.00844119 0.00754627 + 0.00657396 0.00591212 0.00539269 0.0049282 0.00448417 0.0040572 + 0.00363719 0.00320392 0.00279607 0.00243938 0.00211505 0.00182302 + 0.00156254 0.0013341 0.00113834 0.000971865 0.00082776 0.000706193 + 0.000602499 0.000515059 0.000441401 0.00037897 0.000325459 + 0.00028083 0.000242096 0.000207274 0.000176444 0.000150372 + 0.000126407 0.000103373 9.05522e-05 8.53555e-05 8.63685e-05 + 9.02593e-05 8.37346e-05 7.72099e-05 7.06852e-05 6.41605e-05 + 5.76358e-05 5.11112e-05 4.45865e-05 4.08176e-05 3.72497e-05 + 3.36818e-05 3.01138e-05 2.65459e-05 2.2978e-05 1.94101e-05 + 1.76154e-05 1.67399e-05 1.58645e-05 1.4989e-05 1.41136e-05 + 1.32381e-05 1.23626e-05 1.14872e-05 1.06117e-05 9.73629e-06 + 8.86083e-06 7.98538e-06 7.10993e-06 6.23447e-06 5.44363e-06 + 5.32578e-06 5.20792e-06 5.09007e-06 4.97222e-06 0.0784323 + 0.0474527 -0.0764232 -0.151146 0.0615785 0.0144489 0.00974161 + 0.00947176 0.00849005 0.00728201 0.00630581 0.00554032 0.00487809 + 0.00441504 0.00384139 -0.118943 -0.149894 -0.161173 -0.0825299 + 0.171686 0.176912 0.0816085 0.0335236 0.013791 0.0056976 + 0.00238833 0.00105348 0.000526199 0.00025969 0.000396026 + 0.000837835 0.00170131 0.00196699 -0.000553314 -0.0061621 + -0.0111895 -0.0142698 -0.0124608 -0.00795847 -0.00467822 + -0.0043058 -0.00874449 -0.0118584 -0.00871386 -0.00377892 + 1.95244e-05 0.00218952 0.00325486 0.00386497 0.00422837 + 0.00446883 0.00447065 0.00486647 0.00547838 0.00565398 0.00559092 + 0.00538752 0.00507015 0.00466305 0.00420756 0.00373465 0.00328404 + 0.00287059 0.00250057 0.00216124 0.00184861 0.00156815 0.00134624 + 0.00117857 0.00103412 0.0008948 0.000761012 0.000619853 + 0.000462614 0.000319965 0.000287666 0.000356415 0.000379946 + 0.000339183 0.00027972 0.000252982 0.000226244 0.000199507 + 0.000172769 0.000146031 0.000130097 0.000117578 0.000105059 + 9.25401e-05 8.00213e-05 7.11204e-05 6.67061e-05 6.22918e-05 + 5.78775e-05 5.34632e-05 4.90489e-05 4.46346e-05 4.02203e-05 + 3.5806e-05 3.13916e-05 2.69773e-05 2.4827e-05 2.31747e-05 + 2.15225e-05 1.98702e-05 1.8218e-05 1.65658e-05 1.49135e-05 + 1.32613e-05 1.1609e-05 9.95678e-06 8.50108e-06 7.86765e-06 + 7.23422e-06 6.60079e-06 5.96736e-06 5.33393e-06 4.7005e-06 + 4.06707e-06 3.43363e-06 EOD @v[10].set(<<-'EOD') - 1.86175 1.99308 2.16619 2.46661 3.09359 3.76864 4.31299 - 4.65564 4.83425 4.92153 4.96157 4.98063 4.98649 4.99039 - 4.9945 4.9972 4.96206 4.89882 4.83865 4.83202 4.91016 5.04479 - 5.06078 5.04827 5.03474 5.0246 5.01639 5.00996 5.00569 5.00239 - 5.00043 5.00296 5.00437 5.00382 5.00287 5.00208 5.00148 - 5.00104 5.00073 5.0005 5.00034 5.00023 5.00016 5.00011 5.00008 - 5.00007 5.00007 5.00004 5 4.99998 4.99998 4.99997 4.99998 - 4.99999 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 - 5.00001 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 5.10081 - 5.10949 4.98359 5.00733 5.15145 4.37298 2.36126 0.470759 - 0.0577238 0.0115884 0.00262611 0.000671499 0.000389038 0.000291291 - 0.000317347 -0.0167823 -0.0158344 -0.0140559 0.0104849 0.0865874 - 0.107813 0.0524688 0.0214369 0.00876443 0.00341595 0.00170778 - 0.00259042 0.0022241 0.00118519 1.10217e-06 -0.000784506 - -0.000948169 -0.000856256 -0.000696719 -0.000485987 -0.000724787 - -0.000981491 -0.001454 -0.00552498 -0.0114992 -0.0105266 - -0.00543527 -0.000982798 0.00127356 0.00224212 0.00275439 - 0.00281098 0.0025471 0.00230368 0.00222576 0.00485522 0.00729453 - 0.00691796 0.0062615 0.00573987 0.0052688 0.00481185 0.00436934 - 0.00394326 0.00352712 0.00309978 0.00270038 0.00235335 0.00203742 - 0.00175256 0.00150067 0.00128126 0.00109323 0.000933619 - 0.000795113 0.000678182 0.00057843 0.000494345 0.000423609 - 0.000363821 0.000312766 0.000269856 0.000232389 0.000198382 - 0.000168126 0.00014267 0.000119293 9.69034e-05 8.5669e-05 - 8.26828e-05 8.64066e-05 9.26665e-05 8.5454e-05 7.82416e-05 - 7.10291e-05 6.38167e-05 5.66043e-05 4.93918e-05 4.21794e-05 - 3.86073e-05 3.53007e-05 3.19941e-05 2.86876e-05 2.5381e-05 - 2.20744e-05 1.87678e-05 1.70933e-05 1.62648e-05 1.54363e-05 - 1.46079e-05 1.37794e-05 1.2951e-05 1.21225e-05 1.12941e-05 - 1.04656e-05 9.63716e-06 8.80871e-06 7.98026e-06 7.1518e-06 - 6.32335e-06 5.5374e-06 5.08959e-06 4.64178e-06 4.19397e-06 - 3.74616e-06 0.0438026 0.0242078 -0.0602019 -0.0840866 0.00148461 - -0.00292489 0.000442098 0.00219489 0.00281478 0.00290756 - 0.00277945 0.00263896 0.00240099 0.00223283 0.001947 -0.0153629 - -0.0148815 -0.0128673 0.0126017 0.0905161 0.11051 0.0538958 - 0.022562 0.00935726 0.00397422 0.00172534 0.000790207 0.000416322 - 0.000191632 0.000469721 0.0009779 0.00192566 0.00200688 - -0.0016502 -0.00733932 -0.0128113 -0.0147608 -0.0115456 - -0.00668995 -0.00401368 -0.00463908 -0.0101197 -0.0118993 - -0.0076276 -0.00262656 0.000813059 0.00264455 0.00350796 - 0.00399494 0.0043049 0.00451658 0.00444739 0.00503842 0.00559516 - 0.00568213 0.00556459 0.0053176 0.00496654 0.00454337 0.00408592 - 0.00362171 0.00317793 0.00277001 0.00240394 0.00207009 0.00176575 - 0.00149725 0.00129045 0.00114257 0.00101135 0.000871672 - 0.000723764 0.000580438 0.000427507 0.000296956 0.000281834 - 0.000376628 0.000412266 0.000367547 0.000295305 0.000264513 - 0.000233721 0.000202929 0.000172137 0.000141345 0.000124721 - 0.000112577 0.000100433 8.82893e-05 7.61453e-05 6.75517e-05 - 6.33609e-05 5.91701e-05 5.49792e-05 5.07884e-05 4.65976e-05 - 4.24067e-05 3.82159e-05 3.40251e-05 2.98342e-05 2.56434e-05 - 2.36401e-05 2.21181e-05 2.05961e-05 1.90741e-05 1.75521e-05 - 1.60301e-05 1.45081e-05 1.29861e-05 1.14641e-05 9.94208e-06 - 8.59252e-06 7.96439e-06 7.33626e-06 6.70813e-06 6.07999e-06 - 5.45186e-06 4.82373e-06 4.1956e-06 3.56747e-06 + 1.86175 1.99308 2.16619 2.46661 3.09359 3.76864 4.31299 + 4.65564 4.83425 4.92153 4.96157 4.98063 4.98649 4.99039 + 4.9945 4.9972 4.96206 4.89882 4.83865 4.83202 4.91016 5.04479 + 5.06078 5.04827 5.03474 5.0246 5.01639 5.00996 5.00569 5.00239 + 5.00043 5.00296 5.00437 5.00382 5.00287 5.00208 5.00148 + 5.00104 5.00073 5.0005 5.00034 5.00023 5.00016 5.00011 5.00008 + 5.00007 5.00007 5.00004 5 4.99998 4.99998 4.99997 4.99998 + 4.99999 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 + 5.00001 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 5.10081 + 5.10949 4.98359 5.00733 5.15145 4.37298 2.36126 0.470759 + 0.0577238 0.0115884 0.00262611 0.000671499 0.000389038 0.000291291 + 0.000317347 -0.0167823 -0.0158344 -0.0140559 0.0104849 0.0865874 + 0.107813 0.0524688 0.0214369 0.00876443 0.00341595 0.00170778 + 0.00259042 0.0022241 0.00118519 1.10217e-06 -0.000784506 + -0.000948169 -0.000856256 -0.000696719 -0.000485987 -0.000724787 + -0.000981491 -0.001454 -0.00552498 -0.0114992 -0.0105266 + -0.00543527 -0.000982798 0.00127356 0.00224212 0.00275439 + 0.00281098 0.0025471 0.00230368 0.00222576 0.00485522 0.00729453 + 0.00691796 0.0062615 0.00573987 0.0052688 0.00481185 0.00436934 + 0.00394326 0.00352712 0.00309978 0.00270038 0.00235335 0.00203742 + 0.00175256 0.00150067 0.00128126 0.00109323 0.000933619 + 0.000795113 0.000678182 0.00057843 0.000494345 0.000423609 + 0.000363821 0.000312766 0.000269856 0.000232389 0.000198382 + 0.000168126 0.00014267 0.000119293 9.69034e-05 8.5669e-05 + 8.26828e-05 8.64066e-05 9.26665e-05 8.5454e-05 7.82416e-05 + 7.10291e-05 6.38167e-05 5.66043e-05 4.93918e-05 4.21794e-05 + 3.86073e-05 3.53007e-05 3.19941e-05 2.86876e-05 2.5381e-05 + 2.20744e-05 1.87678e-05 1.70933e-05 1.62648e-05 1.54363e-05 + 1.46079e-05 1.37794e-05 1.2951e-05 1.21225e-05 1.12941e-05 + 1.04656e-05 9.63716e-06 8.80871e-06 7.98026e-06 7.1518e-06 + 6.32335e-06 5.5374e-06 5.08959e-06 4.64178e-06 4.19397e-06 + 3.74616e-06 0.0438026 0.0242078 -0.0602019 -0.0840866 0.00148461 + -0.00292489 0.000442098 0.00219489 0.00281478 0.00290756 + 0.00277945 0.00263896 0.00240099 0.00223283 0.001947 -0.0153629 + -0.0148815 -0.0128673 0.0126017 0.0905161 0.11051 0.0538958 + 0.022562 0.00935726 0.00397422 0.00172534 0.000790207 0.000416322 + 0.000191632 0.000469721 0.0009779 0.00192566 0.00200688 + -0.0016502 -0.00733932 -0.0128113 -0.0147608 -0.0115456 + -0.00668995 -0.00401368 -0.00463908 -0.0101197 -0.0118993 + -0.0076276 -0.00262656 0.000813059 0.00264455 0.00350796 + 0.00399494 0.0043049 0.00451658 0.00444739 0.00503842 0.00559516 + 0.00568213 0.00556459 0.0053176 0.00496654 0.00454337 0.00408592 + 0.00362171 0.00317793 0.00277001 0.00240394 0.00207009 0.00176575 + 0.00149725 0.00129045 0.00114257 0.00101135 0.000871672 + 0.000723764 0.000580438 0.000427507 0.000296956 0.000281834 + 0.000376628 0.000412266 0.000367547 0.000295305 0.000264513 + 0.000233721 0.000202929 0.000172137 0.000141345 0.000124721 + 0.000112577 0.000100433 8.82893e-05 7.61453e-05 6.75517e-05 + 6.33609e-05 5.91701e-05 5.49792e-05 5.07884e-05 4.65976e-05 + 4.24067e-05 3.82159e-05 3.40251e-05 2.98342e-05 2.56434e-05 + 2.36401e-05 2.21181e-05 2.05961e-05 1.90741e-05 1.75521e-05 + 1.60301e-05 1.45081e-05 1.29861e-05 1.14641e-05 9.94208e-06 + 8.59252e-06 7.96439e-06 7.33626e-06 6.70813e-06 6.07999e-06 + 5.45186e-06 4.82373e-06 4.1956e-06 3.56747e-06 EOD @v[11].set(<<-'EOD') - 1.86175 1.73419 1.42874 1.04055 0.943004 0.268275 0.0826455 - 0.0388346 0.0214104 0.0135431 0.00961322 0.00712846 0.00588262 - 0.00432397 0.00377774 0.00270134 -0.00393731 -0.00542187 - -0.00126596 0.0113777 0.0134522 0.00477056 -0.00211067 -0.00229253 - -0.00173355 -0.00122404 -0.00113426 -0.000744931 -0.000520112 - -0.000410048 -0.000220439 0.000508104 5.15856e-05 -0.000112593 - -0.000118917 -9.57394e-05 -7.15727e-05 -5.11847e-05 -3.58275e-05 - -2.47166e-05 -1.68866e-05 -1.14082e-05 -7.66646e-06 -5.12139e-06 - -3.63426e-06 -3.01815e-06 -2.64862e-06 -1.4947e-06 -1.91403e-07 - -2.5763e-08 -7.73699e-07 -1.52164e-06 -1.07268e-06 -3.81696e-07 - 2.6727e-07 4.75489e-07 6.83708e-07 8.91926e-07 1.10014e-06 - 1.30836e-06 1.2482e-06 1.00726e-06 7.66311e-07 5.25364e-07 - 2.84417e-07 6.27857e-08 7.43904e-10 -6.12979e-08 -1.2334e-07 - -1.85382e-07 -2.47423e-07 -3.09465e-07 -3.71507e-07 -4.33549e-07 - -4.95591e-07 -5.57633e-07 -6.04571e-07 -5.4944e-07 -4.9431e-07 - -4.3918e-07 -3.84049e-07 -3.28919e-07 -2.73789e-07 -2.18659e-07 - -1.63528e-07 -1.08398e-07 -5.32678e-08 1.062e-09 5.08502e-08 - 1.00638e-07 1.50427e-07 2.00215e-07 2.50003e-07 2.99791e-07 - 3.4958e-07 3.99368e-07 4.49156e-07 4.98944e-07 5.34512e-07 - 5.01032e-07 4.67553e-07 4.34073e-07 4.00593e-07 3.67113e-07 - 3.33633e-07 3.00153e-07 2.66674e-07 2.33194e-07 1.99714e-07 - 1.66234e-07 1.32754e-07 9.92744e-08 6.57945e-08 3.23147e-08 - -1.16513e-09 -3.4645e-08 -6.81248e-08 -1.01605e-07 -1.35084e-07 - -1.68564e-07 -2.18729e-07 0.0114926 -0.0245378 -0.111828 - 0.0964775 1.61491 3.22668 4.22041 4.54492 4.82845 4.94868 - 4.98588 4.99609 4.9981 4.99908 4.99788 4.98395 4.99294 4.99724 - 5.01939 5.0471 5.00902 4.98194 4.98496 4.99188 4.99623 4.99862 - 5.00025 4.99974 4.99953 4.99946 4.99958 5.00012 4.99997 - 4.99992 4.99988 4.99985 4.9998 4.9997 4.9988 4.99806 4.99982 - 5.00143 5.00159 5.00098 5.00053 5.00028 5.00007 4.99977 - 4.99992 5.00005 5.00133 5.0009 4.99993 4.99972 4.99975 4.9998 - 4.99982 4.99983 4.99983 4.99983 4.99983 4.99984 4.99986 - 4.99987 4.99989 4.9999 4.99991 4.99992 4.99994 4.99995 4.99995 - 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 4.99998 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 5 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 5 5 5.01457 4.99482 4.96561 4.99326 - 5.03452 5.00424 5.00101 5.00045 5.00004 4.99965 4.99997 - 4.99994 4.99958 4.99999 4.99936 4.9839 4.99248 4.99717 5.01976 - 5.04869 5.0087 4.98143 4.98488 4.99199 4.99622 4.9983 4.99928 - 4.99971 4.99986 5.00031 5.00022 5.00035 5.0001 4.99884 4.99811 - 4.99803 4.99887 5.00078 5.00151 5.00116 5.00007 4.99843 - 4.99915 5.00107 5.00168 5.00141 5.00092 5.00055 5.0003 5.00016 - 5.0001 5.00001 5.00016 5.0002 5.00009 4.99993 4.99975 4.99984 - 4.99991 4.99991 4.99982 4.99974 4.99974 4.99985 4.99995 - 4.99999 4.99998 5.00004 5.00013 5.00015 5.00007 4.99988 - 4.99982 4.99985 4.99995 5.00006 5.0002 5.00025 5.0002 5.00009 - 5.00006 5.00004 5.00002 5 4.99998 4.99997 4.99998 4.99998 - 4.99999 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 - 4.99998 4.99998 4.99998 + 1.86175 1.73419 1.42874 1.04055 0.943004 0.268275 0.0826455 + 0.0388346 0.0214104 0.0135431 0.00961322 0.00712846 0.00588262 + 0.00432397 0.00377774 0.00270134 -0.00393731 -0.00542187 + -0.00126596 0.0113777 0.0134522 0.00477056 -0.00211067 -0.00229253 + -0.00173355 -0.00122404 -0.00113426 -0.000744931 -0.000520112 + -0.000410048 -0.000220439 0.000508104 5.15856e-05 -0.000112593 + -0.000118917 -9.57394e-05 -7.15727e-05 -5.11847e-05 -3.58275e-05 + -2.47166e-05 -1.68866e-05 -1.14082e-05 -7.66646e-06 -5.12139e-06 + -3.63426e-06 -3.01815e-06 -2.64862e-06 -1.4947e-06 -1.91403e-07 + -2.5763e-08 -7.73699e-07 -1.52164e-06 -1.07268e-06 -3.81696e-07 + 2.6727e-07 4.75489e-07 6.83708e-07 8.91926e-07 1.10014e-06 + 1.30836e-06 1.2482e-06 1.00726e-06 7.66311e-07 5.25364e-07 + 2.84417e-07 6.27857e-08 7.43904e-10 -6.12979e-08 -1.2334e-07 + -1.85382e-07 -2.47423e-07 -3.09465e-07 -3.71507e-07 -4.33549e-07 + -4.95591e-07 -5.57633e-07 -6.04571e-07 -5.4944e-07 -4.9431e-07 + -4.3918e-07 -3.84049e-07 -3.28919e-07 -2.73789e-07 -2.18659e-07 + -1.63528e-07 -1.08398e-07 -5.32678e-08 1.062e-09 5.08502e-08 + 1.00638e-07 1.50427e-07 2.00215e-07 2.50003e-07 2.99791e-07 + 3.4958e-07 3.99368e-07 4.49156e-07 4.98944e-07 5.34512e-07 + 5.01032e-07 4.67553e-07 4.34073e-07 4.00593e-07 3.67113e-07 + 3.33633e-07 3.00153e-07 2.66674e-07 2.33194e-07 1.99714e-07 + 1.66234e-07 1.32754e-07 9.92744e-08 6.57945e-08 3.23147e-08 + -1.16513e-09 -3.4645e-08 -6.81248e-08 -1.01605e-07 -1.35084e-07 + -1.68564e-07 -2.18729e-07 0.0114926 -0.0245378 -0.111828 + 0.0964775 1.61491 3.22668 4.22041 4.54492 4.82845 4.94868 + 4.98588 4.99609 4.9981 4.99908 4.99788 4.98395 4.99294 4.99724 + 5.01939 5.0471 5.00902 4.98194 4.98496 4.99188 4.99623 4.99862 + 5.00025 4.99974 4.99953 4.99946 4.99958 5.00012 4.99997 + 4.99992 4.99988 4.99985 4.9998 4.9997 4.9988 4.99806 4.99982 + 5.00143 5.00159 5.00098 5.00053 5.00028 5.00007 4.99977 + 4.99992 5.00005 5.00133 5.0009 4.99993 4.99972 4.99975 4.9998 + 4.99982 4.99983 4.99983 4.99983 4.99983 4.99984 4.99986 + 4.99987 4.99989 4.9999 4.99991 4.99992 4.99994 4.99995 4.99995 + 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 4.99998 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 5 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 5 5 5.01457 4.99482 4.96561 4.99326 + 5.03452 5.00424 5.00101 5.00045 5.00004 4.99965 4.99997 + 4.99994 4.99958 4.99999 4.99936 4.9839 4.99248 4.99717 5.01976 + 5.04869 5.0087 4.98143 4.98488 4.99199 4.99622 4.9983 4.99928 + 4.99971 4.99986 5.00031 5.00022 5.00035 5.0001 4.99884 4.99811 + 4.99803 4.99887 5.00078 5.00151 5.00116 5.00007 4.99843 + 4.99915 5.00107 5.00168 5.00141 5.00092 5.00055 5.0003 5.00016 + 5.0001 5.00001 5.00016 5.0002 5.00009 4.99993 4.99975 4.99984 + 4.99991 4.99991 4.99982 4.99974 4.99974 4.99985 4.99995 + 4.99999 4.99998 5.00004 5.00013 5.00015 5.00007 4.99988 + 4.99982 4.99985 4.99995 5.00006 5.0002 5.00025 5.0002 5.00009 + 5.00006 5.00004 5.00002 5 4.99998 4.99997 4.99998 4.99998 + 4.99999 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 + 4.99998 4.99998 4.99998 EOD @v[12].set(<<-'EOD') - 5 5.16975 4.78685 2.94241 0.126698 0.0487004 -0.00422591 - -0.00130689 -0.000486756 -0.000195875 -0.000108988 -6.66736e-05 - -7.26005e-05 -5.63608e-05 -3.81859e-05 -2.123e-05 -0.0646846 - -0.0184474 0.182248 1.06731 3.10988 4.46133 4.84133 4.95113 - 4.98364 4.99455 4.99694 4.99727 4.9994 4.99975 5.0001 5.00132 - 5.00089 5.00039 5.00019 5.00011 5.00006 5.00005 5.00004 - 5.00001 4.99992 4.99992 5.00002 5.00013 5.00017 5.00009 - 4.99992 4.99991 4.99994 4.99996 4.99998 4.99999 5.00001 - 5.00004 5.00006 5.00005 5.00004 5.00003 5.00002 5.00001 - 5 4.99999 4.99999 4.99998 4.99998 4.99997 4.99997 4.99998 - 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 - 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 5 5.14699 4.78074 - 3.19424 0.305663 0.0611255 -0.00179951 -0.0012032 0.000405978 - 0.000989399 0.000445194 0.000191447 8.30476e-05 3.96236e-05 - 1.91866e-05 1.70665e-05 -0.0655239 -0.0210234 0.1827 1.06848 - 3.11554 4.46518 4.84212 4.94853 4.98244 4.99434 4.9997 5.00081 - 5.00009 4.99972 4.99985 4.99974 4.9995 4.99949 4.99958 4.99973 - 4.99948 4.99914 4.99874 4.99946 5.00309 5.0091 5.01576 5.01835 - 5.01852 5.0176 5.01625 5.01479 5.01345 5.01264 5.011 5.01092 - 5.01344 5.01363 5.01289 5.01184 5.01071 5.00956 5.00848 - 5.00751 5.00663 5.00577 5.00497 5.00427 5.00365 5.0031 5.00264 - 5.00224 5.00191 5.00163 5.00138 5.00117 5.00099 5.00083 - 5.00071 5.00061 5.00053 5.00045 5.00037 5.00029 5.00022 - 5.00019 5.0002 5.00023 5.00024 5.00023 5.00023 5.00022 5.0002 - 5.00018 5.00016 5.00014 5.00011 5.00009 5.00007 5.00006 - 5.00005 5.00005 5.00004 5.00003 5.00002 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00001 5.00001 5.00001 5.14298 4.79809 3.32704 - 0.498385 0.105773 0.0160646 0.0319912 0.0299434 0.0240102 - 0.0185844 0.0130411 0.0106532 0.00864871 0.00744519 0.00660887 - -0.0612913 -0.0203719 0.174998 0.991787 3.06292 4.60005 - 4.93058 4.98917 5.00033 4.9999 4.99909 4.9966 4.9955 4.99488 - 4.99374 4.9943 5.00131 5.00506 4.99311 4.96288 4.93567 4.92439 - 4.94236 4.9732 4.98864 4.99458 5.00031 5.00694 5.01525 5.01945 - 5.01998 5.01953 5.01874 5.01766 5.0164 5.01509 5.01326 5.01423 - 5.01455 5.01361 5.01245 5.01122 5.01002 5.00888 5.00783 - 5.00687 5.00596 5.00514 5.00442 5.00379 5.00325 5.00279 - 5.0024 5.00208 5.0018 5.00153 5.00126 5.00107 5.00094 5.00085 - 5.00078 5.00072 5.00063 5.00053 5.00042 5.00038 5.00034 - 5.0003 5.00027 5.00023 5.00021 5.00019 5.00017 5.00015 5.00013 - 5.00012 5.00011 5.0001 5.0001 5.00009 5.00008 5.00007 5.00007 - 5.00006 5.00005 5.00005 5.00004 5.00004 5.00003 5.00003 - 5.00002 5.00002 5.00002 5.00001 5.00001 5 5 5 5.00001 5.00001 - 5.00001 5.00002 5.00002 5.00002 5.00002 + 5 5.16975 4.78685 2.94241 0.126698 0.0487004 -0.00422591 + -0.00130689 -0.000486756 -0.000195875 -0.000108988 -6.66736e-05 + -7.26005e-05 -5.63608e-05 -3.81859e-05 -2.123e-05 -0.0646846 + -0.0184474 0.182248 1.06731 3.10988 4.46133 4.84133 4.95113 + 4.98364 4.99455 4.99694 4.99727 4.9994 4.99975 5.0001 5.00132 + 5.00089 5.00039 5.00019 5.00011 5.00006 5.00005 5.00004 + 5.00001 4.99992 4.99992 5.00002 5.00013 5.00017 5.00009 + 4.99992 4.99991 4.99994 4.99996 4.99998 4.99999 5.00001 + 5.00004 5.00006 5.00005 5.00004 5.00003 5.00002 5.00001 + 5 4.99999 4.99999 4.99998 4.99998 4.99997 4.99997 4.99998 + 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 + 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 5 5.14699 4.78074 + 3.19424 0.305663 0.0611255 -0.00179951 -0.0012032 0.000405978 + 0.000989399 0.000445194 0.000191447 8.30476e-05 3.96236e-05 + 1.91866e-05 1.70665e-05 -0.0655239 -0.0210234 0.1827 1.06848 + 3.11554 4.46518 4.84212 4.94853 4.98244 4.99434 4.9997 5.00081 + 5.00009 4.99972 4.99985 4.99974 4.9995 4.99949 4.99958 4.99973 + 4.99948 4.99914 4.99874 4.99946 5.00309 5.0091 5.01576 5.01835 + 5.01852 5.0176 5.01625 5.01479 5.01345 5.01264 5.011 5.01092 + 5.01344 5.01363 5.01289 5.01184 5.01071 5.00956 5.00848 + 5.00751 5.00663 5.00577 5.00497 5.00427 5.00365 5.0031 5.00264 + 5.00224 5.00191 5.00163 5.00138 5.00117 5.00099 5.00083 + 5.00071 5.00061 5.00053 5.00045 5.00037 5.00029 5.00022 + 5.00019 5.0002 5.00023 5.00024 5.00023 5.00023 5.00022 5.0002 + 5.00018 5.00016 5.00014 5.00011 5.00009 5.00007 5.00006 + 5.00005 5.00005 5.00004 5.00003 5.00002 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00001 5.00001 5.00001 5.14298 4.79809 3.32704 + 0.498385 0.105773 0.0160646 0.0319912 0.0299434 0.0240102 + 0.0185844 0.0130411 0.0106532 0.00864871 0.00744519 0.00660887 + -0.0612913 -0.0203719 0.174998 0.991787 3.06292 4.60005 + 4.93058 4.98917 5.00033 4.9999 4.99909 4.9966 4.9955 4.99488 + 4.99374 4.9943 5.00131 5.00506 4.99311 4.96288 4.93567 4.92439 + 4.94236 4.9732 4.98864 4.99458 5.00031 5.00694 5.01525 5.01945 + 5.01998 5.01953 5.01874 5.01766 5.0164 5.01509 5.01326 5.01423 + 5.01455 5.01361 5.01245 5.01122 5.01002 5.00888 5.00783 + 5.00687 5.00596 5.00514 5.00442 5.00379 5.00325 5.00279 + 5.0024 5.00208 5.0018 5.00153 5.00126 5.00107 5.00094 5.00085 + 5.00078 5.00072 5.00063 5.00053 5.00042 5.00038 5.00034 + 5.0003 5.00027 5.00023 5.00021 5.00019 5.00017 5.00015 5.00013 + 5.00012 5.00011 5.0001 5.0001 5.00009 5.00008 5.00007 5.00007 + 5.00006 5.00005 5.00005 5.00004 5.00004 5.00003 5.00003 + 5.00002 5.00002 5.00002 5.00001 5.00001 5 5 5 5.00001 5.00001 + 5.00001 5.00002 5.00002 5.00002 5.00002 EOD @v[13].set(<<-'EOD') - 9.73784e-10 0.0189926 0.0926769 0.206309 0.111533 0.0953491 - 0.0426966 0.0214177 0.0117943 0.00741442 0.00528816 0.00398417 - 0.0032967 0.00266499 0.00206647 0.00158788 -0.0371391 -0.0439528 - -0.0408653 -0.0188706 0.0150241 0.0126852 0.00209817 -0.000239206 - -5.31488e-05 0.000876324 -0.00451221 -0.0165223 -0.0284127 - -0.0427584 -0.0502453 -0.0257366 -0.00903938 -0.00376456 - -0.00233385 -0.00169922 -0.00130397 -0.00102542 -0.000811435 - -0.000648115 -0.000529266 -0.00043795 -0.00036574 -0.00030716 - -0.00026221 -0.000229662 -0.000205112 -0.000181038 -0.000162045 - -0.000148988 -0.000137633 -0.000126278 -0.000115562 -0.000104976 - -9.49324e-05 -9.0585e-05 -8.62375e-05 -8.18901e-05 -7.75426e-05 - -7.31952e-05 -6.93752e-05 -6.59106e-05 -6.24461e-05 -5.89815e-05 - -5.55169e-05 -5.22412e-05 -5.05263e-05 -4.88114e-05 -4.70966e-05 - -4.53817e-05 -4.36668e-05 -4.19519e-05 -4.0237e-05 -3.85222e-05 - -3.68073e-05 -3.50924e-05 -3.34782e-05 -3.25442e-05 -3.16102e-05 - -3.06763e-05 -2.97423e-05 -2.88083e-05 -2.78744e-05 -2.69404e-05 - -2.60064e-05 -2.50725e-05 -2.41385e-05 -2.32635e-05 -2.27232e-05 - -2.21829e-05 -2.16426e-05 -2.11023e-05 -2.0562e-05 -2.00217e-05 - -1.94814e-05 -1.89411e-05 -1.84007e-05 -1.78604e-05 -1.73647e-05 - -1.70853e-05 -1.68059e-05 -1.65265e-05 -1.62471e-05 -1.59677e-05 - -1.56883e-05 -1.54089e-05 -1.51295e-05 -1.48501e-05 -1.45707e-05 - -1.42913e-05 -1.40119e-05 -1.37325e-05 -1.34531e-05 -1.31737e-05 - -1.28943e-05 -1.26149e-05 -1.23355e-05 -1.20561e-05 -1.17767e-05 - -1.14973e-05 -1.10954e-05 0.0152675 0.0228237 -0.00460678 - -0.0341525 0.0232109 -0.0138039 -0.0416538 -0.0458764 -0.0201967 - -0.00878316 -0.00379173 -0.00164621 -0.000785131 -0.00037575 - -0.000352375 -0.0545586 -0.0746881 -0.0771865 -0.05386 -0.0022199 - 0.0136703 0.00633526 0.00138826 -0.00108934 0.0038886 0.0298077 - 0.0475776 0.0481003 0.0464167 0.047818 0.042789 0.035207 - 0.0264423 0.0193959 0.0151614 0.00624257 -0.00913057 -0.0310696 - -0.0430238 0.016426 0.189762 0.49025 0.820116 1.13919 1.43549 - 1.70658 1.95183 2.17414 2.38506 2.5657 2.73958 2.97905 3.21403 - 3.43025 3.62645 3.8028 3.96002 4.09996 4.22443 4.33427 4.42886 - 4.51097 4.5817 4.64326 4.6957 4.74132 4.7797 4.81298 4.84102 - 4.86512 4.88523 4.90224 4.91649 4.92846 4.93868 4.94755 - 4.95483 4.96114 4.96682 4.97161 4.97502 4.9776 4.97944 4.98141 - 4.98319 4.98467 4.98585 4.9869 4.98796 4.98902 4.99008 4.99114 - 4.9922 4.99326 4.9938 4.99429 4.99479 4.99528 4.99578 4.99628 - 4.99677 4.99704 4.99718 4.99733 4.99747 4.99762 4.99777 - 4.99791 4.99806 4.9982 4.99835 4.9985 4.99864 4.99879 4.99893 - 4.99907 4.99916 4.99925 4.99934 4.99943 5.01473 4.92293 - 4.61974 4.0316 3.7835 3.74195 3.78344 3.87272 3.97386 4.07319 - 4.16686 4.25256 4.33126 4.40264 4.46697 4.49249 4.51807 - 4.55803 4.64055 4.78574 4.86074 4.88334 4.8999 4.91455 4.92814 - 4.93926 4.94761 4.95433 4.95907 4.9654 4.98317 5.0208 5.05134 - 4.85852 4.16041 3.00077 1.68376 0.672707 0.240838 0.0794725 - -0.0106347 -0.00879443 0.107196 0.368163 0.701424 1.03581 - 1.3601 1.6678 1.95731 2.22701 2.47544 2.69099 2.92327 3.16648 - 3.3877 3.59067 3.77344 3.93584 4.08066 4.20863 4.32065 4.41791 - 4.50211 4.57423 4.63614 4.68888 4.73377 4.7721 4.80519 4.83338 - 4.85732 4.87815 4.89514 4.90927 4.92108 4.93122 4.94014 - 4.94845 4.95601 4.96251 4.96576 4.969 4.97225 4.9755 4.97874 - 4.98087 4.98265 4.98442 4.9862 4.98797 4.98924 4.9899 4.99055 - 4.9912 4.99186 4.99251 4.99316 4.99381 4.99447 4.99512 4.99577 - 4.99609 4.99634 4.99659 4.99683 4.99708 4.99732 4.99757 - 4.99782 4.99806 4.99831 4.99853 4.99863 4.99873 4.99883 - 4.99893 4.99903 4.99913 4.99923 4.99933 + 9.73784e-10 0.0189926 0.0926769 0.206309 0.111533 0.0953491 + 0.0426966 0.0214177 0.0117943 0.00741442 0.00528816 0.00398417 + 0.0032967 0.00266499 0.00206647 0.00158788 -0.0371391 -0.0439528 + -0.0408653 -0.0188706 0.0150241 0.0126852 0.00209817 -0.000239206 + -5.31488e-05 0.000876324 -0.00451221 -0.0165223 -0.0284127 + -0.0427584 -0.0502453 -0.0257366 -0.00903938 -0.00376456 + -0.00233385 -0.00169922 -0.00130397 -0.00102542 -0.000811435 + -0.000648115 -0.000529266 -0.00043795 -0.00036574 -0.00030716 + -0.00026221 -0.000229662 -0.000205112 -0.000181038 -0.000162045 + -0.000148988 -0.000137633 -0.000126278 -0.000115562 -0.000104976 + -9.49324e-05 -9.0585e-05 -8.62375e-05 -8.18901e-05 -7.75426e-05 + -7.31952e-05 -6.93752e-05 -6.59106e-05 -6.24461e-05 -5.89815e-05 + -5.55169e-05 -5.22412e-05 -5.05263e-05 -4.88114e-05 -4.70966e-05 + -4.53817e-05 -4.36668e-05 -4.19519e-05 -4.0237e-05 -3.85222e-05 + -3.68073e-05 -3.50924e-05 -3.34782e-05 -3.25442e-05 -3.16102e-05 + -3.06763e-05 -2.97423e-05 -2.88083e-05 -2.78744e-05 -2.69404e-05 + -2.60064e-05 -2.50725e-05 -2.41385e-05 -2.32635e-05 -2.27232e-05 + -2.21829e-05 -2.16426e-05 -2.11023e-05 -2.0562e-05 -2.00217e-05 + -1.94814e-05 -1.89411e-05 -1.84007e-05 -1.78604e-05 -1.73647e-05 + -1.70853e-05 -1.68059e-05 -1.65265e-05 -1.62471e-05 -1.59677e-05 + -1.56883e-05 -1.54089e-05 -1.51295e-05 -1.48501e-05 -1.45707e-05 + -1.42913e-05 -1.40119e-05 -1.37325e-05 -1.34531e-05 -1.31737e-05 + -1.28943e-05 -1.26149e-05 -1.23355e-05 -1.20561e-05 -1.17767e-05 + -1.14973e-05 -1.10954e-05 0.0152675 0.0228237 -0.00460678 + -0.0341525 0.0232109 -0.0138039 -0.0416538 -0.0458764 -0.0201967 + -0.00878316 -0.00379173 -0.00164621 -0.000785131 -0.00037575 + -0.000352375 -0.0545586 -0.0746881 -0.0771865 -0.05386 -0.0022199 + 0.0136703 0.00633526 0.00138826 -0.00108934 0.0038886 0.0298077 + 0.0475776 0.0481003 0.0464167 0.047818 0.042789 0.035207 + 0.0264423 0.0193959 0.0151614 0.00624257 -0.00913057 -0.0310696 + -0.0430238 0.016426 0.189762 0.49025 0.820116 1.13919 1.43549 + 1.70658 1.95183 2.17414 2.38506 2.5657 2.73958 2.97905 3.21403 + 3.43025 3.62645 3.8028 3.96002 4.09996 4.22443 4.33427 4.42886 + 4.51097 4.5817 4.64326 4.6957 4.74132 4.7797 4.81298 4.84102 + 4.86512 4.88523 4.90224 4.91649 4.92846 4.93868 4.94755 + 4.95483 4.96114 4.96682 4.97161 4.97502 4.9776 4.97944 4.98141 + 4.98319 4.98467 4.98585 4.9869 4.98796 4.98902 4.99008 4.99114 + 4.9922 4.99326 4.9938 4.99429 4.99479 4.99528 4.99578 4.99628 + 4.99677 4.99704 4.99718 4.99733 4.99747 4.99762 4.99777 + 4.99791 4.99806 4.9982 4.99835 4.9985 4.99864 4.99879 4.99893 + 4.99907 4.99916 4.99925 4.99934 4.99943 5.01473 4.92293 + 4.61974 4.0316 3.7835 3.74195 3.78344 3.87272 3.97386 4.07319 + 4.16686 4.25256 4.33126 4.40264 4.46697 4.49249 4.51807 + 4.55803 4.64055 4.78574 4.86074 4.88334 4.8999 4.91455 4.92814 + 4.93926 4.94761 4.95433 4.95907 4.9654 4.98317 5.0208 5.05134 + 4.85852 4.16041 3.00077 1.68376 0.672707 0.240838 0.0794725 + -0.0106347 -0.00879443 0.107196 0.368163 0.701424 1.03581 + 1.3601 1.6678 1.95731 2.22701 2.47544 2.69099 2.92327 3.16648 + 3.3877 3.59067 3.77344 3.93584 4.08066 4.20863 4.32065 4.41791 + 4.50211 4.57423 4.63614 4.68888 4.73377 4.7721 4.80519 4.83338 + 4.85732 4.87815 4.89514 4.90927 4.92108 4.93122 4.94014 + 4.94845 4.95601 4.96251 4.96576 4.969 4.97225 4.9755 4.97874 + 4.98087 4.98265 4.98442 4.9862 4.98797 4.98924 4.9899 4.99055 + 4.9912 4.99186 4.99251 4.99316 4.99381 4.99447 4.99512 4.99577 + 4.99609 4.99634 4.99659 4.99683 4.99708 4.99732 4.99757 + 4.99782 4.99806 4.99831 4.99853 4.99863 4.99873 4.99883 + 4.99893 4.99903 4.99913 4.99923 4.99933 EOD @v[14].set(<<-'EOD') - 1.86175 2.00147 1.85141 1.0654 0.275481 0.205547 0.0712627 - 0.0313387 0.0151431 0.00864531 0.00593861 0.00438111 0.0037479 - 0.00305857 0.00221221 0.0017081 -0.0896128 -0.109079 -0.121356 - -0.0542001 0.175821 0.177442 0.0814591 0.0333042 0.0134909 - 0.00625777 0.00100092 -0.00552776 -0.00411139 -0.00150395 - -0.000564784 3.48169e-05 -0.000287014 -0.000538515 -0.000456537 - -0.000325677 -0.000275468 -0.000166452 -8.27481e-05 -8.28704e-05 - -7.47644e-05 -4.60552e-05 -2.61481e-06 2.26359e-05 2.53852e-05 - -1.39853e-06 -4.23456e-05 -4.0907e-05 -2.8501e-05 -1.5945e-05 - -9.01122e-06 -2.07747e-06 1.49328e-06 4.38398e-06 6.84248e-06 - 4.76711e-06 2.69173e-06 6.16362e-07 -1.45901e-06 -3.53438e-06 - -4.14256e-06 -3.76238e-06 -3.3822e-06 -3.00202e-06 -2.62184e-06 - -2.24878e-06 -1.93456e-06 -1.62033e-06 -1.3061e-06 -9.91867e-07 - -6.77638e-07 -3.63409e-07 -4.91792e-08 2.6505e-07 5.7928e-07 - 8.93509e-07 1.16076e-06 1.11055e-06 1.06034e-06 1.01014e-06 - 9.59927e-07 9.09719e-07 8.59511e-07 8.09302e-07 7.59094e-07 - 7.08886e-07 6.58678e-07 5.99251e-07 4.87523e-07 3.75795e-07 - 2.64068e-07 1.5234e-07 4.06119e-08 -7.1116e-08 -1.82844e-07 - -2.94572e-07 -4.063e-07 -5.18027e-07 -6.08517e-07 -5.95879e-07 - -5.83241e-07 -5.70604e-07 -5.57966e-07 -5.45328e-07 -5.3269e-07 - -5.20053e-07 -5.07415e-07 -4.94777e-07 -4.8214e-07 -4.69502e-07 - -4.56864e-07 -4.44226e-07 -4.31589e-07 -4.18951e-07 -4.06313e-07 - -3.93676e-07 -3.81038e-07 -3.684e-07 -3.55762e-07 -3.43125e-07 - 1.06736e-05 0.0797407 0.0437947 -0.0645098 -0.0877312 0.0653203 - -0.00621184 -0.0353188 -0.0491378 -0.0251957 -0.0110996 - -0.00481123 -0.0020941 -0.000998038 -0.000478747 -0.000445332 - -0.102046 -0.135753 -0.154351 -0.0827509 0.163348 0.174012 - 0.0794822 0.0310624 0.0112213 0.00249061 0.00130764 0.00181315 - 0.00163875 0.00101454 0.000497435 0.000195258 5.31901e-05 - 2.4607e-05 6.62736e-05 7.90718e-05 4.0372e-05 -0.000141184 - -0.000280623 5.5608e-05 0.000799565 0.000920189 0.000931616 - 0.000494527 0.000162303 -8.24884e-05 -0.000183938 -0.000203899 - -0.000144788 -9.87063e-05 -0.000227929 2.93932e-05 0.000208563 - 1.88958e-06 -7.6335e-05 -0.000172472 -0.000165656 -0.000145889 - -0.000177311 -0.000191058 -0.000168287 -0.00015755 -0.00013142 - -8.10488e-05 -6.36115e-05 -7.8699e-05 -8.11282e-05 -7.98625e-05 - -5.98807e-05 -3.40879e-05 -1.95464e-05 -1.79247e-05 -4.45514e-05 - -7.47995e-05 -8.7682e-05 -7.50806e-05 -3.25561e-05 -4.34114e-05 - -7.69099e-05 -0.000141101 -0.00018743 -0.000148471 -5.06546e-05 - 0.000120195 0.000177635 0.000177052 0.000146344 9.75126e-05 - 8.31233e-05 6.8734e-05 5.43447e-05 3.99554e-05 2.55661e-05 - 1.11768e-05 -3.21253e-06 -3.88937e-06 -3.56628e-06 -3.24318e-06 - -2.92008e-06 -2.59699e-06 -2.27389e-06 -1.9508e-06 -1.73227e-06 - -1.56796e-06 -1.40365e-06 -1.23934e-06 -1.07503e-06 -9.10722e-07 - -7.46412e-07 -5.82101e-07 -4.1779e-07 -2.5348e-07 -8.91694e-08 - 7.51412e-08 2.39452e-07 4.03762e-07 5.95733e-07 1.00771e-06 - 1.41969e-06 1.83167e-06 2.24365e-06 0.0828257 0.231038 0.465438 - 1.54516 2.8461 3.19221 3.40395 3.6382 3.80758 3.93848 4.04882 - 4.15428 4.247 4.32917 4.40235 4.36941 4.397 4.48862 4.64552 - 4.86595 5.03475 5.0348 5.02627 5.01967 5.01542 5.00925 4.98613 - 4.9519 4.91581 4.87357 4.82302 4.80403 4.82565 4.86102 4.89483 - 4.92253 4.94428 4.96257 4.97608 4.98373 4.98823 4.99182 - 4.99437 4.99635 4.99745 4.99802 4.99843 4.99873 4.99895 - 4.99912 4.99925 4.99931 4.99962 4.99973 4.99972 4.99971 - 4.9997 4.99969 4.9997 4.99971 4.99973 4.99974 4.99976 4.99978 - 4.9998 4.99982 4.99985 4.99987 4.99989 4.9999 4.99991 4.99991 - 4.99993 4.99994 4.99997 5.00001 5.00006 5.00008 5.00006 - 5.00002 5 4.99999 4.99998 4.99997 4.99995 4.99995 4.99995 - 4.99995 4.99995 4.99995 4.99995 4.99996 4.99997 4.99997 - 4.99998 4.99999 5 5 5.00001 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00001 - 5.00001 5.00001 5.00001 5.00001 5 5 5 4.99999 4.99999 4.99999 + 1.86175 2.00147 1.85141 1.0654 0.275481 0.205547 0.0712627 + 0.0313387 0.0151431 0.00864531 0.00593861 0.00438111 0.0037479 + 0.00305857 0.00221221 0.0017081 -0.0896128 -0.109079 -0.121356 + -0.0542001 0.175821 0.177442 0.0814591 0.0333042 0.0134909 + 0.00625777 0.00100092 -0.00552776 -0.00411139 -0.00150395 + -0.000564784 3.48169e-05 -0.000287014 -0.000538515 -0.000456537 + -0.000325677 -0.000275468 -0.000166452 -8.27481e-05 -8.28704e-05 + -7.47644e-05 -4.60552e-05 -2.61481e-06 2.26359e-05 2.53852e-05 + -1.39853e-06 -4.23456e-05 -4.0907e-05 -2.8501e-05 -1.5945e-05 + -9.01122e-06 -2.07747e-06 1.49328e-06 4.38398e-06 6.84248e-06 + 4.76711e-06 2.69173e-06 6.16362e-07 -1.45901e-06 -3.53438e-06 + -4.14256e-06 -3.76238e-06 -3.3822e-06 -3.00202e-06 -2.62184e-06 + -2.24878e-06 -1.93456e-06 -1.62033e-06 -1.3061e-06 -9.91867e-07 + -6.77638e-07 -3.63409e-07 -4.91792e-08 2.6505e-07 5.7928e-07 + 8.93509e-07 1.16076e-06 1.11055e-06 1.06034e-06 1.01014e-06 + 9.59927e-07 9.09719e-07 8.59511e-07 8.09302e-07 7.59094e-07 + 7.08886e-07 6.58678e-07 5.99251e-07 4.87523e-07 3.75795e-07 + 2.64068e-07 1.5234e-07 4.06119e-08 -7.1116e-08 -1.82844e-07 + -2.94572e-07 -4.063e-07 -5.18027e-07 -6.08517e-07 -5.95879e-07 + -5.83241e-07 -5.70604e-07 -5.57966e-07 -5.45328e-07 -5.3269e-07 + -5.20053e-07 -5.07415e-07 -4.94777e-07 -4.8214e-07 -4.69502e-07 + -4.56864e-07 -4.44226e-07 -4.31589e-07 -4.18951e-07 -4.06313e-07 + -3.93676e-07 -3.81038e-07 -3.684e-07 -3.55762e-07 -3.43125e-07 + 1.06736e-05 0.0797407 0.0437947 -0.0645098 -0.0877312 0.0653203 + -0.00621184 -0.0353188 -0.0491378 -0.0251957 -0.0110996 + -0.00481123 -0.0020941 -0.000998038 -0.000478747 -0.000445332 + -0.102046 -0.135753 -0.154351 -0.0827509 0.163348 0.174012 + 0.0794822 0.0310624 0.0112213 0.00249061 0.00130764 0.00181315 + 0.00163875 0.00101454 0.000497435 0.000195258 5.31901e-05 + 2.4607e-05 6.62736e-05 7.90718e-05 4.0372e-05 -0.000141184 + -0.000280623 5.5608e-05 0.000799565 0.000920189 0.000931616 + 0.000494527 0.000162303 -8.24884e-05 -0.000183938 -0.000203899 + -0.000144788 -9.87063e-05 -0.000227929 2.93932e-05 0.000208563 + 1.88958e-06 -7.6335e-05 -0.000172472 -0.000165656 -0.000145889 + -0.000177311 -0.000191058 -0.000168287 -0.00015755 -0.00013142 + -8.10488e-05 -6.36115e-05 -7.8699e-05 -8.11282e-05 -7.98625e-05 + -5.98807e-05 -3.40879e-05 -1.95464e-05 -1.79247e-05 -4.45514e-05 + -7.47995e-05 -8.7682e-05 -7.50806e-05 -3.25561e-05 -4.34114e-05 + -7.69099e-05 -0.000141101 -0.00018743 -0.000148471 -5.06546e-05 + 0.000120195 0.000177635 0.000177052 0.000146344 9.75126e-05 + 8.31233e-05 6.8734e-05 5.43447e-05 3.99554e-05 2.55661e-05 + 1.11768e-05 -3.21253e-06 -3.88937e-06 -3.56628e-06 -3.24318e-06 + -2.92008e-06 -2.59699e-06 -2.27389e-06 -1.9508e-06 -1.73227e-06 + -1.56796e-06 -1.40365e-06 -1.23934e-06 -1.07503e-06 -9.10722e-07 + -7.46412e-07 -5.82101e-07 -4.1779e-07 -2.5348e-07 -8.91694e-08 + 7.51412e-08 2.39452e-07 4.03762e-07 5.95733e-07 1.00771e-06 + 1.41969e-06 1.83167e-06 2.24365e-06 0.0828257 0.231038 0.465438 + 1.54516 2.8461 3.19221 3.40395 3.6382 3.80758 3.93848 4.04882 + 4.15428 4.247 4.32917 4.40235 4.36941 4.397 4.48862 4.64552 + 4.86595 5.03475 5.0348 5.02627 5.01967 5.01542 5.00925 4.98613 + 4.9519 4.91581 4.87357 4.82302 4.80403 4.82565 4.86102 4.89483 + 4.92253 4.94428 4.96257 4.97608 4.98373 4.98823 4.99182 + 4.99437 4.99635 4.99745 4.99802 4.99843 4.99873 4.99895 + 4.99912 4.99925 4.99931 4.99962 4.99973 4.99972 4.99971 + 4.9997 4.99969 4.9997 4.99971 4.99973 4.99974 4.99976 4.99978 + 4.9998 4.99982 4.99985 4.99987 4.99989 4.9999 4.99991 4.99991 + 4.99993 4.99994 4.99997 5.00001 5.00006 5.00008 5.00006 + 5.00002 5 4.99999 4.99998 4.99997 4.99995 4.99995 4.99995 + 4.99995 4.99995 4.99995 4.99995 4.99996 4.99997 4.99997 + 4.99998 4.99999 5 5 5.00001 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00001 + 5.00001 5.00001 5.00001 5.00001 5 5 5 4.99999 4.99999 4.99999 EOD @v[15].set(<<-'EOD') - 1.86175 2.00199 2.08919 1.84314 1.08254 0.214737 0.0377351 - 0.00952455 0.00232763 0.000563614 0.000263477 0.000148642 - 0.000285086 0.000242592 7.34699e-05 -1.53467e-05 -0.0161874 - -0.0157876 -0.0141194 0.0132576 0.0903272 0.109938 0.0535295 - 0.0224216 0.00940945 0.00466825 -0.000649972 -0.00654752 - -0.00333248 -0.00103671 -0.000508276 -5.8896e-05 -0.00043938 - -0.000544704 -0.00044444 -0.000307093 -0.00024517 -0.000154538 - -8.78602e-05 -7.10461e-05 -6.06485e-05 -3.91039e-05 -8.45988e-06 - 9.43442e-06 1.28351e-05 -2.16734e-06 -2.6142e-05 -2.54768e-05 - -1.88997e-05 -1.17906e-05 -7.3808e-06 -2.97101e-06 1.19146e-07 - 2.94246e-06 5.38942e-06 3.88851e-06 2.38761e-06 8.86704e-07 - -6.14201e-07 -2.11511e-06 -2.59565e-06 -2.38885e-06 -2.18205e-06 - -1.97525e-06 -1.76845e-06 -1.56241e-06 -1.36258e-06 -1.16276e-06 - -9.62939e-07 -7.63116e-07 -5.63293e-07 -3.6347e-07 -1.63647e-07 - 3.61756e-08 2.35999e-07 4.35822e-07 6.07653e-07 5.90323e-07 - 5.72994e-07 5.55665e-07 5.38336e-07 5.21007e-07 5.03678e-07 - 4.86349e-07 4.6902e-07 4.51691e-07 4.34361e-07 4.11899e-07 - 3.60315e-07 3.08731e-07 2.57146e-07 2.05562e-07 1.53977e-07 - 1.02393e-07 5.08082e-08 -7.76222e-10 -5.23607e-08 -1.03945e-07 - -1.47815e-07 -1.54225e-07 -1.60635e-07 -1.67045e-07 -1.73455e-07 - -1.79864e-07 -1.86274e-07 -1.92684e-07 -1.99094e-07 -2.05504e-07 - -2.11914e-07 -2.18324e-07 -2.24734e-07 -2.31144e-07 -2.37554e-07 - -2.43964e-07 -2.50373e-07 -2.56783e-07 -2.63193e-07 -2.69603e-07 - -2.76013e-07 -2.82423e-07 2.92534e-06 0.0446777 0.024278 - -0.0518987 -0.0636547 0.00983929 -0.000518204 -0.000265194 - 0.000154772 0.000299538 3.12715e-05 -3.18225e-05 -2.48268e-05 - -1.16701e-05 -6.05117e-06 7.61116e-06 -0.0163668 -0.0158244 - -0.0141177 0.0100085 0.0857144 0.107784 0.051862 0.0204448 - 0.00629858 0.000967736 0.00121674 0.00190276 0.00154009 - 0.000860922 0.000410386 0.000164585 3.99493e-05 1.93797e-05 - 5.67594e-05 0.000110126 2.49925e-05 -7.17815e-05 -0.000142299 - -1.63109e-05 0.000439529 0.000562489 0.000594599 0.000326164 - 0.000126423 -4.26063e-05 -0.000122927 -0.000114152 -6.72706e-05 - -6.41242e-05 -0.000135588 2.61507e-05 0.000134036 6.43734e-06 - -4.6223e-05 -0.000112047 -0.000101388 -8.67847e-05 -0.000117664 - -0.000133957 -0.000116558 -0.000100873 -7.65448e-05 -4.44964e-05 - -3.6677e-05 -5.26632e-05 -5.45172e-05 -5.13545e-05 -3.73869e-05 - -1.99732e-05 -1.0907e-05 -1.10081e-05 -3.02609e-05 -5.18517e-05 - -6.13597e-05 -5.30706e-05 -2.39572e-05 -3.24146e-05 -5.70062e-05 - -0.000103448 -0.000135376 -0.0001024 -2.39007e-05 0.000110929 - 0.000151226 0.000142044 0.000105922 5.62834e-05 4.78476e-05 - 3.94117e-05 3.09759e-05 2.25401e-05 1.41042e-05 5.66837e-06 - -2.76747e-06 -3.08639e-06 -2.81341e-06 -2.54043e-06 -2.26745e-06 - -1.99447e-06 -1.72149e-06 -1.44851e-06 -1.26226e-06 -1.12096e-06 - -9.79661e-07 -8.38363e-07 -6.97065e-07 -5.55768e-07 -4.1447e-07 - -2.73173e-07 -1.31875e-07 9.42259e-09 1.5072e-07 2.92018e-07 - 4.33315e-07 5.74613e-07 7.10363e-07 8.01984e-07 8.93604e-07 - 9.85225e-07 1.07685e-06 0.04474 0.0928765 0.141327 0.0176048 - -0.071675 -0.0124613 0.989022 2.28104 3.40619 4.21417 4.67173 - 4.87438 4.96044 4.98996 4.99858 4.96672 4.89502 4.79391 - 4.76433 4.8387 4.98612 5.0161 5.01722 5.01437 5.01256 4.99827 - 4.95807 4.9209 4.88217 4.83006 4.78461 4.80759 4.85548 4.89604 - 4.9254 4.94617 4.96126 4.97374 4.98255 4.98792 4.99126 4.99361 - 4.99554 4.99699 4.99792 4.99846 4.99881 4.99905 4.99924 - 4.99938 4.99949 4.99955 4.9997 4.9998 4.99982 4.99982 4.99982 - 4.99982 4.99982 4.99983 4.99984 4.99985 4.99986 4.99987 - 4.99988 4.99989 4.9999 4.99992 4.99993 4.99994 4.99995 4.99995 - 4.99996 4.99996 4.99998 4.99999 5.00001 5.00002 5.00002 - 5.00001 5.00001 5 4.99999 4.99999 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 1.86175 2.00199 2.08919 1.84314 1.08254 0.214737 0.0377351 + 0.00952455 0.00232763 0.000563614 0.000263477 0.000148642 + 0.000285086 0.000242592 7.34699e-05 -1.53467e-05 -0.0161874 + -0.0157876 -0.0141194 0.0132576 0.0903272 0.109938 0.0535295 + 0.0224216 0.00940945 0.00466825 -0.000649972 -0.00654752 + -0.00333248 -0.00103671 -0.000508276 -5.8896e-05 -0.00043938 + -0.000544704 -0.00044444 -0.000307093 -0.00024517 -0.000154538 + -8.78602e-05 -7.10461e-05 -6.06485e-05 -3.91039e-05 -8.45988e-06 + 9.43442e-06 1.28351e-05 -2.16734e-06 -2.6142e-05 -2.54768e-05 + -1.88997e-05 -1.17906e-05 -7.3808e-06 -2.97101e-06 1.19146e-07 + 2.94246e-06 5.38942e-06 3.88851e-06 2.38761e-06 8.86704e-07 + -6.14201e-07 -2.11511e-06 -2.59565e-06 -2.38885e-06 -2.18205e-06 + -1.97525e-06 -1.76845e-06 -1.56241e-06 -1.36258e-06 -1.16276e-06 + -9.62939e-07 -7.63116e-07 -5.63293e-07 -3.6347e-07 -1.63647e-07 + 3.61756e-08 2.35999e-07 4.35822e-07 6.07653e-07 5.90323e-07 + 5.72994e-07 5.55665e-07 5.38336e-07 5.21007e-07 5.03678e-07 + 4.86349e-07 4.6902e-07 4.51691e-07 4.34361e-07 4.11899e-07 + 3.60315e-07 3.08731e-07 2.57146e-07 2.05562e-07 1.53977e-07 + 1.02393e-07 5.08082e-08 -7.76222e-10 -5.23607e-08 -1.03945e-07 + -1.47815e-07 -1.54225e-07 -1.60635e-07 -1.67045e-07 -1.73455e-07 + -1.79864e-07 -1.86274e-07 -1.92684e-07 -1.99094e-07 -2.05504e-07 + -2.11914e-07 -2.18324e-07 -2.24734e-07 -2.31144e-07 -2.37554e-07 + -2.43964e-07 -2.50373e-07 -2.56783e-07 -2.63193e-07 -2.69603e-07 + -2.76013e-07 -2.82423e-07 2.92534e-06 0.0446777 0.024278 + -0.0518987 -0.0636547 0.00983929 -0.000518204 -0.000265194 + 0.000154772 0.000299538 3.12715e-05 -3.18225e-05 -2.48268e-05 + -1.16701e-05 -6.05117e-06 7.61116e-06 -0.0163668 -0.0158244 + -0.0141177 0.0100085 0.0857144 0.107784 0.051862 0.0204448 + 0.00629858 0.000967736 0.00121674 0.00190276 0.00154009 + 0.000860922 0.000410386 0.000164585 3.99493e-05 1.93797e-05 + 5.67594e-05 0.000110126 2.49925e-05 -7.17815e-05 -0.000142299 + -1.63109e-05 0.000439529 0.000562489 0.000594599 0.000326164 + 0.000126423 -4.26063e-05 -0.000122927 -0.000114152 -6.72706e-05 + -6.41242e-05 -0.000135588 2.61507e-05 0.000134036 6.43734e-06 + -4.6223e-05 -0.000112047 -0.000101388 -8.67847e-05 -0.000117664 + -0.000133957 -0.000116558 -0.000100873 -7.65448e-05 -4.44964e-05 + -3.6677e-05 -5.26632e-05 -5.45172e-05 -5.13545e-05 -3.73869e-05 + -1.99732e-05 -1.0907e-05 -1.10081e-05 -3.02609e-05 -5.18517e-05 + -6.13597e-05 -5.30706e-05 -2.39572e-05 -3.24146e-05 -5.70062e-05 + -0.000103448 -0.000135376 -0.0001024 -2.39007e-05 0.000110929 + 0.000151226 0.000142044 0.000105922 5.62834e-05 4.78476e-05 + 3.94117e-05 3.09759e-05 2.25401e-05 1.41042e-05 5.66837e-06 + -2.76747e-06 -3.08639e-06 -2.81341e-06 -2.54043e-06 -2.26745e-06 + -1.99447e-06 -1.72149e-06 -1.44851e-06 -1.26226e-06 -1.12096e-06 + -9.79661e-07 -8.38363e-07 -6.97065e-07 -5.55768e-07 -4.1447e-07 + -2.73173e-07 -1.31875e-07 9.42259e-09 1.5072e-07 2.92018e-07 + 4.33315e-07 5.74613e-07 7.10363e-07 8.01984e-07 8.93604e-07 + 9.85225e-07 1.07685e-06 0.04474 0.0928765 0.141327 0.0176048 + -0.071675 -0.0124613 0.989022 2.28104 3.40619 4.21417 4.67173 + 4.87438 4.96044 4.98996 4.99858 4.96672 4.89502 4.79391 + 4.76433 4.8387 4.98612 5.0161 5.01722 5.01437 5.01256 4.99827 + 4.95807 4.9209 4.88217 4.83006 4.78461 4.80759 4.85548 4.89604 + 4.9254 4.94617 4.96126 4.97374 4.98255 4.98792 4.99126 4.99361 + 4.99554 4.99699 4.99792 4.99846 4.99881 4.99905 4.99924 + 4.99938 4.99949 4.99955 4.9997 4.9998 4.99982 4.99982 4.99982 + 4.99982 4.99982 4.99983 4.99984 4.99985 4.99986 4.99987 + 4.99988 4.99989 4.9999 4.99992 4.99993 4.99994 4.99995 4.99995 + 4.99996 4.99996 4.99998 4.99999 5.00001 5.00002 5.00002 + 5.00001 5.00001 5 4.99999 4.99999 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 EOD @v[16].set(<<-'EOD') - 1.86175 1.73073 1.50572 1.89001 3.39004 4.36034 4.79012 - 4.93798 4.98305 4.99539 4.9979 4.99904 4.99772 4.9983 4.99935 - 4.99975 4.98837 4.99456 4.99728 5.01838 5.04568 5.00759 - 4.98112 4.98479 4.99197 4.99641 4.99747 4.99775 5.00043 - 5.0007 5.00035 5.00023 4.99976 5.00002 5.00007 5.0002 4.99993 - 5.00003 5.00021 5.00006 4.99993 4.99992 5.00002 5.00013 - 5.00017 5.00009 4.99992 4.99991 4.99993 4.99996 4.99998 - 4.99999 5.00001 5.00003 5.00005 5.00004 5.00004 5.00003 - 5.00002 5.00001 5 4.99999 4.99999 4.99998 4.99998 4.99997 - 4.99997 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00002 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 5 5.01498 4.99342 4.96899 5.00301 5.02627 4.9977 - 4.99548 4.99757 5.00277 5.00245 5.0014 5.00069 5.00032 5.00014 - 5.00009 4.9867 4.99262 4.99607 5.01805 5.04713 5.00927 4.98184 - 4.98483 4.9914 4.99616 4.99902 4.9999 4.99987 4.99979 4.99981 - 4.99989 4.99994 4.99998 5.0002 5.00001 5.00008 5.00008 5.0001 - 5.00021 5.00032 5.00025 5.00019 5.00006 5.00007 4.99994 - 4.99997 4.99999 5.00023 5.00008 4.99993 4.99998 4.99986 - 4.99982 5.00003 4.99985 4.99996 5.00014 5 4.99984 4.99979 - 4.99982 4.99993 5.00008 5.00011 5.00002 4.99996 4.9999 4.99994 - 5.00001 5.00007 5.00009 4.99995 4.99978 4.99971 4.99976 - 4.99997 4.99996 4.99989 4.99972 4.99955 4.99953 4.99959 - 4.99976 4.9999 5.00005 5.00023 5.00039 5.00034 5.00029 5.00024 - 5.00019 5.00014 5.00009 5.00004 5.00003 5.00002 5.00001 - 5 5 4.99999 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 - 5.00001 5.00002 5.00003 5.00004 5.01564 5.03395 5.04932 - 5.11868 3.92502 1.31888 0.163888 0.0946876 0.0789578 0.0565084 - 0.0260333 0.0156986 0.00907667 0.00613629 0.00468417 -0.00174008 - -0.0021422 0.000586962 0.0124937 0.0147977 0.00838454 0.00039383 - -0.000522021 -0.000426598 -0.000290214 -0.00173713 -0.00384132 - -0.00382945 -0.00429219 -0.00580193 -0.00393246 0.0017543 - 0.00423045 0.00408931 0.0031976 0.00245457 0.00187293 0.00159068 - 0.00105697 0.000609902 0.000358825 0.000334125 0.000212708 - 0.000168116 8.97349e-05 5.21578e-05 3.84527e-05 2.93033e-05 - 2.10067e-05 1.59954e-05 1.13917e-05 5.49738e-06 2.77217e-05 - 6.51259e-06 -6.65468e-06 2.09837e-06 -6.617e-06 -4.80187e-06 - 1.55031e-06 4.26536e-06 7.69457e-07 -1.46213e-06 -7.25202e-07 - 3.26501e-06 6.55807e-06 7.524e-06 6.07209e-06 6.00701e-06 - 5.41166e-06 3.86573e-06 1.10651e-06 -2.74603e-06 -2.18566e-06 - 2.3658e-06 8.59956e-06 8.35046e-06 2.90621e-06 -8.75982e-07 - -1.87189e-06 -2.1528e-06 -1.94875e-06 -1.74471e-06 -1.54067e-06 - -1.33662e-06 -1.13258e-06 -8.40567e-07 -5.20743e-07 -2.00918e-07 - 1.18906e-07 4.38731e-07 6.11382e-07 6.01529e-07 5.91675e-07 - 5.81822e-07 5.71968e-07 5.62115e-07 5.52261e-07 5.42407e-07 - 5.32554e-07 5.227e-07 5.12847e-07 4.72812e-07 4.26137e-07 - 3.79462e-07 3.32786e-07 2.86111e-07 2.39436e-07 1.92761e-07 - 1.46086e-07 9.94107e-08 5.27356e-08 -2.77779e-10 -7.98079e-08 - -1.59338e-07 -2.38868e-07 -3.18398e-07 -3.97928e-07 -4.77458e-07 - -5.56988e-07 -6.36519e-07 + 1.86175 1.73073 1.50572 1.89001 3.39004 4.36034 4.79012 + 4.93798 4.98305 4.99539 4.9979 4.99904 4.99772 4.9983 4.99935 + 4.99975 4.98837 4.99456 4.99728 5.01838 5.04568 5.00759 + 4.98112 4.98479 4.99197 4.99641 4.99747 4.99775 5.00043 + 5.0007 5.00035 5.00023 4.99976 5.00002 5.00007 5.0002 4.99993 + 5.00003 5.00021 5.00006 4.99993 4.99992 5.00002 5.00013 + 5.00017 5.00009 4.99992 4.99991 4.99993 4.99996 4.99998 + 4.99999 5.00001 5.00003 5.00005 5.00004 5.00004 5.00003 + 5.00002 5.00001 5 4.99999 4.99999 4.99998 4.99998 4.99997 + 4.99997 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00002 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 5 5.01498 4.99342 4.96899 5.00301 5.02627 4.9977 + 4.99548 4.99757 5.00277 5.00245 5.0014 5.00069 5.00032 5.00014 + 5.00009 4.9867 4.99262 4.99607 5.01805 5.04713 5.00927 4.98184 + 4.98483 4.9914 4.99616 4.99902 4.9999 4.99987 4.99979 4.99981 + 4.99989 4.99994 4.99998 5.0002 5.00001 5.00008 5.00008 5.0001 + 5.00021 5.00032 5.00025 5.00019 5.00006 5.00007 4.99994 + 4.99997 4.99999 5.00023 5.00008 4.99993 4.99998 4.99986 + 4.99982 5.00003 4.99985 4.99996 5.00014 5 4.99984 4.99979 + 4.99982 4.99993 5.00008 5.00011 5.00002 4.99996 4.9999 4.99994 + 5.00001 5.00007 5.00009 4.99995 4.99978 4.99971 4.99976 + 4.99997 4.99996 4.99989 4.99972 4.99955 4.99953 4.99959 + 4.99976 4.9999 5.00005 5.00023 5.00039 5.00034 5.00029 5.00024 + 5.00019 5.00014 5.00009 5.00004 5.00003 5.00002 5.00001 + 5 5 4.99999 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 + 5.00001 5.00002 5.00003 5.00004 5.01564 5.03395 5.04932 + 5.11868 3.92502 1.31888 0.163888 0.0946876 0.0789578 0.0565084 + 0.0260333 0.0156986 0.00907667 0.00613629 0.00468417 -0.00174008 + -0.0021422 0.000586962 0.0124937 0.0147977 0.00838454 0.00039383 + -0.000522021 -0.000426598 -0.000290214 -0.00173713 -0.00384132 + -0.00382945 -0.00429219 -0.00580193 -0.00393246 0.0017543 + 0.00423045 0.00408931 0.0031976 0.00245457 0.00187293 0.00159068 + 0.00105697 0.000609902 0.000358825 0.000334125 0.000212708 + 0.000168116 8.97349e-05 5.21578e-05 3.84527e-05 2.93033e-05 + 2.10067e-05 1.59954e-05 1.13917e-05 5.49738e-06 2.77217e-05 + 6.51259e-06 -6.65468e-06 2.09837e-06 -6.617e-06 -4.80187e-06 + 1.55031e-06 4.26536e-06 7.69457e-07 -1.46213e-06 -7.25202e-07 + 3.26501e-06 6.55807e-06 7.524e-06 6.07209e-06 6.00701e-06 + 5.41166e-06 3.86573e-06 1.10651e-06 -2.74603e-06 -2.18566e-06 + 2.3658e-06 8.59956e-06 8.35046e-06 2.90621e-06 -8.75982e-07 + -1.87189e-06 -2.1528e-06 -1.94875e-06 -1.74471e-06 -1.54067e-06 + -1.33662e-06 -1.13258e-06 -8.40567e-07 -5.20743e-07 -2.00918e-07 + 1.18906e-07 4.38731e-07 6.11382e-07 6.01529e-07 5.91675e-07 + 5.81822e-07 5.71968e-07 5.62115e-07 5.52261e-07 5.42407e-07 + 5.32554e-07 5.227e-07 5.12847e-07 4.72812e-07 4.26137e-07 + 3.79462e-07 3.32786e-07 2.86111e-07 2.39436e-07 1.92761e-07 + 1.46086e-07 9.94107e-08 5.27356e-08 -2.77779e-10 -7.98079e-08 + -1.59338e-07 -2.38868e-07 -3.18398e-07 -3.97928e-07 -4.77458e-07 + -5.56988e-07 -6.36519e-07 EOD @v[17].set(<<-'EOD') - 5 5.16963 4.84136 3.33754 0.316206 0.103113 0.0273341 0.0221102 - 0.0177008 0.0143758 0.0115203 0.00929231 0.00752716 0.00625439 - 0.00489872 0.00403656 -0.0657317 -0.0256467 0.165394 0.985963 - 3.05067 4.55799 4.89728 4.92464 4.8882 4.90592 4.97315 4.99241 - 4.99694 4.99845 4.99905 4.99939 4.99959 4.99971 4.9998 4.99986 - 4.9999 4.99993 4.99995 4.99996 4.99997 4.99998 4.99998 4.99999 - 4.99999 4.99999 4.99999 4.99999 5 5.00001 5.00003 5.00005 - 5.00004 5.00002 5 4.99999 4.99999 4.99998 4.99998 4.99997 - 4.99997 4.99998 4.99998 4.99999 4.99999 5 5 5 5 5 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 - 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 - 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5 5 5 5.00025 5.1657 4.69981 2.43895 - 0.0229743 0.0351406 -0.0211974 -0.0312063 -0.0160331 -0.0021718 - -0.000766597 -0.000251052 -5.49363e-05 -3.36364e-06 -2.01983e-06 - -9.70575e-06 -0.0657007 -0.0205247 0.183332 1.07163 3.11839 - 4.46213 4.84163 4.95195 4.99159 5.02084 5.04029 5.04138 - 5.0271 5.00445 4.97957 4.95702 4.95231 4.97819 4.99191 4.9963 - 4.99822 4.99878 4.99903 4.99925 4.99942 4.9995 4.99954 4.99957 - 4.99961 4.99966 4.9997 4.99974 4.99977 4.99981 4.99983 4.99986 - 4.99988 4.9999 4.99991 4.99992 4.99994 4.99995 4.99995 4.99996 - 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 - 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5 5 5 4.99999 4.99998 4.99997 4.99996 5.14239 4.76219 - 3.16574 0.299969 0.0631609 -0.00118611 -0.00026052 -5.96333e-05 - -1.44904e-05 -4.3859e-06 -2.99454e-06 1.10547e-06 4.84662e-06 - 1.30971e-05 2.23082e-05 -0.0655844 -0.0204818 0.182507 1.05954 - 3.12277 4.46735 4.83915 4.94512 4.97679 4.98654 4.9966 5.00833 - 5.00776 5.00432 5.00199 5.00086 5.00033 5.00008 5 5.00001 - 5 5.00005 5.00002 4.99981 4.99991 4.99998 4.99979 4.99979 - 4.99984 4.9998 4.9998 5.00006 5.00002 5.00001 5 5 4.99992 - 4.99998 4.99999 5.00002 5.00014 4.99999 4.99987 4.99993 - 5.00003 5.00011 5.00005 4.99996 4.99987 4.99985 4.99994 - 5.00009 5.0001 5 4.99993 4.99997 5.00008 5.00015 5.00021 - 5.00021 5.00007 4.99978 4.99965 4.99973 4.9999 4.99992 4.99995 - 4.99997 4.99999 5.00001 5.00002 5.00001 5.00001 5.00001 - 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 5.00001 5.00002 - 5.00002 5.00002 + 5 5.16963 4.84136 3.33754 0.316206 0.103113 0.0273341 0.0221102 + 0.0177008 0.0143758 0.0115203 0.00929231 0.00752716 0.00625439 + 0.00489872 0.00403656 -0.0657317 -0.0256467 0.165394 0.985963 + 3.05067 4.55799 4.89728 4.92464 4.8882 4.90592 4.97315 4.99241 + 4.99694 4.99845 4.99905 4.99939 4.99959 4.99971 4.9998 4.99986 + 4.9999 4.99993 4.99995 4.99996 4.99997 4.99998 4.99998 4.99999 + 4.99999 4.99999 4.99999 4.99999 5 5.00001 5.00003 5.00005 + 5.00004 5.00002 5 4.99999 4.99999 4.99998 4.99998 4.99997 + 4.99997 4.99998 4.99998 4.99999 4.99999 5 5 5 5 5 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 + 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 + 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5 5 5 5.00025 5.1657 4.69981 2.43895 + 0.0229743 0.0351406 -0.0211974 -0.0312063 -0.0160331 -0.0021718 + -0.000766597 -0.000251052 -5.49363e-05 -3.36364e-06 -2.01983e-06 + -9.70575e-06 -0.0657007 -0.0205247 0.183332 1.07163 3.11839 + 4.46213 4.84163 4.95195 4.99159 5.02084 5.04029 5.04138 + 5.0271 5.00445 4.97957 4.95702 4.95231 4.97819 4.99191 4.9963 + 4.99822 4.99878 4.99903 4.99925 4.99942 4.9995 4.99954 4.99957 + 4.99961 4.99966 4.9997 4.99974 4.99977 4.99981 4.99983 4.99986 + 4.99988 4.9999 4.99991 4.99992 4.99994 4.99995 4.99995 4.99996 + 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 + 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5 5 5 4.99999 4.99998 4.99997 4.99996 5.14239 4.76219 + 3.16574 0.299969 0.0631609 -0.00118611 -0.00026052 -5.96333e-05 + -1.44904e-05 -4.3859e-06 -2.99454e-06 1.10547e-06 4.84662e-06 + 1.30971e-05 2.23082e-05 -0.0655844 -0.0204818 0.182507 1.05954 + 3.12277 4.46735 4.83915 4.94512 4.97679 4.98654 4.9966 5.00833 + 5.00776 5.00432 5.00199 5.00086 5.00033 5.00008 5 5.00001 + 5 5.00005 5.00002 4.99981 4.99991 4.99998 4.99979 4.99979 + 4.99984 4.9998 4.9998 5.00006 5.00002 5.00001 5 5 4.99992 + 4.99998 4.99999 5.00002 5.00014 4.99999 4.99987 4.99993 + 5.00003 5.00011 5.00005 4.99996 4.99987 4.99985 4.99994 + 5.00009 5.0001 5 4.99993 4.99997 5.00008 5.00015 5.00021 + 5.00021 5.00007 4.99978 4.99965 4.99973 4.9999 4.99992 4.99995 + 4.99997 4.99999 5.00001 5.00002 5.00001 5.00001 5.00001 + 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 5.00001 5.00002 + 5.00002 5.00002 EOD @v[18].set(<<-'EOD') - 5 5.0333 5.02472 4.92559 4.18383 3.93923 3.9961 4.14293 - 4.28591 4.41336 4.52157 4.61101 4.68472 4.7439 4.79294 4.83239 - 4.80697 4.78808 4.79322 4.8838 5.08529 5.21863 4.88852 3.90198 - 2.14586 0.383977 0.101103 0.0525711 0.0318287 0.020895 0.0146908 - 0.010831 0.00830272 0.00656377 0.00532066 0.00440078 0.00369956 - 0.00315713 0.00272614 0.00237965 0.00209659 0.00186339 0.00167014 - 0.0015081 0.00137172 0.00125607 0.00115393 0.00106076 0.000980166 - 0.000918015 0.000862837 0.00080766 0.000763488 0.000721541 - 0.000680825 0.000653026 0.000625226 0.000597426 0.000569627 - 0.000541827 0.000519087 0.000499756 0.000480424 0.000461093 - 0.000441761 0.000423291 0.000411941 0.00040059 0.00038924 - 0.000377889 0.000366539 0.000355188 0.000343838 0.000332487 - 0.000321137 0.000309786 0.000299055 0.000292509 0.000285963 - 0.000279417 0.000272871 0.000266325 0.000259779 0.000253233 - 0.000246686 0.00024014 0.000233594 0.000227387 0.0002231 - 0.000218813 0.000214526 0.00021024 0.000205953 0.000201666 - 0.000197379 0.000193092 0.000188805 0.000184519 0.000180526 - 0.000177963 0.0001754 0.000172837 0.000170274 0.000167711 - 0.000165148 0.000162585 0.000160022 0.000157459 0.000154895 - 0.000152332 0.000149769 0.000147206 0.000144643 0.00014208 - 0.000139517 0.000136954 0.000134391 0.000131828 0.000129265 - 0.000126702 0.000132838 0.0311184 0.163151 0.34986 0.604501 - 0.357125 0.136137 0.0711304 0.0346959 0.0212674 0.00872193 - 0.00252206 0.000455269 7.59332e-05 2.91532e-05 0.000320562 - -0.0720911 -0.0840491 -0.0791345 -0.0404143 0.0182035 -0.0235871 - -0.0426072 -0.0597501 0.00824773 0.481404 1.32496 2.11949 - 2.57317 2.58202 2.15054 1.33786 0.45702 0.153772 0.0913584 - 0.0604989 0.0421591 0.0271456 0.0170021 0.0115815 0.00907886 - 0.00742466 0.00626096 0.00531127 0.00450501 0.00381927 0.00323718 - 0.00274374 0.00232494 0.00196885 0.00166686 0.00141134 0.00119437 - 0.0010109 0.000855534 0.000723378 0.000611408 0.000516704 - 0.000436769 0.000369523 0.000313026 0.00026526 0.000223976 - 0.000188972 0.000159042 0.000134148 0.000112688 9.49738e-05 - 7.97877e-05 6.721e-05 5.65115e-05 4.77194e-05 4.03591e-05 - 3.42848e-05 2.92627e-05 2.50435e-05 2.1412e-05 1.84532e-05 - 1.58624e-05 1.34673e-05 1.14461e-05 1.00935e-05 9.12375e-06 - 8.50202e-06 7.81431e-06 7.20729e-06 6.73936e-06 6.3702e-06 - 5.90049e-06 5.43077e-06 4.96105e-06 4.49133e-06 4.02162e-06 - 3.5519e-06 3.08218e-06 2.79099e-06 2.51281e-06 2.23463e-06 - 1.95645e-06 1.67827e-06 1.40009e-06 1.12191e-06 1.01376e-06 - 9.9375e-07 9.73741e-07 9.53733e-07 9.33724e-07 9.13715e-07 - 8.93707e-07 8.73698e-07 8.5369e-07 8.33681e-07 8.13673e-07 - 7.93664e-07 7.73655e-07 7.53647e-07 7.21781e-07 5.956e-07 - 4.69419e-07 3.43239e-07 2.17058e-07 0.0284032 0.0374438 - -0.0157543 -0.0680497 0.0504768 0.0100294 0.00222261 0.000528697 - 0.000132929 3.99489e-05 2.46066e-05 4.56327e-06 -6.54853e-06 - 1.33783e-05 -3.68221e-05 -0.0724498 -0.0843663 -0.0792935 - -0.0406426 0.0200019 0.0426259 0.0220753 0.00668555 -0.000968483 - 0.024662 0.0383437 0.0911513 0.087848 0.0602076 0.0390559 - 0.0260573 0.0180444 0.012974 0.00985409 0.00788132 0.0064228 - 0.005545 0.00453571 0.00364245 0.00310278 0.00270523 0.00236439 - 0.0020945 0.00186808 0.00167493 0.00151731 0.00138594 0.00126945 - 0.00116695 0.0010762 0.000996366 0.000928387 0.000864414 - 0.000808258 0.000759574 0.000713865 0.000666712 0.000632716 - 0.000601262 0.000572163 0.000543986 0.000515253 0.0004897 - 0.000468112 0.000449313 0.000432981 0.000417911 0.000401307 - 0.000382712 0.000366678 0.000355736 0.000349171 0.000335727 - 0.000317091 0.000296086 0.000283543 0.000277366 0.000272233 - 0.000267001 0.000263147 0.000256699 0.000250251 0.000243803 - 0.000237355 0.000230907 0.000225424 0.000220247 0.000215069 - 0.000209892 0.000204714 0.000200213 0.000196548 0.000192884 - 0.00018922 0.000185556 0.000181892 0.000178228 0.000174564 - 0.0001709 0.000167236 0.000163572 0.000160824 0.000158279 - 0.000155733 0.000153187 0.000150641 0.000148095 0.000145549 - 0.000143003 0.000140457 0.000137911 0.000135457 0.000133386 - 0.000131315 0.000129245 0.000127174 0.000125103 0.000123032 - 0.000120961 0.000118891 + 5 5.0333 5.02472 4.92559 4.18383 3.93923 3.9961 4.14293 + 4.28591 4.41336 4.52157 4.61101 4.68472 4.7439 4.79294 4.83239 + 4.80697 4.78808 4.79322 4.8838 5.08529 5.21863 4.88852 3.90198 + 2.14586 0.383977 0.101103 0.0525711 0.0318287 0.020895 0.0146908 + 0.010831 0.00830272 0.00656377 0.00532066 0.00440078 0.00369956 + 0.00315713 0.00272614 0.00237965 0.00209659 0.00186339 0.00167014 + 0.0015081 0.00137172 0.00125607 0.00115393 0.00106076 0.000980166 + 0.000918015 0.000862837 0.00080766 0.000763488 0.000721541 + 0.000680825 0.000653026 0.000625226 0.000597426 0.000569627 + 0.000541827 0.000519087 0.000499756 0.000480424 0.000461093 + 0.000441761 0.000423291 0.000411941 0.00040059 0.00038924 + 0.000377889 0.000366539 0.000355188 0.000343838 0.000332487 + 0.000321137 0.000309786 0.000299055 0.000292509 0.000285963 + 0.000279417 0.000272871 0.000266325 0.000259779 0.000253233 + 0.000246686 0.00024014 0.000233594 0.000227387 0.0002231 + 0.000218813 0.000214526 0.00021024 0.000205953 0.000201666 + 0.000197379 0.000193092 0.000188805 0.000184519 0.000180526 + 0.000177963 0.0001754 0.000172837 0.000170274 0.000167711 + 0.000165148 0.000162585 0.000160022 0.000157459 0.000154895 + 0.000152332 0.000149769 0.000147206 0.000144643 0.00014208 + 0.000139517 0.000136954 0.000134391 0.000131828 0.000129265 + 0.000126702 0.000132838 0.0311184 0.163151 0.34986 0.604501 + 0.357125 0.136137 0.0711304 0.0346959 0.0212674 0.00872193 + 0.00252206 0.000455269 7.59332e-05 2.91532e-05 0.000320562 + -0.0720911 -0.0840491 -0.0791345 -0.0404143 0.0182035 -0.0235871 + -0.0426072 -0.0597501 0.00824773 0.481404 1.32496 2.11949 + 2.57317 2.58202 2.15054 1.33786 0.45702 0.153772 0.0913584 + 0.0604989 0.0421591 0.0271456 0.0170021 0.0115815 0.00907886 + 0.00742466 0.00626096 0.00531127 0.00450501 0.00381927 0.00323718 + 0.00274374 0.00232494 0.00196885 0.00166686 0.00141134 0.00119437 + 0.0010109 0.000855534 0.000723378 0.000611408 0.000516704 + 0.000436769 0.000369523 0.000313026 0.00026526 0.000223976 + 0.000188972 0.000159042 0.000134148 0.000112688 9.49738e-05 + 7.97877e-05 6.721e-05 5.65115e-05 4.77194e-05 4.03591e-05 + 3.42848e-05 2.92627e-05 2.50435e-05 2.1412e-05 1.84532e-05 + 1.58624e-05 1.34673e-05 1.14461e-05 1.00935e-05 9.12375e-06 + 8.50202e-06 7.81431e-06 7.20729e-06 6.73936e-06 6.3702e-06 + 5.90049e-06 5.43077e-06 4.96105e-06 4.49133e-06 4.02162e-06 + 3.5519e-06 3.08218e-06 2.79099e-06 2.51281e-06 2.23463e-06 + 1.95645e-06 1.67827e-06 1.40009e-06 1.12191e-06 1.01376e-06 + 9.9375e-07 9.73741e-07 9.53733e-07 9.33724e-07 9.13715e-07 + 8.93707e-07 8.73698e-07 8.5369e-07 8.33681e-07 8.13673e-07 + 7.93664e-07 7.73655e-07 7.53647e-07 7.21781e-07 5.956e-07 + 4.69419e-07 3.43239e-07 2.17058e-07 0.0284032 0.0374438 + -0.0157543 -0.0680497 0.0504768 0.0100294 0.00222261 0.000528697 + 0.000132929 3.99489e-05 2.46066e-05 4.56327e-06 -6.54853e-06 + 1.33783e-05 -3.68221e-05 -0.0724498 -0.0843663 -0.0792935 + -0.0406426 0.0200019 0.0426259 0.0220753 0.00668555 -0.000968483 + 0.024662 0.0383437 0.0911513 0.087848 0.0602076 0.0390559 + 0.0260573 0.0180444 0.012974 0.00985409 0.00788132 0.0064228 + 0.005545 0.00453571 0.00364245 0.00310278 0.00270523 0.00236439 + 0.0020945 0.00186808 0.00167493 0.00151731 0.00138594 0.00126945 + 0.00116695 0.0010762 0.000996366 0.000928387 0.000864414 + 0.000808258 0.000759574 0.000713865 0.000666712 0.000632716 + 0.000601262 0.000572163 0.000543986 0.000515253 0.0004897 + 0.000468112 0.000449313 0.000432981 0.000417911 0.000401307 + 0.000382712 0.000366678 0.000355736 0.000349171 0.000335727 + 0.000317091 0.000296086 0.000283543 0.000277366 0.000272233 + 0.000267001 0.000263147 0.000256699 0.000250251 0.000243803 + 0.000237355 0.000230907 0.000225424 0.000220247 0.000215069 + 0.000209892 0.000204714 0.000200213 0.000196548 0.000192884 + 0.00018922 0.000185556 0.000181892 0.000178228 0.000174564 + 0.0001709 0.000167236 0.000163572 0.000160824 0.000158279 + 0.000155733 0.000153187 0.000150641 0.000148095 0.000145549 + 0.000143003 0.000140457 0.000137911 0.000135457 0.000133386 + 0.000131315 0.000129245 0.000127174 0.000125103 0.000123032 + 0.000120961 0.000118891 EOD @v[19].set(<<-'EOD') - 1.86175 1.99994 2.0833 2.01627 2.42503 3.25769 3.62134 3.88827 - 4.09688 4.26773 4.40529 4.51734 4.60827 4.68313 4.74346 - 4.79302 4.72815 4.68959 4.70421 4.81316 5.01375 5.14493 - 5.10305 5.0699 5.04484 5.03751 5.03348 5.02504 5.01799 5.01271 - 5.00895 5.00628 5.0044 5.00309 5.00216 5.00151 5.00105 5.00073 - 5.00051 5.00034 5.00023 5.00015 5.0001 5.00007 5.00003 4.99998 - 4.99993 4.99993 4.99995 4.99999 5.00001 5.00003 5.00002 - 5.00001 5 5 5 5 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00017 5.17398 - 4.94779 3.78508 1.52302 0.608808 0.244311 0.126053 0.0597175 - 0.038422 0.0158174 0.00481338 0.00107847 0.000301256 0.000114861 - 0.00059489 -0.118904 -0.147478 -0.158986 -0.080544 0.165361 - 0.171378 0.0776087 0.0435738 0.0428235 0.0423755 0.0347695 - 0.0225061 0.0155539 0.0121357 0.0107997 0.0103976 0.0124406 - 0.016814 0.0167556 0.0149852 0.01459 0.0141182 0.0131934 - 0.0120286 0.0108692 0.0097184 0.00855881 0.00744912 0.00643877 - 0.00554044 0.00475165 0.00406535 0.00347158 0.00295981 0.00251995 - 0.00214318 0.00182101 0.00154613 0.00131196 0.0011119 0.000941587 - 0.000796999 0.000674582 0.000571283 0.000484276 0.000410649 - 0.000347005 0.000292984 0.000246715 0.000208143 0.00017489 - 0.000147412 0.000123854 0.000104332 8.77229e-05 7.40686e-05 - 6.2637e-05 5.32e-05 4.53946e-05 3.88343e-05 3.31864e-05 - 2.85905e-05 2.45725e-05 2.08671e-05 1.77301e-05 1.55911e-05 - 1.40153e-05 1.29421e-05 1.18693e-05 1.09815e-05 1.03484e-05 - 9.87664e-06 9.14446e-06 8.41228e-06 7.68011e-06 6.94793e-06 - 6.21575e-06 5.48357e-06 4.7514e-06 4.38454e-06 4.04432e-06 - 3.7041e-06 3.36388e-06 3.02366e-06 2.68344e-06 2.34322e-06 - 2.15196e-06 2.03791e-06 1.92386e-06 1.80982e-06 1.69577e-06 - 1.58173e-06 1.46768e-06 1.35363e-06 1.23959e-06 1.12554e-06 - 1.0115e-06 8.9745e-07 7.83404e-07 6.69358e-07 4.76113e-07 - -3.47071e-07 -1.17025e-06 -1.99344e-06 -2.81662e-06 0.0783754 - 0.0500262 -0.0659563 -0.120914 0.0815957 0.0154255 0.00347177 - 0.000840357 0.000214582 6.54655e-05 3.91709e-05 8.07396e-06 - -4.44265e-07 1.74384e-05 -4.52725e-05 -0.119379 -0.147984 - -0.159247 -0.0824604 0.169014 0.177628 0.0758742 0.010558 - -0.0346506 -0.0710288 -0.0838952 -0.0599521 -0.034568 -0.0181615 - -0.00968034 -0.00547115 -0.00333511 -0.00232468 -0.00181159 - -0.00143841 -0.00116601 -0.000839755 -0.000569764 -0.000578683 - -0.000490551 -0.000411712 -0.000437859 -0.000408185 -0.000356644 - -0.000311332 -0.000269006 -0.000221396 -0.000210054 -0.0001923 - -0.000175122 -0.000161039 -0.0001428 -0.000126123 -0.000127893 - -8.14516e-05 -0.000120166 -0.000154909 -0.000112733 -8.40377e-05 - -7.11342e-05 -8.09538e-05 -9.77789e-05 -9.82402e-05 -7.73531e-05 - -5.28255e-05 -3.1096e-05 -1.87967e-05 -1.96552e-05 -4.16655e-05 - -5.77185e-05 -5.24142e-05 -2.83153e-05 -1.90012e-05 -1.54415e-05 - -2.52569e-05 -6.23747e-05 -0.000130543 -0.000149394 -0.000110886 - -4.35517e-05 -4.17084e-05 -3.98651e-05 -3.80218e-05 -3.61785e-05 - -3.43352e-05 -3.36249e-05 -3.32729e-05 -3.29208e-05 -3.25687e-05 - -3.22166e-05 -3.17143e-05 -3.10258e-05 -3.03372e-05 -2.96486e-05 - -2.89601e-05 -2.82715e-05 -2.75829e-05 -2.68944e-05 -2.62058e-05 - -2.55173e-05 -2.48287e-05 -2.43043e-05 -2.38159e-05 -2.33276e-05 - -2.28393e-05 -2.2351e-05 -2.18626e-05 -2.13743e-05 -2.0886e-05 - -2.03977e-05 -1.99093e-05 -1.945e-05 -1.91122e-05 -1.87744e-05 - -1.84366e-05 -1.80987e-05 -1.77609e-05 -1.74231e-05 -1.70853e-05 - -1.67474e-05 + 1.86175 1.99994 2.0833 2.01627 2.42503 3.25769 3.62134 3.88827 + 4.09688 4.26773 4.40529 4.51734 4.60827 4.68313 4.74346 + 4.79302 4.72815 4.68959 4.70421 4.81316 5.01375 5.14493 + 5.10305 5.0699 5.04484 5.03751 5.03348 5.02504 5.01799 5.01271 + 5.00895 5.00628 5.0044 5.00309 5.00216 5.00151 5.00105 5.00073 + 5.00051 5.00034 5.00023 5.00015 5.0001 5.00007 5.00003 4.99998 + 4.99993 4.99993 4.99995 4.99999 5.00001 5.00003 5.00002 + 5.00001 5 5 5 5 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00017 5.17398 + 4.94779 3.78508 1.52302 0.608808 0.244311 0.126053 0.0597175 + 0.038422 0.0158174 0.00481338 0.00107847 0.000301256 0.000114861 + 0.00059489 -0.118904 -0.147478 -0.158986 -0.080544 0.165361 + 0.171378 0.0776087 0.0435738 0.0428235 0.0423755 0.0347695 + 0.0225061 0.0155539 0.0121357 0.0107997 0.0103976 0.0124406 + 0.016814 0.0167556 0.0149852 0.01459 0.0141182 0.0131934 + 0.0120286 0.0108692 0.0097184 0.00855881 0.00744912 0.00643877 + 0.00554044 0.00475165 0.00406535 0.00347158 0.00295981 0.00251995 + 0.00214318 0.00182101 0.00154613 0.00131196 0.0011119 0.000941587 + 0.000796999 0.000674582 0.000571283 0.000484276 0.000410649 + 0.000347005 0.000292984 0.000246715 0.000208143 0.00017489 + 0.000147412 0.000123854 0.000104332 8.77229e-05 7.40686e-05 + 6.2637e-05 5.32e-05 4.53946e-05 3.88343e-05 3.31864e-05 + 2.85905e-05 2.45725e-05 2.08671e-05 1.77301e-05 1.55911e-05 + 1.40153e-05 1.29421e-05 1.18693e-05 1.09815e-05 1.03484e-05 + 9.87664e-06 9.14446e-06 8.41228e-06 7.68011e-06 6.94793e-06 + 6.21575e-06 5.48357e-06 4.7514e-06 4.38454e-06 4.04432e-06 + 3.7041e-06 3.36388e-06 3.02366e-06 2.68344e-06 2.34322e-06 + 2.15196e-06 2.03791e-06 1.92386e-06 1.80982e-06 1.69577e-06 + 1.58173e-06 1.46768e-06 1.35363e-06 1.23959e-06 1.12554e-06 + 1.0115e-06 8.9745e-07 7.83404e-07 6.69358e-07 4.76113e-07 + -3.47071e-07 -1.17025e-06 -1.99344e-06 -2.81662e-06 0.0783754 + 0.0500262 -0.0659563 -0.120914 0.0815957 0.0154255 0.00347177 + 0.000840357 0.000214582 6.54655e-05 3.91709e-05 8.07396e-06 + -4.44265e-07 1.74384e-05 -4.52725e-05 -0.119379 -0.147984 + -0.159247 -0.0824604 0.169014 0.177628 0.0758742 0.010558 + -0.0346506 -0.0710288 -0.0838952 -0.0599521 -0.034568 -0.0181615 + -0.00968034 -0.00547115 -0.00333511 -0.00232468 -0.00181159 + -0.00143841 -0.00116601 -0.000839755 -0.000569764 -0.000578683 + -0.000490551 -0.000411712 -0.000437859 -0.000408185 -0.000356644 + -0.000311332 -0.000269006 -0.000221396 -0.000210054 -0.0001923 + -0.000175122 -0.000161039 -0.0001428 -0.000126123 -0.000127893 + -8.14516e-05 -0.000120166 -0.000154909 -0.000112733 -8.40377e-05 + -7.11342e-05 -8.09538e-05 -9.77789e-05 -9.82402e-05 -7.73531e-05 + -5.28255e-05 -3.1096e-05 -1.87967e-05 -1.96552e-05 -4.16655e-05 + -5.77185e-05 -5.24142e-05 -2.83153e-05 -1.90012e-05 -1.54415e-05 + -2.52569e-05 -6.23747e-05 -0.000130543 -0.000149394 -0.000110886 + -4.35517e-05 -4.17084e-05 -3.98651e-05 -3.80218e-05 -3.61785e-05 + -3.43352e-05 -3.36249e-05 -3.32729e-05 -3.29208e-05 -3.25687e-05 + -3.22166e-05 -3.17143e-05 -3.10258e-05 -3.03372e-05 -2.96486e-05 + -2.89601e-05 -2.82715e-05 -2.75829e-05 -2.68944e-05 -2.62058e-05 + -2.55173e-05 -2.48287e-05 -2.43043e-05 -2.38159e-05 -2.33276e-05 + -2.28393e-05 -2.2351e-05 -2.18626e-05 -2.13743e-05 -2.0886e-05 + -2.03977e-05 -1.99093e-05 -1.945e-05 -1.91122e-05 -1.87744e-05 + -1.84366e-05 -1.80987e-05 -1.77609e-05 -1.74231e-05 -1.70853e-05 + -1.67474e-05 EOD @v[20].set(<<-'EOD') - 1.86175 1.99724 2.17266 2.48439 3.15933 3.85231 4.38091 - 4.69033 4.85034 4.92851 4.96453 4.98188 4.98736 4.991 4.99482 - 4.9973 4.96422 4.89989 4.83907 4.83151 4.90868 5.04854 5.06104 - 5.04571 5.03219 5.03025 5.02273 5.01707 5.0123 5.0087 5.00611 - 5.00429 5.00301 5.00211 5.00148 5.00103 5.00072 5.0005 5.00035 - 5.00024 5.00016 5.00011 5.00007 5.00005 5.00003 5.00001 - 4.99999 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 - 5 5 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 - 5 5 4.99981 5.10081 5.10903 4.98404 5.00999 5.14946 4.36501 - 2.23938 0.325144 0.00660272 -0.0102186 -0.0082401 -0.00556785 - -0.00374178 -0.00264763 -0.00202823 -0.0182241 -0.0169551 - -0.0150395 0.0103736 0.0877592 0.104382 0.0515938 0.0373818 - 0.0411547 0.0397009 0.0308946 0.0205793 0.0154037 0.0129191 - 0.0119327 0.011527 0.0124295 0.0161152 0.0161076 0.0145391 - 0.0144541 0.0139287 0.0129215 0.0117239 0.0105795 0.00942983 - 0.00827423 0.00718354 0.00619954 0.00532868 0.00456631 0.00390448 - 0.00333254 0.00284003 0.00241714 0.00205524 0.0017458 0.00148202 - 0.00125739 0.0010655 0.000902213 0.000763611 0.000646279 - 0.000547291 0.000463934 0.000393401 0.000332424 0.000280655 - 0.000236328 0.000199386 0.000167536 0.000141218 0.000118654 - 9.99559e-05 8.40479e-05 7.09694e-05 6.00188e-05 5.09786e-05 - 4.3502e-05 3.72191e-05 3.18114e-05 2.74071e-05 2.35539e-05 - 1.99967e-05 1.69871e-05 1.49449e-05 1.3451e-05 1.24492e-05 - 1.14256e-05 1.05669e-05 9.94487e-06 9.47514e-06 8.77318e-06 - 8.07123e-06 7.36927e-06 6.66731e-06 5.96536e-06 5.2634e-06 - 4.56144e-06 4.23044e-06 3.92649e-06 3.62254e-06 3.31858e-06 - 3.01463e-06 2.71068e-06 2.40673e-06 2.23063e-06 2.12082e-06 - 2.01102e-06 1.90121e-06 1.7914e-06 1.68159e-06 1.57178e-06 - 1.46197e-06 1.35216e-06 1.24235e-06 1.13255e-06 1.02274e-06 - 9.12929e-07 8.0312e-07 6.33171e-07 -1.51288e-08 -6.63428e-07 - -1.31173e-06 -1.96003e-06 0.0437517 0.0265689 -0.0515377 - -0.0658688 0.010727 -0.000511921 -8.36924e-05 2.13278e-05 - 1.45207e-05 4.54862e-06 -6.14726e-06 2.0062e-06 1.02709e-06 - 1.4152e-05 -3.08225e-05 -0.0166501 -0.0157139 -0.013957 - 0.0107537 0.0873717 0.111302 0.0454129 -0.00530142 -0.0468336 - -0.0790063 -0.0826944 -0.0534753 -0.0288705 -0.0149009 -0.00801592 - -0.0046342 -0.00291835 -0.00213019 -0.00170055 -0.001352 - -0.00110593 -0.000742655 -0.000532042 -0.000544742 -0.000479206 - -0.000407307 -0.000403575 -0.000366209 -0.000324161 -0.000286183 - -0.000247579 -0.000214281 -0.000203435 -0.000186896 -0.000171033 - -0.00015779 -0.000145259 -0.000128069 -0.000122647 -9.89398e-05 - -0.000114926 -0.000132195 -0.000107872 -8.91015e-05 -7.87996e-05 - -8.14061e-05 -8.9098e-05 -8.83368e-05 -7.6122e-05 -6.14668e-05 - -4.75402e-05 -3.81855e-05 -3.69696e-05 -4.78656e-05 -5.61346e-05 - -5.35007e-05 -4.1459e-05 -3.35411e-05 -2.52374e-05 -2.37479e-05 - -4.6406e-05 -9.41884e-05 -0.000109222 -8.52676e-05 -4.25166e-05 - -4.10125e-05 -3.95085e-05 -3.80045e-05 -3.65004e-05 -3.49964e-05 - -3.41627e-05 -3.3541e-05 -3.29193e-05 -3.22976e-05 -3.16758e-05 - -3.10334e-05 -3.03653e-05 -2.96971e-05 -2.9029e-05 -2.83609e-05 - -2.76928e-05 -2.70246e-05 -2.63565e-05 -2.56884e-05 -2.50203e-05 - -2.43521e-05 -2.38716e-05 -2.34324e-05 -2.29932e-05 -2.25539e-05 - -2.21147e-05 -2.16755e-05 -2.12362e-05 -2.0797e-05 -2.03578e-05 - -1.99186e-05 -1.95079e-05 -1.9217e-05 -1.8926e-05 -1.8635e-05 - -1.8344e-05 -1.8053e-05 -1.7762e-05 -1.74711e-05 -1.71801e-05 + 1.86175 1.99724 2.17266 2.48439 3.15933 3.85231 4.38091 + 4.69033 4.85034 4.92851 4.96453 4.98188 4.98736 4.991 4.99482 + 4.9973 4.96422 4.89989 4.83907 4.83151 4.90868 5.04854 5.06104 + 5.04571 5.03219 5.03025 5.02273 5.01707 5.0123 5.0087 5.00611 + 5.00429 5.00301 5.00211 5.00148 5.00103 5.00072 5.0005 5.00035 + 5.00024 5.00016 5.00011 5.00007 5.00005 5.00003 5.00001 + 4.99999 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 + 5 5 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 + 5 5 4.99981 5.10081 5.10903 4.98404 5.00999 5.14946 4.36501 + 2.23938 0.325144 0.00660272 -0.0102186 -0.0082401 -0.00556785 + -0.00374178 -0.00264763 -0.00202823 -0.0182241 -0.0169551 + -0.0150395 0.0103736 0.0877592 0.104382 0.0515938 0.0373818 + 0.0411547 0.0397009 0.0308946 0.0205793 0.0154037 0.0129191 + 0.0119327 0.011527 0.0124295 0.0161152 0.0161076 0.0145391 + 0.0144541 0.0139287 0.0129215 0.0117239 0.0105795 0.00942983 + 0.00827423 0.00718354 0.00619954 0.00532868 0.00456631 0.00390448 + 0.00333254 0.00284003 0.00241714 0.00205524 0.0017458 0.00148202 + 0.00125739 0.0010655 0.000902213 0.000763611 0.000646279 + 0.000547291 0.000463934 0.000393401 0.000332424 0.000280655 + 0.000236328 0.000199386 0.000167536 0.000141218 0.000118654 + 9.99559e-05 8.40479e-05 7.09694e-05 6.00188e-05 5.09786e-05 + 4.3502e-05 3.72191e-05 3.18114e-05 2.74071e-05 2.35539e-05 + 1.99967e-05 1.69871e-05 1.49449e-05 1.3451e-05 1.24492e-05 + 1.14256e-05 1.05669e-05 9.94487e-06 9.47514e-06 8.77318e-06 + 8.07123e-06 7.36927e-06 6.66731e-06 5.96536e-06 5.2634e-06 + 4.56144e-06 4.23044e-06 3.92649e-06 3.62254e-06 3.31858e-06 + 3.01463e-06 2.71068e-06 2.40673e-06 2.23063e-06 2.12082e-06 + 2.01102e-06 1.90121e-06 1.7914e-06 1.68159e-06 1.57178e-06 + 1.46197e-06 1.35216e-06 1.24235e-06 1.13255e-06 1.02274e-06 + 9.12929e-07 8.0312e-07 6.33171e-07 -1.51288e-08 -6.63428e-07 + -1.31173e-06 -1.96003e-06 0.0437517 0.0265689 -0.0515377 + -0.0658688 0.010727 -0.000511921 -8.36924e-05 2.13278e-05 + 1.45207e-05 4.54862e-06 -6.14726e-06 2.0062e-06 1.02709e-06 + 1.4152e-05 -3.08225e-05 -0.0166501 -0.0157139 -0.013957 + 0.0107537 0.0873717 0.111302 0.0454129 -0.00530142 -0.0468336 + -0.0790063 -0.0826944 -0.0534753 -0.0288705 -0.0149009 -0.00801592 + -0.0046342 -0.00291835 -0.00213019 -0.00170055 -0.001352 + -0.00110593 -0.000742655 -0.000532042 -0.000544742 -0.000479206 + -0.000407307 -0.000403575 -0.000366209 -0.000324161 -0.000286183 + -0.000247579 -0.000214281 -0.000203435 -0.000186896 -0.000171033 + -0.00015779 -0.000145259 -0.000128069 -0.000122647 -9.89398e-05 + -0.000114926 -0.000132195 -0.000107872 -8.91015e-05 -7.87996e-05 + -8.14061e-05 -8.9098e-05 -8.83368e-05 -7.6122e-05 -6.14668e-05 + -4.75402e-05 -3.81855e-05 -3.69696e-05 -4.78656e-05 -5.61346e-05 + -5.35007e-05 -4.1459e-05 -3.35411e-05 -2.52374e-05 -2.37479e-05 + -4.6406e-05 -9.41884e-05 -0.000109222 -8.52676e-05 -4.25166e-05 + -4.10125e-05 -3.95085e-05 -3.80045e-05 -3.65004e-05 -3.49964e-05 + -3.41627e-05 -3.3541e-05 -3.29193e-05 -3.22976e-05 -3.16758e-05 + -3.10334e-05 -3.03653e-05 -2.96971e-05 -2.9029e-05 -2.83609e-05 + -2.76928e-05 -2.70246e-05 -2.63565e-05 -2.56884e-05 -2.50203e-05 + -2.43521e-05 -2.38716e-05 -2.34324e-05 -2.29932e-05 -2.25539e-05 + -2.21147e-05 -2.16755e-05 -2.12362e-05 -2.0797e-05 -2.03578e-05 + -1.99186e-05 -1.95079e-05 -1.9217e-05 -1.8926e-05 -1.8635e-05 + -1.8344e-05 -1.8053e-05 -1.7762e-05 -1.74711e-05 -1.71801e-05 EOD @v[21].set(<<-'EOD') - 1.86175 1.73273 1.42016 1.02483 0.944013 0.274107 0.0823742 - 0.0379366 0.020816 0.0132952 0.00955525 0.00717008 0.00592286 - 0.00437379 0.00383557 0.00273694 -0.0037467 -0.0054191 -0.00131454 - 0.0112179 0.0133918 0.00519747 -0.00260113 -0.00252847 -0.00181292 - 0.000183398 -0.000667607 -0.000750747 -0.000594314 -0.000433904 - -0.000308985 -0.000217858 -0.000152926 -0.000107454 -7.54076e-05 - -5.2675e-05 -3.66299e-05 -2.54341e-05 -1.75095e-05 -1.18848e-05 - -7.97289e-06 -5.30239e-06 -3.53615e-06 -2.38504e-06 -2.40158e-06 - -3.84485e-06 -5.29435e-06 -2.57099e-06 1.95189e-06 3.55083e-06 - 2.06179e-06 5.72753e-07 3.30469e-07 3.40296e-07 3.60221e-07 - 4.86081e-07 6.1194e-07 7.37799e-07 8.63659e-07 9.89518e-07 - 9.21274e-07 7.22275e-07 5.23276e-07 3.24277e-07 1.25278e-07 - -5.59467e-08 -9.03265e-08 -1.24706e-07 -1.59086e-07 -1.93466e-07 - -2.27846e-07 -2.62226e-07 -2.96605e-07 -3.30985e-07 -3.65365e-07 - -3.99745e-07 -4.24266e-07 -3.82163e-07 -3.40061e-07 -2.97959e-07 - -2.55857e-07 -2.13755e-07 -1.71652e-07 -1.2955e-07 -8.7448e-08 - -4.53457e-08 -3.24353e-09 3.76901e-08 7.19937e-08 1.06297e-07 - 1.40601e-07 1.74904e-07 2.09208e-07 2.43512e-07 2.77815e-07 - 3.12119e-07 3.46422e-07 3.80726e-07 4.04507e-07 3.77191e-07 - 3.49876e-07 3.22561e-07 2.95246e-07 2.67931e-07 2.40616e-07 - 2.13301e-07 1.85986e-07 1.58671e-07 1.31356e-07 1.04041e-07 - 7.67256e-08 4.94105e-08 2.20955e-08 -5.21962e-09 -3.25347e-08 - -5.98498e-08 -8.71649e-08 -1.1448e-07 -1.41795e-07 -1.6911e-07 - 7.87893e-06 0.0114592 -0.0245712 -0.111637 0.0961324 1.61168 - 3.22343 4.20442 4.53535 4.83834 4.95464 4.98874 4.99746 - 4.99883 4.99948 4.99815 4.98431 4.99298 4.99718 5.01948 - 5.04749 5.008 4.98243 4.98985 4.99781 4.99887 4.99679 4.99616 - 4.99743 4.99859 4.99936 4.99972 5.00058 5.00123 5.0002 4.99945 - 4.99983 4.9998 4.99966 4.99958 4.99956 4.99956 4.99956 4.99958 - 4.99961 4.99965 4.99969 4.99973 4.99977 4.9998 4.99983 4.99985 - 4.99987 4.99989 4.99991 4.99992 4.99993 4.99994 4.99995 - 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00001 5.00001 - 5.00001 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5 5 5 4.99999 4.99998 4.99997 4.99996 5.01454 - 4.99566 4.96796 4.99819 5.03232 5.00034 4.99867 4.99937 - 4.99977 4.99992 4.99997 4.99999 5.00001 5.00021 4.99974 - 4.98462 4.99301 4.99723 5.01936 5.04807 5.00929 4.9789 4.97876 - 4.98244 4.9863 4.99575 5.0069 5.00863 5.00624 5.00357 5.0019 - 5.00098 5.00048 5.00025 5.00016 5.00011 5.00013 5.00009 - 4.99982 4.99994 5.00005 4.99994 4.99988 4.99989 4.99997 - 5.00003 5.00005 5.00002 5.00001 5.00001 5.00001 4.99993 - 4.99999 5 5.00021 4.99997 4.99981 5 5.00009 5.0001 5.00001 - 4.99991 4.9999 5 5.00011 5.00017 5.00018 5.00018 5.00014 - 5.00007 4.99999 4.9999 4.9999 5.00001 5.00016 5.00014 4.99999 - 4.99993 4.99999 5.00009 5.00007 5.00006 5.00004 5.00003 - 5.00001 5.00001 5 4.99999 4.99998 4.99997 4.99997 4.99997 - 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 - 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 - 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5 5 + 1.86175 1.73273 1.42016 1.02483 0.944013 0.274107 0.0823742 + 0.0379366 0.020816 0.0132952 0.00955525 0.00717008 0.00592286 + 0.00437379 0.00383557 0.00273694 -0.0037467 -0.0054191 -0.00131454 + 0.0112179 0.0133918 0.00519747 -0.00260113 -0.00252847 -0.00181292 + 0.000183398 -0.000667607 -0.000750747 -0.000594314 -0.000433904 + -0.000308985 -0.000217858 -0.000152926 -0.000107454 -7.54076e-05 + -5.2675e-05 -3.66299e-05 -2.54341e-05 -1.75095e-05 -1.18848e-05 + -7.97289e-06 -5.30239e-06 -3.53615e-06 -2.38504e-06 -2.40158e-06 + -3.84485e-06 -5.29435e-06 -2.57099e-06 1.95189e-06 3.55083e-06 + 2.06179e-06 5.72753e-07 3.30469e-07 3.40296e-07 3.60221e-07 + 4.86081e-07 6.1194e-07 7.37799e-07 8.63659e-07 9.89518e-07 + 9.21274e-07 7.22275e-07 5.23276e-07 3.24277e-07 1.25278e-07 + -5.59467e-08 -9.03265e-08 -1.24706e-07 -1.59086e-07 -1.93466e-07 + -2.27846e-07 -2.62226e-07 -2.96605e-07 -3.30985e-07 -3.65365e-07 + -3.99745e-07 -4.24266e-07 -3.82163e-07 -3.40061e-07 -2.97959e-07 + -2.55857e-07 -2.13755e-07 -1.71652e-07 -1.2955e-07 -8.7448e-08 + -4.53457e-08 -3.24353e-09 3.76901e-08 7.19937e-08 1.06297e-07 + 1.40601e-07 1.74904e-07 2.09208e-07 2.43512e-07 2.77815e-07 + 3.12119e-07 3.46422e-07 3.80726e-07 4.04507e-07 3.77191e-07 + 3.49876e-07 3.22561e-07 2.95246e-07 2.67931e-07 2.40616e-07 + 2.13301e-07 1.85986e-07 1.58671e-07 1.31356e-07 1.04041e-07 + 7.67256e-08 4.94105e-08 2.20955e-08 -5.21962e-09 -3.25347e-08 + -5.98498e-08 -8.71649e-08 -1.1448e-07 -1.41795e-07 -1.6911e-07 + 7.87893e-06 0.0114592 -0.0245712 -0.111637 0.0961324 1.61168 + 3.22343 4.20442 4.53535 4.83834 4.95464 4.98874 4.99746 + 4.99883 4.99948 4.99815 4.98431 4.99298 4.99718 5.01948 + 5.04749 5.008 4.98243 4.98985 4.99781 4.99887 4.99679 4.99616 + 4.99743 4.99859 4.99936 4.99972 5.00058 5.00123 5.0002 4.99945 + 4.99983 4.9998 4.99966 4.99958 4.99956 4.99956 4.99956 4.99958 + 4.99961 4.99965 4.99969 4.99973 4.99977 4.9998 4.99983 4.99985 + 4.99987 4.99989 4.99991 4.99992 4.99993 4.99994 4.99995 + 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00001 5.00001 + 5.00001 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5 5 5 4.99999 4.99998 4.99997 4.99996 5.01454 + 4.99566 4.96796 4.99819 5.03232 5.00034 4.99867 4.99937 + 4.99977 4.99992 4.99997 4.99999 5.00001 5.00021 4.99974 + 4.98462 4.99301 4.99723 5.01936 5.04807 5.00929 4.9789 4.97876 + 4.98244 4.9863 4.99575 5.0069 5.00863 5.00624 5.00357 5.0019 + 5.00098 5.00048 5.00025 5.00016 5.00011 5.00013 5.00009 + 4.99982 4.99994 5.00005 4.99994 4.99988 4.99989 4.99997 + 5.00003 5.00005 5.00002 5.00001 5.00001 5.00001 4.99993 + 4.99999 5 5.00021 4.99997 4.99981 5 5.00009 5.0001 5.00001 + 4.99991 4.9999 5 5.00011 5.00017 5.00018 5.00018 5.00014 + 5.00007 4.99999 4.9999 4.9999 5.00001 5.00016 5.00014 4.99999 + 4.99993 4.99999 5.00009 5.00007 5.00006 5.00004 5.00003 + 5.00001 5.00001 5 4.99999 4.99998 4.99997 4.99997 4.99997 + 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 + 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 + 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5 5 EOD @v[22].set(<<-'EOD') - 7.10441e-10 0.00107105 0.000637109 -0.00236346 -0.018079 - -0.0120077 -0.00217059 0.00266679 0.00403383 0.00403836 - 0.00356705 0.00303303 0.00244716 0.00198586 0.0016855 0.00136497 - -3.96022e-05 -0.000367409 -3.77079e-05 0.00194085 0.00506964 - -0.0400214 -0.0402572 0.0524434 0.286234 0.803011 1.44795 - 2.02473 2.54768 3.02748 3.4415 3.78287 4.09667 4.35152 4.53987 - 4.67614 4.77407 4.84319 4.89227 4.92702 4.95119 4.96764 - 4.97846 4.98557 4.98982 4.99209 4.99371 4.99569 4.99727 - 4.99802 4.99834 4.99867 4.99892 4.99915 4.99936 4.99939 - 4.99943 4.99946 4.9995 4.99953 4.99957 4.9996 4.99963 4.99967 - 4.9997 4.99973 4.99974 4.99975 4.99976 4.99977 4.99978 4.9998 - 4.99981 4.99982 4.99983 4.99984 4.99985 4.99986 4.99986 - 4.99986 4.99987 4.99987 4.99988 4.99988 4.99989 4.99989 - 4.9999 4.9999 4.9999 4.9999 4.99991 4.99991 4.99991 4.99991 - 4.99992 4.99992 4.99992 4.99992 4.99993 4.99993 4.99993 - 4.99993 4.99993 4.99993 4.99993 4.99993 4.99994 4.99994 - 4.99994 4.99994 4.99994 4.99994 4.99994 4.99994 4.99995 - 4.99995 4.99995 4.99995 4.99995 4.99995 4.99995 5.00145 - 5.00659 5.01209 5.01931 5.00279 4.99273 4.99217 4.99295 - 4.99471 4.99594 4.99696 4.9978 4.99844 4.99891 4.99924 4.99635 - 4.99699 4.99813 5.00068 5.00307 5.0588 4.96365 4.54012 3.6307 - 2.35176 1.0322 0.354379 0.115986 0.0435668 0.0245112 0.020786 - 0.0164656 0.0118409 0.00849698 0.00597078 0.0040105 0.0026076 - 0.0016597 0.00118185 0.00121067 0.00153587 0.00174836 0.00136519 - -0.000189116 -0.00315555 -0.00646603 -0.00898042 -0.010203 - -0.0110896 -0.0123764 -0.00953841 -0.00225795 0.000818314 - 0.00152252 0.00150269 0.00119025 0.000767068 0.000308852 - -3.79272e-05 -0.00019691 -0.000186642 -9.73653e-05 -8.49784e-06 - 2.04147e-05 -9.91086e-06 -1.55959e-05 -1.80499e-05 -1.77097e-05 - -1.51548e-05 -1.1978e-05 -9.84916e-06 -1.29728e-05 -1.67235e-05 - -1.74153e-05 -1.39958e-05 -5.92272e-06 -8.08216e-06 -1.53077e-05 - -2.92531e-05 -3.91049e-05 -2.98935e-05 -7.32122e-06 3.18534e-05 - 4.39134e-05 4.18753e-05 3.22759e-05 1.86766e-05 1.58432e-05 - 1.30098e-05 1.01765e-05 7.34312e-06 4.50975e-06 1.67639e-06 - -1.15697e-06 -1.23877e-06 -1.11991e-06 -1.00106e-06 -8.82208e-07 - -7.63355e-07 -6.44502e-07 -5.2565e-07 -4.29318e-07 -3.44661e-07 - -2.60004e-07 -1.75347e-07 -9.06904e-08 -6.03349e-09 7.86234e-08 - 1.6328e-07 2.47937e-07 3.32594e-07 4.17251e-07 5.01908e-07 - 5.86565e-07 6.71222e-07 7.36123e-07 6.43886e-07 5.5165e-07 - 4.59414e-07 3.67178e-07 0.000334759 -4.60833e-05 -0.00106139 - -0.00166624 0.000859563 0.00102606 0.00410037 0.00419931 - 0.00518997 0.00459791 0.00503125 0.00523877 0.00452158 0.00339924 - 0.00233399 0.000876915 0.000546439 0.000444299 0.000983968 - 0.00119304 -0.0429422 -0.0403983 0.0534896 0.288013 0.807345 - 1.44247 2.03448 2.57021 3.05049 3.47332 3.8131 4.1009 4.34677 - 4.53512 4.67127 4.76531 4.82526 4.86593 4.89586 4.91904 - 4.93806 4.95348 4.96597 4.97629 4.9843 4.98983 4.99335 4.9957 - 4.99741 4.99864 4.99946 4.99994 5.00047 5.00073 5.00086 - 5.00092 5.00094 5.00091 5.00087 5.00081 5.00074 5.00067 - 5.00059 5.00052 5.00046 5.0004 5.00034 5.0003 5.00026 5.00022 - 5.00019 5.00016 5.00014 5.00012 5.0001 5.00009 5.00007 5.00006 - 5.00006 5.00005 5.00004 5.00004 5.00004 5.00003 5.00003 - 5.00003 5.00002 5.00002 5.00002 5.00002 5.00001 5.00001 - 5.00001 5.00001 5.00001 5 5 5 5 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5.00001 5.00001 - 5.00001 5.00001 5.00002 5.00002 + 7.10441e-10 0.00107105 0.000637109 -0.00236346 -0.018079 + -0.0120077 -0.00217059 0.00266679 0.00403383 0.00403836 + 0.00356705 0.00303303 0.00244716 0.00198586 0.0016855 0.00136497 + -3.96022e-05 -0.000367409 -3.77079e-05 0.00194085 0.00506964 + -0.0400214 -0.0402572 0.0524434 0.286234 0.803011 1.44795 + 2.02473 2.54768 3.02748 3.4415 3.78287 4.09667 4.35152 4.53987 + 4.67614 4.77407 4.84319 4.89227 4.92702 4.95119 4.96764 + 4.97846 4.98557 4.98982 4.99209 4.99371 4.99569 4.99727 + 4.99802 4.99834 4.99867 4.99892 4.99915 4.99936 4.99939 + 4.99943 4.99946 4.9995 4.99953 4.99957 4.9996 4.99963 4.99967 + 4.9997 4.99973 4.99974 4.99975 4.99976 4.99977 4.99978 4.9998 + 4.99981 4.99982 4.99983 4.99984 4.99985 4.99986 4.99986 + 4.99986 4.99987 4.99987 4.99988 4.99988 4.99989 4.99989 + 4.9999 4.9999 4.9999 4.9999 4.99991 4.99991 4.99991 4.99991 + 4.99992 4.99992 4.99992 4.99992 4.99993 4.99993 4.99993 + 4.99993 4.99993 4.99993 4.99993 4.99993 4.99994 4.99994 + 4.99994 4.99994 4.99994 4.99994 4.99994 4.99994 4.99995 + 4.99995 4.99995 4.99995 4.99995 4.99995 4.99995 5.00145 + 5.00659 5.01209 5.01931 5.00279 4.99273 4.99217 4.99295 + 4.99471 4.99594 4.99696 4.9978 4.99844 4.99891 4.99924 4.99635 + 4.99699 4.99813 5.00068 5.00307 5.0588 4.96365 4.54012 3.6307 + 2.35176 1.0322 0.354379 0.115986 0.0435668 0.0245112 0.020786 + 0.0164656 0.0118409 0.00849698 0.00597078 0.0040105 0.0026076 + 0.0016597 0.00118185 0.00121067 0.00153587 0.00174836 0.00136519 + -0.000189116 -0.00315555 -0.00646603 -0.00898042 -0.010203 + -0.0110896 -0.0123764 -0.00953841 -0.00225795 0.000818314 + 0.00152252 0.00150269 0.00119025 0.000767068 0.000308852 + -3.79272e-05 -0.00019691 -0.000186642 -9.73653e-05 -8.49784e-06 + 2.04147e-05 -9.91086e-06 -1.55959e-05 -1.80499e-05 -1.77097e-05 + -1.51548e-05 -1.1978e-05 -9.84916e-06 -1.29728e-05 -1.67235e-05 + -1.74153e-05 -1.39958e-05 -5.92272e-06 -8.08216e-06 -1.53077e-05 + -2.92531e-05 -3.91049e-05 -2.98935e-05 -7.32122e-06 3.18534e-05 + 4.39134e-05 4.18753e-05 3.22759e-05 1.86766e-05 1.58432e-05 + 1.30098e-05 1.01765e-05 7.34312e-06 4.50975e-06 1.67639e-06 + -1.15697e-06 -1.23877e-06 -1.11991e-06 -1.00106e-06 -8.82208e-07 + -7.63355e-07 -6.44502e-07 -5.2565e-07 -4.29318e-07 -3.44661e-07 + -2.60004e-07 -1.75347e-07 -9.06904e-08 -6.03349e-09 7.86234e-08 + 1.6328e-07 2.47937e-07 3.32594e-07 4.17251e-07 5.01908e-07 + 5.86565e-07 6.71222e-07 7.36123e-07 6.43886e-07 5.5165e-07 + 4.59414e-07 3.67178e-07 0.000334759 -4.60833e-05 -0.00106139 + -0.00166624 0.000859563 0.00102606 0.00410037 0.00419931 + 0.00518997 0.00459791 0.00503125 0.00523877 0.00452158 0.00339924 + 0.00233399 0.000876915 0.000546439 0.000444299 0.000983968 + 0.00119304 -0.0429422 -0.0403983 0.0534896 0.288013 0.807345 + 1.44247 2.03448 2.57021 3.05049 3.47332 3.8131 4.1009 4.34677 + 4.53512 4.67127 4.76531 4.82526 4.86593 4.89586 4.91904 + 4.93806 4.95348 4.96597 4.97629 4.9843 4.98983 4.99335 4.9957 + 4.99741 4.99864 4.99946 4.99994 5.00047 5.00073 5.00086 + 5.00092 5.00094 5.00091 5.00087 5.00081 5.00074 5.00067 + 5.00059 5.00052 5.00046 5.0004 5.00034 5.0003 5.00026 5.00022 + 5.00019 5.00016 5.00014 5.00012 5.0001 5.00009 5.00007 5.00006 + 5.00006 5.00005 5.00004 5.00004 5.00004 5.00003 5.00003 + 5.00003 5.00002 5.00002 5.00002 5.00002 5.00001 5.00001 + 5.00001 5.00001 5.00001 5 5 5 5 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5.00001 5.00001 + 5.00001 5.00001 5.00002 5.00002 EOD @v[23].set(<<-'EOD') - 5 5.00284 5.01266 5.01895 4.98936 4.99575 4.99217 4.99545 - 4.99775 4.99894 4.99946 4.99968 4.99975 4.99977 4.99986 - 4.9999 4.99528 4.99808 5.00039 5.00392 5.00512 4.99985 4.99863 - 4.99942 4.99992 5.00017 4.99897 4.99803 4.99784 4.99739 - 4.99883 5.00365 5.00298 5.00133 5.00048 5.00019 5.00008 - 5.00005 5.00004 5.00003 5.00002 5.00002 5.00001 5.00001 - 5.00001 5.00001 5.00001 5 5 4.99999 4.99997 4.99995 4.99996 - 4.99998 5 5.00001 5.00001 5.00002 5.00002 5.00003 5.00003 - 5.00002 5.00002 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99998 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 - 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5 5 5 5 5 5 5 5.00217 5.00108 4.99547 4.99658 5.00667 - 4.99641 4.99532 4.99938 5.00328 5.00222 5.00114 5.00052 - 5.00024 5.00011 5.00009 4.99285 4.99591 4.99897 5.00403 - 5.00786 5.00318 4.99942 4.9992 4.99949 5.001 5.00408 5.00319 - 5.00063 4.99995 5.00014 4.99982 4.99832 4.99838 4.99865 - 4.99912 4.99836 4.99735 4.99606 4.99814 5.00958 5.02973 - 5.05293 5.06103 4.99342 4.80726 4.50744 4.07509 3.41358 - 2.37924 1.03194 0.261552 0.142392 0.0904482 0.0555071 0.0322869 - 0.018289 0.0113802 0.00875182 0.00757055 0.00629906 0.00523 - 0.00403349 0.0031953 0.00280864 0.00286119 0.00250389 0.00202815 - 0.001723 0.00147312 0.0012411 0.00104401 0.000886204 0.000758277 - 0.000651915 0.00056348 0.000487966 0.000424048 0.000365613 - 0.000308178 0.000258725 0.000228061 0.000207976 0.000198491 - 0.00018518 0.000172716 0.000163197 0.000155007 0.000141734 - 0.000128461 0.000115188 0.000101915 8.86417e-05 7.53686e-05 - 6.20956e-05 5.69164e-05 5.23275e-05 4.77385e-05 4.31495e-05 - 3.85605e-05 3.39716e-05 2.93826e-05 2.69449e-05 2.56224e-05 - 2.42999e-05 2.29774e-05 2.16549e-05 2.03324e-05 1.90099e-05 - 1.76873e-05 1.63648e-05 1.50423e-05 1.37198e-05 1.23973e-05 - 1.10748e-05 9.75232e-06 8.48447e-06 7.65129e-06 6.81811e-06 - 5.98494e-06 5.15176e-06 0.00056893 -0.00787906 -0.0217381 - -0.0370066 -0.00770505 0.00659312 0.00975477 0.00949456 - 0.00777552 0.00655645 0.00568776 0.00508782 0.00458121 0.00410187 - 0.00365665 0.0015121 0.00160863 0.00263181 0.00638941 0.00772607 - 0.00225583 0.0010843 0.000882939 0.000801563 0.00075632 - 0.000554992 0.000435131 0.0003474 0.000217667 0.000491602 - 0.0012267 0.00250446 0.000212058 -0.0174972 -0.0527527 -0.0479071 - 0.194908 1.45838 3.40677 4.49242 4.86894 4.97215 5.01218 - 5.04342 5.06228 5.03069 4.87169 4.57056 4.11523 3.38264 - 2.19691 0.715839 0.172818 0.102162 0.0627162 0.0363388 0.020289 - 0.0119414 0.00826608 0.0066417 0.00549092 0.00492505 0.00439443 - 0.0037156 0.00306471 0.00247451 0.00195965 0.0014822 0.0010815 - 0.000904464 0.0010514 0.00152308 0.00120752 0.000228447 - -0.00102833 -0.00116644 -0.00042067 4.78758e-05 5.09599e-05 - -4.45756e-05 -3.22966e-06 3.81163e-05 7.94622e-05 0.000120808 - 0.000162154 0.000161895 0.000148481 0.000135068 0.000121654 - 0.000108241 9.81453e-05 9.2164e-05 8.61827e-05 8.02014e-05 - 7.42201e-05 6.82388e-05 6.22576e-05 5.62763e-05 5.0295e-05 - 4.43137e-05 3.83324e-05 3.54323e-05 3.321e-05 3.09877e-05 - 2.87654e-05 2.65431e-05 2.43209e-05 2.20986e-05 1.98763e-05 - 1.7654e-05 1.54317e-05 1.34612e-05 1.25441e-05 1.1627e-05 - 1.07099e-05 9.79276e-06 8.87564e-06 7.95851e-06 7.04139e-06 - 6.12427e-06 + 5 5.00284 5.01266 5.01895 4.98936 4.99575 4.99217 4.99545 + 4.99775 4.99894 4.99946 4.99968 4.99975 4.99977 4.99986 + 4.9999 4.99528 4.99808 5.00039 5.00392 5.00512 4.99985 4.99863 + 4.99942 4.99992 5.00017 4.99897 4.99803 4.99784 4.99739 + 4.99883 5.00365 5.00298 5.00133 5.00048 5.00019 5.00008 + 5.00005 5.00004 5.00003 5.00002 5.00002 5.00001 5.00001 + 5.00001 5.00001 5.00001 5 5 4.99999 4.99997 4.99995 4.99996 + 4.99998 5 5.00001 5.00001 5.00002 5.00002 5.00003 5.00003 + 5.00002 5.00002 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99998 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 + 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5 5 5 5 5 5 5 5.00217 5.00108 4.99547 4.99658 5.00667 + 4.99641 4.99532 4.99938 5.00328 5.00222 5.00114 5.00052 + 5.00024 5.00011 5.00009 4.99285 4.99591 4.99897 5.00403 + 5.00786 5.00318 4.99942 4.9992 4.99949 5.001 5.00408 5.00319 + 5.00063 4.99995 5.00014 4.99982 4.99832 4.99838 4.99865 + 4.99912 4.99836 4.99735 4.99606 4.99814 5.00958 5.02973 + 5.05293 5.06103 4.99342 4.80726 4.50744 4.07509 3.41358 + 2.37924 1.03194 0.261552 0.142392 0.0904482 0.0555071 0.0322869 + 0.018289 0.0113802 0.00875182 0.00757055 0.00629906 0.00523 + 0.00403349 0.0031953 0.00280864 0.00286119 0.00250389 0.00202815 + 0.001723 0.00147312 0.0012411 0.00104401 0.000886204 0.000758277 + 0.000651915 0.00056348 0.000487966 0.000424048 0.000365613 + 0.000308178 0.000258725 0.000228061 0.000207976 0.000198491 + 0.00018518 0.000172716 0.000163197 0.000155007 0.000141734 + 0.000128461 0.000115188 0.000101915 8.86417e-05 7.53686e-05 + 6.20956e-05 5.69164e-05 5.23275e-05 4.77385e-05 4.31495e-05 + 3.85605e-05 3.39716e-05 2.93826e-05 2.69449e-05 2.56224e-05 + 2.42999e-05 2.29774e-05 2.16549e-05 2.03324e-05 1.90099e-05 + 1.76873e-05 1.63648e-05 1.50423e-05 1.37198e-05 1.23973e-05 + 1.10748e-05 9.75232e-06 8.48447e-06 7.65129e-06 6.81811e-06 + 5.98494e-06 5.15176e-06 0.00056893 -0.00787906 -0.0217381 + -0.0370066 -0.00770505 0.00659312 0.00975477 0.00949456 + 0.00777552 0.00655645 0.00568776 0.00508782 0.00458121 0.00410187 + 0.00365665 0.0015121 0.00160863 0.00263181 0.00638941 0.00772607 + 0.00225583 0.0010843 0.000882939 0.000801563 0.00075632 + 0.000554992 0.000435131 0.0003474 0.000217667 0.000491602 + 0.0012267 0.00250446 0.000212058 -0.0174972 -0.0527527 -0.0479071 + 0.194908 1.45838 3.40677 4.49242 4.86894 4.97215 5.01218 + 5.04342 5.06228 5.03069 4.87169 4.57056 4.11523 3.38264 + 2.19691 0.715839 0.172818 0.102162 0.0627162 0.0363388 0.020289 + 0.0119414 0.00826608 0.0066417 0.00549092 0.00492505 0.00439443 + 0.0037156 0.00306471 0.00247451 0.00195965 0.0014822 0.0010815 + 0.000904464 0.0010514 0.00152308 0.00120752 0.000228447 + -0.00102833 -0.00116644 -0.00042067 4.78758e-05 5.09599e-05 + -4.45756e-05 -3.22966e-06 3.81163e-05 7.94622e-05 0.000120808 + 0.000162154 0.000161895 0.000148481 0.000135068 0.000121654 + 0.000108241 9.81453e-05 9.2164e-05 8.61827e-05 8.02014e-05 + 7.42201e-05 6.82388e-05 6.22576e-05 5.62763e-05 5.0295e-05 + 4.43137e-05 3.83324e-05 3.54323e-05 3.321e-05 3.09877e-05 + 2.87654e-05 2.65431e-05 2.43209e-05 2.20986e-05 1.98763e-05 + 1.7654e-05 1.54317e-05 1.34612e-05 1.25441e-05 1.1627e-05 + 1.07099e-05 9.79276e-06 8.87564e-06 7.95851e-06 7.04139e-06 + 6.12427e-06 EOD @v[24].set(<<-'EOD') - 5 5.01099 5.00866 4.97845 4.92369 4.9273 4.97413 4.9929 - 4.99826 4.99958 4.99978 5.00005 4.99968 4.99959 5.00014 - 4.99979 4.99914 4.99982 5.00023 5.00295 5.00664 4.99854 - 4.99647 5.00438 5.01722 5.03681 5.04766 5.04799 5.04867 - 5.04873 5.04685 5.04413 5.0367 5.02505 5.01726 5.01183 5.00806 - 5.00549 5.00371 5.00246 5.00162 5.00105 5.00069 5.00045 - 5.00031 5.00024 5.00019 5.00012 5.00007 5.00004 5.00001 - 4.99998 4.99999 4.99999 5 5.00001 5.00001 5.00002 5.00002 - 5.00003 5.00003 5.00003 5.00002 5.00002 5.00001 5.00001 - 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5.00418 4.99953 4.99152 - 4.99807 5.00497 5.00112 5.00055 5.00038 5.00018 5.00006 - 5.00006 5.00007 5.00006 5.00004 5.00004 4.99853 4.99945 - 4.99998 5.00304 5.00935 5.00742 4.99181 4.97421 4.93603 - 4.8853 4.8927 4.93984 4.97458 4.99039 4.99614 4.99801 4.99851 - 4.99869 4.99924 5.00108 5.00181 5.00119 5.00059 5.00031 - 5.00022 5.00018 5.00011 5.00001 5.00006 4.99981 4.99977 - 4.99982 5.00012 4.99993 5.00008 5.00043 5.00048 5.00024 - 5.00008 4.99984 4.99993 5.00011 4.99996 4.9998 4.99977 4.9998 - 4.99993 5.00008 5.00011 5.00002 4.99995 4.99989 4.99993 - 5 5.00007 5.00009 4.99994 4.99977 4.9997 4.99975 4.99996 - 4.99996 4.99988 4.9997 4.99952 4.9995 4.99956 4.99973 4.99988 - 5.00005 5.00025 5.00042 5.00036 5.00031 5.00025 5.0002 5.00014 - 5.00009 5.00003 5.00002 5.00001 5.00001 5 4.99999 4.99998 - 4.99998 4.99997 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5.00284 - 5.00442 5.00381 4.98997 4.99092 5.00733 5.07791 4.98237 - 4.86434 4.76835 4.74067 4.79278 4.85094 4.90068 4.93603 - 4.95698 4.96984 4.97856 4.98869 4.99904 5.0005 4.99524 5.00181 - 5.01878 5.05177 5.07986 4.98917 4.56217 3.68 2.3539 1.18541 - 0.505772 0.221044 0.115287 0.0760938 0.0589194 0.0476784 - 0.0457213 0.0412911 0.033889 0.0259741 0.0191452 0.0139018 - 0.0100235 0.00711788 0.00497657 0.00349368 0.00250021 0.00176179 - 0.00121843 0.000838368 0.000582711 0.000423458 0.000294608 - 0.000201251 0.000133748 8.6227e-05 5.44252e-05 3.30514e-05 - 1.93926e-05 1.09814e-05 5.29857e-06 1.92247e-06 3.08708e-07 - -3.74311e-07 -6.11121e-07 -7.27807e-07 -4.87604e-07 -4.80493e-07 - -9.15925e-07 -2.03774e-06 -4.01128e-06 -2.46644e-06 2.10626e-06 - 8.22422e-06 1.04922e-05 9.83047e-06 7.27106e-06 3.29654e-06 - -2.06736e-06 -2.18019e-06 -2.29303e-06 -2.40586e-06 -2.51869e-06 - -2.63153e-06 -2.24615e-06 -1.70325e-06 -1.16036e-06 -6.17468e-07 - -7.45754e-08 2.45198e-07 2.88285e-07 3.31373e-07 3.7446e-07 - 4.17548e-07 4.60635e-07 5.03723e-07 5.4681e-07 5.89898e-07 - 6.32985e-07 6.76073e-07 6.19054e-07 5.4001e-07 4.60967e-07 - 3.81923e-07 3.02879e-07 2.23836e-07 1.44792e-07 6.57488e-08 - -1.32948e-08 -9.23383e-08 -1.6698e-07 -2.23206e-07 -2.79432e-07 - -3.35658e-07 -3.91884e-07 -4.48109e-07 -5.04335e-07 -5.60561e-07 - -6.16787e-07 + 5 5.01099 5.00866 4.97845 4.92369 4.9273 4.97413 4.9929 + 4.99826 4.99958 4.99978 5.00005 4.99968 4.99959 5.00014 + 4.99979 4.99914 4.99982 5.00023 5.00295 5.00664 4.99854 + 4.99647 5.00438 5.01722 5.03681 5.04766 5.04799 5.04867 + 5.04873 5.04685 5.04413 5.0367 5.02505 5.01726 5.01183 5.00806 + 5.00549 5.00371 5.00246 5.00162 5.00105 5.00069 5.00045 + 5.00031 5.00024 5.00019 5.00012 5.00007 5.00004 5.00001 + 4.99998 4.99999 4.99999 5 5.00001 5.00001 5.00002 5.00002 + 5.00003 5.00003 5.00003 5.00002 5.00002 5.00001 5.00001 + 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5.00418 4.99953 4.99152 + 4.99807 5.00497 5.00112 5.00055 5.00038 5.00018 5.00006 + 5.00006 5.00007 5.00006 5.00004 5.00004 4.99853 4.99945 + 4.99998 5.00304 5.00935 5.00742 4.99181 4.97421 4.93603 + 4.8853 4.8927 4.93984 4.97458 4.99039 4.99614 4.99801 4.99851 + 4.99869 4.99924 5.00108 5.00181 5.00119 5.00059 5.00031 + 5.00022 5.00018 5.00011 5.00001 5.00006 4.99981 4.99977 + 4.99982 5.00012 4.99993 5.00008 5.00043 5.00048 5.00024 + 5.00008 4.99984 4.99993 5.00011 4.99996 4.9998 4.99977 4.9998 + 4.99993 5.00008 5.00011 5.00002 4.99995 4.99989 4.99993 + 5 5.00007 5.00009 4.99994 4.99977 4.9997 4.99975 4.99996 + 4.99996 4.99988 4.9997 4.99952 4.9995 4.99956 4.99973 4.99988 + 5.00005 5.00025 5.00042 5.00036 5.00031 5.00025 5.0002 5.00014 + 5.00009 5.00003 5.00002 5.00001 5.00001 5 4.99999 4.99998 + 4.99998 4.99997 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5.00284 + 5.00442 5.00381 4.98997 4.99092 5.00733 5.07791 4.98237 + 4.86434 4.76835 4.74067 4.79278 4.85094 4.90068 4.93603 + 4.95698 4.96984 4.97856 4.98869 4.99904 5.0005 4.99524 5.00181 + 5.01878 5.05177 5.07986 4.98917 4.56217 3.68 2.3539 1.18541 + 0.505772 0.221044 0.115287 0.0760938 0.0589194 0.0476784 + 0.0457213 0.0412911 0.033889 0.0259741 0.0191452 0.0139018 + 0.0100235 0.00711788 0.00497657 0.00349368 0.00250021 0.00176179 + 0.00121843 0.000838368 0.000582711 0.000423458 0.000294608 + 0.000201251 0.000133748 8.6227e-05 5.44252e-05 3.30514e-05 + 1.93926e-05 1.09814e-05 5.29857e-06 1.92247e-06 3.08708e-07 + -3.74311e-07 -6.11121e-07 -7.27807e-07 -4.87604e-07 -4.80493e-07 + -9.15925e-07 -2.03774e-06 -4.01128e-06 -2.46644e-06 2.10626e-06 + 8.22422e-06 1.04922e-05 9.83047e-06 7.27106e-06 3.29654e-06 + -2.06736e-06 -2.18019e-06 -2.29303e-06 -2.40586e-06 -2.51869e-06 + -2.63153e-06 -2.24615e-06 -1.70325e-06 -1.16036e-06 -6.17468e-07 + -7.45754e-08 2.45198e-07 2.88285e-07 3.31373e-07 3.7446e-07 + 4.17548e-07 4.60635e-07 5.03723e-07 5.4681e-07 5.89898e-07 + 6.32985e-07 6.76073e-07 6.19054e-07 5.4001e-07 4.60967e-07 + 3.81923e-07 3.02879e-07 2.23836e-07 1.44792e-07 6.57488e-08 + -1.32948e-08 -9.23383e-08 -1.6698e-07 -2.23206e-07 -2.79432e-07 + -3.35658e-07 -3.91884e-07 -4.48109e-07 -5.04335e-07 -5.60561e-07 + -6.16787e-07 EOD @v[25].set(<<-'EOD') - 1.34824 1.35838 1.36465 1.34675 1.29167 1.23161 1.2201 1.2185 - 1.2181 1.21798 1.21793 1.21788 1.21785 1.21782 1.21779 1.21776 - 1.21655 1.21656 1.21669 1.21871 1.22421 1.22247 1.21858 - 1.2228 1.23803 1.27737 1.10647 0.395248 0.0600669 0.027687 - 0.0192374 0.015425 0.0130881 0.00977445 0.00696598 0.00491122 - 0.00341952 0.00237078 0.00162339 0.00109178 0.000726647 - 0.000478886 0.00031568 0.000207902 0.000143494 0.000109768 - 8.62987e-05 5.69775e-05 3.36547e-05 2.30356e-05 1.86108e-05 - 1.41861e-05 1.08293e-05 7.68835e-06 4.79593e-06 4.51019e-06 - 4.22444e-06 3.9387e-06 3.65295e-06 3.36721e-06 3.04559e-06 - 2.69981e-06 2.35403e-06 2.00825e-06 1.66247e-06 1.34508e-06 - 1.26225e-06 1.17941e-06 1.09657e-06 1.01373e-06 9.30893e-07 - 8.48054e-07 7.65216e-07 6.82378e-07 5.9954e-07 5.16702e-07 - 4.37489e-07 3.82774e-07 3.2806e-07 2.73346e-07 2.18632e-07 - 1.63917e-07 1.09203e-07 5.4489e-08 -2.2523e-10 -5.49395e-08 - -1.09654e-07 -1.52862e-07 -1.3079e-07 -1.08718e-07 -8.6646e-08 - -6.45739e-08 -4.25019e-08 -2.04298e-08 1.64229e-09 2.37144e-08 - 4.57864e-08 6.78585e-08 8.71693e-08 9.30725e-08 9.89758e-08 - 1.04879e-07 1.10782e-07 1.16685e-07 1.22589e-07 1.28492e-07 - 1.34395e-07 1.40298e-07 1.46201e-07 1.52105e-07 1.58008e-07 - 1.63911e-07 1.69814e-07 1.75718e-07 1.81621e-07 1.87524e-07 - 1.93427e-07 1.9933e-07 2.05234e-07 2.11137e-07 2.19788e-07 - 0.000393944 -0.000218983 -0.00105784 0.00172403 -0.00027134 - -0.000204147 8.79968e-06 5.93762e-05 5.83554e-05 4.13815e-05 - 3.71369e-05 3.03372e-05 2.25336e-05 1.5986e-05 1.07284e-05 - -7.5239e-05 5.60593e-05 6.97571e-05 0.000667617 0.000960856 - 0.00131749 -0.00759564 -0.0217897 -0.0450321 -0.076646 -0.128569 - -0.186391 -0.202175 -0.206953 -0.2082 -0.208416 -0.208669 - -0.208934 -0.209111 -0.209234 -0.209329 -0.209389 -0.209416 - -0.2094 -0.209329 -0.20926 -0.209204 -0.209208 -0.209285 - -0.209454 -0.209641 -0.20977 -0.209811 -0.209833 -0.209887 - -0.209653 -0.209127 -0.208893 -0.208811 -0.208777 -0.208758 - -0.208747 -0.20874 -0.208726 -0.208697 -0.208657 -0.208611 - -0.208565 -0.208524 -0.208488 -0.208451 -0.208412 -0.208373 - -0.208333 -0.208294 -0.208256 -0.208219 -0.208183 -0.208145 - -0.208107 -0.208066 -0.208029 -0.207993 -0.207959 -0.207923 - -0.207883 -0.207838 -0.207789 -0.207747 -0.20771 -0.207675 - -0.207642 -0.207605 -0.207568 -0.207531 -0.207494 -0.207457 - -0.20742 -0.207383 -0.207346 -0.207308 -0.207271 -0.207233 - -0.207196 -0.207158 -0.207121 -0.207084 -0.207046 -0.207009 - -0.206972 -0.206935 -0.206898 -0.206861 -0.206823 -0.206786 - -0.206749 -0.206712 -0.206675 -0.206638 -0.2066 -0.206563 - -0.206526 -0.206489 -0.206452 -0.206415 -0.203384 -0.20015 - -0.196872 -0.205024 -0.210727 -0.206779 -0.0685263 0.586138 - 1.4665 2.22945 2.77554 3.076 3.24926 3.34515 3.40164 3.43006 - 3.43713 3.43075 3.42886 3.4384 3.46567 3.49025 3.51287 3.53821 - 3.57841 3.39846 2.80753 2.22947 1.7549 1.30429 0.707786 - 0.303206 0.131352 0.0671706 0.0429955 0.032461 0.0257161 - 0.0239521 0.0217397 0.0179705 0.0138745 0.0102813 0.00749643 - 0.0054328 0.00386817 0.0027004 0.00189442 0.00135552 0.000954715 - 0.000659981 0.000453435 0.000313993 0.000231347 0.000159665 - 0.000108122 7.10528e-05 4.50233e-05 2.77892e-05 1.62765e-05 - 8.9893e-06 4.5471e-06 1.54614e-06 -1.6542e-07 -8.68508e-07 - -1.04369e-06 -9.63086e-07 -8.44294e-07 -6.57339e-07 -7.35885e-07 - -9.80056e-07 -1.39772e-06 -2.10199e-06 -1.37474e-06 6.13269e-07 - 3.3028e-06 4.60941e-06 4.91053e-06 4.14186e-06 2.45258e-06 - -8.7388e-09 -3.59647e-07 -7.10554e-07 -1.06146e-06 -1.41237e-06 - -1.76328e-06 -1.63073e-06 -1.34534e-06 -1.05995e-06 -7.74561e-07 - -4.8917e-07 -2.95733e-07 -2.16326e-07 -1.3692e-07 -5.75135e-08 - 2.18929e-08 1.01299e-07 1.80706e-07 2.60112e-07 3.39519e-07 - 4.18925e-07 4.98332e-07 4.83984e-07 4.4901e-07 4.14035e-07 - 3.79061e-07 3.44087e-07 3.09112e-07 2.74138e-07 2.39163e-07 - 2.04189e-07 1.69215e-07 1.26002e-07 4.83213e-08 -2.9359e-08 - -1.07039e-07 -1.8472e-07 -2.624e-07 -3.4008e-07 -4.1776e-07 - -4.95441e-07 + 1.34824 1.35838 1.36465 1.34675 1.29167 1.23161 1.2201 1.2185 + 1.2181 1.21798 1.21793 1.21788 1.21785 1.21782 1.21779 1.21776 + 1.21655 1.21656 1.21669 1.21871 1.22421 1.22247 1.21858 + 1.2228 1.23803 1.27737 1.10647 0.395248 0.0600669 0.027687 + 0.0192374 0.015425 0.0130881 0.00977445 0.00696598 0.00491122 + 0.00341952 0.00237078 0.00162339 0.00109178 0.000726647 + 0.000478886 0.00031568 0.000207902 0.000143494 0.000109768 + 8.62987e-05 5.69775e-05 3.36547e-05 2.30356e-05 1.86108e-05 + 1.41861e-05 1.08293e-05 7.68835e-06 4.79593e-06 4.51019e-06 + 4.22444e-06 3.9387e-06 3.65295e-06 3.36721e-06 3.04559e-06 + 2.69981e-06 2.35403e-06 2.00825e-06 1.66247e-06 1.34508e-06 + 1.26225e-06 1.17941e-06 1.09657e-06 1.01373e-06 9.30893e-07 + 8.48054e-07 7.65216e-07 6.82378e-07 5.9954e-07 5.16702e-07 + 4.37489e-07 3.82774e-07 3.2806e-07 2.73346e-07 2.18632e-07 + 1.63917e-07 1.09203e-07 5.4489e-08 -2.2523e-10 -5.49395e-08 + -1.09654e-07 -1.52862e-07 -1.3079e-07 -1.08718e-07 -8.6646e-08 + -6.45739e-08 -4.25019e-08 -2.04298e-08 1.64229e-09 2.37144e-08 + 4.57864e-08 6.78585e-08 8.71693e-08 9.30725e-08 9.89758e-08 + 1.04879e-07 1.10782e-07 1.16685e-07 1.22589e-07 1.28492e-07 + 1.34395e-07 1.40298e-07 1.46201e-07 1.52105e-07 1.58008e-07 + 1.63911e-07 1.69814e-07 1.75718e-07 1.81621e-07 1.87524e-07 + 1.93427e-07 1.9933e-07 2.05234e-07 2.11137e-07 2.19788e-07 + 0.000393944 -0.000218983 -0.00105784 0.00172403 -0.00027134 + -0.000204147 8.79968e-06 5.93762e-05 5.83554e-05 4.13815e-05 + 3.71369e-05 3.03372e-05 2.25336e-05 1.5986e-05 1.07284e-05 + -7.5239e-05 5.60593e-05 6.97571e-05 0.000667617 0.000960856 + 0.00131749 -0.00759564 -0.0217897 -0.0450321 -0.076646 -0.128569 + -0.186391 -0.202175 -0.206953 -0.2082 -0.208416 -0.208669 + -0.208934 -0.209111 -0.209234 -0.209329 -0.209389 -0.209416 + -0.2094 -0.209329 -0.20926 -0.209204 -0.209208 -0.209285 + -0.209454 -0.209641 -0.20977 -0.209811 -0.209833 -0.209887 + -0.209653 -0.209127 -0.208893 -0.208811 -0.208777 -0.208758 + -0.208747 -0.20874 -0.208726 -0.208697 -0.208657 -0.208611 + -0.208565 -0.208524 -0.208488 -0.208451 -0.208412 -0.208373 + -0.208333 -0.208294 -0.208256 -0.208219 -0.208183 -0.208145 + -0.208107 -0.208066 -0.208029 -0.207993 -0.207959 -0.207923 + -0.207883 -0.207838 -0.207789 -0.207747 -0.20771 -0.207675 + -0.207642 -0.207605 -0.207568 -0.207531 -0.207494 -0.207457 + -0.20742 -0.207383 -0.207346 -0.207308 -0.207271 -0.207233 + -0.207196 -0.207158 -0.207121 -0.207084 -0.207046 -0.207009 + -0.206972 -0.206935 -0.206898 -0.206861 -0.206823 -0.206786 + -0.206749 -0.206712 -0.206675 -0.206638 -0.2066 -0.206563 + -0.206526 -0.206489 -0.206452 -0.206415 -0.203384 -0.20015 + -0.196872 -0.205024 -0.210727 -0.206779 -0.0685263 0.586138 + 1.4665 2.22945 2.77554 3.076 3.24926 3.34515 3.40164 3.43006 + 3.43713 3.43075 3.42886 3.4384 3.46567 3.49025 3.51287 3.53821 + 3.57841 3.39846 2.80753 2.22947 1.7549 1.30429 0.707786 + 0.303206 0.131352 0.0671706 0.0429955 0.032461 0.0257161 + 0.0239521 0.0217397 0.0179705 0.0138745 0.0102813 0.00749643 + 0.0054328 0.00386817 0.0027004 0.00189442 0.00135552 0.000954715 + 0.000659981 0.000453435 0.000313993 0.000231347 0.000159665 + 0.000108122 7.10528e-05 4.50233e-05 2.77892e-05 1.62765e-05 + 8.9893e-06 4.5471e-06 1.54614e-06 -1.6542e-07 -8.68508e-07 + -1.04369e-06 -9.63086e-07 -8.44294e-07 -6.57339e-07 -7.35885e-07 + -9.80056e-07 -1.39772e-06 -2.10199e-06 -1.37474e-06 6.13269e-07 + 3.3028e-06 4.60941e-06 4.91053e-06 4.14186e-06 2.45258e-06 + -8.7388e-09 -3.59647e-07 -7.10554e-07 -1.06146e-06 -1.41237e-06 + -1.76328e-06 -1.63073e-06 -1.34534e-06 -1.05995e-06 -7.74561e-07 + -4.8917e-07 -2.95733e-07 -2.16326e-07 -1.3692e-07 -5.75135e-08 + 2.18929e-08 1.01299e-07 1.80706e-07 2.60112e-07 3.39519e-07 + 4.18925e-07 4.98332e-07 4.83984e-07 4.4901e-07 4.14035e-07 + 3.79061e-07 3.44087e-07 3.09112e-07 2.74138e-07 2.39163e-07 + 2.04189e-07 1.69215e-07 1.26002e-07 4.83213e-08 -2.9359e-08 + -1.07039e-07 -1.8472e-07 -2.624e-07 -3.4008e-07 -4.1776e-07 + -4.95441e-07 EOD @v[26].set(<<-'EOD') - 7.10441e-10 0.000309731 -0.000308186 -0.001694 -0.00360784 - 8.40909e-05 0.00203175 0.0012896 0.000596548 0.000277191 - 0.000161134 0.000120439 8.4915e-05 9.49929e-05 6.18812e-05 - 1.65433e-05 1.89682e-05 3.97578e-05 4.95446e-05 0.000225325 - 0.000214579 -0.00230134 -0.000451102 0.00997237 0.0341443 - 0.0449314 0.0424411 0.0341996 0.0315315 0.0308892 0.0291614 - 0.024365 0.0190282 0.0188976 0.017238 0.0138526 0.0105645 - 0.00778548 0.00561753 0.0039871 0.00279554 0.00194075 0.0013468 - 0.000934775 0.000664723 0.000498911 0.000377384 0.000254183 - 0.000163421 0.000120773 9.65058e-05 7.22384e-05 5.60316e-05 - 4.14549e-05 2.79516e-05 2.57096e-05 2.34677e-05 2.12257e-05 - 1.89837e-05 1.67417e-05 1.46737e-05 1.27228e-05 1.07719e-05 - 8.82099e-06 6.87009e-06 5.0896e-06 4.71705e-06 4.34451e-06 - 3.97196e-06 3.59941e-06 3.22686e-06 2.85431e-06 2.48176e-06 - 2.10921e-06 1.73666e-06 1.36411e-06 1.02855e-06 9.42931e-07 - 8.57316e-07 7.71701e-07 6.86086e-07 6.00471e-07 5.14856e-07 - 4.29241e-07 3.43626e-07 2.58011e-07 1.72396e-07 9.85409e-08 - 9.14091e-08 8.42773e-08 7.71456e-08 7.00138e-08 6.2882e-08 - 5.57503e-08 4.86185e-08 4.14867e-08 3.4355e-08 2.72232e-08 - 2.05821e-08 1.63235e-08 1.2065e-08 7.80643e-09 3.54786e-09 - -7.10696e-10 -4.96926e-09 -9.22782e-09 -1.34864e-08 -1.77449e-08 - -2.20035e-08 -2.62621e-08 -3.05206e-08 -3.47792e-08 -3.90378e-08 - -4.32963e-08 -4.75549e-08 -5.18134e-08 -5.6072e-08 -6.03306e-08 - -6.45891e-08 -6.88477e-08 -8.76373e-06 0.000131607 -0.00021685 - -0.000433027 0.00047234 0.000211593 -0.000189601 3.2492e-05 - 0.000575955 7.72235e-05 -0.000285172 -0.000242061 -0.000135112 - -3.50117e-05 -2.75868e-05 5.48974e-05 1.80604e-07 5.48911e-05 - 3.97478e-05 0.000192909 0.000297932 0.00402253 -0.0122366 - -0.047853 -0.0963082 -0.108071 -0.0567275 -0.0239271 -0.0178628 - -0.0233027 -0.031853 -0.0400843 -0.0482725 -0.0576154 -0.0627218 - -0.0511236 -0.0279524 -0.0150986 -0.00931091 -0.00652876 - -0.00479286 -0.00344346 -0.00249578 -0.0019532 -0.00157977 - -0.00131848 -0.00111251 -0.000939229 -0.000797445 -0.000708384 - -0.000630452 -0.000539722 -0.000508862 -0.000480596 -0.000439484 - -0.000407217 -0.000363866 -0.000329506 -0.000318642 -0.000307362 - -0.000286511 -0.000266253 -0.000242943 -0.000218107 -0.000204661 - -0.00020241 -0.000194435 -0.000185062 -0.000173042 -0.000160549 - -0.000151407 -0.000145626 -0.000145976 -0.000147342 -0.000145288 - -0.000137979 -0.000124481 -0.000123218 -0.000127453 -0.000139006 - -0.000145486 -0.000129764 -9.82749e-05 -4.72596e-05 -3.08671e-05 - -3.28834e-05 -4.52254e-05 -6.25389e-05 -6.32516e-05 -6.39643e-05 - -6.4677e-05 -6.53897e-05 -6.61023e-05 -6.6815e-05 -6.75277e-05 - -6.61005e-05 -6.45173e-05 -6.29341e-05 -6.13509e-05 -5.97676e-05 - -5.81844e-05 -5.66012e-05 -5.54231e-05 -5.4455e-05 -5.3487e-05 - -5.25189e-05 -5.15508e-05 -5.05828e-05 -4.96147e-05 -4.86466e-05 - -4.76785e-05 -4.67105e-05 -4.57424e-05 -4.47743e-05 -4.38063e-05 - -4.28382e-05 -4.18821e-05 -4.10211e-05 -4.016e-05 -3.9299e-05 - -3.8438e-05 4.29885e-05 5.14113e-05 -0.000127986 -0.000611463 - -0.000149428 0.000882394 0.00297059 -0.00405825 -0.00591067 - -0.00546997 -0.00158744 0.00190677 0.00298403 0.00268595 - 0.00196161 0.00130289 0.000783347 0.000520683 0.000565306 - 0.00053419 -0.00224696 -0.000920818 0.0132755 0.0322504 - 0.0442808 0.0638615 0.0701007 0.0539356 0.0247771 0.056244 - 0.294266 0.831368 1.45424 2.02898 2.54559 2.9937 3.35333 - 3.72609 4.06363 4.32789 4.52413 4.66504 4.7652 4.83637 4.88631 - 4.92109 4.94464 4.96046 4.97218 4.98079 4.98679 4.99076 - 4.99361 4.99555 4.99686 4.99783 4.99853 4.99902 4.99936 - 4.99959 4.99973 4.99983 4.9999 4.99993 4.99996 4.99998 5 - 5.00001 5 4.99999 4.99997 4.99994 4.99993 4.99994 4.99996 - 4.99999 5.00004 5.00006 5.00005 5.00003 5.00002 5.00001 - 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 + 7.10441e-10 0.000309731 -0.000308186 -0.001694 -0.00360784 + 8.40909e-05 0.00203175 0.0012896 0.000596548 0.000277191 + 0.000161134 0.000120439 8.4915e-05 9.49929e-05 6.18812e-05 + 1.65433e-05 1.89682e-05 3.97578e-05 4.95446e-05 0.000225325 + 0.000214579 -0.00230134 -0.000451102 0.00997237 0.0341443 + 0.0449314 0.0424411 0.0341996 0.0315315 0.0308892 0.0291614 + 0.024365 0.0190282 0.0188976 0.017238 0.0138526 0.0105645 + 0.00778548 0.00561753 0.0039871 0.00279554 0.00194075 0.0013468 + 0.000934775 0.000664723 0.000498911 0.000377384 0.000254183 + 0.000163421 0.000120773 9.65058e-05 7.22384e-05 5.60316e-05 + 4.14549e-05 2.79516e-05 2.57096e-05 2.34677e-05 2.12257e-05 + 1.89837e-05 1.67417e-05 1.46737e-05 1.27228e-05 1.07719e-05 + 8.82099e-06 6.87009e-06 5.0896e-06 4.71705e-06 4.34451e-06 + 3.97196e-06 3.59941e-06 3.22686e-06 2.85431e-06 2.48176e-06 + 2.10921e-06 1.73666e-06 1.36411e-06 1.02855e-06 9.42931e-07 + 8.57316e-07 7.71701e-07 6.86086e-07 6.00471e-07 5.14856e-07 + 4.29241e-07 3.43626e-07 2.58011e-07 1.72396e-07 9.85409e-08 + 9.14091e-08 8.42773e-08 7.71456e-08 7.00138e-08 6.2882e-08 + 5.57503e-08 4.86185e-08 4.14867e-08 3.4355e-08 2.72232e-08 + 2.05821e-08 1.63235e-08 1.2065e-08 7.80643e-09 3.54786e-09 + -7.10696e-10 -4.96926e-09 -9.22782e-09 -1.34864e-08 -1.77449e-08 + -2.20035e-08 -2.62621e-08 -3.05206e-08 -3.47792e-08 -3.90378e-08 + -4.32963e-08 -4.75549e-08 -5.18134e-08 -5.6072e-08 -6.03306e-08 + -6.45891e-08 -6.88477e-08 -8.76373e-06 0.000131607 -0.00021685 + -0.000433027 0.00047234 0.000211593 -0.000189601 3.2492e-05 + 0.000575955 7.72235e-05 -0.000285172 -0.000242061 -0.000135112 + -3.50117e-05 -2.75868e-05 5.48974e-05 1.80604e-07 5.48911e-05 + 3.97478e-05 0.000192909 0.000297932 0.00402253 -0.0122366 + -0.047853 -0.0963082 -0.108071 -0.0567275 -0.0239271 -0.0178628 + -0.0233027 -0.031853 -0.0400843 -0.0482725 -0.0576154 -0.0627218 + -0.0511236 -0.0279524 -0.0150986 -0.00931091 -0.00652876 + -0.00479286 -0.00344346 -0.00249578 -0.0019532 -0.00157977 + -0.00131848 -0.00111251 -0.000939229 -0.000797445 -0.000708384 + -0.000630452 -0.000539722 -0.000508862 -0.000480596 -0.000439484 + -0.000407217 -0.000363866 -0.000329506 -0.000318642 -0.000307362 + -0.000286511 -0.000266253 -0.000242943 -0.000218107 -0.000204661 + -0.00020241 -0.000194435 -0.000185062 -0.000173042 -0.000160549 + -0.000151407 -0.000145626 -0.000145976 -0.000147342 -0.000145288 + -0.000137979 -0.000124481 -0.000123218 -0.000127453 -0.000139006 + -0.000145486 -0.000129764 -9.82749e-05 -4.72596e-05 -3.08671e-05 + -3.28834e-05 -4.52254e-05 -6.25389e-05 -6.32516e-05 -6.39643e-05 + -6.4677e-05 -6.53897e-05 -6.61023e-05 -6.6815e-05 -6.75277e-05 + -6.61005e-05 -6.45173e-05 -6.29341e-05 -6.13509e-05 -5.97676e-05 + -5.81844e-05 -5.66012e-05 -5.54231e-05 -5.4455e-05 -5.3487e-05 + -5.25189e-05 -5.15508e-05 -5.05828e-05 -4.96147e-05 -4.86466e-05 + -4.76785e-05 -4.67105e-05 -4.57424e-05 -4.47743e-05 -4.38063e-05 + -4.28382e-05 -4.18821e-05 -4.10211e-05 -4.016e-05 -3.9299e-05 + -3.8438e-05 4.29885e-05 5.14113e-05 -0.000127986 -0.000611463 + -0.000149428 0.000882394 0.00297059 -0.00405825 -0.00591067 + -0.00546997 -0.00158744 0.00190677 0.00298403 0.00268595 + 0.00196161 0.00130289 0.000783347 0.000520683 0.000565306 + 0.00053419 -0.00224696 -0.000920818 0.0132755 0.0322504 + 0.0442808 0.0638615 0.0701007 0.0539356 0.0247771 0.056244 + 0.294266 0.831368 1.45424 2.02898 2.54559 2.9937 3.35333 + 3.72609 4.06363 4.32789 4.52413 4.66504 4.7652 4.83637 4.88631 + 4.92109 4.94464 4.96046 4.97218 4.98079 4.98679 4.99076 + 4.99361 4.99555 4.99686 4.99783 4.99853 4.99902 4.99936 + 4.99959 4.99973 4.99983 4.9999 4.99993 4.99996 4.99998 5 + 5.00001 5 4.99999 4.99997 4.99994 4.99993 4.99994 4.99996 + 4.99999 5.00004 5.00006 5.00005 5.00003 5.00002 5.00001 + 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 EOD @v[27].set(<<-'EOD') - 5 4.99984 4.99796 4.99478 4.9889 4.98738 4.98896 4.99087 - 4.99262 4.99419 4.99552 4.99659 4.99743 4.99807 4.99855 - 4.9989 4.99894 4.99908 4.99935 5.00001 5.0007 5.00132 5.00032 - 4.99976 5.00134 5.00339 5.00315 5.00157 5.00091 5.00058 - 5.00012 4.99944 4.99886 4.9994 4.99934 4.99899 4.99876 4.99868 - 4.99872 4.99883 4.99898 4.99914 4.9993 4.99944 4.99956 4.99967 - 4.99976 4.99982 4.99986 4.9999 4.99993 4.99997 4.99997 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00009 5.00028 5.00015 4.99983 - 5.00036 4.99996 4.99834 4.99783 5.00383 5.00734 5.00387 - 5.00058 4.99893 4.99836 4.99832 4.99854 4.99873 4.99905 - 4.99927 4.99952 4.99969 4.99834 4.99536 4.99163 4.99073 - 5.0053 5.03631 5.03103 4.9008 4.62503 4.21887 3.70902 3.09967 - 2.35791 1.41912 0.519675 0.210458 0.131362 0.0980819 0.0708209 - 0.0471701 0.0323272 0.0253535 0.0199144 0.0152615 0.0117228 - 0.00917696 0.00738117 0.00609292 0.00512664 0.00436184 0.0037961 - 0.00331639 0.00289006 0.0025477 0.00226529 0.00202925 0.00182793 - 0.00165474 0.00150531 0.00137529 0.00125983 0.00115603 0.00106455 - 0.000982977 0.000911255 0.000846819 0.000790092 0.000738698 - 0.000692816 0.00065107 0.000613595 0.000579642 0.000548935 - 0.00052106 0.000495598 0.000472174 0.000450849 0.000431118 - 0.000412667 0.000395868 0.000381319 0.000368487 0.000357327 - 0.000344212 0.000330334 0.00031622 0.000303298 0.000295809 - 0.00028832 0.000280831 0.000273342 0.000265853 0.000258364 - 0.000250875 0.000245118 0.000239488 0.000233857 0.000228227 - 0.000222596 0.000216966 0.000211336 0.000207047 0.000203455 - 0.000199863 0.00019627 0.000192678 0.000189085 0.000185493 - 0.0001819 0.000178308 0.000174716 0.000171123 0.000167531 - 0.000163938 0.000160346 0.000156835 0.000153973 0.00015111 - 0.000148248 0.000145385 0.000296579 -3.96718e-05 -0.000449085 - 0.000323433 0.000750086 0.000268264 0.000149028 -0.000100249 - 7.00956e-05 0.00012605 0.00022592 0.000193036 0.000120453 - 8.07865e-05 7.65771e-05 -3.27828e-05 0.000116759 0.000169498 - 0.000409804 0.000414965 0.00092323 -0.00590633 -0.0175477 - -0.032433 -0.0559842 -0.0820373 0.0688484 0.626629 1.32929 - 2.01657 2.60925 3.12329 3.38952 3.14128 2.38463 1.23802 - 0.316019 0.107832 0.0694707 0.051837 0.035247 0.0209999 - 0.0116618 0.00967674 0.00789182 0.00574566 0.00386872 0.00258612 - 0.00167126 0.00104169 0.000641093 0.000401246 0.000277928 - 0.000171775 0.000102266 5.89376e-05 3.29258e-05 1.80463e-05 - 1.0057e-05 6.4571e-06 5.10093e-06 4.06791e-06 3.62716e-06 - 3.63321e-06 3.99625e-06 4.64368e-06 5.20886e-06 4.77728e-06 - 3.23919e-06 1.14113e-06 -1.29416e-06 -4.15607e-06 -1.88532e-06 - 5.24411e-06 1.38678e-05 1.28823e-05 3.6758e-06 -2.52285e-06 - -3.97133e-06 -4.03071e-06 -3.37154e-06 -2.71238e-06 -2.05321e-06 - -1.39404e-06 -7.34872e-07 -3.73325e-07 -1.05873e-07 1.61578e-07 - 4.2903e-07 6.96482e-07 8.18468e-07 7.60065e-07 7.01662e-07 - 6.43258e-07 5.84855e-07 5.26452e-07 4.68049e-07 4.09646e-07 - 3.51243e-07 2.9284e-07 2.34437e-07 1.71213e-07 1.06928e-07 - 4.2644e-08 -2.16403e-08 -8.59247e-08 -1.50209e-07 -2.14493e-07 - -2.78778e-07 -3.43062e-07 -4.07346e-07 -4.55065e-07 -4.3348e-07 - -4.11896e-07 -3.90311e-07 -3.68726e-07 -3.47141e-07 -3.25556e-07 - -3.03971e-07 -2.82386e-07 + 5 4.99984 4.99796 4.99478 4.9889 4.98738 4.98896 4.99087 + 4.99262 4.99419 4.99552 4.99659 4.99743 4.99807 4.99855 + 4.9989 4.99894 4.99908 4.99935 5.00001 5.0007 5.00132 5.00032 + 4.99976 5.00134 5.00339 5.00315 5.00157 5.00091 5.00058 + 5.00012 4.99944 4.99886 4.9994 4.99934 4.99899 4.99876 4.99868 + 4.99872 4.99883 4.99898 4.99914 4.9993 4.99944 4.99956 4.99967 + 4.99976 4.99982 4.99986 4.9999 4.99993 4.99997 4.99997 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00009 5.00028 5.00015 4.99983 + 5.00036 4.99996 4.99834 4.99783 5.00383 5.00734 5.00387 + 5.00058 4.99893 4.99836 4.99832 4.99854 4.99873 4.99905 + 4.99927 4.99952 4.99969 4.99834 4.99536 4.99163 4.99073 + 5.0053 5.03631 5.03103 4.9008 4.62503 4.21887 3.70902 3.09967 + 2.35791 1.41912 0.519675 0.210458 0.131362 0.0980819 0.0708209 + 0.0471701 0.0323272 0.0253535 0.0199144 0.0152615 0.0117228 + 0.00917696 0.00738117 0.00609292 0.00512664 0.00436184 0.0037961 + 0.00331639 0.00289006 0.0025477 0.00226529 0.00202925 0.00182793 + 0.00165474 0.00150531 0.00137529 0.00125983 0.00115603 0.00106455 + 0.000982977 0.000911255 0.000846819 0.000790092 0.000738698 + 0.000692816 0.00065107 0.000613595 0.000579642 0.000548935 + 0.00052106 0.000495598 0.000472174 0.000450849 0.000431118 + 0.000412667 0.000395868 0.000381319 0.000368487 0.000357327 + 0.000344212 0.000330334 0.00031622 0.000303298 0.000295809 + 0.00028832 0.000280831 0.000273342 0.000265853 0.000258364 + 0.000250875 0.000245118 0.000239488 0.000233857 0.000228227 + 0.000222596 0.000216966 0.000211336 0.000207047 0.000203455 + 0.000199863 0.00019627 0.000192678 0.000189085 0.000185493 + 0.0001819 0.000178308 0.000174716 0.000171123 0.000167531 + 0.000163938 0.000160346 0.000156835 0.000153973 0.00015111 + 0.000148248 0.000145385 0.000296579 -3.96718e-05 -0.000449085 + 0.000323433 0.000750086 0.000268264 0.000149028 -0.000100249 + 7.00956e-05 0.00012605 0.00022592 0.000193036 0.000120453 + 8.07865e-05 7.65771e-05 -3.27828e-05 0.000116759 0.000169498 + 0.000409804 0.000414965 0.00092323 -0.00590633 -0.0175477 + -0.032433 -0.0559842 -0.0820373 0.0688484 0.626629 1.32929 + 2.01657 2.60925 3.12329 3.38952 3.14128 2.38463 1.23802 + 0.316019 0.107832 0.0694707 0.051837 0.035247 0.0209999 + 0.0116618 0.00967674 0.00789182 0.00574566 0.00386872 0.00258612 + 0.00167126 0.00104169 0.000641093 0.000401246 0.000277928 + 0.000171775 0.000102266 5.89376e-05 3.29258e-05 1.80463e-05 + 1.0057e-05 6.4571e-06 5.10093e-06 4.06791e-06 3.62716e-06 + 3.63321e-06 3.99625e-06 4.64368e-06 5.20886e-06 4.77728e-06 + 3.23919e-06 1.14113e-06 -1.29416e-06 -4.15607e-06 -1.88532e-06 + 5.24411e-06 1.38678e-05 1.28823e-05 3.6758e-06 -2.52285e-06 + -3.97133e-06 -4.03071e-06 -3.37154e-06 -2.71238e-06 -2.05321e-06 + -1.39404e-06 -7.34872e-07 -3.73325e-07 -1.05873e-07 1.61578e-07 + 4.2903e-07 6.96482e-07 8.18468e-07 7.60065e-07 7.01662e-07 + 6.43258e-07 5.84855e-07 5.26452e-07 4.68049e-07 4.09646e-07 + 3.51243e-07 2.9284e-07 2.34437e-07 1.71213e-07 1.06928e-07 + 4.2644e-08 -2.16403e-08 -8.59247e-08 -1.50209e-07 -2.14493e-07 + -2.78778e-07 -3.43062e-07 -4.07346e-07 -4.55065e-07 -4.3348e-07 + -4.11896e-07 -3.90311e-07 -3.68726e-07 -3.47141e-07 -3.25556e-07 + -3.03971e-07 -2.82386e-07 EOD @v[28].set(<<-'EOD') - 0.368163 0.361756 0.327463 0.269513 0.149476 0.0805716 0.0501146 - 0.03403 0.0230886 0.0160474 0.0116071 0.00870013 0.00679614 - 0.00542384 0.00432512 0.00340653 -0.00129719 -0.00399429 - -0.00318719 0.00443085 0.0150156 0.0334147 0.0132288 -0.0189751 - -0.0508377 -0.0252174 -0.0142489 -0.00675908 -0.0038653 - -0.00243423 -0.00168891 -0.00120901 -0.000900426 -0.000685575 - -0.000557595 -0.000457268 -0.000377427 -0.000315269 -0.000266613 - -0.000228397 -0.000198283 -0.000174248 -0.000154886 -0.00013892 - -0.000125864 -0.000115189 -0.000105841 -9.66611e-05 -8.84262e-05 - -8.23872e-05 -7.74668e-05 -7.25463e-05 -6.79992e-05 -6.35276e-05 - -5.92413e-05 -5.68994e-05 -5.45574e-05 -5.22154e-05 -4.98735e-05 - -4.75315e-05 -4.54981e-05 -4.36726e-05 -4.18471e-05 -4.00216e-05 - -3.81961e-05 -3.64559e-05 -3.54209e-05 -3.43858e-05 -3.33508e-05 - -3.23157e-05 -3.12807e-05 -3.02456e-05 -2.92105e-05 -2.81755e-05 - -2.71404e-05 -2.61054e-05 -2.51232e-05 -2.44984e-05 -2.38736e-05 - -2.32487e-05 -2.26239e-05 -2.19991e-05 -2.13742e-05 -2.07494e-05 - -2.01246e-05 -1.94998e-05 -1.88749e-05 -1.82865e-05 -1.79044e-05 - -1.75224e-05 -1.71403e-05 -1.67582e-05 -1.63762e-05 -1.59941e-05 - -1.56121e-05 -1.523e-05 -1.4848e-05 -1.44659e-05 -1.41138e-05 - -1.39075e-05 -1.37011e-05 -1.34947e-05 -1.32883e-05 -1.30819e-05 - -1.28755e-05 -1.26691e-05 -1.24627e-05 -1.22563e-05 -1.205e-05 - -1.18436e-05 -1.16372e-05 -1.14308e-05 -1.12244e-05 -1.1018e-05 - -1.08116e-05 -1.06052e-05 -1.03988e-05 -1.01924e-05 -9.98605e-06 - -9.77966e-06 -2.85319e-05 0.00281092 0.00180106 -0.000981083 - 0.00551926 -0.00119763 -0.0295069 -0.0367677 0.064749 0.119022 - 0.0882007 0.0552062 0.03418 0.0223243 0.015545 0.011949 - 0.00757134 0.00667655 0.00583243 0.00644443 0.00650959 -0.0302575 - -0.0437806 -0.0355466 0.0381776 0.282109 0.674178 1.07582 - 1.45189 1.789 2.08649 2.34663 2.57245 2.81211 3.04778 3.2523 - 3.45877 3.65593 3.83396 3.9923 4.13368 4.25864 4.36719 4.46064 - 4.54086 4.60962 4.66835 4.71838 4.76094 4.79716 4.82796 - 4.85413 4.87634 4.89518 4.91116 4.92476 4.93631 4.94608 - 4.95434 4.9613 4.96715 4.97211 4.97638 4.98001 4.98312 4.98571 - 4.98795 4.98979 4.99138 4.99269 4.99381 4.99474 4.99551 - 4.99615 4.99668 4.99713 4.99752 4.99783 4.99811 4.99836 - 4.99858 4.99873 4.99884 4.99892 4.999 4.99907 4.99912 4.99916 - 4.99921 4.99926 4.99932 4.99937 4.99942 4.99948 4.99953 - 4.99956 4.99958 4.99961 4.99963 4.99966 4.99968 4.99971 - 4.99972 4.99973 4.99974 4.99975 4.99976 4.99977 4.99978 - 4.99979 4.9998 4.9998 4.99981 4.99982 4.99983 4.99984 4.99985 - 4.99986 4.99986 4.99987 4.99987 5.00498 5.00354 4.99359 - 4.98981 5.00498 5.00099 5.00041 5.00022 5.00015 5.00012 - 5.0001 5.00008 5.00005 5.00003 5 4.99431 4.99459 4.99591 - 5.00087 5.01029 5.03935 4.92784 4.51643 3.78356 2.68745 - 1.43417 0.583128 0.205094 0.0777337 0.0391566 0.02723 0.023883 - 0.018808 0.010165 0.00254623 -0.00377463 -0.0038097 0.00144145 - 0.00267231 0.00193045 0.00144538 0.00121758 0.00112893 0.00109424 - 0.0010226 0.000948072 0.000882573 0.000826996 0.000776391 - 0.000729719 0.000686499 0.000647333 0.000610108 0.000575631 - 0.000545069 0.000515485 0.000488514 0.000465316 0.000443215 - 0.000422454 0.00040292 0.00038488 0.000368472 0.000353628 - 0.000339643 0.000326197 0.000313483 0.000302884 0.000294038 - 0.000284003 0.000270941 0.000254925 0.000246511 0.000244089 - 0.000245538 0.000242099 0.000235728 0.000227482 0.000218001 - 0.000207257 0.000202127 0.000196997 0.000191868 0.000186738 - 0.000181608 0.00017758 0.000173899 0.000170219 0.000166538 - 0.000162857 0.000159576 0.00015679 0.000154005 0.000151219 - 0.000148433 0.000145647 0.000142861 0.000140076 0.00013729 - 0.000134504 0.000131718 0.000129603 0.000127635 0.000125668 - 0.0001237 0.000121732 0.000119765 0.000117797 0.000115829 - 0.000113862 0.000111894 0.000109993 0.000108372 0.000106751 - 0.00010513 0.000103509 0.000101887 0.000100266 9.86449e-05 - 9.70237e-05 + 0.368163 0.361756 0.327463 0.269513 0.149476 0.0805716 0.0501146 + 0.03403 0.0230886 0.0160474 0.0116071 0.00870013 0.00679614 + 0.00542384 0.00432512 0.00340653 -0.00129719 -0.00399429 + -0.00318719 0.00443085 0.0150156 0.0334147 0.0132288 -0.0189751 + -0.0508377 -0.0252174 -0.0142489 -0.00675908 -0.0038653 + -0.00243423 -0.00168891 -0.00120901 -0.000900426 -0.000685575 + -0.000557595 -0.000457268 -0.000377427 -0.000315269 -0.000266613 + -0.000228397 -0.000198283 -0.000174248 -0.000154886 -0.00013892 + -0.000125864 -0.000115189 -0.000105841 -9.66611e-05 -8.84262e-05 + -8.23872e-05 -7.74668e-05 -7.25463e-05 -6.79992e-05 -6.35276e-05 + -5.92413e-05 -5.68994e-05 -5.45574e-05 -5.22154e-05 -4.98735e-05 + -4.75315e-05 -4.54981e-05 -4.36726e-05 -4.18471e-05 -4.00216e-05 + -3.81961e-05 -3.64559e-05 -3.54209e-05 -3.43858e-05 -3.33508e-05 + -3.23157e-05 -3.12807e-05 -3.02456e-05 -2.92105e-05 -2.81755e-05 + -2.71404e-05 -2.61054e-05 -2.51232e-05 -2.44984e-05 -2.38736e-05 + -2.32487e-05 -2.26239e-05 -2.19991e-05 -2.13742e-05 -2.07494e-05 + -2.01246e-05 -1.94998e-05 -1.88749e-05 -1.82865e-05 -1.79044e-05 + -1.75224e-05 -1.71403e-05 -1.67582e-05 -1.63762e-05 -1.59941e-05 + -1.56121e-05 -1.523e-05 -1.4848e-05 -1.44659e-05 -1.41138e-05 + -1.39075e-05 -1.37011e-05 -1.34947e-05 -1.32883e-05 -1.30819e-05 + -1.28755e-05 -1.26691e-05 -1.24627e-05 -1.22563e-05 -1.205e-05 + -1.18436e-05 -1.16372e-05 -1.14308e-05 -1.12244e-05 -1.1018e-05 + -1.08116e-05 -1.06052e-05 -1.03988e-05 -1.01924e-05 -9.98605e-06 + -9.77966e-06 -2.85319e-05 0.00281092 0.00180106 -0.000981083 + 0.00551926 -0.00119763 -0.0295069 -0.0367677 0.064749 0.119022 + 0.0882007 0.0552062 0.03418 0.0223243 0.015545 0.011949 + 0.00757134 0.00667655 0.00583243 0.00644443 0.00650959 -0.0302575 + -0.0437806 -0.0355466 0.0381776 0.282109 0.674178 1.07582 + 1.45189 1.789 2.08649 2.34663 2.57245 2.81211 3.04778 3.2523 + 3.45877 3.65593 3.83396 3.9923 4.13368 4.25864 4.36719 4.46064 + 4.54086 4.60962 4.66835 4.71838 4.76094 4.79716 4.82796 + 4.85413 4.87634 4.89518 4.91116 4.92476 4.93631 4.94608 + 4.95434 4.9613 4.96715 4.97211 4.97638 4.98001 4.98312 4.98571 + 4.98795 4.98979 4.99138 4.99269 4.99381 4.99474 4.99551 + 4.99615 4.99668 4.99713 4.99752 4.99783 4.99811 4.99836 + 4.99858 4.99873 4.99884 4.99892 4.999 4.99907 4.99912 4.99916 + 4.99921 4.99926 4.99932 4.99937 4.99942 4.99948 4.99953 + 4.99956 4.99958 4.99961 4.99963 4.99966 4.99968 4.99971 + 4.99972 4.99973 4.99974 4.99975 4.99976 4.99977 4.99978 + 4.99979 4.9998 4.9998 4.99981 4.99982 4.99983 4.99984 4.99985 + 4.99986 4.99986 4.99987 4.99987 5.00498 5.00354 4.99359 + 4.98981 5.00498 5.00099 5.00041 5.00022 5.00015 5.00012 + 5.0001 5.00008 5.00005 5.00003 5 4.99431 4.99459 4.99591 + 5.00087 5.01029 5.03935 4.92784 4.51643 3.78356 2.68745 + 1.43417 0.583128 0.205094 0.0777337 0.0391566 0.02723 0.023883 + 0.018808 0.010165 0.00254623 -0.00377463 -0.0038097 0.00144145 + 0.00267231 0.00193045 0.00144538 0.00121758 0.00112893 0.00109424 + 0.0010226 0.000948072 0.000882573 0.000826996 0.000776391 + 0.000729719 0.000686499 0.000647333 0.000610108 0.000575631 + 0.000545069 0.000515485 0.000488514 0.000465316 0.000443215 + 0.000422454 0.00040292 0.00038488 0.000368472 0.000353628 + 0.000339643 0.000326197 0.000313483 0.000302884 0.000294038 + 0.000284003 0.000270941 0.000254925 0.000246511 0.000244089 + 0.000245538 0.000242099 0.000235728 0.000227482 0.000218001 + 0.000207257 0.000202127 0.000196997 0.000191868 0.000186738 + 0.000181608 0.00017758 0.000173899 0.000170219 0.000166538 + 0.000162857 0.000159576 0.00015679 0.000154005 0.000151219 + 0.000148433 0.000145647 0.000142861 0.000140076 0.00013729 + 0.000134504 0.000131718 0.000129603 0.000127635 0.000125668 + 0.0001237 0.000121732 0.000119765 0.000117797 0.000115829 + 0.000113862 0.000111894 0.000109993 0.000108372 0.000106751 + 0.00010513 0.000103509 0.000101887 0.000100266 9.86449e-05 + 9.70237e-05 EOD @v[29].set(<<-'EOD') - 5 4.99899 4.99654 4.99327 4.9863 4.98954 4.99212 4.99378 - 4.9951 4.99624 4.99715 4.99786 4.99839 4.99879 4.99909 4.99931 - 4.99922 4.99933 4.99971 5.00064 5.00084 5.00123 4.99865 - 4.99853 4.99983 5.00457 5.00242 5.00105 5.00062 5.00042 - 4.99971 4.9994 4.9992 4.9996 4.99955 4.99932 4.99918 4.99915 - 4.99919 4.99927 4.99937 4.99948 4.99957 4.99966 4.99974 - 4.9998 4.99985 4.99989 4.99992 4.99993 4.99994 4.99994 4.99996 - 4.99998 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 - 5.00001 5.00001 5 5 5 5 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 - 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5 5 5 5 5 5 4.9997 4.99998 4.99954 4.99963 - 5.00059 4.99945 4.99732 4.99957 5.00919 5.00558 5.00033 - 4.99851 4.9983 4.99854 4.99871 4.99928 4.99914 4.99939 4.99952 - 4.9998 4.99976 4.99744 4.99598 4.99478 4.99806 5.01911 5.04602 - 5.05469 5.01317 4.89484 4.69655 4.42036 4.06069 3.60793 - 3.12531 2.72975 2.45187 2.25081 2.09841 1.98509 1.90211 - 1.84084 1.79411 1.7574 1.72763 1.70283 1.68188 1.66389 1.64823 - 1.63438 1.62201 1.61088 1.60081 1.59163 1.58323 1.57549 - 1.56835 1.56173 1.55558 1.54985 1.54451 1.53951 1.53479 - 1.53035 1.52615 1.5222 1.51845 1.5149 1.51153 1.50834 1.50529 - 1.5024 1.49964 1.497 1.49449 1.49208 1.48977 1.48755 1.48542 - 1.48336 1.48138 1.47948 1.47765 1.4759 1.47419 1.47255 1.47096 - 1.46949 1.46823 1.46696 1.4657 1.46444 1.46317 1.46191 1.46065 - 1.45956 1.4585 1.45743 1.45636 1.45529 1.45422 1.45315 1.45226 - 1.45145 1.45064 1.44983 1.44902 1.44821 1.4474 1.44659 1.44579 - 1.44498 1.44417 1.44336 1.44255 1.44174 1.44094 1.44019 - 1.43944 1.43868 1.43793 1.43765 1.43679 1.43515 1.43405 - 1.43478 1.43387 1.43345 1.43184 1.43086 1.43021 1.43003 - 1.42988 1.42944 1.42883 1.42818 1.42702 1.42642 1.42595 - 1.42586 1.42616 1.42783 1.41733 1.38106 1.30738 1.3877 2.09819 - 3.05285 3.58059 3.77601 3.87609 4.02557 4.24887 4.4608 4.60411 - 4.72109 4.8255 4.90465 4.97379 5.01253 5.01532 5.01239 5.0092 - 5.00665 5.00474 5.00333 5.00232 5.00163 5.00117 5.00082 - 5.00057 5.00039 5.00027 5.00019 5.00013 5.00009 5.00006 - 5.00004 5.00003 5.00002 5.00001 5.00001 5 5 5 4.99998 4.99995 - 4.99992 4.99996 5.00005 5.00012 5.00008 4.99996 4.9999 4.99985 - 4.99986 4.99997 5.00021 5.0003 5.00024 5.00009 5.00007 5.00005 - 5.00003 5.00001 4.99998 4.99998 4.99998 4.99999 4.99999 - 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99998 - 4.99998 4.99998 + 5 4.99899 4.99654 4.99327 4.9863 4.98954 4.99212 4.99378 + 4.9951 4.99624 4.99715 4.99786 4.99839 4.99879 4.99909 4.99931 + 4.99922 4.99933 4.99971 5.00064 5.00084 5.00123 4.99865 + 4.99853 4.99983 5.00457 5.00242 5.00105 5.00062 5.00042 + 4.99971 4.9994 4.9992 4.9996 4.99955 4.99932 4.99918 4.99915 + 4.99919 4.99927 4.99937 4.99948 4.99957 4.99966 4.99974 + 4.9998 4.99985 4.99989 4.99992 4.99993 4.99994 4.99994 4.99996 + 4.99998 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 + 5.00001 5.00001 5 5 5 5 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 + 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5 5 5 5 5 5 4.9997 4.99998 4.99954 4.99963 + 5.00059 4.99945 4.99732 4.99957 5.00919 5.00558 5.00033 + 4.99851 4.9983 4.99854 4.99871 4.99928 4.99914 4.99939 4.99952 + 4.9998 4.99976 4.99744 4.99598 4.99478 4.99806 5.01911 5.04602 + 5.05469 5.01317 4.89484 4.69655 4.42036 4.06069 3.60793 + 3.12531 2.72975 2.45187 2.25081 2.09841 1.98509 1.90211 + 1.84084 1.79411 1.7574 1.72763 1.70283 1.68188 1.66389 1.64823 + 1.63438 1.62201 1.61088 1.60081 1.59163 1.58323 1.57549 + 1.56835 1.56173 1.55558 1.54985 1.54451 1.53951 1.53479 + 1.53035 1.52615 1.5222 1.51845 1.5149 1.51153 1.50834 1.50529 + 1.5024 1.49964 1.497 1.49449 1.49208 1.48977 1.48755 1.48542 + 1.48336 1.48138 1.47948 1.47765 1.4759 1.47419 1.47255 1.47096 + 1.46949 1.46823 1.46696 1.4657 1.46444 1.46317 1.46191 1.46065 + 1.45956 1.4585 1.45743 1.45636 1.45529 1.45422 1.45315 1.45226 + 1.45145 1.45064 1.44983 1.44902 1.44821 1.4474 1.44659 1.44579 + 1.44498 1.44417 1.44336 1.44255 1.44174 1.44094 1.44019 + 1.43944 1.43868 1.43793 1.43765 1.43679 1.43515 1.43405 + 1.43478 1.43387 1.43345 1.43184 1.43086 1.43021 1.43003 + 1.42988 1.42944 1.42883 1.42818 1.42702 1.42642 1.42595 + 1.42586 1.42616 1.42783 1.41733 1.38106 1.30738 1.3877 2.09819 + 3.05285 3.58059 3.77601 3.87609 4.02557 4.24887 4.4608 4.60411 + 4.72109 4.8255 4.90465 4.97379 5.01253 5.01532 5.01239 5.0092 + 5.00665 5.00474 5.00333 5.00232 5.00163 5.00117 5.00082 + 5.00057 5.00039 5.00027 5.00019 5.00013 5.00009 5.00006 + 5.00004 5.00003 5.00002 5.00001 5.00001 5 5 5 4.99998 4.99995 + 4.99992 4.99996 5.00005 5.00012 5.00008 4.99996 4.9999 4.99985 + 4.99986 4.99997 5.00021 5.0003 5.00024 5.00009 5.00007 5.00005 + 5.00003 5.00001 4.99998 4.99998 4.99998 4.99999 4.99999 + 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99998 + 4.99998 4.99998 EOD @v[30].set(<<-'EOD') - 7.10441e-10 5.70385e-05 0.000226143 0.000131916 -0.000887764 - -8.01837e-05 -3.49653e-05 9.40039e-05 0.000118663 0.000108025 - 8.6059e-05 6.33268e-05 4.99295e-05 3.16843e-05 3.60692e-05 - 2.07572e-05 -8.6375e-05 3.44583e-05 8.07397e-05 0.000196296 - 0.000115615 -7.12768e-05 -0.000129812 -4.18679e-05 7.94364e-05 - 0.000182034 -5.41226e-05 -0.000451819 -0.000713937 -0.00129863 - -0.00262186 -0.00213417 -0.00133767 0.000775698 0.000969902 - 0.000549281 0.000280946 0.000140321 8.6919e-05 7.22446e-05 - 6.5631e-05 6.45263e-05 6.63087e-05 7.17391e-05 7.59042e-05 - 7.59172e-05 7.03353e-05 6.33558e-05 5.31136e-05 4.64278e-05 - 4.40594e-05 4.16909e-05 4.05674e-05 3.96957e-05 3.87875e-05 - 3.74977e-05 3.62079e-05 3.49181e-05 3.36283e-05 3.23385e-05 - 3.12427e-05 3.02775e-05 2.93124e-05 2.83472e-05 2.7382e-05 - 2.64613e-05 2.59077e-05 2.5354e-05 2.48004e-05 2.42468e-05 - 2.36931e-05 2.31395e-05 2.25859e-05 2.20322e-05 2.14786e-05 - 2.0925e-05 2.03916e-05 1.9995e-05 1.95984e-05 1.92019e-05 - 1.88053e-05 1.84087e-05 1.80122e-05 1.76156e-05 1.7219e-05 - 1.68225e-05 1.64259e-05 1.6051e-05 1.57991e-05 1.55471e-05 - 1.52952e-05 1.50433e-05 1.47913e-05 1.45394e-05 1.42875e-05 - 1.40356e-05 1.37836e-05 1.35317e-05 1.32978e-05 1.31513e-05 - 1.30048e-05 1.28583e-05 1.27118e-05 1.25653e-05 1.24188e-05 - 1.22724e-05 1.21259e-05 1.19794e-05 1.18329e-05 1.16864e-05 - 1.15399e-05 1.13934e-05 1.12469e-05 1.11005e-05 1.0954e-05 - 1.08075e-05 1.0661e-05 1.05145e-05 1.0368e-05 1.02215e-05 - 1.76447e-05 7.21516e-05 -3.59786e-05 -0.000159618 0.000156236 - 0.000135106 -0.000336402 -0.000302283 0.000699323 0.000473866 - -0.000156146 -0.000225625 -0.000123592 -3.78116e-05 8.47472e-06 - 2.43387e-06 -7.44762e-05 7.80111e-05 9.43608e-05 0.000170159 - 8.83919e-05 -0.00018802 -0.000373512 -0.000390597 0.000156875 - 0.0032343 0.00776304 -0.000566905 -0.00760695 -0.0159226 - -0.0245989 -0.0331402 -0.0100902 0.067837 0.266702 0.910818 - 1.82282 2.69714 3.43247 3.98325 4.32893 4.51529 4.67087 - 4.79288 4.87574 4.92797 4.95902 4.97655 4.98622 4.99195 - 4.99526 4.99735 4.9991 4.99974 4.99982 4.99974 4.99961 4.9995 - 4.99943 4.9994 4.9994 4.99942 4.99944 4.99948 4.99952 4.99956 - 4.99961 4.99965 4.9997 4.99974 4.99977 4.99981 4.99983 4.99986 - 4.99988 4.9999 4.99991 4.99992 4.99993 4.99994 4.99995 4.99995 - 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 4.99999 - 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5 - 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 5 5.00019 4.99888 4.99663 4.99457 4.99902 - 5.00229 5.00323 5.00302 5.0023 5.0015 5.00085 5.00041 5.00013 - 4.99993 4.99979 4.99948 4.99954 4.99983 5.00055 5.00109 - 5.00009 4.9987 4.998 4.99755 4.99676 4.99618 5.01091 5.05272 - 5.04156 4.80112 4.27692 3.42343 2.23953 0.967179 0.429813 - 0.540757 1.32991 2.32147 3.14903 3.78143 4.22325 4.47978 - 4.59448 4.69875 4.79798 4.87419 4.92339 4.95249 4.97174 - 4.98408 4.99124 4.99478 4.99729 4.99868 4.9992 4.99941 4.99947 - 4.99946 4.99943 4.9994 4.99939 4.9994 4.99942 4.99946 4.99951 - 4.99956 4.99961 4.99967 4.99973 4.99977 4.9998 4.99981 4.99983 - 4.99984 4.99987 4.99992 5.00001 5.00005 5.00001 4.99994 - 4.99995 4.99995 4.99996 4.99996 4.99996 4.99997 4.99997 - 4.99997 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 - 4.99998 4.99998 4.99998 + 7.10441e-10 5.70385e-05 0.000226143 0.000131916 -0.000887764 + -8.01837e-05 -3.49653e-05 9.40039e-05 0.000118663 0.000108025 + 8.6059e-05 6.33268e-05 4.99295e-05 3.16843e-05 3.60692e-05 + 2.07572e-05 -8.6375e-05 3.44583e-05 8.07397e-05 0.000196296 + 0.000115615 -7.12768e-05 -0.000129812 -4.18679e-05 7.94364e-05 + 0.000182034 -5.41226e-05 -0.000451819 -0.000713937 -0.00129863 + -0.00262186 -0.00213417 -0.00133767 0.000775698 0.000969902 + 0.000549281 0.000280946 0.000140321 8.6919e-05 7.22446e-05 + 6.5631e-05 6.45263e-05 6.63087e-05 7.17391e-05 7.59042e-05 + 7.59172e-05 7.03353e-05 6.33558e-05 5.31136e-05 4.64278e-05 + 4.40594e-05 4.16909e-05 4.05674e-05 3.96957e-05 3.87875e-05 + 3.74977e-05 3.62079e-05 3.49181e-05 3.36283e-05 3.23385e-05 + 3.12427e-05 3.02775e-05 2.93124e-05 2.83472e-05 2.7382e-05 + 2.64613e-05 2.59077e-05 2.5354e-05 2.48004e-05 2.42468e-05 + 2.36931e-05 2.31395e-05 2.25859e-05 2.20322e-05 2.14786e-05 + 2.0925e-05 2.03916e-05 1.9995e-05 1.95984e-05 1.92019e-05 + 1.88053e-05 1.84087e-05 1.80122e-05 1.76156e-05 1.7219e-05 + 1.68225e-05 1.64259e-05 1.6051e-05 1.57991e-05 1.55471e-05 + 1.52952e-05 1.50433e-05 1.47913e-05 1.45394e-05 1.42875e-05 + 1.40356e-05 1.37836e-05 1.35317e-05 1.32978e-05 1.31513e-05 + 1.30048e-05 1.28583e-05 1.27118e-05 1.25653e-05 1.24188e-05 + 1.22724e-05 1.21259e-05 1.19794e-05 1.18329e-05 1.16864e-05 + 1.15399e-05 1.13934e-05 1.12469e-05 1.11005e-05 1.0954e-05 + 1.08075e-05 1.0661e-05 1.05145e-05 1.0368e-05 1.02215e-05 + 1.76447e-05 7.21516e-05 -3.59786e-05 -0.000159618 0.000156236 + 0.000135106 -0.000336402 -0.000302283 0.000699323 0.000473866 + -0.000156146 -0.000225625 -0.000123592 -3.78116e-05 8.47472e-06 + 2.43387e-06 -7.44762e-05 7.80111e-05 9.43608e-05 0.000170159 + 8.83919e-05 -0.00018802 -0.000373512 -0.000390597 0.000156875 + 0.0032343 0.00776304 -0.000566905 -0.00760695 -0.0159226 + -0.0245989 -0.0331402 -0.0100902 0.067837 0.266702 0.910818 + 1.82282 2.69714 3.43247 3.98325 4.32893 4.51529 4.67087 + 4.79288 4.87574 4.92797 4.95902 4.97655 4.98622 4.99195 + 4.99526 4.99735 4.9991 4.99974 4.99982 4.99974 4.99961 4.9995 + 4.99943 4.9994 4.9994 4.99942 4.99944 4.99948 4.99952 4.99956 + 4.99961 4.99965 4.9997 4.99974 4.99977 4.99981 4.99983 4.99986 + 4.99988 4.9999 4.99991 4.99992 4.99993 4.99994 4.99995 4.99995 + 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 4.99999 + 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5 + 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 5 5.00019 4.99888 4.99663 4.99457 4.99902 + 5.00229 5.00323 5.00302 5.0023 5.0015 5.00085 5.00041 5.00013 + 4.99993 4.99979 4.99948 4.99954 4.99983 5.00055 5.00109 + 5.00009 4.9987 4.998 4.99755 4.99676 4.99618 5.01091 5.05272 + 5.04156 4.80112 4.27692 3.42343 2.23953 0.967179 0.429813 + 0.540757 1.32991 2.32147 3.14903 3.78143 4.22325 4.47978 + 4.59448 4.69875 4.79798 4.87419 4.92339 4.95249 4.97174 + 4.98408 4.99124 4.99478 4.99729 4.99868 4.9992 4.99941 4.99947 + 4.99946 4.99943 4.9994 4.99939 4.9994 4.99942 4.99946 4.99951 + 4.99956 4.99961 4.99967 4.99973 4.99977 4.9998 4.99981 4.99983 + 4.99984 4.99987 4.99992 5.00001 5.00005 5.00001 4.99994 + 4.99995 4.99995 4.99996 4.99996 4.99996 4.99997 4.99997 + 4.99997 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 + 4.99998 4.99998 4.99998 EOD @v[31].set(<<-'EOD') - 1.8179e-09 -5.28841e-06 -1.44913e-05 -3.62932e-05 -9.75719e-05 - 0.000141781 3.73396e-05 -1.65603e-05 -1.5271e-05 -6.73884e-06 - 4.40157e-06 -4.85345e-06 -1.02964e-05 2.03126e-05 -1.89457e-05 - -8.75564e-06 7.67422e-06 4.71103e-06 1.29798e-05 6.13469e-06 - -1.14363e-05 -0.0394563 -0.0477298 -0.0622012 -0.0519225 - 0.262499 0.943611 1.67052 2.31017 2.84028 3.28467 3.61582 - 3.85887 4.13011 4.36511 4.54063 4.67013 4.76408 4.83263 - 4.8825 4.91837 4.94373 4.96117 4.97318 4.98093 4.98562 4.98906 - 4.99267 4.99539 4.99666 4.99731 4.99797 4.99844 4.99887 - 4.99927 4.99933 4.99938 4.99944 4.99949 4.99955 4.9996 4.99965 - 4.9997 4.99975 4.9998 4.99985 4.99986 4.99987 4.99989 4.9999 - 4.99991 4.99992 4.99993 4.99995 4.99996 4.99997 4.99998 - 4.99998 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5.00001 - 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99997 5.00002 5.00004 5.0001 5.0001 4.99987 5.00009 - 5.00021 5.00002 5.00004 4.99988 5.00013 4.99993 5.00026 - 4.99973 5 5.00006 5.00009 5.00004 5.00004 5.04854 4.82711 - 4.04208 2.64155 0.838902 0.19014 0.0982549 0.0723197 0.0576863 - 0.0427644 0.0301979 0.020146 0.0135728 0.00980358 0.00774482 - 0.00586604 0.0036687 0.00211511 0.00121906 0.000647581 0.000828436 - 0.00190938 0.00224254 0.00199956 0.00165488 0.00135612 0.00113715 - 0.000984181 0.000877175 0.000789973 0.000741139 0.000689338 - 0.000625676 0.000586082 0.000550152 0.000529573 0.000505606 - 0.000482117 0.000460574 0.000441649 0.000424674 0.000408398 - 0.000391914 0.000376272 0.000361487 0.000348181 0.000336045 - 0.000324466 0.000313545 0.000303046 0.000293056 0.00028356 - 0.000274586 0.000266155 0.000258279 0.000250938 0.000243789 - 0.000236912 0.000230244 0.000224186 0.000219291 0.000215346 - 0.000212468 0.000207291 0.000200862 0.00019368 0.000186767 - 0.000183515 0.000180263 0.00017701 0.000173758 0.000170506 - 0.000167253 0.000164001 0.000161164 0.000158357 0.00015555 - 0.000152743 0.000149936 0.000147129 0.000144322 0.000142066 - 0.000140096 0.000138127 0.000136157 0.000134187 0.000132218 - 0.000130248 0.000128278 0.000126308 0.000124339 0.000122369 - 0.000120399 0.000118429 0.00011646 0.000114527 0.000112892 - 0.000111258 0.000109623 0.000107988 0.000103598 6.86052e-05 - 3.337e-05 7.00783e-05 0.000218764 0.000221318 0.000118593 - -0.000113962 5.78552e-05 9.42068e-05 0.000237037 0.000171302 - 0.0001033 6.16066e-05 5.52908e-05 6.30233e-05 7.01897e-05 - 8.48573e-05 0.000106859 8.37213e-05 -0.0391541 -0.047722 - -0.0618454 -0.0169804 0.345725 1.03426 1.74825 2.37152 2.88737 - 3.32173 3.66761 3.9707 4.17762 3.98832 3.30483 2.09737 0.710892 - 0.148159 0.0707463 0.0555808 0.045618 0.0319116 0.0199589 - 0.0133357 0.00898528 0.00586075 0.00375478 0.00245443 0.00156038 - 0.000962344 0.000590953 0.000375107 0.000250243 0.00015882 - 0.000100203 6.18122e-05 3.7372e-05 2.23009e-05 1.32569e-05 - 8.29437e-06 5.72457e-06 3.96832e-06 2.98935e-06 2.59699e-06 - 2.75024e-06 3.38689e-06 4.0453e-06 3.50095e-06 1.64988e-06 - -3.84371e-07 -2.03828e-06 -3.46401e-06 -1.24301e-06 4.63458e-06 - 1.14104e-05 1.02619e-05 2.15487e-06 -2.98487e-06 -3.67221e-06 - -2.94279e-06 -2.58649e-06 -2.23019e-06 -1.87389e-06 -1.5176e-06 - -1.1613e-06 -7.92127e-07 -4.18889e-07 -4.56502e-08 3.27588e-07 - 7.00827e-07 8.79539e-07 8.17025e-07 7.5451e-07 6.91996e-07 - 6.29481e-07 5.66966e-07 5.04452e-07 4.41937e-07 3.79422e-07 - 3.16908e-07 2.54393e-07 1.90078e-07 1.25366e-07 6.0654e-08 - -4.05776e-09 -6.87696e-08 -1.33481e-07 -1.98193e-07 -2.62905e-07 - -3.27617e-07 -3.92329e-07 -4.40392e-07 -4.18802e-07 -3.97213e-07 - -3.75624e-07 -3.54035e-07 -3.32446e-07 -3.10856e-07 -2.89267e-07 - -2.67678e-07 + 1.8179e-09 -5.28841e-06 -1.44913e-05 -3.62932e-05 -9.75719e-05 + 0.000141781 3.73396e-05 -1.65603e-05 -1.5271e-05 -6.73884e-06 + 4.40157e-06 -4.85345e-06 -1.02964e-05 2.03126e-05 -1.89457e-05 + -8.75564e-06 7.67422e-06 4.71103e-06 1.29798e-05 6.13469e-06 + -1.14363e-05 -0.0394563 -0.0477298 -0.0622012 -0.0519225 + 0.262499 0.943611 1.67052 2.31017 2.84028 3.28467 3.61582 + 3.85887 4.13011 4.36511 4.54063 4.67013 4.76408 4.83263 + 4.8825 4.91837 4.94373 4.96117 4.97318 4.98093 4.98562 4.98906 + 4.99267 4.99539 4.99666 4.99731 4.99797 4.99844 4.99887 + 4.99927 4.99933 4.99938 4.99944 4.99949 4.99955 4.9996 4.99965 + 4.9997 4.99975 4.9998 4.99985 4.99986 4.99987 4.99989 4.9999 + 4.99991 4.99992 4.99993 4.99995 4.99996 4.99997 4.99998 + 4.99998 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5.00001 + 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99997 5.00002 5.00004 5.0001 5.0001 4.99987 5.00009 + 5.00021 5.00002 5.00004 4.99988 5.00013 4.99993 5.00026 + 4.99973 5 5.00006 5.00009 5.00004 5.00004 5.04854 4.82711 + 4.04208 2.64155 0.838902 0.19014 0.0982549 0.0723197 0.0576863 + 0.0427644 0.0301979 0.020146 0.0135728 0.00980358 0.00774482 + 0.00586604 0.0036687 0.00211511 0.00121906 0.000647581 0.000828436 + 0.00190938 0.00224254 0.00199956 0.00165488 0.00135612 0.00113715 + 0.000984181 0.000877175 0.000789973 0.000741139 0.000689338 + 0.000625676 0.000586082 0.000550152 0.000529573 0.000505606 + 0.000482117 0.000460574 0.000441649 0.000424674 0.000408398 + 0.000391914 0.000376272 0.000361487 0.000348181 0.000336045 + 0.000324466 0.000313545 0.000303046 0.000293056 0.00028356 + 0.000274586 0.000266155 0.000258279 0.000250938 0.000243789 + 0.000236912 0.000230244 0.000224186 0.000219291 0.000215346 + 0.000212468 0.000207291 0.000200862 0.00019368 0.000186767 + 0.000183515 0.000180263 0.00017701 0.000173758 0.000170506 + 0.000167253 0.000164001 0.000161164 0.000158357 0.00015555 + 0.000152743 0.000149936 0.000147129 0.000144322 0.000142066 + 0.000140096 0.000138127 0.000136157 0.000134187 0.000132218 + 0.000130248 0.000128278 0.000126308 0.000124339 0.000122369 + 0.000120399 0.000118429 0.00011646 0.000114527 0.000112892 + 0.000111258 0.000109623 0.000107988 0.000103598 6.86052e-05 + 3.337e-05 7.00783e-05 0.000218764 0.000221318 0.000118593 + -0.000113962 5.78552e-05 9.42068e-05 0.000237037 0.000171302 + 0.0001033 6.16066e-05 5.52908e-05 6.30233e-05 7.01897e-05 + 8.48573e-05 0.000106859 8.37213e-05 -0.0391541 -0.047722 + -0.0618454 -0.0169804 0.345725 1.03426 1.74825 2.37152 2.88737 + 3.32173 3.66761 3.9707 4.17762 3.98832 3.30483 2.09737 0.710892 + 0.148159 0.0707463 0.0555808 0.045618 0.0319116 0.0199589 + 0.0133357 0.00898528 0.00586075 0.00375478 0.00245443 0.00156038 + 0.000962344 0.000590953 0.000375107 0.000250243 0.00015882 + 0.000100203 6.18122e-05 3.7372e-05 2.23009e-05 1.32569e-05 + 8.29437e-06 5.72457e-06 3.96832e-06 2.98935e-06 2.59699e-06 + 2.75024e-06 3.38689e-06 4.0453e-06 3.50095e-06 1.64988e-06 + -3.84371e-07 -2.03828e-06 -3.46401e-06 -1.24301e-06 4.63458e-06 + 1.14104e-05 1.02619e-05 2.15487e-06 -2.98487e-06 -3.67221e-06 + -2.94279e-06 -2.58649e-06 -2.23019e-06 -1.87389e-06 -1.5176e-06 + -1.1613e-06 -7.92127e-07 -4.18889e-07 -4.56502e-08 3.27588e-07 + 7.00827e-07 8.79539e-07 8.17025e-07 7.5451e-07 6.91996e-07 + 6.29481e-07 5.66966e-07 5.04452e-07 4.41937e-07 3.79422e-07 + 3.16908e-07 2.54393e-07 1.90078e-07 1.25366e-07 6.0654e-08 + -4.05776e-09 -6.87696e-08 -1.33481e-07 -1.98193e-07 -2.62905e-07 + -3.27617e-07 -3.92329e-07 -4.40392e-07 -4.18802e-07 -3.97213e-07 + -3.75624e-07 -3.54035e-07 -3.32446e-07 -3.10856e-07 -2.89267e-07 + -2.67678e-07 EOD @v[32].set(<<-'EOD') - 1.10294 1.10297 1.10291 1.10277 1.10259 1.10294 1.10313 - 1.10306 1.10299 1.10296 1.10295 1.10295 1.10294 1.10294 - 1.10294 1.10294 1.10294 1.10294 1.10294 1.10296 1.10296 - 1.00547 0.998599 1.5201 2.49297 3.31258 3.73162 3.84757 - 3.92505 4.02965 4.16599 4.30294 4.41541 4.52886 4.64414 - 4.73865 4.81065 4.86391 4.90315 4.93188 4.95258 4.96726 - 4.97738 4.98436 4.98888 4.99162 4.99363 4.99573 4.99731 - 4.99804 4.99843 4.99881 4.99909 4.99934 4.99957 4.9996 4.99964 - 4.99967 4.9997 4.99973 4.99977 4.9998 4.99983 4.99986 4.99988 - 4.99991 4.99992 4.99992 4.99993 4.99994 4.99994 4.99995 - 4.99996 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 - 4.99999 4.99999 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 5.00028 4.99988 4.99968 - 5.00019 4.99987 5.00021 4.99973 4.99977 4.99996 4.99997 - 5.0002 4.99957 5.00026 4.99947 5.00074 5.00003 4.99987 4.99979 - 5.00008 4.99997 5.08794 5.05993 4.76875 3.99197 3.10174 - 2.5197 2.21771 2.04 1.92235 1.83874 1.77592 1.72665 1.686 - 1.65276 1.6286 1.61299 1.60039 1.58934 1.57954 1.57083 1.56306 - 1.55604 1.54963 1.54375 1.53832 1.53331 1.52865 1.52432 - 1.52026 1.51645 1.51287 1.50949 1.50629 1.50327 1.50039 - 1.49766 1.49505 1.49257 1.49019 1.48792 1.48574 1.48365 - 1.48164 1.47971 1.47784 1.47604 1.47431 1.47264 1.47102 - 1.46945 1.46794 1.46647 1.46505 1.46367 1.46233 1.46103 - 1.45976 1.45853 1.45733 1.45616 1.45502 1.45392 1.45284 - 1.45179 1.45076 1.44975 1.4488 1.44795 1.44711 1.44626 1.44541 - 1.44457 1.44372 1.44287 1.44212 1.44138 1.44063 1.43989 - 1.43914 1.4384 1.43766 1.43701 1.43641 1.43581 1.43522 1.43462 - 1.43402 1.43342 1.43282 1.43223 1.43163 1.43103 1.43043 - 1.42984 1.42924 1.42865 1.42808 1.42752 1.42695 1.42639 - 1.42584 1.42529 1.42472 1.42412 1.42365 1.42326 1.42304 - 1.42162 1.42082 1.42032 1.42029 1.42026 1.41995 1.41947 - 1.41894 1.41841 1.4179 1.41742 1.41699 1.41656 1.32097 1.30963 - 1.78765 2.64656 3.35764 3.747 3.86589 3.94217 4.04185 4.18453 - 4.3561 4.53439 4.68621 4.74905 4.77848 4.84629 4.91261 4.97541 - 5.01284 5.01548 5.01248 5.00924 5.00666 5.00475 5.00334 - 5.00234 5.00164 5.00118 5.00083 5.00058 5.0004 5.00028 5.00019 - 5.00013 5.00009 5.00007 5.00004 5.00003 5.00002 5.00001 - 5.00001 5.00001 5 5 4.99999 4.99995 4.99992 4.99996 5.00006 - 5.00012 5.00009 4.99997 4.9999 4.99985 4.99986 4.99997 5.00021 - 5.00031 5.00024 5.0001 5.00007 5.00005 5.00003 5.00001 4.99998 - 4.99998 4.99999 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 - 5 4.99999 4.99999 4.99999 4.99998 4.99998 4.99998 + 1.10294 1.10297 1.10291 1.10277 1.10259 1.10294 1.10313 + 1.10306 1.10299 1.10296 1.10295 1.10295 1.10294 1.10294 + 1.10294 1.10294 1.10294 1.10294 1.10294 1.10296 1.10296 + 1.00547 0.998599 1.5201 2.49297 3.31258 3.73162 3.84757 + 3.92505 4.02965 4.16599 4.30294 4.41541 4.52886 4.64414 + 4.73865 4.81065 4.86391 4.90315 4.93188 4.95258 4.96726 + 4.97738 4.98436 4.98888 4.99162 4.99363 4.99573 4.99731 + 4.99804 4.99843 4.99881 4.99909 4.99934 4.99957 4.9996 4.99964 + 4.99967 4.9997 4.99973 4.99977 4.9998 4.99983 4.99986 4.99988 + 4.99991 4.99992 4.99992 4.99993 4.99994 4.99994 4.99995 + 4.99996 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 + 4.99999 4.99999 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 5.00028 4.99988 4.99968 + 5.00019 4.99987 5.00021 4.99973 4.99977 4.99996 4.99997 + 5.0002 4.99957 5.00026 4.99947 5.00074 5.00003 4.99987 4.99979 + 5.00008 4.99997 5.08794 5.05993 4.76875 3.99197 3.10174 + 2.5197 2.21771 2.04 1.92235 1.83874 1.77592 1.72665 1.686 + 1.65276 1.6286 1.61299 1.60039 1.58934 1.57954 1.57083 1.56306 + 1.55604 1.54963 1.54375 1.53832 1.53331 1.52865 1.52432 + 1.52026 1.51645 1.51287 1.50949 1.50629 1.50327 1.50039 + 1.49766 1.49505 1.49257 1.49019 1.48792 1.48574 1.48365 + 1.48164 1.47971 1.47784 1.47604 1.47431 1.47264 1.47102 + 1.46945 1.46794 1.46647 1.46505 1.46367 1.46233 1.46103 + 1.45976 1.45853 1.45733 1.45616 1.45502 1.45392 1.45284 + 1.45179 1.45076 1.44975 1.4488 1.44795 1.44711 1.44626 1.44541 + 1.44457 1.44372 1.44287 1.44212 1.44138 1.44063 1.43989 + 1.43914 1.4384 1.43766 1.43701 1.43641 1.43581 1.43522 1.43462 + 1.43402 1.43342 1.43282 1.43223 1.43163 1.43103 1.43043 + 1.42984 1.42924 1.42865 1.42808 1.42752 1.42695 1.42639 + 1.42584 1.42529 1.42472 1.42412 1.42365 1.42326 1.42304 + 1.42162 1.42082 1.42032 1.42029 1.42026 1.41995 1.41947 + 1.41894 1.41841 1.4179 1.41742 1.41699 1.41656 1.32097 1.30963 + 1.78765 2.64656 3.35764 3.747 3.86589 3.94217 4.04185 4.18453 + 4.3561 4.53439 4.68621 4.74905 4.77848 4.84629 4.91261 4.97541 + 5.01284 5.01548 5.01248 5.00924 5.00666 5.00475 5.00334 + 5.00234 5.00164 5.00118 5.00083 5.00058 5.0004 5.00028 5.00019 + 5.00013 5.00009 5.00007 5.00004 5.00003 5.00002 5.00001 + 5.00001 5.00001 5 5 4.99999 4.99995 4.99992 4.99996 5.00006 + 5.00012 5.00009 4.99997 4.9999 4.99985 4.99986 4.99997 5.00021 + 5.00031 5.00024 5.0001 5.00007 5.00005 5.00003 5.00001 4.99998 + 4.99998 4.99999 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 + 5 4.99999 4.99999 4.99999 4.99998 4.99998 4.99998 EOD @v[33].set(<<-'EOD') - 5 5.00012 5.00023 5.0003 4.99972 4.99988 4.99984 4.99991 - 4.99996 4.99999 5.00008 5.00009 4.99986 5.00003 5.00007 - 4.99995 4.9999 4.99997 5.00013 5.00014 5.00013 4.99701 4.99763 - 4.99742 4.99998 5.02836 5.07262 4.96856 4.57267 3.85637 - 2.79544 1.45942 0.408016 0.084885 0.0271375 0.0119294 0.00707546 - 0.0051087 0.00373035 0.00264737 0.00186477 0.00130379 0.000915857 - 0.000653121 0.000483893 0.000380852 0.000302362 0.000219498 - 0.000154435 0.000121928 0.000104026 8.61242e-05 7.48526e-05 - 6.49216e-05 5.56238e-05 5.29689e-05 5.03139e-05 4.7659e-05 - 4.5004e-05 4.23491e-05 4.00356e-05 3.79522e-05 3.58687e-05 - 3.37852e-05 3.17018e-05 2.97592e-05 2.89804e-05 2.82016e-05 - 2.74228e-05 2.66441e-05 2.58653e-05 2.50865e-05 2.43077e-05 - 2.35289e-05 2.27501e-05 2.19714e-05 2.12346e-05 2.07821e-05 - 2.03295e-05 1.98769e-05 1.94244e-05 1.89718e-05 1.85192e-05 - 1.80667e-05 1.76141e-05 1.71615e-05 1.6709e-05 1.62828e-05 - 1.60061e-05 1.57294e-05 1.54527e-05 1.5176e-05 1.48993e-05 - 1.46226e-05 1.43459e-05 1.40692e-05 1.37925e-05 1.35158e-05 - 1.3262e-05 1.31191e-05 1.29761e-05 1.28332e-05 1.26903e-05 - 1.25474e-05 1.24045e-05 1.22615e-05 1.21186e-05 1.19757e-05 - 1.18328e-05 1.16898e-05 1.15469e-05 1.1404e-05 1.12611e-05 - 1.11182e-05 1.09752e-05 1.08323e-05 1.06894e-05 1.05465e-05 - 1.04036e-05 1.02606e-05 1.00185e-05 3.8343e-05 -3.06781e-05 - -0.000111758 0.000111673 0.000130815 -0.000210491 -0.000231304 - 0.000310226 0.000265303 3.0878e-05 -4.48405e-05 -1.2852e-05 - -7.84469e-06 3.29986e-05 -1.23286e-05 -6.07871e-05 5.35082e-05 - 7.69194e-05 0.000126221 6.57178e-05 0.00223349 -0.0148854 - -0.0476636 -0.0491447 0.220125 1.11174 2.03988 2.90209 3.61069 - 4.13554 4.50679 4.71501 4.83916 4.91027 4.95284 4.98086 - 4.99151 4.98651 4.97113 4.95075 4.93102 4.93683 4.95457 - 4.97071 4.98212 4.98948 4.99386 4.99636 4.99785 4.9987 4.99927 - 4.99989 5.00014 5.00007 4.99988 4.99982 4.99976 4.99973 - 4.99972 4.99972 4.99973 4.99974 4.99975 4.99977 4.99979 - 4.99981 4.99984 4.99986 4.99988 4.99989 4.99991 4.99992 - 4.99993 4.99994 4.99995 4.99996 4.99996 4.99997 4.99997 - 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 - 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00002 5.00001 5.00001 - 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 5 5.00012 4.99946 4.99839 4.99733 - 4.99948 5.00114 5.00158 5.00147 5.00113 5.00073 5.00043 - 5.0002 5.00006 4.99995 4.99986 4.99973 4.99976 4.9999 5.00029 - 5.00055 4.99704 4.99734 4.9972 5.00278 5.03354 5.07184 4.94057 - 4.51936 3.75638 2.60982 1.23803 0.315016 0.0796102 0.0252894 - 0.0165723 0.0827785 0.491298 1.40686 2.33436 3.1251 3.7691 - 4.22201 4.49976 4.68115 4.80513 4.88509 4.93208 4.95861 - 4.97579 4.98655 4.99268 4.99571 4.99771 4.99881 4.99929 - 4.99954 4.99965 4.9997 4.99971 4.99971 4.99971 4.99971 4.99972 - 4.99974 4.99976 4.99978 4.99981 4.99984 4.99987 4.99989 - 4.99991 4.99991 4.99992 4.99992 4.99993 4.99997 5.00003 - 5.00006 5.00004 5.00001 5 4.99999 4.99998 4.99998 4.99997 - 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 4.99999 - 4.99999 4.99999 4.99999 4.99998 4.99998 + 5 5.00012 5.00023 5.0003 4.99972 4.99988 4.99984 4.99991 + 4.99996 4.99999 5.00008 5.00009 4.99986 5.00003 5.00007 + 4.99995 4.9999 4.99997 5.00013 5.00014 5.00013 4.99701 4.99763 + 4.99742 4.99998 5.02836 5.07262 4.96856 4.57267 3.85637 + 2.79544 1.45942 0.408016 0.084885 0.0271375 0.0119294 0.00707546 + 0.0051087 0.00373035 0.00264737 0.00186477 0.00130379 0.000915857 + 0.000653121 0.000483893 0.000380852 0.000302362 0.000219498 + 0.000154435 0.000121928 0.000104026 8.61242e-05 7.48526e-05 + 6.49216e-05 5.56238e-05 5.29689e-05 5.03139e-05 4.7659e-05 + 4.5004e-05 4.23491e-05 4.00356e-05 3.79522e-05 3.58687e-05 + 3.37852e-05 3.17018e-05 2.97592e-05 2.89804e-05 2.82016e-05 + 2.74228e-05 2.66441e-05 2.58653e-05 2.50865e-05 2.43077e-05 + 2.35289e-05 2.27501e-05 2.19714e-05 2.12346e-05 2.07821e-05 + 2.03295e-05 1.98769e-05 1.94244e-05 1.89718e-05 1.85192e-05 + 1.80667e-05 1.76141e-05 1.71615e-05 1.6709e-05 1.62828e-05 + 1.60061e-05 1.57294e-05 1.54527e-05 1.5176e-05 1.48993e-05 + 1.46226e-05 1.43459e-05 1.40692e-05 1.37925e-05 1.35158e-05 + 1.3262e-05 1.31191e-05 1.29761e-05 1.28332e-05 1.26903e-05 + 1.25474e-05 1.24045e-05 1.22615e-05 1.21186e-05 1.19757e-05 + 1.18328e-05 1.16898e-05 1.15469e-05 1.1404e-05 1.12611e-05 + 1.11182e-05 1.09752e-05 1.08323e-05 1.06894e-05 1.05465e-05 + 1.04036e-05 1.02606e-05 1.00185e-05 3.8343e-05 -3.06781e-05 + -0.000111758 0.000111673 0.000130815 -0.000210491 -0.000231304 + 0.000310226 0.000265303 3.0878e-05 -4.48405e-05 -1.2852e-05 + -7.84469e-06 3.29986e-05 -1.23286e-05 -6.07871e-05 5.35082e-05 + 7.69194e-05 0.000126221 6.57178e-05 0.00223349 -0.0148854 + -0.0476636 -0.0491447 0.220125 1.11174 2.03988 2.90209 3.61069 + 4.13554 4.50679 4.71501 4.83916 4.91027 4.95284 4.98086 + 4.99151 4.98651 4.97113 4.95075 4.93102 4.93683 4.95457 + 4.97071 4.98212 4.98948 4.99386 4.99636 4.99785 4.9987 4.99927 + 4.99989 5.00014 5.00007 4.99988 4.99982 4.99976 4.99973 + 4.99972 4.99972 4.99973 4.99974 4.99975 4.99977 4.99979 + 4.99981 4.99984 4.99986 4.99988 4.99989 4.99991 4.99992 + 4.99993 4.99994 4.99995 4.99996 4.99996 4.99997 4.99997 + 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 + 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00002 5.00001 5.00001 + 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 5 5.00012 4.99946 4.99839 4.99733 + 4.99948 5.00114 5.00158 5.00147 5.00113 5.00073 5.00043 + 5.0002 5.00006 4.99995 4.99986 4.99973 4.99976 4.9999 5.00029 + 5.00055 4.99704 4.99734 4.9972 5.00278 5.03354 5.07184 4.94057 + 4.51936 3.75638 2.60982 1.23803 0.315016 0.0796102 0.0252894 + 0.0165723 0.0827785 0.491298 1.40686 2.33436 3.1251 3.7691 + 4.22201 4.49976 4.68115 4.80513 4.88509 4.93208 4.95861 + 4.97579 4.98655 4.99268 4.99571 4.99771 4.99881 4.99929 + 4.99954 4.99965 4.9997 4.99971 4.99971 4.99971 4.99971 4.99972 + 4.99974 4.99976 4.99978 4.99981 4.99984 4.99987 4.99989 + 4.99991 4.99991 4.99992 4.99992 4.99993 4.99997 5.00003 + 5.00006 5.00004 5.00001 5 4.99999 4.99998 4.99998 4.99997 + 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 4.99999 + 4.99999 4.99999 4.99999 4.99998 4.99998 EOD @v[34].set(<<-'EOD') - 5 5.00207 5.00813 5.01486 5.00156 5.0018 4.99861 4.99844 - 4.99888 4.9993 4.99956 4.99971 4.99979 4.99983 4.99987 4.99989 - 4.99671 4.9974 4.99864 5.00131 5.00377 5.0021 5.00039 4.99993 - 5.00004 5.0009 5.00109 4.99636 4.98617 4.96778 4.92047 4.89528 - 4.91112 4.9559 4.98286 4.99369 4.99812 4.99951 4.99994 5.00014 - 5.00008 4.99994 4.99984 4.99989 4.99998 5.00004 5.00004 - 5.00006 5.00005 5.00001 4.99997 4.99992 4.99993 4.99994 - 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 - 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 - 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 - 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 - 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99998 4.99998 5.00131 5.00072 4.9977 4.99811 - 5.00325 4.99647 4.98948 4.99459 5.00262 5.00276 5.00156 - 5.00072 5.0003 5.00013 4.99995 4.99668 4.99775 4.99917 5.00173 - 5.00386 5.00188 4.99888 4.99757 4.99951 5.01712 5.0557 5.07088 - 5.07704 5.07758 5.06958 5.04223 5.03331 5.0279 5.03408 5.07611 - 5.01911 4.68594 3.99152 2.92195 1.69878 0.809 0.344091 0.154663 - 0.0788717 0.0467212 0.0336168 0.0280514 0.0254947 0.024173 - 0.0223567 0.0220555 0.0271514 0.0295872 0.0296052 0.0283971 - 0.0264726 0.0241813 0.0218244 0.0195349 0.017368 0.0152495 - 0.013295 0.0115444 0.00996982 0.00857091 0.00733891 0.00627261 - 0.0053494 0.00456316 0.00388373 0.00331073 0.00282181 0.00240991 - 0.00206389 0.00177187 0.00152283 0.00131167 0.00112558 0.000954373 - 0.000805726 0.00069326 0.000600991 0.000525743 0.00047355 - 0.00044359 0.000434815 0.000436053 0.000402511 0.000368969 - 0.000335427 0.000301886 0.000268344 0.000234802 0.00020126 - 0.000184967 0.000169932 0.000154896 0.000139861 0.000124825 - 0.00010979 9.47546e-05 8.67896e-05 8.24901e-05 7.81906e-05 - 7.38911e-05 6.95915e-05 6.5292e-05 6.09925e-05 5.66929e-05 - 5.23934e-05 4.80939e-05 4.37943e-05 3.94948e-05 3.51953e-05 - 3.08957e-05 2.67968e-05 2.42936e-05 2.17904e-05 1.92872e-05 - 1.6784e-05 0.00125927 -0.00794344 -0.0305499 -0.0621697 - -0.0463796 -0.0224608 -0.00538381 0.00546086 0.0108675 0.012883 - 0.0131787 0.0127271 0.0119702 0.0110398 0.0100635 0.00649617 - 0.00489388 0.00545863 0.0098351 0.0167428 0.0126563 0.00697542 - 0.00427027 0.00330002 0.00390774 0.00408999 -0.00259143 - -0.0160578 -0.0451849 -0.0409651 0.1301 0.597429 1.3848 - 2.63426 3.81272 4.51373 4.8412 4.98731 4.88165 4.37165 3.40034 - 2.17681 1.12217 0.505129 0.219703 0.104992 0.0622333 0.0448317 - 0.0355782 0.0311867 0.0293529 0.0274615 0.0288739 0.0307845 - 0.0304909 0.029245 0.0273602 0.0251006 0.022697 0.0202765 - 0.0179357 0.0157106 0.0136562 0.0117951 0.0101273 0.00865784 - 0.00739394 0.00634364 0.00551356 0.00480538 0.00415747 0.00356084 - 0.00297585 0.00236711 0.00181853 0.00160713 0.00169822 0.00166542 - 0.00145504 0.00120252 0.00109259 0.000982658 0.00087273 - 0.000762802 0.000652874 0.000584068 0.000528263 0.000472458 - 0.000416653 0.000360848 0.000321155 0.000301442 0.000281729 - 0.000262016 0.000242303 0.00022259 0.000202877 0.000183164 - 0.000163451 0.000143738 0.000124025 0.000114582 0.000107399 - 0.000100216 9.30332e-05 8.58502e-05 7.86672e-05 7.14841e-05 - 6.43011e-05 5.7118e-05 4.9935e-05 4.35378e-05 4.04281e-05 - 3.73184e-05 3.42088e-05 3.10991e-05 2.79894e-05 2.48798e-05 - 2.17701e-05 1.86604e-05 + 5 5.00207 5.00813 5.01486 5.00156 5.0018 4.99861 4.99844 + 4.99888 4.9993 4.99956 4.99971 4.99979 4.99983 4.99987 4.99989 + 4.99671 4.9974 4.99864 5.00131 5.00377 5.0021 5.00039 4.99993 + 5.00004 5.0009 5.00109 4.99636 4.98617 4.96778 4.92047 4.89528 + 4.91112 4.9559 4.98286 4.99369 4.99812 4.99951 4.99994 5.00014 + 5.00008 4.99994 4.99984 4.99989 4.99998 5.00004 5.00004 + 5.00006 5.00005 5.00001 4.99997 4.99992 4.99993 4.99994 + 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 + 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 + 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 + 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 + 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99998 4.99998 5.00131 5.00072 4.9977 4.99811 + 5.00325 4.99647 4.98948 4.99459 5.00262 5.00276 5.00156 + 5.00072 5.0003 5.00013 4.99995 4.99668 4.99775 4.99917 5.00173 + 5.00386 5.00188 4.99888 4.99757 4.99951 5.01712 5.0557 5.07088 + 5.07704 5.07758 5.06958 5.04223 5.03331 5.0279 5.03408 5.07611 + 5.01911 4.68594 3.99152 2.92195 1.69878 0.809 0.344091 0.154663 + 0.0788717 0.0467212 0.0336168 0.0280514 0.0254947 0.024173 + 0.0223567 0.0220555 0.0271514 0.0295872 0.0296052 0.0283971 + 0.0264726 0.0241813 0.0218244 0.0195349 0.017368 0.0152495 + 0.013295 0.0115444 0.00996982 0.00857091 0.00733891 0.00627261 + 0.0053494 0.00456316 0.00388373 0.00331073 0.00282181 0.00240991 + 0.00206389 0.00177187 0.00152283 0.00131167 0.00112558 0.000954373 + 0.000805726 0.00069326 0.000600991 0.000525743 0.00047355 + 0.00044359 0.000434815 0.000436053 0.000402511 0.000368969 + 0.000335427 0.000301886 0.000268344 0.000234802 0.00020126 + 0.000184967 0.000169932 0.000154896 0.000139861 0.000124825 + 0.00010979 9.47546e-05 8.67896e-05 8.24901e-05 7.81906e-05 + 7.38911e-05 6.95915e-05 6.5292e-05 6.09925e-05 5.66929e-05 + 5.23934e-05 4.80939e-05 4.37943e-05 3.94948e-05 3.51953e-05 + 3.08957e-05 2.67968e-05 2.42936e-05 2.17904e-05 1.92872e-05 + 1.6784e-05 0.00125927 -0.00794344 -0.0305499 -0.0621697 + -0.0463796 -0.0224608 -0.00538381 0.00546086 0.0108675 0.012883 + 0.0131787 0.0127271 0.0119702 0.0110398 0.0100635 0.00649617 + 0.00489388 0.00545863 0.0098351 0.0167428 0.0126563 0.00697542 + 0.00427027 0.00330002 0.00390774 0.00408999 -0.00259143 + -0.0160578 -0.0451849 -0.0409651 0.1301 0.597429 1.3848 + 2.63426 3.81272 4.51373 4.8412 4.98731 4.88165 4.37165 3.40034 + 2.17681 1.12217 0.505129 0.219703 0.104992 0.0622333 0.0448317 + 0.0355782 0.0311867 0.0293529 0.0274615 0.0288739 0.0307845 + 0.0304909 0.029245 0.0273602 0.0251006 0.022697 0.0202765 + 0.0179357 0.0157106 0.0136562 0.0117951 0.0101273 0.00865784 + 0.00739394 0.00634364 0.00551356 0.00480538 0.00415747 0.00356084 + 0.00297585 0.00236711 0.00181853 0.00160713 0.00169822 0.00166542 + 0.00145504 0.00120252 0.00109259 0.000982658 0.00087273 + 0.000762802 0.000652874 0.000584068 0.000528263 0.000472458 + 0.000416653 0.000360848 0.000321155 0.000301442 0.000281729 + 0.000262016 0.000242303 0.00022259 0.000202877 0.000183164 + 0.000163451 0.000143738 0.000124025 0.000114582 0.000107399 + 0.000100216 9.30332e-05 8.58502e-05 7.86672e-05 7.14841e-05 + 6.43011e-05 5.7118e-05 4.9935e-05 4.35378e-05 4.04281e-05 + 3.73184e-05 3.42088e-05 3.10991e-05 2.79894e-05 2.48798e-05 + 2.17701e-05 1.86604e-05 EOD @v[35].set(<<-'EOD') - 7.24585e-12 2.21843e-05 3.20014e-05 1.25076e-05 -2.44947e-05 - 1.8425e-05 5.50546e-06 3.53025e-05 -1.07551e-05 -3.94383e-06 - -2.27848e-06 -9.04789e-05 7.44215e-05 -2.7662e-05 0.000200038 - -2.11998e-05 -2.09011e-05 2.37098e-05 2.18751e-05 -2.28422e-05 - -6.23659e-05 3.58241e-05 1.76386e-05 -4.28311e-05 0.000355626 - 0.00156903 0.00100999 -0.0085304 -0.02067 -0.0389485 -0.0651568 - -0.128475 -0.314362 -0.406837 -0.421558 -0.421277 -0.418176 - -0.414481 -0.410845 -0.407348 -0.403971 -0.400716 -0.397582 - -0.394563 -0.391658 -0.388866 -0.386178 -0.383585 -0.381094 - -0.378789 -0.376569 -0.37435 -0.372256 -0.370188 -0.36815 - -0.366422 -0.364694 -0.362967 -0.361239 -0.359511 -0.357888 - -0.356334 -0.354781 -0.353227 -0.351674 -0.350152 -0.348888 - -0.347625 -0.346361 -0.345098 -0.343834 -0.342571 -0.341307 - -0.340044 -0.33878 -0.337517 -0.336279 -0.335215 -0.334152 - -0.333088 -0.332024 -0.330961 -0.329897 -0.328833 -0.32777 - -0.326706 -0.325642 -0.324601 -0.323683 -0.322766 -0.321849 - -0.320932 -0.320014 -0.319097 -0.31818 -0.317263 -0.316345 - -0.315428 -0.314545 -0.313825 -0.313106 -0.312387 -0.311667 - -0.310948 -0.310228 -0.309509 -0.308789 -0.30807 -0.307351 - -0.306631 -0.305912 -0.305192 -0.304473 -0.303754 -0.303034 - -0.302315 -0.301595 -0.300876 -0.300157 -0.299437 -0.298716 - -0.29798 -0.297329 -0.296691 -0.295837 -0.29516 -0.294725 - -0.294044 -0.292917 -0.292351 -0.291965 -0.291365 -0.290687 - -0.290027 -0.289376 -0.288772 -0.288193 -0.287505 -0.286892 - -0.28626 -0.285714 -0.284545 -0.289246 -0.298717 -0.298492 - -0.214163 0.181451 0.0749974 0.0454707 0.0292987 0.0196837 - 0.0124119 0.00884715 0.00527181 0.00585821 0.0296361 0.169856 - 0.361207 0.538856 0.67469 0.685933 0.392802 0.17772 0.0813085 - 0.0424601 0.0246654 0.0175258 0.0144256 0.0129859 0.012205 - 0.0112846 0.010933 0.0134813 0.0147254 0.0147981 0.0142156 - 0.0132732 0.0121355 0.0109587 0.00981238 0.00872731 0.00767007 - 0.00669346 0.00581341 0.00502167 0.00431819 0.00369842 0.00316168 - 0.00269663 0.00230035 0.00195801 0.00166928 0.00142286 0.00121522 - 0.00104072 0.000893384 0.000767675 0.000661268 0.000567659 - 0.000481766 0.000407101 0.000350044 0.000302721 0.000263424 - 0.000236813 0.00022199 0.000218182 0.000219548 0.0002027 - 0.000185853 0.000169006 0.000152158 0.000135311 0.000118463 - 0.000101616 9.33782e-05 8.57685e-05 7.81588e-05 7.0549e-05 - 6.29393e-05 5.53296e-05 4.77199e-05 4.36954e-05 4.15296e-05 - 3.93637e-05 3.71978e-05 3.50319e-05 3.28661e-05 3.07002e-05 - 2.85343e-05 2.63685e-05 2.42026e-05 2.20367e-05 1.98709e-05 - 1.7705e-05 1.55391e-05 1.34772e-05 1.22416e-05 1.10061e-05 - 9.77055e-06 8.535e-06 0.000631271 -0.00362586 -0.0146235 - -0.0308486 -0.0237466 -0.0117522 -0.00304171 0.00251033 - 0.00531986 0.0063897 0.00657351 0.00636494 0.00599705 0.00553442 - 0.00505994 0.00330925 0.00246671 0.0027006 0.00473161 0.00830333 - 0.00649147 0.00356815 0.00217448 0.00187579 0.00270447 0.00219543 - -0.00546118 -0.0179576 -0.0445306 -0.0649309 0.0197935 0.473629 - 0.87268 0.269542 0.0086094 0.0844602 0.606456 1.04929 0.906014 - 0.916205 0.919425 0.872867 0.556244 0.262457 0.11838 0.0571226 - 0.0333451 0.0237133 0.0185096 0.0159617 0.0148663 0.0138683 - 0.0144081 0.0153797 0.0152551 0.0146487 0.0137192 0.0125973 - 0.0113996 0.0101903 0.00901851 0.00790495 0.00687502 0.00593994 - 0.00510092 0.00436111 0.00372439 0.0031945 0.00277537 0.00241888 - 0.002095 0.00179943 0.00150419 0.00119264 0.00090934 0.000802394 - 0.000852816 0.000838368 0.000730842 0.000601028 0.000546616 - 0.000492205 0.000437793 0.000383381 0.000328969 0.00029454 - 0.000266428 0.000238317 0.000210205 0.000182093 0.000162091 - 0.000152145 0.000142198 0.000132252 0.000122306 0.000112359 - 0.000102413 9.24665e-05 8.25201e-05 7.25738e-05 6.26274e-05 - 5.78553e-05 5.42216e-05 5.05878e-05 4.69541e-05 4.33204e-05 - 3.96867e-05 3.60529e-05 3.24192e-05 2.87855e-05 2.51518e-05 - 2.19153e-05 2.03406e-05 1.8766e-05 1.71913e-05 1.56167e-05 - 1.4042e-05 1.24674e-05 1.08927e-05 9.31806e-06 + 7.24585e-12 2.21843e-05 3.20014e-05 1.25076e-05 -2.44947e-05 + 1.8425e-05 5.50546e-06 3.53025e-05 -1.07551e-05 -3.94383e-06 + -2.27848e-06 -9.04789e-05 7.44215e-05 -2.7662e-05 0.000200038 + -2.11998e-05 -2.09011e-05 2.37098e-05 2.18751e-05 -2.28422e-05 + -6.23659e-05 3.58241e-05 1.76386e-05 -4.28311e-05 0.000355626 + 0.00156903 0.00100999 -0.0085304 -0.02067 -0.0389485 -0.0651568 + -0.128475 -0.314362 -0.406837 -0.421558 -0.421277 -0.418176 + -0.414481 -0.410845 -0.407348 -0.403971 -0.400716 -0.397582 + -0.394563 -0.391658 -0.388866 -0.386178 -0.383585 -0.381094 + -0.378789 -0.376569 -0.37435 -0.372256 -0.370188 -0.36815 + -0.366422 -0.364694 -0.362967 -0.361239 -0.359511 -0.357888 + -0.356334 -0.354781 -0.353227 -0.351674 -0.350152 -0.348888 + -0.347625 -0.346361 -0.345098 -0.343834 -0.342571 -0.341307 + -0.340044 -0.33878 -0.337517 -0.336279 -0.335215 -0.334152 + -0.333088 -0.332024 -0.330961 -0.329897 -0.328833 -0.32777 + -0.326706 -0.325642 -0.324601 -0.323683 -0.322766 -0.321849 + -0.320932 -0.320014 -0.319097 -0.31818 -0.317263 -0.316345 + -0.315428 -0.314545 -0.313825 -0.313106 -0.312387 -0.311667 + -0.310948 -0.310228 -0.309509 -0.308789 -0.30807 -0.307351 + -0.306631 -0.305912 -0.305192 -0.304473 -0.303754 -0.303034 + -0.302315 -0.301595 -0.300876 -0.300157 -0.299437 -0.298716 + -0.29798 -0.297329 -0.296691 -0.295837 -0.29516 -0.294725 + -0.294044 -0.292917 -0.292351 -0.291965 -0.291365 -0.290687 + -0.290027 -0.289376 -0.288772 -0.288193 -0.287505 -0.286892 + -0.28626 -0.285714 -0.284545 -0.289246 -0.298717 -0.298492 + -0.214163 0.181451 0.0749974 0.0454707 0.0292987 0.0196837 + 0.0124119 0.00884715 0.00527181 0.00585821 0.0296361 0.169856 + 0.361207 0.538856 0.67469 0.685933 0.392802 0.17772 0.0813085 + 0.0424601 0.0246654 0.0175258 0.0144256 0.0129859 0.012205 + 0.0112846 0.010933 0.0134813 0.0147254 0.0147981 0.0142156 + 0.0132732 0.0121355 0.0109587 0.00981238 0.00872731 0.00767007 + 0.00669346 0.00581341 0.00502167 0.00431819 0.00369842 0.00316168 + 0.00269663 0.00230035 0.00195801 0.00166928 0.00142286 0.00121522 + 0.00104072 0.000893384 0.000767675 0.000661268 0.000567659 + 0.000481766 0.000407101 0.000350044 0.000302721 0.000263424 + 0.000236813 0.00022199 0.000218182 0.000219548 0.0002027 + 0.000185853 0.000169006 0.000152158 0.000135311 0.000118463 + 0.000101616 9.33782e-05 8.57685e-05 7.81588e-05 7.0549e-05 + 6.29393e-05 5.53296e-05 4.77199e-05 4.36954e-05 4.15296e-05 + 3.93637e-05 3.71978e-05 3.50319e-05 3.28661e-05 3.07002e-05 + 2.85343e-05 2.63685e-05 2.42026e-05 2.20367e-05 1.98709e-05 + 1.7705e-05 1.55391e-05 1.34772e-05 1.22416e-05 1.10061e-05 + 9.77055e-06 8.535e-06 0.000631271 -0.00362586 -0.0146235 + -0.0308486 -0.0237466 -0.0117522 -0.00304171 0.00251033 + 0.00531986 0.0063897 0.00657351 0.00636494 0.00599705 0.00553442 + 0.00505994 0.00330925 0.00246671 0.0027006 0.00473161 0.00830333 + 0.00649147 0.00356815 0.00217448 0.00187579 0.00270447 0.00219543 + -0.00546118 -0.0179576 -0.0445306 -0.0649309 0.0197935 0.473629 + 0.87268 0.269542 0.0086094 0.0844602 0.606456 1.04929 0.906014 + 0.916205 0.919425 0.872867 0.556244 0.262457 0.11838 0.0571226 + 0.0333451 0.0237133 0.0185096 0.0159617 0.0148663 0.0138683 + 0.0144081 0.0153797 0.0152551 0.0146487 0.0137192 0.0125973 + 0.0113996 0.0101903 0.00901851 0.00790495 0.00687502 0.00593994 + 0.00510092 0.00436111 0.00372439 0.0031945 0.00277537 0.00241888 + 0.002095 0.00179943 0.00150419 0.00119264 0.00090934 0.000802394 + 0.000852816 0.000838368 0.000730842 0.000601028 0.000546616 + 0.000492205 0.000437793 0.000383381 0.000328969 0.00029454 + 0.000266428 0.000238317 0.000210205 0.000182093 0.000162091 + 0.000152145 0.000142198 0.000132252 0.000122306 0.000112359 + 0.000102413 9.24665e-05 8.25201e-05 7.25738e-05 6.26274e-05 + 5.78553e-05 5.42216e-05 5.05878e-05 4.69541e-05 4.33204e-05 + 3.96867e-05 3.60529e-05 3.24192e-05 2.87855e-05 2.51518e-05 + 2.19153e-05 2.03406e-05 1.8766e-05 1.71913e-05 1.56167e-05 + 1.4042e-05 1.24674e-05 1.08927e-05 9.31806e-06 EOD @v[36].set(<<-'EOD') - 5 5.01426 5.02852 5.01923 4.77685 4.56471 4.52338 4.56813 - 4.63122 4.693 4.74776 4.79385 4.83258 4.86358 4.88918 4.91021 - 4.90553 4.89733 4.89554 4.91953 5.00757 5.07101 5.06318 - 5.05241 5.05535 5.08042 5.07251 4.90973 4.56136 3.98637 - 3.237 2.67216 2.33678 2.13529 2.00544 1.91429 1.84638 1.79461 - 1.75338 1.71958 1.69175 1.6686 1.64918 1.63258 1.61836 1.60607 - 1.59506 1.58483 1.57575 1.56847 1.56193 1.55538 1.54968 - 1.54416 1.5388 1.53523 1.53165 1.52807 1.52449 1.52091 1.51771 - 1.51477 1.51182 1.50888 1.50593 1.50309 1.50113 1.49917 - 1.4972 1.49524 1.49328 1.49132 1.48935 1.48739 1.48543 1.48346 - 1.48157 1.48012 1.47868 1.47724 1.47579 1.47435 1.47291 - 1.47146 1.47002 1.46857 1.46713 1.46574 1.46462 1.4635 1.46238 - 1.46126 1.46014 1.45902 1.4579 1.45678 1.45567 1.45455 1.45349 - 1.45275 1.45201 1.45127 1.45053 1.44979 1.44905 1.44831 - 1.44757 1.44683 1.44609 1.44535 1.44461 1.44387 1.44313 - 1.44239 1.44165 1.44091 1.44017 1.43943 1.43869 1.43795 - 1.43721 1.43874 1.43976 1.43619 1.43182 1.43726 1.43084 - 1.42587 1.42383 1.42642 1.42728 1.42736 1.4271 1.42669 1.42621 - 1.42569 1.41703 1.41244 1.41019 1.41199 1.41833 1.42502 - 1.41504 1.37535 1.28381 1.44779 2.33713 3.25835 3.67554 - 3.84975 4.01125 4.2253 4.45433 4.62215 4.74478 4.82998 4.8868 - 4.92396 4.94768 4.96498 4.98537 5.0128 5.04467 5.06722 5.06535 - 5.01475 4.91956 4.80647 4.7242 4.7059 4.73552 4.76379 4.81684 - 4.87376 4.92276 4.96112 4.9884 5.0045 5.00999 5.00933 5.00619 - 5.00384 5.00342 5.00373 5.00362 5.00309 5.00272 5.00239 - 5.00204 5.00172 5.00146 5.00124 5.00105 5.00089 5.00076 - 5.00065 5.00057 5.00048 5.00041 5.00034 5.00028 5.00023 - 5.00019 5.00015 5.00015 5.00016 5.0002 5.00023 5.00021 5.00019 - 5.00017 5.00015 5.00012 5.0001 5.00008 5.00007 5.00006 5.00005 - 5.00004 5.00003 5.00002 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00001 - 5.00001 5.00001 5.00062 4.99506 4.9835 4.96726 4.9728 4.97877 - 4.98675 4.9966 5.00406 5.00679 5.00629 5.00561 5.00487 5.00429 - 5.00384 5.002 5.00164 5.00229 5.00484 5.00769 5.00019 5.00242 - 5.01319 5.0335 5.07265 5.10129 5.11485 5.12551 5.13953 5.16048 - 5.18862 5.22811 5.25656 5.25627 5.19975 4.9139 4.24745 3.43732 - 2.8202 2.43224 2.17409 2.01333 1.93951 1.94622 1.98861 2.02217 - 2.05383 2.08376 2.11184 2.13793 2.16191 2.18267 2.20502 - 2.22837 2.24958 2.26901 2.28648 2.302 2.31582 2.32802 2.33869 - 2.34795 2.35596 2.36282 2.3687 2.37371 2.37797 2.38161 2.38476 - 2.38743 2.3897 2.39168 2.39329 2.39463 2.39575 2.39671 2.39756 - 2.39835 2.39907 2.39968 2.39999 2.4003 2.40061 2.40091 2.40122 - 2.40142 2.40159 2.40176 2.40193 2.4021 2.40222 2.40228 2.40234 - 2.4024 2.40247 2.40253 2.40259 2.40265 2.40271 2.40277 2.40284 - 2.40287 2.40289 2.40291 2.40294 2.40296 2.40298 2.40301 - 2.40303 2.40305 2.40308 2.4031 2.40311 2.40312 2.40313 2.40314 - 2.40315 2.40316 2.40317 2.40318 + 5 5.01426 5.02852 5.01923 4.77685 4.56471 4.52338 4.56813 + 4.63122 4.693 4.74776 4.79385 4.83258 4.86358 4.88918 4.91021 + 4.90553 4.89733 4.89554 4.91953 5.00757 5.07101 5.06318 + 5.05241 5.05535 5.08042 5.07251 4.90973 4.56136 3.98637 + 3.237 2.67216 2.33678 2.13529 2.00544 1.91429 1.84638 1.79461 + 1.75338 1.71958 1.69175 1.6686 1.64918 1.63258 1.61836 1.60607 + 1.59506 1.58483 1.57575 1.56847 1.56193 1.55538 1.54968 + 1.54416 1.5388 1.53523 1.53165 1.52807 1.52449 1.52091 1.51771 + 1.51477 1.51182 1.50888 1.50593 1.50309 1.50113 1.49917 + 1.4972 1.49524 1.49328 1.49132 1.48935 1.48739 1.48543 1.48346 + 1.48157 1.48012 1.47868 1.47724 1.47579 1.47435 1.47291 + 1.47146 1.47002 1.46857 1.46713 1.46574 1.46462 1.4635 1.46238 + 1.46126 1.46014 1.45902 1.4579 1.45678 1.45567 1.45455 1.45349 + 1.45275 1.45201 1.45127 1.45053 1.44979 1.44905 1.44831 + 1.44757 1.44683 1.44609 1.44535 1.44461 1.44387 1.44313 + 1.44239 1.44165 1.44091 1.44017 1.43943 1.43869 1.43795 + 1.43721 1.43874 1.43976 1.43619 1.43182 1.43726 1.43084 + 1.42587 1.42383 1.42642 1.42728 1.42736 1.4271 1.42669 1.42621 + 1.42569 1.41703 1.41244 1.41019 1.41199 1.41833 1.42502 + 1.41504 1.37535 1.28381 1.44779 2.33713 3.25835 3.67554 + 3.84975 4.01125 4.2253 4.45433 4.62215 4.74478 4.82998 4.8868 + 4.92396 4.94768 4.96498 4.98537 5.0128 5.04467 5.06722 5.06535 + 5.01475 4.91956 4.80647 4.7242 4.7059 4.73552 4.76379 4.81684 + 4.87376 4.92276 4.96112 4.9884 5.0045 5.00999 5.00933 5.00619 + 5.00384 5.00342 5.00373 5.00362 5.00309 5.00272 5.00239 + 5.00204 5.00172 5.00146 5.00124 5.00105 5.00089 5.00076 + 5.00065 5.00057 5.00048 5.00041 5.00034 5.00028 5.00023 + 5.00019 5.00015 5.00015 5.00016 5.0002 5.00023 5.00021 5.00019 + 5.00017 5.00015 5.00012 5.0001 5.00008 5.00007 5.00006 5.00005 + 5.00004 5.00003 5.00002 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00001 + 5.00001 5.00001 5.00062 4.99506 4.9835 4.96726 4.9728 4.97877 + 4.98675 4.9966 5.00406 5.00679 5.00629 5.00561 5.00487 5.00429 + 5.00384 5.002 5.00164 5.00229 5.00484 5.00769 5.00019 5.00242 + 5.01319 5.0335 5.07265 5.10129 5.11485 5.12551 5.13953 5.16048 + 5.18862 5.22811 5.25656 5.25627 5.19975 4.9139 4.24745 3.43732 + 2.8202 2.43224 2.17409 2.01333 1.93951 1.94622 1.98861 2.02217 + 2.05383 2.08376 2.11184 2.13793 2.16191 2.18267 2.20502 + 2.22837 2.24958 2.26901 2.28648 2.302 2.31582 2.32802 2.33869 + 2.34795 2.35596 2.36282 2.3687 2.37371 2.37797 2.38161 2.38476 + 2.38743 2.3897 2.39168 2.39329 2.39463 2.39575 2.39671 2.39756 + 2.39835 2.39907 2.39968 2.39999 2.4003 2.40061 2.40091 2.40122 + 2.40142 2.40159 2.40176 2.40193 2.4021 2.40222 2.40228 2.40234 + 2.4024 2.40247 2.40253 2.40259 2.40265 2.40271 2.40277 2.40284 + 2.40287 2.40289 2.40291 2.40294 2.40296 2.40298 2.40301 + 2.40303 2.40305 2.40308 2.4031 2.40311 2.40312 2.40313 2.40314 + 2.40315 2.40316 2.40317 2.40318 EOD @v[37].set(<<-'EOD') - 5 5.01732 5.03181 5.05944 5.12686 5.20725 5.28103 5.31254 - 5.32901 5.33709 5.3408 5.34257 5.34311 5.34347 5.34386 5.34411 - 5.3406 5.33484 5.32942 5.32904 5.33644 5.34869 5.35001 5.34882 - 5.34758 5.34672 5.34599 5.34496 5.34364 5.34165 5.33712 - 5.33502 5.3366 5.34067 5.34306 5.34398 5.34434 5.34442 5.34443 - 5.34443 5.34441 5.34439 5.34437 5.34437 5.34438 5.34438 - 5.34438 5.34438 5.34438 5.34437 5.34437 5.34436 5.34436 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.35377 5.35451 - 5.34265 5.34488 5.35861 5.28622 4.90033 4.75027 4.89731 - 4.97098 4.99293 4.99832 4.99909 4.99956 4.99858 4.99829 - 4.9998 5.00035 5.0038 5.00989 5.00251 4.99438 4.9953 4.99761 - 4.99985 5.00152 5.0011 5.00046 4.99996 4.99925 4.99862 4.99919 - 4.99961 5.00048 5.00234 4.99654 4.98235 4.95936 4.83738 - 4.53021 4.21004 4.00593 3.91207 3.88059 3.87822 3.89117 - 3.91278 3.94044 3.97376 4.01152 4.05052 4.10679 4.17908 - 4.25673 4.33414 4.40875 4.47879 4.54342 4.60258 4.65595 - 4.70291 4.74414 4.78018 4.81185 4.83915 4.86291 4.88301 - 4.90048 4.91528 4.92802 4.9387 4.94777 4.95539 4.9618 4.96725 - 4.97195 4.97588 4.97932 4.98247 4.98512 4.98697 4.98831 - 4.98919 4.99015 4.99101 4.99169 4.99222 4.99282 4.99341 - 4.994 4.9946 4.99519 4.99578 4.99638 4.99667 4.99693 4.9972 - 4.99747 4.99773 4.998 4.99827 4.99841 4.99849 4.99856 4.99864 - 4.99872 4.9988 4.99888 4.99896 4.99904 4.99911 4.99919 4.99927 - 4.99935 4.99943 4.9995 4.99955 4.9996 4.99965 4.9997 5.00736 - 4.98252 4.87516 4.66727 4.49142 4.43103 4.4301 4.4571 4.49729 - 4.5407 4.5835 4.62363 4.66114 4.69577 4.72738 4.74632 4.75971 - 4.77576 4.80671 4.87073 4.91665 4.93252 4.94418 4.95331 - 4.96094 4.96727 4.97148 4.97471 4.97612 4.98276 5.00247 - 5.04086 5.08628 5.10673 5.08887 5.0564 5.02767 5.01336 4.99685 - 4.97422 4.90866 4.67035 4.33117 4.07888 3.94432 3.89105 - 3.88174 3.89292 3.91442 3.94564 3.98708 4.0355 4.09134 4.16315 - 4.24088 4.31918 4.39527 4.46693 4.53337 4.59405 4.6486 4.69693 - 4.73938 4.77617 4.80809 4.83551 4.85895 4.87894 4.89596 - 4.91081 4.92417 4.93651 4.94552 4.95198 4.9565 4.96096 4.96523 - 4.96972 4.97428 4.97868 4.98064 4.9826 4.98455 4.98651 4.98847 - 4.98967 4.99064 4.9916 4.99257 4.99353 4.99422 4.99457 4.99493 - 4.99528 4.99563 4.99598 4.99633 4.99668 4.99703 4.99738 - 4.99773 4.9979 4.99804 4.99817 4.9983 4.99843 4.99856 4.99869 - 4.99883 4.99896 4.99909 4.99921 4.99926 4.99931 4.99937 - 4.99942 4.99948 4.99953 4.99959 4.99964 + 5 5.01732 5.03181 5.05944 5.12686 5.20725 5.28103 5.31254 + 5.32901 5.33709 5.3408 5.34257 5.34311 5.34347 5.34386 5.34411 + 5.3406 5.33484 5.32942 5.32904 5.33644 5.34869 5.35001 5.34882 + 5.34758 5.34672 5.34599 5.34496 5.34364 5.34165 5.33712 + 5.33502 5.3366 5.34067 5.34306 5.34398 5.34434 5.34442 5.34443 + 5.34443 5.34441 5.34439 5.34437 5.34437 5.34438 5.34438 + 5.34438 5.34438 5.34438 5.34437 5.34437 5.34436 5.34436 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.35377 5.35451 + 5.34265 5.34488 5.35861 5.28622 4.90033 4.75027 4.89731 + 4.97098 4.99293 4.99832 4.99909 4.99956 4.99858 4.99829 + 4.9998 5.00035 5.0038 5.00989 5.00251 4.99438 4.9953 4.99761 + 4.99985 5.00152 5.0011 5.00046 4.99996 4.99925 4.99862 4.99919 + 4.99961 5.00048 5.00234 4.99654 4.98235 4.95936 4.83738 + 4.53021 4.21004 4.00593 3.91207 3.88059 3.87822 3.89117 + 3.91278 3.94044 3.97376 4.01152 4.05052 4.10679 4.17908 + 4.25673 4.33414 4.40875 4.47879 4.54342 4.60258 4.65595 + 4.70291 4.74414 4.78018 4.81185 4.83915 4.86291 4.88301 + 4.90048 4.91528 4.92802 4.9387 4.94777 4.95539 4.9618 4.96725 + 4.97195 4.97588 4.97932 4.98247 4.98512 4.98697 4.98831 + 4.98919 4.99015 4.99101 4.99169 4.99222 4.99282 4.99341 + 4.994 4.9946 4.99519 4.99578 4.99638 4.99667 4.99693 4.9972 + 4.99747 4.99773 4.998 4.99827 4.99841 4.99849 4.99856 4.99864 + 4.99872 4.9988 4.99888 4.99896 4.99904 4.99911 4.99919 4.99927 + 4.99935 4.99943 4.9995 4.99955 4.9996 4.99965 4.9997 5.00736 + 4.98252 4.87516 4.66727 4.49142 4.43103 4.4301 4.4571 4.49729 + 4.5407 4.5835 4.62363 4.66114 4.69577 4.72738 4.74632 4.75971 + 4.77576 4.80671 4.87073 4.91665 4.93252 4.94418 4.95331 + 4.96094 4.96727 4.97148 4.97471 4.97612 4.98276 5.00247 + 5.04086 5.08628 5.10673 5.08887 5.0564 5.02767 5.01336 4.99685 + 4.97422 4.90866 4.67035 4.33117 4.07888 3.94432 3.89105 + 3.88174 3.89292 3.91442 3.94564 3.98708 4.0355 4.09134 4.16315 + 4.24088 4.31918 4.39527 4.46693 4.53337 4.59405 4.6486 4.69693 + 4.73938 4.77617 4.80809 4.83551 4.85895 4.87894 4.89596 + 4.91081 4.92417 4.93651 4.94552 4.95198 4.9565 4.96096 4.96523 + 4.96972 4.97428 4.97868 4.98064 4.9826 4.98455 4.98651 4.98847 + 4.98967 4.99064 4.9916 4.99257 4.99353 4.99422 4.99457 4.99493 + 4.99528 4.99563 4.99598 4.99633 4.99668 4.99703 4.99738 + 4.99773 4.9979 4.99804 4.99817 4.9983 4.99843 4.99856 4.99869 + 4.99883 4.99896 4.99909 4.99921 4.99926 4.99931 4.99937 + 4.99942 4.99948 4.99953 4.99959 4.99964 EOD @v[38].set(<<-'EOD') - 4.49849 4.53282 4.58329 4.66625 4.83345 4.97823 5.0207 5.01816 - 5.01116 5.00595 5.00296 5.00148 5.00073 5.00062 5.00033 - 5.0003 4.99864 4.99661 4.99652 4.99928 5.00361 5.12573 5.17251 - 5.22612 5.33479 5.44503 5.44432 5.44379 5.44334 5.443 5.44276 - 5.44258 5.44246 5.44238 5.44232 5.44228 5.44225 5.44223 - 5.44221 5.4422 5.44219 5.44219 5.44218 5.44218 5.44218 5.44218 - 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 - 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 - 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44216 - 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 - 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 - 5.44216 5.44216 5.44216 5.44216 5.44215 5.44215 5.44215 - 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 - 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 - 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 - 5.44214 5.44214 5.44214 5.44214 5.44214 5.44214 5.44214 - 5.44214 5.44214 5.44214 5.44214 5.44212 5.45159 5.45236 - 5.44064 5.44307 5.45616 5.38122 4.77163 3.53297 2.74466 - 2.34448 2.11802 1.9783 1.88656 1.82001 1.77389 1.72955 1.69632 - 1.66971 1.6526 1.65236 1.56034 1.53764 1.97139 2.75096 3.39212 - 3.74042 3.82345 3.85696 3.88547 3.91862 3.9585 4.00467 4.05903 - 4.1254 4.19533 4.26791 4.34517 4.42112 4.49238 4.55807 4.6179 - 4.6713 4.71815 4.75889 4.79418 4.82456 4.85062 4.87291 4.89196 - 4.90823 4.92209 4.93388 4.9439 4.95242 4.95968 4.96585 4.97108 - 4.9755 4.97923 4.98237 4.98503 4.98732 4.98927 4.99094 4.99233 - 4.99353 4.99452 4.99538 4.99608 4.99668 4.99718 4.9976 4.99794 - 4.99822 4.99847 4.99867 4.99884 4.99899 4.99913 4.99924 - 4.99932 4.99938 4.99943 4.99947 4.99951 4.99953 4.99955 - 4.99958 4.99961 4.99964 4.99967 4.99969 4.99972 4.99975 - 4.99977 4.99978 4.99979 4.99981 4.99982 4.99983 4.99985 - 4.99986 4.99986 4.99987 4.99987 4.99988 4.99988 4.99988 - 4.99989 4.99989 4.9999 4.9999 4.99991 4.99991 4.99992 4.99992 - 4.99993 4.99993 4.99993 4.99994 5.00381 5.00064 4.99246 - 4.99823 5.00349 5.00076 5.00033 5.00015 5.00009 5.00007 - 5.00005 5.00004 5.00003 5.00002 4.99988 4.99732 4.99728 - 4.9978 5.00187 5.00927 5.08712 5.07654 4.92855 4.4863 3.76162 - 3.00049 2.49834 2.20883 2.03492 1.92384 1.84676 1.79021 - 1.74716 1.7132 1.68576 1.66309 1.64406 1.62785 1.61383 1.60162 - 1.59081 1.58117 1.57253 1.56473 1.55765 1.55117 1.54527 - 1.53988 1.53485 1.53012 1.5257 1.5216 1.51773 1.51411 1.51071 - 1.50746 1.50438 1.50146 1.49868 1.49603 1.4935 1.49109 1.48878 - 1.48657 1.48445 1.48242 1.48046 1.47858 1.47677 1.47502 - 1.47333 1.4717 1.47012 1.46859 1.46711 1.46568 1.46428 1.46292 - 1.4616 1.46034 1.45923 1.45812 1.45701 1.4559 1.45479 1.45378 - 1.45279 1.45181 1.45082 1.44983 1.44893 1.44813 1.44732 - 1.44652 1.44571 1.44491 1.4441 1.4433 1.44249 1.44169 1.44089 - 1.44019 1.43951 1.43883 1.43815 1.43747 1.4368 1.43612 1.43544 - 1.43476 1.43408 1.43342 1.43283 1.43223 1.43163 1.43104 - 1.43044 1.42984 1.42924 1.42865 + 4.49849 4.53282 4.58329 4.66625 4.83345 4.97823 5.0207 5.01816 + 5.01116 5.00595 5.00296 5.00148 5.00073 5.00062 5.00033 + 5.0003 4.99864 4.99661 4.99652 4.99928 5.00361 5.12573 5.17251 + 5.22612 5.33479 5.44503 5.44432 5.44379 5.44334 5.443 5.44276 + 5.44258 5.44246 5.44238 5.44232 5.44228 5.44225 5.44223 + 5.44221 5.4422 5.44219 5.44219 5.44218 5.44218 5.44218 5.44218 + 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 + 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 + 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44216 + 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 + 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 + 5.44216 5.44216 5.44216 5.44216 5.44215 5.44215 5.44215 + 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 + 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 + 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 + 5.44214 5.44214 5.44214 5.44214 5.44214 5.44214 5.44214 + 5.44214 5.44214 5.44214 5.44214 5.44212 5.45159 5.45236 + 5.44064 5.44307 5.45616 5.38122 4.77163 3.53297 2.74466 + 2.34448 2.11802 1.9783 1.88656 1.82001 1.77389 1.72955 1.69632 + 1.66971 1.6526 1.65236 1.56034 1.53764 1.97139 2.75096 3.39212 + 3.74042 3.82345 3.85696 3.88547 3.91862 3.9585 4.00467 4.05903 + 4.1254 4.19533 4.26791 4.34517 4.42112 4.49238 4.55807 4.6179 + 4.6713 4.71815 4.75889 4.79418 4.82456 4.85062 4.87291 4.89196 + 4.90823 4.92209 4.93388 4.9439 4.95242 4.95968 4.96585 4.97108 + 4.9755 4.97923 4.98237 4.98503 4.98732 4.98927 4.99094 4.99233 + 4.99353 4.99452 4.99538 4.99608 4.99668 4.99718 4.9976 4.99794 + 4.99822 4.99847 4.99867 4.99884 4.99899 4.99913 4.99924 + 4.99932 4.99938 4.99943 4.99947 4.99951 4.99953 4.99955 + 4.99958 4.99961 4.99964 4.99967 4.99969 4.99972 4.99975 + 4.99977 4.99978 4.99979 4.99981 4.99982 4.99983 4.99985 + 4.99986 4.99986 4.99987 4.99987 4.99988 4.99988 4.99988 + 4.99989 4.99989 4.9999 4.9999 4.99991 4.99991 4.99992 4.99992 + 4.99993 4.99993 4.99993 4.99994 5.00381 5.00064 4.99246 + 4.99823 5.00349 5.00076 5.00033 5.00015 5.00009 5.00007 + 5.00005 5.00004 5.00003 5.00002 4.99988 4.99732 4.99728 + 4.9978 5.00187 5.00927 5.08712 5.07654 4.92855 4.4863 3.76162 + 3.00049 2.49834 2.20883 2.03492 1.92384 1.84676 1.79021 + 1.74716 1.7132 1.68576 1.66309 1.64406 1.62785 1.61383 1.60162 + 1.59081 1.58117 1.57253 1.56473 1.55765 1.55117 1.54527 + 1.53988 1.53485 1.53012 1.5257 1.5216 1.51773 1.51411 1.51071 + 1.50746 1.50438 1.50146 1.49868 1.49603 1.4935 1.49109 1.48878 + 1.48657 1.48445 1.48242 1.48046 1.47858 1.47677 1.47502 + 1.47333 1.4717 1.47012 1.46859 1.46711 1.46568 1.46428 1.46292 + 1.4616 1.46034 1.45923 1.45812 1.45701 1.4559 1.45479 1.45378 + 1.45279 1.45181 1.45082 1.44983 1.44893 1.44813 1.44732 + 1.44652 1.44571 1.44491 1.4441 1.4433 1.44249 1.44169 1.44089 + 1.44019 1.43951 1.43883 1.43815 1.43747 1.4368 1.43612 1.43544 + 1.43476 1.43408 1.43342 1.43283 1.43223 1.43163 1.43104 + 1.43044 1.42984 1.42924 1.42865 EOD @v[39].set(<<-'EOD') - 5 5.01048 5.01221 4.98887 4.76261 4.54943 4.51564 4.56249 - 4.62621 4.68843 4.74374 4.79044 4.82972 4.86127 4.88724 - 4.90862 4.90791 4.89858 4.89589 4.91767 5.00405 5.16956 - 5.12391 4.7557 3.87953 3.01124 2.48482 2.20424 2.03812 1.92679 - 1.84956 1.79256 1.74907 1.71487 1.68724 1.6644 1.64513 1.6287 - 1.61446 1.60197 1.59095 1.58117 1.57245 1.5646 1.55752 1.55109 - 1.54516 1.53958 1.53444 1.53008 1.52606 1.52205 1.51843 - 1.5149 1.51146 1.50893 1.50639 1.50387 1.50133 1.4988 1.49651 - 1.49436 1.49222 1.49007 1.48793 1.48585 1.48433 1.4828 1.48128 - 1.47975 1.47823 1.4767 1.47518 1.47365 1.47213 1.4706 1.46912 - 1.46795 1.46678 1.46561 1.46444 1.46327 1.4621 1.46093 1.45976 - 1.45859 1.45741 1.45628 1.45534 1.45441 1.45347 1.45254 - 1.4516 1.45067 1.44973 1.4488 1.44786 1.44693 1.44604 1.44539 - 1.44475 1.4441 1.44345 1.44281 1.44216 1.44151 1.44086 1.44022 - 1.43957 1.43892 1.43828 1.43763 1.43698 1.43633 1.43569 - 1.43504 1.43439 1.43375 1.4331 1.43245 1.4318 1.43157 1.43089 - 1.43001 1.43042 1.42899 1.42439 1.42216 1.43447 1.44048 - 1.43705 1.43314 1.43039 1.42861 1.42739 1.42651 1.42548 - 1.42488 1.4243 1.42392 1.4235 1.32443 1.31149 1.78169 2.64844 - 3.43211 3.95252 4.20231 4.3746 4.49948 4.58929 4.65742 4.71183 - 4.77057 4.83196 4.88354 4.92894 4.96625 4.99235 5.00651 - 5.00941 5.00813 5.00689 5.00588 5.00504 5.00431 5.00368 - 5.00314 5.00268 5.00228 5.00194 5.00165 5.0014 5.00118 5.001 - 5.00085 5.00072 5.00061 5.00052 5.00044 5.00037 5.00031 - 5.00027 5.00022 5.00019 5.00016 5.00013 5.00011 5.00009 - 5.00008 5.00007 5.00006 5.00005 5.00004 5.00003 5.00003 - 5.00003 5.00002 5.00002 5.00002 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5.00001 - 5.00002 5.00003 5.00004 5.00022 4.99974 4.99942 4.99997 - 5.00063 5.00002 5.00003 4.99994 4.99998 4.99999 5 5 5 5 - 5 4.99981 4.99998 5.00004 5.00036 5.00049 5.12012 5.16315 - 5.19712 5.21835 4.87874 4.10151 3.31555 2.74207 2.38075 - 2.15872 2.01614 1.91886 1.84852 1.79401 1.75052 1.71508 - 1.68672 1.66467 1.64602 1.62985 1.61576 1.60343 1.59256 - 1.58287 1.57418 1.56632 1.55922 1.55282 1.54687 1.54132 - 1.53618 1.53143 1.52698 1.52282 1.51895 1.51527 1.5118 1.50851 - 1.5054 1.50244 1.49963 1.49695 1.4944 1.49196 1.48963 1.4874 - 1.48527 1.48322 1.48124 1.47934 1.47751 1.47574 1.47403 - 1.47239 1.4708 1.46926 1.46777 1.46632 1.46491 1.46355 1.46237 - 1.4612 1.46002 1.45884 1.45766 1.45659 1.45555 1.45451 1.45346 - 1.45242 1.45147 1.45062 1.44978 1.44894 1.44809 1.44725 - 1.4464 1.44556 1.44472 1.44387 1.44303 1.4423 1.44159 1.44088 - 1.44017 1.43947 1.43876 1.43805 1.43734 1.43664 1.43593 - 1.43524 1.43462 1.434 1.43338 1.43276 1.43213 1.43151 1.43089 - 1.43027 + 5 5.01048 5.01221 4.98887 4.76261 4.54943 4.51564 4.56249 + 4.62621 4.68843 4.74374 4.79044 4.82972 4.86127 4.88724 + 4.90862 4.90791 4.89858 4.89589 4.91767 5.00405 5.16956 + 5.12391 4.7557 3.87953 3.01124 2.48482 2.20424 2.03812 1.92679 + 1.84956 1.79256 1.74907 1.71487 1.68724 1.6644 1.64513 1.6287 + 1.61446 1.60197 1.59095 1.58117 1.57245 1.5646 1.55752 1.55109 + 1.54516 1.53958 1.53444 1.53008 1.52606 1.52205 1.51843 + 1.5149 1.51146 1.50893 1.50639 1.50387 1.50133 1.4988 1.49651 + 1.49436 1.49222 1.49007 1.48793 1.48585 1.48433 1.4828 1.48128 + 1.47975 1.47823 1.4767 1.47518 1.47365 1.47213 1.4706 1.46912 + 1.46795 1.46678 1.46561 1.46444 1.46327 1.4621 1.46093 1.45976 + 1.45859 1.45741 1.45628 1.45534 1.45441 1.45347 1.45254 + 1.4516 1.45067 1.44973 1.4488 1.44786 1.44693 1.44604 1.44539 + 1.44475 1.4441 1.44345 1.44281 1.44216 1.44151 1.44086 1.44022 + 1.43957 1.43892 1.43828 1.43763 1.43698 1.43633 1.43569 + 1.43504 1.43439 1.43375 1.4331 1.43245 1.4318 1.43157 1.43089 + 1.43001 1.43042 1.42899 1.42439 1.42216 1.43447 1.44048 + 1.43705 1.43314 1.43039 1.42861 1.42739 1.42651 1.42548 + 1.42488 1.4243 1.42392 1.4235 1.32443 1.31149 1.78169 2.64844 + 3.43211 3.95252 4.20231 4.3746 4.49948 4.58929 4.65742 4.71183 + 4.77057 4.83196 4.88354 4.92894 4.96625 4.99235 5.00651 + 5.00941 5.00813 5.00689 5.00588 5.00504 5.00431 5.00368 + 5.00314 5.00268 5.00228 5.00194 5.00165 5.0014 5.00118 5.001 + 5.00085 5.00072 5.00061 5.00052 5.00044 5.00037 5.00031 + 5.00027 5.00022 5.00019 5.00016 5.00013 5.00011 5.00009 + 5.00008 5.00007 5.00006 5.00005 5.00004 5.00003 5.00003 + 5.00003 5.00002 5.00002 5.00002 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5.00001 + 5.00002 5.00003 5.00004 5.00022 4.99974 4.99942 4.99997 + 5.00063 5.00002 5.00003 4.99994 4.99998 4.99999 5 5 5 5 + 5 4.99981 4.99998 5.00004 5.00036 5.00049 5.12012 5.16315 + 5.19712 5.21835 4.87874 4.10151 3.31555 2.74207 2.38075 + 2.15872 2.01614 1.91886 1.84852 1.79401 1.75052 1.71508 + 1.68672 1.66467 1.64602 1.62985 1.61576 1.60343 1.59256 + 1.58287 1.57418 1.56632 1.55922 1.55282 1.54687 1.54132 + 1.53618 1.53143 1.52698 1.52282 1.51895 1.51527 1.5118 1.50851 + 1.5054 1.50244 1.49963 1.49695 1.4944 1.49196 1.48963 1.4874 + 1.48527 1.48322 1.48124 1.47934 1.47751 1.47574 1.47403 + 1.47239 1.4708 1.46926 1.46777 1.46632 1.46491 1.46355 1.46237 + 1.4612 1.46002 1.45884 1.45766 1.45659 1.45555 1.45451 1.45346 + 1.45242 1.45147 1.45062 1.44978 1.44894 1.44809 1.44725 + 1.4464 1.44556 1.44472 1.44387 1.44303 1.4423 1.44159 1.44088 + 1.44017 1.43947 1.43876 1.43805 1.43734 1.43664 1.43593 + 1.43524 1.43462 1.434 1.43338 1.43276 1.43213 1.43151 1.43089 + 1.43027 EOD end diff --git a/ext/tk/sample/tkextlib/blt/graph7.rb b/ext/tk/sample/tkextlib/blt/graph7.rb index 27fbe53d97..8b31b28c91 100644 --- a/ext/tk/sample/tkextlib/blt/graph7.rb +++ b/ext/tk/sample/tkextlib/blt/graph7.rb @@ -16,10 +16,10 @@ v_x.expr("random(#{v_x})") v_y.expr("random(#{v_y})") v_x.sort(v_y) -plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, - :color=>'green4', :fill=>'green2', - :linewidth=>0, :outlinewidth=>1, - :pixels=>4, :label=>'plot', +plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, + :color=>'green4', :fill=>'green2', + :linewidth=>0, :outlinewidth=>1, + :pixels=>4, :label=>'plot', :xdata=>v_x, :ydata=>v_y) Tk.root.minsize(0, 0) diff --git a/ext/tk/sample/tkextlib/blt/graph7a.rb b/ext/tk/sample/tkextlib/blt/graph7a.rb index a014f72fc7..8def766060 100644 --- a/ext/tk/sample/tkextlib/blt/graph7a.rb +++ b/ext/tk/sample/tkextlib/blt/graph7a.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/blt' -file = File.join(File.dirname(File.expand_path(__FILE__)), +file = File.join(File.dirname(File.expand_path(__FILE__)), 'images', 'buckskin.gif') bgTexture = TkPhotoImage.new(:file=>file) @@ -39,10 +39,10 @@ v_x.expr("random(#{v_x})") v_y.expr("random(#{v_y})") v_x.sort(v_y) -plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, - :color=>'green4', :fill=>'green2', - :linewidth=>0, :outlinewidth=>1, - :pixels=>4, :label=>'plot', +plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, + :color=>'green4', :fill=>'green2', + :linewidth=>0, :outlinewidth=>1, + :pixels=>4, :label=>'plot', :xdata=>v_x, :ydata=>v_y) Tk.root.minsize(0, 0) diff --git a/ext/tk/sample/tkextlib/blt/graph7b.rb b/ext/tk/sample/tkextlib/blt/graph7b.rb index c589f18d86..8b00f154b2 100644 --- a/ext/tk/sample/tkextlib/blt/graph7b.rb +++ b/ext/tk/sample/tkextlib/blt/graph7b.rb @@ -17,10 +17,10 @@ y = Array.new(length) y[i] = rand } -plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, - :color=>'green4', :fill=>'green2', - :linewidth=>0, :outlinewidth=>1, - :pixels=>4, :label=>'plot', +plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, + :color=>'green4', :fill=>'green2', + :linewidth=>0, :outlinewidth=>1, + :pixels=>4, :label=>'plot', :xdata=>x, :ydata=>y) Tk.root.minsize(0, 0) diff --git a/ext/tk/sample/tkextlib/blt/graph7c.rb b/ext/tk/sample/tkextlib/blt/graph7c.rb index 495b66f4af..d4ed1a66ad 100644 --- a/ext/tk/sample/tkextlib/blt/graph7c.rb +++ b/ext/tk/sample/tkextlib/blt/graph7c.rb @@ -21,10 +21,10 @@ y = Array.new(length) v_x.set(x) v_y.set(y) -plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, - :color=>'green4', :fill=>'green2', - :linewidth=>0, :outlinewidth=>1, - :pixels=>4, :label=>'plot', +plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, + :color=>'green4', :fill=>'green2', + :linewidth=>0, :outlinewidth=>1, + :pixels=>4, :label=>'plot', :xdata=>v_x, :ydata=>v_y) Tk.root.minsize(0, 0) diff --git a/ext/tk/sample/tkextlib/blt/pareto.rb b/ext/tk/sample/tkextlib/blt/pareto.rb index 94d5f3f97f..bf9a1ec749 100644 --- a/ext/tk/sample/tkextlib/blt/pareto.rb +++ b/ext/tk/sample/tkextlib/blt/pareto.rb @@ -8,21 +8,21 @@ require 'tkextlib/blt' # The pareto chart mixes line and bar elements in the same graph. # Each processing operating is represented by a bar element. The # total accumulated defects is displayed with a single line element. -b = Tk::BLT::Barchart.new(:title=>'Defects Found During Inspection', - :font=>'Helvetica 12', :plotpady=>[12, 4], +b = Tk::BLT::Barchart.new(:title=>'Defects Found During Inspection', + :font=>'Helvetica 12', :plotpady=>[12, 4], :width=>'6i', :height=>'5i') Tk::BLT::Table.add(Tk.root, b, :fill=>:both) data = [ - ["Spot Weld", 82, 'yellow'], - ["Lathe", 49, 'orange'], - ["Gear Cut", 38, 'green'], - ["Drill", 24, 'blue'], - ["Grind", 17, 'red'], - ["Lapping", 12, 'brown'], - ["Press", 8, 'purple'], - ["De-burr", 4, 'pink'], - ["Packaging", 3, 'cyan'], + ["Spot Weld", 82, 'yellow'], + ["Lathe", 49, 'orange'], + ["Gear Cut", 38, 'green'], + ["Drill", 24, 'blue'], + ["Grind", 17, 'red'], + ["Lapping", 12, 'brown'], + ["Press", 8, 'purple'], + ["De-burr", 4, 'pink'], + ["Packaging", 3, 'cyan'], ["Other", 12, 'magenta'] ] @@ -41,8 +41,8 @@ labels = [] data.each{|label, value, color| count += 1 - b.element_create(label, :xdata=>count, :ydata=>value, :foreground=>color, - :relief=>:solid, :borderwidth=>1, :stipple=>pattern1, + b.element_create(label, :xdata=>count, :ydata=>value, :foreground=>color, + :relief=>:solid, :borderwidth=>1, :stipple=>pattern1, :background=>'lightblue') labels[count] = label # Get the total number of defects. @@ -51,7 +51,7 @@ data.each{|label, value, color| xdata << count } -# Configure the coordinates of the accumulated defects, +# Configure the coordinates of the accumulated defects, # now that we know what they are. b.element_configure('accum', :xdata=>xdata, :ydata=>ydata) @@ -63,19 +63,19 @@ xdata.zip(ydata){|x, y| else text = '%.1f' % percent end - b.marker_create(:text, :coords=>[x, y], :text=>text, :font=>'Helvetica 10', + b.marker_create(:text, :coords=>[x, y], :text=>text, :font=>'Helvetica 10', :foreground=>'red4', :anchor=>:center, :yoffset=>-5) } # Display an auxillary y-axis for percentages. -b.axis_configure('y2', :hide=>false, :min=>0.0, :max=>100.0, +b.axis_configure('y2', :hide=>false, :min=>0.0, :max=>100.0, :title=>'Percentage') # Title the y-axis b.axis_configure('y', :title=>'Defects') # Configure the x-axis to display the process names, instead of numbers. -b.axis_configure('x', :title=>'Process', :rotate=>90, :subdivisions=>0, +b.axis_configure('x', :title=>'Process', :rotate=>90, :subdivisions=>0, :command=>proc{|w, val| val = val.round labels[val]? labels[val]: val diff --git a/ext/tk/sample/tkextlib/blt/plot1b.rb b/ext/tk/sample/tkextlib/blt/plot1b.rb index eb41e361f9..8a3ce8216d 100644 --- a/ext/tk/sample/tkextlib/blt/plot1b.rb +++ b/ext/tk/sample/tkextlib/blt/plot1b.rb @@ -4,7 +4,7 @@ require 'tkextlib/blt' graph = Tk::BLT::Graph.new.pack plot = graph.element_create -plot.configure(:linewidth=>0, :label=>'foo', +plot.configure(:linewidth=>0, :label=>'foo', :data=>[[1.0, 3.4], [1.1, 2.8], [1.2, 3.1], [1.4, 2.9]].flatten) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/blt/winop1.rb b/ext/tk/sample/tkextlib/blt/winop1.rb index e94138cd94..97c31aa295 100644 --- a/ext/tk/sample/tkextlib/blt/winop1.rb +++ b/ext/tk/sample/tkextlib/blt/winop1.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/blt' -file = File.join(File.dirname(File.expand_path(__FILE__)), +file = File.join(File.dirname(File.expand_path(__FILE__)), 'images', 'sample.gif') if File.exist?(file) src = TkPhotoImage.new(:file=>file) @@ -30,9 +30,9 @@ Tk.root.background('white') l_hdr = TkLabel.new(:text=>"#{iw} x #{ih}") l_ftr = TkLabel.new(:text=>"#{r}%") l_img = TkLabel.new(:image=>dst) - Tk::BLT::Table.add(Tk.root, - [0,i], l_hdr, - [1,i], l_img, + Tk::BLT::Table.add(Tk.root, + [0,i], l_hdr, + [1,i], l_img, [2,i], l_ftr) Tk.update } diff --git a/ext/tk/sample/tkextlib/blt/winop2.rb b/ext/tk/sample/tkextlib/blt/winop2.rb index 1f674ee893..d59c43ba22 100644 --- a/ext/tk/sample/tkextlib/blt/winop2.rb +++ b/ext/tk/sample/tkextlib/blt/winop2.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/blt' -file = File.join(File.dirname(File.expand_path(__FILE__)), +file = File.join(File.dirname(File.expand_path(__FILE__)), 'images', 'qv100.t.gif') if File.exist?(file) src = TkPhotoImage.new(:file=>file) diff --git a/ext/tk/sample/tkextlib/bwidget/basic.rb b/ext/tk/sample/tkextlib/bwidget/basic.rb index c1521651fd..060baf8a6c 100644 --- a/ext/tk/sample/tkextlib/bwidget/basic.rb +++ b/ext/tk/sample/tkextlib/bwidget/basic.rb @@ -29,37 +29,37 @@ module DemoBasic end def self._label(parent) - lab = Tk::BWidget::Label.new(parent, :text=>'This is a Label widget', + lab = Tk::BWidget::Label.new(parent, :text=>'This is a Label widget', :helptext=>'Label widget') - chk = TkCheckbutton.new(parent, :text=>'Disabled', - :variable=>@@var.ref(lab, 'state'), - :onvalue=>'disabled', :offvalue=>'normal', + chk = TkCheckbutton.new(parent, :text=>'Disabled', + :variable=>@@var.ref(lab, 'state'), + :onvalue=>'disabled', :offvalue=>'normal', :command=>proc{lab[:state] = @@var[lab, 'state']}) lab.pack(:anchor=>:w, :pady=>4) chk.pack(:anchor=>:w) end def self._entry(parent) - ent = Tk::BWidget::Entry.new(parent, :text=>'Press enter', - :helptext=>'Entry widtet', + ent = Tk::BWidget::Entry.new(parent, :text=>'Press enter', + :helptext=>'Entry widtet', :command=>proc{ @@var['entcmd'] = 'command called' Tk.after(500, proc{@@var['entcmd'] = ''}) }) - chk1 = TkCheckbutton.new(parent, :text=>'Disabled', - :variable=>@@var.ref(ent, 'state'), - :onvalue=>'disabled', :offvalue=>'normal', + chk1 = TkCheckbutton.new(parent, :text=>'Disabled', + :variable=>@@var.ref(ent, 'state'), + :onvalue=>'disabled', :offvalue=>'normal', :command=>proc{ent.state = @@var[ent, 'state']}) - chk2 = TkCheckbutton.new(parent, :text=>'Non editable', - :variable=>@@var.ref(ent, 'editable'), - :onvalue=>false, :offvalue=>true, + chk2 = TkCheckbutton.new(parent, :text=>'Non editable', + :variable=>@@var.ref(ent, 'editable'), + :onvalue=>false, :offvalue=>true, :command=>proc{ ent.editable = @@var[ent, 'editable'] }) - lab = TkLabel.new(parent, :textvariable=>@@var.ref('entcmd'), + lab = TkLabel.new(parent, :textvariable=>@@var.ref('entcmd'), :foreground=>'red') ent.pack(:pady=>4, :anchor=>:w) @@ -69,22 +69,22 @@ module DemoBasic def self._button(parent) frame = TkFrame.new(parent) - but = Tk::BWidget::Button.new(frame, :text=>'Press me!', - :repeatdelay=>300, - :command=>proc{_butcmd('command')}, + but = Tk::BWidget::Button.new(frame, :text=>'Press me!', + :repeatdelay=>300, + :command=>proc{_butcmd('command')}, :helptext=>'This is a Button widget') sep1 = Tk::BWidget::Separator.new(frame, :orient=>:vertical) - arr1 = Tk::BWidget::ArrowButton.new(frame, :type=>:button, - :width=>25, :height=>25, :repeatdelay=>300, - :command=>proc{_butcmd('command')}, + arr1 = Tk::BWidget::ArrowButton.new(frame, :type=>:button, + :width=>25, :height=>25, :repeatdelay=>300, + :command=>proc{_butcmd('command')}, :helptext=>"This is an ArrowButton widget\nof type button") sep2 = Tk::BWidget::Separator.new(frame, :orient=>:vertical) - arr2 = Tk::BWidget::ArrowButton.new(frame, :type=>:arrow, - :width=>25, :height=>25, :relief=>:sunken, - :ipadx=>0, :ipady=>0, :repeatdelay=>300, - :command=>proc{_butcmd('command')}, + arr2 = Tk::BWidget::ArrowButton.new(frame, :type=>:arrow, + :width=>25, :height=>25, :relief=>:sunken, + :ipadx=>0, :ipady=>0, :repeatdelay=>300, + :command=>proc{_butcmd('command')}, :helptext=>"This is an ArrowButton widget\nof type arrow") but.pack(:side=>:left, :padx=>4) @@ -94,49 +94,49 @@ module DemoBasic arr2.pack(:side=>:left, :padx=>4) frame.pack - Tk::BWidget::Separator.new(parent, + Tk::BWidget::Separator.new(parent, :orient=>:horizontal).pack(:fill=>:x, :pady=>10) - labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Command', - :side=>:top, :anchor=>:w, + labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Command', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf1.get_frame - chk1 = TkCheckbutton.new(subf, :text=>'Disabled', - :variable=>@@var.ref('bstate'), - :onvalue=>'disabled', :offvalue=>'normal', - :command=>proc{_bstate(@@var['bstate'], + chk1 = TkCheckbutton.new(subf, :text=>'Disabled', + :variable=>@@var.ref('bstate'), + :onvalue=>'disabled', :offvalue=>'normal', + :command=>proc{_bstate(@@var['bstate'], but, arr1, arr2)}) - chk2 = TkCheckbutton.new(subf, :text=>"Use armcommand/\ndisarmcommand", - :variable=>@@var.ref('barmcmd'), - :command=>proc{_barmcmd(@@var['barmcmd'], + chk2 = TkCheckbutton.new(subf, :text=>"Use armcommand/\ndisarmcommand", + :variable=>@@var.ref('barmcmd'), + :command=>proc{_barmcmd(@@var['barmcmd'], but, arr1, arr2)}) Tk.pack(chk1, chk2, :anchor=>:w) - label = TkLabel.new(parent, :textvariable=>@@var.ref('butcmd'), + label = TkLabel.new(parent, :textvariable=>@@var.ref('butcmd'), :foreground=>'red').pack(:side=>:bottom, :pady=>4) - labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Direction', - :side=>:top, :anchor=>:w, + labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Direction', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf2.get_frame @@var['bside'] = :top [:top, :left, :bottom, :right].each{|dir| - TkRadiobutton.new(subf, :text=>"#{dir} arrow", - :variable=>@@var.ref('bside'), :value=>dir, + TkRadiobutton.new(subf, :text=>"#{dir} arrow", + :variable=>@@var.ref('bside'), :value=>dir, :command=>proc{_bside(@@var['bside'], arr1, arr2)} ).pack(:anchor=>:w) } - labf3 = Tk::BWidget::LabelFrame.new(parent, :text=>'Relief', - :side=>:top, :anchor=>:w, + labf3 = Tk::BWidget::LabelFrame.new(parent, :text=>'Relief', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf3.get_frame @@var['brelief'] = :raised [ %w(raised sunken ridge groove), %w(flat solid link)].each{|lrelief| f = TkFrame.new(subf) lrelief.each{|relief| - TkRadiobutton.new(f, :text=>relief, - :variable=>@@var.ref('brelief'), :value=>relief, + TkRadiobutton.new(f, :text=>relief, + :variable=>@@var.ref('brelief'), :value=>relief, :command=>proc{ _brelief(@@var['brelief'], but, arr1, arr2) }).pack(:anchor=>:w) @@ -163,19 +163,19 @@ module DemoBasic def self._barmcmd(value, but, arr1, arr2) if TkComm.bool(value) - but.configure(:armcommand=>proc{_butcmd('arm')}, - :disarmcommand=>proc{_butcmd('disarm')}, + but.configure(:armcommand=>proc{_butcmd('arm')}, + :disarmcommand=>proc{_butcmd('disarm')}, :command=>'') [arr1, arr2].each{|arr| - arr.configure(:armcommand=>proc{_butcmd('arm')}, - :disarmcommand=>proc{_butcmd('disarm')}, + arr.configure(:armcommand=>proc{_butcmd('arm')}, + :disarmcommand=>proc{_butcmd('disarm')}, :command=>'') } else - but.configure(:armcommand=>'', :disarmcommand=>'', + but.configure(:armcommand=>'', :disarmcommand=>'', :command=>proc{_butcmd('command')}) [arr1, arr2].each{|arr| - arr.configure(:armcommand=>'', :disarmcommand=>'', + arr.configure(:armcommand=>'', :disarmcommand=>'', :command=>proc{_butcmd('command')}) } end diff --git a/ext/tk/sample/tkextlib/bwidget/demo.rb b/ext/tk/sample/tkextlib/bwidget/demo.rb index 785d2681a8..3eb98818f3 100644 --- a/ext/tk/sample/tkextlib/bwidget/demo.rb +++ b/ext/tk/sample/tkextlib/bwidget/demo.rb @@ -54,21 +54,21 @@ class BWidget_Demo descmenu = [ '&File', 'all', 'file', 0, [ - ['command', 'E&xit', [], 'Exit BWidget demo', [], + ['command', 'E&xit', [], 'Exit BWidget demo', [], {:command=>proc{exit}}] - ], + ], '&Options', 'all', 'options', 0, [ - ['checkbutton', 'Toolbar &1', ['all', 'option'], - 'Show/hide toolbar 1', [], - { :variable=>DemoVar.toolbar1, + ['checkbutton', 'Toolbar &1', ['all', 'option'], + 'Show/hide toolbar 1', [], + { :variable=>DemoVar.toolbar1, :command=>proc{ DemoVar.mainframe.show_toolbar(0, DemoVar.toolbar1.value) } } - ], - ['checkbutton', 'Toolbar &2', ['all', 'option'], - 'Show/hide toolbar 2', [], - { :variable=>DemoVar.toolbar2, + ], + ['checkbutton', 'Toolbar &2', ['all', 'option'], + 'Show/hide toolbar 2', [], + { :variable=>DemoVar.toolbar2, :command=>proc{ DemoVar.mainframe.show_toolbar(1, DemoVar.toolbar2.value) } @@ -81,8 +81,8 @@ class BWidget_Demo DemoVar.prgindic.value = 0 DemoVar.mainframe = Tk::BWidget::MainFrame.new( - :menu=>descmenu, - :textvariable=>DemoVar.status, + :menu=>descmenu, + :textvariable=>DemoVar.status, :progressvar=>DemoVar.prgindic ) @@ -91,22 +91,22 @@ class BWidget_Demo DemoVar.mainframe.add_toolbar{|tb1| Tk::BWidget::ButtonBox.new(tb1, :spacing=>0, :padx=>1, :pady=>1){|bbox| - add(:image=>Tk::BWidget::Bitmap.new('new'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Create a new file" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('new'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Create a new file" icon'}, :helptext=>"Create a new file") - add(:image=>Tk::BWidget::Bitmap.new('open'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Open an existing file" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('open'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Open an existing file" icon'}, :helptext=>"Open an existing file") - add(:image=>Tk::BWidget::Bitmap.new('save'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Save file" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('save'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Save file" icon'}, :helptext=>"Save file") pack(:side=>:left, :anchor=>:w) @@ -119,22 +119,22 @@ class BWidget_Demo DemoVar.prgindic.numeric += 1 Tk::BWidget::ButtonBox.new(tb1, :spacing=>0, :padx=>1, :pady=>1){|bbox| - add(:image=>Tk::BWidget::Bitmap.new('cut'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Cut selection" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('cut'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Cut selection" icon'}, :helptext=>"Cut selection") - add(:image=>Tk::BWidget::Bitmap.new('copy'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Copy selection" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('copy'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Copy selection" icon'}, :helptext=>"Copy selection") - add(:image=>Tk::BWidget::Bitmap.new('paste'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Paste selection" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('paste'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Paste selection" icon'}, :helptext=>"Paste selection") pack(:side=>:left, :anchor=>:w) @@ -145,7 +145,7 @@ class BWidget_Demo DemoVar.prgindic.numeric += 1 tb2 = DemoVar.mainframe.add_toolbar - DemoVar._wfont = Tk::BWidget::SelectFont::Toolbar.new(tb2, + DemoVar._wfont = Tk::BWidget::SelectFont::Toolbar.new(tb2, :command=>proc{update_font(DemoVar._wfont[:font])} ) DemoVar.font = DemoVar._wfont[:font] @@ -213,18 +213,18 @@ class BWidget_Demo top.withdraw top.overrideredirect(true) - ximg = TkLabel.new(top, :bitmap=>"@#{File.join(DEMODIR,'x1.xbm')}", + ximg = TkLabel.new(top, :bitmap=>"@#{File.join(DEMODIR,'x1.xbm')}", :foreground=>'grey90', :background=>'white') bwimg = TkLabel.new(ximg, :bitmap=>"@#{File.join(DEMODIR,'bwidget.xbm')}", :foreground=>'grey90', :background=>'white') frame = TkFrame.new(ximg, :background=>'white') - TkLabel.new(frame, :text=>'Loading demo', + TkLabel.new(frame, :text=>'Loading demo', :background=>'white', :font=>'times 8').pack - TkLabel.new(frame, :textvariable=>DemoVar.prgtext, + TkLabel.new(frame, :textvariable=>DemoVar.prgtext, :background=>'white', :font=>'times 8', :width=>35).pack - Tk::BWidget::ProgressBar.new(frame, :width=>50, :height=>10, - :background=>'white', - :variable=>DemoVar.prgindic, + Tk::BWidget::ProgressBar.new(frame, :width=>50, :height=>10, + :background=>'white', + :variable=>DemoVar.prgindic, :maximum=>10).pack frame.place(:x=>0, :y=>0, :anchor=>:nw) bwimg.place(:relx=>1, :rely=>1, :anchor=>:se) diff --git a/ext/tk/sample/tkextlib/bwidget/dnd.rb b/ext/tk/sample/tkextlib/bwidget/dnd.rb index 1c8b036530..b1b1cf60ff 100644 --- a/ext/tk/sample/tkextlib/bwidget/dnd.rb +++ b/ext/tk/sample/tkextlib/bwidget/dnd.rb @@ -12,19 +12,19 @@ module DemoDnD titf1 = Tk::BWidget::TitleFrame.new(frame, :text=>'Drag source') subf = titf1.get_frame - ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry', - :labelwidth=>14, :dragenabled=>true, + ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry', + :labelwidth=>14, :dragenabled=>true, :dragevent=>3) - labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (text)', + labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (text)', :width=>14) f = labf1.get_frame - lab = Tk::BWidget::Label.new(f, :text=>'Drag this text', + lab = Tk::BWidget::Label.new(f, :text=>'Drag this text', :dragenabled=>true, :dragevent=>3).pack - labf2 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (bitmap)', + labf2 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (bitmap)', :width=>14) f = labf2.get_frame - lab = Tk::BWidget::Label.new(f, :bitmap=>'info', + lab = Tk::BWidget::Label.new(f, :bitmap=>'info', :dragenabled=>true, :dragevent=>3).pack Tk.pack(ent1, labf1, labf2, :side=>:top, :fill=>:x, :pady=>4) @@ -32,11 +32,11 @@ module DemoDnD titf2 = Tk::BWidget::TitleFrame.new(frame, :text=>'Drop targets') subf = titf2.get_frame - ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry', + ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry', :labelwidth=>14, :dropenabled=>true) labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label', :width=>14) f = labf1.get_frame - lab = Tk::BWidget::Label.new(f, :dropenabled=>true, + lab = Tk::BWidget::Label.new(f, :dropenabled=>true, :highlightthickness=>1).pack(:fill=>:x) Tk.pack(ent1, labf1, :side=>:top, :fill=>:x, :pady=>4) Tk.pack(titf1, titf2, :pady=>4) diff --git a/ext/tk/sample/tkextlib/bwidget/manager.rb b/ext/tk/sample/tkextlib/bwidget/manager.rb index 776cb3065b..a59afb8b86 100644 --- a/ext/tk/sample/tkextlib/bwidget/manager.rb +++ b/ext/tk/sample/tkextlib/bwidget/manager.rb @@ -32,19 +32,19 @@ module DemoManager end def self._mainframe(parent) - labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Toolbar', - :side=>:top, :anchor=>:w, + labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Toolbar', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>2) subf = labf1.get_frame - chk1 = TkCheckbutton.new(subf, :text=>'View toolbar 1', - :variable=>DemoVar.toolbar1, + chk1 = TkCheckbutton.new(subf, :text=>'View toolbar 1', + :variable=>DemoVar.toolbar1, :command=>proc{ DemoVar.mainframe.show_toolbar( 0, DemoVar.toolbar1.value ) }) - chk2 = TkCheckbutton.new(subf, :text=>'View toolbar 2', - :variable=>DemoVar.toolbar2, + chk2 = TkCheckbutton.new(subf, :text=>'View toolbar 2', + :variable=>DemoVar.toolbar2, :command=>proc{ DemoVar.mainframe.show_toolbar( 1, DemoVar.toolbar2.value @@ -54,12 +54,12 @@ module DemoManager Tk.pack(chk1, chk2, :anchor=>:w, :fill=>:x) labf1.pack(:fill=>:both) - labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Status bar', - :side=>:top, :anchor=>:w, + labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Status bar', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>2) subf = labf2.get_frame - chk1 = TkCheckbutton.new(subf, :text=>"Show Progress\nindicator", - :justify=>:left, :variable=>@@progress, + chk1 = TkCheckbutton.new(subf, :text=>"Show Progress\nindicator", + :justify=>:left, :variable=>@@progress, :command=>proc{ _show_progress }) chk1.pack(:anchor=>:w, :fill=>:x) @@ -67,8 +67,8 @@ module DemoManager end def self._notebook(parent) - TkCheckbutton.new(parent, :text=>'Homogeneous label', - :variable=>@@homogeneous, + TkCheckbutton.new(parent, :text=>'Homogeneous label', + :variable=>@@homogeneous, :command=>proc{ DemoVar.notebook[:homogeneous] = @@homogeneous.value }).pack(:side=>:left, :anchor=>:n, :fill=>:x) @@ -92,13 +92,13 @@ module DemoManager sw.pack(:fill=>:both, :expand=>true) } - sw = Tk::BWidget::ScrolledWindow.new(pane3, :relief=>:sunken, + sw = Tk::BWidget::ScrolledWindow.new(pane3, :relief=>:sunken, :borderwidth=>2) sf = Tk::BWidget::ScrollableFrame.new(sw) sw.set_widget(sf) subf = sf.get_frame lab = TkLabel.new(subf, :text=>'This is a ScrollableFrame') - chk = TkCheckbutton.new(subf, :text=>'Constrained with', + chk = TkCheckbutton.new(subf, :text=>'Constrained with', :variable=>@@constw, :command=>proc{ sf['constrainedwidth'] = @@constw.value }) diff --git a/ext/tk/sample/tkextlib/bwidget/select.rb b/ext/tk/sample/tkextlib/bwidget/select.rb index ea24b47e2e..3a1a810e14 100644 --- a/ext/tk/sample/tkextlib/bwidget/select.rb +++ b/ext/tk/sample/tkextlib/bwidget/select.rb @@ -13,28 +13,28 @@ module DemoSelect titf1 = Tk::BWidget::TitleFrame.new(frame, :text=>'SpinBox') subf = titf1.get_frame - spin = Tk::BWidget::SpinBox.new(subf, :range=>[1, 100, 1], - :textvariable=>@@var.ref('spin', 'var'), + spin = Tk::BWidget::SpinBox.new(subf, :range=>[1, 100, 1], + :textvariable=>@@var.ref('spin', 'var'), :helptext=>'This is the SpinBox') - ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var', - :labelwidth=>10, :labelanchor=>:w, - :textvariable=>@@var.ref('spin', 'var'), - :editable=>0, + ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var', + :labelwidth=>10, :labelanchor=>:w, + :textvariable=>@@var.ref('spin', 'var'), + :editable=>0, :helptext=>"This is an Entry reflecting\nthe linked var of SpinBox") - labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', - :side=>:top, :anchor=>:w, - :relief=>:sunken, :borderwidth=>1, + labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', + :side=>:top, :anchor=>:w, + :relief=>:sunken, :borderwidth=>1, :helptext=>'Modify some options of SpinBox') subf = labf.get_frame - chk1 = TkCheckbutton.new(subf, :text=>'Non editable', - :variable=>@@var.ref('spin', 'editable'), - :onvalue=>false, :offvalue=>true, + chk1 = TkCheckbutton.new(subf, :text=>'Non editable', + :variable=>@@var.ref('spin', 'editable'), + :onvalue=>false, :offvalue=>true, :command=>proc{ spin.editable(@@var['spin', 'editable']) }) - chk2 = TkCheckbutton.new(subf, :text=>'Disabled', - :variable=>@@var.ref('spin', 'state'), - :onvalue=>'disabled', :offvalue=>'normal', + chk2 = TkCheckbutton.new(subf, :text=>'Disabled', + :variable=>@@var.ref('spin', 'state'), + :onvalue=>'disabled', :offvalue=>'normal', :command=>proc{ spin.state(@@var['spin', 'state']) }) @@ -47,28 +47,28 @@ module DemoSelect combo = Tk::BWidget::ComboBox.new(subf, :textvariable=>@@var.ref('combo', 'var'), :values=>[ - 'first value', 'second value', - 'third value', 'fourth value', + 'first value', 'second value', + 'third value', 'fourth value', 'fifth value' - ], + ], :helptext=>'This is the ComboBox') - ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var', - :labelwidth=>10, :labelanchor=>:w, + ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var', + :labelwidth=>10, :labelanchor=>:w, :textvariable=>@@var.ref('combo', 'var'), :editable=>0, :helptext=>"This is an Entry reflecting\nthe linked var of ComboBox") - labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', :side=>:top, - :anchor=>:w, :relief=>:sunken, + labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', :side=>:top, + :anchor=>:w, :relief=>:sunken, :borderwidth=>1, :helptext=>'Modify some options of ComboBox') subf = labf.get_frame - chk1 = TkCheckbutton.new(subf, :text=>'Non editable', - :variable=>@@var.ref('combo', 'editable'), - :onvalue=>false, :offvalue=>true, + chk1 = TkCheckbutton.new(subf, :text=>'Non editable', + :variable=>@@var.ref('combo', 'editable'), + :onvalue=>false, :offvalue=>true, :command=>proc{ combo.editable(@@var['combo', 'editable']) }) - chk2 = TkCheckbutton.new(subf, :text=>'Disabled', - :variable=>@@var.ref('combo', 'state'), - :onvalue=>'disabled', :offvalue=>'normal', + chk2 = TkCheckbutton.new(subf, :text=>'Disabled', + :variable=>@@var.ref('combo', 'state'), + :onvalue=>'disabled', :offvalue=>'normal', :command=>proc{ combo.state(@@var['combo', 'state']) }) diff --git a/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb b/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb index 3d19c8d092..da2c9678c0 100644 --- a/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb +++ b/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb @@ -23,14 +23,14 @@ module DemoDialog titf4 = Tk::BWidget::TitleFrame.new(frame, :text=>'Other dialog') subf = titf1.get_frame - cmd = proc{ TkOption.read_file(File.join(Tk::BWidget::LIBRARY, 'lang', + cmd = proc{ TkOption.read_file(File.join(Tk::BWidget::LIBRARY, 'lang', @@resources.value + '.rc')) } - Tk.pack(TkRadiobutton.new(subf, :text=>'English', :value=>'en', - :variable=>@@resources, :command=>cmd), - TkRadiobutton.new(subf, :text=>'French', :value=>'fr', - :variable=>@@resources, :command=>cmd), - TkRadiobutton.new(subf, :text=>'German', :value=>'de', - :variable=>@@resources, :command=>cmd), + Tk.pack(TkRadiobutton.new(subf, :text=>'English', :value=>'en', + :variable=>@@resources, :command=>cmd), + TkRadiobutton.new(subf, :text=>'French', :value=>'fr', + :variable=>@@resources, :command=>cmd), + TkRadiobutton.new(subf, :text=>'German', :value=>'de', + :variable=>@@resources, :command=>cmd), :side=>:left) _tmpldlg(titf2.get_frame) @@ -46,34 +46,34 @@ module DemoDialog @@tmpl['side'] = :bottom @@tmpl['anchor'] = :c - labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button side', - :side=>:top, :anchor=>:w, + labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button side', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf1.get_frame - Tk.pack(TkRadiobutton.new(subf, :text=>'Bottom', :value=>:bottom, - :variable=>@@tmpl.ref('side'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Left', :value=>:left, - :variable=>@@tmpl.ref('side'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Right', :value=>:right, - :variable=>@@tmpl.ref('side'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Top', :value=>:top, - :variable=>@@tmpl.ref('side'), :anchor=>:w), + Tk.pack(TkRadiobutton.new(subf, :text=>'Bottom', :value=>:bottom, + :variable=>@@tmpl.ref('side'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Left', :value=>:left, + :variable=>@@tmpl.ref('side'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Right', :value=>:right, + :variable=>@@tmpl.ref('side'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Top', :value=>:top, + :variable=>@@tmpl.ref('side'), :anchor=>:w), :fill=>:x, :anchor=>:w) - labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button anchor', - :side=>:top, :anchor=>:w, + labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button anchor', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf2.get_frame - Tk.pack(TkRadiobutton.new(subf, :text=>'North', :value=>:n, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'West', :value=>:w, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'East', :value=>:e, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'South', :value=>:s, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Center', :value=>:c, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + Tk.pack(TkRadiobutton.new(subf, :text=>'North', :value=>:n, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'West', :value=>:w, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'East', :value=>:e, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'South', :value=>:s, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Center', :value=>:c, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), :fill=>:x, :anchor=>:w) sep = Tk::BWidget::Separator.new(parent, :orient=>:horizontal) @@ -88,44 +88,44 @@ module DemoDialog @@msg['type'] = 'ok' @@msg['icon'] = 'info' - labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Type', :side=>:top, - :anchor=>:w, :relief=>:sunken, + labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Type', :side=>:top, + :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf1.get_frame - Tk.pack(TkRadiobutton.new(subf, :text=>'Ok', :value=>'ok', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Ok, Cancel', :value=>'okcancel', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Retry, Cancel', - :value=>'retrycancel', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Yes, No', :value=>'yesno', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Yes, No, Cancel', - :value=>'yesnocancel', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Abort, Retry, Ignore', - :value=>'abortretryignore', - :variable=>@@msg.ref('type'), :anchor=>:w), + Tk.pack(TkRadiobutton.new(subf, :text=>'Ok', :value=>'ok', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Ok, Cancel', :value=>'okcancel', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Retry, Cancel', + :value=>'retrycancel', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Yes, No', :value=>'yesno', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Yes, No, Cancel', + :value=>'yesnocancel', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Abort, Retry, Ignore', + :value=>'abortretryignore', + :variable=>@@msg.ref('type'), :anchor=>:w), :fill=>:x, :anchor=>:w) - Tk.pack(TkRadiobutton.new(subf, :text=>'User', :value=>'user', - :variable=>@@msg.ref('type'), :anchor=>:w), + Tk.pack(TkRadiobutton.new(subf, :text=>'User', :value=>'user', + :variable=>@@msg.ref('type'), :anchor=>:w), Tk::BWidget::Entry.new(subf, :textvariable=>@@msg.ref('buttons')), :side=>:left) - labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Icon', :side=>:top, - :anchor=>:w, :relief=>:sunken, + labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Icon', :side=>:top, + :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf2.get_frame - Tk.pack(TkRadiobutton.new(subf, :text=>'Information', :value=>'info', - :variable=>@@msg.ref('icon'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Question', :value=>'question', - :variable=>@@msg.ref('icon'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Warning', :value=>'warning', - :variable=>@@msg.ref('icon'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Error', :value=>'error', - :variable=>@@msg.ref('icon'), :anchor=>:w), + Tk.pack(TkRadiobutton.new(subf, :text=>'Information', :value=>'info', + :variable=>@@msg.ref('icon'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Question', :value=>'question', + :variable=>@@msg.ref('icon'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Warning', :value=>'warning', + :variable=>@@msg.ref('icon'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Error', :value=>'error', + :variable=>@@msg.ref('icon'), :anchor=>:w), :fill=>:x, :anchor=>:w) sep = Tk::BWidget::Separator.new(parent, :orient=>:horizontal) @@ -139,13 +139,13 @@ module DemoDialog def self._stddlg(parent) Tk.pack(TkButton.new(parent, :text=>'Select a color '){|w| command(proc{DemoDialog._show_color(w)}) - }, - TkButton.new(parent, :text=>'Font selector dialog', - :command=>proc{_show_fontdlg}), - TkButton.new(parent, :text=>'Progression dialog', - :command=>proc{_show_progdlg}), - TkButton.new(parent, :text=>'Password dialog', - :command=>proc{_show_passdlg}), + }, + TkButton.new(parent, :text=>'Font selector dialog', + :command=>proc{_show_fontdlg}), + TkButton.new(parent, :text=>'Progression dialog', + :command=>proc{_show_progdlg}), + TkButton.new(parent, :text=>'Password dialog', + :command=>proc{_show_passdlg}), :side=>:left, :padx=>5, :anchor=>:w) end @@ -158,15 +158,15 @@ module DemoDialog end def self._show_tmpldlg - dlg = Tk::BWidget::Dialog.new(:relative=>Tk.root, :modal=>:local, - :separator=>true, :title=>'Template dialog', - :side=>@@tmpl['side'], - :anchor=>@@tmpl['anchor'], + dlg = Tk::BWidget::Dialog.new(:relative=>Tk.root, :modal=>:local, + :separator=>true, :title=>'Template dialog', + :side=>@@tmpl['side'], + :anchor=>@@tmpl['anchor'], :default=>0, :cancel=>1) dlg.add('name'=>'ok') dlg.add('name'=>'cancel') - TkMessage.new(dlg.get_frame, :text=>"Template\nDialog", :justify=>:center, - :anchor=>:c, :width=>80).pack(:fill=>:both, :expand=>true, + TkMessage.new(dlg.get_frame, :text=>"Template\nDialog", :justify=>:center, + :anchor=>:c, :width=>80).pack(:fill=>:both, :expand=>true, :padx=>100, :pady=>100) dlg.draw dlg.destroy @@ -174,16 +174,16 @@ module DemoDialog def self._show_msgdlg @@msgdlg.destroy if @@msgdlg - @@msgdlg = Tk::BWidget::MessageDlg.new(:relative=>Tk.root, - :message=>'Message for MessageBox', - :type=>@@msg['type'], - :icon=>@@msg['icon'], + @@msgdlg = Tk::BWidget::MessageDlg.new(:relative=>Tk.root, + :message=>'Message for MessageBox', + :type=>@@msg['type'], + :icon=>@@msg['icon'], :buttons=>@@msg['buttons']) @@msgdlg.create end def self._show_fontdlg - font = Tk::BWidget::SelectFont.new(:relative=>Tk.root, + font = Tk::BWidget::SelectFont.new(:relative=>Tk.root, :font=>DemoVar.font).create DemoVar::Demo.update_font(font) end @@ -192,11 +192,11 @@ module DemoDialog @@progmsg.value = "Compute in progress..." @@progval.value = 0 - @@progdlg = Tk::BWidget::ProgressDlg.new(:relative=>Tk.root, - :title=>'Wait...', - :type=>'infinite', :width=>20, - :textvariable=>@@progmsg, - :variable=>@@progval, + @@progdlg = Tk::BWidget::ProgressDlg.new(:relative=>Tk.root, + :title=>'Wait...', + :type=>'infinite', :width=>20, + :textvariable=>@@progmsg, + :variable=>@@progval, :stop=>'Stop') { command(proc{self.destroy}) create diff --git a/ext/tk/sample/tkextlib/bwidget/tree.rb b/ext/tk/sample/tkextlib/bwidget/tree.rb index e1fcaa774f..9ef6569d16 100644 --- a/ext/tk/sample/tkextlib/bwidget/tree.rb +++ b/ext/tk/sample/tkextlib/bwidget/tree.rb @@ -16,28 +16,28 @@ module DemoTree pane = pw.add(:weight=>1) title = Tk::BWidget::TitleFrame.new(pane, :text=>'Directory tree') - sw = Tk::BWidget::ScrolledWindow.new(title.get_frame, + sw = Tk::BWidget::ScrolledWindow.new(title.get_frame, :relief=>:sunken, :borderwidth=>2) - tree = Tk::BWidget::Tree.new(sw, :relief=>:flat, :borderwidth=>0, - :width=>15, :highlightthickness=>0, - :redraw=>false, :dropenabled=>true, - :dragenabled=>true, :dragevent=>3, + tree = Tk::BWidget::Tree.new(sw, :relief=>:flat, :borderwidth=>0, + :width=>15, :highlightthickness=>0, + :redraw=>false, :dropenabled=>true, + :dragenabled=>true, :dragevent=>3, :droptypes=>[ 'TREE_NODE', [ - :copy, [], + :copy, [], :move, [], :link, [] - ], + ], 'LISTBOX_ITEM', [ - :copy, [], + :copy, [], :move, [], :link, [] ] - ], - :opencmd=>proc{|node| + ], + :opencmd=>proc{|node| moddir(1, tree, node) - }, - :closecmd=>proc{|node| + }, + :closecmd=>proc{|node| moddir(0, tree, node) }) sw.set_widget(tree) @@ -47,24 +47,24 @@ module DemoTree pane = pw.add(:weight=>2) lf = Tk::BWidget::TitleFrame.new(pane, :text=>'Content') - sw = Tk::BWidget::ScrolledWindow.new(lf.get_frame, - :scrollbar=>:horizontal, - :auto=>:none, :relief=>:sunken, + sw = Tk::BWidget::ScrolledWindow.new(lf.get_frame, + :scrollbar=>:horizontal, + :auto=>:none, :relief=>:sunken, :borderwidth=>2) - list = Tk::BWidget::ListBox.new(sw, :relief=>:flat, :borderwidth=>0, - :highlightthickness=>0, :width=>20, - :multicolumn=>true, :redraw=>false, - :dragevent=>3, :dropenabled=>true, - :dragenabled=>true, + list = Tk::BWidget::ListBox.new(sw, :relief=>:flat, :borderwidth=>0, + :highlightthickness=>0, :width=>20, + :multicolumn=>true, :redraw=>false, + :dragevent=>3, :dropenabled=>true, + :dragenabled=>true, :droptypes=>[ 'TREE_NODE', [ - :copy, [], + :copy, [], :move, [], :link, [] - ], + ], 'LISTBOX_ITEM', [ - :copy, [], + :copy, [], :move, [], :link, [] ] @@ -77,43 +77,43 @@ module DemoTree tree.textbind('ButtonPress-1', proc{|node, ev| select('tree', 1, tree, list, node)}) - tree.textbind('Double-ButtonPress-1', + tree.textbind('Double-ButtonPress-1', proc{|node, ev| select('tree', 2, tree, list, node)}) list.textbind('ButtonPress-1', proc{|node, ev| select('list', 1, tree, list, node)}) - list.textbind('Double-ButtonPress-1', + list.textbind('Double-ButtonPress-1', proc{|node, ev| select('list', 2, tree, list, node)}) - list.imagebind('Double-ButtonPress-1', + list.imagebind('Double-ButtonPress-1', proc{|node, ev| select('list', 2, tree, list, node)}) - nb.itemconfigure('demoTree', - :createcmd=>proc{|*args| init(tree, list, *args)}, + nb.itemconfigure('demoTree', + :createcmd=>proc{|*args| init(tree, list, *args)}, :raisecmd=>proc{ - Tk.root.geometry =~ + Tk.root.geometry =~ /\d+x\d+([+-]{1,2}\d+)([+-]{1,2}\d+)/ global_w = ($1 || 0).to_i global_h = ($2 || 0).to_i if @@top - Tk::BWidget.place(@@top, 0, 0, :at, + Tk::BWidget.place(@@top, 0, 0, :at, global_w - Tk.root.winfo_screenwidth, global_h) @@top.deiconify Tk.root.bind('Unmap', proc{@@top.withdraw}) Tk.root.bind('Map', proc{@@top.deiconify}) Tk.root.bind('Configure', proc{|w| if w == Tk.root - Tk.root.geometry =~ + Tk.root.geometry =~ /\d+x\d+([+-]{1,2}\d+)([+-]{1,2}\d+)/ global_w = ($1 || 0).to_i global_h = ($2 || 0).to_i - Tk::BWidget.place(@@top, 0, 0, :at, - global_w - Tk.root.winfo_screenwidth, + Tk::BWidget.place(@@top, 0, 0, :at, + global_w - Tk.root.winfo_screenwidth, global_h) end }, '%W') end - }, + }, :leavecmd=>proc{ @@top.withdraw if @@top Tk.root.bind_remove('Unmap') @@ -131,8 +131,8 @@ module DemoTree rootdir = 'c:' end - tree.insert('end', 'root', 'home', - :text=>rootdir, :data=>rootdir, :open=>true, + tree.insert('end', 'root', 'home', + :text=>rootdir, :data=>rootdir, :open=>true, :image=>Tk::BWidget::Bitmap.new('openfold')) getdir(tree, 'home', rootdir) select('tree', 1, tree, list, 'home') @@ -147,8 +147,8 @@ module DemoTree @@top.resizable(false, false) @@top.title('Drag rectangle to scroll directory tree') @@top.transient(Tk.root) - Tk::BWidget::ScrollView.new(@@top, :window=>tree, :fill=>'white', - :width=>300, :height=>300, :relief=>:sunken, + Tk::BWidget::ScrollView.new(@@top, :window=>tree, :fill=>'white', + :width=>300, :height=>300, :relief=>:sunken, :bd=>1).pack(:fill=>:both, :expand=>true) end @@ -156,11 +156,11 @@ module DemoTree lentries = Dir.glob(File.join(path, '*')).sort lfiles = [] lentries.each{|f| - basename = File.basename(f) + basename = File.basename(f) if File.directory?(f) - Tk::BWidget::Tree::Node.new(tree, node, - :index=>'end', :text=>basename, - :image=>Tk::BWidget::Bitmap.new('folder'), + Tk::BWidget::Tree::Node.new(tree, node, + :index=>'end', :text=>basename, + :image=>Tk::BWidget::Bitmap.new('folder'), :drawcross=>:allways, :data=>f) @@count += 1 else @@ -187,7 +187,7 @@ module DemoTree def self.select(where, num, tree, list, node) @@dblclick = true if num == 1 - if (where == 'tree' && + if (where == 'tree' && tree.selection_get.find{|x| TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) }) @@ -195,7 +195,7 @@ module DemoTree Tk.after(500, proc{edit('tree', tree, list, node)}) return end - if (where == 'list' && + if (where == 'list' && list.selection_get.find{|x| TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) }) @@ -230,13 +230,13 @@ module DemoTree end tree.nodes(node).each{|subnode| - list.insert('end', subnode, - :text=>tree.itemcget(subnode, :text), + list.insert('end', subnode, + :text=>tree.itemcget(subnode, :text), :image=>Tk::BWidget::Bitmap.new('folder')) } TkComm.simplelist(dir).each{|f| - Tk::BWidget::ListBox::Item.new(list, 'end', :text=>f, + Tk::BWidget::ListBox::Item.new(list, 'end', :text=>f, :image=>Tk::BWidget::Bitmap.new('file')) } end @@ -244,7 +244,7 @@ module DemoTree def self.edit(where, tree, list, node) return if @@dblclick - if (where == 'tree' && + if (where == 'tree' && tree.selection_get.find{|x| TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) }) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb index 4dd929c035..bb09b4dfd3 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb @@ -2,9 +2,9 @@ require 'tk' require 'tkextlib/iwidgets' -Tk::Iwidgets::Calendar.new(:command=>proc{|arg| puts(arg.date)}, - :weekendbackground=>'mistyrose', - :weekdaybackground=>'ghostwhite', - :outline=>'black', :startday=>'wednesday', +Tk::Iwidgets::Calendar.new(:command=>proc{|arg| puts(arg.date)}, + :weekendbackground=>'mistyrose', + :weekdaybackground=>'ghostwhite', + :outline=>'black', :startday=>'wednesday', :days=>%w(We Th Fr Sa Su Mo Tu)).pack Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb index ec9c7a1df3..36847538d6 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb @@ -5,11 +5,11 @@ require 'tkextlib/iwidgets' # # Non-editable Dropdown Combobox # -cb1 = Tk::Iwidgets::Combobox.new(:labeltext=>'Month:', +cb1 = Tk::Iwidgets::Combobox.new(:labeltext=>'Month:', :selectioncommand=>proc{ puts(cb1.get_curselection) - }, - :editable=>false, :listheight=>185, + }, + :editable=>false, :listheight=>185, :popupcursor=>'hand1') cb1.insert_list('end', *%w(Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec)) @@ -18,7 +18,7 @@ cb1.insert_list('end', *%w(Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec)) # # Editable Dropdown Combobox # -cb2 = Tk::Iwidgets::Combobox.new(:labeltext=>'Operating System:', +cb2 = Tk::Iwidgets::Combobox.new(:labeltext=>'Operating System:', :selectioncommand=>proc{ puts(cb2.get_curselection) }) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb b/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb index 197521e0a4..00ee99786c 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb @@ -8,7 +8,7 @@ ds.add('OK', :text=>'OK', :command=>proc{puts 'OK'; ds.deactivate}) ds.add('Cancel', :text=>'Cancel', :command=>proc{puts 'Cancel'; ds.deactivate}) ds.default('OK') -TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, +TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, :command=>proc{puts ds.activate}).pack(:padx=>10, :pady=>10) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb index 85c5d03d17..682c853e47 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -djl = Tk::Iwidgets::Disjointlistbox.new.pack(:fill=>:both, :expand=>true, +djl = Tk::Iwidgets::Disjointlistbox.new.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10) djl.set_lhs(*[0,2,4,5]) djl.set_rhs(3,6) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb index 856d883a92..8563a0894d 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb @@ -11,20 +11,20 @@ TkOption.add('*textBackground', 'white') ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) -fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', +fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', :fixed=>10, :width=>12) -nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', +nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', :validate=>:numeric, :width=>12) -aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', - :validate=>:alphabetic, :width=>12, +aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', + :validate=>:alphabetic, :width=>12, :invalid=>proc{ puts "Alphabetic contents invalid" }) -pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, - :show=>Tk::UTF8_String("\267"), +pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, + :show=>Tk::UTF8_String("\267"), ## <=== utf8 character :command=>proc{puts "Return Pressed"}) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb index e2b4eec6bc..d8ccdf8555 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb @@ -17,19 +17,19 @@ TkOption.add('*textBackground', 'white') ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) -fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', +fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', :fixed=>10, :width=>12) -nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', +nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', :validate=>:numeric, :width=>12) -aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', - :validate=>:alphabetic, :width=>12, +aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', + :validate=>:alphabetic, :width=>12, :invalid=>proc{ puts "Alphabetic contents invalid" }) -pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, +pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, :show=>"\267", ## <=== utf8 character :command=>proc{puts "Return Pressed"}) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb index bddd542f64..327f90893c 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb @@ -13,19 +13,19 @@ TkOption.add('*textBackground', 'white') ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) -fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', +fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', :fixed=>10, :width=>12) -nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', +nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', :validate=>:numeric, :width=>12) -aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', - :validate=>:alphabetic, :width=>12, +aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', + :validate=>:alphabetic, :width=>12, :invalid=>proc{ puts "Alphabetic contents invalid" }) -pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, +pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, :show=>"\267", ## <=== utf8 character :command=>proc{puts "Return Pressed"}) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb index 6971052b60..4944c72ea5 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb @@ -2,9 +2,9 @@ require 'tk' require 'tkextlib/iwidgets' -Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info', - :background=>'bisque', :activeforeground=>'red', - :bitmapforeground=>'blue', :defaultring=>true, +Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info', + :background=>'bisque', :activeforeground=>'red', + :bitmapforeground=>'blue', :defaultring=>true, :command=>proc{ puts "Bisque is beautiful" }).pack(:expand=>true) @@ -12,9 +12,9 @@ Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info', #img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../../../images/earthris.gif')) img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/clear.gif')) -Tk::Iwidgets::Extbutton.new(:text=>'Image example', :relief=>:ridge, - :image=>img, :imagepos=>:e, :font=>'9x15bold', - :activebackground=>'lightyellow', +Tk::Iwidgets::Extbutton.new(:text=>'Image example', :relief=>:ridge, + :image=>img, :imagepos=>:e, :font=>'9x15bold', + :activebackground=>'lightyellow', :background=>'lightgreen').pack(:expand=>true) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb index 4738084d9d..63e4be2fee 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -Tk::Iwidgets::Extfileselectionbox.new.pack(:padx=>10, :pady=>10, +Tk::Iwidgets::Extfileselectionbox.new.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb index 2ad3adb974..3a5b513bde 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -Tk::Iwidgets::Fileselectionbox.new.pack(:padx=>10, :pady=>10, +Tk::Iwidgets::Fileselectionbox.new.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb index ddb08d8b78..085070e652 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb @@ -10,16 +10,16 @@ def get_files(file) } end -Tk::Iwidgets::Hierarchy.new(:querycommand=>proc{|arg| get_files(arg.node)}, - :visibleitems=>'30x15', - :labeltext=>ENV['HOME']).pack(:side=>:left, - :expand=>true, +Tk::Iwidgets::Hierarchy.new(:querycommand=>proc{|arg| get_files(arg.node)}, + :visibleitems=>'30x15', + :labeltext=>ENV['HOME']).pack(:side=>:left, + :expand=>true, :fill=>:both) -# Tk::Iwidgets::Hierarchy.new(:querycommand=>[proc{|n| get_files(n)}, '%n'], -# :visibleitems=>'30x15', -# :labeltext=>ENV['HOME']).pack(:side=>:left, -# :expand=>true, +# Tk::Iwidgets::Hierarchy.new(:querycommand=>[proc{|n| get_files(n)}, '%n'], +# :visibleitems=>'30x15', +# :labeltext=>ENV['HOME']).pack(:side=>:left, +# :expand=>true, # :fill=>:both) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb b/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb index 1d2e0a98a3..577550af55 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb @@ -2,11 +2,11 @@ require 'tk' require 'tkextlib/iwidgets' -lw = Tk::Iwidgets::Labeledwidget.new(:labeltext=>'Canvas Widget', +lw = Tk::Iwidgets::Labeledwidget.new(:labeltext=>'Canvas Widget', :labelpos=>:s) lw.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10) -cw = TkCanvas.new(lw.child_site, :relief=>:raised, :width=>200, :height=>200, +cw = TkCanvas.new(lw.child_site, :relief=>:raised, :width=>200, :height=>200, :borderwidth=>3, :background=>:white) cw.pack(:padx=>10, :pady=>10) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb b/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb index b87a6d27f9..c9677f2270 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb @@ -4,55 +4,55 @@ require 'tkextlib/iwidgets' mw = Tk::Iwidgets::Mainwindow.new -mw.menubar.add(:menubutton, 'file', :text=>'File', :underline=>0, +mw.menubar.add(:menubutton, 'file', :text=>'File', :underline=>0, :padx=>8, :pady=>2, :menu=>[ - [:options, {:tearoff=>false}], + [:options, {:tearoff=>false}], [:command, 'new', { - :label=>'New', :underline=>0, + :label=>'New', :underline=>0, :helpstr=>'Create a new file' } - ], + ], [:command, 'open', { - :label=>'Open ...', :underline=>0, + :label=>'Open ...', :underline=>0, :helpstr=>'Open an existing file' } - ], + ], [:command, 'save', { - :label=>'Save', :underline=>0, + :label=>'Save', :underline=>0, :helpstr=>'Save the current file' } - ], + ], [:command, 'saveas', { - :label=>'Save As', :underline=>5, + :label=>'Save As', :underline=>5, :helpstr=>'Save the file as a different name' } - ], + ], [:command, 'print', { - :label=>'Print', :underline=>0, + :label=>'Print', :underline=>0, :helpstr=>'Print the file' } - ], + ], - [:separator, 'sep1'], + [:separator, 'sep1'], [:command, 'close', { - :label=>'Close', :underline=>0, + :label=>'Close', :underline=>0, :helpstr=>'Close the file' } - ], + ], - [:separator, 'sep2'], + [:separator, 'sep2'], [:command, 'exit', { - :label=>'Exit', :underline=>1, + :label=>'Exit', :underline=>1, :helpstr=>'Exit this application' } - ], + ], nil ]) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb index 891761adc1..e01275217d 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb @@ -8,96 +8,96 @@ viewmode = TkVariable.new menu_spec = [ [:menubutton, 'file', { :text=>'File', :menu=>[ - [:options, {:tearoff=>false}], + [:options, {:tearoff=>false}], [:command, 'new', { - :label=>'New', :helpstr=>'Open new document', + :label=>'New', :helpstr=>'Open new document', :command=>proc{puts 'NEW'} } - ], + ], [:command, 'close', { - :label=>'Close', :helpstr=>'Close current document', + :label=>'Close', :helpstr=>'Close current document', :command=>proc{puts 'CLOSE'} } - ], + ], - [:separator, 'sep1'], + [:separator, 'sep1'], [:command, 'exit', { - :label=>'Exit', :helpstr=>'Exit application', + :label=>'Exit', :helpstr=>'Exit application', :command=>proc{exit} } ] ] } - ], + ], [:menubutton, 'edit', { :text=>'Edit', :menu=>[ - [:options, {:tearoff=>false}], + [:options, {:tearoff=>false}], [:command, 'undo', { - :label=>'Undo', :underline=>0, - :helpstr=>'Undo last command', + :label=>'Undo', :underline=>0, + :helpstr=>'Undo last command', :command=>proc{puts 'UNDO'} } - ], + ], - [:separator, 'sep2'], + [:separator, 'sep2'], [:command, 'cut', { - :label=>'Cut', :underline=>1, - :helpstr=>'Cut selection to clipboard', + :label=>'Cut', :underline=>1, + :helpstr=>'Cut selection to clipboard', :command=>proc{puts 'CUT'} } - ], + ], [:command, 'copy', { - :label=>'Copy', :underline=>1, - :helpstr=>'Copy selection to clipboard', + :label=>'Copy', :underline=>1, + :helpstr=>'Copy selection to clipboard', :command=>proc{puts 'COPY'} } - ], + ], [:command, 'paste', { - :label=>'Paste', :underline=>0, - :helpstr=>'Paste clipboard contents', + :label=>'Paste', :underline=>0, + :helpstr=>'Paste clipboard contents', :command=>proc{puts 'PASTE'} } ] ] } - ], + ], [:menubutton, 'options', { :text=>'Options', :menu=>[ - [:options, {:tearoff=>false, :selectcolor=>'blue'}], + [:options, {:tearoff=>false, :selectcolor=>'blue'}], [:radiobutton, 'byName', { - :variable=>viewmode, :value=>'NAME', - :label=>'by Name', :helpstr=>'View files by name order', + :variable=>viewmode, :value=>'NAME', + :label=>'by Name', :helpstr=>'View files by name order', :command=>proc{puts 'NAME'} } - ], + ], [:radiobutton, 'byDate', { - :variable=>viewmode, :value=>'DATE', - :label=>'by Date', :helpstr=>'View files by date order', + :variable=>viewmode, :value=>'DATE', + :label=>'by Date', :helpstr=>'View files by date order', :command=>proc{puts 'DATE'} } - ], + ], [:cascade, 'prefs', { :label=>'Preferences', :menu=>[ [:command, 'colors', { - :label=>'Colors...', :helpstr=>'Change text colors', + :label=>'Colors...', :helpstr=>'Change text colors', :command=>proc{puts 'COLORS'} } - ], + ], [:command, 'fonts', { - :label=>'Fonts...', :helpstr=>'Change text font', + :label=>'Fonts...', :helpstr=>'Change text font', :command=>proc{puts 'COLORS'} } ] @@ -109,7 +109,7 @@ menu_spec = [ ] ] -#mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar, +#mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar, # :menubuttons=>menu_spec) mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar) mb.configure(:menubuttons=>menu_spec) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb index d6f2292650..477c916e07 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb @@ -9,13 +9,13 @@ mb = Tk::Iwidgets::Menubar.new mb.menubuttons = [ [:menubutton, 'file', { :text=>'File', :menu=>[ - [:command, 'new', {:label=>'New'}], - [:command, 'close', {:label=>'Close'}], - [:separator, 'sep1'], + [:command, 'new', {:label=>'New'}], + [:command, 'close', {:label=>'Close'}], + [:separator, 'sep1'], [:command, 'quit', {:label=>'Quit'}] ] } - ], + ], [:menubutton, 'edit', {:text=>'Edit'}] ] @@ -28,14 +28,14 @@ mb.add(:command, '.edit.paste', :label=>'Paste', :underline=>0) mb.add(:menubutton, '.options', :text=>'Options', :menu=>[ [:radiobutton, 'byName', { :variable=>viewmode, :value=>'NAME', :label=>'by Name'} - ], + ], [:radiobutton, 'byDate', { :variable=>viewmode, :value=>'DATE', :label=>'by Date'} ] ]) mb.add(:cascade, '.options.prefs', :label=>'Preferences', :menu=>[ - [:command, 'colors', {:label=>'Colors...'}], + [:command, 'colors', {:label=>'Colors...'}], [:command, 'fonts', {:label=>'Fonts...'}] ]) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb index 3221dbc30c..87b2d38907 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb @@ -2,9 +2,9 @@ require 'tk' require 'tkextlib/iwidgets' -mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, - :labeltext=>'Messages', :labelpos=>:n, - :height=>120, :width=>550, +mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, + :labeltext=>'Messages', :labelpos=>:n, + :height=>120, :width=>550, :savedir=>'/tmp', :textbackground=>'#d9d9d9') mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb index 2f0e3648a6..5278883568 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb @@ -2,9 +2,9 @@ require 'tk' require 'tkextlib/iwidgets' -mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, - :labeltext=>'Messages', :labelpos=>:n, - :height=>120, :width=>550, +mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, + :labeltext=>'Messages', :labelpos=>:n, + :height=>120, :width=>550, :savedir=>'/tmp', :textbackground=>'#d9d9d9') mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb index 6c6bfbca3f..52799f206c 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb @@ -7,8 +7,8 @@ mainloop = Thread.new{Tk.mainloop} # # Standard question message dialog used for confirmation. # -md = Tk::Iwidgets::Messagedialog.new(:title=>'Message Dialog', - :text=>'Are you sure ? ', +md = Tk::Iwidgets::Messagedialog.new(:title=>'Message Dialog', + :text=>'Are you sure ? ', :bitmap=>'questhead', :modality=>:global) md.buttonconfigure('OK', :text=>'Yes') @@ -32,8 +32,8 @@ md.destroy # bmp = '@' + File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/text.xbm') -cr = Tk::Iwidgets::Messagedialog.new(:title=>'Copyright', - :bitmap=>bmp, :imagepos=>:n, +cr = Tk::Iwidgets::Messagedialog.new(:title=>'Copyright', + :bitmap=>bmp, :imagepos=>:n, :text=>"Copyright 200x XXX Corporation\nAll rights reserved") cr.hide('Cancel') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb index e33b81eb6f..055312ec96 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100) -nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, +nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, :side=>:left, :padx=>10, :pady=>10) # Add two pages to the tabnotebook, diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb index 649de4f024..41e9ce1bfc 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100) -nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, +nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, :side=>:top, :padx=>10, :pady=>0) # Add two pages to the tabnotebook, diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb b/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb index 1fd7a5bc05..2b921ffab9 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -om = Tk::Iwidgets::Optionmenu.new(:labelmargin=>5, :labelpos=>:w, +om = Tk::Iwidgets::Optionmenu.new(:labelmargin=>5, :labelpos=>:w, :labeltext=>"Operating System :") om.insert('end', 'Unix', 'VMS', 'Linux', 'OS/2', 'Windows NT', 'DOS') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb index 6e4458e508..88fc401483 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb @@ -11,7 +11,7 @@ pw.add('bottom', :margin=>10, :minimum=>10) pw.pack(:fill=>:both, :expand=>true) pw.child_site_list.each{|pane| - TkButton.new(pane, :text=>pane.path, :relief=>:raised, + TkButton.new(pane, :text=>pane.path, :relief=>:raised, :borderwidth=>2).pack(:fill=>:both, :expand=>true) } diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb index 6779cb57db..96987d529c 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb @@ -11,7 +11,7 @@ bottom = pw.add(:margin=>10, :minimum=>10) pw.pack(:fill=>:both, :expand=>true) pw.child_site_list.each{|pane| - TkButton.new(pane, :text=>pane.path, :relief=>:raised, + TkButton.new(pane, :text=>pane.path, :relief=>:raised, :borderwidth=>2).pack(:fill=>:both, :expand=>true) } diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb index 2c643e56f7..d92a26ead9 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb @@ -6,7 +6,7 @@ mainloop = Thread.new{Tk.mainloop} TkOption.add('*textBackground', 'white') -pd = Tk::Iwidgets::Promptdialog.new(:modality=>:global, :title=>'Password', +pd = Tk::Iwidgets::Promptdialog.new(:modality=>:global, :title=>'Password', :labeltext=>'Password:', :show=>'*') pd.hide('Apply') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb b/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb index 6e1c3fffe3..e76dda88c6 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb @@ -2,8 +2,8 @@ require 'tk' require 'tkextlib/iwidgets' -Tk::Iwidgets::Pushbutton.new(:text=>'Hello', - :command=>proc{puts 'Hello World'}, +Tk::Iwidgets::Pushbutton.new(:text=>'Hello', + :command=>proc{puts 'Hello World'}, :defaultring=>true).pack(:padx=>10, :pady=>10) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb index 5219847c9c..e5bd90a1cb 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -sf = Tk::Iwidgets::Scrolledframe.new(:width=>150, :height=>180, +sf = Tk::Iwidgets::Scrolledframe.new(:width=>150, :height=>180, :labeltext=>'scrolledframe') cs = sf.child_site diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb index 04334b8da8..2b675f802c 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') -sh = Tk::Iwidgets::Scrolledhtml.new(:fontname=>'helvetica', +sh = Tk::Iwidgets::Scrolledhtml.new(:fontname=>'helvetica', :linkcommand=>proc{|href| sh.import_link(href) }) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb index 0b69751911..bf2c60191f 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb @@ -4,13 +4,13 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') -slb = Tk::Iwidgets::Scrolledlistbox.new(:selectmode=>:single, +slb = Tk::Iwidgets::Scrolledlistbox.new(:selectmode=>:single, :vscrollmode=>:static, :hscrollmode=>:dynamic, - :labeltext=>'List', + :labeltext=>'List', :selectioncommand=>proc{ puts(slb.get_curselection) - }, + }, :dblclickcommand=>proc{ puts('Double Click') puts(slb.get_curselection) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb index dd1a99a829..41498e67f7 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -st = Tk::Iwidgets::Scrolledtext.new(:hscrollmode=>:dynamic, :wrap=>:none, +st = Tk::Iwidgets::Scrolledtext.new(:hscrollmode=>:dynamic, :wrap=>:none, :labeltext=>'Password File') st.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb index a5d623ae80..74684974b1 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb @@ -4,12 +4,12 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') -sb = Tk::Iwidgets::Selectionbox.new.pack(:padx=>10, :pady=>10, +sb = Tk::Iwidgets::Selectionbox.new.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) sb.insert_items('end', *['Hello', 'Out There', 'World']) -TkLabel.new(sb.child_site, +TkLabel.new(sb.child_site, :text=>'Child Site is Here').pack(:fill=>:x, :padx=>10, :pady=>10) sb.insert_items(2, 'Cruel Cruel') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb index f40b419180..d53391f2f3 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' mainloop = Thread.new{Tk.mainloop} -TkButton.new(:text=>'QUIT', +TkButton.new(:text=>'QUIT', :command=>proc{Tk.root.destroy}).pack(:padx=>10, :pady=>10) Tk::Iwidgets::Selectiondialog.new.activate diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb b/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb index c44b5554a6..6d01280141 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb @@ -2,16 +2,16 @@ require 'tk' require 'tkextlib/iwidgets' -sh = Tk::Iwidgets::Shell.new(:modality=>:application, +sh = Tk::Iwidgets::Shell.new(:modality=>:application, :padx=>20, :pady=>20, :title=>'Shell') -TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, +TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, :command=>proc{puts sh.activate}).pack(:padx=>10, :pady=>10) TkLabel.new(sh.child_site, :text=>'SHELL').pack -TkButton.new(sh.child_site, :text=>'YES', +TkButton.new(sh.child_site, :text=>'YES', :command=>proc{sh.deactivate 'press YES'}).pack(:fill=>:x) -TkButton.new(sh.child_site, :text=>'NO', +TkButton.new(sh.child_site, :text=>'NO', :command=>proc{sh.deactivate 'press NO'}).pack(:fill=>:x) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb index 0bcdefb763..e2dde01b18 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') -Tk::Iwidgets::Spinint.new(:labeltext=>'Temperature', :labelpos=>:w, :width=>5, +Tk::Iwidgets::Spinint.new(:labeltext=>'Temperature', :labelpos=>:w, :width=>5, :fixed=>true, :range=>[32, 212]).pack(:pady=>10) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb index 295d38ee96..6a20b0eb87 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb @@ -18,10 +18,10 @@ class Spinner_demo < TkWindow end def initialize(parent=nil) - @spinner = Tk::Iwidgets::Spinner.new(parent, :labeltext=>'Month : ', - :width=>10, :fixed=>10, - :validate=>proc{|c| block_input}, - :decrement=>proc{spin_month -1}, + @spinner = Tk::Iwidgets::Spinner.new(parent, :labeltext=>'Month : ', + :width=>10, :fixed=>10, + :validate=>proc{|c| block_input}, + :decrement=>proc{spin_month -1}, :increment=>proc{spin_month 1}) @path = @spinner @spinner.insert(0, Months[0]) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb index 6f1ecc4fa4..382b34d3ce 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100) -tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, +tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, :side=>:left, :padx=>10, :pady=>10) # Add two pages to the tabnotebook, diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb index 4a5eef5a8f..2689759bde 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100) -tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, +tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, :side=>:top, :padx=>10, :pady=>0) # Add two pages to the tabnotebook, diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb index 355466eb1a..608efd0af1 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb @@ -88,7 +88,7 @@ EOD ########################################## -bmp_dir = File.join(File.dirname(File.expand_path(__FILE__)), +bmp_dir = File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images') ########################################## @@ -102,16 +102,16 @@ tb = Tk::Iwidgets::Toolbar.new(:helpvariable=>status_var) ########################################## -tb.add(:button, :helpstr=>'Copy It', :image=>editcopy22, +tb.add(:button, :helpstr=>'Copy It', :image=>editcopy22, :balloonstr=>'Copy', :command=>proc{puts 'Copy It'}) -tb.add(:button, :helpstr=>'Cut It', :image=>editcut22, +tb.add(:button, :helpstr=>'Cut It', :image=>editcut22, :balloonstr=>'Cut', :command=>proc{puts 'Cut It'}) -tb.add(:button, :helpstr=>'Paste It', :image=>editpaste22, +tb.add(:button, :helpstr=>'Paste It', :image=>editpaste22, :balloonstr=>'Paste', :command=>proc{puts 'Paste It'}) -tb.add(:button, :helpstr=>'Delete It', :image=>editdelete22, +tb.add(:button, :helpstr=>'Delete It', :image=>editdelete22, :balloonstr=>'Delete', :command=>proc{puts 'Delete It'}) #-------------------------------- @@ -120,19 +120,19 @@ tb.add(:frame, :borderwidth=>1, :width=>10, :height=>10) #-------------------------------- -tb.add(:radiobutton, :variable=>radio_var, :value=>'Box', - :bitmap=>"@#{bmp_dir}/box.xbm", - :helpstr=>'Radio Button #1', :balloonstr=>'Radio', +tb.add(:radiobutton, :variable=>radio_var, :value=>'Box', + :bitmap=>"@#{bmp_dir}/box.xbm", + :helpstr=>'Radio Button #1', :balloonstr=>'Radio', :command=>proc{puts 'Radio Button "Box"'}) -tb.add(:radiobutton, :variable=>radio_var, :value=>'Line', - :bitmap=>"@#{bmp_dir}/line.xbm", - :helpstr=>'Radio Button #2', :balloonstr=>'Radio', +tb.add(:radiobutton, :variable=>radio_var, :value=>'Line', + :bitmap=>"@#{bmp_dir}/line.xbm", + :helpstr=>'Radio Button #2', :balloonstr=>'Radio', :command=>proc{puts 'Radio Button "Line"'}) -tb.add(:radiobutton, :variable=>radio_var, :value=>'Oval', - :bitmap=>"@#{bmp_dir}/oval.xbm", - :helpstr=>'Radio Button #3', :balloonstr=>'Radio', +tb.add(:radiobutton, :variable=>radio_var, :value=>'Oval', + :bitmap=>"@#{bmp_dir}/oval.xbm", + :helpstr=>'Radio Button #3', :balloonstr=>'Radio', :command=>proc{puts 'Radio Button "Oval"'}) #-------------------------------- @@ -141,10 +141,10 @@ tb.add(:frame, :borderwidth=>1, :width=>10, :height=>10) #-------------------------------- -tb.add(:checkbutton, :variable=>check_var1, :onvalue=>'yes', :offvalue=>'no', +tb.add(:checkbutton, :variable=>check_var1, :onvalue=>'yes', :offvalue=>'no', :image=>text22, :command=>proc{puts 'Checkbutton 1'}) -tb.add(:checkbutton, :variable=>check_var2, :onvalue=>'yes', :offvalue=>'no', +tb.add(:checkbutton, :variable=>check_var2, :onvalue=>'yes', :offvalue=>'no', :bitmap=>"@#{bmp_dir}/points.xbm", :command=>proc{puts 'Checkbutton 2'}) tb.pack(:side=>:top, :anchor=>:nw) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb b/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb index 808c798aec..2af53ba63b 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb @@ -8,7 +8,7 @@ Thread.new{ trap('INT', 'DEFAULT') } -Tk::Iwidgets::Watch.new(:state=>:disabled, :showampm=>:no, +Tk::Iwidgets::Watch.new(:state=>:disabled, :showampm=>:no, :width=>155, :height=>155){|w| w.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) # TkTimer.new(1000, -1, proc{w.show; Tk.update}).start diff --git a/ext/tk/sample/tkextlib/tcllib/datefield.rb b/ext/tk/sample/tkextlib/tcllib/datefield.rb index cfeca0c6de..3550af7d23 100644 --- a/ext/tk/sample/tkextlib/tcllib/datefield.rb +++ b/ext/tk/sample/tkextlib/tcllib/datefield.rb @@ -20,8 +20,8 @@ my_date1.trace('w'){ df = Tk::Tcllib::Datefield.new(:textvariable=>my_date1) Tk.grid(TkLabel.new(:text=>'Enter a date:', :anchor=>:e), df, :sticky=>:ew) -Tk.grid(TkLabel.new(:text=>'That date ia a:', :anchor=>:e), - TkLabel.new(:textvariable=>my_date2, :relief=>:sunken, :width=>12), +Tk.grid(TkLabel.new(:text=>'That date ia a:', :anchor=>:e), + TkLabel.new(:textvariable=>my_date2, :relief=>:sunken, :width=>12), :sticky=>:ew) df.set_focus diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb index 053b0de085..7f35a3833c 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb @@ -23,7 +23,7 @@ Tk.pack(vc1,vc2,vc3, :fill=>:both, :side=>:top) ############################### -s = Tk::Tcllib::Plotchart::XYPlot.new(c1, [0.0, 100.0, 10.0], +s = Tk::Tcllib::Plotchart::XYPlot.new(c1, [0.0, 100.0, 10.0], [0.0, 100.0, 20.0]) @@ -56,7 +56,7 @@ s.save_plot "aha.ps" s = Tk::Tcllib::Plotchart::Piechart.new(c2) -s.plot([ ["Long names", 10], ["Short names", 30], +s.plot([ ["Long names", 10], ["Short names", 30], ["Average", 40], ["Ultra-short names", 5] ]) # @@ -78,7 +78,7 @@ s.title "Cardioid" ############################### -s = Tk::Tcllib::Plotchart::Barchart.new(hc1, %w(A B C D E), +s = Tk::Tcllib::Plotchart::Barchart.new(hc1, %w(A B C D E), [0.0, 10.0, 2.0], 2) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') @@ -87,7 +87,7 @@ s.title "Arbitrary data" ############################### -s = Tk::Tcllib::Plotchart::Barchart.new(hc2, %w(A B C D E), +s = Tk::Tcllib::Plotchart::Barchart.new(hc2, %w(A B C D E), [0.0, 20.0, 5.0], :stacked) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') @@ -96,7 +96,7 @@ s.title "Stacked diagram" ############################### -s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc1, [0.0, 10.0, 2.0], +s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc1, [0.0, 10.0, 2.0], %w(A B C D E), 2) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') @@ -105,7 +105,7 @@ s.title "Arbitrary data" ############################### -s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc2, [0.0, 20.0, 5.0], +s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc2, [0.0, 20.0, 5.0], %w(A B C D E), :stacked) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') @@ -114,7 +114,7 @@ s.title "Stacked diagram" ############################### -s = Tk::Tcllib::Plotchart::Timechart.new(vc3, "1 january 2004", +s = Tk::Tcllib::Plotchart::Timechart.new(vc3, "1 january 2004", "31 december 2004", 4) s.period("Spring", "1 march 2004", "1 june 2004", 'green') @@ -134,7 +134,7 @@ zc1 = TkCanvas.new(z, :background=>'white', :width=>400, :height=>300) zc2 = TkCanvas.new(z, :background=>'white', :width=>400, :height=>250) Tk.pack(zc1,zc2) -s = Tk::Tcllib::Plotchart::Plot3D.new(zc1, +s = Tk::Tcllib::Plotchart::Plot3D.new(zc1, [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) s.title "3D Plot" @@ -145,12 +145,12 @@ s.plot_function{|x, y| 3.0 * (1.0-(x1*x1+y1*y1))*(1.0-(x1*x1+y1*y1)) } -s = Tk::Tcllib::Plotchart::Plot3D.new(zc2, +s = Tk::Tcllib::Plotchart::Plot3D.new(zc2, [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) s.title "3D Plot - data " s.colour("green", "black") -s.plot_data([ [1.0, 2.0, 1.0, 0.0], - [1.1, 3.0, 1.1, -0.5], +s.plot_data([ [1.0, 2.0, 1.0, 0.0], + [1.1, 3.0, 1.1, -0.5], [3.0, 1.0, 4.0, 5.0] ]) ############################### diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb index 33a6f29940..cb657a40d8 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb @@ -12,7 +12,7 @@ Tk.pack(c1,c2, :fill=>:both, :side=>:top) ############################### # Set up a strip chart ############################### -slipchart = Tk::Tcllib::Plotchart::Stripchart.new(c1, [0.0, 100.0, 10.0], +slipchart = Tk::Tcllib::Plotchart::Stripchart.new(c1, [0.0, 100.0, 10.0], [0.0, 100.0, 20.0]) TkTimer.new(500, -1, proc{|obj| # obj --> TkTimer object @@ -34,7 +34,7 @@ slipchart.title "Aha!" ############################### # Set up an isometric plot ############################### -s = Tk::Tcllib::Plotchart::IsometricPlot.new(c2, [0.0, 100.0], [0.0, 200.0], +s = Tk::Tcllib::Plotchart::IsometricPlot.new(c2, [0.0, 100.0], [0.0, 200.0], :noaxes) s.set_zoom_pan @@ -50,8 +50,8 @@ s.plot('circle', [70.0, 70.0, 42.0]) h = TkToplevel.new(:title=>'h') c = TkCanvas.new(h, :bg=>'white', :width=>400, :height=>200).pack(:fill=>:both) -s = Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0]) +s = Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], + [0.0, 100.0, 20.0]) s.dataconfig('series1', :colour=>'red', :type=>:symbol) s.dataconfig('series2', :colour=>'green', :type=>:both) diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb index 2b5c7642bb..66b8fe706a 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb @@ -7,9 +7,9 @@ require 'tkextlib/tcllib/plotchart' # Set up a strip chart ############################### -Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0], - [0.0, 100.0, 20.0], - :background=>'white', +Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0], + [0.0, 100.0, 20.0], + :background=>'white', :width=>400, :height=>200){|chart| title "Aha!" pack(:fill=>:both, :side=>:top) @@ -38,8 +38,8 @@ Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0], ############################### # Set up an isometric plot ############################### -Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes, - :background=>'white', +Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes, + :background=>'white', :width=>400, :height=>200){|chart| pack(:fill=>:both, :side=>:top) set_zoom_pan @@ -54,17 +54,17 @@ Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes, # Check the symbols ############################### TkToplevel.new(:title=>'h'){|h| - Tk::Tcllib::Plotchart::XYPlot.new(h, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0], - :bg=>'white', + Tk::Tcllib::Plotchart::XYPlot.new(h, [0.0, 100.0, 10.0], + [0.0, 100.0, 20.0], + :bg=>'white', :width=>400, :height=>200){|chart| pack(:fill=>:both) yconfig(:format=>"%12.2e") - series1 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'red', + series1 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'red', :type=>:symbol) - series2 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'green', + series2 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'green', :type=>:both) x = 5.0 diff --git a/ext/tk/sample/tkextlib/tcllib/xyplot.rb b/ext/tk/sample/tkextlib/tcllib/xyplot.rb index 8f8c3eb880..2aa101efcb 100644 --- a/ext/tk/sample/tkextlib/tcllib/xyplot.rb +++ b/ext/tk/sample/tkextlib/tcllib/xyplot.rb @@ -5,7 +5,7 @@ require 'tkextlib/tcllib/plotchart' TkCanvas.new(:background=>'white', :width=>400, :height=>200){|c| pack(:fill=>:both) - Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], + Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], [0.0, 100.0, 20.0]){ [ [0.0, 32.0], [10.0, 50.0], [25.0, 60.0], [78.0, 11.0] ].each{|x, y| plot('series1', x, y) diff --git a/ext/tk/sample/tkextlib/tile/demo.rb b/ext/tk/sample/tkextlib/tile/demo.rb index 633a072460..260ca00022 100644 --- a/ext/tk/sample/tkextlib/tile/demo.rb +++ b/ext/tk/sample/tkextlib/tile/demo.rb @@ -34,7 +34,7 @@ Tk.load_tclscript(File.join(demodir, 'repeater.tcl')) # This forces an update of the available packages list. It's required # for package names to find the themes in demos/themes/*.tcl ## Tk.tk_call(TkPackage.unknown_proc, 'Tcl', TkPackage.provide('Tcl')) -## --> This doesn't work. +## --> This doesn't work. ## Because, unknown_proc may be "command + some arguments". Tk.ip_eval("#{TkPackage.unknown_proc} Tcl #{TkPackage.provide('Tcl')}") @@ -45,18 +45,18 @@ TkRoot.new{ # The descriptive names of the builtin themes. $THEMELIST = [ - ['default', 'Default'], - ['classic', 'Classic'], - ['alt', 'Revitalized'], - ['winnative', 'Windows native'], - ['xpnative', 'XP Native'], - ['aqua', 'Aqua'], + ['default', 'Default'], + ['classic', 'Classic'], + ['alt', 'Revitalized'], + ['winnative', 'Windows native'], + ['xpnative', 'XP Native'], + ['aqua', 'Aqua'], ] -$V = TkVariable.new_hash(:THEME => 'default', - :COMPOUND => 'top', - :CONSOLE => false, - :MENURADIO1 => 'One', +$V = TkVariable.new_hash(:THEME => 'default', + :COMPOUND => 'top', + :CONSOLE => false, + :MENURADIO1 => 'One', :MENUCHECK1 => true, :PBMODE => 'determinate', :SELECTED => true, @@ -84,8 +84,8 @@ end def makeThemeControl(parent) c = Tk::Tile::Labelframe.new(parent, :text=>'Theme') $THEMELIST.each{|theme, name| - b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, - :variable=>$V.ref(:THEME), + b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, + :variable=>$V.ref(:THEME), :command=>proc{setTheme(theme)}) b.grid(:sticky=>:ew) unless (TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/}) @@ -93,8 +93,8 @@ def makeThemeControl(parent) end } $RUBY_THEMELIST.each{|theme, name, available| - b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, - :variable=>$V.ref(:THEME), + b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, + :variable=>$V.ref(:THEME), :command=>proc{setTheme(theme)}) b.grid(:sticky=>:ew) b.ttk_state(:disabled) unless available @@ -105,14 +105,14 @@ end def makeThemeMenu(parent) m = TkMenu.new(parent) $THEMELIST.each{|theme, name| - m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), + m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), :value=>theme, :command=>proc{setTheme(theme)}) unless (TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/}) m.entryconfigure(:end, :state=>:disabled) end } $RUBY_THEMELIST.each{|theme, name, available| - m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), + m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), :value=>theme, :command=>proc{setTheme(theme)}) m.entryconfigure(:end, :state=>:disabled) unless available } @@ -174,7 +174,7 @@ def sbstub(sb, cmd, num, units = 'units') current = sb.get sb.set(current[0] + delta * num, current[1] + delta * num) end -end +end # ... for debugging: TkBindTag::ALL.bind('ButtonPress-3', proc{|w| $W = w}, '%W') @@ -209,21 +209,21 @@ def makeToolbars i = 0 $BUTTONS.each{|icon| i += 1 - Tk::Tile::Button.new(tb, :text=>icon, :image=>$ICON[icon], - :compound=>$V[:COMPOUND], - :style=>:Toolbutton).grid(:row=>0, :column=>i, + Tk::Tile::Button.new(tb, :text=>icon, :image=>$ICON[icon], + :compound=>$V[:COMPOUND], + :style=>:Toolbutton).grid(:row=>0, :column=>i, :sticky=>:news) } $CHECKBOXES.each{|icon| i += 1 - Tk::Tile::Checkbutton.new(tb, :text=>icon, :image=>$ICON[icon], - :variable=>$V.ref(icon), - :compound=>$V[:COMPOUND], - :style=>:Toolbutton).grid(:row=>0, :column=>i, + Tk::Tile::Checkbutton.new(tb, :text=>icon, :image=>$ICON[icon], + :variable=>$V.ref(icon), + :compound=>$V[:COMPOUND], + :style=>:Toolbutton).grid(:row=>0, :column=>i, :sticky=>:news) } - mb = Tk::Tile::Menubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], + mb = Tk::Tile::Menubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], :compound=>$V[:COMPOUND]) mb.configure(:menu=>makeCompoundMenu(mb)) i += 1 @@ -240,21 +240,21 @@ def makeToolbars i = 0 $BUTTONS.each{|icon| i += 1 - TkButton.new(tb, :text=>icon, :image=>$ICON[icon], - :compound=>$V[:COMPOUND], :relief=>:flat, - :overrelief=>:raised).grid(:row=>0, :column=>i, + TkButton.new(tb, :text=>icon, :image=>$ICON[icon], + :compound=>$V[:COMPOUND], :relief=>:flat, + :overrelief=>:raised).grid(:row=>0, :column=>i, :sticky=>:news) } $CHECKBOXES.each{|icon| i += 1 - TkCheckbutton.new(tb, :text=>icon, :image=>$ICON[icon], - :variable=>$V.ref(icon), :compound=>$V[:COMPOUND], - :indicatoron=>false, :selectcolor=>'', :relief=>:flat, - :overrelief=>:raised).grid(:row=>0, :column=>i, + TkCheckbutton.new(tb, :text=>icon, :image=>$ICON[icon], + :variable=>$V.ref(icon), :compound=>$V[:COMPOUND], + :indicatoron=>false, :selectcolor=>'', :relief=>:flat, + :overrelief=>:raised).grid(:row=>0, :column=>i, :sticky=>:news) } - mb = TkMenubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], + mb = TkMenubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], :compound=>$V[:COMPOUND]) mb.configure(:menu=>makeCompoundMenu(mb)) i += 1 @@ -270,8 +270,8 @@ end def makeCompoundMenu(mb) menu = TkMenu.new(mb) %w(text image none top bottom left right center).each{|str| - menu.add(:radiobutton, :label=>Tk.tk_call('string', 'totitle', str), - :variable=>$V.ref(:COMPOUND), :value=>str, + menu.add(:radiobutton, :label=>Tk.tk_call('string', 'totitle', str), + :variable=>$V.ref(:COMPOUND), :value=>str, :command=>proc{ changeToolbars() }) } menu @@ -289,7 +289,7 @@ makeThemeControl(control).grid(:sticky=>:news, :padx=>6, :ipadx=>6) control.grid_rowconfigure(99, :weight=>1) def changeToolbars - foreachWidget($TOOLBARS, + foreachWidget($TOOLBARS, proc{|w| begin w.compound($V[:COMPOUND]) @@ -350,7 +350,7 @@ nb, client, scales, combo, tree, others = makeNotebook() # def fillMenu(menu) %w(above below left right flush).each{|dir| - menu.add(:command, :label=>Tk.tk_call('string', 'totitle', dir), + menu.add(:command, :label=>Tk.tk_call('string', 'totitle', dir), :command=>proc{ menu.winfo_parent.direction(dir) }) } menu.add(:cascade, :label=>'Submenu', :menu=>(submenu = TkMenu.new(menu))) @@ -366,14 +366,14 @@ l = Tk::Tile::Labelframe.new(client, :text=>'Themed', :padding=>6) r = TkLabelframe.new(client, :text=>'Standard', :padx=>6, :pady=>6) ## Styled frame -cb = Tk::Tile::Checkbutton.new(l, :text=>'Checkbutton', +cb = Tk::Tile::Checkbutton.new(l, :text=>'Checkbutton', :variable=>$V.ref(:SELECTED), :underline=>2) -rb1 = Tk::Tile::Radiobutton.new(l, :text=>'One', :variable=>$V.ref(:CHOICE), +rb1 = Tk::Tile::Radiobutton.new(l, :text=>'One', :variable=>$V.ref(:CHOICE), :value=>1, :underline=>0) -rb2 = Tk::Tile::Radiobutton.new(l, :text=>'Two', :variable=>$V.ref(:CHOICE), +rb2 = Tk::Tile::Radiobutton.new(l, :text=>'Two', :variable=>$V.ref(:CHOICE), :value=>2) -rb3 = Tk::Tile::Radiobutton.new(l, :text=>'Three', - :variable=>$V.ref(:CHOICE), +rb3 = Tk::Tile::Radiobutton.new(l, :text=>'Three', + :variable=>$V.ref(:CHOICE), :value=>3, :underline=>0) btn = Tk::Tile::Button.new(l, :text=>'Button', :underline=>0) @@ -386,9 +386,9 @@ $entryText = TkVariable.new('Entry widget') e = Tk::Tile::Entry.new(l, :textvariable=>$entryText) e.selection_range(6, :end) -ltext_f, ltext = scrolledWidget(l, TkText, true, +ltext_f, ltext = scrolledWidget(l, TkText, true, :width=>12, :height=>5, :wrap=>:none) -# NOTE TO MAINTAINERS: +# NOTE TO MAINTAINERS: # The checkbuttons are -sticky ew / -expand x on purpose: # it demonstrates one of the differences between TCheckbuttons # and standard checkbuttons. @@ -407,11 +407,11 @@ TkGrid.rowconfigure(l, 7, :weight=>1) # text widget (grid is a PITA) ## Orig frame cb = TkCheckbutton.new(r, :text=>'Checkbutton', :variable=>$V.ref(:SELECTED)) -rb1 = TkRadiobutton.new(r, :text=>'One', +rb1 = TkRadiobutton.new(r, :text=>'One', :variable=>$V.ref(:CHOICE), :value=>1) -rb2 = TkRadiobutton.new(r, :text=>'Two', :variable=>$V.ref(:CHOICE), +rb2 = TkRadiobutton.new(r, :text=>'Two', :variable=>$V.ref(:CHOICE), :value=>2, :underline=>1) -rb3 = TkRadiobutton.new(r, :text=>'Three', +rb3 = TkRadiobutton.new(r, :text=>'Three', :variable=>$V.ref(:CHOICE), :value=>3) btn = TkButton.new(r, :text=>'Button') @@ -420,14 +420,14 @@ m = TkMenu.new(mb) mb.menu(m) $V[:rmbIndicatoron] = mb.indicatoron m.add(:checkbutton, :label=>'Indicator?', #' - :variable=>$V.ref(:rmbIndicatoron), + :variable=>$V.ref(:rmbIndicatoron), :command=>proc{mb.indicatoron($V[:rmbIndicatoron])}) m.add(:separator) fillMenu(m) e = TkEntry.new(r, :textvariable=>$entryText) -rtext_f, rtext = scrolledWidget(r, TkText, false, +rtext_f, rtext = scrolledWidget(r, TkText, false, :width=>12, :height=>5, :wrap=>:none) Tk.grid(cb, :sticky=>:ew) @@ -450,9 +450,9 @@ TkGrid.columnconfigure(client, [0, 1], :weight=>1) # Add some text to the text boxes: # msgs = [ -"The cat crept into the crypt, crapped and crept out again", -"Peter Piper picked a peck of pickled peppers", -"How much wood would a woodchuck chuck if a woodchuck could chuck wood", +"The cat crept into the crypt, crapped and crept out again", +"Peter Piper picked a peck of pickled peppers", +"How much wood would a woodchuck chuck if a woodchuck could chuck wood", "He thrusts his fists against the posts and still insists he sees the ghosts", "Who put the bomb in the bom-b-bom-b-bom,", "Is this your sister's sixth zither, sir?", @@ -493,8 +493,8 @@ if version?('0.6') scale.command {|value| progress.value(value)} vscale.command {|value| progress.inverted(vprogress, value) } else - # This would also work, but the Tk scale widgets - # in the right hand pane cause some interference when + # This would also work, but the Tk scale widgets + # in the right hand pane cause some interference when # in autoincrement/indeterminate mode. # progress.variable $V.ref(:SCALE) @@ -609,10 +609,10 @@ scales.grid_rowconfigure(0, :weight=>1) # Command box: # cmd = Tk::Tile::Frame.new($BASE) -b_close = Tk::Tile::Button.new(cmd, :text=>'Close', - :underline=>0, :default=>:normal, +b_close = Tk::Tile::Button.new(cmd, :text=>'Close', + :underline=>0, :default=>:normal, :command=>proc{Tk.root.destroy}) -b_help = Tk::Tile::Button.new(cmd, :text=>'Help', :underline=>0, +b_help = Tk::Tile::Button.new(cmd, :text=>'Help', :underline=>0, :default=>:normal, :command=>proc{showHelp()}) Tk.grid('x', b_close, b_help, :pady=>[6, 4], :padx=>4) TkGrid.columnconfigure(cmd, 0, :weight=>1) @@ -639,20 +639,20 @@ menu = TkMenu.new($BASE) $ROOT.menu(menu) m_file = TkMenu.new(menu, :tearoff=>0) menu.add(:cascade, :label=>'File', :underline=>0, :menu=>m_file) -m_file.add(:command, :label=>'Open', :underline=>0, +m_file.add(:command, :label=>'Open', :underline=>0, :compound=>:left, :image=>$ICON['open']) -m_file.add(:command, :label=>'Save', :underline=>0, +m_file.add(:command, :label=>'Save', :underline=>0, :compound=>:left, :image=>$ICON['save']) m_file.add(:separator) m_f_test = TkMenu.new(menu, :tearoff=>0) m_file.add(:cascade, :label=>'Test submenu', :underline=>0, :menu=>m_f_test) -m_file.add(:checkbutton, :label=>'Text check', :underline=>5, +m_file.add(:checkbutton, :label=>'Text check', :underline=>5, :variable=>$V.ref(:MENUCHECK1)) m_file.insert(:end, :separator) if Tk.windowingsystem != 'x11' TkConsole.create - m_file.insert(:end, :checkbutton, :label=>'Console', :underline=>5, + m_file.insert(:end, :checkbutton, :label=>'Console', :underline=>5, :variable=>$V.ref(:CONSOLE), :command=>proc{toggle_console()}) def toggle_console if TkComm.bool($V[:CONSOLE]) @@ -663,7 +663,7 @@ if Tk.windowingsystem != 'x11' end end -m_file.add(:command, :label=>'Exit', :underline=>1, +m_file.add(:command, :label=>'Exit', :underline=>1, :command=>proc{Tk.event_generate(b_close, '<Invoke>')}) %w(One Two Three Four).each{|lbl| @@ -672,7 +672,7 @@ m_file.add(:command, :label=>'Exit', :underline=>1, # Add Theme menu. # -menu.add(:cascade, :label=>'Theme', :underline=>3, +menu.add(:cascade, :label=>'Theme', :underline=>3, :menu=>makeThemeMenu(menu)) setTheme($V[:THEME]) @@ -710,7 +710,7 @@ if version?('0.5') tree.grid_rowconfigure(0, :weight=>1) tree.grid_propagate(0) - # Add initial tree node: + # Add initial tree node: # Later nodes will be added in <<TreeviewOpen>> binding. treeview.insert('', 0, :id=>'.', :text=>'Main Window', :open=>false, :values=>[TkWinfo.classname('.')]) @@ -758,20 +758,20 @@ showDescription.bind('Enter', proc{|w| msg.text($Desc[w.path])}, '%W') showDescription.bind('Leave', proc{|w| msg.text('')}, '%W') [ - [ :trackStates, "Widget states...", - "Display/modify widget state bits" ], + [ :trackStates, "Widget states...", + "Display/modify widget state bits" ], - [ :scrollbarResizeDemo, "Scrollbar resize behavior...", - "Shows how Tile and standard scrollbars differ when they're sized too large" ], + [ :scrollbarResizeDemo, "Scrollbar resize behavior...", + "Shows how Tile and standard scrollbars differ when they're sized too large" ], - [ :trackFocus, "Track keyboard focus..." , + [ :trackFocus, "Track keyboard focus..." , "Display the name of the widget that currently has focus" ], [ :repeatDemo, "Repeating buttons...", "Demonstrates custom classes (see demos/repeater.tcl)" ] ].each{|demo_cmd, label, description| - b = Tk::Tile::Button.new(others, :text=>label, + b = Tk::Tile::Button.new(others, :text=>label, :command=>proc{ self.__send__(demo_cmd) }) $Desc[b.path] = description b.bindtags <<= showDescription @@ -825,16 +825,16 @@ def trackFocus $focus = TkToplevel.new(:title=>'Keyboard focus') i = 0 [ - ["Focus widget:", :Widget], - ["Class:", :WidgetClass], - ["Next:", :WidgetNext], - ["Grab:", :Grab], + ["Focus widget:", :Widget], + ["Class:", :WidgetClass], + ["Next:", :WidgetNext], + ["Grab:", :Grab], ["Status:", :GrabStatus] ].each{|label, var_index| - Tk.grid(Tk::Tile::Label.new($focus, :text=>label, :anchor=>:e), - Tk::Tile::Label.new($focus, - :textvariable=>$FocusInf.ref(var_index), - :width=>40, :anchor=>:w, :relief=>:groove), + Tk.grid(Tk::Tile::Label.new($focus, :text=>label, :anchor=>:e), + Tk::Tile::Label.new($focus, + :textvariable=>$FocusInf.ref(var_index), + :width=>40, :anchor=>:w, :relief=>:groove), :sticky=>:ew) i += 1 } @@ -857,7 +857,7 @@ def focusMonitor $FocusInf[:Grab] = grab_wins = Tk.current_grabs unless grab_wins.empty? $FocusInf[:GrabStatus] = grab_wins[0].grab_status - else + else $FocusInf[:GrabStatus] = '' end @@ -869,13 +869,13 @@ end # $Widget = TkVariable.new -TkBindTag::ALL.bind('Control-Shift-ButtonPress-1', +TkBindTag::ALL.bind('Control-Shift-ButtonPress-1', proc{|w| $Widget.value = w updateStates() Tk.callback_break }, '%W') -$states_list = %w(active disabled focus pressed selected +$states_list = %w(active disabled focus pressed selected background indeterminate invalid default) $states_btns = {} $states = nil @@ -893,17 +893,17 @@ def trackStates l_inf = Tk::Tile::Label.new($states, :text=>"Press Control-Shift-Button-1 on any widget") - l_lw = Tk::Tile::Label.new($states, :text=>'Widget:', + l_lw = Tk::Tile::Label.new($states, :text=>'Widget:', :anchor=>:e, :relief=>:groove) - l_w = Tk::Tile::Label.new($states, :textvariable=>$Widget, + l_w = Tk::Tile::Label.new($states, :textvariable=>$Widget, :anchor=>:w, :relief=>:groove) Tk.grid(l_inf, '-', :sticky=>:ew, :padx=>6, :pady=>6) Tk.grid(l_lw, l_w, :sticky=>:ew) $states_list.each{|st| - cb = Tk::Tile::Checkbutton.new($states, :text=>st, - :variable=>$State.ref(st), + cb = Tk::Tile::Checkbutton.new($states, :text=>st, + :variable=>$State.ref(st), :command=>proc{ changeState(st) }) $states_btns[st] = cb Tk.grid('x', cb, :sticky=>:nsew) @@ -914,7 +914,7 @@ def trackStates f_cmd = Tk::Tile::Frame.new($states) Tk.grid('x', f_cmd, :sticky=>:nse) - b_close = Tk::Tile::Button.new(f_cmd, :text=>'Close', + b_close = Tk::Tile::Button.new(f_cmd, :text=>'Close', :command=>proc{ $states.destroy }) Tk.grid('x', b_close, :padx=>4, :pady=>[6,4]) f_cmd.grid_columnconfigure(0, :weight=>1) diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc.rb b/ext/tk/sample/tkextlib/tile/themes/kroc.rb index 27006d847f..72a7c6901d 100644 --- a/ext/tk/sample/tkextlib/tile/themes/kroc.rb +++ b/ext/tk/sample/tkextlib/tile/themes/kroc.rb @@ -1,5 +1,5 @@ # -# kroc.rb +# kroc.rb # # based on: # >> kroc.tcl - Copyright (C) 2004 David Zolli <kroc@kroc.tk> @@ -15,30 +15,30 @@ else end def kroc_rb_settings - # Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F', + # Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or - # Tk::Tile::Style.default(Tk.root, :background=>'#FCB64F', + # Tk::Tile::Style.default(Tk.root, :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or - # Tk::Tile::Style.default('.', :background=>'#FCB64F', + # Tk::Tile::Style.default('.', :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or - # Tk::Tile::Style.default(nil, :background=>'#FCB64F', + # Tk::Tile::Style.default(nil, :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or - Tk::Tile::Style.default(:background=>'#FCB64F', :troughcolor=>'#F8C278', + Tk::Tile::Style.default(:background=>'#FCB64F', :troughcolor=>'#F8C278', :borderwidth=>1) - # Tk::Tile::Style.default(TkRoot, :font=>Tk::Tile::Font::Default, + # Tk::Tile::Style.default(TkRoot, :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or - # Tk::Tile::Style.default(Tk.root, :font=>Tk::Tile::Font::Default, + # Tk::Tile::Style.default(Tk.root, :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or - # Tk::Tile::Style.default('.', :font=>Tk::Tile::Font::Default, + # Tk::Tile::Style.default('.', :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or - # Tk::Tile::Style.default(nil, :font=>Tk::Tile::Font::Default, + # Tk::Tile::Style.default(nil, :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or Tk::Tile::Style.default(:font=>Tk::Tile::Font::Default, :borderwidth=>1) @@ -57,37 +57,37 @@ def kroc_rb_settings # Tk::Tile::Style.default('TButton', :padding=>[10,4]) Tk::Tile::Style.default(Tk::Tile::TButton, :padding=>[10,4]) - # Tk::Tile::Style.default('TNotebook.Tab', - Tk::Tile::Style.default($TNotebook_Tab, + # Tk::Tile::Style.default('TNotebook.Tab', + Tk::Tile::Style.default($TNotebook_Tab, :padding=>[10, 3], :font=>Tk::Tile::Font::Default) - # Tk::Tile::Style.map('TNotebook.Tab', - Tk::Tile::Style.map($TNotebook_Tab, - :background=>[:selected, '#FCB64F', '', '#FFE6BA'], - :foreground=>['', 'black'], + # Tk::Tile::Style.map('TNotebook.Tab', + Tk::Tile::Style.map($TNotebook_Tab, + :background=>[:selected, '#FCB64F', '', '#FFE6BA'], + :foreground=>['', 'black'], :padding=>[:selected, [10, 6, 10, 3]]) - # Tk::Tile::Style.map('TScrollbar', - Tk::Tile::Style.map(Tk::Tile::TScrollbar, - :background=>[:pressed, '#694418'], - :arrowcolor=>[:pressed, '#FEF7CB'], + # Tk::Tile::Style.map('TScrollbar', + Tk::Tile::Style.map(Tk::Tile::TScrollbar, + :background=>[:pressed, '#694418'], + :arrowcolor=>[:pressed, '#FEF7CB'], :relief=>[:pressed, :sunken]) - # Tk::Tile::Style.layout('Vertical.TScrollbar', - Tk::Tile::Style.layout(Tk::Tile.style('Vertical', Tk::Tile::TScrollbar), + # Tk::Tile::Style.layout('Vertical.TScrollbar', + Tk::Tile::Style.layout(Tk::Tile.style('Vertical', Tk::Tile::TScrollbar), ['Scrollbar.trough', {:children=>[ - 'Scrollbar.uparrow', {:side=>:top}, - 'Scrollbar.downarrow', {:side=>:bottom}, - 'Scrollbar.uparrow', {:side=>:bottom}, + 'Scrollbar.uparrow', {:side=>:top}, + 'Scrollbar.downarrow', {:side=>:bottom}, + 'Scrollbar.uparrow', {:side=>:bottom}, 'Scrollbar.thumb', {:side=>:top, :expand=>true} ]} ]) - # Tk::Tile::Style.layout('Horizontal.TScrollbar', - Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', Tk::Tile::TScrollbar), + # Tk::Tile::Style.layout('Horizontal.TScrollbar', + Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', Tk::Tile::TScrollbar), ['Scrollbar.trough', {:children=>[ - 'Scrollbar.leftarrow', {:side=>:left}, - 'Scrollbar.rightarrow', {:side=>:right}, - 'Scrollbar.leftarrow', {:side=>:right}, + 'Scrollbar.leftarrow', {:side=>:left}, + 'Scrollbar.rightarrow', {:side=>:right}, + 'Scrollbar.leftarrow', {:side=>:right}, 'Scrollbar.thumb', {:side=>:left, :expand=>true} ]} ]) @@ -96,15 +96,15 @@ def kroc_rb_settings # Elements: # if Tk::Tile::TILE_SPEC_VERSION_ID >= 8 - Tk::Tile::Style.element_create('Button.button', - :image, + Tk::Tile::Style.element_create('Button.button', + :image, [ $images['button-n'], - :pressed, $images['button-p'], - :active, $images['button-h'], + :pressed, $images['button-p'], + :active, $images['button-h'], ], :border=>3, :sticky=>:ew) - Tk::Tile::Style.element_create('Checkbutton.indicator', - :image, + Tk::Tile::Style.element_create('Checkbutton.indicator', + :image, [ $images['check-nu'], [:pressed, :selected],$images['check-nc'], :pressed, $images['check-nu'], @@ -113,8 +113,8 @@ def kroc_rb_settings :selected, $images['check-nc'], ], :sticky=>:w) - Tk::Tile::Style.element_create('Radiobutton.indicator', - :image, + Tk::Tile::Style.element_create('Radiobutton.indicator', + :image, [ $images['radio-nu'], [:pressed,:selected],$images['radio-nc'], :pressed, $images['radio-nu'], @@ -124,14 +124,14 @@ def kroc_rb_settings ], :sticky=>:w) elsif TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0 - Tk::Tile::Style.element_create('Button.button', + Tk::Tile::Style.element_create('Button.button', :image, $images['button-n'], :map=>[ - :pressed, $images['button-p'], - :active, $images['button-h'], + :pressed, $images['button-p'], + :active, $images['button-h'], ], :border=>3, :sticky=>:ew) - Tk::Tile::Style.element_create('Checkbutton.indicator', + Tk::Tile::Style.element_create('Checkbutton.indicator', :image, $images['check-nu'], :map=>[ [:pressed, :selected],$images['check-nc'], @@ -141,7 +141,7 @@ def kroc_rb_settings :selected, $images['check-nc'], ], :sticky=>:w) - Tk::Tile::Style.element_create('Radiobutton.indicator', + Tk::Tile::Style.element_create('Radiobutton.indicator', :image, $images['radio-nu'], :map=>[ [:pressed, :selected],$images['radio-nc'], @@ -152,14 +152,14 @@ def kroc_rb_settings ], :sticky=>:w) else # tile 0.4 or earlier - Tk::Tile::Style.element_create('Button.button', :pixmap, + Tk::Tile::Style.element_create('Button.button', :pixmap, :images=>[ - :pressed, $images['button-p'], - :active, $images['button-h'], + :pressed, $images['button-p'], + :active, $images['button-h'], '', $images['button-n'] ], :border=>3, :tiling=>:tile) - Tk::Tile::Style.element_create('Checkbutton.indicator', :pixmap, + Tk::Tile::Style.element_create('Checkbutton.indicator', :pixmap, :images=>[ [:pressed, :selected],$images['check-nc'], :pressed, $images['check-nu'], @@ -169,7 +169,7 @@ def kroc_rb_settings '', $images['check-nu'], ], :tiling=>:fixed) - Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap, + Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap, :images=>[ [:pressed, :selected],$images['radio-nc'], :pressed, $images['radio-nu'], @@ -184,7 +184,7 @@ def kroc_rb_settings # # Settings: # - # Tk::Tile::Style.layout(Tk::Tile::TButton, + # Tk::Tile::Style.layout(Tk::Tile::TButton, Tk::Tile::Style.layout('TButton', [ 'Button.button', {:children=>[ 'Button.focus', {:children=>[ @@ -195,12 +195,12 @@ def kroc_rb_settings ]} ]) - # Tk::Tile::Style.layout(Tk::Tile::TCheckbutton, + # Tk::Tile::Style.layout(Tk::Tile::TCheckbutton, Tk::Tile::Style.layout('TCheckbutton', [ 'Checkbutton.background', # this is not needed in tile 0.5 or later 'Checkbutton.border', {:children=>[ 'Checkbutton.padding', {:children=>[ - 'Checkbutton.indicator', {:side=>:left}, + 'Checkbutton.indicator', {:side=>:left}, 'Checkbutton.focus', {:side=>:left, :children=>[ 'Checkbutton.label' ]} @@ -208,12 +208,12 @@ def kroc_rb_settings ]} ]) - # Tk::Tile::Style.layout(Tk::Tile::TRadiobutton, + # Tk::Tile::Style.layout(Tk::Tile::TRadiobutton, Tk::Tile::Style.layout('TRadiobutton', [ 'Radiobutton.background', # this is not needed in tile 0.5 or later 'Radiobutton.border', {:children=>[ 'Radiobutton.padding', {:children=>[ - 'Radiobutton.indicator', {:side=>:left}, + 'Radiobutton.indicator', {:side=>:left}, 'Radiobutton.focus', {:expand=>true, :sticky=>:w, :children=>[ 'Radiobutton.label', {:side=>:right, :expand=>true} ]} @@ -222,5 +222,5 @@ def kroc_rb_settings ]) end -Tk::Tile::Style.theme_create('kroc-rb', :parent=>'alt', +Tk::Tile::Style.theme_create('kroc-rb', :parent=>'alt', :settings=>proc{ kroc_rb_settings() }) diff --git a/ext/tk/sample/tkextlib/tkHTML/hv.rb b/ext/tk/sample/tkextlib/tkHTML/hv.rb index a4d78ea5b1..920eb15f5a 100644 --- a/ext/tk/sample/tkextlib/tkHTML/hv.rb +++ b/ext/tk/sample/tkextlib/tkHTML/hv.rb @@ -5,7 +5,7 @@ # # This application is used for testing the HTML widget. It can # also server as an example of how to use the HTML widget. -# +# require 'tk' require 'tkextlib/tkHTML' @@ -51,11 +51,11 @@ show_img = TkVariable.new(1) # html[:fontcommand] = pick_font pick_font = proc{|size, attrs| puts "FontCmd: #{size} #{attrs}" - [ ((attrs =~ /fixed/)? 'courier': 'charter'), - (12 * (1.2**(size.to_f - 4.0))).to_i, - ((attrs =~ /italic/)? 'italic': 'roman'), - ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ') -} + [ ((attrs =~ /fixed/)? 'courier': 'charter'), + (12 * (1.2**(size.to_f - 4.0))).to_i, + ((attrs =~ /italic/)? 'italic': 'roman'), + ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ') +} # # This routine is called for each form element @@ -126,7 +126,7 @@ script_cmd = proc{|*args| # This routine is called for every <APPLET> markup # -applet_cmd = proc{|w, arglist| +applet_cmd = proc{|w, arglist| # puts "AppletCmd: w=#{w} arglist=#{arglist}" TkLabel.new(w, :text=>"The Applet #{w}", :bd=>2, :relief=>raised) } @@ -134,12 +134,12 @@ applet_cmd = proc{|w, arglist| # # Construct the main HTML viewer # -html = Tk::HTML_Widget.new(:padx=>5, :pady=>9, - :formcommand=>form_cmd, - :imagecommand=>image_cmd, - :scriptcommand=>script_cmd, - :appletcommand=>applet_cmd, - :underlinehyperlinks=>0, +html = Tk::HTML_Widget.new(:padx=>5, :pady=>9, + :formcommand=>form_cmd, + :imagecommand=>image_cmd, + :scriptcommand=>script_cmd, + :appletcommand=>applet_cmd, + :underlinehyperlinks=>0, :bg=>'white', :tablerelief=>:raised) vscr = html.yscrollbar(TkScrollbar.new) hscr = html.xscrollbar(TkScrollbar.new) @@ -166,7 +166,7 @@ read_file = proc{|name| rescue ret = nil fp = nil - Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'", + Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'", :type=>:ok) ensure fp.close if fp @@ -221,7 +221,7 @@ html.clipping_window.bind('1', href_binding, '%x %y') html.clipping_window.bind('B1-Motion', proc{|w, x, y| w.selection_set(priv['mark'], "@#{x},#{y}") TkClipboard.clear - # avoid tkhtml0.0 errors + # avoid tkhtml0.0 errors # anyone can fix this for tkhtml0.0 begin TkClipboard.append(TkSelection.get) @@ -235,7 +235,7 @@ html.clipping_window.bind('B1-Motion', proc{|w, x, y| last_dir = Dir.pwd sel_load = proc{ filetypes = [ - ['Html Files', ['.html', '.htm']], + ['Html Files', ['.html', '.htm']], ['All Files', '*'] ] @@ -268,15 +268,15 @@ Tk::HTML_Widget::ClippingWindow.bind('Motion', proc{|w, x, y| # Setup menu # menu_spec = [ - [['File', 0], - ['Open', sel_load, 0], - ['Refresh', refresh, 0], + [['File', 0], + ['Open', sel_load, 0], + ['Refresh', refresh, 0], '---', - ['Exit', proc{exit}, 1]], + ['Exit', proc{exit}, 1]], - [['View', 0], - ['Underline Hyperlinks', ul_hyper], - ['Show Table Structure', show_tbl], + [['View', 0], + ['Underline Hyperlinks', ul_hyper], + ['Show Table Structure', show_tbl], ['Show Images', show_img]] ] @@ -285,7 +285,7 @@ mbar = Tk.root.add_menubar(menu_spec) # # Setup trace # -ul_hyper.trace('w', proc{ +ul_hyper.trace('w', proc{ html[:underlinehyperlinks] = ul_hyper.value refresh.call }) diff --git a/ext/tk/sample/tkextlib/tkHTML/ss.rb b/ext/tk/sample/tkextlib/tkHTML/ss.rb index 1c13d7ac34..45d4d87d69 100644 --- a/ext/tk/sample/tkextlib/tkHTML/ss.rb +++ b/ext/tk/sample/tkextlib/tkHTML/ss.rb @@ -2,7 +2,7 @@ # # This script implements the "ss" application. "ss" implements # a presentation slide-show based on HTML slides. -# +# require 'tk' require 'tkextlib/tkHTML' @@ -45,18 +45,18 @@ EOD @key_block = false - Tk::HTML_Widget::ClippingWindow.bind('1', - proc{|w, ksym| key_press(w, ksym)}, + Tk::HTML_Widget::ClippingWindow.bind('1', + proc{|w, ksym| key_press(w, ksym)}, '%W Down') - Tk::HTML_Widget::ClippingWindow.bind('3', - proc{|w, ksym| key_press(w, ksym)}, + Tk::HTML_Widget::ClippingWindow.bind('3', + proc{|w, ksym| key_press(w, ksym)}, '%W Up') - Tk::HTML_Widget::ClippingWindow.bind('2', - proc{|w, ksym| key_press(w, ksym)}, + Tk::HTML_Widget::ClippingWindow.bind('2', + proc{|w, ksym| key_press(w, ksym)}, '%W Down') - Tk::HTML_Widget::ClippingWindow.bind('KeyPress', - proc{|w, ksym| key_press(w, ksym)}, + Tk::HTML_Widget::ClippingWindow.bind('KeyPress', + proc{|w, ksym| key_press(w, ksym)}, '%W %K') ############################################ @@ -64,37 +64,37 @@ EOD # Build the half-size view of the page # menu_spec = [ - [['File', 0], - ['Open', proc{sel_load()}, 0], - ['Full Screen', proc{fullscreen()}, 0], - ['Refresh', proc{refresh()}, 0], + [['File', 0], + ['Open', proc{sel_load()}, 0], + ['Full Screen', proc{fullscreen()}, 0], + ['Refresh', proc{refresh()}, 0], '---', ['Exit', proc{exit}, 1]] ] mbar = @root.add_menubar(menu_spec) - @html = Tk::HTML_Widget.new(:width=>512, :height=>384, - :padx=>5, :pady=>9, + @html = Tk::HTML_Widget.new(:width=>512, :height=>384, + :padx=>5, :pady=>9, :formcommand=>proc{|*args| form_cmd(*args)}, :imagecommand=>proc{|*args| image_cmd(1, *args) - }, + }, :scriptcommand=>proc{|*args| script_cmd(*args) - }, + }, :appletcommand=>proc{|*args| applet_cmd(*args) - }, - :hyperlinkcommand=>proc{|*args| + }, + :hyperlinkcommand=>proc{|*args| hyper_cmd(*args) - }, + }, :fontcommand=>proc{|*args| pick_font(*args) - }, + }, :appletcommand=>proc{|*args| run_applet('small', *args) - }, + }, :bg=>'white', :tablerelief=>:raised) @html.token_handler('meta', proc{|*args| meta(@html, *args)}) @@ -127,9 +127,9 @@ EOD # html[:fontcommand] = pick_font def pick_font(size, attrs) # puts "FontCmd: #{size} #{attrs}" - [ ((attrs =~ /fixed/)? 'courier': 'charter'), - (12 * (1.2**(size.to_f - 4.0))).to_i, - ((attrs =~ /italic/)? 'italic': 'roman'), + [ ((attrs =~ /fixed/)? 'courier': 'charter'), + (12 * (1.2**(size.to_f - 4.0))).to_i, + ((attrs =~ /italic/)? 'italic': 'roman'), ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ') end @@ -139,9 +139,9 @@ EOD baseFontSize = 24 # puts "FontCmd: #{size} #{attrs}" - [ ((attrs =~ /fixed/)? 'courier': 'charter'), - (baseFontSize * (1.2**(size.to_f - 4.0))).to_i, - ((attrs =~ /italic/)? 'italic': 'roman'), + [ ((attrs =~ /fixed/)? 'courier': 'charter'), + (baseFontSize * (1.2**(size.to_f - 4.0))).to_i, + ((attrs =~ /italic/)? 'italic': 'roman'), ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ') end @@ -244,7 +244,7 @@ EOD # def sel_load filetypes = [ - ['Html Files', ['.html', '.htm']], + ['Html Files', ['.html', '.htm']], ['All Files', '*'] ] @@ -280,7 +280,7 @@ EOD rescue ret = nil fp = nil - Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'", + Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'", :type=>:ok) ensure fp.close if fp @@ -371,32 +371,32 @@ EOD width = @root.winfo_screenwidth height = @root.winfo_screenheight - @fswin = TkToplevel.new(:overrideredirect=>true, + @fswin = TkToplevel.new(:overrideredirect=>true, :geometry=>"#{width}x#{height}+0+0") - @html_fs = Tk::HTML_Widget.new(@fswin, :padx=>5, :pady=>9, + @html_fs = Tk::HTML_Widget.new(@fswin, :padx=>5, :pady=>9, :formcommand=>proc{|*args| form_cmd(*args) }, - :imagecommand=>proc{|*args| + :imagecommand=>proc{|*args| image_cmd(0, *args) - }, + }, :scriptcommand=>proc{|*args| script_cmd(*args) - }, + }, :appletcommand=>proc{|*args| applet_cmd(*args) - }, - :hyperlinkcommand=>proc{|*args| + }, + :hyperlinkcommand=>proc{|*args| hyper_cmd(*args) - }, + }, :appletcommand=>proc{|*args| run_applet('big', *args) - }, + }, :fontcommand=>proc{|*args| pick_font_fs(*args) - }, - :bg=>'white', :tablerelief=>:raised, + }, + :bg=>'white', :tablerelief=>:raised, :cursor=>:tcross) { pack(:fill=>:both, :expand=>true) token_handler('meta', proc{|*args| meta(self, *args)}) diff --git a/ext/tk/sample/tkextlib/tkimg/demo.rb b/ext/tk/sample/tkextlib/tkimg/demo.rb index a0c4d1b64f..d453e8ee9d 100644 --- a/ext/tk/sample/tkextlib/tkimg/demo.rb +++ b/ext/tk/sample/tkextlib/tkimg/demo.rb @@ -2,7 +2,7 @@ # # Tk::Img demo # -# -- This script is based on demo.tcl of Tcl/Tk's 'Img' extention. +# -- This script is based on demo.tcl of Tcl/Tk's 'Img' extention. # Image data in this script is those of demo.tcl. # Please read 'license_terms_of_Img_extension' file. # @@ -85,7 +85,7 @@ class TkImg_demo Tk.update_idletasks Tk.after(20, proc{update_animated_gif(w, :image, 0)}) rescue => e - w.configure(:text=>"error displaying animated gif:\n#{e.message}", + w.configure(:text=>"error displaying animated gif:\n#{e.message}", :image=>'', :relief=>:ridge) end w.pack @@ -98,15 +98,15 @@ class TkImg_demo TkLabel.new(@typeFrame[fmt], :text=>"#{fmt} : ").pack(:side=>:left) end begin - f = TkFrame.new(@typeFrame[fmt], + f = TkFrame.new(@typeFrame[fmt], :borderwidth=>2, :relief=>:ridge).pack(:side=>:left) im = TkPhotoImage.new(:data=>data) im['data'] = '' TkLabel.new(f, :image=>im).pack - TkLabel.new(f, :text=>type, :borderwidth=>0, :pady=>0, :padx=>2, + TkLabel.new(f, :text=>type, :borderwidth=>0, :pady=>0, :padx=>2, :font=>'Helvetica 8').pack rescue => e - TkMessage.new(f, :text=>"error displaying #{type} image: #{e.message}", + TkMessage.new(f, :text=>"error displaying #{type} image: #{e.message}", :aspect=>250).pack end Tk.update diff --git a/ext/tk/sample/tkextlib/tktable/basic.rb b/ext/tk/sample/tkextlib/tktable/basic.rb index 0d2d48893a..dddbb776dc 100644 --- a/ext/tk/sample/tkextlib/tktable/basic.rb +++ b/ext/tk/sample/tkextlib/tktable/basic.rb @@ -3,7 +3,7 @@ ## basic.rb ## ## This demo shows the basic use of the table widget -## +## ## ( based on 'basic.tcl' included source archive of tktable extension ) ## require 'tk' @@ -22,19 +22,19 @@ cols = 8 lbl = TkLabel.new(:text=>"TkTable v1 Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>2, - :roworigin=>-1, :colorigin=>-2, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>2, + :roworigin=>-1, :colorigin=>-2, :rowstretchmode=>:last, :colstretchmode=>:last, :rowtagcommand=>proc{|row| row = Integer(row) (row>0 && row%2 == 1)? 'OddRow': '' - }, + }, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, + }, :selectmode=>:extended, :sparsearray=>false) sx = table.xscrollbar(TkScrollbar.new) diff --git a/ext/tk/sample/tkextlib/tktable/buttons.rb b/ext/tk/sample/tkextlib/tktable/buttons.rb index b21e8673c2..e35c137a28 100644 --- a/ext/tk/sample/tkextlib/tktable/buttons.rb +++ b/ext/tk/sample/tkextlib/tktable/buttons.rb @@ -14,11 +14,11 @@ tab = TkVariable.new_hash rows = 20 cols = 20 -table = Tk::TkTable.new(:rows=>rows + 1, :cols=>cols + 1, - :variable=>tab, :titlerows=>1, :titlecols=>1, - :roworigin=>-1, :colorigin=>-1, - :colwidth=>4, :width=>8, :height=>8, - :cursor=>'top_left_arrow', :borderwidth=>2, +table = Tk::TkTable.new(:rows=>rows + 1, :cols=>cols + 1, + :variable=>tab, :titlerows=>1, :titlecols=>1, + :roworigin=>-1, :colorigin=>-1, + :colwidth=>4, :width=>8, :height=>8, + :cursor=>'top_left_arrow', :borderwidth=>2, :flashmode=>false, :state=>:disabled) sx = table.xscrollbar(TkScrollbar.new) @@ -67,7 +67,7 @@ table.bind('1', proc{|w, x, y| 0.step(cols){|j| if i == 0 tab[-1,j] = j - end + end tab[i,j] = "OFF" table.tag_cell('OFF', "#{i},#{j}") } diff --git a/ext/tk/sample/tkextlib/tktable/command.rb b/ext/tk/sample/tkextlib/tktable/command.rb index bf36159ccc..e697ccf3bf 100644 --- a/ext/tk/sample/tkextlib/tktable/command.rb +++ b/ext/tk/sample/tkextlib/tktable/command.rb @@ -27,7 +27,7 @@ current = TkLabel.new(:textvariable=>cur_var, :width=>5) ent_var = TkVariable.new entry = TkEntry.new(:textvariable=>ent_var) -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :command=>[proc{|mode, cell, val| if (mode == :w) data[cell] = val @@ -38,10 +38,10 @@ table = Tk::TkTable.new(:rows=>rows, :cols=>cols, '' # not exist end end - }, '%i %C %s'], - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>1, - :roworigin=>-1, :colorigin=>-1, + }, '%i %C %s'], + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>1, + :roworigin=>-1, :colorigin=>-1, :rowstretchmode=>:last, :colstretchmode=>:last, :rowtagcommand=>proc{|row| row = Integer(row) @@ -50,20 +50,20 @@ table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, - :selectmode=>:extended, :flashmode=>true, + }, + :selectmode=>:extended, :flashmode=>true, :rowstretch=>:unset, :colstretch=>:unset, :browsecommand=>[proc{|w, s| cur_var.value = s ent_var.value = w.get(s) - }, '%W %S'], - :validate=>true, - :validatecommand=>proc{|e| + }, '%W %S'], + :validate=>true, + :validatecommand=>proc{|e| ent_var.value = e.new_value; true }) =begin :validatecommand=>[ - proc{|s| + proc{|s| ent_var.value = s; true }, '%S']) =end diff --git a/ext/tk/sample/tkextlib/tktable/debug.rb b/ext/tk/sample/tkextlib/tktable/debug.rb index d5cd5e49ba..016d5b353e 100644 --- a/ext/tk/sample/tkextlib/tktable/debug.rb +++ b/ext/tk/sample/tkextlib/tktable/debug.rb @@ -23,15 +23,15 @@ cols = 20 lbl = TkLabel.new(:text=>"TkTable v2 Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>2, - :roworigin=>-5, :colorigin=>-2, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>2, + :roworigin=>-5, :colorigin=>-2, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, - :selectmode=>:extended, :flashmode=>true, + }, + :selectmode=>:extended, :flashmode=>true, :rowstretch=>:unset, :colstretch=>:unset, :selecttitles=>false, :drawmode=>:single) @@ -67,8 +67,8 @@ table.tag_cell('logo', [1,2], [2,3], [4,1]) table.tag_cell('dis', [2,1], [1,-1], [3,0]) table.set_width([-2,8], [-1,9], [0, 12], [4, 14]) -table.set([1,1], "multi-line\ntext\nmight be\ninteresting", - [3,2], "more\nmulti-line\nplaying\n", +table.set([1,1], "multi-line\ntext\nmight be\ninteresting", + [3,2], "more\nmulti-line\nplaying\n", [2,2], "null\0byte") # This is in the row span diff --git a/ext/tk/sample/tkextlib/tktable/dynarows.rb b/ext/tk/sample/tkextlib/tktable/dynarows.rb index d083e26559..cc72a021cf 100644 --- a/ext/tk/sample/tkextlib/tktable/dynarows.rb +++ b/ext/tk/sample/tkextlib/tktable/dynarows.rb @@ -5,7 +5,7 @@ ## This demos shows the use of the validation mechanism of the table ## and uses the table's cache (no -command or -variable) with a cute ## dynamic row routine. -## +## ## ( based on 'dynarows.tcl' included source archive of tktable extension ) ## require 'tk' @@ -24,7 +24,7 @@ def table_validate(w, idx) begin time = Tk.tk_call('clock', 'scan', val) date = [] - Tk.tk_call('clock', 'format', time, + Tk.tk_call('clock', 'format', time, :format=>'%m %d %Y').split(' ').each{|item| date << item.sub(/^\s*0*/,'') } @@ -54,12 +54,12 @@ end lbl = TkLabel.new(:text=>"Dynamic Date Validated Rows") -table = Tk::TkTable.new(:rows=>2, :cols=>3, :cache=>1, :selecttype=>:row, - :titlerows=>1, :titlecols=>1, :height=>5, - :colstretch=>:unset, :rowstretch=>:unset, - :autoclear=>true, +table = Tk::TkTable.new(:rows=>2, :cols=>3, :cache=>1, :selecttype=>:row, + :titlerows=>1, :titlecols=>1, :height=>5, + :colstretch=>:unset, :rowstretch=>:unset, + :autoclear=>true, :browsecommand=>[ - proc{|w,s| table_validate(w, s)}, + proc{|w,s| table_validate(w, s)}, '%W %s' ]) table.set([0,1], 'Begin', [0,2], 'End', [1,0], '*') diff --git a/ext/tk/sample/tkextlib/tktable/maxsize.rb b/ext/tk/sample/tkextlib/tktable/maxsize.rb index aff68ff377..74e136c49c 100644 --- a/ext/tk/sample/tkextlib/tktable/maxsize.rb +++ b/ext/tk/sample/tkextlib/tktable/maxsize.rb @@ -4,7 +4,7 @@ ## ## This demo uses a really big table. The big startup time is in ## filling the table's Tcl array var. -## +## ## ( based on 'maxsize.tcl' included source archive of tktable extension ) ## require 'tk' @@ -23,15 +23,15 @@ cols = 10 lbl = TkLabel.new(:text=>"TkTable v2 Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>8, - :titlerows=>1, :titlecols=>1, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, + :width=>6, :height=>8, + :titlerows=>1, :titlecols=>1, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, - :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, + }, + :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, :selecttitles=>false, :drawmode=>:slow) sx = table.xscrollbar(TkScrollbar.new) diff --git a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb index 9da896f5a7..2953b2e597 100644 --- a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb +++ b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb @@ -4,7 +4,7 @@ ## ## This demos shows how you can simulate a 3D table ## and has other basic features to begin a basic spreadsheet -## +## ## ( based on 'spreadsheet.tcl' included source archive of tktable extension ) ## require 'tk' @@ -67,15 +67,15 @@ optmenu = TkOptionMenubutton.new(page, *(%w(AA BB CC DD))) fill_table(table_list, page.value) fill_table(table_list, 'BB', Integer(rows/2), Integer(cols/2)) -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :width=>5, :height=>5, - :variable=>table_list[page.value], - :titlerows=>1, :titlecols=>1, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :width=>5, :height=>5, + :variable=>table_list[page.value], + :titlerows=>1, :titlecols=>1, :coltagcommand=>proc{|n| colorize(n)}, - :flashmode=>true, :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, + :flashmode=>true, :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, :browsecommand=>proc{|e| cur_var.value = e.new_index}) -page.trace(:w, proc{|var, elem, op| +page.trace(:w, proc{|var, elem, op| changepage(table_list, table, entry, color, var, elem, op) }) @@ -128,7 +128,7 @@ menu = TkMenu.new m_file = TkMenu.new(menu) Tk.root.menu(menu) menu.add(:cascade, :label=>'File', :underline=>0, :menu=>m_file) -m_file.add(:command, :label=>'Fill Array', +m_file.add(:command, :label=>'Fill Array', :command=>proc{ fill_table(table_list, page.value) }) m_file.add(:command, :label=>'Quit', :command=>proc{exit}) diff --git a/ext/tk/sample/tkextlib/tktable/valid.rb b/ext/tk/sample/tkextlib/tktable/valid.rb index e5d3f11d84..98e9c3855a 100644 --- a/ext/tk/sample/tkextlib/tktable/valid.rb +++ b/ext/tk/sample/tkextlib/tktable/valid.rb @@ -4,7 +4,7 @@ ## ## This demos shows the use of the validation mechanism of the table ## and uses the table's cache (no -command or -variable) -## +## ## ( based on 'valid.tcl' included source archive of tktable extension ) ## require 'tk' @@ -53,12 +53,12 @@ end lbl = TkLabel.new(:text=>"TkTable v1 Validated Table Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :cache=>1, - :width=>5, :height=>5, :titlerows=>1, :titlecols=>1, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :cache=>1, + :width=>5, :height=>5, :titlerows=>1, :titlecols=>1, :coltagcommand=>proc{|n| colorize(n)}, - :flashmode=>true, :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, - :validate=>true, + :flashmode=>true, :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, + :validate=>true, :validatecommand=>proc{|e| unless e.widget.tag_include?('title', e.index) validate_proc(e.column, e.new_value) diff --git a/ext/tk/sample/tkextlib/treectrl/bitmaps.rb b/ext/tk/sample/tkextlib/treectrl/bitmaps.rb index 745e6a2e5b..0d8b37b81e 100644 --- a/ext/tk/sample/tkextlib/treectrl/bitmaps.rb +++ b/ext/tk/sample/tkextlib/treectrl/bitmaps.rb @@ -4,12 +4,12 @@ def demoBitmaps(t) #if $Version_1_1_OrLater if @has_bgimg - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', :showheader=>false, :backgroundimage=>@images['sky']) else - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', :showheader=>false) end @@ -19,15 +19,15 @@ def demoBitmaps(t) t.column_configure(0, :itembackground=>['gray90', []]) end - t.element_create('elemTxt', :text, + t.element_create('elemTxt', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('elemSelTxt', :rect, :showfocus=>true, + t.element_create('elemSelTxt', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) - t.element_create('elemSelBmp', :rect, :outlinewidth=>4, + t.element_create('elemSelBmp', :rect, :outlinewidth=>4, :outline=>[@SystemHighlight, ['selected', 'focus']]) - t.element_create('elemBmp', :bitmap, - :foreground=>[@SystemHighlight, ['selected', 'focus']], - :background=>'linen', + t.element_create('elemBmp', :bitmap, + :foreground=>[@SystemHighlight, ['selected', 'focus']], + :background=>'linen', :bitmap=>['question' ['selected']]) s = t.style_create('STYLE', :orient=>:vertical) @@ -42,7 +42,7 @@ def demoBitmaps(t) t.defaultstyle = [s] end - bitmap_names = %w(error gray75 gray50 gray25 gray12 + bitmap_names = %w(error gray75 gray50 gray25 gray12 hourglass info questhead question warning) bitmap_names.each{|name| @@ -60,15 +60,15 @@ def demoBitmaps(t) t.item_style_set(i, 0, s) t.item_text(i, 0, name) if true - t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name, - :foreground=>['brown', ''], + t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name, + :foreground=>['brown', ''], :background=>['', '']) else - t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name, + t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name, :foreground=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'brown', [] - ], + ], :background=>['', []]) end t.item_lastchild(:root, i) diff --git a/ext/tk/sample/tkextlib/treectrl/demo.rb b/ext/tk/sample/tkextlib/treectrl/demo.rb index a1b4661197..564a005bdc 100644 --- a/ext/tk/sample/tkextlib/treectrl/demo.rb +++ b/ext/tk/sample/tkextlib/treectrl/demo.rb @@ -76,7 +76,7 @@ class TkTreeCtrl_demo #################### - @tree2.bind('ButtonPress-3', + @tree2.bind('ButtonPress-3', proc{|w, x, y, rootx, rooty| show_list_popup(w, x, y, rootx, rooty) }, '%W %x %y %X %Y') @@ -94,7 +94,7 @@ class TkTreeCtrl_demo #################### - @tree1.notify_bind(@tree1, 'Selection', + @tree1.notify_bind(@tree1, 'Selection', proc{|c, t| if c == 1 item = t.selection_get[0] @@ -102,10 +102,10 @@ class TkTreeCtrl_demo end }, '%c %T') - # When one item is selected in the demo list, display the styles in + # When one item is selected in the demo list, display the styles in # that item. # See DemoClear for why the tag "DontDelete" is used - @tree2.notify_bind('DontDelete', 'Selection', + @tree2.notify_bind('DontDelete', 'Selection', proc{|c, t| display_styles_in_item(t.selection_get[0]) if c == 1 }, '%c %T') @@ -162,7 +162,7 @@ class TkTreeCtrl_demo font = TkFont.new(['Courier', 9]) end - @src_txt = TkText.new(f, :font=>font, :tabs=>font.measure('1234'), + @src_txt = TkText.new(f, :font=>font, :tabs=>font.measure('1234'), :wrap=>:none) xscr = @src_txt.xscrollbar(TkScrollbar.new(f)) yscr = @src_txt.yscrollbar(TkScrollbar.new(f)) @@ -204,23 +204,23 @@ class TkTreeCtrl_demo font = TkFont.new(['MS Sans', 8]) end - tree = Tk::TreeCtrl.new(f, :highlightthickness=>0, + tree = Tk::TreeCtrl.new(f, :highlightthickness=>0, :borderwidth=>0, :font=>font) tree[:xscrollincrement] = 20 tree.debug_configure(:enable=>false, :display=>false) if h - h_scr = TkScrollbar.new(f, :orient=>:horizontal, + h_scr = TkScrollbar.new(f, :orient=>:horizontal, :command=>proc{|*args| tree.xview(*args)}) - tree.notify_bind(h_scr, 'Scroll-x', + tree.notify_bind(h_scr, 'Scroll-x', proc{|w, l, u| w.set(l, u)}, '%W %l %u') h_scr.bind('ButtonPress-1', proc{tree.set_focus}) end if v - v_scr = TkScrollbar.new(f, :orient=>:vertical, + v_scr = TkScrollbar.new(f, :orient=>:vertical, :command=>proc{|*args| tree.yview(*args)}) - tree.notify_bind(v_scr, 'Scroll-y', + tree.notify_bind(v_scr, 'Scroll-y', proc{|w, l, u| w.set(l, u)}, '%W %l %u') v_scr.bind('ButtonPress-1', proc{tree.set_focus}) end @@ -249,13 +249,13 @@ class TkTreeCtrl_demo # Tree + scrollbar: demos f1, @tree1 = tree_plus_scrollbars_in_a_frame(nil, false, true) - @tree1.configure(:showbuttons=>false, :showlines=>:false, + @tree1.configure(:showbuttons=>false, :showlines=>:false, :showroot=>false, :height=>100) if $HasColumnCreate - @tree1.column_create(:text=>'List of Demos', + @tree1.column_create(:text=>'List of Demos', :expand=>true, :button=>false) else - @tree1.column_configure(0, :text=>'List of Demos', + @tree1.column_configure(0, :text=>'List of Demos', :expand=>true, :button=>false) end @@ -263,10 +263,10 @@ class TkTreeCtrl_demo f4, @tree4 = tree_plus_scrollbars_in_a_frame(nil, false, true) @tree4.configure(:showroot=>false, :height=>140) if $HasColumnCreate - @tree4.column_create(:text=>'Elements and Styles', + @tree4.column_create(:text=>'Elements and Styles', :expand=>true, :button=>false) else - @tree4.column_configure(0, :text=>'Elements and Styles', + @tree4.column_configure(0, :text=>'Elements and Styles', :expand=>true, :button=>false) end @@ -274,10 +274,10 @@ class TkTreeCtrl_demo f3, @tree3 = tree_plus_scrollbars_in_a_frame(nil, false, true) @tree3.configure(:showroot=>false) if $HasColumnCreate - @tree3.column_create(:text=>'Styles in Item', + @tree3.column_create(:text=>'Styles in Item', :expand=>true, :button=>false) else - @tree3.column_configure(0, :text=>'Styles in Item', + @tree3.column_configure(0, :text=>'Styles in Item', :expand=>true, :button=>false) end @@ -290,7 +290,7 @@ class TkTreeCtrl_demo # Tree + scrollbars f2, @tree2 = tree_plus_scrollbars_in_a_frame(f2_base, true, true) @tree2.configure(:indent=>19) - @tree2.debug_configure(:enable=>false, :display=>true, + @tree2.debug_configure(:enable=>false, :display=>true, :erasecolor=>'pink', :displaydelay=>30) # Give it a big border to debug drawing @@ -343,7 +343,7 @@ class TkTreeCtrl_demo @popup[:show] = Hash.new{|h, k| h[k] = TkVariable.new} menuspec = [ - [ 'Collapse', [], nil, '', {:menu_config=>{:tearoff=>false}} ], + [ 'Collapse', [], nil, '', {:menu_config=>{:tearoff=>false}} ], [ 'Expand', [], nil, '', {:menu_config=>{:tearoff=>false}} ] ] @@ -351,61 +351,61 @@ class TkTreeCtrl_demo # if $Version_1_1_OrLater if @has_bgimg menuspec << \ - [ 'Background Image', + [ 'Background Image', [ - [ 'none', [@popup[:bgimg], 'none'], nil, '', - {:command=>proc{@tree2.backgroundimage = ''}} ], - [ 'sky', [@popup[:bgimg], 'sky'], nil, '', + [ 'none', [@popup[:bgimg], 'none'], nil, '', + {:command=>proc{@tree2.backgroundimage = ''}} ], + [ 'sky', [@popup[:bgimg], 'sky'], nil, '', {:command=>proc{ @tree2.backgroundimage = @images[@popup[:bgimg].value]}} ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ] end menuspec.concat([ - [ 'Background Mode', + [ 'Background Mode', %w(column index row visindex).collect{|val| - [ val, [@popup[:bgmode], val] , nil, '', + [ val, [@popup[:bgmode], val] , nil, '', {:command=>proc{@tree2.backgroundmode = @popup[:bgmode].value}} ] - }, + }, nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Debug', + [ 'Debug', [ - [ 'Data', @popup[:debug][:data], nil, '', + [ 'Data', @popup[:debug][:data], nil, '', {:command=>proc{ @tree2.debug_configure(:data=>@popup[:debug][:data].value) } - } ], - [ 'Display', @popup[:debug][:display], nil, '', + } ], + [ 'Display', @popup[:debug][:display], nil, '', {:command=>proc{ @tree2.debug_configure(:display=>@popup[:debug][:display].value) } - } ], - [ 'Enable', @popup[:debug][:enable], nil, '', + } ], + [ 'Enable', @popup[:debug][:enable], nil, '', {:command=>proc{ @tree2.debug_configure(:enable=>@popup[:debug][:enable].value) } } ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Buffering', + [ 'Buffering', [ - [ 'none', [@popup[:doublebuffer], 'none'], nil, '', + [ 'none', [@popup[:doublebuffer], 'none'], nil, '', {:command=>proc{ @tree2.doublebuffer = @popup[:doublebuffer].value } - } ], - [ 'item', [@popup[:doublebuffer], 'item'], nil, '', + } ], + [ 'item', [@popup[:doublebuffer], 'item'], nil, '', {:command=>proc{ @tree2.doublebuffer = @popup[:doublebuffer].value } - } ], - [ 'window', [@popup[:doublebuffer], 'window'], nil, '', + } ], + [ 'window', [@popup[:doublebuffer], 'window'], nil, '', {:command=>proc{ @tree2.doublebuffer = @popup[:doublebuffer].value } @@ -414,62 +414,62 @@ class TkTreeCtrl_demo nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Line style', + [ 'Line style', [ - [ 'dot', [@popup[:linestyle], 'dot'], nil, '', - {:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ], - [ 'solid', [@popup[:linestyle], 'solid'], nil, '', + [ 'dot', [@popup[:linestyle], 'dot'], nil, '', + {:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ], + [ 'solid', [@popup[:linestyle], 'solid'], nil, '', {:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Orient', + [ 'Orient', [ - [ 'Horizontal', [@popup[:orient], 'horizontal'], nil, '', - {:command=>proc{@tree2.orient = @popup[:orient].value}} ], - [ 'Vertical', [@popup[:orient], 'vertical'], nil, '', + [ 'Horizontal', [@popup[:orient], 'horizontal'], nil, '', + {:command=>proc{@tree2.orient = @popup[:orient].value}} ], + [ 'Vertical', [@popup[:orient], 'vertical'], nil, '', {:command=>proc{@tree2.orient = @popup[:orient].value}} ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Selectmode', + [ 'Selectmode', %w(list browse extended multiple single).collect{|val| - [ val, [@popup[:selectmode], val] , nil, '', + [ val, [@popup[:selectmode], val] , nil, '', {:command=>proc{@tree2.selectmode = @popup[:selectmode].value}} ] - }, + }, nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Show', + [ 'Show', [ - [ 'Buttons', @popup[:show][:buttons], nil, '', + [ 'Buttons', @popup[:show][:buttons], nil, '', {:command=>proc{ @tree2.showbuttons = @popup[:show][:buttons].value } - } ], - [ 'Header', @popup[:show][:header], nil, '', + } ], + [ 'Header', @popup[:show][:header], nil, '', {:command=>proc{ @tree2.showheader = @popup[:show][:header].value } - } ], - [ 'Lines', @popup[:show][:lines], nil, '', + } ], + [ 'Lines', @popup[:show][:lines], nil, '', {:command=>proc{ @tree2.showlines = @popup[:show][:lines].value } - } ], - [ 'Root', @popup[:show][:root], nil, '', + } ], + [ 'Root', @popup[:show][:root], nil, '', {:command=>proc{ @tree2.showroot = @popup[:show][:root].value } - } ], - [ 'Root Button', @popup[:show][:rootbutton], nil, '', + } ], + [ 'Root Button', @popup[:show][:rootbutton], nil, '', {:command=>proc{ @tree2.showrootbutton = @popup[:show][:rootbutton].value } } ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ], @@ -509,14 +509,14 @@ class TkTreeCtrl_demo if id[0] == 'item' item = id[1] if $Version_1_1_OrLater - m.add_command(:label=>"Item #{item}", + m.add_command(:label=>"Item #{item}", :command=>proc{w.item_collapse(item)}) - m.add_command(:label=>"Item #{item} (recurse)", + m.add_command(:label=>"Item #{item} (recurse)", :command=>proc{w.item_collapse_recurse(item)}) else - m.add_command(:label=>"Item #{item}", + m.add_command(:label=>"Item #{item}", :command=>proc{w.collapse(item)}) - m.add_command(:label=>"Item #{item} (recurse)", + m.add_command(:label=>"Item #{item} (recurse)", :command=>proc{w.collapse_recurse(item)}) end end @@ -533,14 +533,14 @@ class TkTreeCtrl_demo if id[0] == 'item' item = id[1] if $Version_1_1_OrLater - m.add_command(:label=>"Item #{item}", + m.add_command(:label=>"Item #{item}", :command=>proc{w.item_expand(item)}) - m.add_command(:label=>"Item #{item} (recurse)", + m.add_command(:label=>"Item #{item} (recurse)", :command=>proc{w.item_expand_recurse(item)}) else - m.add_command(:label=>"Item #{item}", + m.add_command(:label=>"Item #{item}", :command=>proc{w.expand(item)}) - m.add_command(:label=>"Item #{item} (recurse)", + m.add_command(:label=>"Item #{item} (recurse)", :command=>proc{w.expand_recurse(item)}) end end @@ -572,8 +572,8 @@ class TkTreeCtrl_demo txt = w.column_cget(i, :text) img_name = w.column_cget(i, :image) img_name = @images.key(img_name) if img_name.kind_of?(TkImage) - m.add_checkbutton(:variable=>@popup[:visible][i], - :label=>"Column #{i} \"#{txt}\" [#{img_name}]", + m.add_checkbutton(:variable=>@popup[:visible][i], + :label=>"Column #{i} \"#{txt}\" [#{img_name}]", :command=>proc{w.column_configure(i, :visible=>@popup[:visible][i].value)}) } @@ -590,90 +590,90 @@ class TkTreeCtrl_demo @popup[:justify] = TkVariable.new menuspec = [ - [ 'Arrow', + [ 'Arrow', [ - [ 'None', [@popup[:arrow], 'none'], nil, '', + [ 'None', [@popup[:arrow], 'none'], nil, '', {:command=>proc{ @tree2.column_configure(@popup[:column].value, :arrow=>:none) } } ], - [ 'Up', [@popup[:arrow], 'up'], nil, '', + [ 'Up', [@popup[:arrow], 'up'], nil, '', {:command=>proc{ @tree2.column_configure(@popup[:column].value, :arrow=>:up) } } ], - [ 'Down', [@popup[:arrow], 'down'], nil, '', + [ 'Down', [@popup[:arrow], 'down'], nil, '', {:command=>proc{ @tree2.column_configure(@popup[:column].value, :arrow=>:down) } } ], - '---', + '---', - [ 'Side Left', [@popup[:arrowside], 'left'], nil, '', + [ 'Side Left', [@popup[:arrowside], 'left'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :arrowside=>:left) } } ], - [ 'Side Right', [@popup[:arrowside], 'right'], nil, '', + [ 'Side Right', [@popup[:arrowside], 'right'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :arrowside=>:right) } } ], - '---', + '---', - [ 'Gravity Left', [@popup[:arrowgravity], 'left'], nil, '', + [ 'Gravity Left', [@popup[:arrowgravity], 'left'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :arrowgravity=>:left) } } ], - [ 'Gravity Right', [@popup[:arrowgravity], 'right'], nil, '', + [ 'Gravity Right', [@popup[:arrowgravity], 'right'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :arrowgravity=>:right) } } ], - ], - nil, '', {:menu_config=>{:tearoff=>false}} ], + ], + nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Expand', @popup[:expand], nil, '', + [ 'Expand', @popup[:expand], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :expand=>@popup[:expand].value) } } ], - [ 'Squeeze', @popup[:squeeze], nil, '', + [ 'Squeeze', @popup[:squeeze], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :squeeze=>@popup[:squeeze].value) } } ], - [ 'Justify', + [ 'Justify', [ - [ 'Left', [@popup[:justify], 'left'], nil, '', + [ 'Left', [@popup[:justify], 'left'], nil, '', {:command=>proc{ @tree2.column_configure(@popup[:column].value, :justify=>:left) } } ], - [ 'Center', [@popup[:justify], 'center'], nil, '', + [ 'Center', [@popup[:justify], 'center'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :justify=>:center) } } ], - [ 'Right', [@popup[:justify], 'right'], nil, '', + [ 'Right', [@popup[:justify], 'right'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :justify=>:right) } } ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ] ] @@ -707,7 +707,7 @@ class TkTreeCtrl_demo def master._pub_display_styles_in_item(item) display_styles_in_item(item) end - proc_disp_styles_in_item = proc{|item| + proc_disp_styles_in_item = proc{|item| master._pub_display_styles_in_item(item) } @@ -771,15 +771,15 @@ class TkTreeCtrl_demo def load_demo_scripts # demo sources [ - 'bitmaps', - 'explorer', - 'help', - 'imovie', - 'layout', - 'mailwasher', - 'outlook-folders', - 'outlook-newgroup', - 'random', + 'bitmaps', + 'explorer', + 'help', + 'imovie', + 'layout', + 'mailwasher', + 'outlook-folders', + 'outlook-newgroup', + 'random', 'www-options' ].each{|f| @demo_scripts.load_demo(File.join(@ScriptDir, "#{f}.rb")) @@ -789,18 +789,18 @@ class TkTreeCtrl_demo ########################### def init_demo_list - @tree1.element_create('e1', :text, + @tree1.element_create('e1', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - @tree1.element_create('e2', :rect, :showfocus=>true, + @tree1.element_create('e2', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], - 'gray', ['selected', '!focus'], + @SystemHighlight, ['selected', 'focus'], + 'gray', ['selected', '!focus'], ]) @tree1.style_create('s1') @tree1.style_elements('s1', ['e2', 'e1']) # Tk listbox has linespace + 1 height - @tree1.style_layout('s1', 'e2', :union=>['e1'], + @tree1.style_layout('s1', 'e2', :union=>['e1'], :ipadx=>2, :ipady=>[0, 1], :iexpand=>:e) if $Version_1_1_OrLater @@ -809,19 +809,19 @@ class TkTreeCtrl_demo ### [ - ["Random #{@RandomN[0]} Items", :demoRandom, 'random.rb'], - ["Random #{@RandomN[0]} Items, Button Images", :demoRandom2, 'random.rb'], + ["Random #{@RandomN[0]} Items", :demoRandom, 'random.rb'], + ["Random #{@RandomN[0]} Items, Button Images", :demoRandom2, 'random.rb'], ["Outlook Express (Folders)", :demoOutlookFolders, 'outlook-folders.rb'], - ["Outlook Express (Newsgroup)", :demoOutlookNewsgroup, 'outlook-newgroup.rb'], - ["Explorer (Details)", :demoExplorerDetails, 'explorer.rb'], - ["Explorer (List)", :demoExplorerList, 'explorer.rb'], - ["Explorer (Large icons)", :demoExplorerLargeIcons, 'explorer.rb'], - ["Explorer (Small icons)", :demoExplorerSmallIcons, 'explorer.rb'], - ["Internet Options", :demoInternetOptions, 'www-options.rb'], - ["Help Contents", :demoHelpContents, 'help.rb'], - ["Layout", :demoLayout, 'layout.rb'], - ["MailWasher", :demoMailWasher, 'mailwasher.rb'], - ["Bitmaps", :demoBitmaps, 'bitmaps.rb'], + ["Outlook Express (Newsgroup)", :demoOutlookNewsgroup, 'outlook-newgroup.rb'], + ["Explorer (Details)", :demoExplorerDetails, 'explorer.rb'], + ["Explorer (List)", :demoExplorerList, 'explorer.rb'], + ["Explorer (Large icons)", :demoExplorerLargeIcons, 'explorer.rb'], + ["Explorer (Small icons)", :demoExplorerSmallIcons, 'explorer.rb'], + ["Internet Options", :demoInternetOptions, 'www-options.rb'], + ["Help Contents", :demoHelpContents, 'help.rb'], + ["Layout", :demoLayout, 'layout.rb'], + ["MailWasher", :demoMailWasher, 'mailwasher.rb'], + ["Bitmaps", :demoBitmaps, 'bitmaps.rb'], ["iMovie", :demoIMovie, 'imovie.rb'] ].each{|label, cmd, file| item = @tree1.item_create @@ -853,15 +853,15 @@ class TkTreeCtrl_demo def display_styles_in_list # Create elements and styles the first time this is called if @tree4.style_names.empty? - @tree4.element_create('e1', :text, + @tree4.element_create('e1', :text, :fill=>[@SystemHighlightText,['selected','focus']]) - @tree4.element_create('e2', :text, + @tree4.element_create('e2', :text, :fill=>[ - @SystemHighlightText, ['selected','focus'], - '', ['selected','!focus'], + @SystemHighlightText, ['selected','focus'], + '', ['selected','!focus'], 'blue', [] ]) - @tree4.element_create('e3', :rect, :showfocus=>true, + @tree4.element_create('e3', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected','focus'], 'gray', ['selected', '!focus'] @@ -874,13 +874,13 @@ class TkTreeCtrl_demo @tree4.style_create('s2') @tree4.style_elements('s2', ['e3', 'e1', 'e2']) @tree4.style_layout('s2', 'e1', :padx=>[0,4]) - @tree4.style_layout('s2', 'e3', :union=>['e1', 'e2'], + @tree4.style_layout('s2', 'e3', :union=>['e1', 'e2'], :ipadx=>1, :ipady=>[0,1]) end # Clear the list @tree4.item_delete(:all) - + # One item for each element in the demo list @tree2.element_names.sort.each{|elem| if $Version_1_1_OrLater @@ -892,7 +892,7 @@ class TkTreeCtrl_demo @tree4.collapse(item) end @tree4.item_style_set(item, 0, 's1') - @tree4.item_text(item, 0, + @tree4.item_text(item, 0, "Element #{elem} (#{@tree2.element_type(elem)})") # One item for each configuration option for this element @@ -907,7 +907,7 @@ class TkTreeCtrl_demo else @tree4.item_style_set(item2, 0, 's2') @tree4.item_complex(item2, [ - ['e1', {:text=>name}], + ['e1', {:text=>name}], ['e2', {:text=>current.inspect}] ]) end @@ -942,7 +942,7 @@ class TkTreeCtrl_demo @tree4.collapse(item2) end @tree4.item_style_set(item2, 0, 's1') - @tree4.item_text(item2, 0, + @tree4.item_text(item2, 0, "Element #{elem} (#{@tree2.element_type(elem)})") # One item for each layout option for this element in this style @@ -971,15 +971,15 @@ class TkTreeCtrl_demo # Create elements and styles the first time this is called if @tree3.style_names.empty? - @tree3.element_create('e1', :text, + @tree3.element_create('e1', :text, :fill=>[@SystemHighlightText,['selected','focus']]) - @tree3.element_create('e2', :text, + @tree3.element_create('e2', :text, :fill=>[ - @SystemHighlightText, ['selected','focus'], - '', ['selected','!focus'], + @SystemHighlightText, ['selected','focus'], + '', ['selected','!focus'], 'blue', [] ]) - @tree3.element_create('e3', :rect, :showfocus=>true, + @tree3.element_create('e3', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected','focus'], 'gray', ['selected', '!focus'] @@ -992,7 +992,7 @@ class TkTreeCtrl_demo @tree3.style_create('s2') @tree3.style_elements('s2', ['e3', 'e1', 'e2']) @tree3.style_layout('s2', 'e1', :padx=>[0,4]) - @tree3.style_layout('s2', 'e3', :union=>['e1', 'e2'], + @tree3.style_layout('s2', 'e3', :union=>['e1', 'e2'], :ipadx=>1, :ipady=>[0,1]) end # Clear the list @@ -1008,7 +1008,7 @@ class TkTreeCtrl_demo @tree3.collapse(item2) end @tree3.item_style_set(item2, 0, 's1') - @tree3.item_element_configure(item2, 0, 'e1', + @tree3.item_element_configure(item2, 0, 'e1', :text=>"Column #{column}: Style #{sty}") button = false @@ -1029,7 +1029,7 @@ class TkTreeCtrl_demo @tree3.collapse(item3) end @tree3.item_style_set(item3, 0, 's1') - @tree3.item_element_configure(item3, 0, 'e1', + @tree3.item_element_configure(item3, 0, 'e1', :text=>"Element #{elem} (#{@tree2.element_type(elem)})") # One item for each configuration option in this element @@ -1046,13 +1046,13 @@ class TkTreeCtrl_demo if sameAsMaster @tree3.item_style_set(item4, 0, 's1') @tree3.item_complex(item4, [ - ['e1', + ['e1', {:text=>"#{name} #{current.inspect}"}] ]) else @tree3.item_style_set(item4, 0, 's2') @tree3.item_complex(item4, [ - ['e1', {:text=>name}], + ['e1', {:text=>name}], ['e2', {:text=>current.inspect}] ]) end @@ -1112,28 +1112,28 @@ class TkTreeCtrl_demo # Restore some happy defaults to the demo list # if $Version_1_1_OrLater if @has_bgimg - @tree2.configure(:orient=>:vertical, :wrap=>'', - :xscrollincrement=>0, :yscrollincrement=>0, - :itemheight=>0, :showheader=>true, - :background=>'white', :scrollmargin=>0, - :xscrolldelay=>50, :yscrolldelay=>50, - :openbuttonimage=>'', :closedbuttonimage=>'', - :backgroundmode=>:row, :treecolumn=>0, :indent=>19, + @tree2.configure(:orient=>:vertical, :wrap=>'', + :xscrollincrement=>0, :yscrollincrement=>0, + :itemheight=>0, :showheader=>true, + :background=>'white', :scrollmargin=>0, + :xscrolldelay=>50, :yscrolldelay=>50, + :openbuttonimage=>'', :closedbuttonimage=>'', + :backgroundmode=>:row, :treecolumn=>0, :indent=>19, :defaultstyle=>'', :backgroundimage=>'') else - @tree2.configure(:orient=>:vertical, :wrap=>'', - :xscrollincrement=>0, :yscrollincrement=>0, - :itemheight=>0, :showheader=>true, - :background=>'white', :scrollmargin=>0, - :xscrolldelay=>50, :yscrolldelay=>50, - :openbuttonimage=>'', :closedbuttonimage=>'', + @tree2.configure(:orient=>:vertical, :wrap=>'', + :xscrollincrement=>0, :yscrollincrement=>0, + :itemheight=>0, :showheader=>true, + :background=>'white', :scrollmargin=>0, + :xscrolldelay=>50, :yscrolldelay=>50, + :openbuttonimage=>'', :closedbuttonimage=>'', :backgroundmode=>:row, :treecolumn=>0, :indent=>19) end # Restore default bindings to the demo list @tree2.bindtags = [ @tree2, Tk::TreeCtrl, @tree2.winfo_toplevel, :all ] - @tree2.winfo_children.each{|w| + @tree2.winfo_children.each{|w| w.destroy unless @non_clear_list.include?(w) } end @@ -1147,8 +1147,8 @@ def cursor_window(top = nil) top.destroy if top.kind_of?(TkWindow) && top.winfo_exist? top = TkToplevel.new(:title=>'Cursor Window') - c = TkCanvas.new(top, :background=>'white', - :width=>50*10, :highlightthickness=>0, + c = TkCanvas.new(top, :background=>'white', + :width=>50*10, :highlightthickness=>0, :borderwidth=>0).pack(:expand=>true, :fill=>:both) cursors = %w( X_cursor @@ -1241,7 +1241,7 @@ def cursor_window(top = nil) begin c.cursor = cur - r = TkcRectangle.new(c, x, y, x+50, y+40, + r = TkcRectangle.new(c, x, y, x+50, y+40, :fill=>'gray90', :outline=>'black', :width=>2) t = TkcText.new(c, x+50/2, y+4, :text=>cur, :anchor=>:n, :width=>42) @@ -1278,10 +1278,10 @@ if Tk::PLATFORM['platform'] == 'unix' && Tk.windowingsystem != 'aqua' loupe[:y] = 0 unless loupe[:y] loupe[:auto] = true unless loupe[:auto] loupe[:delay] = 500 unless loupe[:delay] - loupe[:image] = + loupe[:image] = TkPhotoImage.new(:width=>150, :height=>150) unless loupe[:image] - top = TkToplevel.new(:geometry=>'-0+30', + top = TkToplevel.new(:geometry=>'-0+30', :title=>'A little screen magnifier for X11') TkLabel.new(top, :image=>loupe[:image]).pack diff --git a/ext/tk/sample/tkextlib/treectrl/explorer.rb b/ext/tk/sample/tkextlib/treectrl/explorer.rb index 242777cbce..1b8c2a8287 100644 --- a/ext/tk/sample/tkextlib/treectrl/explorer.rb +++ b/ext/tk/sample/tkextlib/treectrl/explorer.rb @@ -49,44 +49,44 @@ def demoExplorerDetails(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :itemheight=>height, :selectmode=>:extended, - :xscrollincrement=>20, :scrollmargin=>16, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :itemheight=>height, :selectmode=>:extended, + :xscrollincrement=>20, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) init_pics('small-*') if $HasColumnCreate - t.column_create(:text=>'Name', :tag=>'name', + t.column_create(:text=>'Name', :tag=>'name', :width=>200, :arrow=>:up, :arrowpad=>6) - t.column_create(:text=>'Size', :tag=>'size', :justify=>:right, + t.column_create(:text=>'Size', :tag=>'size', :justify=>:right, :width=>60, :arrowside=>:left, :arrowgravity=>:right) t.column_create(:text=>'Type', :tag=>'type', :width=>120) t.column_create(:text=>'Modified', :tag=>'modified', :width=>130) else - t.column_configure(0, :text=>'Name', :tag=>'name', + t.column_configure(0, :text=>'Name', :tag=>'name', :width=>200, :arrow=>:up, :arrowpad=>6) - t.column_configure(1, :text=>'Size', :tag=>'size', :justify=>:right, + t.column_configure(1, :text=>'Size', :tag=>'size', :justify=>:right, :width=>60, :arrowside=>:left, :arrowgravity=>:right) t.column_configure(2, :text=>'Type', :tag=>'type', :width=>120) t.column_configure(3, :text=>'Modified', :tag=>'modified', :width=>130) end - t.element_create('e1', :image, + t.element_create('e1', :image, :image=>[ - @sel_images['small-folder'], ['selected'], + @sel_images['small-folder'], ['selected'], @images['small-folder'], [] ]) - t.element_create('e2', :text, :lines=>1, + t.element_create('e2', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('txtType', :text, :lines=>1) - t.element_create('txtSize', :text, :lines=>1, + t.element_create('txtSize', :text, :lines=>1, :datatype=>:integer, :format=>'%dKB') - t.element_create('txtDate', :text, :lines=>1, + t.element_create('txtDate', :text, :lines=>1, :datatype=>:time, :format=>'%d/%m/%y %I:%M %p') t.element_create('e4', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -116,23 +116,23 @@ def demoExplorerDetails(t) @Priv[:sensitive, t] = [ ['name', 'styName', 'e1', 'e2'] ] @Priv[:dragimage, t] = [ ['name', 'styName', 'e1', 'e2'] ] - t.notify_bind(t, 'Edit-accept', + t.notify_bind(t, 'Edit-accept', proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t') dir_proc = proc{|file| item = t.item_create t.item_style_set(item, 0, 'styName', 2, 'styType', 3, 'styDate') - t.item_complex(item, - [['e2', {:text=>File.basename(file)}]], - [], - [['txtType', {:text=>'Folder'}]], + t.item_complex(item, + [['e2', {:text=>File.basename(file)}]], + [], + [['txtType', {:text=>'Folder'}]], [['txtDate', {:data=>File.mtime(file).tv_sec}]]) t.item_lastchild(:root, item) } file_proc = proc{|file| item = t.item_create - t.item_style_set(item, 0, 'styName', 1, 'stySize', + t.item_style_set(item, 0, 'styName', 1, 'stySize', 2, 'styType', 3, 'styDate') ext = File.extname(file) @@ -151,14 +151,14 @@ def demoExplorerDetails(t) type = type[1..-1] << ' ' unless type.empty? type << 'File' - t.item_complex(item, - [ - ['e1', {:image=>[@sel_images[img], ['selected'], + t.item_complex(item, + [ + ['e1', {:image=>[@sel_images[img], ['selected'], @images[img], []]}], ['e2', {:text=>File.basename(file)}] - ], - [ ['txtSize', {:data=>File.size(file)/1024 + 1}] ], - [ ['txtType', {:text=>type}] ], + ], + [ ['txtSize', {:data=>File.size(file)/1024 + 1}] ], + [ ['txtType', {:text=>type}] ], [ ['txtDate', {:data=>File.mtime(file).tv_sec}] ] ) t.item_lastchild(:root, item) @@ -167,7 +167,7 @@ def demoExplorerDetails(t) demoExplorerAux(t, dir_proc, file_proc) @SortColumn = 0 - t.notify_bind(t, 'Header-invoke', + t.notify_bind(t, 'Header-invoke', proc{|w, c| explorerHeaderInvoke(t, w, c)}, '%T %C') t.bindtags = [ t, 'TreeCtrlFileList', Tk::TreeCtrl, t.winfo_toplevel, :all ] @@ -200,37 +200,37 @@ def explorerHeaderInvoke(t, w, c) case t.column_cget(c, :tag) when 'name' if dirCount > 0 - t.item_sort(:root, order, {:last=>"root child #{lastDir}"}, + t.item_sort(:root, order, {:last=>"root child #{lastDir}"}, {:column=>c, :dictionary=>true}) end if dirCount < t.numitems - 1 - t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, + t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, {:column=>c, :dictionary=>true}) end when 'size' if dirCount < t.numitems - 1 - t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, - {:column=>c, :integer=>true}, + t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, + {:column=>c, :integer=>true}, {:column=>'name', :dictionary=>true}) end when 'type' if dirCount < t.numitems - 1 - t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, - {:column=>c, :dictionary=>true}, + t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, + {:column=>c, :dictionary=>true}, {:column=>'name', :dictionary=>true}) end when 'modified' if dirCount > 0 - t.item_sort(:root, order, {:last=>"root child #{lastDir}"}, - {:column=>c, :integer=>true}, + t.item_sort(:root, order, {:last=>"root child #{lastDir}"}, + {:column=>c, :integer=>true}, {:column=>'name', :dictionary=>true}) end if dirCount < t.numitems - 1 - t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, - {:column=>c, :integer=>true}, + t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, + {:column=>c, :integer=>true}, {:column=>'name', :dictionary=>true}) end @@ -241,9 +241,9 @@ def demoExplorerLargeIcons(t) # Item height is 32 for icon, 4 padding, 3 lines of text itemHeight = 32 + 4 + t.font.metrics(:linespace) * 3 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :selectmode=>:extended, :wrap=>:window, :orient=>:horizontal, - :itemheight=>itemHeight, :showheader=>false, :scrollmargin=>16, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :selectmode=>:extended, :wrap=>:window, :orient=>:horizontal, + :itemheight=>itemHeight, :showheader=>false, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) init_pics('big-*') @@ -254,17 +254,17 @@ def demoExplorerLargeIcons(t) t.column_configure(0, :width=>75) end - t.element_create('elemImg', :image, + t.element_create('elemImg', :image, :image=>[ - @sel_images['big-folder'], ['selected'], + @sel_images['big-folder'], ['selected'], @images['big-folder'], [] ]) - t.element_create('elemTxt', :text, :justify=>:center, - :lines=>1, :width=>71, :wrap=>:word, + t.element_create('elemTxt', :text, :justify=>:center, + :lines=>1, :width=>71, :wrap=>:word, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('elemSel', :rect, :showfocus=>true, + t.element_create('elemSel', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected'] ]) @@ -272,7 +272,7 @@ def demoExplorerLargeIcons(t) s = t.style_create('STYLE', :orient=>:vertical) t.style_elements(s, ['elemSel', 'elemImg', 'elemTxt']) t.style_layout(s, 'elemImg', :expand=>:we) - t.style_layout(s, 'elemTxt', + t.style_layout(s, 'elemTxt', :pady=>[4,0], :padx=>2, :squeeze=>:x, :expand=>:we) t.style_layout(s, 'elemSel', :union=>['elemTxt']) @@ -280,7 +280,7 @@ def demoExplorerLargeIcons(t) @Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] @Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] - t.notify_bind(t, 'Edit-accept', + t.notify_bind(t, 'Edit-accept', proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t') dir_proc = proc{|file| @@ -310,9 +310,9 @@ def demoExplorerLargeIcons(t) type = type[1..-1] << ' ' unless type.empty? type << 'File' - t.item_complex(item, - [ - ['elemImg', {:image=>[@sel_images[img], ['selected'], + t.item_complex(item, + [ + ['elemImg', {:image=>[@sel_images[img], ['selected'], @images[img], []]}], ['elemTxt', {:text=>File.basename(file)}] ]) @@ -323,7 +323,7 @@ def demoExplorerLargeIcons(t) t.activate(t.index('root firstchild')) - t.notify_bind(t, 'ActiveItem', + t.notify_bind(t, 'ActiveItem', proc{|w, a, c| w.item_element_configure(a, 0, 'elemTxt', :lines=>'') w.item_element_configure(c, 0, 'elemTxt', :lines=>3) @@ -346,9 +346,9 @@ def demoExplorerList(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :itemheight=>height, :selectmode=>:extended, :wrap=>:window, - :showheader=>false, :scrollmargin=>16, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :itemheight=>height, :selectmode=>:extended, :wrap=>:window, + :showheader=>false, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) init_pics('small-*') @@ -359,16 +359,16 @@ def demoExplorerList(t) t.column_configure(0, :widthhack=>true) end - t.element_create('elemImg', :image, + t.element_create('elemImg', :image, :image=>[ - @sel_images['small-folder'], ['selected'], + @sel_images['small-folder'], ['selected'], @images['small-folder'], [] ]) - t.element_create('elemTxt', :text, :lines=>1, + t.element_create('elemTxt', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('elemSel', :rect, :showfocus=>true, + t.element_create('elemSel', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -383,7 +383,7 @@ def demoExplorerList(t) @Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] @Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] - t.notify_bind(t, 'Edit-accept', + t.notify_bind(t, 'Edit-accept', proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t') dir_proc = proc{|file| @@ -413,9 +413,9 @@ def demoExplorerList(t) type = type[1..-1] << ' ' unless type.empty? type << 'File' - t.item_complex(item, - [ - ['elemImg', {:image=>[@sel_images[img], ['selected'], + t.item_complex(item, + [ + ['elemImg', {:image=>[@sel_images[img], ['selected'], @images[img], []]}], ['elemTxt', {:text=>File.basename(file)}] ]) diff --git a/ext/tk/sample/tkextlib/treectrl/help.rb b/ext/tk/sample/tkextlib/treectrl/help.rb index af026fc006..31ec9eb3f8 100644 --- a/ext/tk/sample/tkextlib/treectrl/help.rb +++ b/ext/tk/sample/tkextlib/treectrl/help.rb @@ -4,7 +4,7 @@ def demoHelpContents(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('help-*') @@ -20,16 +20,16 @@ def demoHelpContents(t) t.element_create('e1', :image, :image=>@images['help-page']) t.element_create('e2', :image, :image=>[ - @images['help-book-open'], ['open'], - @images['help-book-closed'], [], + @images['help-book-open'], ['open'], + @images['help-book-closed'], [], ]) - t.element_create('e3', :text, - :font=>[t.font.dup.underline(true), ['mouseover']], + t.element_create('e3', :text, + :font=>[t.font.dup.underline(true), ['mouseover']], :fill=>[ - @SystemHighlightText, ['selected', 'focus'], + @SystemHighlightText, ['selected', 'focus'], 'blue', ['mouseover'] ]) - t.element_create('e4', :rect, :showfocus=>true, + t.element_create('e4', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) # book @@ -49,21 +49,21 @@ def demoHelpContents(t) parentList = [:root, '', '', '', '', '', ''] parent = :root [ - [0, 's1', "Welcome to Help"], - [0, 's2', "Introducing Windows 98"], - [1, 's2', "How to Use Help"], - [2, 's1', "Find a topic"], + [0, 's1', "Welcome to Help"], + [0, 's2', "Introducing Windows 98"], + [1, 's2', "How to Use Help"], + [2, 's1', "Find a topic"], [2, 's1', "Get more out of help"], [1, 's2', "Register Your Software"], - [2, 's1', "Registering Windows 98 online"], - [1, 's2', "What's New in Windows 98"], - [2, 's1', "Innovative, easy-to-use features"], - [2, 's1', "Improved reliability"], - [2, 's1', "A faster operating system"], - [2, 's1', "True Web integration"], - [2, 's1', "More entertaining and fun"], - [1, 's2', "If You're New to Windows 98"], - [2, 's2', "Tips for Macintosh Users"], + [2, 's1', "Registering Windows 98 online"], + [1, 's2', "What's New in Windows 98"], + [2, 's1', "Innovative, easy-to-use features"], + [2, 's1', "Improved reliability"], + [2, 's1', "A faster operating system"], + [2, 's1', "True Web integration"], + [2, 's1', "More entertaining and fun"], + [1, 's2', "If You're New to Windows 98"], + [2, 's2', "Tips for Macintosh Users"], [3, 's1', "Why does the mouse have two buttons?"] ].each{|depth, style, text| item = t.item_create @@ -81,7 +81,7 @@ def demoHelpContents(t) treeCtrlHelp = TkBindTag.new - treeCtrlHelp.bind('Double-ButtonPress-1', + treeCtrlHelp.bind('Double-ButtonPress-1', proc{|w, x, y| if w.identify(x, y)[0] == 'header' Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) @@ -91,25 +91,25 @@ def demoHelpContents(t) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('ButtonPress-1', + treeCtrlHelp.bind('ButtonPress-1', proc{|w, x, y| helpButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('Button1-Motion', + treeCtrlHelp.bind('Button1-Motion', proc{|w, x, y| helpMotion1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('Button1-Leave', + treeCtrlHelp.bind('Button1-Leave', proc{|w, x, y| helpLeave1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('ButtonRelease-1', + treeCtrlHelp.bind('ButtonRelease-1', proc{|w, x, y| helpRelease1(w, x, y) Tk.callback_break @@ -119,7 +119,7 @@ def demoHelpContents(t) treeCtrlHelp.bind('Leave', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y') - treeCtrlHelp.bind('KeyPress-Return', + treeCtrlHelp.bind('KeyPress-Return', proc{|w, x, y| if w.selection_get.length == 1 if $Version_1_1_OrLater @@ -141,7 +141,7 @@ end def demoHelpContents2(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('help-*') @@ -154,19 +154,19 @@ def demoHelpContents2(t) t.element_create('e1', :image, :image=>@images['help-page']) t.element_create('e2', :image, :image=>[ - @images['help-book-open'], ['open'], - @images['help-book-closed'], [], + @images['help-book-open'], ['open'], + @images['help-book-closed'], [], ]) - t.element_create('e3', :text, + t.element_create('e3', :text, :fill=>[ - @SystemHighlightText, ['selected', 'focus'], + @SystemHighlightText, ['selected', 'focus'], 'blue', [] ]) - t.element_create('e4', :rect, :showfocus=>true, + t.element_create('e4', :rect, :showfocus=>true, :fill=>[@SystemHighligh, ['selected', 'focus']]) - t.element_create('e5', :text, :font=>t.font.dup.underline(true), + t.element_create('e5', :text, :font=>t.font.dup.underline(true), :fill=>[ - @SystemHighlightText, ['selected', 'focus'], + @SystemHighlightText, ['selected', 'focus'], 'blue', [] ]) @@ -201,21 +201,21 @@ def demoHelpContents2(t) parentList = [:root, '', '', '', '', '', ''] parent = :root [ - [0, 's1', "Welcome to Help"], - [0, 's2', "Introducing Windows 98"], - [1, 's2', "How to Use Help"], - [2, 's1' "Find a topic"], + [0, 's1', "Welcome to Help"], + [0, 's2', "Introducing Windows 98"], + [1, 's2', "How to Use Help"], + [2, 's1' "Find a topic"], [2, 's1', "Get more out of help"], [1, 's2', "Register Your Software"], - [2, 's1', "Registering Windows 98 online"], - [1, 's2', "What's New in Windows 98"], - [2, 's1', "Innovative, easy-to-use features"], - [2, 's1', "Improved reliability"], - [2, 's1', "A faster operating system"], - [2, 's1', "True Web integration"], - [2, 's1', "More entertaining and fun"], - [1, 's2', "If You're New to Windows 98"], - [2, 's2', "Tips for Macintosh Users"], + [2, 's1', "Registering Windows 98 online"], + [1, 's2', "What's New in Windows 98"], + [2, 's1', "Innovative, easy-to-use features"], + [2, 's1', "Improved reliability"], + [2, 's1', "A faster operating system"], + [2, 's1', "True Web integration"], + [2, 's1', "More entertaining and fun"], + [1, 's2', "If You're New to Windows 98"], + [2, 's2', "Tips for Macintosh Users"], [3, 's1', "Why does the mouse have two buttons?"] ].each{|depth, style, text| item = t.item_create @@ -233,7 +233,7 @@ def demoHelpContents2(t) treeCtrlHelp = TkBindTag.new - treeCtrlHelp.bind('Double-ButtonPress-1', + treeCtrlHelp.bind('Double-ButtonPress-1', proc{|w, x, y| if w.identify(x, y)[0] == 'header' Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) @@ -243,25 +243,25 @@ def demoHelpContents2(t) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('ButtonPress-1', + treeCtrlHelp.bind('ButtonPress-1', proc{|w, x, y| helpButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('Button1-Motion', + treeCtrlHelp.bind('Button1-Motion', proc{|w, x, y| helpMotion1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('Button1-Leave', + treeCtrlHelp.bind('Button1-Leave', proc{|w, x, y| helpLeave1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('ButtonRelease-1', + treeCtrlHelp.bind('ButtonRelease-1', proc{|w, x, y| helpRelease1(w, x, y) Tk.callback_break @@ -271,7 +271,7 @@ def demoHelpContents2(t) treeCtrlHelp.bind('Leave', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y') - treeCtrlHelp.bind('KeyPress-Return', + treeCtrlHelp.bind('KeyPress-Return', proc{|w, x, y| if w.selection_get.length == 1 w.item_toggle(w.selection_get[0]) diff --git a/ext/tk/sample/tkextlib/treectrl/imovie.rb b/ext/tk/sample/tkextlib/treectrl/imovie.rb index d61bf9a7c3..72134ebda6 100644 --- a/ext/tk/sample/tkextlib/treectrl/imovie.rb +++ b/ext/tk/sample/tkextlib/treectrl/imovie.rb @@ -2,8 +2,8 @@ # Demo: iMovie # def demoIMovie(t) - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :selectmode=>:browse, :orient=>:horizontal, :wrap=>:window, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :selectmode=>:browse, :orient=>:horizontal, :wrap=>:window, :showheader=>false, :background=>'#dcdcdc') if $HasColumnCreate @@ -26,24 +26,24 @@ def demoIMovie(t) t.element_create('elemTime', :text, :font=>font1) t.element_create('elemName', :text, :font=>font2, :lines=>1, :width=>80) - t.element_create('elemRect', :rect, :outline=>'#827878', :outlinewidth=>1, + t.element_create('elemRect', :rect, :outline=>'#827878', :outlinewidth=>1, :fill=>['#ffdc5a', ['selected'], 'white', []]) t.element_create('elemImg', :image) - t.element_create('elemShadow', :rect, :outline=>'gray', :outlinewidth=>1, + t.element_create('elemShadow', :rect, :outline=>'gray', :outlinewidth=>1, :open=>:wn) s = t.style_create('STYLE', :orient=>:vertical) t.style_elements(s, [ - 'elemShadow', 'elemRect', 'elemTime', + 'elemShadow', 'elemRect', 'elemTime', 'elemImg', 'elemName' ]) - t.style_layout(s, 'elemShadow', :detach=>true, + t.style_layout(s, 'elemShadow', :detach=>true, :padx=>[1,2], :pady=>[1,2], :iexpand=>:es) t.style_layout(s, 'elemTime', :padx=>[2,0]) t.style_layout(s, 'elemImg', :pady=>[0,1]) - t.style_layout(s, 'elemName', :expand=>:we, :ipady=>[0,2], :padx=>[0,3], + t.style_layout(s, 'elemName', :expand=>:we, :ipady=>[0,2], :padx=>[0,3], :squeeze=>:x) - t.style_layout(s, 'elemRect', :union=>['elemTime', 'elemImg', 'elemName'], + t.style_layout(s, 'elemRect', :union=>['elemTime', 'elemImg', 'elemName'], :ipadx=>6, :padx=>[0,3], :pady=>[0,3]) # Set default item style @@ -53,12 +53,12 @@ def demoIMovie(t) (0..4).each{|i| [ - ['15:20', 'Clip 1', @images['imovie-01']], - ['19:18', 'Clip 2', @images['imovie-02']], - ['07:20', 'Clip 3', @images['imovie-03']], - ['07:20', 'Clip 4', @images['imovie-04']], - ['07:20', 'Clip 5', @images['imovie-05']], - ['07:20', 'Clip 6', @images['imovie-06']], + ['15:20', 'Clip 1', @images['imovie-01']], + ['19:18', 'Clip 2', @images['imovie-02']], + ['07:20', 'Clip 3', @images['imovie-03']], + ['07:20', 'Clip 4', @images['imovie-04']], + ['07:20', 'Clip 5', @images['imovie-05']], + ['07:20', 'Clip 6', @images['imovie-06']], ['07:20', 'Clip 7', @images['imovie-07']] ].each{|time, name, image| item = t.item_create @@ -110,7 +110,7 @@ def iMovieButton1(w, x, y) Tk::TreeCtrl::BindCallback.entryOpen(w, i, 0, e) ent = TkComm.window(w.path + '.entry') unless exists - ent.configure(:borderwidth=>0, :justify=>:center, + ent.configure(:borderwidth=>0, :justify=>:center, :background=>'#ffdc5a') x1, y1, x2, y2 = w.item_bbox(i, 0, e) ent.place(:y=>y1 - 1) diff --git a/ext/tk/sample/tkextlib/treectrl/layout.rb b/ext/tk/sample/tkextlib/treectrl/layout.rb index 745ac86f36..488abe2aa9 100644 --- a/ext/tk/sample/tkextlib/treectrl/layout.rb +++ b/ext/tk/sample/tkextlib/treectrl/layout.rb @@ -2,7 +2,7 @@ # Demo: Layout # def demoLayout(t) - t.configure(:showroot=>false, :showrootbutton=>true, :showbuttons=>true, + t.configure(:showroot=>false, :showrootbutton=>true, :showbuttons=>true, :showlines=>true, :itemheight=>0, :selectmode=>:browse) if $HasColumnCreate @@ -12,10 +12,10 @@ def demoLayout(t) end t.element_create('e1', :rect, :width=>30, :height=>30, :fill=>'gray20') - t.element_create('e2', :rect, :width=>30, :height=>30, :fill=>'gray40', + t.element_create('e2', :rect, :width=>30, :height=>30, :fill=>'gray40', :outline=>'blue', :outlinewidth=>3) t.element_create('e3', :rect, :fill=>'gray60') - t.element_create('e4', :rect, :showfocus=>true, + t.element_create('e4', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray80', [] ]) @@ -31,9 +31,9 @@ def demoLayout(t) t.style_layout(s, 'e3', :union=>['e1', 'e2'], :ipadx=>4, :ipady=>4, :pady=>2) t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es) t.style_layout(s, 'e5', :detach=>true, :padx=>[2,0], :pady=>2, :iexpand=>:s) - t.style_layout(s, 'e6', :detach=>true, :expand=>:ws, + t.style_layout(s, 'e6', :detach=>true, :expand=>:ws, :padx=>[0,2], :pady=>[2,0]) - t.style_layout(s, 'e7', :detach=>true, :expand=>:wn, + t.style_layout(s, 'e7', :detach=>true, :expand=>:wn, :padx=>[0,2], :pady=>[0,2]) if $Version_1_1_OrLater @@ -53,7 +53,7 @@ def demoLayout(t) t.item_style_set(i, 0, s) t.item_lastchild(parent, i) - ### + ### s = t.style_create('s2') t.style_elements(s, ['e4', 'e3', 'e1']) @@ -77,7 +77,7 @@ def demoLayout(t) t.item_style_set(i2, 0, s) t.item_lastchild(i, i2) - ### + ### s = t.style_create('s3') t.style_elements(s, ['e4', 'e3', 'e1', 'e5', 'e6']) @@ -101,10 +101,10 @@ def demoLayout(t) t.item_style_set(i2, 0, s) t.item_lastchild(i, i2) - ### + ### - t.element_create('eb', :border, :background=>@SystemButtonFace, - :relief=>[:sunken, ['selected'], :raised, []], + t.element_create('eb', :border, :background=>@SystemButtonFace, + :relief=>[:sunken, ['selected'], :raised, []], :thickness=>2, :filled=>true) t.element_create('et', :text) @@ -134,11 +134,11 @@ def demoLayout(t) t.item_text(i, 0, text) t.item_lastchild(parent, i) - ### + ### styleNum = 5 - [ - [:horizontal, [:s, :ns, :n]], + [ + [:horizontal, [:s, :ns, :n]], [:vertical, [:e, :we, :w]] ].each{|orient, expandList| expandList.each{|expand| diff --git a/ext/tk/sample/tkextlib/treectrl/mailwasher.rb b/ext/tk/sample/tkextlib/treectrl/mailwasher.rb index 836e1e87de..1b51bb9b21 100644 --- a/ext/tk/sample/tkextlib/treectrl/mailwasher.rb +++ b/ext/tk/sample/tkextlib/treectrl/mailwasher.rb @@ -7,8 +7,8 @@ def demoMailWasher(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:showroot=>false, :showrootbutton=>false, :showbuttons=>false, - :showlines=>false, :itemheight=>height, :selectmode=>:browse, + t.configure(:showroot=>false, :showrootbutton=>false, :showbuttons=>false, + :showlines=>false, :itemheight=>height, :selectmode=>:browse, :xscrollincrement=>1) pad = 4 @@ -16,14 +16,14 @@ def demoMailWasher(t) if $Version_1_1_OrLater t.column_create(:text=>'Delete', :textpadx=>pad, :tag=>'delete') t.column_create(:text=>'Bounce', :textpadx=>pad, :tag=>'bounce') - t.column_create(:text=>'Status', :width=>80, :textpadx=>pad, + t.column_create(:text=>'Status', :width=>80, :textpadx=>pad, :tag=>'status') - t.column_create(:text=>'Size', :width=>40, :textpadx=>pad, + t.column_create(:text=>'Size', :width=>40, :textpadx=>pad, :justify=>:right, :tag=>'size') t.column_create(:text=>'From', :width=>140, :textpadx=>pad, :tag=>'from') - t.column_create(:text=>'Subject', :width=>240, :textpadx=>pad, + t.column_create(:text=>'Subject', :width=>240, :textpadx=>pad, :tag=>'subject') - t.column_create(:text=>'Received', :textpadx=>pad, :arrow=>:up, + t.column_create(:text=>'Received', :textpadx=>pad, :arrow=>:up, :arrowpad=>[4,0], :tag=>'received') t.column_create(:text=>'Attachments', :textpadx=>pad, :tag=>'attachments') @@ -36,38 +36,38 @@ def demoMailWasher(t) else # TreeCtrl 1.0 t.column_configure(0, :text=>'Delete', :textpadx=>pad, :tag=>'delete') t.column_configure(1, :text=>'Bounce', :textpadx=>pad, :tag=>'bounce') - t.column_configure(2, :text=>'Status', :width=>80, :textpadx=>pad, + t.column_configure(2, :text=>'Status', :width=>80, :textpadx=>pad, :tag=>'status') - t.column_configure(3, :text=>'Size', :width=>40, :textpadx=>pad, + t.column_configure(3, :text=>'Size', :width=>40, :textpadx=>pad, :justify=>:right, :tag=>'size') - t.column_configure(4, :text=>'From', :width=>140, :textpadx=>pad, + t.column_configure(4, :text=>'From', :width=>140, :textpadx=>pad, :tag=>'from') - t.column_configure(5, :text=>'Subject', :width=>240, :textpadx=>pad, + t.column_configure(5, :text=>'Subject', :width=>240, :textpadx=>pad, :tag=>'subject') - t.column_configure(6, :text=>'Received', :textpadx=>pad, :arrow=>:up, + t.column_configure(6, :text=>'Received', :textpadx=>pad, :arrow=>:up, :arrowpad=>[4,0], :tag=>'received') - t.column_configure(7, :text=>'Attachments', :textpadx=>pad, + t.column_configure(7, :text=>'Attachments', :textpadx=>pad, :tag=>'attachments') t.element_create('imgOff', :image, :image=>@images['unchecked']) t.element_create('imgOn', :image, :image=>@images['checked']) end - t.element_create('border', :rect, :open=>:nw, :outline=>'gray', + t.element_create('border', :rect, :open=>:nw, :outline=>'gray', :outlinewidth=>1, :fill=>[@SystemHighlight, ['selected']]) - t.element_create('txtAny', :text, :lines=>1, + t.element_create('txtAny', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) - t.element_create('txtNone', :text, :text=>'none', :lines=>1, + t.element_create('txtNone', :text, :text=>'none', :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) - t.element_create('txtYes', :text, :text=>'yes', :lines=>1, + t.element_create('txtYes', :text, :text=>'yes', :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) - t.element_create('txtNormal', :text, :text=>'Normal', :lines=>1, + t.element_create('txtNormal', :text, :text=>'Normal', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#006800', []]) - t.element_create('txtPossSpam', :text, :text=>'Possible Spam', :lines=>1, + t.element_create('txtPossSpam', :text, :text=>'Possible Spam', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#787800', []]) - t.element_create('txtProbSpam', :text, :text=>'Probably Spam', :lines=>1, + t.element_create('txtProbSpam', :text, :text=>'Probably Spam', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#FF9000', []]) - t.element_create('txtBlacklist', :text, :text=>'Blacklisted', :lines=>1, + t.element_create('txtBlacklist', :text, :text=>'Blacklisted', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#FF5800', []]) if $Version_1_1_OrLater @@ -96,16 +96,16 @@ def demoMailWasher(t) } [ - ['baldy@spammer.com', "Your hair is thinning"], - ['flat@spammer.com', "Your breasts are too small"], - ['tiny@spammer.com', "Your penis is too small"], - ['dumbass@spammer.com', "You are not very smart"], - ['bankrobber@spammer.com', "You need more money"], - ['loser@spammer.com', "You need better friends"], - ['gossip@spammer.com', "Find out what your coworkers think about you"], + ['baldy@spammer.com', "Your hair is thinning"], + ['flat@spammer.com', "Your breasts are too small"], + ['tiny@spammer.com', "Your penis is too small"], + ['dumbass@spammer.com', "You are not very smart"], + ['bankrobber@spammer.com', "You need more money"], + ['loser@spammer.com', "You need better friends"], + ['gossip@spammer.com', "Find out what your coworkers think about you"], ['whoami@spammer.com', "Find out what you think about yourself"], - ['downsized@spammer.com', "You need a better job"], - ['poorhouse@spammer.com', "Your mortgage is a joke"], + ['downsized@spammer.com', "You need a better job"], + ['poorhouse@spammer.com', "Your mortgage is a joke"], ['spam4ever@spammer.com', "You need more spam"] ].each{|frm, subj| item = t.item_create @@ -115,8 +115,8 @@ def demoMailWasher(t) if $Version_1_1_OrLater delete = [false, true][rand(2)] bounce = [false, true][rand(2)] - t.item_style_set(item, - 0, 'styCheck', 1, 'styCheck', 2, status, 3, 'styAny', + t.item_style_set(item, + 0, 'styCheck', 1, 'styCheck', 2, status, 3, 'styAny', 4, 'styAny', 5, 'styAny', 6, 'styAny', 7, attachments) t.item_state_forcolumn(item, 'delete', 'CHECK') if delete t.item_state_forcolumn(item, 'bounce', 'CHECK') if bounce @@ -124,8 +124,8 @@ def demoMailWasher(t) else # TreeCtrl 1.0 delete = ['styOn', 'styOff'][rand(2)] bounce = ['styOn', 'styOff'][rand(2)] - t.item_style_set(item, - 0, delete, 1, bounce, 2, status, 3, 'styAny', + t.item_style_set(item, + 0, delete, 1, bounce, 2, status, 3, 'styAny', 4, 'styAny', 5, 'styAny', 6, 'styAny', 7, attachments) end @@ -138,7 +138,7 @@ def demoMailWasher(t) } sortColumn = 6 - t.notify_bind(t, 'Header-invoke', + t.notify_bind(t, 'Header-invoke', proc{|c, w| if c == sortColumn if w.column_cget(sortColumn, :arrow) == 'down' @@ -162,35 +162,35 @@ def demoMailWasher(t) w.column_configure(c, :arrow=>arrow) case w.column_cget(c, :tag) when 'bounce', 'delete' - w.item_sort(:root, order, - { - :column=>c, + w.item_sort(:root, order, + { + :column=>c, :command=>proc{|item1, item2| compareOnOff(w, c, item1, item2) } - }, + }, { :column=>'subject', :dictionary=>true }) when 'status' - w.item_sort(:root, order, + w.item_sort(:root, order, { :column=>c, :dictionary=>true }) when 'from' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'subject' - w.item_sort(:root, order, + w.item_sort(:root, order, { :column=>c, :dictionary=>true }) when 'size' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'received' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'attachments' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) end }, '%C %T') @@ -198,7 +198,7 @@ def demoMailWasher(t) mailWasher = TkBindTag.new if $Version_1_1_OrLater - mailWasher.bind('ButtonPress-1', + mailWasher.bind('ButtonPress-1', proc{|w, x, y| id = w.identify(x, y) if id.empty? @@ -214,7 +214,7 @@ def demoMailWasher(t) end }, '%W %x %y') else # TreeCtrl 1.0 - mailWasher.bind('ButtonPress-1', + mailWasher.bind('ButtonPress-1', proc{|w, x, y| id = w.identify(x, y) if id.empty? diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb b/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb index c3af86868e..d966807866 100644 --- a/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb +++ b/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb @@ -7,7 +7,7 @@ def demoOutlookFolders(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>true, + t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>true, :showroot=>true, :showrootbutton=>false, :showbuttons=>true) if $HasColumnCreate @@ -17,15 +17,15 @@ def demoOutlookFolders(t) end t.element_create('e1', :image) - t.element_create('e2', :text, :lines=>1, + t.element_create('e2', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('e3', :text, :lines=>1, :font=>t.font.dup.weight(:bold), + t.element_create('e3', :text, :lines=>1, :font=>t.font.dup.weight(:bold), :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('e4', :text, :fill=>'blue') t.element_create('e5', :image, :image=>@images['outlook-folder']) - t.element_create('e6', :rect, :showfocus=>true, + t.element_create('e6', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -60,28 +60,28 @@ def demoOutlookFolders(t) t.style_layout(s, 'e6', :union=>['e3'], :iexpand=>:ns, :ipadx=>2) t.item_style_set(:root, 0, 's1') - t.item_complex(:root, + t.item_complex(:root, [ - ['e1', {:image=>@images['outlook-main']}], + ['e1', {:image=>@images['outlook-main']}], ['e2', {:text=>'Outlook Express'}] ]) parentList = [:root, '', '', '', '', '', ''] parent = :root [ - [0, :local, "Local Folders", true, 0], - [1, :inbox, 'Inbox', false, 5], - [1, :outbox, 'Outbox', false, 0], - [1, :sent, "Sent Items", false, 0], - [1, :deleted, "Deleted Items", false, 50], - [1, :draft, 'Drafts', false, 0], - [1, :folder, "Messages to Dad", false, 0], - [1, :folder, "Messages to Sis", false, 0], - [1, :folder, "Messages to Me", false, 0], - [2, :folder, "2001", false, 0], - [2, :folder, "2000", false, 0], - [2, :folder, "1999", false, 0], - [0, :server, "news.gmane.org", true, 0], + [0, :local, "Local Folders", true, 0], + [1, :inbox, 'Inbox', false, 5], + [1, :outbox, 'Outbox', false, 0], + [1, :sent, "Sent Items", false, 0], + [1, :deleted, "Deleted Items", false, 50], + [1, :draft, 'Drafts', false, 0], + [1, :folder, "Messages to Dad", false, 0], + [1, :folder, "Messages to Sis", false, 0], + [1, :folder, "Messages to Me", false, 0], + [2, :folder, "2001", false, 0], + [2, :folder, "2000", false, 0], + [2, :folder, "1999", false, 0], + [0, :server, "news.gmane.org", true, 0], [1, :group, "gmane.comp.lang.lua.general", false, 498] ].each{|depth, img, text, button, unread| if $Version_1_1_OrLater @@ -93,7 +93,7 @@ def demoOutlookFolders(t) if img == :folder if unread != 0 t.item_style_set(item, 0, 's4') - t.item_complex(item, + t.item_complex(item, [['e3', {:text=>text}], ['e4', {:text=>"(#{unread})"}]]) else t.item_style_set(item, 0, 's3') @@ -102,17 +102,17 @@ def demoOutlookFolders(t) else if unread != 0 t.item_style_set(item, 0, 's2') - t.item_complex(item, + t.item_complex(item, [ - ['e1', {:image=>@images["outlook-#{img}"]}], - ['e3', {:text=>text}], + ['e1', {:image=>@images["outlook-#{img}"]}], + ['e3', {:text=>text}], ['e4', {:text=>"(#{unread})"}] ]) else t.item_style_set(item, 0, 's1') - t.item_complex(item, + t.item_complex(item, [ - ['e1', {:image=>@images["outlook-#{img}"]}], + ['e1', {:image=>@images["outlook-#{img}"]}], ['e2', {:text=>text}] ]) end diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb index d7e7f7e004..3495522e5c 100644 --- a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb +++ b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb @@ -6,7 +6,7 @@ def demoOutlookNewsgroup(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, + t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, :showroot=>false, :showrootbutton=>false, :showbuttons=>true) if $Version_1_1_OrLater @@ -24,7 +24,7 @@ def demoOutlookNewsgroup(t) t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject') t.column_configure(4, :text=>'From', :width=>150, :tag=>'from') t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent') - t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right, + t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right, :tag=>'size') end @@ -37,35 +37,35 @@ def demoOutlookNewsgroup(t) # State for a message with unread descendants t.state_define('unread') - t.element_create('elemImg', :image, + t.element_create('elemImg', :image, :image=>[ - @sel_images['outlook-read-2'], - ['selected', 'read', 'unread', '!open'], + @sel_images['outlook-read-2'], + ['selected', 'read', 'unread', '!open'], @images['outlook-read-2'], ['read', 'unread', '!open'], - @sel_images['outlook-read'], ['selected', 'read'], - @images['outlook-read'], ['read'], - @sel_images['outlook-unread'], ['selected'], + @sel_images['outlook-read'], ['selected', 'read'], + @images['outlook-read'], ['read'], + @sel_images['outlook-unread'], ['selected'], @images['outlook-unread'], [] ]) - t.element_create('elemTxt', :text, :lines=>1, - :fill=>[@SystemHighlightText, ['selected', 'focus']], + t.element_create('elemTxt', :text, :lines=>1, + :fill=>[@SystemHighlightText, ['selected', 'focus']], :font=>[ - t.font.dup.weight(:bold), ['read', 'unread', '!open'], + t.font.dup.weight(:bold), ['read', 'unread', '!open'], t.font.dup.weight(:bold), ['!read'] ]) - t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true, + t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) - t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true, + t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) - t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true, + t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -74,7 +74,7 @@ def demoOutlookNewsgroup(t) t.style_elements(s, ['sel.e', 'elemImg', 'elemTxt']) t.style_layout(s, 'elemImg', :expand=>:ns) t.style_layout(s, 'elemTxt', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) - t.style_layout(s, 'sel.e', :union=>['elemTxt'], + t.style_layout(s, 'sel.e', :union=>['elemTxt'], :iexpand=>:nes, :ipadx=>[2,0]) # Text @@ -168,12 +168,12 @@ def demoOutlookNewsgroup(t) } # Do something when the selection changes - t.notify_bind(t, 'Selection', + t.notify_bind(t, 'Selection', proc{|w| if w.selection_count == 1 # One item is selected if @Message[:afterId][:id] - Tk.after_cancel(@Message[:afterId][:id]) + Tk.after_cancel(@Message[:afterId][:id]) end @Message[:afterId][:item] = w.selection_get[0] @Message[:afterId][:id] = Tk.after(500, proc{ @@ -208,7 +208,7 @@ def demoOutlookNewsgroup2(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, + t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, :showroot=>false, :showrootbutton=>false, :showbuttons=>true) if $Version_1_1_OrLater @@ -226,7 +226,7 @@ def demoOutlookNewsgroup2(t) t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject') t.column_configure(4, :text=>'From', :width=>150, :tag=>'from') t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent') - t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right, + t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right, :tag=>'size') end @@ -235,24 +235,24 @@ def demoOutlookNewsgroup2(t) t.element_create('image.unread', :image, :image=>@images['outlook-unread']) t.element_create('image.read', :image, :image=>@images['outlook-read']) t.element_create('image.read2', :image, :image=>@images['outlook-read-2']) - t.element_create('text.read', :text, :lines=>1, + t.element_create('text.read', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('text.unread', :text, :lines=>1, - :fill=>[@SystemHighlightText, ['selected', 'focus']], + t.element_create('text.unread', :text, :lines=>1, + :fill=>[@SystemHighlightText, ['selected', 'focus']], :font=>t.font.dup.weight(:bold)) - t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true, + t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) - t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true, + t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) - t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true, + t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -261,7 +261,7 @@ def demoOutlookNewsgroup2(t) t.style_elements(s, ['sel.e', 'image.unread', 'text.unread']) t.style_layout(s, 'image.unread', :expand=>:ns) t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) - t.style_layout(s, 'sel.e', :union=>['text.unread'], + t.style_layout(s, 'sel.e', :union=>['text.unread'], :iexpand=>:nes, :ipadx=>[2,0]) # Image + text @@ -269,7 +269,7 @@ def demoOutlookNewsgroup2(t) t.style_elements(s, ['sel.e', 'image.read', 'text.read']) t.style_layout(s, 'image.read', :expand=>:ns) t.style_layout(s, 'text.read', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) - t.style_layout(s, 'sel.e', :union=>['text.read'], + t.style_layout(s, 'sel.e', :union=>['text.read'], :iexpand=>:nes, :ipadx=>[2,0]) # Image + text @@ -277,7 +277,7 @@ def demoOutlookNewsgroup2(t) t.style_elements(s, ['sel.e', 'image.read2', 'text.unread']) t.style_layout(s, 'image.read2', :expand=>:ns) t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) - t.style_layout(s, 'sel.e', :union=>['text.unread'], + t.style_layout(s, 'sel.e', :union=>['text.unread'], :iexpand=>:nes, :ipadx=>[2,0]) # Text @@ -350,7 +350,7 @@ def demoOutlookNewsgroup2(t) style = 'unread' style2 = 'unread2' end - t.item_style_set(i, 3, style, 4, "#{style2}.we", 5, "#{style2}.we", + t.item_style_set(i, 3, style, 4, "#{style2}.we", 5, "#{style2}.we", 6, "#{style2}.w") t.item_text(i, 3, subject, 4, from, 5, sent, 6, size) if t.item_numchildren(i) > 0 @@ -359,24 +359,24 @@ def demoOutlookNewsgroup2(t) } # Do something when the selection changes - t.notify_bind(t, 'Selection', + t.notify_bind(t, 'Selection', proc{|w| if w.selection_count == 1 i = t.selection_get[0] unless @Message[:read][i] if t.item_isopen(i) || !anyUnreadDescendants(t, i) # unread -> read - t.item_style_map(i, 'subject', 'read', + t.item_style_map(i, 'subject', 'read', ['text.unread', 'text.read']) - t.item_style_map(i, 'from', 'read.we', + t.item_style_map(i, 'from', 'read.we', ['text.unread', 'text.read']) - t.item_style_map(i, 'sent', 'read.we', + t.item_style_map(i, 'sent', 'read.we', ['text.unread', 'text.read']) - t.item_style_map(i, 'size', 'read.w', + t.item_style_map(i, 'size', 'read.w', ['text.unread', 'text.read']) else # unread -> read2 - t.item_style_map(i, 'subject', 'read2', + t.item_style_map(i, 'subject', 'read2', ['text.unread', 'text.unread']) end @@ -386,34 +386,34 @@ def demoOutlookNewsgroup2(t) end }, '%T') - t.notify_bind(t, 'Expand-after', + t.notify_bind(t, 'Expand-after', proc{|w, i| if @Messge[:read][i] && anyUnreadDescendants(t, i) # read2 -> read - t.item_style_map(i, 'subject', 'read', + t.item_style_map(i, 'subject', 'read', ['text.unread', 'text.read']) # unread -> read - t.item_style_map(i, 'from', 'read.we', + t.item_style_map(i, 'from', 'read.we', ['text.unread', 'text.read']) - t.item_style_map(i, 'sent', 'read.we', + t.item_style_map(i, 'sent', 'read.we', ['text.unread', 'text.read']) - t.item_style_map(i, 'size', 'read.w', + t.item_style_map(i, 'size', 'read.w', ['text.unread', 'text.read']) end }, '%T %I') - t.notify_bind(t, 'Collapse-after', + t.notify_bind(t, 'Collapse-after', proc{|w, i| if @Messge[:read][i] && anyUnreadDescendants(t, i) # read -> read2 - t.item_style_map(i, 'subject', 'read2', + t.item_style_map(i, 'subject', 'read2', ['text.read', 'text.unread']) # read -> unread - t.item_style_map(i, 'from', 'unread.we', + t.item_style_map(i, 'from', 'unread.we', ['text.read', 'text.unread']) - t.item_style_map(i, 'sent', 'unread.we', + t.item_style_map(i, 'sent', 'unread.we', ['text.read', 'text.unread']) - t.item_style_map(i, 'size', 'unread.w', + t.item_style_map(i, 'size', 'unread.w', ['text.read', 'text.unread']) end }, '%T %I') diff --git a/ext/tk/sample/tkextlib/treectrl/random.rb b/ext/tk/sample/tkextlib/treectrl/random.rb index 2c9e614aa5..43aca63283 100644 --- a/ext/tk/sample/tkextlib/treectrl/random.rb +++ b/ext/tk/sample/tkextlib/treectrl/random.rb @@ -1,4 +1,4 @@ -# +# def random_N @RandomN[0] || 500 end @@ -11,39 +11,39 @@ def demoRandom(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:itemheight=>height, :selectmode=>:extended, - :showroot=>true, :showrootbutton=>true, :showbuttons=>true, - :showlines=>true, :scrollmargin=>16, + t.configure(:itemheight=>height, :selectmode=>:extended, + :showroot=>true, :showrootbutton=>true, :showbuttons=>true, + :showlines=>true, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) if $Version_1_1_OrLater - t.column_create(:expand=>true, :text=>'Item', + t.column_create(:expand=>true, :text=>'Item', :itembackground=>['#e0e8f0', []], :tag=>'item') - t.column_create(:text=>'Parent', :justify=>:center, + t.column_create(:text=>'Parent', :justify=>:center, :itembackground=>['gray90', []], :tag=>'parent') - t.column_create(:text=>'Depth', :justify=>:center, + t.column_create(:text=>'Depth', :justify=>:center, :itembackground=>['linen', []], :tag=>'depth') else # TreeCtrl 1.0 - t.column_configure(0, :expand=>true, :text=>'Item', + t.column_configure(0, :expand=>true, :text=>'Item', :itembackground=>['#e0e8f0', []], :tag=>'item') - t.column_configure(1, :text=>'Parent', :justify=>:center, + t.column_configure(1, :text=>'Parent', :justify=>:center, :itembackground=>['gray90', []], :tag=>'parent') - t.column_configure(2, :text=>'Depth', :justify=>:center, + t.column_configure(2, :text=>'Depth', :justify=>:center, :itembackground=>['linen', []], :tag=>'depth') end t.element_create('e1', :image, :image=>[ - @images['folder-open'], ['open'], + @images['folder-open'], ['open'], @images['folder-closed'], [] ]) t.element_create('e2', :image, :image=>@images['small-file']) - t.element_create('e3', :text, + t.element_create('e3', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('e4', :text, :fill=>'blue') t.element_create('e6', :text) - t.element_create('e5', :rect, :showfocus=>true, + t.element_create('e5', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -65,11 +65,11 @@ def demoRandom(t) t.style_layout(s, 'e6', :padx=>6, :expand=>:ns) @Priv[:sensitive, t] = [ - [:item, 's1', 'e5', 'e1', 'e3'], + [:item, 's1', 'e5', 'e1', 'e3'], [:item, 's2', 'e5', 'e2', 'e3'] ] @Priv[:dragimage, t] = [ - [:item, 's1', 'e1', 'e3'], + [:item, 's1', 'e1', 'e3'], [:item, 's2', 'e2', 'e3'] ] @@ -108,16 +108,16 @@ def demoRandom(t) t.item_hasbutton(item_i, true) end t.item_style_set(item_i, 0, 's1', 1, 's3', 2, 's3') - t.item_complex(item_i, - [ ['e3', {:text=>"Item #{i}"}], - ['e4', {:text=>"(#{numChildren})"}] ], - [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ], + t.item_complex(item_i, + [ ['e3', {:text=>"Item #{i}"}], + ['e4', {:text=>"(#{numChildren})"}] ], + [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ], [ ['e6', {:text=>"#{t.depth(item_i)}"}] ]) else t.item_style_set(item_i, 1, 's3', 2, 's3', 0, 's2') - t.item_complex(item_i, - [ ['e3', {:text=>"Item #{i}"}] ], - [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ], + t.item_complex(item_i, + [ ['e3', {:text=>"Item #{i}"}] ], + [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ], [ ['e6', {:text=>"#{t.depth(item_i)}"}] ]) end } @@ -125,46 +125,46 @@ def demoRandom(t) treeCtrlRandom = TkBindTag.new - treeCtrlRandom.bind('Double-ButtonPress-1', + treeCtrlRandom.bind('Double-ButtonPress-1', proc{|w, x, y| Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('Control-ButtonPress-1', + treeCtrlRandom.bind('Control-ButtonPress-1', proc{|w, x, y| @Priv['selectMode'] = :toggle randomButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('Shift-ButtonPress-1', + treeCtrlRandom.bind('Shift-ButtonPress-1', proc{|w, x, y| @Priv['selectMode'] = :add randomButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('ButtonPress-1', + treeCtrlRandom.bind('ButtonPress-1', proc{|w, x, y| @Priv['selectMode'] = :set randomButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('Button1-Motion', + treeCtrlRandom.bind('Button1-Motion', proc{|w, x, y| randomMotion1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('Button1-Leave', + treeCtrlRandom.bind('Button1-Leave', proc{|w, x, y| randomLeave1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('ButtonRelease-1', + treeCtrlRandom.bind('ButtonRelease-1', proc{|w, x, y| randomRelease1(w, x, y) Tk.callback_break @@ -363,7 +363,7 @@ def randomRelease1(t, x, y) t.selection_modify('', @Priv[:drop]) t[:cursor] = '' if @Priv[:drop] != '' - randomDrop(t, @Priv[:drop], @Priv.list_element(:selection), + randomDrop(t, @Priv[:drop], @Priv.list_element(:selection), @Priv[:drop, :pos]) end end @@ -479,7 +479,7 @@ def randomAutoScanCheck(t, x, y) when 'drag', 'marquee' randomMotion(t, x, y) end - @Priv[:autoscan, :afterId, t] = + @Priv[:autoscan, :afterId, t] = Tk.after(delay, proc{ randomAutoScanCheckAux(t) }) end return @@ -502,7 +502,7 @@ def demoRandom2(t) init_pics('mac-*') - t.configure(:openbuttonimage=>@images['mac-collapse'], - :closedbuttonimage=>@images['mac-expand'], + t.configure(:openbuttonimage=>@images['mac-collapse'], + :closedbuttonimage=>@images['mac-expand'], :showlines=>false) end diff --git a/ext/tk/sample/tkextlib/treectrl/www-options.rb b/ext/tk/sample/tkextlib/treectrl/www-options.rb index efa55ca06c..6a3e9c2201 100644 --- a/ext/tk/sample/tkextlib/treectrl/www-options.rb +++ b/ext/tk/sample/tkextlib/treectrl/www-options.rb @@ -3,7 +3,7 @@ def demoInternetOptions (t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('internet-*') @@ -19,14 +19,14 @@ def demoInternetOptions (t) t.state_define('on') t.element_create('e1', :image, :image=>[ - @images['internet-check-on'], ['check', 'on'], - @images['internet-check-off'], ['check'], - @images['internet-radio-on'], ['radio', 'on'], + @images['internet-check-on'], ['check', 'on'], + @images['internet-check-off'], ['check'], + @images['internet-radio-on'], ['radio', 'on'], @images['internet-radio-off'], ['radio'] ]) - t.element_create('e2', :text, + t.element_create('e2', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('e3', :rect, :showfocus=>true, + t.element_create('e3', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) s = t.style_create('s1') @@ -38,18 +38,18 @@ def demoInternetOptions (t) parentList = [:root, '', '', '', '', '', ''] parent = :root [ - [0, :print, "Printing", "", ""], - [1, :off, "Print background colors and images", "o1", ""], - [0, :search, "Search from Address bar", "", ""], - [1, :search, "When searching", "", ""], - [2, :off, "Display results, and go to the most likely sites", - "o2", "r1"], - [2, :off, "Do not search from the Address bar", "o3", "r1"], - [2, :off, "Just display the results in the main window", + [0, :print, "Printing", "", ""], + [1, :off, "Print background colors and images", "o1", ""], + [0, :search, "Search from Address bar", "", ""], + [1, :search, "When searching", "", ""], + [2, :off, "Display results, and go to the most likely sites", + "o2", "r1"], + [2, :off, "Do not search from the Address bar", "o3", "r1"], + [2, :off, "Just display the results in the main window", "o4", "r1"], - [2, :on, "Just go to the most likely site", "o5", "r1"], - [0, :security, "Security", "", ""], - [1, :on, "Check for publisher's certificate revocation", "o5", ""], + [2, :on, "Just go to the most likely site", "o5", "r1"], + [0, :security, "Security", "", ""], + [1, :on, "Check for publisher's certificate revocation", "o5", ""], [1, :off, "Check for server certificate revocation (requires restart)", "o6", ""] ].each{|depth, setting, text, option, group| @@ -73,7 +73,7 @@ def demoInternetOptions (t) t.item_state_set(item, 'radio') end else - t.item_element_configure(item, 0, 'e1', + t.item_element_configure(item, 0, 'e1', :image=>@images["internet-#{setting}"]) end t.item_lastchild(parentList[depth], item) @@ -146,7 +146,7 @@ end def demoInternetOptions_2(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('internet-*') @@ -154,9 +154,9 @@ def demoInternetOptions_2(t) t.column_configure(0, :text=>'Internet Options') t.element_create('e1', :image) - t.element_create('e2', :text, + t.element_create('e2', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('e3', :rect, :showfocus=>true, + t.element_create('e3', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) s = t.style_create('s1') @@ -168,18 +168,18 @@ def demoInternetOptions_2(t) parentList = [:root, '', '', '', '', '', ''] parent = :root [ - [0, :print, "Printing", "", ""], - [1, :off, "Print background colors and images", "o1", ""], - [0, :search, "Search from Address bar", "", ""], - [1, :search, "When searching", "", ""], - [2, :off, "Display results, and go to the most likely sites", - "o2", "r1"], - [2, :off, "Do not search from the Address bar", "o3", "r1"], - [2, :off, "Just display the results in the main window", + [0, :print, "Printing", "", ""], + [1, :off, "Print background colors and images", "o1", ""], + [0, :search, "Search from Address bar", "", ""], + [1, :search, "When searching", "", ""], + [2, :off, "Display results, and go to the most likely sites", + "o2", "r1"], + [2, :off, "Do not search from the Address bar", "o3", "r1"], + [2, :off, "Just display the results in the main window", "o4", "r1"], - [2, :on, "Just go to the most likely site", "o5", "r1"], - [0, :security, "Security", "", ""], - [1, :on, "Check for publisher's certificate revocation", "o5", ""], + [2, :on, "Just go to the most likely site", "o5", "r1"], + [0, :security, "Security", "", ""], + [1, :on, "Check for publisher's certificate revocation", "o5", ""], [1, :off, "Check for server certificate revocation (requires restart)", "o6", ""] ].each{|depth, setting, text, option, group| @@ -201,7 +201,7 @@ def demoInternetOptions_2(t) t.item_element_configure(item, 0, 'e1', :image=>img) end else - t.item_element_configure(item, 0, 'e1', + t.item_element_configure(item, 0, 'e1', :image=>@images["internet-#{setting}"]) end t.item_lastchild(parentList[depth], item) @@ -256,16 +256,16 @@ def optionButton1_2(w, x, y) else setting = :on end - w.item_element_configure(item, 0, 'e1', + w.item_element_configure(item, 0, 'e1', :image=>@images["internet-check-#{setting}"]) @Option[:setting, item] = setting else # a radiobutton current = @Option[:current, group] return if current == item.to_s - w.item_element_configure(current, 0, 'e1', + w.item_element_configure(current, 0, 'e1', :image=>@images["internet-radio-off"]) - w.item_element_configure(item, 0, 'e1', + w.item_element_configure(item, 0, 'e1', :image=>@images["internet-radio-on"]) @Option[:setting, item] = :on @Option[:current, group] = item diff --git a/ext/tk/sample/tkextlib/vu/canvItems.rb b/ext/tk/sample/tkextlib/vu/canvItems.rb index 33acf4f7e7..364f87613b 100644 --- a/ext/tk/sample/tkextlib/vu/canvItems.rb +++ b/ext/tk/sample/tkextlib/vu/canvItems.rb @@ -9,63 +9,63 @@ xbm = File.join(File.dirname(File.expand_path(__FILE__)), 'm128_000.xbm') sval = [ 11, 22, 33, 44, 55, 66, 77, 88, 99 ] -l0 = TkLabel.new(:width=>128, :height=>128, +l0 = TkLabel.new(:width=>128, :height=>128, :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) -c0 = TkCanvas.new(:width=>80, :height=>80, - :insertwidth=>0, :highlightthickness=>0, - :selectborderwidth=>0, :borderwidth=>2, - :relief=>:ridge).place(:in=>l0, :relx=>0.5, :rely=>0.5, +c0 = TkCanvas.new(:width=>80, :height=>80, + :insertwidth=>0, :highlightthickness=>0, + :selectborderwidth=>0, :borderwidth=>2, + :relief=>:ridge).place(:in=>l0, :relx=>0.5, :rely=>0.5, :anchor=>:c) -st = Tk::Vu::TkcStripchart.new(c0, 3, 3, 80, 80, - :background=>"#b7c0d7", :fill=>'slategray3', - :jumpscroll=>1, :outline=>'black', - :scaleline=>'blue', :stripline=>'red', +st = Tk::Vu::TkcStripchart.new(c0, 3, 3, 80, 80, + :background=>"#b7c0d7", :fill=>'slategray3', + :jumpscroll=>1, :outline=>'black', + :scaleline=>'blue', :stripline=>'red', :selected=>1, :values=>sval) -TkcText.create(c0, 40, 40, +TkcText.create(c0, 40, 40, :text=>Tk::TCL_PATCHLEVEL, :fill=>'cyan', :tags=>'text') -l1 = TkLabel.new(:width=>128, :height=>128, +l1 = TkLabel.new(:width=>128, :height=>128, :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) -c1 = TkCanvas.new(:width=>80, :height=>80, - :insertwidth=>0, :highlightthickness=>0, - :selectborderwidth=>0, :borderwidth=>2, - :relief=>:ridge).place(:in=>l1, :relx=>0.5, :rely=>0.5, +c1 = TkCanvas.new(:width=>80, :height=>80, + :insertwidth=>0, :highlightthickness=>0, + :selectborderwidth=>0, :borderwidth=>2, + :relief=>:ridge).place(:in=>l1, :relx=>0.5, :rely=>0.5, :anchor=>:c) -bar1 = Tk::Vu::TkcBarchart.new(c1, 3, 3, 80, 80, - :background=>"#b7c0d7", :scalevalue=>10.0, - :autocolor=>true, :selected=>1, - :outline=>'black', :barline=>'yellow', +bar1 = Tk::Vu::TkcBarchart.new(c1, 3, 3, 80, 80, + :background=>"#b7c0d7", :scalevalue=>10.0, + :autocolor=>true, :selected=>1, + :outline=>'black', :barline=>'yellow', :scalelinestyle=>0) -bar2 = Tk::Vu::TkcBarchart.new(c1, 53, 3, 80, 80, - :background=>"#b7c0d7", :scalevalue=>10.0, - :autocolor=>true, :selected=>1, - :outline=>'black', :fill=>"#b7c0d7", +bar2 = Tk::Vu::TkcBarchart.new(c1, 53, 3, 80, 80, + :background=>"#b7c0d7", :scalevalue=>10.0, + :autocolor=>true, :selected=>1, + :outline=>'black', :fill=>"#b7c0d7", :barline=>'red', :scalelinestyle=>22) -l2 = TkLabel.new(:width=>128, :height=>128, +l2 = TkLabel.new(:width=>128, :height=>128, :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) -c2 = TkCanvas.new(:width=>80, :height=>80, - :insertwidth=>0, :highlightthickness=>0, - :selectborderwidth=>0, :borderwidth=>2, - :relief=>:ridge).place(:in=>l2, :relx=>0.5, :rely=>0.5, +c2 = TkCanvas.new(:width=>80, :height=>80, + :insertwidth=>0, :highlightthickness=>0, + :selectborderwidth=>0, :borderwidth=>2, + :relief=>:ridge).place(:in=>l2, :relx=>0.5, :rely=>0.5, :anchor=>:c) begin - stick = Tk::Vu::TkcSticker.new(c2, 3, 3, 80, 80, - :text=>"Tcl/Tk", :space=>0, :color=>'red', - :outline=>'red', :font=>'Helvetica 14 bold', - :fill=>'', :stipple=>'', :bar=>'blue', - :orient=>:vertical, :anchor=>:s, - :relheight=>1.0, :relwidth=>0.15, + stick = Tk::Vu::TkcSticker.new(c2, 3, 3, 80, 80, + :text=>"Tcl/Tk", :space=>0, :color=>'red', + :outline=>'red', :font=>'Helvetica 14 bold', + :fill=>'', :stipple=>'', :bar=>'blue', + :orient=>:vertical, :anchor=>:s, + :relheight=>1.0, :relwidth=>0.15, :relx=>0.1, :rely=>0.0) rescue stick = nil diff --git a/ext/tk/sample/tkextlib/vu/canvSticker.rb b/ext/tk/sample/tkextlib/vu/canvSticker.rb index e2cd604975..85713ebcf3 100644 --- a/ext/tk/sample/tkextlib/vu/canvSticker.rb +++ b/ext/tk/sample/tkextlib/vu/canvSticker.rb @@ -14,7 +14,7 @@ c = TkCanvas.new.pack begin st = Tk::Vu::TkcSticker.new(c, 0, 0, 10, 10) rescue - Tk.messageBox(:type=>'ok', :title=>"No sticker Item", + Tk.messageBox(:type=>'ok', :title=>"No sticker Item", :message=>"This build of vu does not include the sticker item") exit end @@ -56,7 +56,7 @@ steps << proc{ steps << proc{ puts 'A vertical bar appears in the lower right region and text jumps to the left.' - st.configure(:anchor=>:n, :relw=>0.3, :relh=>0.7, + st.configure(:anchor=>:n, :relw=>0.3, :relh=>0.7, :relx=>0.6, :rely=>0.3, :bar=>'red') } diff --git a/ext/tk/sample/tkextlib/vu/canvSticker2.rb b/ext/tk/sample/tkextlib/vu/canvSticker2.rb index 548a72c2cb..3d9495ffb0 100644 --- a/ext/tk/sample/tkextlib/vu/canvSticker2.rb +++ b/ext/tk/sample/tkextlib/vu/canvSticker2.rb @@ -10,7 +10,7 @@ c = TkCanvas.new.pack begin st = Tk::Vu::TkcSticker.new(c, 0, 0, 10, 10) rescue - Tk.messageBox(:type=>'ok', :title=>"No sticker Item", + Tk.messageBox(:type=>'ok', :title=>"No sticker Item", :message=>"This build of vu does not include the sticker item") exit end @@ -22,7 +22,7 @@ c.destroy #sti_conf = [ [10, 10, 180, 180], "Sticker äöüß@²³¼½¾", :center ] #txt_conf = [ [210, 210], "Text äöüß@²³¼½¾", :center ] -sti_conf = [ [10, 10, 350, 350], +sti_conf = [ [10, 10, 350, 350], Tk::UTF8_String('Sticker \u00E4\u00F6\u00FC\u00DF\u0040\u00B2\u00B3\u00BC\u00BD\u00BE'), :center ] txt_conf = [ [250, 250], diff --git a/ext/tk/sample/tkextlib/vu/dial_demo.rb b/ext/tk/sample/tkextlib/vu/dial_demo.rb index 09bd3e9186..f1f2f110b1 100644 --- a/ext/tk/sample/tkextlib/vu/dial_demo.rb +++ b/ext/tk/sample/tkextlib/vu/dial_demo.rb @@ -12,61 +12,61 @@ v_rot = TkVariable.new v_linked = TkVariable.new v_needle = TkVariable.new -volume = Tk::Vu::Dial.new(:label=>"Volume", :from=>-0.1, :to=>0.1, - :resolution=>0.001, :minortickinterval=>0.01, - :tickinterval=>0.1, :beginangle=>-20, +volume = Tk::Vu::Dial.new(:label=>"Volume", :from=>-0.1, :to=>0.1, + :resolution=>0.001, :minortickinterval=>0.01, + :tickinterval=>0.1, :beginangle=>-20, :endangle=>260, :variable=>v_volume) -speed = Tk::Vu::Dial.new(:label=>"Speed", :from=>2000, :to=>100, - :resolution=>10, :tickinterval=>100, - :minortickinterval=>0, :variable=>v_speed, +speed = Tk::Vu::Dial.new(:label=>"Speed", :from=>2000, :to=>100, + :resolution=>10, :tickinterval=>100, + :minortickinterval=>0, :variable=>v_speed, :showtags=>:label, :showvalue=>false) speed.set_tag_constrain(100, 'Fast', 2000, 'Slow') -fwd = Tk::Vu::Dial.new(:from=>-10.0, :to=>-20.0, :resolution=>0.1, - :tickinterval=>5.0, :minortickinterval=>1.0, +fwd = Tk::Vu::Dial.new(:from=>-10.0, :to=>-20.0, :resolution=>0.1, + :tickinterval=>5.0, :minortickinterval=>1.0, :variable=>v_dir) -rev = Tk::Vu::Dial.new(:from=>-20.0, :to=>-10.0, :resolution=>0.1, - :tickinterval=>5.0, :minortickinterval=>1.0, +rev = Tk::Vu::Dial.new(:from=>-20.0, :to=>-10.0, :resolution=>0.1, + :tickinterval=>5.0, :minortickinterval=>1.0, :variable=>v_dir) -small = Tk::Vu::Dial.new(:font=>"Helvetica -10", :from=>0, :to=>10, +small = Tk::Vu::Dial.new(:font=>"Helvetica -10", :from=>0, :to=>10, :resolution=>0.05, :tickinterval=>2, - :minortickinterval=>0.5, :radius=>20, - :dialcolor=>'red2', :activebackground=>'red', + :minortickinterval=>0.5, :radius=>20, + :dialcolor=>'red2', :activebackground=>'red', :variable=>v_rot) -large = Tk::Vu::Dial.new(:font=>"Helvetica -8", :from=>0, :to=>10, +large = Tk::Vu::Dial.new(:font=>"Helvetica -8", :from=>0, :to=>10, :resolution=>0.05, :tickinterval=>1, - :minortickinterval=>0.25, :radius=>40, - :dialcolor=>'red2', :activebackground=>'red', + :minortickinterval=>0.25, :radius=>40, + :dialcolor=>'red2', :activebackground=>'red', :variable=>v_rot) -turn = Tk::Vu::Dial.new(:needlecolor=>'red', :label=>"Linked", +turn = Tk::Vu::Dial.new(:needlecolor=>'red', :label=>"Linked", :variable=>v_linked) scale = TkScale.new(:label=>"Linked", :variable=>v_linked) -d1 = Tk::Vu::Dial.new(:resolution=>0.0001, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>30, :label=>"Dial", - :beginangle=>-20, :endangle=>260, :variable=>v_needle, +d1 = Tk::Vu::Dial.new(:resolution=>0.0001, :from=>-0.1, :to=>0.1, + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>30, :label=>"Dial", + :beginangle=>-20, :endangle=>260, :variable=>v_needle, :relief=>:raised) -d2 = Tk::Vu::Dial.new(:resolution=>0.01, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>30, :label=>"Dial 2", - :beginangle=>-20, :endangle=>260, :variable=>v_needle, - :dialrelief=>:flat, :needlecolor=>'red', +d2 = Tk::Vu::Dial.new(:resolution=>0.01, :from=>-0.1, :to=>0.1, + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>30, :label=>"Dial 2", + :beginangle=>-20, :endangle=>260, :variable=>v_needle, + :dialrelief=>:flat, :needlecolor=>'red', :needletype=>:triangle, :relief=>:sunken) -d3 = Tk::Vu::Dial.new(:resolution=>0.001, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>30, :label=>"Dial 3", - :beginangle=>-20, :endangle=>260, :variable=>v_needle, - :dialrelief=>:flat, :needlecolor=>'blue', +d3 = Tk::Vu::Dial.new(:resolution=>0.001, :from=>-0.1, :to=>0.1, + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>30, :label=>"Dial 3", + :beginangle=>-20, :endangle=>260, :variable=>v_needle, + :dialrelief=>:flat, :needlecolor=>'blue', :needletype=>:arc, :relief=>:ridge) f_btns = TkFrame.new diff --git a/ext/tk/sample/tkextlib/vu/oscilloscope.rb b/ext/tk/sample/tkextlib/vu/oscilloscope.rb index 2015e46645..1efe13ce01 100644 --- a/ext/tk/sample/tkextlib/vu/oscilloscope.rb +++ b/ext/tk/sample/tkextlib/vu/oscilloscope.rb @@ -22,26 +22,26 @@ geo_t1 = [15, 88] c = TkCanvas.new(:width=>220, :height=>190).pack(:fill=>:both, :expand=>true) #---background -TkcRectangle.new(c, geo_fr, :width=>4, :fill=>'aquamarine3', +TkcRectangle.new(c, geo_fr, :width=>4, :fill=>'aquamarine3', :tags=>['osc', 'frbg']) #---channel 0 -ch0 = Tk::Vu::TkcStripchart.new(c, geo_ch0, - :fill=>'', :jumpscroll=>false, - :outline=>'', :scaleline=>'', +ch0 = Tk::Vu::TkcStripchart.new(c, geo_ch0, + :fill=>'', :jumpscroll=>false, + :outline=>'', :scaleline=>'', :stripline=>'cyan', :tags=>['osc', 'ch0']) #---channel 1 -ch1 = Tk::Vu::TkcStripchart.new(c, geo_ch1, - :fill=>'', :jumpscroll=>0, - :outline=>'', :scaleline=>'', +ch1 = Tk::Vu::TkcStripchart.new(c, geo_ch1, + :fill=>'', :jumpscroll=>0, + :outline=>'', :scaleline=>'', :stripline=>'red', :tags=>['osc', 'ch1']) #---frame TkcRectangle.new(c, geo_fr, :width=>4, :tags=>['osc', 'frfg']) #---position -txt1 = TkcText.new(c, geo_t1, :text=>"B1-Motion: X:%X\tY:%Y", +txt1 = TkcText.new(c, geo_t1, :text=>"B1-Motion: X:%X\tY:%Y", :anchor=>:nw, :tags=>['osc', 'txt1']) #---BINDINGS diff --git a/ext/tk/sample/tkextlib/vu/pie.rb b/ext/tk/sample/tkextlib/vu/pie.rb index ed598d6233..c8f9276e4e 100644 --- a/ext/tk/sample/tkextlib/vu/pie.rb +++ b/ext/tk/sample/tkextlib/vu/pie.rb @@ -26,13 +26,13 @@ quit_btn = TkButton.new(f, :text=>"Exit", :command=>proc{exit}) Tk.grid(pie, :sticky=>:news) Tk.grid(f, :sticky=>:ew) -Tk.pack(fast_btn, slow_btn, quit_btn, +Tk.pack(fast_btn, slow_btn, quit_btn, :in=>f, :side=>:left, :fill=>:both, :expand=>true, :padx=>6, :pady=>4) Tk.root.grid_columnconfigure(0, :weight=>1) Tk.root.grid_rowconfigure(0, :weight=>1) -priv = { +priv = { :x=>0, :y=>0, :pie_in=>false, :angle=>pie[:angle], :origin=>pie[:origin] } @@ -46,9 +46,9 @@ pie.bind('ButtonPress-1', proc{|w, x, y| pie.bind('B1-Motion', proc{|w, x, y| if priv[:pie_in] - w.configure(:angle=>priv[:angle] + (priv[:y] - y)/3, - :origin=>(priv[:origin] + - ((w.winfo_height/2.2 > y)? -1: 1) * + w.configure(:angle=>priv[:angle] + (priv[:y] - y)/3, + :origin=>(priv[:origin] + + ((w.winfo_height/2.2 > y)? -1: 1) * (priv[:x] - x)/3) % 360) end }, '%W %x %y') diff --git a/ext/tk/sample/tkextlib/vu/vu_demo.rb b/ext/tk/sample/tkextlib/vu/vu_demo.rb index d078ae16f2..358d32495f 100644 --- a/ext/tk/sample/tkextlib/vu/vu_demo.rb +++ b/ext/tk/sample/tkextlib/vu/vu_demo.rb @@ -9,13 +9,13 @@ puts "Show off barchart and dial widgets" speed = TkVariable.new(0) -dial = Tk::Vu::Dial.new(:resolution=>0.001, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>50, :label=>"Dial", - :beginangle=>-20, :endangle=>260, :dialcolor=>'red3', +dial = Tk::Vu::Dial.new(:resolution=>0.001, :from=>-0.1, :to=>0.1, + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>50, :label=>"Dial", + :beginangle=>-20, :endangle=>260, :dialcolor=>'red3', :active=>'red2', :variable=>speed) -bar = Tk::Vu::Bargraph.new(:from=>0, :to=>100, :relief=>:groove, +bar = Tk::Vu::Bargraph.new(:from=>0, :to=>100, :relief=>:groove, :border=>2, :label=>"Bar Chart") ####################################### @@ -26,7 +26,7 @@ purple = 75 current = 50 def rand_bool - + end update = TkTimer.new(200, -1, proc{ @@ -61,7 +61,7 @@ Tk.grid('x', nobar, :sticky=>:ew, :padx=>4, :pady=>4) Tk.grid(quit, '-', '-', :sticky=>:ew, :padx=>4, :pady=>4) Tk.root.grid_columnconfigure(2, :weight=>1) Tk.root.grid_rowconfigure(1, :weight=>1) - + ####################################### Tk.mainloop diff --git a/ext/tk/sample/tkfrom.rb b/ext/tk/sample/tkfrom.rb index 2cece7337e..f51f7f5d85 100644 --- a/ext/tk/sample/tkfrom.rb +++ b/ext/tk/sample/tkfrom.rb @@ -22,7 +22,7 @@ class Mail @body = [] while line = f.gets() $_.chop! - next if /^From / =~ line # skip From-line + next if /^From / =~ line # skip From-line break if /^$/ =~ line # end of header if /^(\S+):\s*(.*)/ =~ line @header[attr = $1.capitalize] = $2 diff --git a/ext/tk/sample/tkhello.rb b/ext/tk/sample/tkhello.rb index 3b505f4983..597c1f6242 100644 --- a/ext/tk/sample/tkhello.rb +++ b/ext/tk/sample/tkhello.rb @@ -1,6 +1,6 @@ require "tk" -TkButton.new(nil, +TkButton.new(nil, :text => 'hello', :command => proc{print "hello\n"}).pack(:fill=>'x') TkButton.new(nil, diff --git a/ext/tk/sample/tkmenubutton.rb b/ext/tk/sample/tkmenubutton.rb index 37f6128fd9..8ae1359425 100644 --- a/ext/tk/sample/tkmenubutton.rb +++ b/ext/tk/sample/tkmenubutton.rb @@ -7,56 +7,56 @@ require 'tk' TkLabel.new(:text=>'Sample of TkMenubutton').pack(:side=>:top) TkFrame.new{|f| - pack(:side=>:top) + pack(:side=>:top) - TkMenubutton.new(:parent=>f, :text=>'Right', :underline=>0, + TkMenubutton.new(:parent=>f, :text=>'Right', :underline=>0, :direction=>:right, :relief=>:raised){|mb| menu TkMenu.new(:parent=>mb, :tearoff=>0){ - add(:command, :label=>'Right menu: first item', - :command=>proc{print 'You have selected the first item' + + add(:command, :label=>'Right menu: first item', + :command=>proc{print 'You have selected the first item' + " from the Right menu.\n"}) - add(:command, :label=>'Right menu: second item', - :command=>proc{print 'You have selected the second item' + + add(:command, :label=>'Right menu: second item', + :command=>proc{print 'You have selected the second item' + " from the Right menu.\n"}) } pack(:side=>:left, :padx=>25, :pady=>25) } - TkMenubutton.new(:parent=>f, :text=>'Below', :underline=>0, + TkMenubutton.new(:parent=>f, :text=>'Below', :underline=>0, :direction=>:below, :relief=>:raised){|mb| menu(TkMenu.new(:parent=>mb, :tearoff=>0){ - add(:command, :label=>'Below menu: first item', - :command=>proc{print 'You have selected the first item' + + add(:command, :label=>'Below menu: first item', + :command=>proc{print 'You have selected the first item' + " from the Below menu.\n"}) - add(:command, :label=>'Below menu: second item', - :command=>proc{print 'You have selected the second item' + + add(:command, :label=>'Below menu: second item', + :command=>proc{print 'You have selected the second item' + " from the Below menu.\n"}) }) pack(:side=>:left, :padx=>25, :pady=>25) } - TkMenubutton.new(:parent=>f, :text=>'Above', :underline=>0, + TkMenubutton.new(:parent=>f, :text=>'Above', :underline=>0, :direction=>:above, :relief=>:raised){|mb| menu TkMenu.new(:parent=>mb, :tearoff=>0){ - add(:command, :label=>'Above menu: first item', - :command=>proc{print 'You have selected the first item' + + add(:command, :label=>'Above menu: first item', + :command=>proc{print 'You have selected the first item' + " from the Above menu.\n"}) - add(:command, :label=>'Above menu: second item', - :command=>proc{print 'You have selected the second item' + + add(:command, :label=>'Above menu: second item', + :command=>proc{print 'You have selected the second item' + " from the Above menu.\n"}) } pack(:side=>:left, :padx=>25, :pady=>25) } - TkMenubutton.new(:parent=>f, :text=>'Left', :underline=>0, + TkMenubutton.new(:parent=>f, :text=>'Left', :underline=>0, :direction=>:left, :relief=>:raised){|mb| menu(TkMenu.new(:parent=>mb, :tearoff=>0){ - add(:command, :label=>'Left menu: first item', - :command=>proc{print 'You have selected the first item' + + add(:command, :label=>'Left menu: first item', + :command=>proc{print 'You have selected the first item' + " from the Left menu.\n"}) - add(:command, :label=>'Left menu: second item', - :command=>proc{print 'You have selected the second item' + + add(:command, :label=>'Left menu: second item', + :command=>proc{print 'You have selected the second item' + " from the Left menu.\n"}) }) pack(:side=>:left, :padx=>25, :pady=>25) @@ -64,20 +64,20 @@ TkFrame.new{|f| } ############################ -TkFrame.new(:borderwidth=>2, :relief=>:sunken, +TkFrame.new(:borderwidth=>2, :relief=>:sunken, :height=>5).pack(:side=>:top, :fill=>:x, :padx=>20) ############################ TkLabel.new(:text=>'Sample of TkOptionMenu').pack(:side=>:top) -colors = %w(Black red4 DarkGreen NavyBlue gray75 Red Green Blue gray50 +colors = %w(Black red4 DarkGreen NavyBlue gray75 Red Green Blue gray50 Yellow Cyan Magenta White Brown DarkSeaGreen DarkViolet) TkFrame.new{|f| - pack(:side=>:top) + pack(:side=>:top) - b1 = TkOptionMenubutton . - new(:parent=>f, :values=>%w(one two three)) . + b1 = TkOptionMenubutton . + new(:parent=>f, :values=>%w(one two three)) . pack(:side=>:left, :padx=>25, :pady=>25) b2 = TkOptionMenubutton.new(:parent=>f, :values=>colors) {|optMB| @@ -96,7 +96,7 @@ TkFrame.new{|f| put 'Black', *[14, 2, 16, 14] put color, *[ 2, 2, 14, 14] } - optMB.entryconfigure(color, :hidemargin=>1, + optMB.entryconfigure(color, :hidemargin=>1, :image=>no_sel, :selectimage=>sel) } optMB.menuconfigure(:tearoff, 1) @@ -114,7 +114,7 @@ TkFrame.new{|f| } ############################ -TkFrame.new(:borderwidth=>2, :relief=>:sunken, +TkFrame.new(:borderwidth=>2, :relief=>:sunken, :height=>5).pack(:side=>:top, :fill=>:x, :padx=>20) ############################ diff --git a/ext/tk/sample/tkmsgcat-load_rb.rb b/ext/tk/sample/tkmsgcat-load_rb.rb index 5373e0086f..98a91fadf4 100644 --- a/ext/tk/sample/tkmsgcat-load_rb.rb +++ b/ext/tk/sample/tkmsgcat-load_rb.rb @@ -15,7 +15,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| TkComm.window(frame).background(color) Tk.update TkComm.window(label).text( - msgcat["%1$s:: %2$s", 'Color', + msgcat["%1$s:: %2$s", 'Color', color.capitalize]) w.flash; w.flash Tk.callback_break; @@ -23,7 +23,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| del_proc = TkComm.install_cmd(proc{top_win.destroy; top_win = nil}) -err_proc = TkComm.install_cmd(proc{fail(RuntimeError, +err_proc = TkComm.install_cmd(proc{fail(RuntimeError, msgcat['Application Error'])}) show_sample = proc{|loc| @@ -38,10 +38,10 @@ show_sample = proc{|loc| pack(:pady=>10, :padx=>10) } - lbl = TkLabel.new(top_win, :text=>msgcat["%1$s:: %2$s", + lbl = TkLabel.new(top_win, :text=>msgcat["%1$s:: %2$s", 'Color', '']).pack(:anchor=>'w') - bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, + bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, :expand=>true, :fill=>:both) TkFrame.new(bg){|f| @@ -53,9 +53,9 @@ show_sample = proc{|loc| }.pack(:anchor=>'center', :pady=>15) TkFrame.new(top_win){|f| - TkButton.new(f, :text=>msgcat['Delete'], + TkButton.new(f, :text=>msgcat['Delete'], :command=>del_proc).pack(:side=>:right, :padx=>5) - TkButton.new(f, :text=>msgcat['Error'], + TkButton.new(f, :text=>msgcat['Error'], :command=>err_proc).pack(:side=>:left, :padx=>5) }.pack(:side=>:bottom, :fill=>:x) @@ -67,7 +67,7 @@ show_sample = proc{|loc| TkLabel.new(:text=>"Please click a locale.").pack(:padx=>5, :pady=>3) TkFrame.new{|f| - TkButton.new(f, :text=>msgcat['Exit'], + TkButton.new(f, :text=>msgcat['Exit'], :command=>proc{exit}).pack(:side=>:right, :padx=>5) }.pack(:side=>:bottom, :fill=>:x) @@ -90,7 +90,7 @@ lbox.bind('ButtonRelease-1'){|ev| lbox.insert('end', 'default') -Dir.entries(msgcat_dir).sort.each{|f| +Dir.entries(msgcat_dir).sort.each{|f| if f =~ /^(.*).msg$/ lbox.insert('end', $1) end diff --git a/ext/tk/sample/tkmsgcat-load_rb2.rb b/ext/tk/sample/tkmsgcat-load_rb2.rb index 55246545c8..05512a3131 100644 --- a/ext/tk/sample/tkmsgcat-load_rb2.rb +++ b/ext/tk/sample/tkmsgcat-load_rb2.rb @@ -15,7 +15,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| TkComm.window(frame).background(color) Tk.update TkComm.window(label).text( - msgcat["%1$s:: %2$s", 'Color', + msgcat["%1$s:: %2$s", 'Color', color.capitalize]) w.flash; w.flash Tk.callback_break; @@ -23,7 +23,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| del_proc = TkComm.install_cmd(proc{top_win.destroy; top_win = nil}) -err_proc = TkComm.install_cmd(proc{fail(RuntimeError, +err_proc = TkComm.install_cmd(proc{fail(RuntimeError, msgcat['Application Error'])}) show_sample = proc{|loc| @@ -38,10 +38,10 @@ show_sample = proc{|loc| pack(:pady=>10, :padx=>10) } - lbl = TkLabel.new(top_win, :text=>msgcat["%1$s:: %2$s", + lbl = TkLabel.new(top_win, :text=>msgcat["%1$s:: %2$s", 'Color', '']).pack(:anchor=>'w') - bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, + bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, :expand=>true, :fill=>:both) TkFrame.new(bg){|f| @@ -53,9 +53,9 @@ show_sample = proc{|loc| }.pack(:anchor=>'center', :pady=>15) TkFrame.new(top_win){|f| - TkButton.new(f, :text=>msgcat['Delete'], + TkButton.new(f, :text=>msgcat['Delete'], :command=>del_proc).pack(:side=>:right, :padx=>5) - TkButton.new(f, :text=>msgcat['Error'], + TkButton.new(f, :text=>msgcat['Error'], :command=>err_proc).pack(:side=>:left, :padx=>5) }.pack(:side=>:bottom, :fill=>:x) @@ -67,7 +67,7 @@ show_sample = proc{|loc| TkLabel.new(:text=>"Please click a locale.").pack(:padx=>5, :pady=>3) TkFrame.new{|f| - TkButton.new(f, :text=>msgcat['Exit'], + TkButton.new(f, :text=>msgcat['Exit'], :command=>proc{exit}).pack(:side=>:right, :padx=>5) }.pack(:side=>:bottom, :fill=>:x) @@ -90,7 +90,7 @@ lbox.bind('ButtonRelease-1'){|ev| lbox.insert('end', 'default') -Dir.entries(msgcat_dir).sort.each{|f| +Dir.entries(msgcat_dir).sort.each{|f| if f =~ /^(.*).msg$/ lbox.insert('end', $1) end diff --git a/ext/tk/sample/tkmsgcat-load_tk.rb b/ext/tk/sample/tkmsgcat-load_tk.rb index 45d68e4e0b..703f471e19 100644 --- a/ext/tk/sample/tkmsgcat-load_tk.rb +++ b/ext/tk/sample/tkmsgcat-load_tk.rb @@ -14,7 +14,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| TkComm.window(frame).background(color) Tk.update TkComm.window(label).text( - msgcat.mc("%1$s:: %2$s", 'Color', + msgcat.mc("%1$s:: %2$s", 'Color', color.capitalize)) w.flash; w.flash Tk.callback_break; @@ -22,7 +22,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| del_proc = TkComm.install_cmd(proc{top_win.destroy; top_win = nil}) -err_proc = TkComm.install_cmd(proc{fail(RuntimeError, +err_proc = TkComm.install_cmd(proc{fail(RuntimeError, msgcat.mc('Application Error'))}) show_sample = proc{|loc| @@ -36,10 +36,10 @@ show_sample = proc{|loc| pack(:pady=>10, :padx=>10) } - lbl = TkLabel.new(top_win, :text=>msgcat.mc("%1$s:: %2$s", + lbl = TkLabel.new(top_win, :text=>msgcat.mc("%1$s:: %2$s", 'Color', '')).pack(:anchor=>'w') - bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, + bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, :expand=>true, :fill=>:both) TkFrame.new(bg){|f| @@ -48,7 +48,7 @@ show_sample = proc{|loc| bind('ButtonRelease-1', col_proc, "#{col} #{bg.path} #{lbl.path}") }.pack(:fill=>:x) =begin - TkButton.new(f, :text=>msgcat.mc(col), + TkButton.new(f, :text=>msgcat.mc(col), :command=>proc{ bg.background col lbl.text msgcat.mc("%1$s:: %2$s", 'Color', col.capitalize) @@ -58,17 +58,17 @@ show_sample = proc{|loc| }.pack(:anchor=>'center', :pady=>15) TkFrame.new(top_win){|f| - TkButton.new(f, :text=>msgcat.mc('Delete'), + TkButton.new(f, :text=>msgcat.mc('Delete'), :command=>del_proc).pack(:side=>:right, :padx=>5) - TkButton.new(f, :text=>msgcat.mc('Error'), + TkButton.new(f, :text=>msgcat.mc('Error'), :command=>err_proc).pack(:side=>:left, :padx=>5) =begin - TkButton.new(f, :text=>msgcat.mc('Delete'), + TkButton.new(f, :text=>msgcat.mc('Delete'), :command=>proc{ top_win.destroy top_win = nil }).pack(:side=>:right, :padx=>5) - TkButton.new(f, :text=>msgcat.mc('Error'), + TkButton.new(f, :text=>msgcat.mc('Error'), :command=>proc{ fail RuntimeError, msgcat.mc('Application Error') }).pack(:side=>:left, :padx=>5) @@ -83,7 +83,7 @@ show_sample = proc{|loc| TkLabel.new(:text=>"Please click a locale.").pack(:padx=>5, :pady=>3) TkFrame.new{|f| - TkButton.new(f, :text=>msgcat.mc('Exit'), + TkButton.new(f, :text=>msgcat.mc('Exit'), :command=>proc{exit}).pack(:side=>:right, :padx=>5) }.pack(:side=>:bottom, :fill=>:x) @@ -106,7 +106,7 @@ lbox.bind('ButtonRelease-1'){|ev| lbox.insert('end', 'default') -Dir.entries(msgcat_dir).sort.each{|f| +Dir.entries(msgcat_dir).sort.each{|f| if f =~ /^(.*).msg$/ lbox.insert('end', $1) end diff --git a/ext/tk/sample/tkmulticolumnlist.rb b/ext/tk/sample/tkmulticolumnlist.rb index 255eb691e5..a1b3a1a2fa 100644 --- a/ext/tk/sample/tkmulticolumnlist.rb +++ b/ext/tk/sample/tkmulticolumnlist.rb @@ -32,7 +32,7 @@ class TkMultiColumnList < TkText # decide total width @lbox_total = title_info.size @width_total = 0 - title_info.each{|title, width, cmd| + title_info.each{|title, width, cmd| @width_total += width.to_f @title_cmd << cmd } @@ -54,28 +54,28 @@ class TkMultiColumnList < TkText @command = nil # virtical scrollbar - @v_scroll = TkYScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @v_scroll = TkYScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'width'=>@scrbar_width) # horizontal scrollbar - @h_scroll = TkXScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @h_scroll = TkXScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'width'=>@scrbar_width) # create base flames - @c_title = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_title = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_title = TkFrame.new(@c_title, 'width'=>@width_total) - @w_title = TkcWindow.new(@c_title, 0, 0, + @w_title = TkcWindow.new(@c_title, 0, 0, 'window'=>@f_title, 'anchor'=>'nw') - @c_lbox = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_lbox = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_lbox = TkFrame.new(@c_lbox, 'width'=>@width_total) @w_lbox = TkcWindow.new(@c_lbox, 0, 0, 'window'=>@f_lbox, 'anchor'=>'nw') - @c_hscr = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_hscr = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_hscr = TkFrame.new(@c_hscr, 'width'=>@width_total) @w_hscr = TkcWindow.new(@c_hscr, 0, 0, 'window'=>@f_hscr, 'anchor'=>'nw') @@ -99,28 +99,28 @@ class TkMultiColumnList < TkText f = TkFrame.new(@f_title, 'width'=>width) base = [f] - title = TkLabel.new(f, 'text'=>label, 'borderwidth'=>@title_border, + title = TkLabel.new(f, 'text'=>label, 'borderwidth'=>@title_border, 'relief'=>'raised', 'highlightthickness'=>@h_l_thick) title_binding(title, idx) title.pack('fill'=>'x') @title_list << title - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, - 'relheight'=>1.0, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + 'relheight'=>1.0, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) # listbox field f = TkFrame.new(@f_lbox, 'width'=>width) base << f - @lbox_list << TkText.new(f, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@lbox_border, - 'takefocus'=>false, + @lbox_list << TkText.new(f, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@lbox_border, + 'takefocus'=>false, 'wrap'=>'none') { bindtags(bindtags - [TkText]) - @seltag = TkTextTag.new(self, 'background'=>'#b3b3b3', + @seltag = TkTextTag.new(self, 'background'=>'#b3b3b3', 'borderwidth'=>1, 'relief'=>'raised') def self.nearest(y) self.index("@1,#{y}").split('.')[0].to_i @@ -151,17 +151,17 @@ class TkMultiColumnList < TkText pack('fill'=>'both', 'expand'=>true) } - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) # scrollbar field f = TkFrame.new(@f_hscr, 'width'=>width) base << f - @hscr_list << TkXScrollbar.new(f, 'width'=>@scrbar_width, - 'borderwidth'=>@scrbar_border, + @hscr_list << TkXScrollbar.new(f, 'width'=>@scrbar_width, + 'borderwidth'=>@scrbar_border, 'highlightthickness'=>@h_l_thick ).pack('fill'=>'x', 'anchor'=>'w') - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) @lbox_list[idx].xscrollbar(@hscr_list[idx]) @@ -171,23 +171,23 @@ class TkMultiColumnList < TkText } # pad - @f_title_pad = TkFrame.new(@frame, 'relief'=>'raised', - 'borderwidth'=>@title_border, + @f_title_pad = TkFrame.new(@frame, 'relief'=>'raised', + 'borderwidth'=>@title_border, 'highlightthickness'=>@h_l_thick) - @f_scr_pad = TkFrame.new(@frame, 'relief'=>'sunken', - 'borderwidth'=>1, + @f_scr_pad = TkFrame.new(@frame, 'relief'=>'sunken', + 'borderwidth'=>1, 'highlightthickness'=>@h_l_thick) # height check title_height = 0 - @title_list.each{|w| + @title_list.each{|w| h = w.winfo_reqheight title_height = h if title_height < h } hscr_height = 0 - @hscr_list.each{|w| + @hscr_list.each{|w| h = w.winfo_reqheight hscr_height = h if hscr_height < h } @@ -203,12 +203,12 @@ class TkMultiColumnList < TkText @h_scroll.assign(@c_title, @c_lbox, @c_hscr) # binding for listboxes - @lbox_list.each_with_index{|l, idx| - l.bind('Button-1', proc{|w, y| + @lbox_list.each_with_index{|l, idx| + l.bind('Button-1', proc{|w, y| @frame.focus select_line(w, w.nearest(y)) }, '%W %y') - l.bind('B1-Motion', proc{|w, y| + l.bind('B1-Motion', proc{|w, y| select_line(w, w.nearest(y)) }, '%W %y') l.bind('Double-Button-1', proc{ @@ -218,11 +218,11 @@ class TkMultiColumnList < TkText l.bind('Control-Home', proc{|w| select_line(w, 0)}, '%W') l.bind('Control-End', proc{|w| select_line(w, 'end')}, '%W') - l.bind('Button-2', proc{|x, y| + l.bind('Button-2', proc{|x, y| @lbox_mark_x = x @lbox_list.each{|lbox| lbox.scan_mark(x, y)} }, '%x %y') - l.bind('B2-Motion', proc{|x, y| + l.bind('B2-Motion', proc{|x, y| @lbox_list.each{|lbox| lbox.scan_dragto(@lbox_mark_x, y)} l.scan_dragto(x, y) }, '%x %y') @@ -265,8 +265,8 @@ class TkMultiColumnList < TkText @f_scr_pad.grid('row'=>2, 'rowspan'=>2, 'column'=>2, 'sticky'=>'news') # binding for 'Configure' event - @c_lbox.bind('Configure', - proc{|height, width| reconstruct(height, width)}, + @c_lbox.bind('Configure', + proc{|height, width| reconstruct(height, width)}, '%h %w') # set default receiver of method calls @@ -386,7 +386,7 @@ class TkMultiColumnList < TkText def titlefont(font) @title_list.each{|label| label['font'] = font} title_height = 0 - @title_list.each{|w| + @title_list.each{|w| h = w.winfo_reqheight title_height = h if title_height < h } @@ -523,7 +523,7 @@ class TkMultiColumnList < TkText array[indices[0]] = line[label] else if line[label].kind_of? Array - indices.each_with_index{|index, num| + indices.each_with_index{|index, num| array[index] = line[label][num] } else @@ -541,9 +541,9 @@ class TkMultiColumnList < TkText indices.each{|index| lbox_ins[index] << line[index]} end } - } + } - @lbox_list.each_with_index{|lbox, index| + @lbox_list.each_with_index{|lbox, index| lbox.insert(idx, cr + lbox_ins[index].join("\n")) if lbox_ins[index] } end @@ -581,7 +581,7 @@ class TkMultiColumnList < TkText (0..(@rel_list.size - 2)).each{|idx| title, lbox, hscr = @base_list[idx] title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) } @@ -608,11 +608,11 @@ class TkMultiColumnList < TkText # adjustment of rightside widget of the sash title, lbox, hscr = @base_list[idx] - title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx], 'relheight'=>1.0) - hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) # update reference position @@ -636,34 +636,34 @@ class TkMultiColumnList < TkText end def title_binding(title, index) - title.bind('Motion', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, + title.bind('Motion', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, "%W %x #{index}") - title.bind('Enter', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, + title.bind('Enter', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, "%W %x #{index}") title.bind('Leave', proc{|w| w.cursor ""}, "%W") - title.bind('Button-1', - proc{|w, x| + title.bind('Button-1', + proc{|w, x| if @mode == :sash @x = x @frame_width = TkWinfo.width(@f_title).to_f else title.relief 'sunken' end - }, + }, '%W %X') - title.bind('ButtonRelease-1', - proc{|w, x, idx| + title.bind('ButtonRelease-1', + proc{|w, x, idx| i = idx.to_i if @mode == :title && @title_cmd[i].kind_of?(Proc) @title_cmd[i].call end title.relief 'raised' motion_cb(w,x,i) - }, + }, "%W %x #{index}") title.bind('B1-Motion', proc{|x| resize(x) if @mode == :sash}, "%X") @@ -705,13 +705,13 @@ end # test ################################################ if __FILE__ == $0 - l = TkMultiColumnList.new(nil, 200, - [ ['L1', 200, proc{p 'click L1'}], - ['L2', 100], - ['L3', 200] ], - 'width'=>350, - #'titleforeground'=>'yellow', - 'titleforeground'=>'white', + l = TkMultiColumnList.new(nil, 200, + [ ['L1', 200, proc{p 'click L1'}], + ['L2', 100], + ['L3', 200] ], + 'width'=>350, + #'titleforeground'=>'yellow', + 'titleforeground'=>'white', #'titlebackground'=>'navy', 'titlebackground'=>'blue', 'titlefont'=>'courier' @@ -719,7 +719,7 @@ if __FILE__ == $0 l.insert('end', [1,2,3]) l.insert('end', [4,5,6]) l.insert('end', [4,5,6], [4,5,6]) - l.insert('end', ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + l.insert('end', ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', 'cccccccccccccccccccccccccccccccccccccccccccccccccccc']) l.insert('end', [1,2,3]) diff --git a/ext/tk/sample/tkmultilistbox.rb b/ext/tk/sample/tkmultilistbox.rb index 6f956d0edb..7791649c4b 100644 --- a/ext/tk/sample/tkmultilistbox.rb +++ b/ext/tk/sample/tkmultilistbox.rb @@ -35,10 +35,10 @@ class TkMultiListbox < TkListbox # create base flames @f_title = TkFrame.new(@frame, 'width'=>@width_total) - @f_lbox = TkFrame.new(@frame, + @f_lbox = TkFrame.new(@frame, 'width'=>@width_total, 'height'=>lbox_height) - @f_hscr = TkFrame.new(@frame, 'width'=>@width_total, - 'height'=>@v_scroll.cget('width') + + @f_hscr = TkFrame.new(@frame, 'width'=>@width_total, + 'height'=>@v_scroll.cget('width') + 2 * @v_scroll.cget('borderwidth')) # dummy label to keep the hight of title space @@ -63,25 +63,25 @@ class TkMultiListbox < TkListbox f = TkFrame.new(@f_title, 'width'=>width) base = [f] @title_list << TkLabel.new(f, 'text'=>label).pack('fill'=>'x') - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-6, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-6, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) # listbox field f = TkFrame.new(@f_lbox, 'width'=>width) base << f @lbox_list << TkListbox.new(f).pack('fill'=>'both', 'expand'=>true) - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-4, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-4, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) # scrollbar field f = TkFrame.new(@f_hscr, 'width'=>width) base << f - @hscr_list << TkScrollbar.new(f, 'orient'=>'horizontal') . + @hscr_list << TkScrollbar.new(f, 'orient'=>'horizontal') . pack('fill'=>'x', 'anchor'=>'w') - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-4, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-4, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) - @lbox_list[idx].xscrollcommand proc{|first, last| + @lbox_list[idx].xscrollcommand proc{|first, last| @hscr_list[idx].set first, last } @hscr_list[idx].command proc{|*args| @lbox_list[idx].xview *args} @@ -93,19 +93,19 @@ class TkMultiListbox < TkListbox # create tab @tab_list = [nil] (1..(@rel_list.size - 2)).each{|idx| - tab = TkFrame.new(@f_title, 'cursor'=>'sb_h_double_arrow', + tab = TkFrame.new(@f_title, 'cursor'=>'sb_h_double_arrow', 'width'=>6, 'borderwidth'=>2, 'relief'=>'raised') @tab_list << tab tab.place('relx'=>@rel_list[idx], 'anchor'=>'ne', 'relheight'=>0.95) - tab.bind('Button-1', - proc{|x| @x = x; @frame_width = TkWinfo.width(@f_title).to_f}, + tab.bind('Button-1', + proc{|x| @x = x; @frame_width = TkWinfo.width(@f_title).to_f}, '%X') tab.bind('B1-Motion', proc{|x, idx| resize(x, idx.to_i)}, "%X #{idx}") } # set control procedure for virtical scroll @lbox_list.each{|lbox| - lbox.yscrollcommand proc{|first, last| + lbox.yscrollcommand proc{|first, last| @v_scroll.set first, last } } @@ -118,17 +118,17 @@ class TkMultiListbox < TkListbox @mode['extended'] = extended_mode_bindtag @mode['multiple'] = multiple_mode_bindtag @current_mode = 'browse' - @lbox_list.each{|l| - l.bind('Shift-Key-Left', + @lbox_list.each{|l| + l.bind('Shift-Key-Left', proc{|w| focus_shift(w, -1); Tk.callback_break}, '%W') - l.bind('Shift-Key-Right', + l.bind('Shift-Key-Right', proc{|w| focus_shift(w, 1); Tk.callback_break}, '%W') - l.bind('Button-2', proc{|x, y| + l.bind('Button-2', proc{|x, y| @lbox_mark_x = x @lbox_list.each{|lbox| lbox.scan_mark(x, y)} }, '%x %y') - l.bind('B2-Motion', proc{|x, y| + l.bind('B2-Motion', proc{|x, y| @lbox_list.each{|lbox| lbox.scan_dragto(@lbox_mark_x, y)} l.scan_dragto(x, y) }, '%x %y') @@ -189,7 +189,7 @@ class TkMultiListbox < TkListbox # set 'mode' option of listboxes def mode(sel_mode) - @lbox_list.each{|l| + @lbox_list.each{|l| tags = l.bindtags tags = tags - [ @mode[@current_mode] ] l.bindtags(tags.unshift(@mode[sel_mode])) @@ -282,7 +282,7 @@ class TkMultiListbox < TkListbox array[indices[0]] = line[label] else if line[label].kind_of? Array - indices.each_with_index{|index, num| + indices.each_with_index{|index, num| array[index] = line[label][num] } else @@ -300,9 +300,9 @@ class TkMultiListbox < TkListbox indices.each{|index| lbox_ins[index] << line[index]} end } - } + } - @lbox_list.each_with_index{|lbox, index| + @lbox_list.each_with_index{|lbox, index| lbox.insert(idx, *lbox_ins[index]) if lbox_ins[index] } end @@ -326,7 +326,7 @@ class TkMultiListbox < TkListbox (0..(@rel_list.size - 2)).each{|idx| title, lbox, hscr = @base_list[idx] title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) @@ -356,11 +356,11 @@ class TkMultiListbox < TkListbox # adjustment of rightside widget of the tab title, lbox, hscr = @base_list[idx] - title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx], 'relheight'=>1.0) - hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) # update reference position @@ -370,11 +370,11 @@ class TkMultiListbox < TkListbox ################################# def browse_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_line(w, w.nearest(y))}, '%W %y') t.bind('B1-Motion', proc{|w, y| select_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| select_shift(w, -1)}, '%W') @@ -385,7 +385,7 @@ class TkMultiListbox < TkListbox t.bind('space', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t.bind('Select', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-slash', + t.bind('Control-slash', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t @@ -394,12 +394,12 @@ class TkMultiListbox < TkListbox ######################## def single_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_only(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| select_shift(w, -1)}, '%W') @@ -410,9 +410,9 @@ class TkMultiListbox < TkListbox t.bind('space', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t.bind('Select', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-slash', + t.bind('Control-slash', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-backslash', + t.bind('Control-backslash', proc{@lbox_list.each{|l| l.selection_clear(0, 'end')}}) t @@ -421,22 +421,22 @@ class TkMultiListbox < TkListbox ######################## def extended_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_only(w, w.nearest(y))}, '%W %y') t.bind('B1-Motion', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('Shift-B1-Motion', + t.bind('Shift-B1-Motion', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('Control-Button-1', + t.bind('Control-Button-1', proc{|w, y| select_toggle(w, w.nearest(y))}, '%W %y') - t.bind('Control-B1-Motion', + t.bind('Control-B1-Motion', proc{|w, y| select_drag(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| active_shift(w, -1)}, '%W') @@ -462,9 +462,9 @@ class TkMultiListbox < TkListbox ######################## def multiple_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_line3(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| active_shift(w, -1)}, '%W') @@ -624,15 +624,15 @@ end # test ################################################ if __FILE__ == $0 - f = TkFrame.new(nil, 'width'=>300, + f = TkFrame.new(nil, 'width'=>300, 'height'=>200).pack('fill'=>'both', 'expand'=>'true') #f = TkFrame.new.pack('fill'=>'both', 'expand'=>'true') - l = TkMultiListbox.new(f, 150, - [ ['L1', 100], - ['L2', 200], - ['L3', 50] ], - 'titlefont'=>'courier', - 'titleforeground'=>'yellow', + l = TkMultiListbox.new(f, 150, + [ ['L1', 100], + ['L2', 200], + ['L3', 50] ], + 'titlefont'=>'courier', + 'titleforeground'=>'yellow', 'titlebackground'=>'navy' ).pack('fill'=>'both', 'expand'=>true) l.insert('end', [1,2,3]) diff --git a/ext/tk/sample/tkmultilistframe.rb b/ext/tk/sample/tkmultilistframe.rb index ef1a0a824d..7c0aac9a9e 100644 --- a/ext/tk/sample/tkmultilistframe.rb +++ b/ext/tk/sample/tkmultilistframe.rb @@ -32,7 +32,7 @@ class TkMultiListFrame < TkListbox # decide total width @lbox_total = title_info.size @width_total = 0 - title_info.each{|title, width, cmd| + title_info.each{|title, width, cmd| @width_total += width.to_f @title_cmd << cmd } @@ -54,37 +54,37 @@ class TkMultiListFrame < TkListbox # virtical scrollbar =begin - @v_scroll = TkScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @v_scroll = TkScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'orient'=>'vertical', 'width'=>@scrbar_width) =end - @v_scroll = TkYScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @v_scroll = TkYScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'width'=>@scrbar_width) # horizontal scrollbar =begin - @h_scroll = TkScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @h_scroll = TkScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'orient'=>'horizontal', 'width'=>@scrbar_width) =end - @h_scroll = TkXScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @h_scroll = TkXScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'width'=>@scrbar_width) # create base flames - @c_title = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_title = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_title = TkFrame.new(@c_title, 'width'=>@width_total) - @w_title = TkcWindow.new(@c_title, 0, 0, + @w_title = TkcWindow.new(@c_title, 0, 0, 'window'=>@f_title, 'anchor'=>'nw') - @c_lbox = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_lbox = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_lbox = TkFrame.new(@c_lbox, 'width'=>@width_total) @w_lbox = TkcWindow.new(@c_lbox, 0, 0, 'window'=>@f_lbox, 'anchor'=>'nw') - @c_hscr = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_hscr = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_hscr = TkFrame.new(@c_hscr, 'width'=>@width_total) @w_hscr = TkcWindow.new(@c_hscr, 0, 0, 'window'=>@f_hscr, 'anchor'=>'nw') @@ -108,45 +108,45 @@ class TkMultiListFrame < TkListbox f = TkFrame.new(@f_title, 'width'=>width) base = [f] - title = TkLabel.new(f, 'text'=>label, 'borderwidth'=>@title_border, + title = TkLabel.new(f, 'text'=>label, 'borderwidth'=>@title_border, 'relief'=>'raised', 'highlightthickness'=>@h_l_thick) title_binding(title, idx) title.pack('fill'=>'x') @title_list << title - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, - 'relheight'=>1.0, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + 'relheight'=>1.0, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) # listbox field f = TkFrame.new(@f_lbox, 'width'=>width) base << f - @lbox_list << TkListbox.new(f, 'highlightthickness'=>@h_l_thick, + @lbox_list << TkListbox.new(f, 'highlightthickness'=>@h_l_thick, 'borderwidth'=>@lbox_border ).pack('fill'=>'both', 'expand'=>true) - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) # scrollbar field f = TkFrame.new(@f_hscr, 'width'=>width) base << f =begin - @hscr_list << TkScrollbar.new(f, 'orient'=>'horizontal', - 'width'=>@scrbar_width, - 'borderwidth'=>@scrbar_border, + @hscr_list << TkScrollbar.new(f, 'orient'=>'horizontal', + 'width'=>@scrbar_width, + 'borderwidth'=>@scrbar_border, 'highlightthickness'=>@h_l_thick ).pack('fill'=>'x', 'anchor'=>'w') =end - @hscr_list << TkXScrollbar.new(f, 'width'=>@scrbar_width, - 'borderwidth'=>@scrbar_border, + @hscr_list << TkXScrollbar.new(f, 'width'=>@scrbar_width, + 'borderwidth'=>@scrbar_border, 'highlightthickness'=>@h_l_thick ).pack('fill'=>'x', 'anchor'=>'w') - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) =begin - @lbox_list[idx].xscrollcommand proc{|first, last| + @lbox_list[idx].xscrollcommand proc{|first, last| @hscr_list[idx].set first, last } @hscr_list[idx].command proc{|*args| @lbox_list[idx].xview *args} @@ -159,23 +159,23 @@ class TkMultiListFrame < TkListbox # pad # @f_title_pad = TkFrame.new(@frame) - @f_title_pad = TkFrame.new(@frame, 'relief'=>'raised', - 'borderwidth'=>@title_border, + @f_title_pad = TkFrame.new(@frame, 'relief'=>'raised', + 'borderwidth'=>@title_border, 'highlightthickness'=>@h_l_thick) - @f_scr_pad = TkFrame.new(@frame, 'relief'=>'sunken', - 'borderwidth'=>1, + @f_scr_pad = TkFrame.new(@frame, 'relief'=>'sunken', + 'borderwidth'=>1, 'highlightthickness'=>@h_l_thick) # height check title_height = 0 - @title_list.each{|w| + @title_list.each{|w| h = w.winfo_reqheight title_height = h if title_height < h } hscr_height = 0 - @hscr_list.each{|w| + @hscr_list.each{|w| h = w.winfo_reqheight hscr_height = h if hscr_height < h } @@ -187,7 +187,7 @@ class TkMultiListFrame < TkListbox # set control procedure for virtical scroll =begin @lbox_list.each{|lbox| - lbox.yscrollcommand proc{|first, last| + lbox.yscrollcommand proc{|first, last| @v_scroll.set first, last } } @@ -197,16 +197,16 @@ class TkMultiListFrame < TkListbox # set control procedure for horizoncal scroll =begin - @c_title.xscrollcommand proc{|first, last| + @c_title.xscrollcommand proc{|first, last| @h_scroll.set first, last } - @c_lbox.xscrollcommand proc{|first, last| + @c_lbox.xscrollcommand proc{|first, last| @h_scroll.set first, last } - @c_hscr.xscrollcommand proc{|first, last| + @c_hscr.xscrollcommand proc{|first, last| @h_scroll.set first, last } - @h_scroll.command proc{|*args| + @h_scroll.command proc{|*args| @c_title.xview *args @c_lbox.xview *args @c_hscr.xview *args if @show_each_hscr @@ -221,17 +221,17 @@ class TkMultiListFrame < TkListbox @lbox_mode['extended'] = extended_mode_bindtag @lbox_mode['multiple'] = multiple_mode_bindtag @current_mode = 'browse' - @lbox_list.each_with_index{|l, idx| - l.bind('Shift-Key-Left', + @lbox_list.each_with_index{|l, idx| + l.bind('Shift-Key-Left', proc{|w| focus_shift(w, -1); Tk.callback_break}, '%W') - l.bind('Shift-Key-Right', + l.bind('Shift-Key-Right', proc{|w| focus_shift(w, 1); Tk.callback_break}, '%W') - l.bind('Button-2', proc{|x, y| + l.bind('Button-2', proc{|x, y| @lbox_mark_x = x @lbox_list.each{|lbox| lbox.scan_mark(x, y)} }, '%x %y') - l.bind('B2-Motion', proc{|x, y| + l.bind('B2-Motion', proc{|x, y| @lbox_list.each{|lbox| lbox.scan_dragto(@lbox_mark_x, y)} l.scan_dragto(x, y) }, '%x %y') @@ -270,8 +270,8 @@ class TkMultiListFrame < TkListbox @f_scr_pad.grid('row'=>2, 'rowspan'=>2, 'column'=>2, 'sticky'=>'news') # binding for 'Configure' event - @c_lbox.bind('Configure', - proc{|height, width| reconstruct(height, width)}, + @c_lbox.bind('Configure', + proc{|height, width| reconstruct(height, width)}, '%h %w') # set default receiver of method calls @@ -316,7 +316,7 @@ class TkMultiListFrame < TkListbox # set 'mode' option of listboxes def mode(sel_mode) - @lbox_list.each{|l| + @lbox_list.each{|l| tags = l.bindtags tags = tags - [ @lbox_mode[@current_mode] ] l.bindtags(tags.unshift(@lbox_mode[sel_mode])) @@ -395,7 +395,7 @@ class TkMultiListFrame < TkListbox def titlefont(font) @title_list.each{|label| label['font'] = font} title_height = 0 - @title_list.each{|w| + @title_list.each{|w| h = w.winfo_reqheight title_height = h if title_height < h } @@ -498,7 +498,7 @@ class TkMultiListFrame < TkListbox array[indices[0]] = line[label] else if line[label].kind_of? Array - indices.each_with_index{|index, num| + indices.each_with_index{|index, num| array[index] = line[label][num] } else @@ -516,9 +516,9 @@ class TkMultiListFrame < TkListbox indices.each{|index| lbox_ins[index] << line[index]} end } - } + } - @lbox_list.each_with_index{|lbox, index| + @lbox_list.each_with_index{|lbox, index| lbox.insert(idx, *lbox_ins[index]) if lbox_ins[index] } end @@ -560,7 +560,7 @@ class TkMultiListFrame < TkListbox (0..(@rel_list.size - 2)).each{|idx| title, lbox, hscr = @base_list[idx] title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) } @@ -587,11 +587,11 @@ class TkMultiListFrame < TkListbox # adjustment of rightside widget of the sash title, lbox, hscr = @base_list[idx] - title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx], 'relheight'=>1.0) - hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) # update reference position @@ -615,34 +615,34 @@ class TkMultiListFrame < TkListbox end def title_binding(title, index) - title.bind('Motion', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, + title.bind('Motion', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, "%W %x #{index}") - title.bind('Enter', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, + title.bind('Enter', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, "%W %x #{index}") title.bind('Leave', proc{|w| w.cursor ""}, "%W") - title.bind('Button-1', - proc{|w, x| + title.bind('Button-1', + proc{|w, x| if @mode == :sash @x = x @frame_width = TkWinfo.width(@f_title).to_f else title.relief 'sunken' end - }, + }, '%W %X') - title.bind('ButtonRelease-1', - proc{|w, x, idx| + title.bind('ButtonRelease-1', + proc{|w, x, idx| i = idx.to_i if @mode == :title && @title_cmd[i].kind_of?(Proc) @title_cmd[i].call end title.relief 'raised' motion_cb(w,x,i) - }, + }, "%W %x #{index}") title.bind('B1-Motion', proc{|x| resize(x) if @mode == :sash}, "%X") @@ -651,11 +651,11 @@ class TkMultiListFrame < TkListbox ################################# def browse_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_line(w, w.nearest(y))}, '%W %y') t.bind('B1-Motion', proc{|w, y| select_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| select_shift(w, -1)}, '%W') @@ -666,7 +666,7 @@ class TkMultiListFrame < TkListbox t.bind('space', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t.bind('Select', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-slash', + t.bind('Control-slash', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t @@ -675,12 +675,12 @@ class TkMultiListFrame < TkListbox ######################## def single_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_only(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| select_shift(w, -1)}, '%W') @@ -691,9 +691,9 @@ class TkMultiListFrame < TkListbox t.bind('space', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t.bind('Select', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-slash', + t.bind('Control-slash', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-backslash', + t.bind('Control-backslash', proc{@lbox_list.each{|l| l.selection_clear(0, 'end')}}) t @@ -702,22 +702,22 @@ class TkMultiListFrame < TkListbox ######################## def extended_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_only(w, w.nearest(y))}, '%W %y') t.bind('B1-Motion', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('Shift-B1-Motion', + t.bind('Shift-B1-Motion', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('Control-Button-1', + t.bind('Control-Button-1', proc{|w, y| select_toggle(w, w.nearest(y))}, '%W %y') - t.bind('Control-B1-Motion', + t.bind('Control-B1-Motion', proc{|w, y| select_drag(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| active_shift(w, -1)}, '%W') @@ -743,9 +743,9 @@ class TkMultiListFrame < TkListbox ######################## def multiple_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_line3(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| active_shift(w, -1)}, '%W') @@ -905,13 +905,13 @@ end # test ################################################ if __FILE__ == $0 - l = TkMultiListFrame.new(nil, 200, - [ ['L1', 200, proc{p 'click L1'}], - ['L2', 100], - ['L3', 200] ], - 'width'=>350, - #'titleforeground'=>'yellow', - 'titleforeground'=>'white', + l = TkMultiListFrame.new(nil, 200, + [ ['L1', 200, proc{p 'click L1'}], + ['L2', 100], + ['L3', 200] ], + 'width'=>350, + #'titleforeground'=>'yellow', + 'titleforeground'=>'white', #'titlebackground'=>'navy', 'titlebackground'=>'blue', 'titlefont'=>'courier' @@ -919,7 +919,7 @@ if __FILE__ == $0 l.insert('end', [1,2,3]) l.insert('end', [4,5,6]) l.insert('end', [4,5,6], [4,5,6]) - l.insert('end', ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + l.insert('end', ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', 'cccccccccccccccccccccccccccccccccccccccccccccccccccc']) l.insert('end', [1,2,3]) diff --git a/ext/tk/sample/tkoptdb-safeTk.rb b/ext/tk/sample/tkoptdb-safeTk.rb index a06098323f..3972577b0f 100644 --- a/ext/tk/sample/tkoptdb-safeTk.rb +++ b/ext/tk/sample/tkoptdb-safeTk.rb @@ -18,19 +18,19 @@ EOM if ENV['LANG'] =~ /^ja/ # read Japanese resource - ent = TkOptionDB.read_entries(File.expand_path('resource.ja', + ent = TkOptionDB.read_entries(File.expand_path('resource.ja', File.dirname(__FILE__)), 'euc-jp') else # read English resource - ent = TkOptionDB.read_entries(File.expand_path('resource.en', + ent = TkOptionDB.read_entries(File.expand_path('resource.en', File.dirname(__FILE__))) end file = File.expand_path('tkoptdb.rb', File.dirname(__FILE__)) ip = MultiTkIp.new_safeTk{ - # When a block is given to 'new_safeTk' method, + # When a block is given to 'new_safeTk' method, # the block is evaluated on $SAFE==4. ent.each{|pat, val| Tk.tk_call('option', 'add', pat, val)} } @@ -38,22 +38,22 @@ ip = MultiTkIp.new_safeTk{ print "ip.eval_proc{$SAFE} ==> ", ip.eval_proc{$SAFE}, "\n" print "\ncall 'ip.wait_on_mainloop = false'\n" -print "If 'ip.wait_on_mainloop? == true', ", - "when 'mainloop' is called on 'ip.eval_proc', ", - "'ip.eval_proc' does't return while the root window exists.\n", - "If you want to avoid that, set wait_on_mainloop to false. ", - "Then the mainloop in the eval_proc returns soon ", - "and the following steps are evaluated. \n", - "If you hate the both of them, use 'ip.bg_eval_proc' or ", +print "If 'ip.wait_on_mainloop? == true', ", + "when 'mainloop' is called on 'ip.eval_proc', ", + "'ip.eval_proc' does't return while the root window exists.\n", + "If you want to avoid that, set wait_on_mainloop to false. ", + "Then the mainloop in the eval_proc returns soon ", + "and the following steps are evaluated. \n", + "If you hate the both of them, use 'ip.bg_eval_proc' or ", "wrap 'ip.eval_proc' by a thread.\n" ip.wait_on_mainloop = false ret = ip.eval_proc{ - # When a block is given to 'eval_proc' method, + # When a block is given to 'eval_proc' method, # the block is evaluated on the IP's current safe level. - # So, the followings raises an exception. - # An Exception object of the exception is returned as a + # So, the followings raises an exception. + # An Exception object of the exception is returned as a # return value of this method. load file @@ -64,7 +64,7 @@ print "If a proc object is given, the proc is evaluated on the safe-level which safe0_cmd = Proc.new{ print 'safe0_cmd safe-level == ', $SAFE, "\n" - # This proc object keeps current safe-level ($SAFE==0). + # This proc object keeps current safe-level ($SAFE==0). load file } ip.eval_proc{safe0_cmd.call} diff --git a/ext/tk/sample/tkoptdb.rb b/ext/tk/sample/tkoptdb.rb index 47784ea238..75c21e7e47 100644 --- a/ext/tk/sample/tkoptdb.rb +++ b/ext/tk/sample/tkoptdb.rb @@ -2,21 +2,21 @@ # # sample script of TkOptionDB # -# If 'LANG' environment variable's value is started by 'ja', -# then read Japanese resource data and display Japanese button text. -# In other case, read English resource data and display English text. +# If 'LANG' environment variable's value is started by 'ja', +# then read Japanese resource data and display Japanese button text. +# In other case, read English resource data and display English text. # require "tk" if __FILE__ == $0 || !TkCore::INTERP.safe? if ENV['LANG'] =~ /^ja/ # read Japanese resource - TkOptionDB.read_with_encoding(File.expand_path('resource.ja', - File.dirname(__FILE__)), + TkOptionDB.read_with_encoding(File.expand_path('resource.ja', + File.dirname(__FILE__)), 'euc-jp') else # read English resource - TkOptionDB.readfile(File.expand_path('resource.en', + TkOptionDB.readfile(File.expand_path('resource.en', File.dirname(__FILE__))) end end @@ -24,7 +24,7 @@ end # 'show_msg' and 'bye_msg' procedures can be defined on BTN_CMD resource. # Those procedures are called under $SAFE==2 cmd = TkOptionDB.new_proc_class(:BTN_CMD, [:show_msg, :bye_msg], 3) { - # If you want to check resource string (str), + # If you want to check resource string (str), # please define __check_proc_string__(str) like this. class << self def __check_proc_string__(str) @@ -40,12 +40,12 @@ cmd = TkOptionDB.new_proc_class(:BTN_CMD, [:show_msg, :bye_msg], 3) { # following two frame widgets use same database entry TkFrame.new(:class=>'BtnFrame'){|f| pack(:padx=>5, :pady=>5) - TkButton.new(:parent=>f, :widgetname=>'hello'){ + TkButton.new(:parent=>f, :widgetname=>'hello'){ command proc{ print "($SAFE=#{$SAFE} >>>) : " cmd.show_msg(TkOptionDB.inspect) print "(<<< $SAFE=#{$SAFE})" - } + } pack(:fill=>:x, :padx=>10, :pady=>10) } TkButton.new(:command=>proc{ @@ -53,7 +53,7 @@ TkFrame.new(:class=>'BtnFrame'){|f| cmd.bye_msg print "(<<< $SAFE=#{$SAFE} ) : " exit - }, + }, :parent=>f, :widgetname=>'quit'){ pack(:fill=>:x, :padx=>10, :pady=>10) } @@ -62,12 +62,12 @@ TkFrame.new(:class=>'BtnFrame'){|f| class BtnFrame < TkFrame; end BtnFrame.new{|f| pack(:padx=>5, :pady=>5) - TkButton.new(:parent=>f, :widgetname=>'hello'){ + TkButton.new(:parent=>f, :widgetname=>'hello'){ command proc{ print "($SAFE=#{$SAFE} >>>) : " cmd.show_msg(TkOptionDB.inspect) print "(<<< $SAFE=#{$SAFE})" - } + } pack(:fill=>:x, :padx=>10, :pady=>10) } TkButton.new(:command=>proc{ @@ -75,7 +75,7 @@ BtnFrame.new{|f| cmd.bye_msg print "(<<< $SAFE=#{$SAFE})" exit - }, + }, :parent=>f, :widgetname=>'quit'){ pack(:fill=>:x, :padx=>10, :pady=>10) } @@ -84,12 +84,12 @@ BtnFrame.new{|f| # if unknown class, use default option values TkFrame.new(:class=>'BtnFrame2'){|f| pack(:padx=>5, :pady=>5) - TkButton.new(:parent=>f, :widgetname=>'hello'){ + TkButton.new(:parent=>f, :widgetname=>'hello'){ command proc{ print "($SAFE=#{$SAFE} >>>) : " cmd.show_msg(TkOptionDB.inspect) print "(<<< $SAFE=#{$SAFE})" - } + } pack(:fill=>:x, :padx=>10, :pady=>10) } TkButton.new(:command=>proc{ @@ -97,7 +97,7 @@ TkFrame.new(:class=>'BtnFrame2'){|f| cmd.bye_msg print "(<<< $SAFE=#{$SAFE})" exit - }, + }, :parent=>f, :widgetname=>'quit'){ pack(:fill=>:x, :padx=>10, :pady=>10) } diff --git a/ext/tk/sample/tkrttimer.rb b/ext/tk/sample/tkrttimer.rb index 0abd4ecbd2..1f9cbd9eb5 100644 --- a/ext/tk/sample/tkrttimer.rb +++ b/ext/tk/sample/tkrttimer.rb @@ -8,24 +8,24 @@ root = TkRoot.new(:title=>'realtime timer sample') f1 = TkFrame.new(:borderwidth=>2, :relief=>:ridge) f1.pack(:side=>:bottom, :fill=>:both) TkLabel.new(f1, :text=>'use TkTimer (TkAfter) class').pack(:anchor=>:center) -label1 = TkLabel.new(:parent=>f1, :relief=>:raised, +label1 = TkLabel.new(:parent=>f1, :relief=>:raised, :width=>10).pack(:fill=>:both) f2 = TkFrame.new(:borderwidth=>2, :relief=>:ridge) f2.pack(:side=>:bottom, :fill=>:both) TkLabel.new(f2, :text=>'use TkRTTimer class').pack -label2 = TkLabel.new(:parent=>f2, :relief=>:raised, +label2 = TkLabel.new(:parent=>f2, :relief=>:raised, :width=>10).pack(:fill=>:both) TkLabel.new(:padx=>10, :pady=>5, :justify=>'left', :text=><<EOT).pack Interval setting of each timer object is 10 ms. Each timer object counts up the value on each callback (the value is not the clock data). -The count of the TkTimer object is delayed by execution +The count of the TkTimer object is delayed by execution time of callbacks and inaccuracy of interval. -On the other hand, the count of the TkRTTimer object is -not delayed. Its callback interval is not accurate too. -But it can compute error correction about the time when +On the other hand, the count of the TkRTTimer object is +not delayed. Its callback interval is not accurate too. +But it can compute error correction about the time when a callback should start. EOT diff --git a/ext/tk/sample/tktextframe.rb b/ext/tk/sample/tktextframe.rb index bdab057d34..d50f2e5d88 100644 --- a/ext/tk/sample/tktextframe.rb +++ b/ext/tk/sample/tktextframe.rb @@ -41,9 +41,9 @@ class TkTextFrame < TkText =end # please check the differences of the following definitions option_methods( - [:scrollbarwidth, :get_scrollbarwidth], - [:textbackground, nil, :textbg_info], - :textborderwidth, + [:scrollbarwidth, :get_scrollbarwidth], + [:textbackground, nil, :textbg_info], + :textborderwidth, :textrelief ) @@ -146,17 +146,17 @@ end if __FILE__ == $0 f = TkFrame.new.pack('fill'=>'x') #t = TkTextFrame.new.pack - t = TkTextFrame.new(:textborderwidth=>3, - :textrelief=>:ridge, + t = TkTextFrame.new(:textborderwidth=>3, + :textrelief=>:ridge, :scrollbarrelief=>:ridge).pack p t.configinfo - TkButton.new(f, 'text'=>'vscr OFF', + TkButton.new(f, 'text'=>'vscr OFF', 'command'=>proc{t.vscroll(false)}).pack('side'=>'right') - TkButton.new(f, 'text'=>'vscr ON', + TkButton.new(f, 'text'=>'vscr ON', 'command'=>proc{t.vscroll(true)}).pack('side'=>'right') - TkButton.new(f, 'text'=>'hscr ON', + TkButton.new(f, 'text'=>'hscr ON', 'command'=>proc{t.hscroll(true)}).pack('side'=>'left') - TkButton.new(f, 'text'=>'hscr OFF', + TkButton.new(f, 'text'=>'hscr OFF', 'command'=>proc{t.hscroll(false)}).pack('side'=>'left') Tk.mainloop end diff --git a/ext/tk/sample/tktextio.rb b/ext/tk/sample/tktextio.rb index 9f012feada..679a2b7142 100644 --- a/ext/tk/sample/tktextio.rb +++ b/ext/tk/sample/tktextio.rb @@ -3,15 +3,15 @@ # TkTextIO class :: handling I/O stream on a TkText widget # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -# NOTE: TkTextIO supports 'character' (not 'byte') access only. -# So, for example, TkTextIO#getc returns a character, TkTextIO#pos -# means the character position, TkTextIO#read(size) counts by +# NOTE: TkTextIO supports 'character' (not 'byte') access only. +# So, for example, TkTextIO#getc returns a character, TkTextIO#pos +# means the character position, TkTextIO#read(size) counts by # characters, and so on. -# Of course, it is available to make TkTextIO class to suuport -# 'byte' access. However, it may break multi-byte characters. +# Of course, it is available to make TkTextIO class to suuport +# 'byte' access. However, it may break multi-byte characters. # and then, displayed string on the text widget may be garbled. -# I think that it is not good on the supposed situation of using -# TkTextIO. +# I think that it is not good on the supposed situation of using +# TkTextIO. # require 'tk' require 'tk/text' @@ -24,14 +24,14 @@ class TkTextIO < TkText OPT_DEFAULTS = { 'mode' => nil, - 'overwrite' => false, - 'text' => nil, - 'show' => :pos, - 'wrap' => 'char', - 'sync' => true, - 'prompt' => nil, - 'prompt_cmd' => nil, - 'hist_size' => 1000, + 'overwrite' => false, + 'text' => nil, + 'show' => :pos, + 'wrap' => 'char', + 'sync' => true, + 'prompt' => nil, + 'prompt_cmd' => nil, + 'hist_size' => 1000, } def create_self(keys) @@ -46,7 +46,7 @@ class TkTextIO < TkText @buf_size = 0 @buf_max = 1024 - @write_buf_queue, @write_buf_mutex, + @write_buf_queue, @write_buf_mutex, @read_buf_queue, @read_buf_mutex = @@create_queues.call @idle_flush = TkTimer.new(:idle, 1, proc{ @flusher.run rescue nil }) @@ -87,7 +87,7 @@ class TkTextIO < TkText def _get_io_params(keys) opts = {} - self.class.const_get(:OPT_DEFAULTS).each{|k, v| + self.class.const_get(:OPT_DEFAULTS).each{|k, v| if keys.has_key?(k) opts[k] = keys.delete(k) else @@ -261,7 +261,7 @@ class TkTextIO < TkText Tk.callback_break end end - private :_cb_up, :_cb_down, :_cb_left, :_cb_backspace, + private :_cb_up, :_cb_down, :_cb_left, :_cb_backspace, :_cb_ctrl_a, :_cb_ctrl_u def _setup_console_bindings @@ -484,7 +484,7 @@ class TkTextIO < TkText Thread.pass if @open[:w] || ! @write_buffer.empty? @write_buf_mutex.synchronize { - _sync_write_buf(@write_buffer) + _sync_write_buf(@write_buffer) @write_buffer[0..-1] = '' } end @@ -666,7 +666,7 @@ class TkTextIO < TkText @txtpos.set('end - 1 char') elsif rs == '' @count_var.value # make it global - idx = tksearch_with_count([:regexp], @count_var, + idx = tksearch_with_count([:regexp], @count_var, "\n(\n)+", @txtpos, 'end - 1 char') if idx s = get(@txtpos, idx) << "\n" @@ -779,9 +779,9 @@ class TkTextIO < TkText end def show_mode=(mode) - # define show mode when file position is changed. - # mode == :pos or "pos" or true :: see current file position. - # mode == :insert or "insert" :: see insert cursor position. + # define show mode when file position is changed. + # mode == :pos or "pos" or true :: see current file position. + # mode == :insert or "insert" :: see insert cursor position. # mode == nil or false :: do nothing # else see 'mode' position ('mode' should be text index or mark) case mode @@ -921,9 +921,9 @@ if __FILE__ == $0 ev_loop = Thread.new{Tk.mainloop} f = TkFrame.new.pack - #tio = TkTextIO.new(f, :show=>:nil, - #tio = TkTextIO.new(f, :show=>:pos, - tio = TkTextIO.new(f, :show=>:insert, + #tio = TkTextIO.new(f, :show=>:nil, + #tio = TkTextIO.new(f, :show=>:pos, + tio = TkTextIO.new(f, :show=>:insert, :text=>">>> This is an initial text line. <<<\n\n"){ # yscrollbar(TkScrollbar.new(f).pack(:side=>:right, :fill=>:y)) pack(:side=>:left, :fill=>:both, :expand=>true) @@ -1045,12 +1045,12 @@ if __FILE__ == $0 num = 0 # io = TkTextIO.new(:mode=>:console, :prompt=>'').pack #=begin - io = TkTextIO.new(:mode=>:console, + io = TkTextIO.new(:mode=>:console, :prompt_cmd=>proc{ s = "[#{num}]" num += 1 s - }, + }, :prompt=>'-> ').pack #=end Thread.new{loop{sleep 2; io.puts 'hoge'}} diff --git a/ext/tk/sample/tktimer2.rb b/ext/tk/sample/tktimer2.rb index dd31bb098e..125115e863 100644 --- a/ext/tk/sample/tktimer2.rb +++ b/ext/tk/sample/tktimer2.rb @@ -5,7 +5,7 @@ require "tk" # new notation : # * symbols are acceptable as keys or values of the option hash -# * the parent widget can be given by :parent key on the option hash +# * the parent widget can be given by :parent key on the option hash root = TkRoot.new(:title=>'timer sample') label = TkLabel.new(:parent=>root, :relief=>:raised, :width=>10) \ .pack(:side=>:bottom, :fill=>:both) @@ -19,11 +19,11 @@ tick = proc{|aobj| #<== TkTimer object } timer = TkTimer.new(50, -1, tick).start(0, proc{ label.text('0.00'); 0 }) - # ==> repeat-interval : (about) 50 ms, - # repeat : infinite (-1) times, + # ==> repeat-interval : (about) 50 ms, + # repeat : infinite (-1) times, # repeat-procedure : tick (only one, in this case) # - # ==> wait-before-call-init-proc : 0 ms, + # ==> wait-before-call-init-proc : 0 ms, # init_proc : proc{ label.text('0.00'); 0 } # # (0ms)-> init_proc ->(50ms)-> tick ->(50ms)-> tick ->.... diff --git a/ext/tk/sample/tktimer3.rb b/ext/tk/sample/tktimer3.rb index e3bb4c3e4a..08e8a3cad4 100644 --- a/ext/tk/sample/tktimer3.rb +++ b/ext/tk/sample/tktimer3.rb @@ -5,7 +5,7 @@ require "tk" # new notation : # * symbols are acceptable as keys or values of the option hash -# * the parent widget can be given by :parent key on the option hash +# * the parent widget can be given by :parent key on the option hash root = TkRoot.new(:title=>'timer sample') label = TkLabel.new(:parent=>root, :relief=>:raised, :width=>10) \ .pack(:side=>:bottom, :fill=>:both) @@ -19,11 +19,11 @@ tick = proc{|aobj| #<== TkTimer object } timer = TkTimer.new(50, -1, tick).start(0, proc{ label.text('0.00'); 0 }) - # ==> repeat-interval : (about) 50 ms, - # repeat : infinite (-1) times, + # ==> repeat-interval : (about) 50 ms, + # repeat : infinite (-1) times, # repeat-procedure : tick (only one, in this case) # - # ==> wait-before-call-init-proc : 0 ms, + # ==> wait-before-call-init-proc : 0 ms, # init_proc : proc{ label.text('0.00'); 0 } # # (0ms)-> init_proc ->(50ms)-> tick ->(50ms)-> tick ->.... diff --git a/ext/tk/sample/tktree.rb b/ext/tk/sample/tktree.rb index 56b7211c88..4eb7f60627 100644 --- a/ext/tk/sample/tktree.rb +++ b/ext/tk/sample/tktree.rb @@ -3,10 +3,10 @@ # # see <http://wiki.tcl.tk/10615> # -# Note: optional argument '-font' of the Tcl library is changed to -# 'itemfont' on this Ruby library, because of avoiding font -# operation trouble in 'initialize' method ( see the following -# test script ). +# Note: optional argument '-font' of the Tcl library is changed to +# 'itemfont' on this Ruby library, because of avoiding font +# operation trouble in 'initialize' method ( see the following +# test script ). # ########################################################################## require 'tk' @@ -68,9 +68,9 @@ end if __FILE__ == $0 TkLabel.new(:text=><<EOL, :relief=>:ridge, :justify=>:left).pack - This is a sample to use a Tcl library script on Ruby/Tk. - This sample loads tktree.tcl (see <http://wiki.tcl.tk/10615>) - and calls functions of the Tcl script. + This is a sample to use a Tcl library script on Ruby/Tk. + This sample loads tktree.tcl (see <http://wiki.tcl.tk/10615>) + and calls functions of the Tcl script. EOL items = %w(/group1/item1 /group1/item2 /group1/subgroup/item1 /group2/item1 /item1) @@ -79,14 +79,14 @@ EOL tr1.focus items.each{|item| - tr1.newitem(item, + tr1.newitem(item, :command=>proc{Tk.messageBox(:message=>"#{item} executed")}) } f = TkFrame.new.pack(:expand=>true, :fill=>:both) - tr2 = TkTree.new(f, :bg=>'black', #:itemfont=>{:family=>'Times', :size=>14}, - :textcolor=>'red', :bd=>4, :relief=>:ridge, - :selectbackground=>'darkBlue', :selectforeground=>'yellow', + tr2 = TkTree.new(f, :bg=>'black', #:itemfont=>{:family=>'Times', :size=>14}, + :textcolor=>'red', :bd=>4, :relief=>:ridge, + :selectbackground=>'darkBlue', :selectforeground=>'yellow', :selectborderwidth=>3, :linecolor=>'yellow') { yscrollbar(TkScrollbar.new(f, :width=>10).pack(:side=>:right, :fill=>:y)) xscrollbar(TkScrollbar.new(f, :width=>10).pack(:side=>:bottom, :fill=>:x)) @@ -94,8 +94,8 @@ EOL } items.each{|item| - tr2.newitem(item, :textcolor=>'green', :image=>'', - :itemfont=>{:family=>'Times', :size=>10}, + tr2.newitem(item, :textcolor=>'green', :image=>'', + :itemfont=>{:family=>'Times', :size=>10}, :command=>proc{Tk.messageBox(:message=>"#{item} executed")}) } diff --git a/ext/tk/sample/ttk_wrapper.rb b/ext/tk/sample/ttk_wrapper.rb index 1580668994..e4eb9c7964 100644 --- a/ext/tk/sample/ttk_wrapper.rb +++ b/ext/tk/sample/ttk_wrapper.rb @@ -10,7 +10,7 @@ version = '0.1.3' # parse commandline arguments ########################################################################## require 'optparse' -opt = OptionParser.new("Usage: #{$0} [options] rubytk_script" << "\n " << +opt = OptionParser.new("Usage: #{$0} [options] rubytk_script" << "\n " << "Ruby/Tk script wrapper. Use Ttk widgets as default.") opt.version = version @@ -21,7 +21,7 @@ OPTS[:theme] = 'default' opt.on('-l', '--list', 'list available theme names'){|v| OPTS[:list] = true} opt.on('-t', '--theme theme', 'theme name'){|v| OPTS[:theme] = v} -opt.on('-d', '--themedir themes_dir', 'directory of theme definitions'){|v| +opt.on('-d', '--themedir themes_dir', 'directory of theme definitions'){|v| OPTS[:themedir] << v } opt.on('-r', '--rubytheme rb_theme', 'theme definition file (ruby script)'){|v| @@ -42,7 +42,7 @@ begin Tk.default_widget_set = :Ttk rescue LoadError if OPTS[:verbose] - print "warning: fail to load 'Ttk' extension. use standard widgets.\n" + print "warning: fail to load 'Ttk' extension. use standard widgets.\n" end end @@ -53,7 +53,7 @@ end ########################################################################## # define Tcl/Tk procedures for compatibility. -# those are required when want to use themes included +# those are required when want to use themes included # in "sample/tkextlib/tile/demo.rb". ########################################################################## Tk::Tile.__define_LoadImages_proc_for_compatibility__! @@ -111,7 +111,7 @@ TkItemConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__! true # set theme of widget style ########################################################################## if OPTS[:list] || OPTS[:verbose] - print "supported theme names: #{Tk::Tile.themes.inspect}\n" + print "supported theme names: #{Tk::Tile.themes.inspect}\n" exit if OPTS[:list] && ARGV.empty? end print "use theme: \"#{OPTS[:theme]}\"\n" if OPTS[:theme] && OPTS[:verbose] @@ -122,7 +122,7 @@ Tk::Tile.set_theme(OPTS[:theme]) if OPTS[:theme] ########################################################################## # replace $0 and $RPAGRAM_NAME ########################################################################## -# When the expand_path of the target script is long, ruby sometimes +# When the expand_path of the target script is long, ruby sometimes # fails to set the path to $0 (the path string is trimmed). # The following replaces $0 and $PROGNAME to avoid such trouble. progname_obj = $0.dup diff --git a/ext/win32ole/extconf.rb b/ext/win32ole/extconf.rb index 500bd3dd3a..b4f09fc7c0 100644 --- a/ext/win32ole/extconf.rb +++ b/ext/win32ole/extconf.rb @@ -19,7 +19,7 @@ end def create_win32ole_makefile if have_library("ole32") and have_library("oleaut32") and - have_library("uuid") and + have_library("uuid") and have_library("user32") and have_library("kernel32") and have_library("advapi32") and diff --git a/ext/win32ole/sample/excel1.rb b/ext/win32ole/sample/excel1.rb index 2cad84a488..c8cd38e732 100644 --- a/ext/win32ole/sample/excel1.rb +++ b/ext/win32ole/sample/excel1.rb @@ -17,11 +17,11 @@ worksheet.Range("D2").value = 20; worksheet.Range("A1:B2").value = [["North","South"], [5.2, 10]]; -vals = WIN32OLE_VARIANT.new([["East","West"], - [8, 20]], - WIN32OLE::VARIANT::VT_ARRAY) +vals = WIN32OLE_VARIANT.new([["East","West"], + [8, 20]], + WIN32OLE::VARIANT::VT_ARRAY) worksheet.Range("C1:D2").value = vals - + range = worksheet.Range("A1:D2"); range.Select chart = workbook.Charts.Add; diff --git a/ext/win32ole/sample/ieconst.rb b/ext/win32ole/sample/ieconst.rb index 234272c7ed..2c6a7a383c 100644 --- a/ext/win32ole/sample/ieconst.rb +++ b/ext/win32ole/sample/ieconst.rb @@ -20,7 +20,7 @@ end # Remark!!! CONSTANTS has not tested enoughly!!! # CONSTANTS is alpha release. # If there are constants which first letter is not [a-zA-Z], -# like a '_Foo', then maybe you can access the value by +# like a '_Foo', then maybe you can access the value by # using CONSTANTS['_Foo'] #------------------------------------------------------------ IE_CONST::CONSTANTS.each do |k, v| diff --git a/ext/win32ole/sample/ienavi.rb b/ext/win32ole/sample/ienavi.rb index c7fa3f5ec2..8b279ddaae 100644 --- a/ext/win32ole/sample/ienavi.rb +++ b/ext/win32ole/sample/ienavi.rb @@ -26,7 +26,7 @@ ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents') ev.on_event {|*args| default_handler(*args)} ev.on_event("NavigateComplete") {|url| navigate(url)} -ev.on_event("Quit") {|*args| stop_msg_loop} +ev.on_event("Quit") {|*args| stop_msg_loop} $LOOP = TRUE while ($LOOP) diff --git a/ext/win32ole/sample/oledirs.rb b/ext/win32ole/sample/oledirs.rb index 1c77e76f14..dbacc2131d 100644 --- a/ext/win32ole/sample/oledirs.rb +++ b/ext/win32ole/sample/oledirs.rb @@ -7,7 +7,7 @@ require "win32ole" def listup(items) # items.each do |i| for i in items - puts i.name + puts i.name end end diff --git a/ext/win32ole/sample/olegen.rb b/ext/win32ole/sample/olegen.rb index df6fe7adaa..4ec576ca50 100644 --- a/ext/win32ole/sample/olegen.rb +++ b/ext/win32ole/sample/olegen.rb @@ -49,7 +49,7 @@ class WIN32COMGen ts = '' typedetails.each do |t| case t - when 'CARRAY', 'VOID', 'UINT', 'RESULT', 'DECIMAL', 'I8', 'UI8' + when 'CARRAY', 'VOID', 'UINT', 'RESULT', 'DECIMAL', 'I8', 'UI8' # raise "Sorry type\"" + t + "\" not supported" ts << "\"??? NOT SUPPORTED TYPE:`#{t}'\"" when 'USERDEFINED', 'Unknown Type 9' @@ -80,7 +80,7 @@ class WIN32COMGen generate_argtype(param.ole_type_detail) }.join(", ") if proptypes - types += ", " if types.size > 0 + types += ", " if types.size > 0 types += generate_argtype(proptypes) end types @@ -97,8 +97,8 @@ class WIN32COMGen end def generate_method_help(method, type = nil) - str = " # " - if type + str = " # " + if type str += type else str += method.return_type @@ -123,7 +123,7 @@ class WIN32COMGen def generate_method_args_help(method) args = [] method.params.each_with_index {|param, i| - h = " # #{param.ole_type} arg#{i} --- #{param.name}" + h = " # #{param.ole_type} arg#{i} --- #{param.name}" inout = [] inout.push "IN" if param.input? inout.push "OUT" if param.output? @@ -166,14 +166,14 @@ class WIN32COMGen method.visible? && method.size_params > 0 }.each do |method| - types = method.return_type_detail + types = method.return_type_detail io.puts "\n" io.puts generate_method_help(method, types[0]) io.puts " def #{method.name}" if klass.ole_type == "Class" - io.print " OLEProperty.new(@dispatch, #{method.dispid}, [" + io.print " OLEProperty.new(@dispatch, #{method.dispid}, [" else - io.print " OLEProperty.new(self, #{method.dispid}, [" + io.print " OLEProperty.new(self, #{method.dispid}, [" end io.print generate_argtypes(method, nil) io.print "], [" @@ -320,8 +320,8 @@ STR ole_classes(typelib).select{|klass| klass.visible? && - (klass.ole_type == "Class" || - klass.ole_type == "Interface" || + (klass.ole_type == "Class" || + klass.ole_type == "Interface" || klass.ole_type == "Dispatch" || klass.ole_type == "Enum") }.each do |klass| @@ -329,7 +329,7 @@ STR end begin @ole.quit if @ole - rescue + rescue end end end diff --git a/ext/win32ole/sample/xml.rb b/ext/win32ole/sample/xml.rb index b95d6d5275..4b1a54dc75 100644 --- a/ext/win32ole/sample/xml.rb +++ b/ext/win32ole/sample/xml.rb @@ -1,11 +1,11 @@ -# +# # This file created by olegen.rb as following. # ruby olegen.rb 'Microsoft XML, version 2.0' > xml.rb -# +# require 'win32ole' require 'win32ole/property' -# +# module IXMLDOMImplementation include WIN32OLE::VARIANT attr_reader :lastargs @@ -343,7 +343,7 @@ module OLEtagDOMNodeType NODE_NOTATION = 12 end -# +# module IXMLDOMNodeList include WIN32OLE::VARIANT attr_reader :lastargs @@ -380,7 +380,7 @@ module IXMLDOMNodeList end end -# +# module IXMLDOMNamedNodeMap include WIN32OLE::VARIANT attr_reader :lastargs @@ -464,7 +464,7 @@ module IXMLDOMNamedNodeMap end end -# +# module IXMLDOMDocument include WIN32OLE::VARIANT attr_reader :lastargs @@ -1040,7 +1040,7 @@ module IXMLDOMDocument end end -# +# module IXMLDOMDocumentType include WIN32OLE::VARIANT attr_reader :lastargs @@ -1368,7 +1368,7 @@ module IXMLDOMDocumentType end end -# +# module IXMLDOMElement include WIN32OLE::VARIANT attr_reader :lastargs @@ -1752,7 +1752,7 @@ module IXMLDOMElement end end -# +# module IXMLDOMAttribute include WIN32OLE::VARIANT attr_reader :lastargs @@ -2080,7 +2080,7 @@ module IXMLDOMAttribute end end -# +# module IXMLDOMDocumentFragment include WIN32OLE::VARIANT attr_reader :lastargs @@ -2384,7 +2384,7 @@ module IXMLDOMDocumentFragment end end -# +# module IXMLDOMText include WIN32OLE::VARIANT attr_reader :lastargs @@ -2771,7 +2771,7 @@ module IXMLDOMText end end -# +# module IXMLDOMCharacterData include WIN32OLE::VARIANT attr_reader :lastargs @@ -3149,7 +3149,7 @@ module IXMLDOMCharacterData end end -# +# module IXMLDOMComment include WIN32OLE::VARIANT attr_reader :lastargs @@ -3527,7 +3527,7 @@ module IXMLDOMComment end end -# +# module IXMLDOMCDATASection include WIN32OLE::VARIANT attr_reader :lastargs @@ -3914,7 +3914,7 @@ module IXMLDOMCDATASection end end -# +# module IXMLDOMProcessingInstruction include WIN32OLE::VARIANT attr_reader :lastargs @@ -4242,7 +4242,7 @@ module IXMLDOMProcessingInstruction end end -# +# module IXMLDOMEntityReference include WIN32OLE::VARIANT attr_reader :lastargs @@ -4608,7 +4608,7 @@ module IXMLDOMParseError end end -# +# module IXMLDOMNotation include WIN32OLE::VARIANT attr_reader :lastargs @@ -4928,7 +4928,7 @@ module IXMLDOMNotation end end -# +# module IXMLDOMEntity include WIN32OLE::VARIANT attr_reader :lastargs diff --git a/lib/English.rb b/lib/English.rb index 1a0e11de74..4fd53c5ec6 100644 --- a/lib/English.rb +++ b/lib/English.rb @@ -11,7 +11,7 @@ # With English: # # require "English" -# +# # $OUTPUT_FIELD_SEPARATOR = ' -- ' # "waterbuffalo" =~ /buff/ # print $LOADED_FEATURES, $POSTMATCH, $PID, "\n" @@ -83,7 +83,7 @@ alias $DEFAULT_OUTPUT $> # of the contents of all the files # given as command-line arguments, or <tt>$stdin</tt> # (in the case where there are no -# arguments). <tt>$<</tt> supports methods similar to a +# arguments). <tt>$<</tt> supports methods similar to a # +File+ object: # +inmode+, +close+, # <tt>closed?</tt>, +each+, @@ -91,7 +91,7 @@ alias $DEFAULT_OUTPUT $> # +eof+, <tt>eof?</tt>, +file+, # +filename+, +fileno+, # +getc+, +gets+, +lineno+, -# <tt>lineno=</tt>, +path+, +# <tt>lineno=</tt>, +path+, # +pos+, <tt>pos=</tt>, # +read+, +readchar+, # +readline+, +readlines+, @@ -139,12 +139,12 @@ alias $ARGV $* alias $MATCH $& # The string preceding the match in the last -# successful pattern match. This variable is local to +# successful pattern match. This variable is local to # the current scope. Read only. Thread local. alias $PREMATCH $` # The string following the match in the last -# successful pattern match. This variable is local to +# successful pattern match. This variable is local to # the current scope. Read only. Thread local. alias $POSTMATCH $' diff --git a/lib/base64.rb b/lib/base64.rb index ebd796eccd..383acacef9 100644 --- a/lib/base64.rb +++ b/lib/base64.rb @@ -8,12 +8,12 @@ # # == Example # -# A simple encoding and decoding. -# +# A simple encoding and decoding. +# # require "base64" # # enc = Base64.encode64('Send reinforcements') -# # -> "U2VuZCByZWluZm9yY2VtZW50cw==\n" +# # -> "U2VuZCByZWluZm9yY2VtZW50cw==\n" # plain = Base64.decode64(enc) # # -> "Send reinforcements" # diff --git a/lib/benchmark.rb b/lib/benchmark.rb index 380c364398..9a0bbef596 100644 --- a/lib/benchmark.rb +++ b/lib/benchmark.rb @@ -1,13 +1,13 @@ =begin # -# benchmark.rb - a performance benchmarking library -# +# benchmark.rb - a performance benchmarking library +# # $Id$ -# -# Created by Gotoken (gotoken@notwork.org). +# +# Created by Gotoken (gotoken@notwork.org). # # Documentation by Gotoken (original RD), Lyle Johnson (RDoc conversion), and -# Gavin Sinclair (editing). +# Gavin Sinclair (editing). # =end @@ -26,15 +26,15 @@ # require 'benchmark' # # puts Benchmark.measure { "a"*1_000_000 } -# +# # On my machine (FreeBSD 3.2 on P5, 100MHz) this generates: -# +# # 1.166667 0.050000 1.216667 ( 0.571355) -# +# # This report shows the user CPU time, system CPU time, the sum of # the user and system CPU times, and the elapsed real time. The unit # of time is seconds. -# +# # * Do some experiments sequentially using the #bm method: # # require 'benchmark' @@ -45,7 +45,7 @@ # x.report { n.times do ; a = "1"; end } # x.report { 1.upto(n) do ; a = "1"; end } # end -# +# # The result: # # user system total real @@ -63,14 +63,14 @@ # x.report("times:") { n.times do ; a = "1"; end } # x.report("upto:") { 1.upto(n) do ; a = "1"; end } # end -# +# # The result: -# +# # user system total real # for: 1.050000 0.000000 1.050000 ( 0.503462) # times: 1.533333 0.016667 1.550000 ( 0.735473) # upto: 1.500000 0.016667 1.516667 ( 0.711239) -# +# # # * The times for some benchmarks depend on the order in which items # are run. These differences are due to the cost of memory @@ -79,21 +79,21 @@ # sort an array of floats: # # require 'benchmark' -# +# # array = (1..1000000).map { rand } -# +# # Benchmark.bmbm do |x| # x.report("sort!") { array.dup.sort! } # x.report("sort") { array.dup.sort } # end -# +# # The result: -# +# # Rehearsal ----------------------------------------- # sort! 11.928000 0.010000 11.938000 ( 12.756000) # sort 13.048000 0.020000 13.068000 ( 13.857000) # ------------------------------- total: 25.006000sec -# +# # user system total real # sort! 12.959000 0.010000 12.969000 ( 13.793000) # sort 12.007000 0.000000 12.007000 ( 12.791000) @@ -103,7 +103,7 @@ # using the #benchmark method: # # require 'benchmark' -# include Benchmark # we need the CAPTION and FMTSTR constants +# include Benchmark # we need the CAPTION and FMTSTR constants # # n = 50000 # Benchmark.benchmark(" "*7 + CAPTION, 7, FMTSTR, ">total:", ">avg:") do |x| @@ -112,9 +112,9 @@ # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } # [tf+tt+tu, (tf+tt+tu)/3] # end -# +# # The result: -# +# # user system total real # for: 1.016667 0.016667 1.033333 ( 0.485749) # times: 1.450000 0.016667 1.466667 ( 0.681367) @@ -145,10 +145,10 @@ module Benchmark # suitable for nearly all benchmarking requirements. See the examples in # Benchmark, and the #bm and #bmbm methods. # - # Example: + # Example: # # require 'benchmark' - # include Benchmark # we need the CAPTION and FMTSTR constants + # include Benchmark # we need the CAPTION and FMTSTR constants # # n = 50000 # Benchmark.benchmark(" "*7 + CAPTION, 7, FMTSTR, ">total:", ">avg:") do |x| @@ -157,16 +157,16 @@ module Benchmark # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } # [tf+tt+tu, (tf+tt+tu)/3] # end - # + # # <i>Generates:</i> - # + # # user system total real # for: 1.016667 0.016667 1.033333 ( 0.485749) # times: 1.450000 0.016667 1.466667 ( 0.681367) # upto: 1.533333 0.000000 1.533333 ( 0.722166) # >total: 4.000000 0.033333 4.033333 ( 1.889282) # >avg: 1.333333 0.011111 1.344444 ( 0.629761) - # + # def benchmark(caption = "", label_width = nil, fmtstr = nil, *labels) # :yield: report sync = STDOUT.sync @@ -177,7 +177,7 @@ module Benchmark print caption results = yield(Report.new(label_width, fmtstr)) Array === results and results.grep(Tms).each {|t| - print((labels.shift || t.label || "").ljust(label_width), + print((labels.shift || t.label || "").ljust(label_width), t.format(fmtstr)) } STDOUT.sync = sync @@ -186,7 +186,7 @@ module Benchmark # A simple interface to the #benchmark method, #bm is generates sequential reports # with labels. The parameters have the same meaning as for #benchmark. - # + # # require 'benchmark' # # n = 50000 @@ -195,9 +195,9 @@ module Benchmark # x.report("times:") { n.times do ; a = "1"; end } # x.report("upto:") { 1.upto(n) do ; a = "1"; end } # end - # + # # <i>Generates:</i> - # + # # user system total real # for: 1.050000 0.000000 1.050000 ( 0.503462) # times: 1.533333 0.016667 1.550000 ( 0.735473) @@ -224,21 +224,21 @@ module Benchmark # calculate the required label width. # # require 'benchmark' - # + # # array = (1..1000000).map { rand } - # + # # Benchmark.bmbm do |x| # x.report("sort!") { array.dup.sort! } # x.report("sort") { array.dup.sort } # end - # + # # <i>Generates:</i> - # + # # Rehearsal ----------------------------------------- # sort! 11.928000 0.010000 11.938000 ( 12.756000) # sort 13.048000 0.020000 13.068000 ( 13.857000) # ------------------------------- total: 25.006000sec - # + # # user system total real # sort! 12.959000 0.010000 12.969000 ( 13.793000) # sort 12.007000 0.000000 12.007000 ( 12.791000) @@ -267,7 +267,7 @@ module Benchmark ets = sum.format("total: %tsec") printf("%s %s\n\n", "-"*(width+CAPTION.length-ets.length-1), ets) - + # take print ' '*width, CAPTION list = [] @@ -285,7 +285,7 @@ module Benchmark ary end - # + # # Returns the time used to execute the given block as a # Benchmark::Tms object. # @@ -293,10 +293,10 @@ module Benchmark t0, r0 = Benchmark.times, Time.now yield t1, r1 = Benchmark.times, Time.now - Benchmark::Tms.new(t1.utime - t0.utime, - t1.stime - t0.stime, - t1.cutime - t0.cutime, - t1.cstime - t0.cstime, + Benchmark::Tms.new(t1.utime - t0.utime, + t1.stime - t0.stime, + t1.cutime - t0.cutime, + t1.cstime - t0.cstime, r1.to_f - r0.to_f, label) end @@ -323,8 +323,8 @@ module Benchmark # Usually, one doesn't call this method directly, as new # Job objects are created by the #bmbm method. # _width_ is a initial value for the label offset used in formatting; - # the #bmbm method passes its _width_ argument to this constructor. - # + # the #bmbm method passes its _width_ argument to this constructor. + # def initialize(width) @width = width @list = [] @@ -343,11 +343,11 @@ module Benchmark end alias report item - + # An array of 2-element arrays, consisting of label and block pairs. attr_reader :list - - # Length of the widest label in the #list, plus one. + + # Length of the widest label in the #list, plus one. attr_reader :width end @@ -363,10 +363,10 @@ module Benchmark # # Returns an initialized Report instance. # Usually, one doesn't call this method directly, as new - # Report objects are created by the #benchmark and #bm methods. - # _width_ and _fmtstr_ are the label offset and - # format string used by Tms#format. - # + # Report objects are created by the #benchmark and #bm methods. + # _width_ and _fmtstr_ are the label offset and + # format string used by Tms#format. + # def initialize(width = 0, fmtstr = nil) @width, @fmtstr = width, fmtstr end @@ -398,50 +398,50 @@ module Benchmark # User CPU time attr_reader :utime - + # System CPU time attr_reader :stime - + # User CPU time of children attr_reader :cutime - + # System CPU time of children attr_reader :cstime - + # Elapsed real time attr_reader :real - - # Total time, that is _utime_ + _stime_ + _cutime_ + _cstime_ + + # Total time, that is _utime_ + _stime_ + _cutime_ + _cstime_ attr_reader :total - + # Label attr_reader :label # # Returns an initialized Tms object which has - # _u_ as the user CPU time, _s_ as the system CPU time, + # _u_ as the user CPU time, _s_ as the system CPU time, # _cu_ as the children's user CPU time, _cs_ as the children's # system CPU time, _real_ as the elapsed real time and _l_ - # as the label. - # + # as the label. + # def initialize(u = 0.0, s = 0.0, cu = 0.0, cs = 0.0, real = 0.0, l = nil) @utime, @stime, @cutime, @cstime, @real, @label = u, s, cu, cs, real, l @total = @utime + @stime + @cutime + @cstime end - # + # # Returns a new Tms object whose times are the sum of the times for this # Tms object, plus the time required to execute the code block (_blk_). - # + # def add(&blk) # :yield: - self + Benchmark::measure(&blk) + self + Benchmark::measure(&blk) end - # + # # An in-place version of #add. - # + # def add! - t = Benchmark::measure(&blk) + t = Benchmark::measure(&blk) @utime = utime + t.utime @stime = stime + t.stime @cutime = cutime + t.cutime @@ -450,32 +450,32 @@ module Benchmark self end - # + # # Returns a new Tms object obtained by memberwise summation # of the individual times for this Tms object with those of the other # Tms object. - # This method and #/() are useful for taking statistics. - # + # This method and #/() are useful for taking statistics. + # def +(other); memberwise(:+, other) end - + # # Returns a new Tms object obtained by memberwise subtraction # of the individual times for the other Tms object from those of this # Tms object. # def -(other); memberwise(:-, other) end - + # # Returns a new Tms object obtained by memberwise multiplication # of the individual times for this Tms object by _x_. # def *(x); memberwise(:*, x) end - # + # # Returns a new Tms object obtained by memberwise division # of the individual times for this Tms object by _x_. - # This method and #+() are useful for taking statistics. - # + # This method and #+() are useful for taking statistics. + # def /(x); memberwise(:/, x) end # @@ -486,15 +486,15 @@ module Benchmark # # <tt>%u</tt>:: Replaced by the user CPU time, as reported by Tms#utime. # <tt>%y</tt>:: Replaced by the system CPU time, as reported by #stime (Mnemonic: y of "s*y*stem") - # <tt>%U</tt>:: Replaced by the children's user CPU time, as reported by Tms#cutime + # <tt>%U</tt>:: Replaced by the children's user CPU time, as reported by Tms#cutime # <tt>%Y</tt>:: Replaced by the children's system CPU time, as reported by Tms#cstime # <tt>%t</tt>:: Replaced by the total CPU time, as reported by Tms#total # <tt>%r</tt>:: Replaced by the elapsed real time, as reported by Tms#real # <tt>%n</tt>:: Replaced by the label string, as reported by Tms#label (Mnemonic: n of "*n*ame") - # + # # If _fmtstr_ is not given, FMTSTR is used as default value, detailing the # user, system and real elapsed time. - # + # def format(arg0 = nil, *args) fmtstr = (arg0 || FMTSTR).dup fmtstr.gsub!(/(%[-+\.\d]*)n/){"#{$1}s" % label} @@ -507,19 +507,19 @@ module Benchmark arg0 ? Kernel::format(fmtstr, *args) : fmtstr end - # + # # Same as #format. - # + # def to_s format end - # + # # Returns a new 6-element array, consisting of the # label, user CPU time, system CPU time, children's # user CPU time, children's system CPU time and elapsed # real time. - # + # def to_a [@label, @utime, @stime, @cutime, @cstime, @real] end @@ -548,7 +548,7 @@ module Benchmark # The default caption string (heading above the output times). CAPTION = Benchmark::Tms::CAPTION - # The default format string used to display times. See also Benchmark::Tms#format. + # The default format string used to display times. See also Benchmark::Tms#format. FMTSTR = Benchmark::Tms::FMTSTR end diff --git a/lib/cgi.rb b/lib/cgi.rb index 6acf05b382..6355a92804 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -1,14 +1,14 @@ -# +# # cgi.rb - cgi support library -# +# # Copyright (C) 2000 Network Applied Communication Laboratory, Inc. -# +# # Copyright (C) 2000 Information-technology Promotion Agency, Japan # # Author: Wakou Aoyama <wakou@ruby-lang.org> # -# Documentation: Wakou Aoyama (RDoc'd and embellished by William Webber) -# +# Documentation: Wakou Aoyama (RDoc'd and embellished by William Webber) +# # == Overview # # The Common Gateway Interface (CGI) is a simple protocol @@ -18,7 +18,7 @@ # parameters of the request passed in either in the # environment (GET) or via $stdin (POST), and everything # it prints to $stdout is returned to the client. -# +# # This file holds the +CGI+ class. This class provides # functionality for retrieving HTTP request parameters, # managing cookies, and generating HTML output. See the @@ -75,18 +75,18 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0" # # # For each of these variables, there is a corresponding attribute with the -# same name, except all lower case and without a preceding HTTP_. +# same name, except all lower case and without a preceding HTTP_. # +content_length+ and +server_port+ are integers; the rest are strings. # # === Parameters # # The method #params() returns a hash of all parameters in the request as # name/value-list pairs, where the value-list is an Array of one or more -# values. The CGI object itself also behaves as a hash of parameter names -# to values, but only returns a single value (as a String) for each +# values. The CGI object itself also behaves as a hash of parameter names +# to values, but only returns a single value (as a String) for each # parameter name. # -# For instance, suppose the request contains the parameter +# For instance, suppose the request contains the parameter # "favourite_colours" with the multiple values "blue" and "green". The # following behaviour would occur: # @@ -105,7 +105,7 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0" # # === Multipart requests # -# If a request's method is POST and its content type is multipart/form-data, +# If a request's method is POST and its content type is multipart/form-data, # then it may contain uploaded files. These are stored by the QueryExtension # module in the parameters of the request. The parameter name is the name # attribute of the file input field, as usual. However, the value is not @@ -136,7 +136,7 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0" # # Each HTML element has a corresponding method for generating that # element as a String. The name of this method is the same as that -# of the element, all lowercase. The attributes of the element are +# of the element, all lowercase. The attributes of the element are # passed in as a hash, and the body as a no-argument block that evaluates # to a String. The HTML generation module knows which elements are # always empty, and silently drops any passed-in body. It also knows @@ -150,57 +150,57 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0" # as arguments, rather than via a hash. # # == Examples of use -# +# # === Get form values -# +# # require "cgi" # cgi = CGI.new # value = cgi['field_name'] # <== value string for 'field_name' # # if not 'field_name' included, then return "". # fields = cgi.keys # <== array of field names -# +# # # returns true if form has 'field_name' # cgi.has_key?('field_name') # cgi.has_key?('field_name') # cgi.include?('field_name') -# -# CAUTION! cgi['field_name'] returned an Array with the old +# +# CAUTION! cgi['field_name'] returned an Array with the old # cgi.rb(included in ruby 1.6) -# +# # === Get form values as hash -# +# # require "cgi" # cgi = CGI.new # params = cgi.params -# +# # cgi.params is a hash. -# +# # cgi.params['new_field_name'] = ["value"] # add new param # cgi.params['field_name'] = ["new_value"] # change value # cgi.params.delete('field_name') # delete param # cgi.params.clear # delete all params -# -# +# +# # === Save form values to file -# +# # require "pstore" # db = PStore.new("query.db") # db.transaction do # db["params"] = cgi.params # end -# -# +# +# # === Restore form values from file -# +# # require "pstore" # db = PStore.new("query.db") # db.transaction do # cgi.params = db["params"] # end -# -# +# +# # === Get multipart form values -# +# # require "cgi" # cgi = CGI.new # value = cgi['field_name'] # <== value string for 'field_name' @@ -208,37 +208,37 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0" # value.local_path # <== path to local file of value # value.original_filename # <== original filename of value # value.content_type # <== content_type of value -# +# # and value has StringIO or Tempfile class methods. -# +# # === Get cookie values -# +# # require "cgi" # cgi = CGI.new # values = cgi.cookies['name'] # <== array of 'name' # # if not 'name' included, then return []. # names = cgi.cookies.keys # <== array of cookie names -# +# # and cgi.cookies is a hash. -# +# # === Get cookie objects -# +# # require "cgi" # cgi = CGI.new # for name, cookie in cgi.cookies # cookie.expires = Time.now + 30 # end # cgi.out("cookie" => cgi.cookies) {"string"} -# +# # cgi.cookies # { "name1" => cookie1, "name2" => cookie2, ... } -# +# # require "cgi" # cgi = CGI.new # cgi.cookies['name'].expires = Time.now + 30 # cgi.out("cookie" => cgi.cookies['name']) {"string"} -# +# # === Print http header and html string to $DEFAULT_OUTPUT ($>) -# +# # require "cgi" # cgi = CGI.new("html3") # add HTML generation methods # cgi.out() do @@ -262,7 +262,7 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0" # end # end # end -# +# # # add HTML generation methods # CGI.new("html3") # html3.2 # CGI.new("html4") # html4.01 (Strict) diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb index befe1402e6..5c2cd62a27 100644 --- a/lib/cgi/cookie.rb +++ b/lib/cgi/cookie.rb @@ -15,16 +15,16 @@ # 'expires' => Time.now, # optional # 'secure' => true # optional # ) - # + # # cgi.out("cookie" => [cookie1, cookie2]) { "string" } - # + # # name = cookie1.name # values = cookie1.value # path = cookie1.path # domain = cookie1.domain # expires = cookie1.expires # secure = cookie1.secure - # + # # cookie1.name = 'name' # cookie1.value = ['value1', 'value2', ...] # cookie1.path = 'path' @@ -48,7 +48,7 @@ class CGI # domain:: the domain for which this cookie applies. # expires:: the time at which this cookie expires, as a +Time+ object. # secure:: whether this cookie is a secure cookie or not (default to - # false). Secure cookies are only transmitted to HTTPS + # false). Secure cookies are only transmitted to HTTPS # servers. # # These keywords correspond to attributes of the cookie object. diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb index 95cf423d83..69c7f28603 100644 --- a/lib/cgi/core.rb +++ b/lib/cgi/core.rb @@ -13,7 +13,7 @@ class CGI REVISION = '$Id$' #:nodoc: - NEEDS_BINMODE = true if /WIN/i.match(RUBY_PLATFORM) + NEEDS_BINMODE = true if /WIN/i.match(RUBY_PLATFORM) # Path separators in different environments. PATH_SEPARATOR = {'UNIX'=>'/', 'WINDOWS'=>'\\', 'MACINTOSH'=>':'} @@ -48,7 +48,7 @@ class CGI # :startdoc: - def env_table + def env_table ENV end @@ -79,7 +79,7 @@ class CGI # status:: the HTTP status code, returned as the Status header. See the # list of available status codes below. # server:: the server software, returned as the Server header. - # connection:: the connection type, returned as the Connection header (for + # connection:: the connection type, returned as the Connection header (for # instance, "close". # length:: the length of the content that will be sent, returned as the # Content-Length header. @@ -89,19 +89,19 @@ class CGI # object, returned as the Expires header. # cookie:: a cookie or cookies, returned as one or more Set-Cookie headers. # The value can be the literal string of the cookie; a CGI::Cookie - # object; an Array of literal cookie strings or Cookie objects; or a + # object; an Array of literal cookie strings or Cookie objects; or a # hash all of whose values are literal cookie strings or Cookie objects. # These cookies are in addition to the cookies held in the # @output_cookies field. # # Other header lines can also be set; they are appended as key: value. - # + # # header # # Content-Type: text/html - # + # # header("text/plain") # # Content-Type: text/plain - # + # # header("nph" => true, # "status" => "OK", # == "200 OK" # # "status" => "200 GOOD", @@ -116,9 +116,9 @@ class CGI # "cookie" => [cookie1, cookie2], # "my_header1" => "my_value" # "my_header2" => "my_value") - # + # # The status codes are: - # + # # "OK" --> "200 OK" # "PARTIAL_CONTENT" --> "206 Partial Content" # "MULTIPLE_CHOICES" --> "300 Multiple Choices" @@ -137,8 +137,8 @@ class CGI # "NOT_IMPLEMENTED" --> "501 Method Not Implemented" # "BAD_GATEWAY" --> "502 Bad Gateway" # "VARIANT_ALSO_VARIES" --> "506 Variant Also Negotiates" - # - # This method does not perform charset conversion. + # + # This method does not perform charset conversion. def header(options='text/html') if options.is_a?(String) content_type = options @@ -277,13 +277,13 @@ class CGI # # Content-Length: 6 # # # # string - # + # # cgi.out("text/plain") { "string" } # # Content-Type: text/plain # # Content-Length: 6 # # # # string - # + # # cgi.out("nph" => true, # "status" => "OK", # == "200 OK" # "server" => ENV['SERVER_SOFTWARE'], @@ -296,16 +296,16 @@ class CGI # "cookie" => [cookie1, cookie2], # "my_header1" => "my_value", # "my_header2" => "my_value") { "string" } - # + # # Content-Length is automatically calculated from the size of # the String returned by the content block. # # If ENV['REQUEST_METHOD'] == "HEAD", then only the header # is outputted (the content block is still required, but it # is ignored). - # + # # If the charset is "iso-2022-jp" or "euc-jp" or "shift_jis" then - # the content is converted to this charset, and the language is set + # the content is converted to this charset, and the language is set # to "ja". def out(options = "text/html") # :yield: @@ -358,7 +358,7 @@ class CGI # Mixin module. It provides the follow functionality groups: # - # 1. Access to CGI environment variables as methods. See + # 1. Access to CGI environment variables as methods. See # documentation to the CGI class for a list of these variables. # # 2. Access to cookies, including the cookies attribute. @@ -617,7 +617,7 @@ class CGI # Get the value for the parameter with a given key. # - # If the parameter has multiple values, only the first will be + # If the parameter has multiple values, only the first will be # retrieved; use #params() to get the array of values. def [](key) params = @params[key] @@ -658,7 +658,7 @@ class CGI # This default value default is "UTF-8" # If you want to change the default accept character set # when create a new CGI instance, set this: - # + # # CGI.accept_charset = "EUC-JP" # @@ -700,11 +700,11 @@ class CGI # # == block # - # When you use a block, you can write a process + # When you use a block, you can write a process # that query encoding is invalid. Example: # # encoding_error={} - # cgi=CGI.new(:accept_charset=>"EUC-JP") do |name,value| + # cgi=CGI.new(:accept_charset=>"EUC-JP") do |name,value| # encoding_error[key] = value # end # diff --git a/lib/cgi/html.rb b/lib/cgi/html.rb index 62f1fc1898..8ee38000c5 100644 --- a/lib/cgi/html.rb +++ b/lib/cgi/html.rb @@ -66,7 +66,7 @@ class CGI # Modules Http3, Http4, etc., contain more basic HTML-generation methods # (:title, :center, etc.). # - # See class CGI for a detailed example. + # See class CGI for a detailed example. # module HtmlExtension @@ -99,7 +99,7 @@ class CGI end end - # Generate a Document Base URI element as a String. + # Generate a Document Base URI element as a String. # # +href+ can either by a string, giving the base URL for the HREF # attribute, or it can be a has of the element's attributes. @@ -179,10 +179,10 @@ class CGI # # checkbox("name") # # = checkbox("NAME" => "name") - # + # # checkbox("name", "value") # # = checkbox("NAME" => "name", "VALUE" => "value") - # + # # checkbox("name", "value", true) # # = checkbox("NAME" => "name", "VALUE" => "value", "CHECKED" => true) def checkbox(name = "", value = nil, checked = nil) @@ -220,23 +220,23 @@ class CGI # # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo # # <INPUT TYPE="checkbox" NAME="name" VALUE="bar">bar # # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz - # + # # checkbox_group("name", ["foo"], ["bar", true], "baz") # # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo # # <INPUT TYPE="checkbox" CHECKED NAME="name" VALUE="bar">bar # # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz - # + # # checkbox_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz") # # <INPUT TYPE="checkbox" NAME="name" VALUE="1">Foo # # <INPUT TYPE="checkbox" CHECKED NAME="name" VALUE="2">Bar # # <INPUT TYPE="checkbox" NAME="name" VALUE="Baz">Baz - # + # # checkbox_group("NAME" => "name", # "VALUES" => ["foo", "bar", "baz"]) - # + # # checkbox_group("NAME" => "name", # "VALUES" => [["foo"], ["bar", true], "baz"]) - # + # # checkbox_group("NAME" => "name", # "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"]) def checkbox_group(name = "", *values) @@ -272,13 +272,13 @@ class CGI # # file_field("name") # # <INPUT TYPE="file" NAME="name" SIZE="20"> - # + # # file_field("name", 40) # # <INPUT TYPE="file" NAME="name" SIZE="40"> - # + # # file_field("name", 40, 100) # # <INPUT TYPE="file" NAME="name" SIZE="40" MAXLENGTH="100"> - # + # # file_field("NAME" => "name", "SIZE" => 40) # # <INPUT TYPE="file" NAME="name" SIZE="40"> def file_field(name = "", size = 20, maxlength = nil) @@ -298,7 +298,7 @@ class CGI # # +method+ should be either "get" or "post", and defaults to the latter. # +action+ defaults to the current CGI script name. +enctype+ - # defaults to "application/x-www-form-urlencoded". + # defaults to "application/x-www-form-urlencoded". # # Alternatively, the attributes can be specified as a hash. # @@ -306,19 +306,19 @@ class CGI # # form{ "string" } # # <FORM METHOD="post" ENCTYPE="application/x-www-form-urlencoded">string</FORM> - # + # # form("get") { "string" } # # <FORM METHOD="get" ENCTYPE="application/x-www-form-urlencoded">string</FORM> - # + # # form("get", "url") { "string" } # # <FORM METHOD="get" ACTION="url" ENCTYPE="application/x-www-form-urlencoded">string</FORM> - # + # # form("METHOD" => "post", "ENCTYPE" => "enctype") { "string" } # # <FORM METHOD="post" ENCTYPE="enctype">string</FORM> def form(method = "post", action = script_name, enctype = "application/x-www-form-urlencoded") attributes = if method.kind_of?(String) { "METHOD" => method, "ACTION" => action, - "ENCTYPE" => enctype } + "ENCTYPE" => enctype } else unless method.has_key?("METHOD") method["METHOD"] = "post" @@ -350,10 +350,10 @@ class CGI # # hidden("name") # # <INPUT TYPE="hidden" NAME="name"> - # + # # hidden("name", "value") # # <INPUT TYPE="hidden" NAME="name" VALUE="value"> - # + # # hidden("NAME" => "name", "VALUE" => "reset", "ID" => "foo") # # <INPUT TYPE="hidden" NAME="name" VALUE="value" ID="foo"> def hidden(name = "", value = nil) @@ -376,36 +376,36 @@ class CGI # should include the entire text of this tag, including angle brackets. # # The body of the html element is supplied as a block. - # + # # html{ "string" } # # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML>string</HTML> - # + # # html("LANG" => "ja") { "string" } # # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML LANG="ja">string</HTML> - # + # # html("DOCTYPE" => false) { "string" } # # <HTML>string</HTML> - # + # # html("DOCTYPE" => '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">') { "string" } # # <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML>string</HTML> - # + # # html("PRETTY" => " ") { "<BODY></BODY>" } # # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> # # <HTML> # # <BODY> # # </BODY> # # </HTML> - # + # # html("PRETTY" => "\t") { "<BODY></BODY>" } # # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> # # <HTML> # # <BODY> # # </BODY> # # </HTML> - # + # # html("PRETTY") { "<BODY></BODY>" } # # = html("PRETTY" => " ") { "<BODY></BODY>" } - # + # # html(if $VERBOSE then "PRETTY" end) { "HTML string" } # def html(attributes = {}) # :yield: @@ -444,17 +444,17 @@ class CGI # Generate an Image Button Input element as a string. # - # +src+ is the URL of the image to use for the button. +name+ + # +src+ is the URL of the image to use for the button. +name+ # is the input name. +alt+ is the alternative text for the image. # # Alternatively, the attributes can be specified as a hash. - # + # # image_button("url") # # <INPUT TYPE="image" SRC="url"> - # + # # image_button("url", "name", "string") # # <INPUT TYPE="image" SRC="url" NAME="name" ALT="string"> - # + # # image_button("SRC" => "url", "ATL" => "strng") # # <INPUT TYPE="image" SRC="url" ALT="string"> def image_button(src = "", name = nil, alt = nil) @@ -480,7 +480,7 @@ class CGI # # img("src", "alt", 100, 50) # # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50"> - # + # # img("SRC" => "src", "ALT" => "alt", "WIDTH" => 100, "HEIGHT" => 50) # # <IMG SRC="src" ALT="alt" WIDTH="100" HEIGHT="50"> def img(src = "", alt = "", width = nil, height = nil) @@ -506,15 +506,15 @@ class CGI # # multipart_form{ "string" } # # <FORM METHOD="post" ENCTYPE="multipart/form-data">string</FORM> - # + # # multipart_form("url") { "string" } # # <FORM METHOD="post" ACTION="url" ENCTYPE="multipart/form-data">string</FORM> def multipart_form(action = nil, enctype = "multipart/form-data") attributes = if action == nil - { "METHOD" => "post", "ENCTYPE" => enctype } + { "METHOD" => "post", "ENCTYPE" => enctype } elsif action.kind_of?(String) { "METHOD" => "post", "ACTION" => action, - "ENCTYPE" => enctype } + "ENCTYPE" => enctype } else unless action.has_key?("METHOD") action["METHOD"] = "post" @@ -542,13 +542,13 @@ class CGI # # password_field("name") # # <INPUT TYPE="password" NAME="name" SIZE="40"> - # + # # password_field("name", "value") # # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="40"> - # + # # password_field("password", "value", 80, 200) # # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200"> - # + # # password_field("NAME" => "name", "VALUE" => "value") # # <INPUT TYPE="password" NAME="name" VALUE="value"> def password_field(name = "", value = nil, size = 40, maxlength = nil) @@ -584,21 +584,21 @@ class CGI # # <OPTION VALUE="bar">bar</OPTION> # # <OPTION VALUE="baz">baz</OPTION> # # </SELECT> - # + # # popup_menu("name", ["foo"], ["bar", true], "baz") # # <SELECT NAME="name"> # # <OPTION VALUE="foo">foo</OPTION> # # <OPTION VALUE="bar" SELECTED>bar</OPTION> # # <OPTION VALUE="baz">baz</OPTION> # # </SELECT> - # + # # popup_menu("name", ["1", "Foo"], ["2", "Bar", true], "Baz") # # <SELECT NAME="name"> # # <OPTION VALUE="1">Foo</OPTION> # # <OPTION SELECTED VALUE="2">Bar</OPTION> # # <OPTION VALUE="Baz">Baz</OPTION> # # </SELECT> - # + # # popup_menu("NAME" => "name", "SIZE" => 2, "MULTIPLE" => true, # "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"]) # # <SELECT NAME="name" MULTIPLE SIZE="2"> @@ -649,10 +649,10 @@ class CGI # # radio_button("name", "value") # # <INPUT TYPE="radio" NAME="name" VALUE="value"> - # + # # radio_button("name", "value", true) # # <INPUT TYPE="radio" NAME="name" VALUE="value" CHECKED> - # + # # radio_button("NAME" => "name", "VALUE" => "value", "ID" => "foo") # # <INPUT TYPE="radio" NAME="name" VALUE="value" ID="foo"> def radio_button(name = "", value = nil, checked = nil) @@ -670,28 +670,28 @@ class CGI # # This works the same as #checkbox_group(). However, it is not valid # to have more than one radiobutton in a group checked. - # + # # radio_group("name", "foo", "bar", "baz") # # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo # # <INPUT TYPE="radio" NAME="name" VALUE="bar">bar # # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz - # + # # radio_group("name", ["foo"], ["bar", true], "baz") # # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo # # <INPUT TYPE="radio" CHECKED NAME="name" VALUE="bar">bar # # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz - # + # # radio_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz") # # <INPUT TYPE="radio" NAME="name" VALUE="1">Foo # # <INPUT TYPE="radio" CHECKED NAME="name" VALUE="2">Bar # # <INPUT TYPE="radio" NAME="name" VALUE="Baz">Baz - # + # # radio_group("NAME" => "name", # "VALUES" => ["foo", "bar", "baz"]) - # + # # radio_group("NAME" => "name", # "VALUES" => [["foo"], ["bar", true], "baz"]) - # + # # radio_group("NAME" => "name", # "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"]) def radio_group(name = "", *values) @@ -723,10 +723,10 @@ class CGI # # reset # # <INPUT TYPE="reset"> - # + # # reset("reset") # # <INPUT TYPE="reset" VALUE="reset"> - # + # # reset("VALUE" => "reset", "ID" => "foo") # # <INPUT TYPE="reset" VALUE="reset" ID="foo"> def reset(value = nil, name = nil) @@ -750,13 +750,13 @@ class CGI # # submit # # <INPUT TYPE="submit"> - # + # # submit("ok") # # <INPUT TYPE="submit" VALUE="ok"> - # + # # submit("ok", "button1") # # <INPUT TYPE="submit" VALUE="ok" NAME="button1"> - # + # # submit("VALUE" => "ok", "NAME" => "button1", "ID" => "foo") # # <INPUT TYPE="submit" VALUE="ok" NAME="button1" ID="foo"> def submit(value = nil, name = nil) @@ -779,16 +779,16 @@ class CGI # # text_field("name") # # <INPUT TYPE="text" NAME="name" SIZE="40"> - # + # # text_field("name", "value") # # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="40"> - # + # # text_field("name", "value", 80) # # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="80"> - # + # # text_field("name", "value", 80, 200) # # <INPUT TYPE="text" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200"> - # + # # text_field("NAME" => "name", "VALUE" => "value") # # <INPUT TYPE="text" NAME="name" VALUE="value"> def text_field(name = "", value = nil, size = 40, maxlength = nil) diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb index 2b5aa846d9..65d6442b37 100644 --- a/lib/cgi/session.rb +++ b/lib/cgi/session.rb @@ -13,7 +13,7 @@ # # This file provides the +CGI::Session+ class, which provides session # support for CGI scripts. A session is a sequence of HTTP requests -# and responses linked together and associated with a single client. +# and responses linked together and associated with a single client. # Information associated with the session is stored # on the server between requests. A session id is passed between client # and server with every request and response, transparently @@ -28,7 +28,7 @@ require 'tmpdir' class CGI - # Class representing an HTTP session. See documentation for the file + # Class representing an HTTP session. See documentation for the file # cgi/session.rb for an introduction to HTTP sessions. # # == Lifecycle @@ -47,7 +47,7 @@ class CGI # == Setting and retrieving session data. # # The Session class associates data with a session as key-value pairs. - # This data can be set and retrieved by indexing the Session instance + # This data can be set and retrieved by indexing the Session instance # using '[]', much the same as hashes (although other hash methods # are not supported). # @@ -60,21 +60,21 @@ class CGI # # == Storing session state # - # The caller can specify what form of storage to use for the session's + # The caller can specify what form of storage to use for the session's # data with the +database_manager+ option to CGI::Session::new. The # following storage classes are provided as part of the standard library: # - # CGI::Session::FileStore:: stores data as plain text in a flat file. Only - # works with String data. This is the default + # CGI::Session::FileStore:: stores data as plain text in a flat file. Only + # works with String data. This is the default # storage type. - # CGI::Session::MemoryStore:: stores data in an in-memory hash. The data - # only persists for as long as the current ruby + # CGI::Session::MemoryStore:: stores data in an in-memory hash. The data + # only persists for as long as the current ruby # interpreter instance does. # CGI::Session::PStore:: stores data in Marshalled format. Provided by - # cgi/session/pstore.rb. Supports data of any type, + # cgi/session/pstore.rb. Supports data of any type, # and provides file-locking and transaction support. # - # Custom storage types can also be created by defining a class with + # Custom storage types can also be created by defining a class with # the following methods: # # new(session, options) @@ -99,14 +99,14 @@ class CGI # The simplest way to do this is via cookies. The CGI::Session class # provides transparent support for session id communication via cookies # if the client has cookies enabled. - # + # # If the client has cookies disabled, the session id must be included # as a parameter of all requests sent by the client to the server. The # CGI::Session class in conjunction with the CGI class will transparently # add the session id as a hidden input field to all forms generated # using the CGI#form() HTML generation method. No built-in support is # provided for other mechanisms, such as URL re-writing. The caller is - # responsible for extracting the session id from the session_id + # responsible for extracting the session id from the session_id # attribute and manually encoding it in URLs and adding it as a hidden # input to HTML forms created by other mechanisms. Also, session expiry # is not automatically handled. @@ -124,10 +124,10 @@ class CGI # session = CGI::Session.new(cgi, # 'database_manager' => CGI::Session::PStore, # use PStore # 'session_key' => '_rb_sess_id', # custom session key - # 'session_expires' => Time.now + 30 * 60, # 30 minute timeout + # 'session_expires' => Time.now + 30 * 60, # 30 minute timeout # 'prefix' => 'pstore_sid_') # PStore option # if cgi.has_key?('user_name') and cgi['user_name'] != '' - # # coerce to String: cgi[] returns the + # # coerce to String: cgi[] returns the # # string-like CGI::QueryExtension::Value # session['user_name'] = cgi['user_name'].to_s # elsif !session['user_name'] @@ -143,11 +143,11 @@ class CGI # cgi = CGI.new("html4") # # # We make sure to delete an old session if one exists, - # # not just to free resources, but to prevent the session + # # not just to free resources, but to prevent the session # # from being maliciously hijacked later on. # begin - # session = CGI::Session.new(cgi, 'new_session' => false) - # session.delete + # session = CGI::Session.new(cgi, 'new_session' => false) + # session.delete # rescue ArgumentError # if no old session # end # session = CGI::Session.new(cgi, 'new_session' => true) @@ -172,7 +172,7 @@ class CGI # The session id is an MD5 hash based upon the time, # a random number, and a constant string. This routine # is used internally for automatically generated - # session ids. + # session ids. def create_new_id require 'securerandom' begin @@ -205,7 +205,7 @@ class CGI # it is retrieved from the +session_key+ parameter # of the request, or automatically generated for # a new session. - # new_session:: if true, force creation of a new session. If not set, + # new_session:: if true, force creation of a new session. If not set, # a new session is only created if none currently # exists. If false, a new session is never created, # and if none currently exists and the +session_id+ @@ -220,7 +220,7 @@ class CGI # The following options are also recognised, but only apply if the # session id is stored in a cookie. # - # session_expires:: the time the current session expires, as a + # session_expires:: the time the current session expires, as a # +Time+ object. If not set, the session will terminate # when the user's browser is closed. # session_domain:: the hostname domain for which this session is valid. @@ -232,10 +232,10 @@ class CGI # +option+ is also passed on to the session storage class initializer; see # the documentation for each session storage class for the options # they support. - # + # # The retrieved or created session is automatically added to +request+ # as a cookie, and also to its +output_hidden+ table, which is used - # to add hidden input elements to forms. + # to add hidden input elements to forms. # # *WARNING* the +output_hidden+ # fields are surrounded by a <fieldset> tag in HTML 4 generation, which @@ -294,7 +294,7 @@ class CGI "expires" => option['session_expires'], "domain" => option['session_domain'], "secure" => option['session_secure'], - "path" => + "path" => if option['session_path'] option['session_path'] elsif ENV["SCRIPT_NAME"] @@ -323,11 +323,11 @@ class CGI # Store session data on the server. For some session storage types, # this is a no-op. - def update + def update @dbman.update end - # Store session data on the server and close the session storage. + # Store session data on the server and close the session storage. # For some session storage types, this is a no-op. def close @dbman.close @@ -359,7 +359,7 @@ class CGI # created. The session id must only contain alphanumeric # characters; automatically generated session ids observe # this requirement. - # + # # +option+ is a hash of options for the initializer. The # following options are recognised: # @@ -450,7 +450,7 @@ class CGI # In-memory session storage class. # # Implements session storage as a global in-memory hash. Session - # data will only persist for as long as the ruby interpreter + # data will only persist for as long as the ruby interpreter # instance does. class MemoryStore GLOBAL_HASH_TABLE = {} #:nodoc: diff --git a/lib/cgi/session/pstore.rb b/lib/cgi/session/pstore.rb index 3cd3e46000..a63d7d3984 100644 --- a/lib/cgi/session/pstore.rb +++ b/lib/cgi/session/pstore.rb @@ -2,7 +2,7 @@ # cgi/session/pstore.rb - persistent storage of marshalled session data # # Documentation: William Webber (william@williamwebber.com) -# +# # == Overview # # This file provides the CGI::Session::PStore class, which builds @@ -29,7 +29,7 @@ class CGI # created. The session id must only contain alphanumeric # characters; automatically generated session ids observe # this requirement. - # + # # +option+ is a hash of options for the initializer. The # following options are recognised: # @@ -77,7 +77,7 @@ class CGI end # Save session state to the session's PStore file. - def update + def update @p.transaction do @p['hash'] = @hash end diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb index 991b68ce73..b7b0233b4d 100644 --- a/lib/cgi/util.rb +++ b/lib/cgi/util.rb @@ -119,7 +119,7 @@ class CGI # print CGI::unescapeElement( # CGI::escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG") # # "<BR><A HREF="url"></A>" - # + # # print CGI::unescapeElement( # CGI::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"]) # # "<BR><A HREF="url"></A>" @@ -161,7 +161,7 @@ class CGI # # <BODY> # # </BODY> # # </HTML> - # + # # print CGI::pretty("<HTML><BODY></BODY></HTML>", "\t") # # <HTML> # # <BODY> diff --git a/lib/csv.rb b/lib/csv.rb index 8adc2973b9..a5f670c059 100644 --- a/lib/csv.rb +++ b/lib/csv.rb @@ -5,38 +5,38 @@ # Created by James Edward Gray II on 2005-10-31. # Copyright 2005 James Edward Gray II. You can redistribute or modify this code # under the terms of Ruby's license. -# +# # See CSV for documentation. -# +# # == Description -# +# # Welcome to the new and improved CSV. -# +# # This version of the CSV library began its life as FasterCSV. FasterCSV was # intended as a replacement to Ruby's then standard CSV library. It was # designed to address concerns users of that library had and it had three # primary goals: -# +# # 1. Be significantly faster than CSV while remaining a pure Ruby library. # 2. Use a smaller and easier to maintain code base. (FasterCSV eventually # grew larger, was also but considerably richer in features. The parsing # core remains quite small.) # 3. Improve on the CSV interface. -# +# # Obviously, the last one is subjective. I did try to defer to the original # interface whenever I didn't have a compelling reason to change it though, so # hopefully this won't be too radically different. -# +# # We must have met our goals because FasterCSV was renamed to CSV and replaced # the original library. -# +# # == What's Different From the Old CSV? -# +# # I'm sure I'll miss something, but I'll try to mention most of the major # differences I am aware of, to help others quickly get up to speed: -# +# # === CSV Parsing -# +# # * This parser is m17n aware. See CSV for full details. # * This library has a stricter parser and will throw MalformedCSVErrors on # problematic data. @@ -46,9 +46,9 @@ # * The old library returned empty lines as <tt>[nil]</tt>. This library calls # them <tt>[]</tt>. # * This library has a much faster parser. -# +# # === Interface -# +# # * CSV now uses Hash-style parameters to set options. # * CSV no longer has generate_row() or parse_row(). # * The old CSV's Reader and Writer classes have been dropped. @@ -60,33 +60,33 @@ # * CSV no longer supports partial reads. It works line-by-line. # * CSV no longer allows the instance methods to override the separators for # performance reasons. They must be set in the constructor. -# +# # If you use this library and find yourself missing any functionality I have # trimmed, please {let me know}[mailto:james@grayproductions.net]. -# +# # == Documentation -# +# # See CSV for documentation. -# +# # == What is CSV, really? -# +# # CSV maintains a pretty strict definition of CSV taken directly from # {the RFC}[http://www.ietf.org/rfc/rfc4180.txt]. I relax the rules in only one # place and that is to make using this library easier. CSV will parse all valid # CSV. -# +# # What you don't want to do is feed CSV invalid data. Because of the way the # CSV format works, it's common for a parser to need to read until the end of # the file to be sure a field is invalid. This eats a lot of time and memory. -# +# # Luckily, when working with invalid CSV, Ruby's built-in methods will almost # always be superior in every way. For example, parsing non-quoted fields is as # easy as: -# +# # data.split(",") -# +# # == Questions and/or Comments -# +# # Feel free to email {James Edward Gray II}[mailto:james@grayproductions.net] # with any questions. @@ -95,139 +95,139 @@ require "English" require "date" require "stringio" -# +# # This class provides a complete interface to CSV files and data. It offers # tools to enable you to read and write to and from Strings or IO objects, as # needed. -# +# # == Reading -# +# # === From a File -# +# # ==== A Line at a Time -# +# # CSV.foreach("path/to/file.csv") do |row| # # use row here... # end -# +# # ==== All at Once -# +# # arr_of_arrs = CSV.read("path/to/file.csv") -# +# # === From a String -# +# # ==== A Line at a Time -# +# # CSV.parse("CSV,data,String") do |row| # # use row here... # end -# +# # ==== All at Once -# +# # arr_of_arrs = CSV.parse("CSV,data,String") -# +# # == Writing -# +# # === To a File -# +# # CSV.open("path/to/file.csv", "wb") do |csv| # csv << ["row", "of", "CSV", "data"] # csv << ["another", "row"] # # ... # end -# +# # === To a String -# +# # csv_string = CSV.generate do |csv| # csv << ["row", "of", "CSV", "data"] # csv << ["another", "row"] # # ... # end -# +# # == Convert a Single Line -# +# # csv_string = ["CSV", "data"].to_csv # to CSV # csv_array = "CSV,String".parse_csv # from CSV -# +# # == Shortcut Interface -# +# # CSV { |csv_out| csv_out << %w{my data here} } # to $stdout # CSV(csv = "") { |csv_str| csv_str << %w{my data here} } # to a String # CSV($stderr) { |csv_err| csv_err << %w{my data here} } # to $stderr -# +# # == CSV and Character Encodings (M17n or Multilingualization) -# +# # This new CSV parser is m17n savvy. The parser works in the Encoding of the IO # or String object being read from or written to. Your data is never transcoded # (unless you ask Ruby to transcode it for you) and will literally be parsed in # the Encoding it is in. Thus CSV will return Arrays or Rows of Strings in the # Encoding of your data. This is accomplished by transcoding the parser itself # into your Encoding. -# +# # Some transcoding must take place, of course, to accomplish this multiencoding # support. For example, <tt>:col_sep</tt>, <tt>:row_sep</tt>, and # <tt>:quote_char</tt> must be transcoded to match your data. Hopefully this # makes the entire process feel transparent, since CSV's defaults should just # magically work for you data. However, you can set these values manually in # the target Encoding to avoid the translation. -# +# # It's also important to note that while all of CSV's core parser is now # Encoding agnostic, some features are not. For example, the built-in # converters will try to transcode data to UTF-8 before making conversions. # Again, you can provide custom converters that are aware of your Encodings to # avoid this translation. It's just too hard for me to support native # conversions in all of Ruby's Encodings. -# +# # Anyway, the practical side of this is simple: make sure IO and String objects # passed into CSV have the proper Encoding set and everything should just work. # CSV methods that allow you to open IO objects (CSV::foreach(), CSV::open(), # CSV::read(), and CSV::readlines()) do allow you to specify the Encoding. -# +# # One minor exception comes when generating CSV into a String with an Encoding # that is not ASCII compatible. There's no existing data for CSV to use to # prepare itself and thus you will probably need to manually specify the desired # Encoding for most of those cases. It will try to guess using the fields in a # row of output though, when using CSV::generate_line() or Array#to_csv(). -# +# # I try to point out any other Encoding issues in the documentation of methods # as they come up. -# +# # This has been tested to the best of my ability with all non-"dummy" Encodings # Ruby ships with. However, it is brave new code and may have some bugs. # Please feel free to {report}[mailto:james@grayproductions.net] any issues you # find with it. -# +# class CSV # The version of the installed library. VERSION = "2.4.5".freeze - - # + + # # A CSV::Row is part Array and part Hash. It retains an order for the fields # and allows duplicates just as an Array would, but also allows you to access # fields by name just as you could if they were in a Hash. - # + # # All rows returned by CSV will be constructed from this class, if header row # processing is activated. - # + # class Row - # + # # Construct a new CSV::Row from +headers+ and +fields+, which are expected # to be Arrays. If one Array is shorter than the other, it will be padded # with +nil+ objects. - # + # # The optional +header_row+ parameter can be set to +true+ to indicate, via # CSV::Row.header_row?() and CSV::Row.field_row?(), that this is a header # row. Otherwise, the row is assumes to be a field row. - # + # # A CSV::Row object supports the following Array methods through delegation: - # + # # * empty?() # * length() # * size() - # + # def initialize(headers, fields, header_row = false) @header_row = header_row - + # handle extra headers or fields @row = if headers.size > fields.size headers.zip(fields) @@ -235,7 +235,7 @@ class CSV fields.zip(headers).map { |pair| pair.reverse } end end - + # Internal data format used to compare equality. attr_reader :row protected :row @@ -244,35 +244,35 @@ class CSV extend Forwardable def_delegators :@row, :empty?, :length, :size - + # Returns +true+ if this is a header row. def header_row? @header_row end - + # Returns +true+ if this is a field row. def field_row? not header_row? end - + # Returns the headers of this row. def headers @row.map { |pair| pair.first } end - - # + + # # :call-seq: # field( header ) # field( header, offset ) # field( index ) - # + # # This method will fetch the field value by +header+ or +index+. If a field # is not found, +nil+ is returned. - # + # # When provided, +offset+ ensures that a header match occurrs on or later - # than the +offset+ index. You can use this to find duplicate headers, + # than the +offset+ index. You can use this to find duplicate headers, # without resorting to hard-coding exact indices. - # + # def field(header_or_index, minimum_index = 0) # locate the pair finder = header_or_index.is_a?(Integer) ? :[] : :assoc @@ -282,23 +282,23 @@ class CSV pair.nil? ? nil : pair.last end alias_method :[], :field - - # + + # # :call-seq: # []=( header, value ) # []=( header, offset, value ) # []=( index, value ) - # + # # Looks up the field by the semantics described in CSV::Row.field() and # assigns the +value+. - # + # # Assigning past the end of the row with an index will set all pairs between # to <tt>[nil, nil]</tt>. Assigning to an unused header appends the new # pair. - # + # def []=(*args) value = args.pop - + if args.first.is_a? Integer if @row[args.first].nil? # extending past the end with index @row[args.first] = [nil, value] @@ -315,20 +315,20 @@ class CSV end end end - - # + + # # :call-seq: # <<( field ) # <<( header_and_field_array ) # <<( header_and_field_hash ) - # + # # If a two-element Array is provided, it is assumed to be a header and field # and the pair is appended. A Hash works the same way with the key being # the header and the value being the field. Anything else is assumed to be # a lone field which is appended with a +nil+ header. - # + # # This method returns the row for chaining. - # + # def <<(arg) if arg.is_a?(Array) and arg.size == 2 # appending a header and name @row << arg @@ -337,33 +337,33 @@ class CSV else # append field value @row << [nil, arg] end - + self # for chaining end - - # + + # # A shortcut for appending multiple fields. Equivalent to: - # + # # args.each { |arg| csv_row << arg } - # + # # This method returns the row for chaining. - # + # def push(*args) args.each { |arg| self << arg } - + self # for chaining end - - # + + # # :call-seq: # delete( header ) # delete( header, offset ) # delete( index ) - # + # # Used to remove a pair from the row by +header+ or +index+. The pair is # located as described in CSV::Row.field(). The deleted pair is returned, # or +nil+ if a pair could not be found. - # + # def delete(header_or_index, minimum_index = 0) if header_or_index.is_a? Integer # by index @row.delete_at(header_or_index) @@ -371,28 +371,28 @@ class CSV @row.delete_at(index(header_or_index, minimum_index)) end end - - # + + # # The provided +block+ is passed a header and field for each pair in the row # and expected to return +true+ or +false+, depending on whether the pair # should be deleted. - # + # # This method returns the row for chaining. - # + # def delete_if(&block) @row.delete_if(&block) - + self # for chaining end - - # + + # # This method accepts any number of arguments which can be headers, indices, - # Ranges of either, or two-element Arrays containing a header and offset. + # Ranges of either, or two-element Arrays containing a header and offset. # Each argument will be replaced with a field lookup as described in # CSV::Row.field(). - # + # # If called with no arguments, all fields are returned. - # + # def fields(*headers_and_or_indices) if headers_and_or_indices.empty? # return all fields--no arguments @row.map { |pair| pair.last } @@ -413,80 +413,80 @@ class CSV end end alias_method :values_at, :fields - - # + + # # :call-seq: # index( header ) # index( header, offset ) - # + # # This method will return the index of a field with the provided +header+. # The +offset+ can be used to locate duplicate header names, as described in # CSV::Row.field(). - # + # def index(header, minimum_index = 0) # find the pair index = headers[minimum_index..-1].index(header) # return the index at the right offset, if we found one index.nil? ? nil : index + minimum_index end - + # Returns +true+ if +name+ is a header for this row, and +false+ otherwise. def header?(name) headers.include? name end alias_method :include?, :header? - - # + + # # Returns +true+ if +data+ matches a field in this row, and +false+ # otherwise. - # + # def field?(data) fields.include? data end include Enumerable - - # + + # # Yields each pair of the row as header and field tuples (much like # iterating over a Hash). - # + # # Support for Enumerable. - # + # # This method returns the row for chaining. - # + # def each(&block) @row.each(&block) - + self # for chaining end - - # - # Returns +true+ if this row contains the same headers and fields in the + + # + # Returns +true+ if this row contains the same headers and fields in the # same order as +other+. - # + # def ==(other) @row == other.row end - - # + + # # Collapses the row into a simple Hash. Be warning that this discards field # order and clobbers duplicate fields. - # + # def to_hash # flatten just one level of the internal Array Hash[*@row.inject(Array.new) { |ary, pair| ary.push(*pair) }] end - - # + + # # Returns the row as a CSV String. Headers are not used. Equivalent to: - # + # # csv_row.fields.to_csv( options ) - # + # def to_csv(options = Hash.new) fields.to_csv(options) end alias_method :to_s, :to_csv - + # A summary of fields, by header, in an ASCII compatible String. def inspect str = ["#<", self.class.to_s] @@ -505,35 +505,35 @@ class CSV end end end - - # + + # # A CSV::Table is a two-dimensional data structure for representing CSV - # documents. Tables allow you to work with the data by row or column, + # documents. Tables allow you to work with the data by row or column, # manipulate the data, and even convert the results back to CSV, if needed. - # + # # All tables returned by CSV will be constructed from this class, if header # row processing is activated. - # + # class Table - # + # # Construct a new CSV::Table from +array_of_rows+, which are expected # to be CSV::Row objects. All rows are assumed to have the same headers. - # + # # A CSV::Table object supports the following Array methods through # delegation: - # + # # * empty?() # * length() # * size() - # + # def initialize(array_of_rows) @table = array_of_rows @mode = :col_or_row end - + # The current access mode for indexing and iteration. attr_reader :mode - + # Internal data format used to compare equality. attr_reader :table protected :table @@ -542,88 +542,88 @@ class CSV extend Forwardable def_delegators :@table, :empty?, :length, :size - - # - # Returns a duplicate table object, in column mode. This is handy for - # chaining in a single call without changing the table mode, but be aware + + # + # Returns a duplicate table object, in column mode. This is handy for + # chaining in a single call without changing the table mode, but be aware # that this method can consume a fair amount of memory for bigger data sets. - # + # # This method returns the duplicate table for chaining. Don't chain # destructive methods (like []=()) this way though, since you are working # with a duplicate. - # + # def by_col self.class.new(@table.dup).by_col! end - - # + + # # Switches the mode of this table to column mode. All calls to indexing and # iteration methods will work with columns until the mode is changed again. - # + # # This method returns the table and is safe to chain. - # + # def by_col! @mode = :col - + self end - - # - # Returns a duplicate table object, in mixed mode. This is handy for - # chaining in a single call without changing the table mode, but be aware + + # + # Returns a duplicate table object, in mixed mode. This is handy for + # chaining in a single call without changing the table mode, but be aware # that this method can consume a fair amount of memory for bigger data sets. - # + # # This method returns the duplicate table for chaining. Don't chain # destructive methods (like []=()) this way though, since you are working # with a duplicate. - # + # def by_col_or_row self.class.new(@table.dup).by_col_or_row! end - - # + + # # Switches the mode of this table to mixed mode. All calls to indexing and # iteration methods will use the default intelligent indexing system until # the mode is changed again. In mixed mode an index is assumed to be a row # reference while anything else is assumed to be column access by headers. - # + # # This method returns the table and is safe to chain. - # + # def by_col_or_row! @mode = :col_or_row - + self end - - # + + # # Returns a duplicate table object, in row mode. This is handy for chaining # in a single call without changing the table mode, but be aware that this # method can consume a fair amount of memory for bigger data sets. - # + # # This method returns the duplicate table for chaining. Don't chain # destructive methods (like []=()) this way though, since you are working # with a duplicate. - # + # def by_row self.class.new(@table.dup).by_row! end - - # + + # # Switches the mode of this table to row mode. All calls to indexing and # iteration methods will work with rows until the mode is changed again. - # + # # This method returns the table and is safe to chain. - # + # def by_row! @mode = :row - + self end - - # + + # # Returns the headers for the first row of this table (assumed to match all # other rows). An empty Array is returned for empty tables. - # + # def headers if @table.empty? Array.new @@ -631,15 +631,15 @@ class CSV @table.first.headers end end - - # + + # # In the default mixed mode, this method returns rows for index access and # columns for header access. You can force the index association by first # calling by_col!() or by_row!(). - # + # # Columns are returned as an Array of values. Altering that Array has no # effect on the table. - # + # def [](index_or_header) if @mode == :row or # by index (@mode == :col_or_row and index_or_header.is_a? Integer) @@ -648,23 +648,23 @@ class CSV @table.map { |row| row[index_or_header] } end end - - # + + # # In the default mixed mode, this method assigns rows for index access and # columns for header access. You can force the index association by first # calling by_col!() or by_row!(). - # + # # Rows may be set to an Array of values (which will inherit the table's # headers()) or a CSV::Row. - # - # Columns may be set to a single value, which is copied to each row of the + # + # Columns may be set to a single value, which is copied to each row of the # column, or an Array of values. Arrays of values are assigned to rows top # to bottom in row major order. Excess values are ignored and if the Array # does not have a value for each row the extra rows will receive a +nil+. - # + # # Assigning to an existing column or row clobbers the data. Assigning to # new columns creates them at the right end of the table. - # + # def []=(index_or_header, value) if @mode == :row or # by index (@mode == :col_or_row and index_or_header.is_a? Integer) @@ -693,16 +693,16 @@ class CSV end end end - - # + + # # The mixed mode default is to treat a list of indices as row access, # returning the rows indicated. Anything else is considered columnar # access. For columnar access, the return set has an Array for each row # with the values indicated by the headers in each Array. You can force # column or row mode using by_col!() or by_row!(). - # + # # You cannot mix column and row access. - # + # def values_at(*indices_or_headers) if @mode == :row or # by indices ( @mode == :col_or_row and indices_or_headers.all? do |index| @@ -717,41 +717,41 @@ class CSV end end - # + # # Adds a new row to the bottom end of this table. You can provide an Array, # which will be converted to a CSV::Row (inheriting the table's headers()), # or a CSV::Row. - # + # # This method returns the table for chaining. - # + # def <<(row_or_array) if row_or_array.is_a? Array # append Array @table << Row.new(headers, row_or_array) else # append Row @table << row_or_array end - + self # for chaining end - - # + + # # A shortcut for appending multiple rows. Equivalent to: - # + # # rows.each { |row| self << row } - # + # # This method returns the table for chaining. - # + # def push(*rows) rows.each { |row| self << row } - + self # for chaining end - # + # # Removes and returns the indicated column or row. In the default mixed # mode indices refer to rows and everything else is assumed to be a column # header. Use by_col!() or by_row!() to force the lookup. - # + # def delete(index_or_header) if @mode == :row or # by index (@mode == :col_or_row and index_or_header.is_a? Integer) @@ -760,15 +760,15 @@ class CSV @table.map { |row| row.delete(index_or_header).last } end end - - # + + # # Removes any column or row for which the block returns +true+. In the # default mixed mode or row mode, iteration is the standard row major # walking of rows. In column mode, interation will +yield+ two element # tuples containing the column name and an Array of values for that column. - # + # # This method returns the table for chaining. - # + # def delete_if(&block) if @mode == :row or @mode == :col_or_row # by index @table.delete_if(&block) @@ -779,38 +779,38 @@ class CSV end to_delete.map { |header| delete(header) } end - + self # for chaining end - + include Enumerable - - # + + # # In the default mixed mode or row mode, iteration is the standard row major # walking of rows. In column mode, interation will +yield+ two element # tuples containing the column name and an Array of values for that column. - # + # # This method returns the table for chaining. - # + # def each(&block) if @mode == :col headers.each { |header| block[[header, self[header]]] } else @table.each(&block) end - + self # for chaining end - + # Returns +true+ if all rows of this table ==() +other+'s rows. def ==(other) @table == other.table end - - # + + # # Returns the table as an Array of Arrays. Headers will be the first row, # then all of the field rows will follow. - # + # def to_a @table.inject([headers]) do |array, row| if row.header_row? @@ -820,11 +820,11 @@ class CSV end end end - - # + + # # Returns the table as a complete CSV String. Headers will be listed first, # then all of the field rows. - # + # def to_csv(options = Hash.new) @table.inject([headers.to_csv(options)]) do |rows, row| if row.header_row? @@ -835,7 +835,7 @@ class CSV end.join end alias_method :to_s, :to_csv - + # Shows the mode and size of this table in a US-ASCII String. def inspect "#<#{self.class} mode:#{@mode} row_count:#{to_a.size}>".encode("US-ASCII") @@ -844,19 +844,19 @@ class CSV # The error thrown when the parser encounters illegal CSV formatting. class MalformedCSVError < RuntimeError; end - - # + + # # A FieldInfo Struct contains details about a field's position in the data # source it was read from. CSV will pass this Struct to some blocks that make # decisions based on field structure. See CSV.convert_fields() for an # example. - # + # # <b><tt>index</tt></b>:: The zero-based index of the field in its row. # <b><tt>line</tt></b>:: The line of the data source this row is from. # <b><tt>header</tt></b>:: The header for the column, when available. - # + # FieldInfo = Struct.new(:index, :line, :header) - + # A Regexp used to find and convert some common Date formats. DateMatcher = / \A(?: (\w+,?\s+)?\w+\s+\d{1,2},?\s+\d{2,4} | \d{4}-\d{2}-\d{2} )\z /x @@ -864,34 +864,34 @@ class CSV DateTimeMatcher = / \A(?: (\w+,?\s+)?\w+\s+\d{1,2}\s+\d{1,2}:\d{1,2}:\d{1,2},?\s+\d{2,4} | \d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2} )\z /x - + # The encoding used by all converters. ConverterEncoding = Encoding.find("UTF-8") - - # + + # # This Hash holds the built-in converters of CSV that can be accessed by name. # You can select Converters with CSV.convert() or through the +options+ Hash # passed to CSV::new(). - # + # # <b><tt>:integer</tt></b>:: Converts any field Integer() accepts. # <b><tt>:float</tt></b>:: Converts any field Float() accepts. - # <b><tt>:numeric</tt></b>:: A combination of <tt>:integer</tt> + # <b><tt>:numeric</tt></b>:: A combination of <tt>:integer</tt> # and <tt>:float</tt>. # <b><tt>:date</tt></b>:: Converts any field Date::parse() accepts. # <b><tt>:date_time</tt></b>:: Converts any field DateTime::parse() accepts. - # <b><tt>:all</tt></b>:: All built-in converters. A combination of + # <b><tt>:all</tt></b>:: All built-in converters. A combination of # <tt>:date_time</tt> and <tt>:numeric</tt>. - # + # # All built-in converters transcode field data to UTF-8 before attempting a # conversion. If your data cannot be transcoded to UTF-8 the conversion will # fail and the field will remain unchanged. - # + # # This Hash is intentionally left unfrozen and users should feel free to add # values to it that can be accessed by all CSV objects. - # + # # To add a combo field, the value should be an Array of names. Combo fields # can be nested with other combo fields. - # + # Converters = { integer: lambda { |f| Integer(f.encode(ConverterEncoding)) rescue f }, @@ -917,26 +917,26 @@ class CSV }, all: [:date_time, :numeric] } - # + # # This Hash holds the built-in header converters of CSV that can be accessed # by name. You can select HeaderConverters with CSV.header_convert() or # through the +options+ Hash passed to CSV::new(). - # + # # <b><tt>:downcase</tt></b>:: Calls downcase() on the header String. # <b><tt>:symbol</tt></b>:: The header String is downcased, spaces are # replaced with underscores, non-word characters # are dropped, and finally to_sym() is called. - # + # # All built-in header converters transcode header data to UTF-8 before # attempting a conversion. If your data cannot be transcoded to UTF-8 the # conversion will fail and the header will remain unchanged. - # + # # This Hash is intetionally left unfrozen and users should feel free to add # values to it that can be accessed by all CSV objects. - # + # # To add a combo field, the value should be an Array of names. Combo fields # can be nested with other combo fields. - # + # HeaderConverters = { downcase: lambda { |h| h.encode(ConverterEncoding).downcase }, symbol: lambda { |h| @@ -944,10 +944,10 @@ class CSV gsub(/\W+/, "").to_sym } } - - # + + # # The options used when no overrides are given by calling code. They are: - # + # # <b><tt>:col_sep</tt></b>:: <tt>","</tt> # <b><tt>:row_sep</tt></b>:: <tt>:auto</tt> # <b><tt>:quote_char</tt></b>:: <tt>'"'</tt> @@ -959,10 +959,10 @@ class CSV # <b><tt>:header_converters</tt></b>:: +nil+ # <b><tt>:skip_blanks</tt></b>:: +false+ # <b><tt>:force_quotes</tt></b>:: +false+ - # + # DEFAULT_OPTIONS = { col_sep: ",", row_sep: :auto, - quote_char: '"', + quote_char: '"', field_size_limit: nil, converters: nil, unconverted_fields: nil, @@ -971,21 +971,21 @@ class CSV header_converters: nil, skip_blanks: false, force_quotes: false }.freeze - - # + + # # This method will return a CSV instance, just like CSV::new(), but the # instance will be cached and returned for all future calls to this method for # the same +data+ object (tested by Object#object_id()) with the same # +options+. - # + # # If a block is given, the instance is passed to the block and the return # value becomes the return value of the block. - # + # def self.instance(data = $stdout, options = Hash.new) # create a _signature_ for this method call, data object and options sig = [data.object_id] + options.values_at(*DEFAULT_OPTIONS.keys.sort_by { |sym| sym.to_s }) - + # fetch or create the instance for this signature @@instances ||= Hash.new instance = (@@instances[sig] ||= new(data, options)) @@ -997,25 +997,25 @@ class CSV end end - # + # # This method allows you to serialize an Array of Ruby objects to a String or # File of CSV data. This is not as powerful as Marshal or YAML, but perhaps # useful for spreadsheet and database interaction. - # + # # Out of the box, this method is intended to work with simple data objects or # Structs. It will serialize a list of instance variables and/or # Struct.members(). - # + # # If you need need more complicated serialization, you can control the process # by adding methods to the class to be serialized. - # + # # A class method csv_meta() is responsible for returning the first row of the # document (as an Array). This row is considered to be a Hash of the form # key_1,value_1,key_2,value_2,... CSV::load() expects to find a class key # with a value of the stringified class name and CSV::dump() will create this, # if you do not define this method. This method is only called on the first # object of the Array. - # + # # The next method you can provide is an instance method called csv_headers(). # This method is expected to return the second line of the document (again as # an Array), which is to be used to give each column a header. By default, @@ -1023,20 +1023,20 @@ class CSV # @ character or call send() passing the header as the method name and # the field value as an argument. This method is only called on the first # object of the Array. - # + # # Finally, you can provide an instance method called csv_dump(), which will # be passed the headers. This should return an Array of fields that can be # serialized for this object. This method is called once for every object in # the Array. - # + # # The +io+ parameter can be used to serialize to a File, and +options+ can be # anything CSV::new() accepts. - # + # def self.dump(ary_of_objs, io = "", options = Hash.new) obj_template = ary_of_objs.first - + csv = new(io, options) - + # write meta information begin csv << obj_template.class.csv_meta @@ -1054,7 +1054,7 @@ class CSV end end csv << headers - + # serialize each object ary_of_objs.each do |obj| begin @@ -1069,39 +1069,39 @@ class CSV end end end - + if io.is_a? String csv.string else csv.close end end - - # + + # # This method is the reading counterpart to CSV::dump(). See that method for # a detailed description of the process. - # - # You can customize loading by adding a class method called csv_load() which + # + # You can customize loading by adding a class method called csv_load() which # will be passed a Hash of meta information, an Array of headers, and an Array # of fields for the object the method is expected to return. - # + # # Remember that all fields will be Strings after this load. If you need # something else, use +options+ to setup converters or provide a custom # csv_load() implementation. - # + # def self.load(io_or_str, options = Hash.new) csv = new(io_or_str, options) - + # load meta information meta = Hash[*csv.shift] cls = meta["class".encode(csv.encoding)].split("::".encode(csv.encoding)). inject(Object) do |c, const| c.const_get(const) end - + # load headers headers = csv.shift - + # unserialize each object stored in the file results = csv.inject(Array.new) do |all, row| begin @@ -1118,36 +1118,36 @@ class CSV end all << obj end - + csv.close unless io_or_str.is_a? String - + results end - - # + + # # :call-seq: # filter( options = Hash.new ) { |row| ... } # filter( input, options = Hash.new ) { |row| ... } # filter( input, output, options = Hash.new ) { |row| ... } - # + # # This method is a convenience for building Unix-like filters for CSV data. - # Each row is yielded to the provided block which can alter it as needed. + # Each row is yielded to the provided block which can alter it as needed. # After the block returns, the row is appended to +output+ altered or not. - # + # # The +input+ and +output+ arguments can be anything CSV::new() accepts - # (generally String or IO objects). If not given, they default to + # (generally String or IO objects). If not given, they default to # <tt>ARGF</tt> and <tt>$stdout</tt>. - # + # # The +options+ parameter is also filtered down to CSV::new() after some - # clever key parsing. Any key beginning with <tt>:in_</tt> or + # clever key parsing. Any key beginning with <tt>:in_</tt> or # <tt>:input_</tt> will have that leading identifier stripped and will only # be used in the +options+ Hash for the +input+ object. Keys starting with - # <tt>:out_</tt> or <tt>:output_</tt> affect only +output+. All other keys + # <tt>:out_</tt> or <tt>:output_</tt> affect only +output+. All other keys # are assigned to both objects. - # + # # The <tt>:output_row_sep</tt> +option+ defaults to # <tt>$INPUT_RECORD_SEPARATOR</tt> (<tt>$/</tt>). - # + # def self.filter(*args) # parse options for input, output, or both in_options, out_options = Hash.new, {row_sep: $INPUT_RECORD_SEPARATOR} @@ -1167,19 +1167,19 @@ class CSV # build input and output wrappers input = new(args.shift || ARGF, in_options) output = new(args.shift || $stdout, out_options) - + # read, yield, write input.each do |row| yield row output << row end end - - # + + # # This method is intended as the primary interface for reading CSV files. You # pass a +path+ and any +options+ you wish to set for the read. Each row of # file will be passed to the provided +block+ in turn. - # + # # The +options+ parameter can be anything CSV::new() understands. This method # also understands an additional <tt>:encoding</tt> parameter that you can use # to specify the Encoding of the data in the file to be read. You must provide @@ -1188,7 +1188,7 @@ class CSV # have the data transcoded as it is read. For example, # <tt>encoding: "UTF-32BE:UTF-8"</tt> would read UTF-32BE data from the file # but transcode it to UTF-8 before CSV parses it. - # + # def self.foreach(path, options = Hash.new, &block) encoding = options.delete(:encoding) mode = "rb" @@ -1198,24 +1198,24 @@ class CSV end end - # + # # :call-seq: # generate( str, options = Hash.new ) { |csv| ... } # generate( options = Hash.new ) { |csv| ... } - # - # This method wraps a String you provide, or an empty default String, in a + # + # This method wraps a String you provide, or an empty default String, in a # CSV object which is passed to the provided block. You can use the block to # append CSV rows to the String and when the block exits, the final String # will be returned. - # + # # Note that a passed String *is* modfied by this method. Call dup() before # passing if you need a new String. - # + # # The +options+ parameter can be anthing CSV::new() understands. This method # understands an additional <tt>:encoding</tt> parameter when not passed a # String to set the base Encoding for the output. CSV needs this hint if you # plan to output non-ASCII compatible data. - # + # def self.generate(*args) # add a default empty String, if none was given if args.first.is_a? String @@ -1233,19 +1233,19 @@ class CSV csv.string # return final String end - # - # This method is a shortcut for converting a single row (Array) into a CSV + # + # This method is a shortcut for converting a single row (Array) into a CSV # String. - # + # # The +options+ parameter can be anthing CSV::new() understands. This method - # understands an additional <tt>:encoding</tt> parameter to set the base + # understands an additional <tt>:encoding</tt> parameter to set the base # Encoding for the output. This method will try to guess your Encoding from # the first non-+nil+ field in +row+, if possible, but you may need to use # this parameter as a backup plan. - # + # # The <tt>:row_sep</tt> +option+ defaults to <tt>$INPUT_RECORD_SEPARATOR</tt> # (<tt>$/</tt>) when calling this method. - # + # def self.generate_line(row, options = Hash.new) options = {row_sep: $INPUT_RECORD_SEPARATOR}.merge(options) encoding = options.delete(:encoding) @@ -1257,27 +1257,27 @@ class CSV end (new(str, options) << row).string end - - # + + # # :call-seq: # open( filename, mode = "rb", options = Hash.new ) { |faster_csv| ... } # open( filename, options = Hash.new ) { |faster_csv| ... } # open( filename, mode = "rb", options = Hash.new ) # open( filename, options = Hash.new ) - # + # # This method opens an IO object, and wraps that with CSV. This is intended # as the primary interface for writing a CSV file. - # + # # You must pass a +filename+ and may optionally add a +mode+ for Ruby's # open(). You may also pass an optional Hash containing any +options+ # CSV::new() understands as the final argument. - # + # # This method works like Ruby's open() call, in that it will pass a CSV object # to a provided block and close it when the block terminates, or it will # return the CSV object when no block is provided. (*Note*: This is different # from the Ruby 1.8 CSV library which passed rows to the block. Use # CSV::foreach() for that behavior.) - # + # # You must provide a +mode+ with an embedded Encoding designator unless your # data is in Encoding::default_external(). CSV will check the Encoding of the # underlying IO object (set by the +mode+ you pass) to deterime how to parse @@ -1285,10 +1285,10 @@ class CSV # it is read just as you can with a normal call to IO::open(). For example, # <tt>"rb:UTF-32BE:UTF-8"</tt> would read UTF-32BE data from the file but # transcode it to UTF-8 before CSV parses it. - # + # # An opened CSV object will delegate to many IO methods for convenience. You # may call: - # + # # * binmode() # * binmode?() # * close() @@ -1320,7 +1320,7 @@ class CSV # * to_io() # * truncate() # * tty?() - # + # def self.open(*args) # find the +options+ Hash options = if args.last.is_a? Hash then args.pop else Hash.new end @@ -1328,7 +1328,7 @@ class CSV args << "rb" if args.size == 1 # wrap a File opened with the remaining +args+ csv = new(File.open(*args), options) - + # handle blocks like Ruby's open(), not like the CSV library if block_given? begin @@ -1340,19 +1340,19 @@ class CSV csv end end - - # + + # # :call-seq: # parse( str, options = Hash.new ) { |row| ... } # parse( str, options = Hash.new ) - # + # # This method can be used to easily parse CSV out of a String. You may either # provide a +block+ which will be called with each row of the String in turn, # or just use the returned Array of Arrays (when no +block+ is given). - # + # # You pass your +str+ to read from, and an optional +options+ Hash containing # anything CSV::new() understands. - # + # def self.parse(*args, &block) csv = new(*args) if block.nil? # slurp contents, if no block is given @@ -1365,20 +1365,20 @@ class CSV csv.each(&block) end end - - # - # This method is a shortcut for converting a single line of a CSV String into - # a into an Array. Note that if +line+ contains multiple rows, anything + + # + # This method is a shortcut for converting a single line of a CSV String into + # a into an Array. Note that if +line+ contains multiple rows, anything # beyond the first row is ignored. - # + # # The +options+ parameter can be anthing CSV::new() understands. - # + # def self.parse_line(line, options = Hash.new) new(line, options).shift end - - # - # Use to slurp a CSV file into an Array of Arrays. Pass the +path+ to the + + # + # Use to slurp a CSV file into an Array of Arrays. Pass the +path+ to the # file and any +options+ CSV::new() understands. This method also understands # an additional <tt>:encoding</tt> parameter that you can use to specify the # Encoding of the data in the file to be read. You must provide this unless @@ -1387,46 +1387,46 @@ class CSV # transcoded as it is read. For example, # <tt>encoding: "UTF-32BE:UTF-8"</tt> would read UTF-32BE data from the file # but transcode it to UTF-8 before CSV parses it. - # + # def self.read(path, options = Hash.new) encoding = options.delete(:encoding) mode = "rb" mode << ":#{encoding}" if encoding open(path, mode, options) { |csv| csv.read } end - + # Alias for CSV::read(). def self.readlines(*args) read(*args) end - - # + + # # A shortcut for: - # + # # CSV.read( path, { headers: true, # converters: :numeric, # header_converters: :symbol }.merge(options) ) - # + # def self.table(path, options = Hash.new) read( path, { headers: true, converters: :numeric, header_converters: :symbol }.merge(options) ) end - - # + + # # This constructor will wrap either a String or IO object passed in +data+ for # reading and/or writing. In addition to the CSV instance methods, several IO # methods are delegated. (See CSV::open() for a complete list.) If you pass # a String for +data+, you can later retrieve it (after writing to it, for # example) with CSV.string(). - # - # Note that a wrapped String will be positioned at at the beginning (for + # + # Note that a wrapped String will be positioned at at the beginning (for # reading). If you want it at the end (for writing), use CSV::generate(). # If you want any other positioning, pass a preset StringIO object instead. - # - # You may set any reading and/or writing preferences in the +options+ Hash. + # + # You may set any reading and/or writing preferences in the +options+ Hash. # Available options are: - # + # # <b><tt>:col_sep</tt></b>:: The String placed between each field. # This String will be transcoded into # the data's Encoding before parsing. @@ -1501,7 +1501,7 @@ class CSV # Array or String were not fields of the # document and thus will have an empty # Array attached. - # <b><tt>:headers</tt></b>:: If set to <tt>:first_row</tt> or + # <b><tt>:headers</tt></b>:: If set to <tt>:first_row</tt> or # +true+, the initial row of the CSV # file will be treated as a row of # headers. If set to an Array, the @@ -1538,16 +1538,16 @@ class CSV # skip over any rows with no content. # <b><tt>:force_quotes</tt></b>:: When set to a +true+ value, CSV will # quote all CSV fields it creates. - # + # # See CSV::DEFAULT_OPTIONS for the default settings. - # + # # Options cannot be overriden in the instance methods for performance reasons, # so be sure to set what you want here. - # + # def initialize(data, options = Hash.new) # build the options for this read/write options = DEFAULT_OPTIONS.merge(options) - + # create the IO object we will read from @io = if data.is_a? String then StringIO.new(data) else data end # honor the IO encoding if we can, otherwise default to ASCII-8BIT @@ -1557,110 +1557,110 @@ class CSV @io.string.encoding end @encoding ||= Encoding.default_internal || Encoding.default_external - # + # # prepare for building safe regular expressions in the target encoding, # if we can transcode the needed characters - # + # @re_esc = "\\".encode(@encoding) rescue "" @re_chars = %w[ \\ . [ ] - ^ $ ? * + { } ( ) | # \ \r \n \t \f \v ]. map { |s| s.encode(@encoding) rescue nil }.compact - + init_separators(options) init_parsers(options) init_converters(options) init_headers(options) - + unless options.empty? raise ArgumentError, "Unknown options: #{options.keys.join(', ')}." end - + # track our own lineno since IO gets confused about line-ends is CSV fields @lineno = 0 end - - # + + # # The encoded <tt>:col_sep</tt> used in parsing and writing. See CSV::new # for details. - # + # attr_reader :col_sep - # + # # The encoded <tt>:row_sep</tt> used in parsing and writing. See CSV::new # for details. - # + # attr_reader :row_sep - # + # # The encoded <tt>:quote_char</tt> used in parsing and writing. See CSV::new # for details. - # + # attr_reader :quote_char # The limit for field size, if any. See CSV::new for details. attr_reader :field_size_limit - # + # # Returns the current list of converters in effect. See CSV::new for details. # Built-in converters will be returned by name, while others will be returned # as is. - # + # def converters @converters.map do |converter| name = Converters.rassoc(converter) name ? name.first : converter end end - # + # # Returns +true+ if unconverted_fields() to parsed results. See CSV::new # for details. - # + # def unconverted_fields?() @unconverted_fields end - # + # # Returns +nil+ if headers will not be used, +true+ if they will but have not # yet been read, or the actual headers after they have been read. See # CSV::new for details. - # + # def headers @headers || true if @use_headers end - # + # # Returns +true+ if headers will be returned as a row of results. # See CSV::new for details. - # + # def return_headers?() @return_headers end # Returns +true+ if headers are written in output. See CSV::new for details. def write_headers?() @write_headers end - # + # # Returns the current list of converters in effect for headers. See CSV::new # for details. Built-in converters will be returned by name, while others # will be returned as is. - # + # def header_converters @header_converters.map do |converter| name = HeaderConverters.rassoc(converter) name ? name.first : converter end end - # + # # Returns +true+ blank lines are skipped by the parser. See CSV::new # for details. - # + # def skip_blanks?() @skip_blanks end # Returns +true+ if all output fields are quoted. See CSV::new for details. def force_quotes?() @force_quotes end - - # + + # # The Encoding CSV is parsing or writing in. This will be the Encoding you # receive parsed data in and/or the Encoding data will be written in. - # + # attr_reader :encoding - - # - # The line number of the last row read from this file. Fields with nested + + # + # The line number of the last row read from this file. Fields with nested # line-end characters will not affect this count. - # + # attr_reader :lineno - + ### IO and StringIO Delegation ### - + extend Forwardable def_delegators :@io, :binmode, :binmode?, :close, :close_read, :close_write, :closed?, :eof, :eof?, :external_encoding, :fcntl, @@ -1668,31 +1668,31 @@ class CSV :ioctl, :isatty, :path, :pid, :pos, :pos=, :reopen, :seek, :stat, :string, :sync, :sync=, :tell, :to_i, :to_io, :truncate, :tty? - + # Rewinds the underlying IO object and resets CSV's lineno() counter. def rewind @headers = nil @lineno = 0 - + @io.rewind end ### End Delegation ### - - # + + # # The primary write method for wrapped Strings and IOs, +row+ (an Array or # CSV::Row) is converted to CSV and appended to the data source. When a # CSV::Row is passed, only the row's fields() are appended to the output. - # + # # The data source must be open for writing. - # + # def <<(row) # make sure headers have been assigned if header_row? and [Array, String].include? @use_headers.class parse_headers # won't read data for Array or String self << @headers if @write_headers end - + # handle CSV::Row objects and Hashes row = case row when self.class::Row then row.fields @@ -1704,69 +1704,69 @@ class CSV @lineno += 1 @io << row.map(&@quote).join(@col_sep) + @row_sep # quote and separate - + self # for chaining end alias_method :add_row, :<< alias_method :puts, :<< - - # + + # # :call-seq: # convert( name ) # convert { |field| ... } # convert { |field, field_info| ... } - # + # # You can use this method to install a CSV::Converters built-in, or provide a # block that handles a custom conversion. - # + # # If you provide a block that takes one argument, it will be passed the field # and is expected to return the converted value or the field itself. If your - # block takes two arguments, it will also be passed a CSV::FieldInfo Struct, - # containing details about the field. Again, the block should return a + # block takes two arguments, it will also be passed a CSV::FieldInfo Struct, + # containing details about the field. Again, the block should return a # converted field or the field itself. - # + # def convert(name = nil, &converter) add_converter(:converters, self.class::Converters, name, &converter) end - # + # # :call-seq: # header_convert( name ) # header_convert { |field| ... } # header_convert { |field, field_info| ... } - # + # # Identical to CSV#convert(), but for header rows. - # + # # Note that this method must be called before header rows are read to have any # effect. - # + # def header_convert(name = nil, &converter) add_converter( :header_converters, self.class::HeaderConverters, name, &converter ) end - + include Enumerable - - # + + # # Yields each row of the data source in turn. - # + # # Support for Enumerable. - # + # # The data source must be open for reading. - # + # def each while row = shift yield row end end - - # + + # # Slurps the remaining rows and returns an Array of Arrays. - # + # # The data source must be open for reading. - # + # def read rows = to_a if @use_headers @@ -1776,25 +1776,25 @@ class CSV end end alias_method :readlines, :read - + # Returns +true+ if the next row read will be a header row. def header_row? @use_headers and @headers.nil? end - - # + + # # The primary read method for wrapped Strings and IOs, a single row is pulled # from the data source, parsed and returned as an Array of fields (if header # rows are not used) or a CSV::Row (when header rows are used). - # + # # The data source must be open for reading. - # + # def shift ######################################################################### ### This method is purposefully kept a bit long as simple conditional ### ### checks are faster than numerous (expensive) method calls. ### ######################################################################### - + # handle headers not based on document content if header_row? and @return_headers and [Array, String].include? @use_headers.class @@ -1804,25 +1804,25 @@ class CSV return parse_headers end end - + # begin with a blank line, so we can always add to it line = "" - # + # # it can take multiple calls to <tt>@io.gets()</tt> to get a full line, # because of \r and/or \n characters embedded in quoted fields - # + # loop do # add another read to the line (line += @io.gets(@row_sep)) rescue return nil # copy the line so we can chop it up in parsing parse = line.dup parse.sub!(@parsers[:line_end], "") - - # + + # # I believe a blank line should be an <tt>Array.new</tt>, not Ruby 1.8 # CSV's <tt>[nil]</tt> - # + # if parse.empty? @lineno += 1 if @skip_blanks @@ -1837,19 +1837,19 @@ class CSV end end - # - # shave leading empty fields if needed, because the main parser chokes + # + # shave leading empty fields if needed, because the main parser chokes # on these - # + # csv = if parse.sub!(@parsers[:leading_fields], "") [nil] * ($&.length / @col_sep.length) else Array.new end - # - # then parse the main fields with a hyper-tuned Regexp from + # + # then parse the main fields with a hyper-tuned Regexp from # Mastering Regular Expressions, Second Edition - # + # parse.gsub!(@parsers[:csv_row]) do csv << if $1.nil? # we found an unquoted field if $2.empty? # switch empty unquoted fields to +nil+... @@ -1903,11 +1903,11 @@ class CSV end alias_method :gets, :shift alias_method :readline, :shift - - # + + # # Returns a simplified description of the key FasterCSV attributes in an # ASCII compatible String. - # + # def inspect str = ["<#", self.class.to_s, " io_type:"] # show type of wrapped IO @@ -1942,19 +1942,19 @@ class CSV end.join end end - + private - - # + + # # Stores the indicated separators for later use. - # + # # If auto-discovery was requested for <tt>@row_sep</tt>, this method will read # ahead in the <tt>@io</tt> and try to find one. +ARGF+, +STDIN+, +STDOUT+, # +STDERR+ and any stream open for output only with a default # <tt>@row_sep</tt> of <tt>$INPUT_RECORD_SEPARATOR</tt> (<tt>$/</tt>). - # + # # This method also establishes the quoting rules used for CSV output. - # + # def init_separators(options) # store the selected separators @col_sep = options.delete(:col_sep).to_s.encode(@encoding) @@ -1964,11 +1964,11 @@ class CSV if @quote_char.length != 1 raise ArgumentError, ":quote_char has to be a single character String" end - - # + + # # automatically discover row separator when requested # (not fully encoding safe) - # + # if @row_sep == :auto if [ARGF, STDIN, STDOUT, STDERR].include?(@io) or (defined?(Zlib) and @io.class == Zlib::GzipWriter) @@ -1977,20 +1977,20 @@ class CSV begin saved_pos = @io.pos # remember where we were while @row_sep == :auto - # - # if we run out of data, it's probably a single line + # + # if we run out of data, it's probably a single line # (use a sensible default) - # + # if @io.eof? @row_sep = $INPUT_RECORD_SEPARATOR break end - + # read ahead a bit sample = read_to_char(1024) sample += read_to_char(1) if sample[-1..-1] == encode_str("\r") and not @io.eof? - + # try to find a standard separator if sample =~ encode_re("\r\n?|\n") @row_sep = $& @@ -2011,7 +2011,7 @@ class CSV end end @row_sep = @row_sep.to_s.encode(@encoding) - + # establish quoting rules @force_quotes = options.delete(:force_quotes) do_quote = lambda do |field| @@ -2039,13 +2039,13 @@ class CSV end end end - + # Pre-compiles parsers and stores them by name for access during reads. def init_parsers(options) # store the parser behaviors @skip_blanks = options.delete(:skip_blanks) @field_size_limit = options.delete(:field_size_limit) - + # prebuild Regexps for faster parsing esc_col_sep = escape_re(@col_sep) esc_row_sep = escape_re(@row_sep) @@ -2084,27 +2084,27 @@ class CSV return_newline: encode_str("\r\n") } end - - # + + # # Loads any converters requested during construction. - # + # # If +field_name+ is set <tt>:converters</tt> (the default) field converters # are set. When +field_name+ is <tt>:header_converters</tt> header converters # are added instead. - # - # The <tt>:unconverted_fields</tt> option is also actived for + # + # The <tt>:unconverted_fields</tt> option is also actived for # <tt>:converters</tt> calls, if requested. - # + # def init_converters(options, field_name = :converters) if field_name == :converters @unconverted_fields = options.delete(:unconverted_fields) end instance_variable_set("@#{field_name}", Array.new) - + # find the correct method to add the converters convert = method(field_name.to_s.sub(/ers\Z/, "")) - + # load converters unless options[field_name].nil? # allow a single converter not wrapped in an Array @@ -2120,10 +2120,10 @@ class CSV end end end - + options.delete(field_name) end - + # Stores header row settings and loads header converters, if needed. def init_headers(options) @use_headers = options.delete(:headers) @@ -2132,18 +2132,18 @@ class CSV # headers must be delayed until shift(), in case they need a row of content @headers = nil - + init_converters(options, :header_converters) end - - # + + # # The actual work method for adding converters, used by both CSV.convert() and # CSV.header_convert(). - # + # # This method requires the +var_name+ of the instance variable to place the # converters in, the +const+ Hash to lookup named converters in, and the # normal parameters of the CSV.convert() and CSV.header_convert() methods. - # + # def add_converter(var_name, const, name = nil, &converter) if name.nil? # custom converter instance_variable_get("@#{var_name}") << converter @@ -2159,18 +2159,18 @@ class CSV end end end - - # + + # # Processes +fields+ with <tt>@converters</tt>, or <tt>@header_converters</tt> # if +headers+ is passed as +true+, returning the converted field set. Any # converter that changes the field into something other than a String halts # the pipeline of conversion for that field. This is primarily an efficiency # shortcut. - # + # def convert_fields(fields, headers = false) # see if we are converting headers or fields converters = headers ? @header_converters : @converters - + fields.map.with_index do |field, index| converters.each do |converter| field = if converter.arity == 1 # straight field converter @@ -2184,17 +2184,17 @@ class CSV field # final state of each field, converted or original end end - - # + + # # This methods is used to turn a finished +row+ into a CSV::Row. Header rows # are also dealt with here, either by returning a CSV::Row with identical # headers and fields (save that the fields do not go through the converters) # or by reading past them to return a field row. Headers are also saved in # <tt>@headers</tt> for use in future rows. - # + # # When +nil+, +row+ is assumed to be a header row not based on an actual row # of the stream. - # + # def parse_headers(row = nil) if @headers.nil? # header row @headers = case @use_headers # save headers @@ -2209,11 +2209,11 @@ class CSV # first row is headers else row end - + # prepare converted and unconverted copies row = @headers if row.nil? @headers = convert_fields(@headers, true) - + if @return_headers # return headers return self.class::Row.new(@headers, row, true) elsif not [Array, String].include? @use_headers.class # skip to field row @@ -2223,12 +2223,12 @@ class CSV self.class::Row.new(@headers, convert_fields(row)) # field row end - - # + + # # Thiw methods injects an instance variable <tt>unconverted_fields</tt> into # +row+ and an accessor method for it called unconverted_fields(). The # variable is set to the contents of +fields+. - # + # def add_unconverted_fields(row, fields) class << row attr_reader :unconverted_fields @@ -2236,41 +2236,41 @@ class CSV row.instance_eval { @unconverted_fields = fields } row end - - # + + # # This method is an encoding safe version of Regexp::escape(). It will escape # any characters that would change the meaning of a regular expression in the # encoding of +str+. Regular expression characters that cannot be transcoded # to the target encoding will be skipped and no escaping will be performed if # a backslash cannot be transcoded. - # + # def escape_re(str) str.chars.map { |c| @re_chars.include?(c) ? @re_esc + c : c }.join end - - # + + # # Builds a regular expression in <tt>@encoding</tt>. All +chunks+ will be # transcoded to that encoding. - # + # def encode_re(*chunks) Regexp.new(encode_str(*chunks)) end - - # + + # # Builds a String in <tt>@encoding</tt>. All +chunks+ will be transcoded to # that encoding. - # + # def encode_str(*chunks) chunks.map { |chunk| chunk.encode(@encoding.name) }.join end - # + # # Reads at least +bytes+ from <tt>@io</tt>, but will read up 10 bytes ahead if # needed to ensure the data read is valid in the ecoding of that data. This # should ensure that it is safe to use regular expressions on the read data, # unless it is actually a broken encoding. The read data will be returned in # <tt>@encoding</tt>. - # + # def read_to_char(bytes) return "" if @io.eof? data = @io.read(bytes) diff --git a/lib/debug.rb b/lib/debug.rb index 7bb1450198..10236c352d 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -220,7 +220,7 @@ class Context def debug_command(file, line, id, binding) MUTEX.lock unless defined?($debugger_restart) and $debugger_restart - callcc{|c| $debugger_restart = c} + callcc{|c| $debugger_restart = c} end set_last_thread(Thread.current) frame_pos = 0 @@ -299,7 +299,7 @@ class Context stdout.print "Breakpoints:\n" break_points.each do |b| if b[0] and b[1] == 0 - stdout.printf " %d %s:%s\n", n, b[2], b[3] + stdout.printf " %d %s:%s\n", n, b[2], b[3] end n += 1 end @@ -711,7 +711,7 @@ EOHELP end @frames.shift - when 'raise' + when 'raise' excn_handle(file, line, id, binding) end @@ -878,7 +878,7 @@ class << DEBUGGER__ @stdout.print "Already stopped.\n" else thread_list(@thread_list[th]) - context(th).suspend + context(th).suspend end when /^resume\s+(\d+)/ diff --git a/lib/delegate.rb b/lib/delegate.rb index 025e901a89..5fc0cafb4b 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -37,16 +37,16 @@ # def initialize # @source = SimpleDelegator.new([]) # end -# +# # def stats( records ) # @source.__setobj__(records) -# +# # "Elements: #{@source.size}\n" + # " Non-Nil: #{@source.compact.size}\n" + # " Unique: #{@source.uniq.size}\n" # end # end -# +# # s = Stats.new # puts s.stats(%w{James Edward Gray II}) # puts @@ -57,7 +57,7 @@ # Elements: 4 # Non-Nil: 4 # Unique: 4 -# +# # Elements: 8 # Non-Nil: 7 # Unique: 6 @@ -72,19 +72,19 @@ # # class Tempfile < DelegateClass(File) # # constant and class member data initialization... -# +# # def initialize(basename, tmpdir=Dir::tmpdir) # # build up file path/name in var tmpname... -# +# # @tmpfile = File.open(tmpname, File::RDWR|File::CREAT|File::EXCL, 0600) -# +# # # ... -# +# # super(@tmpfile) -# +# # # below this point, all methods of File are supported... # end -# +# # # ... # end # @@ -97,15 +97,15 @@ # super # pass obj to Delegator constructor, required # @delegate_sd_obj = obj # store obj for future use # end -# +# # def __getobj__ # @delegate_sd_obj # return object we are delegating to, required # end -# +# # def __setobj__(obj) # @delegate_sd_obj = obj # change delegation object, a feature we're providing # end -# +# # # ... # end @@ -142,18 +142,18 @@ class Delegator end end - # - # Checks for a method provided by this the delegate object by fowarding the + # + # Checks for a method provided by this the delegate object by fowarding the # call through \_\_getobj\_\_. - # + # def respond_to?(m, include_private = false) return true if super return self.__getobj__.respond_to?(m, include_private) end - # + # # Returns true if two objects are considered same. - # + # def ==(obj) return true if obj.equal?(self) self.__getobj__ == obj diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb index 13a89de07f..6a4e6021db 100644 --- a/lib/drb/drb.rb +++ b/lib/drb/drb.rb @@ -18,7 +18,7 @@ # # The Ruby standard library contains the core classes of the dRuby package. # However, the full package also includes access control lists and the -# Rinda tuple-space distributed task management system, as well as a +# Rinda tuple-space distributed task management system, as well as a # large number of samples. The full dRuby package can be downloaded from # the dRuby home page (see *References*). # @@ -121,7 +121,7 @@ require 'drb/eq' # are forwarded to the local object, as described in the discussion of # DRbObjects. This has semantics similar to the normal Ruby # pass-by-reference. -# +# # The easiest way to signal that we want an otherwise marshallable # object to be passed or returned as a DRbObject reference, rather # than marshalled and sent as a copy, is to include the @@ -135,7 +135,7 @@ require 'drb/eq' # passed back to the remote execution context to be collected, before # the collected values are finally returned to the local context as # the return value of the method invocation. -# +# # == Examples of usage # # For more dRuby samples, see the +samples+ directory in the full @@ -148,33 +148,33 @@ require 'drb/eq' # starting the server code first. # # ==== Server code -# +# # require 'drb/drb' -# +# # # The URI for the server to connect to -# URI="druby://localhost:8787" -# +# URI="druby://localhost:8787" +# # class TimeServer -# +# # def get_current_time # return Time.now # end -# +# # end -# +# # # The object that handles requests on the server # FRONT_OBJECT=TimeServer.new # # $SAFE = 1 # disable eval() and friends -# +# # DRb.start_service(URI, FRONT_OBJECT) # # Wait for the drb server thread to finish before exiting. # DRb.thread.join # # ==== Client code -# +# # require 'drb/drb' -# +# # # The URI to connect to # SERVER_URI="druby://localhost:8787" # @@ -184,43 +184,43 @@ require 'drb/eq' # # as soon as we pass a non-marshallable object as an argument # # to a dRuby call. # DRb.start_service -# +# # timeserver = DRbObject.new_with_uri(SERVER_URI) -# puts timeserver.get_current_time +# puts timeserver.get_current_time # # === Remote objects under dRuby # # This example illustrates returning a reference to an object # from a dRuby call. The Logger instances live in the server # process. References to them are returned to the client process, -# where methods can be invoked upon them. These methods are +# where methods can be invoked upon them. These methods are # executed in the server process. # # ==== Server code -# +# # require 'drb/drb' -# +# # URI="druby://localhost:8787" -# +# # class Logger # # # Make dRuby send Logger instances as dRuby references, # # not copies. # include DRb::DRbUndumped -# +# # def initialize(n, fname) # @name = n # @filename = fname # end -# +# # def log(message) # File.open(@filename, "a") do |f| # f.puts("#{Time.now}: #{@name}: #{message}") # end # end -# +# # end -# +# # # We have a central object for creating and retrieving loggers. # # This retains a local reference to all loggers created. This # # is so an existing logger can be looked up by name, but also @@ -228,12 +228,12 @@ require 'drb/eq' # # reference to an object is not sufficient to prevent it being # # garbage collected! # class LoggerFactory -# +# # def initialize(bdir) # @basedir = bdir # @loggers = {} # end -# +# # def get_logger(name) # if !@loggers.has_key? name # # make the filename safe, then declare it to be so @@ -242,34 +242,34 @@ require 'drb/eq' # end # return @loggers[name] # end -# +# # end -# +# # FRONT_OBJECT=LoggerFactory.new("/tmp/dlog") # # $SAFE = 1 # disable eval() and friends -# +# # DRb.start_service(URI, FRONT_OBJECT) # DRb.thread.join # # ==== Client code # # require 'drb/drb' -# +# # SERVER_URI="druby://localhost:8787" # # DRb.start_service -# +# # log_service=DRbObject.new_with_uri(SERVER_URI) -# +# # ["loga", "logb", "logc"].each do |logname| -# +# # logger=log_service.get_logger(logname) -# +# # logger.log("Hello, world!") # logger.log("Goodbye, world!") # logger.log("=== EOT ===") -# +# # end # # == Security @@ -288,9 +288,9 @@ require 'drb/eq' # ro.instance_eval("`rm -rf *`") # # The dangers posed by instance_eval and friends are such that a -# DRbServer should generally be run with $SAFE set to at least -# level 1. This will disable eval() and related calls on strings -# passed across the wire. The sample usage code given above follows +# DRbServer should generally be run with $SAFE set to at least +# level 1. This will disable eval() and related calls on strings +# passed across the wire. The sample usage code given above follows # this practice. # # A DRbServer can be configured with an access control list to @@ -360,7 +360,7 @@ module DRb # # This, the default implementation, uses an object's local ObjectSpace # __id__ as its id. This means that an object's identification over - # drb remains valid only while that object instance remains alive + # drb remains valid only while that object instance remains alive # within the server runtime. # # For alternative mechanisms, see DRb::TimerIdConv in rdb/timeridconv.rb @@ -374,7 +374,7 @@ module DRb def to_obj(ref) ObjectSpace._id2ref(ref) end - + # Convert an object into a reference id. # # This implementation returns the object's __id__ in the local @@ -390,7 +390,7 @@ module DRb # called over drb, then the object remains in the server space # and a reference to the object is returned, rather than the # object being marshalled and moved into the client space. - module DRbUndumped + module DRbUndumped def _dump(dummy) # :nodoc: raise TypeError, 'can\'t dump' end @@ -424,7 +424,7 @@ module DRb def self._load(s) # :nodoc: Marshal::load(s) end - + def _dump(lv) # :nodoc: Marshal::dump(@unknown) end @@ -456,11 +456,11 @@ module DRb # +name+ attribute. The marshalled object is held in the +buf+ # attribute. class DRbUnknown - + # Create a new DRbUnknown object. # # +buf+ is a string containing a marshalled object that could not - # be unmarshalled. +err+ is the error message that was raised + # be unmarshalled. +err+ is the error message that was raised # when the unmarshalling failed. It is used to determine the # name of the unmarshalled object. def initialize(err, buf) @@ -499,7 +499,7 @@ module DRb # Attempt to load the wrapped marshalled object again. # # If the class of the object is now known locally, the object - # will be unmarshalled and returned. Otherwise, a new + # will be unmarshalled and returned. Otherwise, a new # but identical DRbUnknown object will be returned. def reload self.class._load(@buf) @@ -513,7 +513,7 @@ module DRb class DRbArray def initialize(ary) - @ary = ary.collect { |obj| + @ary = ary.collect { |obj| if obj.kind_of? DRbUndumped DRbObject.new(obj) else @@ -607,7 +607,7 @@ module DRb rescue raise(DRbConnError, $!.message, $!.backtrace) end - + def recv_request(stream) # :nodoc: ref = load(stream) ro = DRb.to_obj(ref) @@ -656,10 +656,10 @@ module DRb # using configuration +config+. Return a # protocol instance for this listener. # [uri_option(uri, config)] Take a URI, possibly containing an option - # component (e.g. a trailing '?param=val'), + # component (e.g. a trailing '?param=val'), # and return a [uri, option] tuple. # - # All of these methods should raise a DRbBadScheme error if the URI + # All of these methods should raise a DRbBadScheme error if the URI # does not identify the protocol they support (e.g. "druby:" for # the standard Ruby protocol). This is how the DRbProtocol module, # given a URI, determines which protocol implementation serves that @@ -675,14 +675,14 @@ module DRb # # The protocol instance returned by #open must have the following methods: # - # [send_request (ref, msg_id, arg, b)] + # [send_request (ref, msg_id, arg, b)] # Send a request to +ref+ with the given message id and arguments. # This is most easily implemented by calling DRbMessage.send_request, # providing a stream that sits on top of the current protocol. # [recv_reply] # Receive a reply from the server and return it as a [success-boolean, # reply-value] pair. This is most easily implemented by calling - # DRb.recv_reply, providing a stream that sits on top of the + # DRb.recv_reply, providing a stream that sits on top of the # current protocol. # [alive?] # Is this connection still alive? @@ -725,7 +725,7 @@ module DRb # URI by raising a DRbBadScheme error. If no protocol recognises the # URI, then a DRbBadURI error is raised. If a protocol accepts the # URI, but an error occurs in opening it, a DRbConnError is raised. - def open(uri, config, first=true) + def open(uri, config, first=true) @protocol.each do |prot| begin return prot.open(uri, config) @@ -744,14 +744,14 @@ module DRb end module_function :open - # Open a server listening for connections at +uri+ with + # Open a server listening for connections at +uri+ with # configuration +config+. # # The DRbProtocol module asks each registered protocol in turn to - # try to open a server at the URI. Each protocol signals that it does - # not handle that URI by raising a DRbBadScheme error. If no protocol - # recognises the URI, then a DRbBadURI error is raised. If a protocol - # accepts the URI, but an error occurs in opening it, the underlying + # try to open a server at the URI. Each protocol signals that it does + # not handle that URI by raising a DRbBadScheme error. If no protocol + # recognises the URI, then a DRbBadURI error is raised. If a protocol + # accepts the URI, but an error occurs in opening it, the underlying # error is passed on to the caller. def open_server(uri, config, first=true) @protocol.each do |prot| @@ -773,7 +773,7 @@ module DRb # The DRbProtocol module asks each registered protocol in turn to # try to parse the URI. Each protocol signals that it does not handle that # URI by raising a DRbBadScheme error. If no protocol recognises the - # URI, then a DRbBadURI error is raised. + # URI, then a DRbBadURI error is raised. def uri_option(uri, config, first=true) @protocol.each do |prot| begin @@ -837,9 +837,9 @@ module DRb end def self.open_server_inaddr_any(host, port) - infos = Socket::getaddrinfo(host, nil, + infos = Socket::getaddrinfo(host, nil, Socket::AF_UNSPEC, - Socket::SOCK_STREAM, + Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE) family = infos.collect { |af, *_| af }.uniq @@ -853,7 +853,7 @@ module DRb end end - # Open a server listening for connections at +uri+ using + # Open a server listening for connections at +uri+ using # configuration +config+. def self.open_server(uri, config) uri = 'druby://:0' unless uri @@ -899,7 +899,7 @@ module DRb def peeraddr @socket.peeraddr end - + # Get the socket. def stream; @socket; end @@ -907,7 +907,7 @@ module DRb def send_request(ref, msg_id, arg, b) @msg.send_request(stream, ref, msg_id, arg, b) end - + # On the server side, receive a request from the client. def recv_request @msg.recv_request(stream) @@ -937,14 +937,14 @@ module DRb @socket = nil end end - - # On the server side, for an instance returned by #open_server, + + # On the server side, for an instance returned by #open_server, # accept a client connection and return a new instance to handle # the server's side of this client-server session. def accept while true s = @socket.accept - break if (@acl ? @acl.allow_socket?(s) : true) + break if (@acl ? @acl.allow_socket?(s) : true) s.close end if @config[:tcp_original_host].to_s.size == 0 @@ -981,16 +981,16 @@ module DRb end attr :option def to_s; @option; end - + def ==(other) return false unless DRbURIOption === other @option == other.option end - + def hash @option.hash end - + alias eql? == end @@ -1007,7 +1007,7 @@ module DRb # created to act as a stub for the remote referenced object. def self._load(s) uri, ref = Marshal.load(s) - + if DRb.here?(uri) obj = DRb.to_obj(ref) if ((! obj.tainted?) && Thread.current[:drb_untaint]) @@ -1057,7 +1057,7 @@ module DRb end # Get the URI of the remote object. - def __drburi + def __drburi @uri end @@ -1085,7 +1085,7 @@ module DRb if DRb.here?(@uri) obj = DRb.to_obj(@ref) DRb.current_server.check_insecure_method(obj, msg_id) - return obj.__send__(msg_id, *a, &b) + return obj.__send__(msg_id, *a, &b) end succ, result = self.class.with_friend(@uri) do @@ -1108,7 +1108,7 @@ module DRb def self.with_friend(uri) friend = DRb.fetch_server(uri) return yield() unless friend - + save = Thread.current['DRb'] Thread.current['DRb'] = { 'server' => friend } return yield @@ -1120,7 +1120,7 @@ module DRb prefix = "(#{uri}) " bt = [] result.backtrace.each do |x| - break if /`__send__'$/ =~ x + break if /`__send__'$/ =~ x if /^\(druby:\/\// =~ x bt.push(x) else @@ -1271,14 +1271,14 @@ module DRb def self.verbose=(on) @@verbose = on end - + # Get the default value of the :verbose option. def self.verbose @@verbose end def self.make_config(hash={}) # :nodoc: - default_config = { + default_config = { :idconv => @@idconv, :verbose => @@verbose, :tcp_acl => @@acl, @@ -1368,7 +1368,7 @@ module DRb attr_reader :thread # The front object of the DRbServer. - # + # # This object receives remote method calls made on the server's # URI alone, with an object id. attr_reader :front @@ -1461,7 +1461,7 @@ module DRb def any_to_s(obj) obj.to_s + ":#{obj.class}" rescue - sprintf("#<%s:0x%lx>", obj.class, obj.__id__) + sprintf("#<%s:0x%lx>", obj.class, obj.__id__) end # Check that a method is callable via dRuby. @@ -1469,14 +1469,14 @@ module DRb # +obj+ is the object we want to invoke the method on. +msg_id+ is the # method name, as a Symbol. # - # If the method is an insecure method (see #insecure_method?) a + # If the method is an insecure method (see #insecure_method?) a # SecurityError is thrown. If the method is private or undefined, # a NameError is thrown. def check_insecure_method(obj, msg_id) return true if Proc === obj && msg_id == :__drb_yield raise(ArgumentError, "#{any_to_s(msg_id)} is not a symbol") unless Symbol == msg_id.class raise(SecurityError, "insecure method `#{msg_id}'") if insecure_method?(msg_id) - + if obj.private_methods.include?(msg_id) desc = any_to_s(obj) raise NoMethodError, "private method `#{msg_id}' called for #{desc}" @@ -1488,7 +1488,7 @@ module DRb end end public :check_insecure_method - + class InvokeMethod # :nodoc: def initialize(drb_server, client) @drb_server = drb_server @@ -1510,7 +1510,7 @@ module DRb perform_with_block }.value else - @result = Thread.new { + @result = Thread.new { Thread.current['DRb'] = info $SAFE = @safe_level perform_without_block @@ -1525,7 +1525,7 @@ module DRb end @succ = true if @msg_id == :to_ary && @result.class == Array - @result = DRbArray.new(@result) + @result = DRbArray.new(@result) end return @succ, @result rescue StandardError, ScriptError, Interrupt @@ -1541,7 +1541,7 @@ module DRb @argv = argv @block = block end - + def check_insecure_method @drb_server.check_insecure_method(@obj, @msg_id) end @@ -1550,7 +1550,7 @@ module DRb init_with_client check_insecure_method end - + def perform_without_block if Proc === @obj && @msg_id == :__drb_yield if @argv.size == 1 @@ -1638,7 +1638,7 @@ module DRb # The primary local dRuby server. # - # This is the server created by the #start_service call. + # This is the server created by the #start_service call. attr_accessor :primary_server module_function :primary_server=, :primary_server @@ -1653,8 +1653,8 @@ module DRb # If the above rule fails to find a server, a DRbServerNotFound # error is raised. def current_server - drb = Thread.current['DRb'] - server = (drb && drb['server']) ? drb['server'] : @primary_server + drb = Thread.current['DRb'] + server = (drb && drb['server']) ? drb['server'] : @primary_server raise DRbServerNotFound unless server return server end @@ -1700,7 +1700,7 @@ module DRb DRbServer.make_config end module_function :config - + # Get the front object of the current server. # # This raises a DRbServerNotFound error if there is no current server. @@ -1771,7 +1771,7 @@ module DRb @server.delete(server.uri) end module_function :remove_server - + def fetch_server(uri) @server[uri] end diff --git a/lib/drb/extserv.rb b/lib/drb/extserv.rb index af52250518..5996626492 100644 --- a/lib/drb/extserv.rb +++ b/lib/drb/extserv.rb @@ -1,6 +1,6 @@ =begin external service - Copyright (c) 2000,2002 Masatoshi SEKI + Copyright (c) 2000,2002 Masatoshi SEKI =end require 'drb/drb' diff --git a/lib/drb/extservm.rb b/lib/drb/extservm.rb index 3b1819e834..5937cb0c50 100644 --- a/lib/drb/extservm.rb +++ b/lib/drb/extservm.rb @@ -1,6 +1,6 @@ =begin external service manager - Copyright (c) 2000 Masatoshi SEKI + Copyright (c) 2000 Masatoshi SEKI =end require 'drb/drb' @@ -21,7 +21,7 @@ module DRb def self.command=(cmd) @@command = cmd end - + def initialize super() @cond = new_cond @@ -51,7 +51,7 @@ module DRb end self end - + def unregist(name) synchronize do @servers.delete(name) diff --git a/lib/drb/invokemethod.rb b/lib/drb/invokemethod.rb index 7da8ace88d..220d0ad68d 100644 --- a/lib/drb/invokemethod.rb +++ b/lib/drb/invokemethod.rb @@ -9,7 +9,7 @@ module DRb end block_value = @block.call(*x) end - + def perform_with_block @obj.__send__(@msg_id, *@argv) do |*x| jump_error = nil diff --git a/lib/drb/ssl.rb b/lib/drb/ssl.rb index 58d6b7d1e0..08f97f4bc6 100644 --- a/lib/drb/ssl.rb +++ b/lib/drb/ssl.rb @@ -15,7 +15,7 @@ module DRb :SSLClientCA => nil, :SSLCACertificatePath => nil, :SSLCACertificateFile => nil, - :SSLVerifyMode => ::OpenSSL::SSL::VERIFY_NONE, + :SSLVerifyMode => ::OpenSSL::SSL::VERIFY_NONE, :SSLVerifyDepth => nil, :SSLVerifyCallback => nil, # custom verification :SSLCertificateStore => nil, @@ -31,7 +31,7 @@ module DRb @ssl_ctx = nil end - def [](key); + def [](key); @config[key] || DEFAULT[key] end @@ -41,14 +41,14 @@ module DRb ssl.connect ssl end - + def accept(tcp) ssl = OpenSSL::SSL::SSLSocket.new(tcp, @ssl_ctx) ssl.sync = true ssl.accept ssl end - + def setup_certificate if @cert && @pkey return @@ -77,7 +77,7 @@ module DRb cert.not_before = Time.now cert.not_after = Time.now + (365*24*60*60) cert.public_key = rsa.public_key - + ef = OpenSSL::X509::ExtensionFactory.new(nil,cert) cert.extensions = [ ef.create_extension("basicConstraints","CA:FALSE"), @@ -89,7 +89,7 @@ module DRb cert.add_extension(ef.create_extension("nsComment", comment)) end cert.sign(rsa, OpenSSL::Digest::SHA1.new) - + @cert = cert @pkey = rsa end @@ -143,7 +143,7 @@ module DRb end port = soc.addr[1] if port == 0 @uri = "drbssl://#{host}:#{port}" - + ssl_conf = SSLConfig.new(config) ssl_conf.setup_certificate ssl_conf.setup_ssl_context @@ -159,7 +159,7 @@ module DRb @ssl = is_established ? soc : nil super(uri, soc.to_io, config) end - + def stream; @ssl; end def close @@ -169,12 +169,12 @@ module DRb end super end - + def accept begin while true soc = @socket.accept - break if (@acl ? @acl.allow_socket?(soc) : true) + break if (@acl ? @acl.allow_socket?(soc) : true) soc.close end ssl = @config.accept(soc) @@ -185,6 +185,6 @@ module DRb end end end - + DRbProtocol.add_protocol(DRbSSLSocket) end diff --git a/lib/drb/timeridconv.rb b/lib/drb/timeridconv.rb index bb2c48d528..6d8935b1ef 100644 --- a/lib/drb/timeridconv.rb +++ b/lib/drb/timeridconv.rb @@ -19,7 +19,7 @@ module DRb end def add(obj) - synchronize do + synchronize do key = obj.__id__ @curr[key] = obj return key @@ -27,7 +27,7 @@ module DRb end def fetch(key, dv=@sentinel) - synchronize do + synchronize do obj = peek(key) if obj == @sentinel return dv unless dv == @sentinel @@ -39,7 +39,7 @@ module DRb end def include?(key) - synchronize do + synchronize do obj = peek(key) return false if obj == @sentinel true @@ -47,7 +47,7 @@ module DRb end def peek(key) - synchronize do + synchronize do return @curr.fetch(key, @renew.fetch(key, @gc.fetch(key, @sentinel))) end end diff --git a/lib/drb/unix.rb b/lib/drb/unix.rb index 57feed8301..ebecc22901 100644 --- a/lib/drb/unix.rb +++ b/lib/drb/unix.rb @@ -8,7 +8,7 @@ module DRb class DRbUNIXSocket < DRbTCPSocket def self.parse_uri(uri) - if /^drbunix:(.*?)(\?(.*))?$/ =~ uri + if /^drbunix:(.*?)(\?(.*))?$/ =~ uri filename = $1 option = $3 [filename, option] @@ -59,7 +59,7 @@ module DRb @server_mode = server_mode @acl = nil end - + # import from tempfile.rb Max_try = 10 private diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb index b8d1d44f38..ac2fb2dd49 100644 --- a/lib/e2mmap.rb +++ b/lib/e2mmap.rb @@ -56,7 +56,7 @@ module Exception2MessageMapper super cl.bind(self) unless cl < E2MM end - + def bind(cl) self.module_eval %[ def Raise(err = nil, *rest) @@ -88,7 +88,7 @@ module Exception2MessageMapper def def_e2message(c, m) E2MM.def_e2message(self, c, m) end - + # def_exception(n, m, s) # n: exception_name # m: message_form @@ -115,7 +115,7 @@ module Exception2MessageMapper E2MM.instance_eval{@MessageMap[[k, c]] = m} c end - + # E2MM.def_exception(k, n, m, s) # k: class to define exception under. # n: exception_name @@ -164,8 +164,8 @@ module Exception2MessageMapper alias message e2mm_message end - E2MM.def_exception(E2MM, - :ErrNotRegisteredException, + E2MM.def_exception(E2MM, + :ErrNotRegisteredException, "not registerd exception(%s)") end diff --git a/lib/erb.rb b/lib/erb.rb index 678f082b07..5e9feb9ba5 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -20,7 +20,7 @@ # purposes of generating document information details and/or flow control. # # A very simple example is this: -# +# # require 'erb' # # x = 42 @@ -86,39 +86,39 @@ # <tt>%q{...}</tt> to avoid trouble with the backslash. # # require "erb" -# +# # # Create template. # template = %q{ # From: James Edward Gray II <james@grayproductions.net> # To: <%= to %> # Subject: Addressing Needs -# +# # <%= to[/\w+/] %>: -# +# # Just wanted to send a quick note assuring that your needs are being # addressed. -# +# # I want you to know that my team will keep working on the issues, # especially: -# +# # <%# ignore numerous minor requests -- focus on priorities %> # % priorities.each do |priority| # * <%= priority %> # % end -# +# # Thanks for your patience. -# +# # James Edward Gray II # }.gsub(/^ /, '') -# +# # message = ERB.new(template, 0, "%<>") -# +# # # Set up template data. # to = "Community Spokesman <spokesman@ruby_community.org>" # priorities = [ "Run Ruby Quiz", # "Document Modules", # "Answer Questions on Ruby Talk" ] -# +# # # Produce result. # email = message.result # puts email @@ -128,19 +128,19 @@ # From: James Edward Gray II <james@grayproductions.net> # To: Community Spokesman <spokesman@ruby_community.org> # Subject: Addressing Needs -# +# # Community: -# +# # Just wanted to send a quick note assuring that your needs are being addressed. -# +# # I want you to know that my team will keep working on the issues, especially: -# +# # * Run Ruby Quiz # * Document Modules # * Answer Questions on Ruby Talk -# +# # Thanks for your patience. -# +# # James Edward Gray II # # === Ruby in HTML @@ -150,7 +150,7 @@ # variables in the Product object can be resolved. # # require "erb" -# +# # # Build template data class. # class Product # def initialize( code, name, desc, cost ) @@ -158,37 +158,37 @@ # @name = name # @desc = desc # @cost = cost -# +# # @features = [ ] # end -# +# # def add_feature( feature ) # @features << feature # end -# +# # # Support templating of member data. # def get_binding # binding # end -# +# # # ... # end -# +# # # Create template. # template = %{ # <html> # <head><title>Ruby Toys -- <%= @name %></title></head> # <body> -# +# # <h1><%= @name %> (<%= @code %>)</h1> # <p><%= @desc %></p> -# +# # <ul> # <% @features.each do |f| %> # <li><b><%= f %></b></li> # <% end %> # </ul> -# +# # <p> # <% if @cost < 10 %> # <b>Only <%= @cost %>!!!</b> @@ -196,13 +196,13 @@ # Call for a price, today! # <% end %> # </p> -# +# # </body> # </html> # }.gsub(/^ /, '') -# +# # rhtml = ERB.new(template) -# +# # # Set up template data. # toy = Product.new( "TZ-1002", # "Rubysapien", @@ -213,7 +213,7 @@ # toy.add_feature("Karate-Chop Action!!!") # toy.add_feature("Matz signature on left leg.") # toy.add_feature("Gem studded eyes... Rubies, of course!") -# +# # # Produce result. # rhtml.run(toy.get_binding) # @@ -222,10 +222,10 @@ # <html> # <head><title>Ruby Toys -- Rubysapien</title></head> # <body> -# +# # <h1>Rubysapien (TZ-1002)</h1> # <p>Geek's Best Friend! Responds to Ruby commands...</p> -# +# # <ul> # <li><b>Listens for verbal commands in the Ruby language!</b></li> # <li><b>Ignores Perl, Java, and all C variants.</b></li> @@ -233,15 +233,15 @@ # <li><b>Matz signature on left leg.</b></li> # <li><b>Gem studded eyes... Rubies, of course!</b></li> # </ul> -# +# # <p> # Call for a price, today! # </p> -# +# # </body> # </html> # -# +# # == Notes # # There are a variety of templating solutions available in various Ruby projects: @@ -318,7 +318,7 @@ class ERB end end attr_accessor :stag - + def scan(&block) @stag = nil if @percent @@ -425,7 +425,7 @@ class ERB end end end - + Scanner.regist_scanner(SimpleScanner, nil, false) begin @@ -484,13 +484,13 @@ class ERB def push(cmd) @line << cmd end - + def cr @script << (@line.join('; ')) @line = [] @script << "\n" end - + def close return unless @line @compiler.post_cmd.each do |x| @@ -520,7 +520,7 @@ class ERB content = '' scanner = make_scanner(s) scanner.scan do |token| - next if token.nil? + next if token.nil? next if token == '' if scanner.stag.nil? case token @@ -632,19 +632,19 @@ end class ERB # # Constructs a new ERB object with the template specified in _str_. - # + # # An ERB object works by building a chunk of Ruby code that will output # the completed template when run. If _safe_level_ is set to a non-nil value, # ERB code will be run in a separate thread with <b>$SAFE</b> set to the # provided level. - # + # # If _trim_mode_ is passed a String containing one or more of the following # modifiers, ERB will adjust its code generation as listed: - # + # # % enables Ruby code processing for lines beginning with % # <> omit newline for lines starting with <% and ending in %> # > omit newline for lines ending in %> - # + # # _eoutvar_ can be used to set the name of the variable ERB will build up # its output in. This is useful when you need to run multiple ERB # templates through the same binding and/or when you want to control where @@ -653,20 +653,20 @@ class ERB # === Example # # require "erb" - # + # # # build data class # class Listings # PRODUCT = { :name => "Chicken Fried Steak", # :desc => "A well messages pattie, breaded and fried.", # :cost => 9.95 } - # + # # attr_reader :product, :price - # + # # def initialize( product = "", price = "" ) # @product = product # @price = price # end - # + # # def build # b = binding # # create and run templates, filling member data variables @@ -680,21 +680,21 @@ class ERB # END_PRICE # end # end - # + # # # setup template data # listings = Listings.new # listings.build - # + # # puts listings.product + "\n" + listings.price # # _Generates_ # # Chicken Fried Steak # A well messages pattie, breaded and fried. - # + # # Chicken Fried Steak -- 9.95 # A well messages pattie, breaded and fried. - # + # def initialize(str, safe_level=nil, trim_mode=nil, eoutvar='_erbout') @safe_level = safe_level compiler = ERB::Compiler.new(trim_mode) @@ -721,7 +721,7 @@ class ERB cmd = [] cmd.push "#{eoutvar} = ''" - + compiler.pre_cmd = cmd cmd = [] @@ -739,13 +739,13 @@ class ERB # Executes the generated ERB code to produce a completed template, returning # the results of that code. (See ERB#new for details on how this process can # be affected by _safe_level_.) - # + # # _b_ accepts a Binding or Proc object which is used to set the context of # code evaluation. # def result(b=TOPLEVEL_BINDING) if @safe_level - proc { + proc { $SAFE = @safe_level eval(@src, b, (@filename || '(erb)'), 0) }.call @@ -813,14 +813,14 @@ class ERB public # # A utility method for escaping HTML tag characters in _s_. - # + # # require "erb" # include ERB::Util - # + # # puts html_escape("is a > 0 & a < 10?") - # + # # _Generates_ - # + # # is a > 0 & a < 10? # def html_escape(s) @@ -829,17 +829,17 @@ class ERB alias h html_escape module_function :h module_function :html_escape - + # # A utility method for encoding the String _s_ as a URL. - # + # # require "erb" # include ERB::Util - # + # # puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide") - # + # # _Generates_ - # + # # Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide # def url_encode(s) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 32408ee868..f2302703be 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -1,17 +1,17 @@ -# +# # = fileutils.rb -# +# # Copyright (c) 2000-2007 Minero Aoki -# +# # This program is free software. # You can distribute/modify this program under the same terms of ruby. -# +# # == module FileUtils -# +# # Namespace for several file utility methods for copying, moving, removing, etc. -# +# # === Module Functions -# +# # cd(dir, options) # cd(dir, options) {|dir| .... } # pwd() @@ -64,23 +64,23 @@ # uptodate?(file, cmp_list) # # == module FileUtils::Verbose -# +# # This module has all methods of FileUtils module, but it outputs messages # before acting. This equates to passing the <tt>:verbose</tt> flag to methods # in FileUtils. -# +# # == module FileUtils::NoWrite -# +# # This module has all methods of FileUtils module, but never changes # files/directories. This equates to passing the <tt>:noop</tt> flag to methods # in FileUtils. -# +# # == module FileUtils::DryRun -# +# # This module has all methods of FileUtils module, but never changes # files/directories. This equates to passing the <tt>:noop</tt> and # <tt>:verbose</tt> flags to methods in FileUtils. -# +# module FileUtils @@ -107,14 +107,14 @@ module FileUtils # # Options: verbose - # + # # Changes the current directory to the directory +dir+. - # + # # If this method is called with block, resumes to the old # working directory after the block execution finished. - # + # # FileUtils.cd('/', :verbose => true) # chdir and report it - # + # def cd(dir, options = {}, &block) # :yield: dir fu_check_options options, OPT_TABLE['cd'] fu_output_message "cd #{dir}" if options[:verbose] @@ -131,13 +131,13 @@ module FileUtils # # Options: (none) - # + # # Returns true if +newer+ is newer than all +old_list+. # Non-existent files are older than any file. - # + # # FileUtils.uptodate?('hello.o', %w(hello.c hello.h)) or \ # system 'make hello.o' - # + # def uptodate?(new, old_list, options = nil) raise ArgumentError, 'uptodate? does not accept any option' if options @@ -154,14 +154,14 @@ module FileUtils # # Options: mode noop verbose - # + # # Creates one or more directories. - # + # # FileUtils.mkdir 'test' # FileUtils.mkdir %w( tmp data ) # FileUtils.mkdir 'notexist', :noop => true # Does not really create. # FileUtils.mkdir 'tmp', :mode => 0700 - # + # def mkdir(list, options = {}) fu_check_options options, OPT_TABLE['mkdir'] list = fu_list(list) @@ -178,12 +178,12 @@ module FileUtils # # Options: mode noop verbose - # + # # Creates a directory and all its parent directories. # For example, - # + # # FileUtils.mkdir_p '/usr/local/lib/ruby' - # + # # causes to make following directories, if it does not exist. # * /usr # * /usr/local @@ -191,7 +191,7 @@ module FileUtils # * /usr/local/lib/ruby # # You can pass several directories at a time in a list. - # + # def mkdir_p(list, options = {}) fu_check_options options, OPT_TABLE['mkdir_p'] list = fu_list(list) @@ -247,14 +247,14 @@ module FileUtils # # Options: noop, verbose - # + # # Removes one or more directories. - # + # # FileUtils.rmdir 'somedir' # FileUtils.rmdir %w(somedir anydir otherdir) # # Does not really remove directory; outputs message. # FileUtils.rmdir 'somedir', :verbose => true, :noop => true - # + # def rmdir(list, options = {}) fu_check_options options, OPT_TABLE['rmdir'] list = fu_list(list) @@ -286,19 +286,19 @@ module FileUtils # If +new+ already exists and it is a directory, creates a link +new/old+. # If +new+ already exists and it is not a directory, raises Errno::EEXIST. # But if :force option is set, overwrite +new+. - # + # # FileUtils.ln 'gcc', 'cc', :verbose => true # FileUtils.ln '/usr/bin/emacs21', '/usr/bin/emacs' - # + # # <b><tt>ln(list, destdir, options = {})</tt></b> - # + # # Creates several hard links in a directory, with each one pointing to the # item in +list+. If +destdir+ is not a directory, raises Errno::ENOTDIR. - # + # # include FileUtils # cd '/sbin' # FileUtils.ln %w(cp mv mkdir), '/bin' # Now /sbin/cp and /bin/cp are linked. - # + # def ln(src, dest, options = {}) fu_check_options options, OPT_TABLE['ln'] fu_output_message "ln#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose] @@ -320,24 +320,24 @@ module FileUtils # Options: force noop verbose # # <b><tt>ln_s(old, new, options = {})</tt></b> - # + # # Creates a symbolic link +new+ which points to +old+. If +new+ already # exists and it is a directory, creates a symbolic link +new/old+. If +new+ # already exists and it is not a directory, raises Errno::EEXIST. But if # :force option is set, overwrite +new+. - # + # # FileUtils.ln_s '/usr/bin/ruby', '/usr/local/bin/ruby' # FileUtils.ln_s 'verylongsourcefilename.c', 'c', :force => true - # + # # <b><tt>ln_s(list, destdir, options = {})</tt></b> - # + # # Creates several symbolic links in a directory, with each one pointing to the # item in +list+. If +destdir+ is not a directory, raises Errno::ENOTDIR. # # If +destdir+ is not a directory, raises Errno::ENOTDIR. - # + # # FileUtils.ln_s Dir.glob('bin/*.rb'), '/home/aamine/bin' - # + # def ln_s(src, dest, options = {}) fu_check_options options, OPT_TABLE['ln_s'] fu_output_message "ln -s#{options[:force] ? 'f' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose] @@ -357,10 +357,10 @@ module FileUtils # # Options: noop verbose - # + # # Same as # #ln_s(src, dest, :force) - # + # def ln_sf(src, dest, options = {}) fu_check_options options, OPT_TABLE['ln_sf'] options = options.dup @@ -383,7 +383,7 @@ module FileUtils # FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6' # FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6', :verbose => true # FileUtils.cp 'symlink', 'dest' # copy content, "dest" is not a symlink - # + # def cp(src, dest, options = {}) fu_check_options options, OPT_TABLE['cp'] fu_output_message "cp#{options[:preserve] ? ' -p' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose] @@ -402,17 +402,17 @@ module FileUtils # # Options: preserve noop verbose dereference_root remove_destination - # + # # Copies +src+ to +dest+. If +src+ is a directory, this method copies # all its contents recursively. If +dest+ is a directory, copies # +src+ to +dest/src+. # # +src+ can be a list of files. - # + # # # Installing ruby library "mylib" under the site_ruby # FileUtils.rm_r site_ruby + '/mylib', :force # FileUtils.cp_r 'lib/', site_ruby + '/mylib' - # + # # # Examples of copying several files to target directory. # FileUtils.cp_r %w(mail.rb field.rb debug/), site_ruby + '/tmail' # FileUtils.cp_r Dir.glob('*.rb'), '/home/aamine/lib/ruby', :noop => true, :verbose => true @@ -422,7 +422,7 @@ module FileUtils # # use following code. # FileUtils.cp_r 'src/.', 'dest' # cp_r('src', 'dest') makes src/dest, # # but this doesn't. - # + # def cp_r(src, dest, options = {}) fu_check_options options, OPT_TABLE['cp_r'] fu_output_message "cp -r#{options[:preserve] ? 'p' : ''}#{options[:remove_destination] ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose] @@ -485,16 +485,16 @@ module FileUtils # # Options: force noop verbose - # + # # Moves file(s) +src+ to +dest+. If +file+ and +dest+ exist on the different # disk partition, the file is copied then the original file is removed. - # + # # FileUtils.mv 'badname.rb', 'goodname.rb' # FileUtils.mv 'stuff.rb', '/notexist/lib/ruby', :force => true # no error - # + # # FileUtils.mv %w(junk.txt dust.txt), '/home/aamine/.trash/' # FileUtils.mv Dir.glob('test*.rb'), 'test', :noop => true, :verbose => true - # + # def mv(src, dest, options = {}) fu_check_options options, OPT_TABLE['mv'] fu_output_message "mv#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose] @@ -539,14 +539,14 @@ module FileUtils # # Options: force noop verbose - # + # # Remove file(s) specified in +list+. This method cannot remove directories. # All StandardErrors are ignored when the :force option is set. - # + # # FileUtils.rm %w( junk.txt dust.txt ) # FileUtils.rm Dir.glob('*.so') # FileUtils.rm 'NotExistFile', :force => true # never raises exception - # + # def rm(list, options = {}) fu_check_options options, OPT_TABLE['rm'] list = fu_list(list) @@ -567,7 +567,7 @@ module FileUtils # # Options: noop verbose - # + # # Equivalent to # # #rm(list, :force => true) @@ -588,11 +588,11 @@ module FileUtils # # Options: force noop verbose secure - # + # # remove files +list+[0] +list+[1]... If +list+[n] is a directory, # removes its all contents recursively. This method ignores # StandardError when :force option is set. - # + # # FileUtils.rm_r Dir.glob('/tmp/*') # FileUtils.rm_r '/', :force => true # :-) # @@ -606,7 +606,7 @@ module FileUtils # # NOTE: This method calls #remove_entry_secure if :secure option is set. # See also #remove_entry_secure. - # + # def rm_r(list, options = {}) fu_check_options options, OPT_TABLE['rm_r'] # options[:secure] = true unless options.key?(:secure) @@ -627,14 +627,14 @@ module FileUtils # # Options: noop verbose secure - # + # # Equivalent to # # #rm_r(list, :force => true) # # WARNING: This method causes local vulnerability. # Read the documentation of #rm_r first. - # + # def rm_rf(list, options = {}) fu_check_options options, OPT_TABLE['rm_rf'] options = options.dup @@ -788,7 +788,7 @@ module FileUtils # # Returns true if the contents of a file A and a file B are identical. - # + # # FileUtils.compare_file('somefile', 'somefile') #=> true # FileUtils.compare_file('/bin/cp', '/bin/mv') #=> maybe false # @@ -828,14 +828,14 @@ module FileUtils # # Options: mode preserve noop verbose - # + # # If +src+ is not same as +dest+, copies it and changes the permission # mode to +mode+. If +dest+ is a directory, destination is +dest+/+src+. # This method removes destination before copy. - # + # # FileUtils.install 'ruby', '/usr/local/bin/ruby', :mode => 0755, :verbose => true # FileUtils.install 'lib.rb', '/usr/local/lib/ruby/site_ruby', :verbose => true - # + # def install(src, dest, options = {}) fu_check_options options, OPT_TABLE['install'] fu_output_message "install -c#{options[:preserve] && ' -p'}#{options[:mode] ? (' -m 0%o' % options[:mode]) : ''} #{[src,dest].flatten.join ' '}" if options[:verbose] @@ -856,14 +856,14 @@ module FileUtils # # Options: noop verbose - # + # # Changes permission bits on the named files (in +list+) to the bit pattern # represented by +mode+. - # + # # FileUtils.chmod 0755, 'somecommand' # FileUtils.chmod 0644, %w(my.rb your.rb his.rb her.rb) # FileUtils.chmod 0755, '/usr/bin/ruby', :verbose => true - # + # def chmod(mode, list, options = {}) fu_check_options options, OPT_TABLE['chmod'] list = fu_list(list) @@ -879,12 +879,12 @@ module FileUtils # # Options: noop verbose force - # + # # Changes permission bits on the named files (in +list+) # to the bit pattern represented by +mode+. - # + # # FileUtils.chmod_R 0700, "/tmp/app.#{$$}" - # + # def chmod_R(mode, list, options = {}) fu_check_options options, OPT_TABLE['chmod_R'] list = fu_list(list) @@ -908,16 +908,16 @@ module FileUtils # # Options: noop verbose - # + # # Changes owner and group on the named files (in +list+) # to the user +user+ and the group +group+. +user+ and +group+ # may be an ID (Integer/String) or a name (String). # If +user+ or +group+ is nil, this method does not change # the attribute. - # + # # FileUtils.chown 'root', 'staff', '/usr/local/bin/ruby' # FileUtils.chown nil, 'bin', Dir.glob('/usr/bin/*'), :verbose => true - # + # def chown(user, group, list, options = {}) fu_check_options options, OPT_TABLE['chown'] list = fu_list(list) @@ -937,16 +937,16 @@ module FileUtils # # Options: noop verbose force - # + # # Changes owner and group on the named files (in +list+) # to the user +user+ and the group +group+ recursively. # +user+ and +group+ may be an ID (Integer/String) or # a name (String). If +user+ or +group+ is nil, this # method does not change the attribute. - # + # # FileUtils.chown_R 'www', 'www', '/var/www/htdocs' # FileUtils.chown_R 'cvs', 'cvs', '/var/cvs', :verbose => true - # + # def chown_R(user, group, list, options = {}) fu_check_options options, OPT_TABLE['chown_R'] list = fu_list(list) @@ -1010,13 +1010,13 @@ module FileUtils # # Options: noop verbose - # + # # Updates modification time (mtime) and access time (atime) of file(s) in # +list+. Files are created if they don't exist. - # + # # FileUtils.touch 'timestamp' # FileUtils.touch Dir.glob('*.c'); system 'make' - # + # def touch(list, options = {}) fu_check_options options, OPT_TABLE['touch'] list = fu_list(list) @@ -1510,11 +1510,11 @@ module FileUtils METHODS = singleton_methods() - [:private_module_function, :commands, :options, :have_option?, :options_of, :collect_method] - # + # # This module has all methods of FileUtils module, but it outputs messages # before acting. This equates to passing the <tt>:verbose</tt> flag to # methods in FileUtils. - # + # module Verbose include FileUtils @fileutils_output = $stderr @@ -1535,11 +1535,11 @@ module FileUtils end end - # + # # This module has all methods of FileUtils module, but never changes # files/directories. This equates to passing the <tt>:noop</tt> flag # to methods in FileUtils. - # + # module NoWrite include FileUtils @fileutils_output = $stderr @@ -1560,12 +1560,12 @@ module FileUtils end end - # + # # This module has all methods of FileUtils module, but never changes # files/directories, with printing message before acting. # This equates to passing the <tt>:noop</tt> and <tt>:verbose</tt> flag # to methods in FileUtils. - # + # module DryRun include FileUtils @fileutils_output = $stderr diff --git a/lib/forwardable.rb b/lib/forwardable.rb index 59a760db45..39b35d9cee 100644 --- a/lib/forwardable.rb +++ b/lib/forwardable.rb @@ -1,5 +1,5 @@ # -# forwardable.rb - +# forwardable.rb - # $Release Version: 1.1$ # $Revision$ # by Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -33,28 +33,28 @@ # # class Queue # extend Forwardable -# +# # def initialize # @q = [ ] # prepare delegate object # end -# +# # # setup preferred interface, enq() and deq()... # def_delegator :@q, :push, :enq # def_delegator :@q, :shift, :deq -# +# # # support some general Array methods that fit Queues well # def_delegators :@q, :clear, :first, :push, :shift, :size # end -# +# # q = Queue.new # q.enq 1, 2, 3, 4, 5 # q.push 6 -# +# # q.shift # => 1 # while q.size > 0 # puts q.deq # end -# +# # q.enq "Ruby", "Perl", "Python" # puts q.first # q.clear @@ -90,9 +90,9 @@ # # If you want to use both Forwardable and SingleForwardable, you can # use methods def_instance_delegator and def_single_delegator, etc. -# +# # If the object isn't a Module and Class, You can too extend -# Forwardable module. +# Forwardable module. # printer = String.new # printer.extend Forwardable # prepare object for delegation # printer.def_delegator "STDOUT", "puts" # add delegation for STDOUT.puts() diff --git a/lib/getoptlong.rb b/lib/getoptlong.rb index 4cfb5fbd27..c5e60ec188 100644 --- a/lib/getoptlong.rb +++ b/lib/getoptlong.rb @@ -12,10 +12,10 @@ # found at http://www.sra.co.jp/people/m-kasahr/ruby/getoptlong/ # The GetoptLong class allows you to parse command line options similarly to -# the GNU getopt_long() C library call. Note, however, that GetoptLong is a +# the GNU getopt_long() C library call. Note, however, that GetoptLong is a # pure Ruby implementation. # -# GetoptLong allows for POSIX-style options like <tt>--file</tt> as well +# GetoptLong allows for POSIX-style options like <tt>--file</tt> as well # as single letter options like <tt>-f</tt> # # The empty option <tt>--</tt> (two minus symbols) is used to end option @@ -26,13 +26,13 @@ # # require 'getoptlong' # require 'rdoc/usage' -# +# # opts = GetoptLong.new( # [ '--help', '-h', GetoptLong::NO_ARGUMENT ], # [ '--repeat', '-n', GetoptLong::REQUIRED_ARGUMENT ], # [ '--name', GetoptLong::OPTIONAL_ARGUMENT ] # ) -# +# # dir = nil # name = nil # repetitions = 1 @@ -41,16 +41,16 @@ # when '--help' # puts <<-EOF # hello [OPTION] ... DIR -# +# # -h, --help: # show help -# +# # --repeat x, -n x: # repeat x times -# +# # --name [name]: # greet user by name, if name not supplied default is John -# +# # DIR: The directory in which to issue the greeting. # EOF # when '--repeat' @@ -63,12 +63,12 @@ # end # end # end -# +# # if ARGV.length != 1 # puts "Missing dir argument (try --help)" # exit 0 # end -# +# # dir = ARGV.shift # # Dir.chdir(dir) @@ -114,7 +114,7 @@ class GetoptLong # Set up option processing. # # The options to support are passed to new() as an array of arrays. - # Each sub-array contains any number of String option names which carry + # Each sub-array contains any number of String option names which carry # the same meaning, and one of the following flags: # # GetoptLong::NO_ARGUMENT :: Option does not take an argument. @@ -194,23 +194,23 @@ class GetoptLong # the processing of options as follows: # # <b>REQUIRE_ORDER</b> : - # + # # Options are required to occur before non-options. # # Processing of options ends as soon as a word is encountered that has not # been preceded by an appropriate option flag. # # For example, if -a and -b are options which do not take arguments, - # parsing command line arguments of '-a one -b two' would result in - # 'one', '-b', 'two' being left in ARGV, and only ('-a', '') being + # parsing command line arguments of '-a one -b two' would result in + # 'one', '-b', 'two' being left in ARGV, and only ('-a', '') being # processed as an option/arg pair. # # This is the default ordering, if the environment variable # POSIXLY_CORRECT is set. (This is for compatibility with GNU getopt_long.) # # <b>PERMUTE</b> : - # - # Options can occur anywhere in the command line parsed. This is the + # + # Options can occur anywhere in the command line parsed. This is the # default behavior. # # Every sequence of words which can be interpreted as an option (with or @@ -227,7 +227,7 @@ class GetoptLong # # <b>RETURN_IN_ORDER</b> : # - # All words on the command line are processed as options. Words not + # All words on the command line are processed as options. Words not # preceded by a short or long option flag are passed as arguments # with an option of '' (empty string). # @@ -273,7 +273,7 @@ class GetoptLong # The method is failed if option processing has already started. # if @status != STATUS_YET - raise RuntimeError, + raise RuntimeError, "invoke set_options, but option processing has already started" end @@ -320,7 +320,7 @@ class GetoptLong end # - # Register the option (`i') to the `@canonical_names' and + # Register the option (`i') to the `@canonical_names' and # `@canonical_names' Hashes. # if canonical_name == nil @@ -452,7 +452,7 @@ class GetoptLong return nil end argument = ARGV.shift - elsif @ordering == REQUIRE_ORDER + elsif @ordering == REQUIRE_ORDER if (ARGV[0] !~ /^-./) terminate return nil @@ -589,7 +589,7 @@ class GetoptLong # # The block is called repeatedly with two arguments: # The first is the option name. - # The second is the argument which followed it (if any). + # The second is the argument which followed it (if any). # Example: ('--opt', 'value') # # The option name is always converted to the first (preferred) diff --git a/lib/gserver.rb b/lib/gserver.rb index 592e8661fe..2ab6e42bce 100644 --- a/lib/gserver.rb +++ b/lib/gserver.rb @@ -13,7 +13,7 @@ require "thread" # # GServer implements a generic server, featuring thread pool management, -# simple logging, and multi-server management. See HttpServer in +# simple logging, and multi-server management. See HttpServer in # <tt>xmlrpc/httpserver.rb</tt> in the Ruby standard library for an example of # GServer in action. # @@ -34,7 +34,7 @@ require "thread" # # # # # A server that returns the time in seconds since 1970. -# # +# # # class TimeServer < GServer # def initialize(port=10001, *args) # super(port, *args) @@ -47,17 +47,17 @@ require "thread" # # Run the server with logging enabled (it's a separate thread). # server = TimeServer.new # server.audit = true # Turn logging on. -# server.start +# server.start # # # *** Now point your browser to http://localhost:10001 to see it working *** # -# # See if it's still running. +# # See if it's still running. # GServer.in_service?(10001) # -> true # server.stopped? # -> false # # # Shut the server down gracefully. # server.shutdown -# +# # # Alternatively, stop it immediately. # GServer.stop(10001) # # or, of course, "server.stop". diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb index 26364cd9ce..21c8787f80 100644 --- a/lib/ipaddr.rb +++ b/lib/ipaddr.rb @@ -66,19 +66,19 @@ end # == Example # # require 'ipaddr' -# +# # ipaddr1 = IPAddr.new "3ffe:505:2::1" -# +# # p ipaddr1 #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff> -# +# # p ipaddr1.to_s #=> "3ffe:505:2::1" -# +# # ipaddr2 = ipaddr1.mask(48) #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0000/ffff:ffff:ffff:0000:0000:0000:0000:0000> -# +# # p ipaddr2.to_s #=> "3ffe:505:2::" -# +# # ipaddr3 = IPAddr.new "192.168.2.0/24" -# +# # p ipaddr3 #=> #<IPAddr: IPv4:192.168.2.0/255.255.255.0> class IPAddr @@ -425,7 +425,7 @@ class IPAddr # Creates a new ipaddr object either from a human readable IP # address representation in string, or from a packed in_addr value # followed by an address family. - # + # # In the former case, the following are the valid formats that will # be recognized: "address", "address/prefixlen" and "address/mask", # where IPv6 address may be enclosed in square brackets (`[' and @@ -433,7 +433,7 @@ class IPAddr # IP address. Although the address family is determined # automatically from a specified string, you can specify one # explicitly by the optional second argument. - # + # # Otherwise an IP addess is generated from a packed in_addr value # and an address family. # diff --git a/lib/irb.rb b/lib/irb.rb index f5e662ac51..119e1a45d8 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -64,7 +64,7 @@ module IRB trap("SIGINT") do irb.signal_handle end - + catch(:IRB_EXIT) do irb.eval_input end @@ -84,7 +84,7 @@ module IRB end # - # irb interpreter main routine + # irb interpreter main routine # class Irb def initialize(workspace = nil, input_method = nil, output_method = nil) @@ -125,7 +125,7 @@ module IRB end end end - + @scanner.set_input(@context.io) do signal_status(:IN_INPUT) do if l = @context.io.gets @@ -158,7 +158,7 @@ module IRB print exc.class, ": ", exc, "\n" if exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ && !(SyntaxError === exc) - irb_bug = true + irb_bug = true else irb_bug = false end @@ -174,7 +174,7 @@ module IRB else lasts.push "\tfrom "+m if lasts.size > @context.back_trace_limit - lasts.shift + lasts.shift levels += 1 end end @@ -279,13 +279,13 @@ module IRB when "l" ltype when "i" - if $1 + if $1 format("%" + $1 + "d", indent) else indent.to_s end when "n" - if $1 + if $1 format("%" + $1 + "d", line_no) else line_no.to_s diff --git a/lib/irb/cmd/chws.rb b/lib/irb/cmd/chws.rb index c2db7e5d91..e225b52585 100644 --- a/lib/irb/cmd/chws.rb +++ b/lib/irb/cmd/chws.rb @@ -1,12 +1,12 @@ # -# change-ws.rb - +# change-ws.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "irb/cmd/nop.rb" diff --git a/lib/irb/cmd/fork.rb b/lib/irb/cmd/fork.rb index 6f4133c047..534f13f56a 100644 --- a/lib/irb/cmd/fork.rb +++ b/lib/irb/cmd/fork.rb @@ -1,12 +1,12 @@ # -# fork.rb - +# fork.rb - # $Release Version: 0.9.5 $ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # @RCS_ID='-$Id$-' @@ -17,7 +17,7 @@ module IRB class Fork<Nop def execute(&block) pid = send ExtendCommand.irb_original_method_name("fork") - unless pid + unless pid class<<self alias_method :exit, ExtendCommand.irb_original_method_name('exit') end diff --git a/lib/irb/cmd/help.rb b/lib/irb/cmd/help.rb index e1f47e2c97..146acdfa81 100644 --- a/lib/irb/cmd/help.rb +++ b/lib/irb/cmd/help.rb @@ -5,7 +5,7 @@ # # -- # -# +# # require 'rdoc/ri/driver' diff --git a/lib/irb/cmd/load.rb b/lib/irb/cmd/load.rb index cda9a053fe..5988b7bbd1 100644 --- a/lib/irb/cmd/load.rb +++ b/lib/irb/cmd/load.rb @@ -1,12 +1,12 @@ # -# load.rb - +# load.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "irb/cmd/nop.rb" @@ -25,7 +25,7 @@ module IRB class Require<Nop include IrbLoader - + def execute(file_name) # return ruby_require(file_name) unless IRB.conf[:USE_LOADER] @@ -44,7 +44,7 @@ module IRB when /\.(so|o|sl)$/ return ruby_require(file_name) end - + begin irb_load(f = file_name + ".rb") $".push f diff --git a/lib/irb/cmd/nop.rb b/lib/irb/cmd/nop.rb index 0b68098d4f..873c0f43f4 100644 --- a/lib/irb/cmd/nop.rb +++ b/lib/irb/cmd/nop.rb @@ -1,17 +1,17 @@ # -# nop.rb - +# nop.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # module IRB module ExtendCommand class Nop - + @RCS_ID='-$Id$-' def self.execute(conf, *opts) diff --git a/lib/irb/cmd/pushws.rb b/lib/irb/cmd/pushws.rb index b5b41501af..a82939f39d 100644 --- a/lib/irb/cmd/pushws.rb +++ b/lib/irb/cmd/pushws.rb @@ -1,12 +1,12 @@ # -# change-ws.rb - +# change-ws.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "irb/cmd/nop.rb" diff --git a/lib/irb/cmd/subirb.rb b/lib/irb/cmd/subirb.rb index 5eccf9f2c1..bf41ec50cc 100644 --- a/lib/irb/cmd/subirb.rb +++ b/lib/irb/cmd/subirb.rb @@ -1,13 +1,13 @@ #!/usr/local/bin/ruby # -# multi.rb - +# multi.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "irb/cmd/nop.rb" diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index 26339f217d..a31bee0c76 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -1,5 +1,5 @@ # -# irb/completor.rb - +# irb/completor.rb - # $Release Version: 0.9$ # $Revision$ # by Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -15,16 +15,16 @@ module IRB ReservedWords = [ "BEGIN", "END", - "alias", "and", - "begin", "break", + "alias", "and", + "begin", "break", "case", "class", "def", "defined", "do", "else", "elsif", "end", "ensure", - "false", "for", - "if", "in", - "module", + "false", "for", + "if", "in", + "module", "next", "nil", "not", - "or", + "or", "redo", "rescue", "retry", "return", "self", "super", "then", "true", @@ -32,10 +32,10 @@ module IRB "when", "while", "yield", ] - + CompletionProc = proc { |input| bind = IRB.conf[:MAIN_CONTEXT].workspace.binding - + # puts "input: #{input}" case input @@ -63,7 +63,7 @@ module IRB candidates = Proc.instance_methods.collect{|m| m.to_s} candidates |= Hash.instance_methods.collect{|m| m.to_s} select_message(receiver, message, candidates) - + when /^(:[^:.]*)$/ # Symbol if Symbol.respond_to?(:all_symbols) @@ -137,7 +137,7 @@ module IRB gv = eval("global_variables", bind).collect{|m| m.to_s} lv = eval("local_variables", bind).collect{|m| m.to_s} cv = eval("self.class.constants", bind).collect{|m| m.to_s} - + if (gv | lv | cv).include?(receiver) # foo.func and foo is local var. candidates = eval("#{receiver}.methods", bind).collect{|m| m.to_s} @@ -157,7 +157,7 @@ module IRB rescue Exception name = "" end - next if name != "IRB::Context" and + next if name != "IRB::Context" and /^(IRB|SLex|RubyLex|RubyToken)/ =~ name candidates.concat m.instance_methods(false).collect{|x| x.to_s} } @@ -177,7 +177,7 @@ module IRB else candidates = eval("methods | private_methods | local_variables | self.class.constants", bind).collect{|m| m.to_s} - + (candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/) end } diff --git a/lib/irb/context.rb b/lib/irb/context.rb index e2ab05a341..a3f5e5a79c 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -6,7 +6,7 @@ # # -- # -# +# # require "irb/workspace" @@ -45,7 +45,7 @@ module IRB @ignore_eof = IRB.conf[:IGNORE_EOF] @back_trace_limit = IRB.conf[:BACK_TRACE_LIMIT] - + self.prompt_mode = IRB.conf[:PROMPT_MODE] if IRB.conf[:SINGLE_IRB] or !defined?(JobManager) @@ -90,7 +90,7 @@ module IRB @output_method = StdioOutputMethod.new end - @verbose = IRB.conf[:VERBOSE] + @verbose = IRB.conf[:VERBOSE] @echo = IRB.conf[:ECHO] if @echo.nil? @echo = true @@ -106,7 +106,7 @@ module IRB attr_accessor :workspace attr_reader :thread attr_accessor :io - + attr_accessor :irb attr_accessor :ap_name attr_accessor :rc @@ -141,7 +141,7 @@ module IRB def verbose? if @verbose.nil? - if defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod) + if defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod) false elsif !STDIN.tty? or @io.kind_of?(FileInputMethod) true @@ -179,7 +179,7 @@ module IRB @auto_indent_mode = IRB.conf[:AUTO_INDENT] end end - + def inspect? @inspect_mode.nil? or @inspect_mode end diff --git a/lib/irb/ext/change-ws.rb b/lib/irb/ext/change-ws.rb index 217d4a58ef..3ae1eab7a4 100644 --- a/lib/irb/ext/change-ws.rb +++ b/lib/irb/ext/change-ws.rb @@ -1,12 +1,12 @@ # -# irb/ext/cb.rb - +# irb/ext/cb.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # module IRB @@ -22,12 +22,12 @@ module IRB def change_workspace(*_main) if _main.empty? - @workspace = home_workspace + @workspace = home_workspace return main end - + @workspace = WorkSpace.new(_main[0]) - + if !(class<<main;ancestors;end).include?(ExtendCommandBundle) main.extend ExtendCommandBundle end diff --git a/lib/irb/ext/history.rb b/lib/irb/ext/history.rb index a12700ce19..9142146c42 100644 --- a/lib/irb/ext/history.rb +++ b/lib/irb/ext/history.rb @@ -1,12 +1,12 @@ # -# history.rb - +# history.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # module IRB @@ -56,7 +56,7 @@ module IRB end def size(size) - if size != 0 && size < @size + if size != 0 && size < @size @contents = @contents[@size - size .. @size] end @size = size @@ -78,7 +78,7 @@ module IRB @contents.push [no, val] @contents.shift if @size != 0 && @contents.size > @size end - + alias real_inspect inspect def inspect diff --git a/lib/irb/ext/loader.rb b/lib/irb/ext/loader.rb index 2d4400caef..cee8f51cc9 100644 --- a/lib/irb/ext/loader.rb +++ b/lib/irb/ext/loader.rb @@ -1,12 +1,12 @@ # -# loader.rb - +# loader.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # @@ -44,7 +44,7 @@ module IRB irb.suspend_name(path, File.basename(path)) do irb.suspend_input_method(FileInputMethod.new(path)) do |back_io| - irb.signal_status(:IN_LOAD) do + irb.signal_status(:IN_LOAD) do if back_io.kind_of?(FileInputMethod) irb.eval_input else @@ -61,7 +61,7 @@ module IRB def load_file(path, priv = nil) irb.suspend_name(path, File.basename(path)) do - + if priv ws = WorkSpace.new(Module.new) else @@ -70,7 +70,7 @@ module IRB irb.suspend_workspace(ws) do irb.suspend_input_method(FileInputMethod.new(path)) do |back_io| - irb.signal_status(:IN_LOAD) do + irb.signal_status(:IN_LOAD) do # p irb.conf if back_io.kind_of?(FileInputMethod) irb.eval_input diff --git a/lib/irb/ext/math-mode.rb b/lib/irb/ext/math-mode.rb index 450a21eff7..370fab229d 100644 --- a/lib/irb/ext/math-mode.rb +++ b/lib/irb/ext/math-mode.rb @@ -1,12 +1,12 @@ # -# math-mode.rb - +# math-mode.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "mathn" diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb index d32d41ff95..5085a3f272 100644 --- a/lib/irb/ext/multi-irb.rb +++ b/lib/irb/ext/multi-irb.rb @@ -6,7 +6,7 @@ # # -- # -# +# # IRB.fail CantShiftToMultiIrbMode unless defined?(Thread) require "thread" @@ -66,7 +66,7 @@ module IRB IRB.fail IrbAlreadyDead unless th.alive? th.exit end - end + end def search(key) job = case key @@ -123,8 +123,8 @@ module IRB t_status = "exited" end ary.push format("#%d->%s on %s (%s: %s)", - i, - irb.context.irb_name, + i, + irb.context.irb_name, irb.context.main, th, t_status) @@ -143,14 +143,14 @@ module IRB IRB.JobManager.irb(Thread.current).context end - # invoke multi-irb + # invoke multi-irb def IRB.irb(file = nil, *main) workspace = WorkSpace.new(*main) parent_thread = Thread.current Thread.start do begin irb = Irb.new(workspace, file) - rescue + rescue print "Subirb can't start with context(self): ", workspace.main.inspect, "\n" print "return to main irb\n" Thread.pass diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb index 88610fe9c9..4d53844d5f 100644 --- a/lib/irb/ext/save-history.rb +++ b/lib/irb/ext/save-history.rb @@ -1,13 +1,13 @@ #!/usr/local/bin/ruby # -# save-history.rb - +# save-history.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "readline" diff --git a/lib/irb/ext/tracer.rb b/lib/irb/ext/tracer.rb index df954af20b..6728c46137 100644 --- a/lib/irb/ext/tracer.rb +++ b/lib/irb/ext/tracer.rb @@ -1,12 +1,12 @@ # -# irb/lib/tracer.rb - +# irb/lib/tracer.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "tracer" @@ -43,7 +43,7 @@ module IRB alias __evaluate__ evaluate def evaluate(context, statements, file = nil, line = nil) if context.use_tracer? && file != nil && line != nil - Tracer.on + Tracer.on begin __evaluate__(context, statements, file, line) ensure @@ -57,4 +57,4 @@ module IRB IRB.initialize_tracer end - + diff --git a/lib/irb/ext/use-loader.rb b/lib/irb/ext/use-loader.rb index 3836275fcd..b643dd099e 100644 --- a/lib/irb/ext/use-loader.rb +++ b/lib/irb/ext/use-loader.rb @@ -1,12 +1,12 @@ # -# use-loader.rb - +# use-loader.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "irb/cmd/load" @@ -30,7 +30,7 @@ module IRB class Context IRB.conf[:USE_LOADER] = false - + def use_loader IRB.conf[:USE_LOADER] end diff --git a/lib/irb/ext/workspaces.rb b/lib/irb/ext/workspaces.rb index f3ae8d1ae8..654b8118ea 100644 --- a/lib/irb/ext/workspaces.rb +++ b/lib/irb/ext/workspaces.rb @@ -1,12 +1,12 @@ # -# push-ws.rb - +# push-ws.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # module IRB diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb index 2816f35116..61a43e4a78 100644 --- a/lib/irb/extend-command.rb +++ b/lib/irb/extend-command.rb @@ -1,12 +1,12 @@ # -# irb/extend-command.rb - irb extend command +# irb/extend-command.rb - irb extend command # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # module IRB # @@ -89,15 +89,15 @@ module IRB [:irb_load, :Load, "irb/cmd/load"], [:irb_require, :Require, "irb/cmd/load"], - [:irb_source, :Source, "irb/cmd/load", + [:irb_source, :Source, "irb/cmd/load", [:source, NO_OVERRIDE]], [:irb, :IrbCommand, "irb/cmd/subirb"], - [:irb_jobs, :Jobs, "irb/cmd/subirb", + [:irb_jobs, :Jobs, "irb/cmd/subirb", [:jobs, NO_OVERRIDE]], - [:irb_fg, :Foreground, "irb/cmd/subirb", + [:irb_fg, :Foreground, "irb/cmd/subirb", [:fg, NO_OVERRIDE]], - [:irb_kill, :Kill, "irb/cmd/subirb", + [:irb_kill, :Kill, "irb/cmd/subirb", [:kill, OVERRIDE_PRIVATE_ONLY]], [:irb_help, :Help, "irb/cmd/help", @@ -161,9 +161,9 @@ module IRB (override == NO_OVERRIDE) && !respond_to?(to, true) target = self (class<<self;self;end).instance_eval{ - if target.respond_to?(to, true) && + if target.respond_to?(to, true) && !target.respond_to?(EXCB.irb_original_method_name(to), true) - alias_method(EXCB.irb_original_method_name(to), to) + alias_method(EXCB.irb_original_method_name(to), to) end alias_method to, from } diff --git a/lib/irb/frame.rb b/lib/irb/frame.rb index 8a5d0696fb..8814b47a9d 100644 --- a/lib/irb/frame.rb +++ b/lib/irb/frame.rb @@ -1,12 +1,12 @@ # -# frame.rb - +# frame.rb - # $Release Version: 0.9$ # $Revision$ # by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd) # # -- # -# +# # require "e2mmap" diff --git a/lib/irb/help.rb b/lib/irb/help.rb index 2b064d5d6d..cae9c8a832 100644 --- a/lib/irb/help.rb +++ b/lib/irb/help.rb @@ -6,7 +6,7 @@ # # -- # -# +# # require 'irb/magic-file' diff --git a/lib/irb/init.rb b/lib/irb/init.rb index 62c862a1c3..8f88802f5d 100644 --- a/lib/irb/init.rb +++ b/lib/irb/init.rb @@ -6,7 +6,7 @@ # # -- # -# +# # module IRB @@ -20,7 +20,7 @@ module IRB IRB.load_modules unless @CONF[:PROMPT][@CONF[:PROMPT_MODE]] - IRB.fail(UndefinedPromptMode, @CONF[:PROMPT_MODE]) + IRB.fail(UndefinedPromptMode, @CONF[:PROMPT_MODE]) end end @@ -112,7 +112,7 @@ module IRB # @CONF[:LC_MESSAGES] = "en" @CONF[:LC_MESSAGES] = Locale.new - + @CONF[:DEBUG_LEVEL] = 1 end @@ -246,7 +246,7 @@ module IRB yield proc{|rc| rc == "rc" ? irbrc : irbrc+rc} end if home = ENV["HOME"] - yield proc{|rc| home+"/.irb#{rc}"} + yield proc{|rc| home+"/.irb#{rc}"} end home = Dir.pwd yield proc{|rc| home+"/.irb#{rc}"} diff --git a/lib/irb/input-method.rb b/lib/irb/input-method.rb index 0b22d9ca74..9c3d682c66 100644 --- a/lib/irb/input-method.rb +++ b/lib/irb/input-method.rb @@ -6,13 +6,13 @@ # # -- # -# +# # require 'irb/src_encoding' require 'irb/magic-file' module IRB - # + # # InputMethod # StdioInputMethod # FileInputMethod @@ -28,7 +28,7 @@ module IRB attr_reader :file_name attr_accessor :prompt - + def gets IRB.fail NotImplementedError, "gets" end @@ -38,7 +38,7 @@ module IRB false end end - + class StdioInputMethod < InputMethod def initialize super @@ -70,7 +70,7 @@ module IRB @stdin.external_encoding end end - + class FileInputMethod < InputMethod def initialize(file) super @@ -97,7 +97,7 @@ module IRB begin require "readline" class ReadlineInputMethod < InputMethod - include Readline + include Readline def initialize super diff --git a/lib/irb/lc/error.rb b/lib/irb/lc/error.rb index acfa22c2af..ed7d0361fe 100644 --- a/lib/irb/lc/error.rb +++ b/lib/irb/lc/error.rb @@ -1,12 +1,12 @@ # -# irb/lc/error.rb - +# irb/lc/error.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "e2mmap" diff --git a/lib/irb/lc/ja/error.rb b/lib/irb/lc/ja/error.rb index dc0345e6df..c73b640637 100644 --- a/lib/irb/lc/ja/error.rb +++ b/lib/irb/lc/ja/error.rb @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# irb/lc/ja/error.rb - +# irb/lc/ja/error.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "e2mmap" diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb index d4e2a0244a..9c96d15525 100644 --- a/lib/irb/locale.rb +++ b/lib/irb/locale.rb @@ -6,7 +6,7 @@ # # -- # -# +# # module IRB class Locale @@ -30,7 +30,7 @@ module IRB def initialize(locale = nil) @lang = @territory = @encoding_name = @modifier = nil - @locale = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C" + @locale = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C" if m = LOCALE_NAME_RE.match(@locale) @lang, @territory, @encoding_name, @modifier = m[:language], m[:territory], m[:codeset], m[:modifier] @@ -50,7 +50,7 @@ module IRB def String(mes) mes = super(mes) if @encoding - mes.encode(@encoding) + mes.encode(@encoding) else mes end @@ -109,7 +109,7 @@ module IRB end alias toplevel_load load - + def load(file, priv=nil) dir = File.dirname(file) dir = "" if dir == "." @@ -125,7 +125,7 @@ module IRB return real_load(lc_path, priv) if lc_path end raise LoadError, "No such file to load -- #{file}" - end + end def real_load(path, priv) src = MagicFile.open(path){|f| f.read} diff --git a/lib/irb/notifier.rb b/lib/irb/notifier.rb index 51f10ff398..f76fc8040c 100644 --- a/lib/irb/notifier.rb +++ b/lib/irb/notifier.rb @@ -1,12 +1,12 @@ # -# notifier.rb - output methods used by irb +# notifier.rb - output methods used by irb # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "e2mmap" @@ -15,16 +15,16 @@ require "irb/output-method" module IRB module Notifier extend Exception2MessageMapper - def_exception :ErrUndefinedNotifier, + def_exception :ErrUndefinedNotifier, "undefined notifier level: %d is specified" - def_exception :ErrUnrecognizedLevel, + def_exception :ErrUnrecognizedLevel, "unrecognized notifier level: %s is specified" def def_notifier(prefix = "", output_method = StdioOutputMethod.new) CompositeNotifier.new(prefix, output_method) end module_function :def_notifier - + class AbstructNotifier def initialize(prefix, base_notifier) @prefix = prefix @@ -112,7 +112,7 @@ module IRB def initialize(base, level, prefix) super(prefix, base) - + @level = level end @@ -121,7 +121,7 @@ module IRB def <=>(other) @level <=> other.level end - + def notify? @base_notifier.level >= self end diff --git a/lib/irb/output-method.rb b/lib/irb/output-method.rb index 301af7210e..bbfc072536 100644 --- a/lib/irb/output-method.rb +++ b/lib/irb/output-method.rb @@ -1,12 +1,12 @@ # -# output-method.rb - optput methods used by irb +# output-method.rb - optput methods used by irb # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "e2mmap" @@ -39,7 +39,7 @@ module IRB # <minimum field width> (\*|\*[1-9][0-9]*\$|[1-9][0-9]*) # <precision>.(\*|\*[1-9][0-9]*\$|[1-9][0-9]*|)? # #<length modifier>(hh|h|l|ll|L|q|j|z|t) - # <conversion specifier>[diouxXeEfgGcsb%] + # <conversion specifier>[diouxXeEfgGcsb%] def parse_printf_format(format, opts) return format, opts if $1.size % 2 == 1 end diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index b21f0d34f8..13b101ffc8 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -6,7 +6,7 @@ # # -- # -# +# # require "e2mmap" @@ -20,12 +20,12 @@ class RubyLex def_exception(:AlreadyDefinedToken, "Already defined token(%s)") def_exception(:TkReading2TokenNoKey, "key nothing(key='%s')") def_exception(:TkSymbol2TokenNoKey, "key nothing(key='%s')") - def_exception(:TkReading2TokenDuplicateError, + def_exception(:TkReading2TokenDuplicateError, "key duplicate(token_n='%s', key='%s')") def_exception(:SyntaxError, "%s") def_exception(:TerminateLineInput, "Terminate Line Input") - + include RubyToken class << self @@ -53,7 +53,7 @@ class RubyLex @lex_state = EXPR_BEG @space_seen = false @here_header = false - + @continue = false @line = "" @@ -91,7 +91,7 @@ class RubyLex else @base_char_no += @readed.size end - + readed = @readed.join("") @readed = [] readed @@ -111,7 +111,7 @@ class RubyLex end @seek += 1 if c == "\n" - @line_no += 1 + @line_no += 1 @char_no = 0 else @char_no += 1 @@ -148,10 +148,10 @@ class RubyLex c2 = @here_readed.pop end c = c2 unless c - @rests.unshift c #c = + @rests.unshift c #c = @seek -= 1 if c == "\n" - @line_no -= 1 + @line_no -= 1 if idx = @readed.reverse.index("\n") @char_no = @readed.size - idx else @@ -216,14 +216,14 @@ class RubyLex @lex_state = EXPR_BEG @space_seen = false @here_header = false - + @continue = false prompt @line = "" @exp_line_no = @line_no end - + def each_top_level_statement initialize_input catch(:TERM_INPUT) do @@ -297,7 +297,7 @@ class RubyLex # Tracer.off tk end - + ENINDENT_CLAUSE = [ "case", "class", "def", "do", "for", "if", "module", "unless", "until", "while", "begin" #, "when" @@ -314,7 +314,7 @@ class RubyLex "W" => "]", "s" => ":" } - + PERCENT_PAREN = { "{" => "}", "[" => "]", @@ -354,7 +354,7 @@ class RubyLex end @OP.def_rule("=begin", - proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do + proc{|op, io| @prev_char_no == 0 && peek(0) =~ /\s/}) do |op, io| @ltype = "=" until getc == "\n"; end @@ -374,8 +374,8 @@ class RubyLex else @continue = false @lex_state = EXPR_BEG - until (@indent_stack.empty? || - [TkLPAREN, TkLBRACK, TkLBRACE, + until (@indent_stack.empty? || + [TkLPAREN, TkLBRACK, TkLBRACE, TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last)) @indent_stack.pop end @@ -385,9 +385,9 @@ class RubyLex Token(TkNL) end - @OP.def_rules("*", "**", - "=", "==", "===", - "=~", "<=>", + @OP.def_rules("*", "**", + "=", "==", "===", + "=~", "<=>", "<", "<=", ">", ">=", ">>") do |op, io| @@ -455,7 +455,7 @@ class RubyLex @lex_state = EXPR_BEG; Token(TkQUESTION) else - if (ch == '\\') + if (ch == '\\') read_escape end @lex_state = EXPR_END @@ -469,8 +469,8 @@ class RubyLex @lex_state = EXPR_BEG Token(op) end - - @OP.def_rules("+=", "-=", "*=", "**=", + + @OP.def_rules("+=", "-=", "*=", "**=", "&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do |op, io| @lex_state = EXPR_BEG @@ -529,7 +529,7 @@ class RubyLex lex_int2 end - + def lex_int2 @OP.def_rules("]", "}", ")") do |op, io| @@ -572,7 +572,7 @@ class RubyLex Token(TkOPASGN, "/") #/) elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/ identify_string(op) - else + else @lex_state = EXPR_BEG Token("/") #/) end @@ -588,7 +588,7 @@ class RubyLex # @lex_state = EXPR_BEG # Token(OP_ASGN, :^) # end - + @OP.def_rules(",") do |op, io| @lex_state = EXPR_BEG @@ -598,8 +598,8 @@ class RubyLex @OP.def_rules(";") do |op, io| @lex_state = EXPR_BEG - until (@indent_stack.empty? || - [TkLPAREN, TkLBRACK, TkLBRACE, + until (@indent_stack.empty? || + [TkLPAREN, TkLBRACK, TkLBRACE, TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last)) @indent_stack.pop end @@ -617,7 +617,7 @@ class RubyLex @lex_state = EXPR_BEG Token("~") end - + @OP.def_rule("(") do |op, io| @indent += 1 @@ -718,7 +718,7 @@ class RubyLex end end - # @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do + # @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do # |op, io| # @indent += 1 # @lex_state = EXPR_FNAME @@ -739,13 +739,13 @@ class RubyLex printf "MATCH: end %s: %s\n", op, io.inspect if RubyLex.debug? t end - + p @OP if RubyLex.debug? end - + def identify_gvar @lex_state = EXPR_END - + case ch = getc when /[~_*$?!@\/\\;,=:<>".]/ #" Token(TkGVAR, "$" + ch) @@ -761,12 +761,12 @@ class RubyLex ungetc ungetc identify_identifier - else + else ungetc Token("$") end end - + def identify_identifier token = "" if peek(0) =~ /[$@]/ @@ -781,7 +781,7 @@ class RubyLex token.concat ch end ungetc - + if (ch == "!" || ch == "?") && token[0,1] =~ /\w/ && peek(0) != "=" token.concat getc end @@ -799,7 +799,7 @@ class RubyLex @lex_state = EXPR_END return Token(TkIVAR, token) end - + if @lex_state != EXPR_DOT print token, "\n" if RubyLex.debug? @@ -927,7 +927,7 @@ class RubyLex @lex_state = EXPR_END Token(Ltype2Token[lt]) end - + def identify_quotation ch = getc if lt = PERCENT_LTYPE[ch] @@ -968,10 +968,10 @@ class RubyLex match = /[0-7_]/ when /[89]/ RubyLex.fail SyntaxError, "Invalid octal digit" - else + else return Token(TkINTEGER) end - + len0 = true non_digit = false while ch = getc @@ -999,7 +999,7 @@ class RubyLex end return Token(TkINTEGER) end - + type = TkINTEGER allow_point = true allow_e = true @@ -1042,7 +1042,7 @@ class RubyLex end Token(type) end - + def identify_string(ltype, quoted = ltype) @ltype = ltype @quoted = quoted @@ -1063,7 +1063,7 @@ class RubyLex elsif ch == '\\' #' read_escape end - if PERCENT_PAREN.values.include?(@quoted) + if PERCENT_PAREN.values.include?(@quoted) if PERCENT_PAREN[ch] == @quoted nest += 1 elsif ch == @quoted @@ -1087,7 +1087,7 @@ class RubyLex @lex_state = EXPR_END end end - + def identify_comment @ltype = "#" @@ -1103,7 +1103,7 @@ class RubyLex end return Token(TkCOMMENT) end - + def read_escape case ch = getc when "\n", "\r", "\f" @@ -1120,7 +1120,7 @@ class RubyLex break end end - + when "x" 2.times do case ch = getc @@ -1149,7 +1149,7 @@ class RubyLex read_escape end else - # other characters + # other characters end end end diff --git a/lib/irb/ruby-token.rb b/lib/irb/ruby-token.rb index 30a94b043c..9eb3bc1739 100644 --- a/lib/irb/ruby-token.rb +++ b/lib/irb/ruby-token.rb @@ -1,12 +1,12 @@ # -# irb/ruby-token.rb - ruby tokens +# irb/ruby-token.rb - ruby tokens # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # module RubyToken EXPR_BEG = :EXPR_BEG @@ -21,7 +21,7 @@ module RubyToken if !defined?(Symbol) Symbol = Integer end - + class Token def initialize(seek, line_no, char_no) @seek = seek @@ -84,7 +84,7 @@ module RubyToken if (tk = TkReading2Token[token]).nil? IRB.fail TkReading2TokenNoKey, token end - tk = Token(tk[0], value) + tk = Token(tk[0], value) if tk.kind_of?(TkOp) tk.name = token end @@ -93,8 +93,8 @@ module RubyToken if (tk = TkSymbol2Token[token]).nil? IRB.fail TkSymbol2TokenNoKey, token end - return Token(tk[0], value) - else + return Token(tk[0], value) + else if (token.ancestors & [TkId, TkVal, TkOPASGN, TkUnknownChar]).empty? token.new(@prev_seek, @prev_line_no, @prev_char_no) else @@ -194,7 +194,7 @@ module RubyToken [:TkASSOC, TkOp, "=>"], [:TkQUESTION, TkOp, "?"], #? [:TkCOLON, TkOp, ":"], #: - + [:TkfLPAREN], # func( # [:TkfLBRACK], # func[ # [:TkfLBRACE], # func{ # @@ -250,7 +250,7 @@ module RubyToken IRB.fail AlreadyDefinedToken, token_n end token_c = eval("class #{token_n} < #{super_token}; end; #{token_n}") - + if reading if TkReading2Token[reading] IRB.fail TkReading2TokenDuplicateError, token_n, reading diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb index c8b40c6878..6b3d1f37e3 100644 --- a/lib/irb/slex.rb +++ b/lib/irb/slex.rb @@ -6,7 +6,7 @@ # # -- # -# +# # require "e2mmap" @@ -24,20 +24,20 @@ module IRB D_WARN = DOUT::def_notifier(1, "Warn: ") D_DEBUG = DOUT::def_notifier(2, "Debug: ") D_DETAIL = DOUT::def_notifier(4, "Detail: ") - + DOUT.level = Notifier::D_NOMSG def initialize @head = Node.new("") end - + def def_rule(token, preproc = nil, postproc = nil, &block) D_DETAIL.pp token postproc = block if block_given? node = create(token, preproc, postproc) end - + def def_rules(*tokens, &block) if block_given? p = block @@ -46,18 +46,18 @@ module IRB def_rule(token, nil, p) end end - + def preproc(token, proc) node = search(token) node.preproc=proc end - - #$BMW%A%'%C%/(B? + + #$BMW%A%'%C%/(B? def postproc(token) node = search(token, proc) node.postproc=proc end - + def search(token) @head.search(token.split(//)) end @@ -65,7 +65,7 @@ module IRB def create(token, preproc = nil, postproc = nil) @head.create_subnode(token.split(//), preproc, postproc) end - + def match(token) case token when Array @@ -78,14 +78,14 @@ module IRB D_DETAIL.exec_if{D_DEATIL.printf "match end: %s:%s\n", ret, token.inspect} ret end - + def inspect format("<SLex: @head = %s>", @head.inspect) end #---------------------------------------------------------------------- # - # class Node - + # class Node - # #---------------------------------------------------------------------- class Node @@ -99,7 +99,7 @@ module IRB attr_accessor :preproc attr_accessor :postproc - + def search(chrs, opt = nil) return self if chrs.empty? ch = chrs.shift @@ -114,7 +114,7 @@ module IRB end end end - + def create_subnode(chrs, preproc = nil, postproc = nil) if chrs.empty? if @postproc @@ -127,7 +127,7 @@ module IRB end return self end - + ch = chrs.shift if node = @Tree[ch] if chrs.empty? @@ -161,7 +161,7 @@ module IRB # chrs: String # character array # io must have getc()/ungetc(); and ungetc() must be - # able to be called arbitrary number of times. + # able to be called arbitrary number of times. # def match(chrs, op = "") D_DETAIL.print "match>: ", chrs, "op:", op, "\n" @@ -254,14 +254,14 @@ if $0 == __FILE__ print "1: ", tr.inspect, "\n" tr.def_rule("==") {print "==\n"} print "2: ", tr.inspect, "\n" - + print "case 1:\n" print tr.match("="), "\n" print "case 2:\n" print tr.match("=="), "\n" print "case 3:\n" print tr.match("=>"), "\n" - + when "2" tr = SLex.new print "0: ", tr.inspect, "\n" @@ -269,7 +269,7 @@ if $0 == __FILE__ print "1: ", tr.inspect, "\n" tr.def_rule("==", proc{false}) {print "==\n"} print "2: ", tr.inspect, "\n" - + print "case 1:\n" print tr.match("="), "\n" print "case 2:\n" diff --git a/lib/irb/version.rb b/lib/irb/version.rb index 32ecf940cf..a9ccc1ce95 100644 --- a/lib/irb/version.rb +++ b/lib/irb/version.rb @@ -6,7 +6,7 @@ # # -- # -# +# # module IRB diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb index 7c95106c39..1b88914a84 100644 --- a/lib/irb/workspace.rb +++ b/lib/irb/workspace.rb @@ -1,12 +1,12 @@ # -# irb/workspace-binding.rb - +# irb/workspace-binding.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # module IRB class WorkSpace @@ -21,7 +21,7 @@ module IRB case IRB.conf[:CONTEXT_MODE] when 0 # binding in proc on TOPLEVEL_BINDING @binding = eval("proc{binding}.call", - TOPLEVEL_BINDING, + TOPLEVEL_BINDING, __FILE__, __LINE__) when 1 # binding in loaded file @@ -37,7 +37,7 @@ EOF when 2 # binding in loaded file(thread use) unless defined? BINDING_QUEUE require "thread" - + IRB.const_set("BINDING_QUEUE", SizedQueue.new(1)) Thread.abort_on_exception = true Thread.start do @@ -49,7 +49,7 @@ EOF when 3 # binging in function on TOPLEVEL_BINDING(default) @binding = eval("def irb_binding; binding; end; irb_binding", - TOPLEVEL_BINDING, + TOPLEVEL_BINDING, __FILE__, __LINE__ - 3) end @@ -63,7 +63,7 @@ EOF when Module @binding = eval("IRB.conf[:__MAIN__].module_eval('binding', __FILE__, __LINE__)", @binding, __FILE__, __LINE__) else - begin + begin @binding = eval("IRB.conf[:__MAIN__].instance_eval('binding', __FILE__, __LINE__)", @binding, __FILE__, __LINE__) rescue TypeError IRB.fail CantChangeBinding, @main.inspect @@ -79,7 +79,7 @@ EOF def evaluate(context, statements, file = __FILE__, line = __LINE__) eval(statements, @binding, file, line) end - + # error message manipulator def filter_backtrace(bt) case IRB.conf[:CONTEXT_MODE] diff --git a/lib/irb/ws-for-case-2.rb b/lib/irb/ws-for-case-2.rb index 24c5fd5aa8..d7db90c96b 100644 --- a/lib/irb/ws-for-case-2.rb +++ b/lib/irb/ws-for-case-2.rb @@ -1,12 +1,12 @@ # -# irb/ws-for-case-2.rb - +# irb/ws-for-case-2.rb - # $Release Version: 0.9.5$ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # while true diff --git a/lib/irb/xmp.rb b/lib/irb/xmp.rb index af87b48887..1a58026f45 100644 --- a/lib/irb/xmp.rb +++ b/lib/irb/xmp.rb @@ -6,7 +6,7 @@ # # -- # -# +# # require "irb" diff --git a/lib/mathn.rb b/lib/mathn.rb index 0241f578e9..57eac113c7 100644 --- a/lib/mathn.rb +++ b/lib/mathn.rb @@ -1,12 +1,12 @@ # -# mathn.rb - +# mathn.rb - # $Release Version: 0.5 $ # $Revision: 1.1.1.1.4.1 $ # by Keiju ISHITSUKA(SHL Japan Inc.) # # -- # -# +# # require "cmath.rb" @@ -66,14 +66,14 @@ class Rational elsif self == 1 return Rational(1,1) end - + npd = numerator.prime_division dpd = denominator.prime_division if other < 0 other = -other npd, dpd = dpd, npd end - + for elm in npd elm[1] = elm[1] * other if !elm[1].kind_of?(Integer) and elm[1].denominator != 1 @@ -81,7 +81,7 @@ class Rational end elm[1] = elm[1].to_i end - + for elm in dpd elm[1] = elm[1] * other if !elm[1].kind_of?(Integer) and elm[1].denominator != 1 @@ -89,12 +89,12 @@ class Rational end elm[1] = elm[1].to_i end - + num = Integer.from_prime_division(npd) den = Integer.from_prime_division(dpd) - + Rational(num,den) - + elsif other.kind_of?(Integer) if other > 0 num = numerator ** other @@ -129,7 +129,7 @@ module Math # if !(x.kind_of?(Rational) and y.kind_of?(Rational)) # return a**Rational(1,2) # end - if a.imag >= 0 + if a.imag >= 0 Complex(x, y) else Complex(x, -y) @@ -142,7 +142,7 @@ module Math Complex(0,rsqrt(-a)) end end - + def rsqrt(a) if a.kind_of?(Float) sqrt!(a) @@ -156,7 +156,7 @@ module Math while (src >= max) and (src >>= 32) byte_a.unshift src & 0xffffffff end - + answer = 0 main = 0 side = 0 @@ -166,13 +166,13 @@ module Math if answer != 0 if main * 4 < side * side applo = main.div(side) - else + else applo = ((sqrt!(side * side + 4 * main) - side)/2.0).to_i + 1 end else applo = sqrt!(main).to_i + 1 end - + while (x = (side + applo) * applo) > main applo -= 1 end diff --git a/lib/matrix.rb b/lib/matrix.rb index ec03c730fa..4bc000588b 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -1,6 +1,6 @@ #!/usr/local/bin/ruby #-- -# matrix.rb - +# matrix.rb - # $Release Version: 1.0$ # $Revision: 1.13 $ # Original Version from Smalltalk-80 version @@ -13,9 +13,9 @@ # An implementation of Matrix and Vector classes. # # Author:: Keiju ISHITSUKA -# Documentation:: Gavin Sinclair (sourced from <i>Ruby in a Nutshell</i> (Matsumoto, O'Reilly)) +# Documentation:: Gavin Sinclair (sourced from <i>Ruby in a Nutshell</i> (Matsumoto, O'Reilly)) # -# See classes Matrix and Vector for documentation. +# See classes Matrix and Vector for documentation. # require "e2mmap.rb" @@ -24,7 +24,7 @@ module ExceptionForMatrix # :nodoc: extend Exception2MessageMapper def_e2message(TypeError, "wrong argument type %s (expected %s)") def_e2message(ArgumentError, "Wrong # of arguments(%d for %d)") - + def_exception("ErrDimensionMismatch", "\#{self.name} dimension mismatch") def_exception("ErrNotRegular", "Not Regular Matrix") def_exception("ErrOperationNotDefined", "This operation(%s) can\\'t defined") @@ -59,7 +59,7 @@ end # * <tt> Matrix.row_vector(row) </tt> # * <tt> Matrix.column_vector(column) </tt> # -# To access Matrix elements/columns/rows/submatrices/properties: +# To access Matrix elements/columns/rows/submatrices/properties: # * <tt> [](i, j) </tt> # * <tt> #row_size </tt> # * <tt> #column_size </tt> @@ -104,13 +104,13 @@ end # class Matrix @RCS_ID='-$Id: matrix.rb,v 1.13 2001/12/09 14:22:23 keiju Exp keiju $-' - + # extend Exception2MessageMapper include ExceptionForMatrix - + # instance creations private_class_method :new - + # # Creates a matrix where each argument is a row. # Matrix[ [25, 93], [-1, 66] ] @@ -120,7 +120,7 @@ class Matrix def Matrix.[](*rows) new(:init_rows, rows, false) end - + # # Creates a matrix where +rows+ is an array of arrays, each of which is a row # to the matrix. If the optional argument +copy+ is false, use the given @@ -131,7 +131,7 @@ class Matrix def Matrix.rows(rows, copy = true) new(:init_rows, rows, copy) end - + # # Creates a matrix using +columns+ as an array of column vectors. # Matrix.columns([[25, 93], [-1, 66]]) @@ -147,7 +147,7 @@ class Matrix } Matrix.rows(rows, false) end - + # # Creates a matrix where the diagonal elements are composed of +values+. # Matrix.diagonal(9, 5, -3) @@ -164,7 +164,7 @@ class Matrix } rows(rows, false) end - + # # Creates an +n+ by +n+ diagonal matrix where each diagonal element is # +value+. @@ -185,11 +185,11 @@ class Matrix def Matrix.identity(n) Matrix.scalar(n, 1) end - class << Matrix + class << Matrix alias unit identity alias I identity end - + # # Creates an +n+ by +n+ zero matrix. # Matrix.zero(2) @@ -199,7 +199,7 @@ class Matrix def Matrix.zero(n) Matrix.scalar(n, 0) end - + # # Creates a single-row matrix where the values of that row are as given in # +row+. @@ -216,7 +216,7 @@ class Matrix Matrix.rows([[row]], false) end end - + # # Creates a single-column matrix where the values of that column are as given # in +column+. @@ -243,7 +243,7 @@ class Matrix def initialize(init_method, *argv) self.send(init_method, *argv) end - + def init_rows(rows, copy) if copy @rows = rows.collect{|row| row.dup} @@ -253,7 +253,7 @@ class Matrix self end private :init_rows - + # # Returns element (+i+,+j+) of the matrix. That is: row +i+, column +j+. # @@ -276,7 +276,7 @@ class Matrix def row_size @rows.size end - + # # Returns the number of columns. Note that it is possible to construct a # matrix with uneven columns (e.g. Matrix[ [1,2,3], [4,5] ]), but this is @@ -318,7 +318,7 @@ class Matrix Vector.elements(col, false) end end - + # # Returns a matrix that is the result of iteration of the given block over all # elements of the matrix. @@ -331,7 +331,7 @@ class Matrix Matrix.rows(rows, false) end alias map collect - + # # Returns a section of the matrix. The parameters are either: # * start_row, nrows, start_col, ncols; OR @@ -358,13 +358,13 @@ class Matrix else Matrix.Raise ArgumentError, param.inspect end - + rows = @rows[from_row, size_row].collect{|row| row[from_col, size_col] } Matrix.rows(rows, false) end - + #-- # TESTING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ @@ -375,7 +375,7 @@ class Matrix def regular? square? and rank == column_size end - + # # Returns +true+ is this is a singular (i.e. non-regular) matrix. # @@ -390,7 +390,7 @@ class Matrix def square? column_size == row_size end - + #-- # OBJECT METHODS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ @@ -400,27 +400,27 @@ class Matrix # def ==(other) return false unless Matrix === other - + other.compare_by_row_vectors(@rows) end def eql?(other) return false unless Matrix === other - + other.compare_by_row_vectors(@rows, :eql?) end - + # # Not really intended for general consumption. # def compare_by_row_vectors(rows, comparison = :==) return false unless @rows.size == rows.size - + 0.upto(@rows.size - 1) do |i| return false unless @rows[i].send(comparison, rows[i]) end true end - + # # Returns a clone of the matrix, so that the contents of each do not reference # identical objects. @@ -428,7 +428,7 @@ class Matrix def clone Matrix.rows(@rows) end - + # # Returns a hash-code for the matrix. # @@ -441,11 +441,11 @@ class Matrix end return value end - + #-- # ARITHMETIC -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ - + # # Matrix multiplication. # Matrix[[2,4], [6,8]] * Matrix.identity(2) @@ -467,7 +467,7 @@ class Matrix return r.column(0) when Matrix Matrix.Raise ErrDimensionMismatch if column_size != m.row_size - + rows = (0 .. row_size - 1).collect {|i| (0 .. m.column_size - 1).collect {|j| vij = 0 @@ -483,7 +483,7 @@ class Matrix return x * y end end - + # # Matrix addition. # Matrix.scalar(2,5) + Matrix[[1,0], [-4,7]] @@ -501,9 +501,9 @@ class Matrix x, y = m.coerce(self) return x + y end - + Matrix.Raise ErrDimensionMismatch unless row_size == m.row_size and column_size == m.column_size - + rows = (0 .. row_size - 1).collect {|i| (0 .. column_size - 1).collect {|j| self[i, j] + m[i, j] @@ -529,9 +529,9 @@ class Matrix x, y = m.coerce(self) return x - y end - + Matrix.Raise ErrDimensionMismatch unless row_size == m.row_size and column_size == m.column_size - + rows = (0 .. row_size - 1).collect {|i| (0 .. column_size - 1).collect {|j| self[i, j] - m[i, j] @@ -539,7 +539,7 @@ class Matrix } Matrix.rows(rows, false) end - + # # Matrix division (multiplication by the inverse). # Matrix[[7,6], [3,9]] / Matrix[[2,9], [3,1]] @@ -581,7 +581,7 @@ class Matrix def inverse_from(src) size = row_size - 1 a = src.to_a - + for k in 0..size i = k akk = a[k][k].abs @@ -598,12 +598,12 @@ class Matrix @rows[i], @rows[k] = @rows[k], @rows[i] end akk = a[k][k] - + for i in 0 .. size next if i == k q = a[i][k].quo(akk) a[i][k] = 0 - + for j in (k + 1).. size a[i][j] -= a[k][j] * q end @@ -611,7 +611,7 @@ class Matrix @rows[i][j] -= @rows[k][j] * q end end - + for j in (k + 1).. size a[k][j] = a[k][j].quo(akk) end @@ -622,7 +622,7 @@ class Matrix self end #alias reciprocal inverse - + # # Matrix exponentiation. Defined for integer powers only. Equivalent to # multiplying the matrix by itself N times. @@ -656,11 +656,11 @@ class Matrix Matrix.Raise ErrOperationNotDefined, "**" end end - + #-- # MATRIX FUNCTIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ - + # # Returns the determinant of the matrix. If the matrix is not square, the # result is 0. This method's algorism is Gaussian elimination method @@ -673,10 +673,10 @@ class Matrix # def determinant return 0 unless square? - + size = row_size - 1 a = to_a - + det = 1 k = 0 loop do @@ -706,20 +706,20 @@ class Matrix # # Returns the determinant of the matrix. If the matrix is not square, the - # result is 0. This method's algorism is Gaussian elimination method. + # result is 0. This method's algorism is Gaussian elimination method. # This method uses Euclidean algorism. If all elements are integer, # really exact value. But, if an element is a float, can't return - # exact value. + # exact value. # # Matrix[[7,6], [3,9]].determinant # => 63 # def determinant_e return 0 unless square? - + size = row_size - 1 a = to_a - + det = 1 k = 0 loop do @@ -821,7 +821,7 @@ class Matrix # # Returns the rank of the matrix. This method uses Euclidean # algorism. If all elements are integer, really exact value. But, if - # an element is a float, can't return exact value. + # an element is a float, can't return exact value. # # Matrix[[7,6], [3,9]].rank # => 2 @@ -866,7 +866,7 @@ class Matrix tr end alias tr trace - + # # Returns the transpose of the matrix. # Matrix[[1,2], [3,4], [5,6]] @@ -881,11 +881,11 @@ class Matrix Matrix.columns(@rows) end alias t transpose - + #-- # CONVERTING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ - + # # FIXME: describe #coerce. # @@ -907,7 +907,7 @@ class Matrix } rows end - + # # Returns an array of the column vectors of the matrix. See Vector. # @@ -917,30 +917,30 @@ class Matrix } columns end - + # # Returns an array of arrays that describe the rows of the matrix. # def to_a @rows.collect{|row| row.collect{|e| e}} end - + def elements_to_f collect{|e| e.to_f} end - + def elements_to_i collect{|e| e.to_i} end - + def elements_to_r collect{|e| e.to_r} end - + #-- # PRINTING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ - + # # Overrides Object#to_s # @@ -949,23 +949,23 @@ class Matrix "[" + row.collect{|e| e.to_s}.join(", ") + "]" }.join(", ")+"]" end - + # # Overrides Object#inspect # def inspect "Matrix"+@rows.inspect end - + # Private CLASS - + class Scalar < Numeric # :nodoc: include ExceptionForMatrix - + def initialize(value) @value = value end - + # ARITHMETIC def +(other) case other @@ -980,7 +980,7 @@ class Matrix x + y end end - + def -(other) case other when Numeric @@ -994,7 +994,7 @@ class Matrix x - y end end - + def *(other) case other when Numeric @@ -1006,7 +1006,7 @@ class Matrix x * y end end - + def / (other) case other when Numeric @@ -1020,7 +1020,7 @@ class Matrix x.quo(y) end end - + def ** (other) case other when Numeric @@ -1079,9 +1079,9 @@ end # class Vector include ExceptionForMatrix - + #INSTANCE CREATION - + private_class_method :new # @@ -1091,7 +1091,7 @@ class Vector def Vector.[](*array) new(:init_elements, array, copy = false) end - + # # Creates a vector from an Array. The optional second argument specifies # whether the array itself or a copy is used internally. @@ -1099,14 +1099,14 @@ class Vector def Vector.elements(array, copy = true) new(:init_elements, array, copy) end - + # # For internal use. # def initialize(method, array, copy) self.send(method, array, copy) end - + # # For internal use. # @@ -1117,9 +1117,9 @@ class Vector @elements = array end end - + # ACCESSING - + # # Returns element number +i+ (starting at zero) of the vector. # @@ -1135,14 +1135,14 @@ class Vector alias set_element []= alias set_component []= private :[]=, :set_element, :set_component - + # # Returns the number of elements in the vector. # def size @elements.size end - + #-- # ENUMERATIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ @@ -1156,7 +1156,7 @@ class Vector yield @elements[i], v[i] end end - + # # Collects (as in Enumerable#collect) over the elements of this vector and +v+ # in conjunction. @@ -1177,40 +1177,40 @@ class Vector # def ==(other) return false unless Vector === other - + other.compare_by(@elements) end def eql?(other) return false unless Vector === other - + other.compare_by(@elements, :eql?) end - + # # For internal use. # def compare_by(elements, comparison = :==) @elements.send(comparison, elements) end - + # # Return a copy of the vector. # def clone Vector.elements(@elements) end - + # # Return a hash-code for the vector. # def hash @elements.hash end - + #-- # ARITHMETIC -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ - + # # Multiplies the vector by +x+, where +x+ is a number or another vector. # @@ -1264,25 +1264,25 @@ class Vector s - x end end - + #-- # VECTOR FUNCTIONS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ - + # # Returns the inner product of this vector with the other. # Vector[4,7].inner_product Vector[10,1] => 47 # def inner_product(v) Vector.Raise ErrDimensionMismatch if size != v.size - + p = 0 each2(v) {|v1, v2| p += v1 * v2 } p end - + # # Like Array#collect. # @@ -1293,7 +1293,7 @@ class Vector Vector.elements(els, false) end alias map collect - + # # Like Vector#collect2, but returns a Vector instead of an Array. # @@ -1303,7 +1303,7 @@ class Vector } Vector.elements(els, false) end - + # # Returns the modulus (Pythagorean distance) of the vector. # Vector[5,8,2].r => 9.643650761 @@ -1315,7 +1315,7 @@ class Vector end return Math.sqrt(v) end - + #-- # CONVERTING #++ @@ -1326,26 +1326,26 @@ class Vector def covector Matrix.row_vector(self) end - + # # Returns the elements of the vector in an array. # def to_a @elements.dup end - + def elements_to_f collect{|e| e.to_f} end - + def elements_to_i collect{|e| e.to_i} end - + def elements_to_r collect{|e| e.to_r} end - + # # FIXME: describe Vector#coerce. # @@ -1357,18 +1357,18 @@ class Vector raise TypeError, "#{self.class} can't be coerced into #{other.class}" end end - + #-- # PRINTING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #++ - + # # Overrides Object#to_s # def to_s "Vector[" + @elements.join(", ") + "]" end - + # # Overrides Object#inspect # diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 1afce2ae65..4d0a0dfa93 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -264,7 +264,7 @@ module Logging @log = nil end end - + def self::postpone tmplog = "mkmftmp#{@postpone += 1}.log" open do @@ -858,7 +858,7 @@ end # HAVE_STRUCT_FOO_BAR preprocessor macro would be passed to the compiler. # # HAVE_ST_BAR is also defined for backward compatibility. -# +# def have_struct_member(type, member, headers = nil, &b) checking_for checking_message("#{type}.#{member}", headers) do if try_compile(<<"SRC", &b) @@ -1167,7 +1167,7 @@ end # 'extconf.h'. # # For example: -# +# # # extconf.rb # require 'mkmf' # have_func('realpath') @@ -1262,7 +1262,7 @@ def pkg_config(pkg) if pkgconfig = with_config("#{pkg}-config") and find_executable0(pkgconfig) # iff package specific config command is given get = proc {|opt| `#{pkgconfig} --#{opt}`.chomp} - elsif ($PKGCONFIG ||= + elsif ($PKGCONFIG ||= (pkgconfig = with_config("pkg-config", ("pkg-config" unless CROSS_COMPILING))) && find_executable0(pkgconfig) && pkgconfig) and system("#{$PKGCONFIG} --exists #{pkg}") diff --git a/lib/monitor.rb b/lib/monitor.rb index 31234819b8..00d85fae52 100644 --- a/lib/monitor.rb +++ b/lib/monitor.rb @@ -12,11 +12,11 @@ You can freely distribute/modify this library. This is a simple example. require 'monitor.rb' - + buf = [] buf.extend(MonitorMixin) empty_cond = buf.new_cond - + # consumer Thread.start do loop do @@ -26,7 +26,7 @@ This is a simple example. end end end - + # producer while line = ARGF.gets buf.synchronize do @@ -49,11 +49,11 @@ require 'thread' # +include+. For example: # # require 'monitor' -# +# # buf = [] # buf.extend(MonitorMixin) # empty_cond = buf.new_cond -# +# # # consumer # Thread.start do # loop do @@ -63,7 +63,7 @@ require 'thread' # end # end # end -# +# # # producer # while line = ARGF.gets # buf.synchronize do @@ -71,7 +71,7 @@ require 'thread' # empty_cond.signal # end # end -# +# # The consumer thread waits for the producer thread to push a line # to buf while buf.empty?, and the producer thread (main thread) # reads a line from ARGF and push it to buf, then call @@ -86,7 +86,7 @@ module MonitorMixin # class ConditionVariable class Timeout < Exception; end - + def wait(timeout = nil) if timeout raise NotImplementedError, "timeout is not implemented yet" @@ -100,33 +100,33 @@ module MonitorMixin @monitor.send(:mon_enter_for_cond, count) end end - + def wait_while while yield wait end end - + def wait_until until yield wait end end - + def signal @monitor.send(:mon_check_owner) @cond.signal end - + def broadcast @monitor.send(:mon_check_owner) @cond.broadcast end - + def count_waiters raise NotImplementedError end - + private def initialize(monitor) @@ -134,12 +134,12 @@ module MonitorMixin @cond = ::ConditionVariable.new end end - + def self.extend_object(obj) super(obj) obj.send(:mon_initialize) end - + # # Attempts to enter exclusive section. Returns +false+ if lock fails. # @@ -166,7 +166,7 @@ module MonitorMixin end @mon_count += 1 end - + # # Leaves exclusive section. # @@ -193,7 +193,7 @@ module MonitorMixin end end alias synchronize mon_synchronize - + # # FIXME: This isn't documented in Nutshell. # diff --git a/lib/mutex_m.rb b/lib/mutex_m.rb index f46f866fa5..21d828523e 100644 --- a/lib/mutex_m.rb +++ b/lib/mutex_m.rb @@ -1,5 +1,5 @@ # -# mutex_m.rb - +# mutex_m.rb - # $Release Version: 3.0$ # $Revision: 1.7 $ # Original from mutex.rb @@ -34,13 +34,13 @@ module Mutex_m alias try_lock mu_try_lock alias synchronize mu_synchronize } - end + end def Mutex_m.append_features(cl) super define_aliases(cl) unless cl.instance_of?(Module) end - + def Mutex_m.extend_object(obj) super obj.mu_extended @@ -56,30 +56,30 @@ module Mutex_m end mu_initialize end - - # locking + + # locking def mu_synchronize(&block) @_mutex.synchronize(&block) end - + def mu_locked? @_mutex.locked? end - + def mu_try_lock @_mutex.try_lock end - + def mu_lock @_mutex.lock end - + def mu_unlock @_mutex.unlock end - + private - + def mu_initialize @_mutex = Mutex.new end diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 06cc3eafa2..40227b69d8 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -1,11 +1,11 @@ -# +# # = net/ftp.rb - FTP Client Library -# +# # Written by Shugo Maeda <shugo@ruby-lang.org>. # # Documentation by Gavin Sinclair, sourced from "Programming Ruby" (Hunt/Thomas) # and "Ruby In a Nutshell" (Matsumoto), used with permission. -# +# # This library is distributed under the terms of the Ruby license. # You can freely distribute/modify this library. # @@ -22,8 +22,8 @@ module Net # :stopdoc: class FTPError < StandardError; end class FTPReplyError < FTPError; end - class FTPTempError < FTPError; end - class FTPPermError < FTPError; end + class FTPTempError < FTPError; end + class FTPPermError < FTPError; end class FTPProtoError < FTPError; end # :startdoc: @@ -34,11 +34,11 @@ module Net # advantage of Ruby's style and strengths. # # == Example - # + # # require 'net/ftp' # # === Example 1 - # + # # ftp = Net::FTP.new('ftp.netlab.co.jp') # ftp.login # files = ftp.chdir('pub/lang/ruby/contrib') @@ -71,13 +71,13 @@ module Net # class FTP include MonitorMixin - + # :stopdoc: FTP_PORT = 21 CRLF = "\r\n" DEFAULT_BLOCKSIZE = 4096 # :startdoc: - + # When +true+, transfers are performed in binary mode. Default: +true+. attr_reader :binary @@ -101,7 +101,7 @@ module Net # The server's last response. attr_reader :last_response - + # # A synonym for <tt>FTP.new</tt>, but with a mandatory host parameter. # @@ -120,7 +120,7 @@ module Net new(host, user, passwd, acct) end end - + # # Creates and returns a new +FTP+ object. If a +host+ is given, a connection # is made. Additionally, if the +user+ is given, the given user name, @@ -178,7 +178,7 @@ module Net end end private :open_socket - + # # Establishes an FTP connection to host, optionally overriding the default # port. If the environment variable +SOCKS_SERVER+ is set, sets up the @@ -215,7 +215,7 @@ module Net end end private :sanitize - + def putline(line) if @debug_mode print "put: ", sanitize(line), "\n" @@ -224,7 +224,7 @@ module Net @sock.write(line) end private :putline - + def getline line = @sock.readline # if get EOF, raise EOFError line.sub!(/(\r\n|\n|\r)\z/n, "") @@ -234,7 +234,7 @@ module Net return line end private :getline - + def getmultiline line = getline buff = line @@ -248,7 +248,7 @@ module Net return buff << "\n" end private :getmultiline - + def getresp @last_response = getmultiline @last_response_code = @last_response[0, 3] @@ -264,7 +264,7 @@ module Net end end private :getresp - + def voidresp resp = getresp if resp[0] != ?2 @@ -272,7 +272,7 @@ module Net end end private :voidresp - + # # Sends a command and returns the response. # @@ -282,7 +282,7 @@ module Net return getresp end end - + # # Sends a command and expect a response beginning with '2'. # @@ -292,7 +292,7 @@ module Net voidresp end end - + def sendport(host, port) af = (@sock.peeraddr)[0] if af == "AF_INET" @@ -305,7 +305,7 @@ module Net voidcmd(cmd) end private :sendport - + def makeport sock = TCPServer.open(@sock.addr[3], 0) port = sock.addr[1] @@ -314,7 +314,7 @@ module Net return sock end private :makeport - + def makepasv if @sock.peeraddr[0] == "AF_INET" host, port = parse227(sendcmd("PASV")) @@ -325,13 +325,13 @@ module Net return host, port end private :makepasv - + def transfercmd(cmd, rest_offset = nil) if @passive host, port = makepasv conn = open_socket(host, port) if @resume and rest_offset - resp = sendcmd("REST " + rest_offset.to_s) + resp = sendcmd("REST " + rest_offset.to_s) if resp[0] != ?3 raise FTPReplyError, resp end @@ -345,7 +345,7 @@ module Net else sock = makeport if @resume and rest_offset - resp = sendcmd("REST " + rest_offset.to_s) + resp = sendcmd("REST " + rest_offset.to_s) if resp[0] != ?3 raise FTPReplyError, resp end @@ -362,7 +362,7 @@ module Net return conn end private :transfercmd - + def getaddress thishost = Socket.gethostname if not thishost.index(".") @@ -378,7 +378,7 @@ module Net return realuser + "@" + thishost end private :getaddress - + # # Logs in to the remote host. The session must have been previously # connected. If +user+ is the string "anonymous" and the +password+ is @@ -391,7 +391,7 @@ module Net if user == "anonymous" and passwd == nil passwd = getaddress end - + resp = "" synchronize do resp = sendcmd('USER ' + user) @@ -410,7 +410,7 @@ module Net @welcome = resp self.binary = true end - + # # Puts the connection into binary (image) mode, issues the given command, # and fetches the data returned, passing it to the associated block in @@ -431,7 +431,7 @@ module Net end end end - + # # Puts the connection into ASCII (text) mode, issues the given command, and # passes the resulting data, one line at a time, to the associated block. If @@ -457,7 +457,7 @@ module Net end end end - + # # Puts the connection into binary (image) mode, issues the given server-side # command (such as "STOR myfile"), and sends the contents of the file named @@ -489,7 +489,7 @@ module Net getresp raise end - + # # Puts the connection into ASCII (text) mode, issues the given server-side # command (such as "STOR myfile"), and sends the contents of the file @@ -554,7 +554,7 @@ module Net f.close if localfile end end - + # # Retrieves +remotefile+ in ASCII (text) mode, storing the result in # +localfile+. @@ -593,7 +593,7 @@ module Net gettextfile(remotefile, localfile, &block) end end - + # # Transfers +localfile+ to the server in binary mode, storing the result in # +remotefile+. If a block is supplied, calls it, passing in the transmitted @@ -618,7 +618,7 @@ module Net f.close end end - + # # Transfers +localfile+ to the server in ASCII (text) mode, storing the result # in +remotefile+. If callback or an associated block is supplied, calls it, @@ -653,7 +653,7 @@ module Net cmd = "ACCT " + account voidcmd(cmd) end - + # # Returns an array of filenames in the remote directory. # @@ -668,7 +668,7 @@ module Net end return files end - + # # Returns an array of file information in the directory (the output is like # `ls -l`). If a block is given, it iterates through the listing. @@ -690,7 +690,7 @@ module Net end alias ls list alias dir list - + # # Renames a file on the server. # @@ -701,7 +701,7 @@ module Net end voidcmd("RNTO " + toname) end - + # # Deletes a file on the server. # @@ -715,7 +715,7 @@ module Net raise FTPReplyError, resp end end - + # # Changes the (remote) directory. # @@ -733,22 +733,22 @@ module Net cmd = "CWD " + dirname voidcmd(cmd) end - + # # Returns the size of the given (remote) filename. # def size(filename) with_binary(true) do resp = sendcmd("SIZE " + filename) - if resp[0, 3] != "213" + if resp[0, 3] != "213" raise FTPReplyError, resp end return resp[3..-1].strip.to_i end end - + MDTM_REGEXP = /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/ # :nodoc: - + # # Returns the last modification time of the (remote) file. If +local+ is # +true+, it is returned as a local time, otherwise it's a UTC time. @@ -758,7 +758,7 @@ module Net ary = str.scan(MDTM_REGEXP)[0].collect {|i| i.to_i} return local ? Time.local(*ary) : Time.gm(*ary) end - + # # Creates a remote directory. # @@ -766,14 +766,14 @@ module Net resp = sendcmd("MKD " + dirname) return parse257(resp) end - + # # Removes a remote directory. # def rmdir(dirname) voidcmd("RMD " + dirname) end - + # # Returns the current remote directory. # @@ -782,7 +782,7 @@ module Net return parse257(resp) end alias getdir pwd - + # # Returns system information. # @@ -793,7 +793,7 @@ module Net end return resp[4 .. -1] end - + # # Aborts the previous command (ABOR command). # @@ -807,7 +807,7 @@ module Net end return resp end - + # # Returns the status (STAT command). # @@ -817,7 +817,7 @@ module Net @sock.send(line, Socket::MSG_OOB) return getresp end - + # # Issues the MDTM command. TODO: more info. # @@ -827,7 +827,7 @@ module Net return resp[3 .. -1].strip end end - + # # Issues the HELP command. # @@ -838,7 +838,7 @@ module Net end sendcmd(cmd) end - + # # Exits the FTP session. # @@ -860,7 +860,7 @@ module Net cmd = "SITE " + arg voidcmd(cmd) end - + # # Closes the connection. Further operations are impossible until you open # a new connection with #connect. @@ -868,14 +868,14 @@ module Net def close @sock.close if @sock and not @sock.closed? end - + # # Returns +true+ iff the connection is closed. # def closed? @sock == nil or @sock.closed? end - + def parse227(resp) if resp[0, 3] != "227" raise FTPReplyError, resp @@ -894,7 +894,7 @@ module Net return host, port end private :parse227 - + def parse228(resp) if resp[0, 3] != "228" raise FTPReplyError, resp @@ -922,11 +922,11 @@ module Net end host = v6[0, 8].join(":") port = (numbers[19].to_i << 8) + numbers[20].to_i - end + end return host, port end private :parse228 - + def parse229(resp) if resp[0, 3] != "229" raise FTPReplyError, resp @@ -945,7 +945,7 @@ module Net return host, port end private :parse229 - + def parse257(resp) if resp[0, 3] != "257" raise FTPReplyError, resp diff --git a/lib/net/http.rb b/lib/net/http.rb index e3716b1bde..d95615f5c8 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -4,26 +4,26 @@ # Copyright (c) 1999-2007 Yukihiro Matsumoto # Copyright (c) 1999-2007 Minero Aoki # Copyright (c) 2001 GOTOU Yuuzou -# +# # Written and maintained by Minero Aoki <aamine@loveruby.net>. # HTTPS support added by GOTOU Yuuzou <gotoyuzo@notwork.org>. # # This file is derived from "http-access.rb". # # Documented by Minero Aoki; converted to RDoc by William Webber. -# +# # This program is free software. You can re-distribute and/or # modify this program under the same terms of ruby itself --- # Ruby Distribution License or GNU General Public License. # -# See Net::HTTP for an overview and examples. -# +# See Net::HTTP for an overview and examples. +# # NOTE: You can find Japanese version of this document here: # http://www.ruby-lang.org/ja/man/html/net_http.html -# +# #-- # $Id$ -#++ +#++ require 'net/protocol' require 'uri' @@ -36,29 +36,29 @@ module Net #:nodoc: # :startdoc: # == What Is This Library? - # + # # This library provides your program functions to access WWW # documents via HTTP, Hyper Text Transfer Protocol version 1.1. # For details of HTTP, refer to [RFC2616] # (http://www.ietf.org/rfc/rfc2616.txt). - # + # # == Examples - # + # # === Getting Document From WWW Server - # + # # Example #1: Simple GET+print - # + # # require 'net/http' # Net::HTTP.get_print 'www.example.com', '/index.html' - # + # # Example #2: Simple GET+print by URL - # + # # require 'net/http' # require 'uri' # Net::HTTP.get_print URI.parse('http://www.example.com/index.html') - # + # # Example #3: More generic GET+print - # + # # require 'net/http' # require 'uri' # @@ -69,7 +69,7 @@ module Net #:nodoc: # puts res.body # # Example #4: More generic GET+print - # + # # require 'net/http' # # url = URI.parse('http://www.example.com/index.html') @@ -78,9 +78,9 @@ module Net #:nodoc: # http.request(req) # } # puts res.body - # + # # === Posting Form Data - # + # # require 'net/http' # require 'uri' # @@ -112,15 +112,15 @@ module Net #:nodoc: # res = Net::HTTP.post_form(URI.parse('http://www.example.com/search.cgi'), # {'q' => ['ruby', 'perl'], 'max' => '50'}) # puts res.body - # + # # === Accessing via Proxy - # + # # Net::HTTP.Proxy creates http proxy class. It has same # methods of Net::HTTP but its instances always connect to # proxy, instead of given host. - # + # # require 'net/http' - # + # # proxy_addr = 'your.proxy.host' # proxy_port = 8080 # : @@ -128,20 +128,20 @@ module Net #:nodoc: # # always connect to your.proxy.addr:8080 # : # } - # + # # Since Net::HTTP.Proxy returns Net::HTTP itself when proxy_addr is nil, # there's no need to change code if there's proxy or not. - # + # # There are two additional parameters in Net::HTTP.Proxy which allow to # specify proxy user name and password: - # + # # Net::HTTP::Proxy(proxy_addr, proxy_port, proxy_user = nil, proxy_pass = nil) - # + # # You may use them to work with authorization-enabled proxies: - # + # # require 'net/http' # require 'uri' - # + # # proxy_host = 'your.proxy.host' # proxy_port = 8080 # uri = URI.parse(ENV['http_proxy']) @@ -154,16 +154,16 @@ module Net #:nodoc: # # Note that net/http never rely on HTTP_PROXY environment variable. # If you want to use proxy, set it explicitly. - # + # # === Following Redirection - # + # # require 'net/http' # require 'uri' - # + # # def fetch(uri_str, limit = 10) - # # You should choose better exception. + # # You should choose better exception. # raise ArgumentError, 'HTTP redirect too deep' if limit == 0 - # + # # response = Net::HTTP.get_response(URI.parse(uri_str)) # case response # when Net::HTTPSuccess then response @@ -172,25 +172,25 @@ module Net #:nodoc: # response.error! # end # end - # + # # print fetch('http://www.ruby-lang.org') - # + # # Net::HTTPSuccess and Net::HTTPRedirection is a HTTPResponse class. # All HTTPResponse objects belong to its own response class which # indicate HTTP result status. For details of response classes, # see section "HTTP Response Classes". - # + # # === Basic Authentication - # + # # require 'net/http' - # + # # Net::HTTP.start('www.example.com') {|http| # req = Net::HTTP::Get.new('/secret-page.html') # req.basic_auth 'account', 'password' # response = http.request(req) # print response.body # } - # + # # === HTTP Request Classes # # Here is HTTP request class hierarchy. @@ -263,22 +263,22 @@ module Net #:nodoc: # HTTPServiceUnavailable # 503 # HTTPGatewayTimeOut # 504 # HTTPVersionNotSupported # 505 - # + # # == Switching Net::HTTP versions - # + # # You can use net/http.rb 1.1 features (bundled with Ruby 1.6) # by calling HTTP.version_1_1. Calling Net::HTTP.version_1_2 # allows you to use 1.2 features again. - # + # # # example # Net::HTTP.start {|http1| ...(http1 has 1.2 features)... } - # + # # Net::HTTP.version_1_1 # Net::HTTP.start {|http2| ...(http2 has 1.1 features)... } - # + # # Net::HTTP.version_1_2 # Net::HTTP.start {|http3| ...(http3 has 1.2 features)... } - # + # # This function is NOT thread-safe. # class HTTP < Protocol @@ -338,7 +338,7 @@ module Net #:nodoc: # # Get body from target and output it to +$stdout+. The # target can either be specified as (+uri+), or as - # (+host+, +path+, +port+ = 80); so: + # (+host+, +path+, +port+ = 80); so: # # Net::HTTP.get_print URI.parse('http://www.example.com/index.html') # @@ -358,7 +358,7 @@ module Net #:nodoc: # Send a GET request to the target and return the response # as a string. The target can either be specified as # (+uri+), or as (+host+, +path+, +port+ = 80); so: - # + # # print Net::HTTP.get(URI.parse('http://www.example.com/index.html')) # # or: @@ -372,7 +372,7 @@ module Net #:nodoc: # Send a GET request to the target and return the response # as a Net::HTTPResponse object. The target can either be specified as # (+uri+), or as (+host+, +path+, +port+ = 80); so: - # + # # res = Net::HTTP.get_response(URI.parse('http://www.example.com/index.html')) # print res.body # @@ -442,9 +442,9 @@ module Net #:nodoc: BufferedIO end - # creates a new Net::HTTP object and opens its TCP connection and - # HTTP session. If the optional block is given, the newly - # created Net::HTTP object is passed to it and closed when the + # creates a new Net::HTTP object and opens its TCP connection and + # HTTP session. If the optional block is given, the newly + # created Net::HTTP object is passed to it and closed when the # block finishes. In this case, the return value of this method # is the return value of the block. If no block is given, the # return value of this method is the newly created Net::HTTP object @@ -548,7 +548,7 @@ module Net #:nodoc: end # Opens TCP connection and HTTP session. - # + # # When this method is called with block, gives a HTTP object # to the block and closes the TCP connection / HTTP session # after the block executed. @@ -655,9 +655,9 @@ module Net #:nodoc: # Arguments are address/port of proxy host and username/password # if authorization on proxy server is required. # You can replace the HTTP class with created proxy class. - # + # # If ADDRESS is nil, this method returns self (Net::HTTP). - # + # # # Example # proxy_class = Net::HTTP::Proxy('proxy.example.com', 8080) # : @@ -665,7 +665,7 @@ module Net #:nodoc: # # connecting proxy.foo.org:8080 # : # } - # + # def HTTP.Proxy(p_addr, p_port = nil, p_user = nil, p_pass = nil) return self unless p_addr delta = ProxyDelta @@ -765,14 +765,14 @@ module Net #:nodoc: # and it defaults to an empty hash. # If +initheader+ doesn't have the key 'accept-encoding', then # a value of "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" is used, - # so that gzip compression is used in preference to deflate - # compression, which is used in preference to no compression. + # so that gzip compression is used in preference to deflate + # compression, which is used in preference to no compression. # Ruby doesn't have libraries to support the compress (Lempel-Ziv) # compression, so that is not supported. The intent of this is # to reduce bandwidth by default. If this routine sets up # compression, then it does the decompression also, removing # the header as well to prevent confusion. Otherwise - # it leaves the body as it found it. + # it leaves the body as it found it. # # In version 1.1 (ruby 1.6), this method returns a pair of objects, # a Net::HTTPResponse object and the entity body string. @@ -787,7 +787,7 @@ module Net #:nodoc: # +dest+ argument is obsolete. # It still works but you must not use it. # - # In version 1.1, this method might raise an exception for + # In version 1.1, this method might raise an exception for # 3xx (redirect). In this case you can get a HTTPResponse object # by "anException.response". # @@ -798,7 +798,7 @@ module Net #:nodoc: # # # version 1.2 (bundled with Ruby 1.8 or later) # response = http.get('/index.html') - # + # # # using block # File.open('result.txt', 'w') {|f| # http.get('/~foo/') do |str| @@ -827,7 +827,7 @@ module Net #:nodoc: r.delete("content-encoding") when "identity" ; # nothing needed - else + else ; # Don't do anything dramatic, unless we need to later end else @@ -845,21 +845,21 @@ module Net #:nodoc: # Gets only the header from +path+ on the connected-to host. # +header+ is a Hash like { 'Accept' => '*/*', ... }. - # + # # This method returns a Net::HTTPResponse object. - # - # In version 1.1, this method might raise an exception for + # + # In version 1.1, this method might raise an exception for # 3xx (redirect). On the case you can get a HTTPResponse object # by "anException.response". # In version 1.2, this method never raises an exception. - # + # # response = nil # Net::HTTP.start('some.www.server', 80) {|http| # response = http.head('/index.html') # } # p response['content-type'] # - def head(path, initheader = nil) + def head(path, initheader = nil) res = request(Head.new(path, initheader)) res.value unless @newimpl res @@ -867,11 +867,11 @@ module Net #:nodoc: # Posts +data+ (must be a String) to +path+. +header+ must be a Hash # like { 'Accept' => '*/*', ... }. - # + # # In version 1.1 (ruby 1.6), this method returns a pair of objects, a # Net::HTTPResponse object and an entity body string. # In version 1.2 (ruby 1.8), this method returns a Net::HTTPResponse object. - # + # # If called with a block, yields each fragment of the # entity body in turn as a string as it are read from # the socket. Note that in this case, the returned response @@ -879,18 +879,18 @@ module Net #:nodoc: # # +dest+ argument is obsolete. # It still works but you must not use it. - # - # In version 1.1, this method might raise an exception for + # + # In version 1.1, this method might raise an exception for # 3xx (redirect). In this case you can get an HTTPResponse object # by "anException.response". # In version 1.2, this method never raises exception. - # + # # # version 1.1 # response, body = http.post('/cgi-bin/search.rb', 'query=foo') - # + # # # version 1.2 # response = http.post('/cgi-bin/search.rb', 'query=foo') - # + # # # using block # File.open('result.txt', 'w') {|f| # http.post('/cgi-bin/search.rb', 'query=foo') do |str| @@ -983,21 +983,21 @@ module Net #:nodoc: # Sends a GET request to the +path+ and gets a response, # as an HTTPResponse object. - # + # # When called with a block, yields an HTTPResponse object. # The body of this response will not have been read yet; # the caller can process it using HTTPResponse#read_body, # if desired. # # Returns the response. - # + # # This method never raises Net::* exceptions. - # + # # response = http.request_get('/index.html') # # The entity body is already read here. # p response['content-type'] # puts response.body - # + # # # using block # http.request_get('/index.html') {|response| # p response['content-type'] @@ -1014,9 +1014,9 @@ module Net #:nodoc: # as an HTTPResponse object. # # Returns the response. - # + # # This method never raises Net::* exceptions. - # + # # response = http.request_head('/index.html') # p response['content-type'] # @@ -1026,21 +1026,21 @@ module Net #:nodoc: # Sends a POST request to the +path+ and gets a response, # as an HTTPResponse object. - # + # # When called with a block, yields an HTTPResponse object. # The body of this response will not have been read yet; # the caller can process it using HTTPResponse#read_body, # if desired. # # Returns the response. - # + # # This method never raises Net::* exceptions. - # + # # # example # response = http.request_post('/cgi-bin/nice.rb', 'datadatadata...') # p response.status # puts response.body # body is already read - # + # # # using block # http.request_post('/cgi-bin/nice.rb', 'datadatadata...') {|response| # p response.status @@ -1068,7 +1068,7 @@ module Net #:nodoc: # This method also sends DATA string if DATA is given. # # Returns a HTTPResponse object. - # + # # This method never raises Net::* exceptions. # # response = http.send_request('GET', '/index.html') @@ -1082,14 +1082,14 @@ module Net #:nodoc: # Sends an HTTPRequest object REQUEST to the HTTP server. # This method also sends DATA string if REQUEST is a post/put request. # Giving DATA for get/head request causes ArgumentError. - # + # # When called with a block, yields an HTTPResponse object. # The body of this response will not have been read yet; # the caller can process it using HTTPResponse#read_body, # if desired. # # Returns a HTTPResponse object. - # + # # This method never raises Net::* exceptions. # def request(req, body = nil, &block) # :yield: +response+ @@ -1421,7 +1421,7 @@ module Net #:nodoc: raise HTTPHeaderSyntaxError, 'wrong Content-Length format' len.to_i end - + def content_length=(len) unless len @header.delete 'content-length' @@ -1431,7 +1431,7 @@ module Net #:nodoc: end # Returns "true" if the "transfer-encoding" header is present and - # set to "chunked". This is an HTTP/1.1 feature, allowing the + # set to "chunked". This is an HTTP/1.1 feature, allowing the # the content to be sent in "chunks" without at the outset # stating the entire content length. def chunked? @@ -1472,7 +1472,7 @@ module Net #:nodoc: return nil unless @header['content-type'] self['Content-Type'].split(';').first.to_s.split('/')[0].to_s.strip end - + # Returns a content type string such as "html". # This method returns nil if Content-Type: header field does not exist # or sub-type is not given (e.g. "Content-Type: text"). @@ -1515,7 +1515,7 @@ module Net #:nodoc: # http.form_data = {"q" => "ruby", "lang" => "en"} # http.form_data = {"q" => ["ruby", "perl"], "lang" => "en"} # http.set_form_data({"q" => "ruby", "lang" => "en"}, ';') - # + # def set_form_data(params, sep = '&') self.body = params.map {|k, v| encode_kvpair(k, v) }.flatten.join(sep) self.content_type = 'application/x-www-form-urlencoded' @@ -1691,14 +1691,14 @@ module Net #:nodoc: buf << "\r\n" sock.write buf end - + end - # + # # HTTP request class. This class wraps request header and entity path. # You *must* use its subclass, Net::HTTP::Get, Post, Head. - # + # class HTTPRequest < HTTPGenericRequest # Creates HTTP request object. @@ -1838,17 +1838,17 @@ module Net #:nodoc: # HTTP response class. This class wraps response header and entity. # Mixes in the HTTPHeader module, which provides access to response # header values both via hash-like methods and individual readers. - # Note that each possible HTTP response code defines its own + # Note that each possible HTTP response code defines its own # HTTPResponse subclass. These are listed below. # All classes are # defined under the Net module. Indentation indicates inheritance. - # + # # xxx HTTPResponse - # + # # 1xx HTTPInformation - # 100 HTTPContinue + # 100 HTTPContinue # 101 HTTPSwitchProtocol - # + # # 2xx HTTPSuccess # 200 HTTPOK # 201 HTTPCreated @@ -1857,7 +1857,7 @@ module Net #:nodoc: # 204 HTTPNoContent # 205 HTTPResetContent # 206 HTTPPartialContent - # + # # 3xx HTTPRedirection # 300 HTTPMultipleChoice # 301 HTTPMovedPermanently @@ -1866,7 +1866,7 @@ module Net #:nodoc: # 304 HTTPNotModified # 305 HTTPUseProxy # 307 HTTPTemporaryRedirect - # + # # 4xx HTTPClientError # 400 HTTPBadRequest # 401 HTTPUnauthorized @@ -1886,7 +1886,7 @@ module Net #:nodoc: # 415 HTTPUnsupportedMediaType # 416 HTTPRequestedRangeNotSatisfiable # 417 HTTPExpectationFailed - # + # # 5xx HTTPServerError # 500 HTTPInternalServerError # 501 HTTPNotImplemented @@ -1894,7 +1894,7 @@ module Net #:nodoc: # 503 HTTPServiceUnavailable # 504 HTTPGatewayTimeOut # 505 HTTPVersionNotSupported - # + # # xxx HTTPUnknownResponse # class HTTPResponse @@ -2160,7 +2160,7 @@ module Net #:nodoc: # next is to fix bug in RDoc, where the private inside class << self # spills out. - public + public include HTTPHeader @@ -2193,7 +2193,7 @@ module Net #:nodoc: # To allow Net::HTTP 1.1 style assignment # e.g. # response, body = Net::HTTP.get(....) - # + # def to_ary warn "net/http.rb: warning: Net::HTTP v1.1 style assignment found at #{caller(1)[0]}; use `response = http.get(...)' instead." if $VERBOSE res = self.dup diff --git a/lib/net/https.rb b/lib/net/https.rb index 051e712dc4..636ae1be4d 100644 --- a/lib/net/https.rb +++ b/lib/net/https.rb @@ -17,7 +17,7 @@ == Version $Id$ - + 2001-11-06: Contiributed to Ruby/OpenSSL project. 2004-03-06: Some code is merged in to net/http. diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 3364561508..161e7ac32a 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -9,7 +9,7 @@ # Documentation: Shugo Maeda, with RDoc conversion and overview by William # Webber. # -# See Net::IMAP for documentation. +# See Net::IMAP for documentation. # @@ -45,12 +45,12 @@ module Net # read-only access) #examine(). Once the client has successfully # selected a mailbox, they enter _selected_ state, and that # mailbox becomes the _current_ mailbox, on which mail-item - # related commands implicitly operate. + # related commands implicitly operate. # # Messages have two sorts of identifiers: message sequence - # numbers, and UIDs. + # numbers, and UIDs. # - # Message sequence numbers number messages within a mail box + # Message sequence numbers number messages within a mail box # from 1 up to the number of items in the mail box. If new # message arrives during a session, it receives a sequence # number equal to the new size of the mail box. If messages @@ -58,7 +58,7 @@ module Net # sequence numbers "shuffled down" to fill the gaps. # # UIDs, on the other hand, are permanently guaranteed not to - # identify another message within the same mailbox, even if + # identify another message within the same mailbox, even if # the existing message is deleted. UIDs are required to # be assigned in ascending (but not necessarily sequential) # order within a mailbox; this means that if a non-IMAP client @@ -91,11 +91,11 @@ module Net # imap.store(message_id, "+FLAGS", [:Deleted]) # end # imap.expunge - # + # # == Thread Safety # # Net::IMAP supports concurrent threads. For example, - # + # # imap = Net::IMAP.new("imap.foo.net", "imap2") # imap.authenticate("cram-md5", "bar", "password") # imap.select("inbox") @@ -103,7 +103,7 @@ module Net # search_result = imap.search(["BODY", "hello"]) # fetch_result = fetch_thread.value # imap.disconnect - # + # # This script invokes the FETCH command and the SEARCH command concurrently. # # == Errors @@ -113,9 +113,9 @@ module Net # # NO:: the attempted command could not be successfully completed. For # instance, the username/password used for logging in are incorrect; - # the selected mailbox does not exists; etc. + # the selected mailbox does not exists; etc. # - # BAD:: the request from the client does not follow the server's + # BAD:: the request from the client does not follow the server's # understanding of the IMAP protocol. This includes attempting # commands from the wrong client state; for instance, attempting # to perform a SEARCH command without having SELECTed a current @@ -147,8 +147,8 @@ module Net # # Finally, a Net::IMAP::DataFormatError is thrown if low-level data # is found to be in an incorrect format (for instance, when converting - # between UTF-8 and UTF-16), and Net::IMAP::ResponseParseError is - # thrown if a server response is non-parseable. + # between UTF-8 and UTF-16), and Net::IMAP::ResponseParseError is + # thrown if a server response is non-parseable. # # # == References @@ -274,10 +274,10 @@ module Net # is the type of authentication this authenticator supports # (for instance, "LOGIN"). The +authenticator+ is an object # which defines a process() method to handle authentication with - # the server. See Net::IMAP::LoginAuthenticator, + # the server. See Net::IMAP::LoginAuthenticator, # Net::IMAP::CramMD5Authenticator, and Net::IMAP::DigestMD5Authenticator # for examples. - # + # # # If +auth_type+ refers to an existing authenticator, it will be # replaced by the new one. @@ -314,7 +314,7 @@ module Net # # Note that the Net::IMAP class does not modify its # behaviour according to the capabilities of the server; - # it is up to the user of the class to ensure that + # it is up to the user of the class to ensure that # a certain capability is supported by a server before # using it. def capability @@ -355,7 +355,7 @@ module Net # the authentication mechanism to be used. Currently Net::IMAP # supports authentication mechanisms: # - # LOGIN:: login using cleartext user and password. + # LOGIN:: login using cleartext user and password. # CRAM-MD5:: login with cleartext user and encrypted password # (see [RFC-2195] for a full description). This # mechanism requires that the server have the user's @@ -403,7 +403,7 @@ module Net end # Sends a SELECT command to select a +mailbox+ so that messages - # in the +mailbox+ can be accessed. + # in the +mailbox+ can be accessed. # # After you have selected a mailbox, you may retrieve the # number of items in that mailbox from @responses["EXISTS"][-1], @@ -454,7 +454,7 @@ module Net # Sends a RENAME command to change the name of the +mailbox+ to # +newname+. # - # A Net::IMAP::NoResponseError is raised if a mailbox with the + # A Net::IMAP::NoResponseError is raised if a mailbox with the # name +mailbox+ cannot be renamed to +newname+ for whatever # reason; for instance, because +mailbox+ does not exist, or # because there is already a mailbox with the name +newname+. @@ -501,8 +501,8 @@ module Net # imap.create("foo/bar") # imap.create("foo/baz") # p imap.list("", "foo/%") - # #=> [#<Net::IMAP::MailboxList attr=[:Noselect], delim="/", name="foo/">, \\ - # #<Net::IMAP::MailboxList attr=[:Noinferiors, :Marked], delim="/", name="foo/bar">, \\ + # #=> [#<Net::IMAP::MailboxList attr=[:Noselect], delim="/", name="foo/">, \\ + # #<Net::IMAP::MailboxList attr=[:Noinferiors, :Marked], delim="/", name="foo/bar">, \\ # #<Net::IMAP::MailboxList attr=[:Noinferiors], delim="/", name="foo/baz">] def list(refname, mailbox) synchronize do @@ -555,7 +555,7 @@ module Net # then that user will be stripped of any rights to that mailbox. # The IMAP ACL commands are described in [RFC-2086]. def setacl(mailbox, user, rights) - if rights.nil? + if rights.nil? send_command("SETACL", mailbox, user, "") else send_command("SETACL", mailbox, user, rights) @@ -574,7 +574,7 @@ module Net # Sends a LSUB command, and returns a subset of names from the set # of names that the user has declared as being "active" or - # "subscribed". +refname+ and +mailbox+ are interpreted as + # "subscribed". +refname+ and +mailbox+ are interpreted as # for #list(). # The return value is an array of +Net::IMAP::MailboxList+. def lsub(refname, mailbox) @@ -597,7 +597,7 @@ module Net # p imap.status("inbox", ["MESSAGES", "RECENT"]) # #=> {"RECENT"=>0, "MESSAGES"=>44} # - # A Net::IMAP::NoResponseError is raised if status values + # A Net::IMAP::NoResponseError is raised if status values # for +mailbox+ cannot be returned, for instance because it # does not exist. def status(mailbox, attr) @@ -608,9 +608,9 @@ module Net end # Sends a APPEND command to append the +message+ to the end of - # the +mailbox+. The optional +flags+ argument is an array of + # the +mailbox+. The optional +flags+ argument is an array of # flags to initially passing to the new message. The optional - # +date_time+ argument specifies the creation time to assign to the + # +date_time+ argument specifies the creation time to assign to the # new message; it defaults to the current time. # For example: # @@ -618,7 +618,7 @@ module Net # Subject: hello # From: shugo@ruby-lang.org # To: shugo@ruby-lang.org - # + # # hello world # EOF # @@ -637,7 +637,7 @@ module Net # Sends a CHECK command to request a checkpoint of the currently # selected mailbox. This performs implementation-specific - # housekeeping, for instance, reconciling the mailbox's + # housekeeping, for instance, reconciling the mailbox's # in-memory and on-disk state. def check send_command("CHECK") @@ -661,8 +661,8 @@ module Net # Sends a SEARCH command to search the mailbox for messages that # match the given searching criteria, and returns message sequence - # numbers. +keys+ can either be a string holding the entire - # search string, or a single-dimension array of search keywords and + # numbers. +keys+ can either be a string holding the entire + # search string, or a single-dimension array of search keywords and # arguments. The following are some common search criteria; # see [IMAP] section 6.4.4 for a full list. # @@ -686,7 +686,7 @@ module Net # # OR <search-key> <search-key>:: "or" two search keys together. # - # ON <date>:: messages with an internal date exactly equal to <date>, + # ON <date>:: messages with an internal date exactly equal to <date>, # which has a format similar to 8-Aug-2002. # # SINCE <date>:: messages with an internal date on or after <date>. @@ -694,7 +694,7 @@ module Net # SUBJECT <string>:: messages with <string> in their subject. # # TO <string>:: messages with <string> in their TO field. - # + # # For example: # # p imap.search(["SUBJECT", "hello", "NOT", "NEW"]) @@ -717,8 +717,8 @@ module Net # The return value is an array of Net::IMAP::FetchData. For example: # # p imap.fetch(6..8, "UID") - # #=> [#<Net::IMAP::FetchData seqno=6, attr={"UID"=>98}>, \\ - # #<Net::IMAP::FetchData seqno=7, attr={"UID"=>99}>, \\ + # #=> [#<Net::IMAP::FetchData seqno=6, attr={"UID"=>98}>, \\ + # #<Net::IMAP::FetchData seqno=7, attr={"UID"=>99}>, \\ # #<Net::IMAP::FetchData seqno=8, attr={"UID"=>100}>] # p imap.fetch(6, "BODY[HEADER.FIELDS (SUBJECT)]") # #=> [#<Net::IMAP::FetchData seqno=6, attr={"BODY[HEADER.FIELDS (SUBJECT)]"=>"Subject: test\r\n\r\n"}>] @@ -741,9 +741,9 @@ module Net end # Sends a STORE command to alter data associated with messages - # in the mailbox, in particular their flags. The +set+ parameter - # is a number or an array of numbers or a Range object. Each number - # is a message sequence number. +attr+ is the name of a data item + # in the mailbox, in particular their flags. The +set+ parameter + # is a number or an array of numbers or a Range object. Each number + # is a message sequence number. +attr+ is the name of a data item # to store: 'FLAGS' means to replace the message's flag list # with the provided one; '+FLAGS' means to add the provided flags; # and '-FLAGS' means to remove them. +flags+ is a list of flags. @@ -751,8 +751,8 @@ module Net # The return value is an array of Net::IMAP::FetchData. For example: # # p imap.store(6..8, "+FLAGS", [:Deleted]) - # #=> [#<Net::IMAP::FetchData seqno=6, attr={"FLAGS"=>[:Seen, :Deleted]}>, \\ - # #<Net::IMAP::FetchData seqno=7, attr={"FLAGS"=>[:Seen, :Deleted]}>, \\ + # #=> [#<Net::IMAP::FetchData seqno=6, attr={"FLAGS"=>[:Seen, :Deleted]}>, \\ + # #<Net::IMAP::FetchData seqno=7, attr={"FLAGS"=>[:Seen, :Deleted]}>, \\ # #<Net::IMAP::FetchData seqno=8, attr={"FLAGS"=>[:Seen, :Deleted]}>] def store(set, attr, flags) return store_internal("STORE", set, attr, flags) @@ -794,9 +794,9 @@ module Net return sort_internal("UID SORT", sort_keys, search_keys, charset) end - # Adds a response handler. For example, to detect when + # Adds a response handler. For example, to detect when # the server sends us a new EXISTS response (which normally - # indicates new messages being added to the mail box), + # indicates new messages being added to the mail box), # you could add the following handler after selecting the # mailbox. # @@ -832,7 +832,7 @@ module Net return thread_internal("THREAD", algorithm, search_keys, charset) end - # As for #thread(), but returns unique identifiers instead of + # As for #thread(), but returns unique identifiers instead of # message sequence numbers. def uid_thread(algorithm, search_keys, charset) return thread_internal("UID THREAD", algorithm, search_keys, charset) @@ -897,7 +897,7 @@ module Net # to use SSL (now TLS) to connect to the server. For this to work # OpenSSL [OSSL] and the Ruby OpenSSL [RSSL] extensions need to # be installed. - # if options[:ssl] is a hash, it's passed to + # if options[:ssl] is a hash, it's passed to # OpenSSL::SSL::SSLContext#set_params as parameters. # # The most common errors are: @@ -908,7 +908,7 @@ module Net # being dropped by an intervening firewall). # Errno::ENETUNREACH:: there is no route to that network. # SocketError:: hostname not known or other socket error. - # Net::IMAP::ByeResponseError:: we connected to the host, but they + # Net::IMAP::ByeResponseError:: we connected to the host, but they # immediately said goodbye to us. def initialize(host, port_or_options = {}, usessl = false, certs = nil, verify = true) @@ -1092,7 +1092,7 @@ module Net @tagno += 1 return format("%s%04d", @tag_prefix, @tagno) end - + def put_string(str) @sock.print(str) if @@debug @@ -1160,7 +1160,7 @@ module Net put_string(str) end end - + def send_quoted_string(str) put_string('"' + str.gsub(/["\\]/n, "\\\\\\&") + '"') end @@ -1313,7 +1313,7 @@ module Net context = SSLContext.new context.set_params(params) if defined?(VerifyCallbackProc) - context.verify_callback = VerifyCallbackProc + context.verify_callback = VerifyCallbackProc end @sock = SSLSocket.new(@sock, context) @sock.sync_close = true @@ -1448,109 +1448,109 @@ module Net end # Net::IMAP::ContinuationRequest represents command continuation requests. - # + # # The command continuation request response is indicated by a "+" token # instead of a tag. This form of response indicates that the server is # ready to accept the continuation of a command from the client. The # remainder of this response is a line of text. - # + # # continue_req ::= "+" SPACE (resp_text / base64) - # + # # ==== Fields: - # + # # data:: Returns the data (Net::IMAP::ResponseText). - # + # # raw_data:: Returns the raw data string. ContinuationRequest = Struct.new(:data, :raw_data) # Net::IMAP::UntaggedResponse represents untagged responses. - # + # # Data transmitted by the server to the client and status responses # that do not indicate command completion are prefixed with the token # "*", and are called untagged responses. - # + # # response_data ::= "*" SPACE (resp_cond_state / resp_cond_bye / # mailbox_data / message_data / capability_data) - # + # # ==== Fields: - # + # # name:: Returns the name such as "FLAGS", "LIST", "FETCH".... - # + # # data:: Returns the data such as an array of flag symbols, # a ((<Net::IMAP::MailboxList>)) object.... - # + # # raw_data:: Returns the raw data string. UntaggedResponse = Struct.new(:name, :data, :raw_data) - + # Net::IMAP::TaggedResponse represents tagged responses. - # + # # The server completion result response indicates the success or # failure of the operation. It is tagged with the same tag as the # client command which began the operation. - # + # # response_tagged ::= tag SPACE resp_cond_state CRLF - # + # # tag ::= 1*<any ATOM_CHAR except "+"> - # + # # resp_cond_state ::= ("OK" / "NO" / "BAD") SPACE resp_text - # + # # ==== Fields: - # + # # tag:: Returns the tag. - # + # # name:: Returns the name. the name is one of "OK", "NO", "BAD". - # + # # data:: Returns the data. See ((<Net::IMAP::ResponseText>)). - # + # # raw_data:: Returns the raw data string. # TaggedResponse = Struct.new(:tag, :name, :data, :raw_data) - + # Net::IMAP::ResponseText represents texts of responses. # The text may be prefixed by the response code. - # + # # resp_text ::= ["[" resp_text_code "]" SPACE] (text_mime2 / text) # ;; text SHOULD NOT begin with "[" or "=" - # + # # ==== Fields: - # + # # code:: Returns the response code. See ((<Net::IMAP::ResponseCode>)). - # + # # text:: Returns the text. - # + # ResponseText = Struct.new(:code, :text) - # + # # Net::IMAP::ResponseCode represents response codes. - # + # # resp_text_code ::= "ALERT" / "PARSE" / # "PERMANENTFLAGS" SPACE "(" #(flag / "\*") ")" / # "READ-ONLY" / "READ-WRITE" / "TRYCREATE" / # "UIDVALIDITY" SPACE nz_number / # "UNSEEN" SPACE nz_number / # atom [SPACE 1*<any TEXT_CHAR except "]">] - # + # # ==== Fields: - # + # # name:: Returns the name such as "ALERT", "PERMANENTFLAGS", "UIDVALIDITY".... - # + # # data:: Returns the data if it exists. # ResponseCode = Struct.new(:name, :data) # Net::IMAP::MailboxList represents contents of the LIST response. - # + # # mailbox_list ::= "(" #("\Marked" / "\Noinferiors" / # "\Noselect" / "\Unmarked" / flag_extension) ")" # SPACE (<"> QUOTED_CHAR <"> / nil) SPACE mailbox - # + # # ==== Fields: - # + # # attr:: Returns the name attributes. Each name attribute is a symbol # capitalized by String#capitalize, such as :Noselect (not :NoSelect). - # + # # delim:: Returns the hierarchy delimiter - # + # # name:: Returns the mailbox name. # MailboxList = Struct.new(:attr, :delim, :name) @@ -1559,78 +1559,78 @@ module Net # This object can also be a response to GETQUOTAROOT. In the syntax # specification below, the delimiter used with the "#" construct is a # single space (SPACE). - # + # # quota_list ::= "(" #quota_resource ")" - # + # # quota_resource ::= atom SPACE number SPACE number - # + # # quota_response ::= "QUOTA" SPACE astring SPACE quota_list - # + # # ==== Fields: - # + # # mailbox:: The mailbox with the associated quota. - # + # # usage:: Current storage usage of mailbox. - # + # # quota:: Quota limit imposed on mailbox. # MailboxQuota = Struct.new(:mailbox, :usage, :quota) # Net::IMAP::MailboxQuotaRoot represents part of the GETQUOTAROOT # response. (GETQUOTAROOT can also return Net::IMAP::MailboxQuota.) - # + # # quotaroot_response ::= "QUOTAROOT" SPACE astring *(SPACE astring) - # + # # ==== Fields: - # + # # mailbox:: The mailbox with the associated quota. - # + # # quotaroots:: Zero or more quotaroots that effect the quota on the # specified mailbox. # MailboxQuotaRoot = Struct.new(:mailbox, :quotaroots) # Net::IMAP::MailboxACLItem represents response from GETACL. - # + # # acl_data ::= "ACL" SPACE mailbox *(SPACE identifier SPACE rights) - # + # # identifier ::= astring - # + # # rights ::= astring - # + # # ==== Fields: - # + # # user:: Login name that has certain rights to the mailbox # that was specified with the getacl command. - # + # # rights:: The access rights the indicated user has to the # mailbox. # MailboxACLItem = Struct.new(:user, :rights) # Net::IMAP::StatusData represents contents of the STATUS response. - # + # # ==== Fields: - # + # # mailbox:: Returns the mailbox name. - # + # # attr:: Returns a hash. Each key is one of "MESSAGES", "RECENT", "UIDNEXT", # "UIDVALIDITY", "UNSEEN". Each value is a number. - # + # StatusData = Struct.new(:mailbox, :attr) # Net::IMAP::FetchData represents contents of the FETCH response. - # + # # ==== Fields: - # + # # seqno:: Returns the message sequence number. # (Note: not the unique identifier, even for the UID command response.) - # + # # attr:: Returns a hash. Each key is a data item name, and each value is # its value. - # + # # The current data items are: - # + # # [BODY] # A form of BODYSTRUCTURE without extension data. # [BODY[<section>]<<origin_octet>>] @@ -1657,67 +1657,67 @@ module Net # Equivalent to BODY[TEXT]. # [UID] # A number expressing the unique identifier of the message. - # + # FetchData = Struct.new(:seqno, :attr) # Net::IMAP::Envelope represents envelope structures of messages. - # + # # ==== Fields: - # + # # date:: Returns a string that represents the date. - # + # # subject:: Returns a string that represents the subject. - # + # # from:: Returns an array of Net::IMAP::Address that represents the from. - # + # # sender:: Returns an array of Net::IMAP::Address that represents the sender. - # + # # reply_to:: Returns an array of Net::IMAP::Address that represents the reply-to. - # + # # to:: Returns an array of Net::IMAP::Address that represents the to. - # + # # cc:: Returns an array of Net::IMAP::Address that represents the cc. - # + # # bcc:: Returns an array of Net::IMAP::Address that represents the bcc. - # + # # in_reply_to:: Returns a string that represents the in-reply-to. - # + # # message_id:: Returns a string that represents the message-id. - # + # Envelope = Struct.new(:date, :subject, :from, :sender, :reply_to, :to, :cc, :bcc, :in_reply_to, :message_id) - # + # # Net::IMAP::Address represents electronic mail addresses. - # + # # ==== Fields: - # + # # name:: Returns the phrase from [RFC-822] mailbox. - # + # # route:: Returns the route from [RFC-822] route-addr. - # + # # mailbox:: nil indicates end of [RFC-822] group. # If non-nil and host is nil, returns [RFC-822] group name. # Otherwise, returns [RFC-822] local-part - # + # # host:: nil indicates [RFC-822] group syntax. # Otherwise, returns [RFC-822] domain name. # Address = Struct.new(:name, :route, :mailbox, :host) - # + # # Net::IMAP::ContentDisposition represents Content-Disposition fields. - # + # # ==== Fields: - # + # # dsp_type:: Returns the disposition type. - # + # # param:: Returns a hash that represents parameters of the Content-Disposition # field. - # + # ContentDisposition = Struct.new(:dsp_type, :param) - # Net::IMAP::ThreadMember represents a thread-node returned + # Net::IMAP::ThreadMember represents a thread-node returned # by Net::IMAP#thread # # ==== Fields: @@ -1730,37 +1730,37 @@ module Net ThreadMember = Struct.new(:seqno, :children) # Net::IMAP::BodyTypeBasic represents basic body structures of messages. - # + # # ==== Fields: - # + # # media_type:: Returns the content media type name as defined in [MIME-IMB]. - # + # # subtype:: Returns the content subtype name as defined in [MIME-IMB]. - # + # # param:: Returns a hash that represents parameters as defined in [MIME-IMB]. - # + # # content_id:: Returns a string giving the content id as defined in [MIME-IMB]. - # + # # description:: Returns a string giving the content description as defined in # [MIME-IMB]. - # + # # encoding:: Returns a string giving the content transfer encoding as defined in # [MIME-IMB]. - # + # # size:: Returns a number giving the size of the body in octets. - # + # # md5:: Returns a string giving the body MD5 value as defined in [MD5]. - # + # # disposition:: Returns a Net::IMAP::ContentDisposition object giving # the content disposition. - # + # # language:: Returns a string or an array of strings giving the body # language value as defined in [LANGUAGE-TAGS]. - # + # # extension:: Returns extension data. - # + # # multipart?:: Returns false. - # + # class BodyTypeBasic < Struct.new(:media_type, :subtype, :param, :content_id, :description, :encoding, :size, @@ -1771,7 +1771,7 @@ module Net end # Obsolete: use +subtype+ instead. Calling this will - # generate a warning message to +stderr+, then return + # generate a warning message to +stderr+, then return # the value of +subtype+. def media_subtype $stderr.printf("warning: media_subtype is obsolete.\n") @@ -1781,13 +1781,13 @@ module Net end # Net::IMAP::BodyTypeText represents TEXT body structures of messages. - # + # # ==== Fields: - # + # # lines:: Returns the size of the body in text lines. - # + # # And Net::IMAP::BodyTypeText has all fields of Net::IMAP::BodyTypeBasic. - # + # class BodyTypeText < Struct.new(:media_type, :subtype, :param, :content_id, :description, :encoding, :size, @@ -1799,7 +1799,7 @@ module Net end # Obsolete: use +subtype+ instead. Calling this will - # generate a warning message to +stderr+, then return + # generate a warning message to +stderr+, then return # the value of +subtype+. def media_subtype $stderr.printf("warning: media_subtype is obsolete.\n") @@ -1809,13 +1809,13 @@ module Net end # Net::IMAP::BodyTypeMessage represents MESSAGE/RFC822 body structures of messages. - # + # # ==== Fields: - # + # # envelope:: Returns a Net::IMAP::Envelope giving the envelope structure. - # + # # body:: Returns an object giving the body structure. - # + # # And Net::IMAP::BodyTypeMessage has all methods of Net::IMAP::BodyTypeText. # class BodyTypeMessage < Struct.new(:media_type, :subtype, @@ -1829,7 +1829,7 @@ module Net end # Obsolete: use +subtype+ instead. Calling this will - # generate a warning message to +stderr+, then return + # generate a warning message to +stderr+, then return # the value of +subtype+. def media_subtype $stderr.printf("warning: media_subtype is obsolete.\n") @@ -1838,29 +1838,29 @@ module Net end end - # Net::IMAP::BodyTypeMultipart represents multipart body structures + # Net::IMAP::BodyTypeMultipart represents multipart body structures # of messages. - # + # # ==== Fields: - # + # # media_type:: Returns the content media type name as defined in [MIME-IMB]. - # + # # subtype:: Returns the content subtype name as defined in [MIME-IMB]. - # + # # parts:: Returns multiple parts. - # + # # param:: Returns a hash that represents parameters as defined in [MIME-IMB]. - # + # # disposition:: Returns a Net::IMAP::ContentDisposition object giving # the content disposition. - # + # # language:: Returns a string or an array of strings giving the body # language value as defined in [LANGUAGE-TAGS]. - # + # # extension:: Returns extension data. - # + # # multipart?:: Returns true. - # + # class BodyTypeMultipart < Struct.new(:media_type, :subtype, :parts, :param, :disposition, :language, @@ -1870,7 +1870,7 @@ module Net end # Obsolete: use +subtype+ instead. Calling this will - # generate a warning message to +stderr+, then return + # generate a warning message to +stderr+, then return # the value of +subtype+. def media_subtype $stderr.printf("warning: media_subtype is obsolete.\n") @@ -2671,35 +2671,35 @@ module Net def thread_branch(token) rootmember = nil lastmember = nil - + while true shift_token # ignore first T_LPAR token = lookahead - + case token.symbol when T_NUMBER # new member newmember = ThreadMember.new(number, []) if rootmember.nil? rootmember = newmember - else + else lastmember.children << newmember - end + end lastmember = newmember - when T_SPACE - # do nothing + when T_SPACE + # do nothing when T_LPAR if rootmember.nil? # dummy member lastmember = rootmember = ThreadMember.new(nil, []) - end - + end + lastmember.children << thread_branch(token) when T_RPAR - break - end + break + end end - + return rootmember end @@ -3176,7 +3176,7 @@ module Net @user = user @password = password end - end + end add_authenticator "PLAIN", PlainAuthenticator # Authenticator for the "CRAM-MD5" authentication type. See @@ -3341,7 +3341,7 @@ module Net class BadResponseError < ResponseError end - # Error raised upon a "BYE" response from the server, indicating + # Error raised upon a "BYE" response from the server, indicating # that the client is not being allowed to login, or has been timed # out due to inactivity. class ByeResponseError < ResponseError @@ -3426,7 +3426,7 @@ EOF usage exit(1) end - + imap = Net::IMAP.new($host, :port => $port, :ssl => $ssl) begin password = get_password diff --git a/lib/net/pop.rb b/lib/net/pop.rb index accac72905..6a45e3b5f0 100644 --- a/lib/net/pop.rb +++ b/lib/net/pop.rb @@ -3,20 +3,20 @@ # Copyright (c) 1999-2007 Yukihiro Matsumoto. # # Copyright (c) 1999-2007 Minero Aoki. -# +# # Written & maintained by Minero Aoki <aamine@loveruby.net>. # # Documented by William Webber and Minero Aoki. -# +# # This program is free software. You can re-distribute and/or # modify this program under the same terms as Ruby itself, # Ruby Distribute License. -# +# # NOTE: You can find Japanese version of this document at: # http://www.ruby-lang.org/ja/man/html/net_pop.html -# +# # $Id$ -# +# # See Net::POP3 for documentation. # @@ -45,25 +45,25 @@ module Net # = Net::POP3 # # == What is This Library? - # - # This library provides functionality for retrieving + # + # This library provides functionality for retrieving # email via POP3, the Post Office Protocol version 3. For details # of POP3, see [RFC1939] (http://www.ietf.org/rfc/rfc1939.txt). - # + # # == Examples - # - # === Retrieving Messages - # - # This example retrieves messages from the server and deletes them + # + # === Retrieving Messages + # + # This example retrieves messages from the server and deletes them # on the server. # # Messages are written to files named 'inbox/1', 'inbox/2', .... # Replace 'pop.example.com' with your POP3 server address, and # 'YourAccount' and 'YourPassword' with the appropriate account # details. - # + # # require 'net/pop' - # + # # pop = Net::POP3.new('pop.example.com') # pop.start('YourAccount', 'YourPassword') # (1) # if pop.mails.empty? @@ -80,19 +80,19 @@ module Net # puts "#{pop.mails.size} mails popped." # end # pop.finish # (3) - # + # # 1. Call Net::POP3#start and start POP session. # 2. Access messages by using POP3#each_mail and/or POP3#mails. # 3. Close POP session by calling POP3#finish or use the block form of #start. - # + # # === Shortened Code - # + # # The example above is very verbose. You can shorten the code by using # some utility methods. First, the block form of Net::POP3.start can # be used instead of POP3.new, POP3#start and POP3#finish. - # + # # require 'net/pop' - # + # # Net::POP3.start('pop.example.com', 110, # 'YourAccount', 'YourPassword') do |pop| # if pop.mails.empty? @@ -109,11 +109,11 @@ module Net # puts "#{pop.mails.size} mails popped." # end # end - # + # # POP3#delete_all is an alternative for #each_mail and #delete. - # + # # require 'net/pop' - # + # # Net::POP3.start('pop.example.com', 110, # 'YourAccount', 'YourPassword') do |pop| # if pop.mails.empty? @@ -128,11 +128,11 @@ module Net # end # end # end - # + # # And here is an even shorter example. - # + # # require 'net/pop' - # + # # i = 0 # Net::POP3.delete_all('pop.example.com', 110, # 'YourAccount', 'YourPassword') do |m| @@ -141,14 +141,14 @@ module Net # end # i += 1 # end - # + # # === Memory Space Issues - # + # # All the examples above get each message as one big string. # This example avoids this. - # + # # require 'net/pop' - # + # # i = 1 # Net::POP3.delete_all('pop.example.com', 110, # 'YourAccount', 'YourPassword') do |m| @@ -159,41 +159,41 @@ module Net # i += 1 # end # end - # + # # === Using APOP - # + # # The net/pop library supports APOP authentication. # To use APOP, use the Net::APOP class instead of the Net::POP3 class. # You can use the utility method, Net::POP3.APOP(). For example: - # + # # require 'net/pop' - # + # # # Use APOP authentication if $isapop == true # pop = Net::POP3.APOP($is_apop).new('apop.example.com', 110) # pop.start(YourAccount', 'YourPassword') do |pop| # # Rest of the code is the same. # end - # + # # === Fetch Only Selected Mail Using 'UIDL' POP Command - # + # # If your POP server provides UIDL functionality, # you can grab only selected mails from the POP server. # e.g. - # + # # def need_pop?( id ) # # determine if we need pop this mail... # end - # + # # Net::POP3.start('pop.example.com', 110, # 'Your account', 'Your password') do |pop| # pop.mails.select { |m| need_pop?(m.unique_id) }.each do |m| # do_something(m.pop) # end # end - # + # # The POPMail#unique_id() method returns the unique-id of the message as a # String. Normally the unique-id is a hash of the message. - # + # class POP3 < Protocol Revision = %q$Revision$.split[1] @@ -210,7 +210,7 @@ module Net def POP3.default_pop3_port 110 end - + # The default port for POP3S connections, port 995 def POP3.default_pop3s_port 995 @@ -375,7 +375,7 @@ module Net # Session management # - # Creates a new POP3 object and open the connection. Equivalent to + # Creates a new POP3 object and open the connection. Equivalent to # # Net::POP3.new(address, port, isapop).start(account, password) # @@ -396,7 +396,7 @@ module Net isapop = false, &block) # :yield: pop new(address, port, isapop).start(account, password, &block) end - + # Creates a new POP3 object. # # +address+ is the hostname or ip address of your POP3 server. @@ -412,7 +412,7 @@ module Net @ssl_params = POP3.ssl_params @port = port @apop = isapop - + @command = nil @socket = nil @started = false @@ -434,7 +434,7 @@ module Net def use_ssl? return !@ssl_params.nil? end - + # call-seq: # Net::POP#enable_ssl(params = {}) # @@ -451,7 +451,7 @@ module Net @port = port || @port end end - + def disable_ssl @ssl_params = nil end @@ -635,7 +635,7 @@ module Net # Yields each message to the passed-in block in turn. # Equivalent to: - # + # # pop3.mails.each do |popmail| # .... # end @@ -742,7 +742,7 @@ module Net # # This method fetches the message. If called with a block, the # message is yielded to the block one chunk at a time. If called - # without a block, the message is returned as a String. The optional + # without a block, the message is returned as a String. The optional # +dest+ argument will be prepended to the returned String; this # argument is essentially obsolete. # @@ -753,7 +753,7 @@ module Net # n = 1 # pop.mails.each do |popmail| # File.open("inbox/#{n}", 'w') do |f| - # f.write popmail.pop + # f.write popmail.pop # end # popmail.delete # n += 1 @@ -792,7 +792,7 @@ module Net alias all pop #:nodoc: obsolete alias mail pop #:nodoc: obsolete - # Fetches the message header and +lines+ lines of body. + # Fetches the message header and +lines+ lines of body. # # The optional +dest+ argument is obsolete. # @@ -804,7 +804,7 @@ module Net dest end - # Fetches the message header. + # Fetches the message header. # # The optional +dest+ argument is obsolete. # @@ -933,7 +933,7 @@ module Net @socket.each_message_chunk(&block) } end - + def dele(num) check_response(critical { get_response('DELE %d', num) }) end diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb index e26c849338..e2423f2986 100644 --- a/lib/net/protocol.rb +++ b/lib/net/protocol.rb @@ -121,7 +121,7 @@ module Net # :nodoc: return rbuf_consume(@rbuf.size) end end - + def readline readuntil("\n").chop end @@ -228,7 +228,7 @@ module Net # :nodoc: LOG_on() LOG "read message (#{read_bytes} bytes)" end - + # *library private* (cannot handle 'break') def each_list_item while (str = readuntil("\r\n")) != ".\r\n" diff --git a/lib/net/smtp.rb b/lib/net/smtp.rb index b58e73029b..a84b7ba154 100644 --- a/lib/net/smtp.rb +++ b/lib/net/smtp.rb @@ -1,23 +1,23 @@ # = net/smtp.rb -# +# # Copyright (c) 1999-2007 Yukihiro Matsumoto. # # Copyright (c) 1999-2007 Minero Aoki. -# +# # Written & maintained by Minero Aoki <aamine@loveruby.net>. # # Documented by William Webber and Minero Aoki. -# +# # This program is free software. You can re-distribute and/or # modify this program under the same terms as Ruby itself. -# +# # NOTE: You can find Japanese version of this document at: # http://www.ruby-lang.org/ja/man/html/net_smtp.html -# +# # $Id$ # -# See Net::SMTP for documentation. -# +# See Net::SMTP for documentation. +# require 'net/protocol' require 'digest/md5' @@ -69,103 +69,103 @@ module Net # = Net::SMTP # # == What is This Library? - # + # # This library provides functionality to send internet # mail via SMTP, the Simple Mail Transfer Protocol. For details of # SMTP itself, see [RFC2821] (http://www.ietf.org/rfc/rfc2821.txt). - # + # # == What is This Library NOT? - # + # # This library does NOT provide functions to compose internet mails. # You must create them by yourself. If you want better mail support, # try RubyMail or TMail. You can get both libraries from RAA. # (http://www.ruby-lang.org/en/raa.html) - # + # # FYI: the official documentation on internet mail is: [RFC2822] (http://www.ietf.org/rfc/rfc2822.txt). - # + # # == Examples - # + # # === Sending Messages - # + # # You must open a connection to an SMTP server before sending messages. - # The first argument is the address of your SMTP server, and the second - # argument is the port number. Using SMTP.start with a block is the simplest - # way to do this. This way, the SMTP connection is closed automatically + # The first argument is the address of your SMTP server, and the second + # argument is the port number. Using SMTP.start with a block is the simplest + # way to do this. This way, the SMTP connection is closed automatically # after the block is executed. - # + # # require 'net/smtp' # Net::SMTP.start('your.smtp.server', 25) do |smtp| # # Use the SMTP object smtp only in this block. # end - # + # # Replace 'your.smtp.server' with your SMTP server. Normally # your system manager or internet provider supplies a server # for you. - # + # # Then you can send messages. - # + # # msgstr = <<END_OF_MESSAGE # From: Your Name <your@mail.address> # To: Destination Address <someone@example.com> # Subject: test message # Date: Sat, 23 Jun 2001 16:26:43 +0900 # Message-Id: <unique.message.id.string@example.com> - # + # # This is a test message. # END_OF_MESSAGE - # + # # require 'net/smtp' # Net::SMTP.start('your.smtp.server', 25) do |smtp| # smtp.send_message msgstr, # 'your@mail.address', # 'his_addess@example.com' # end - # + # # === Closing the Session - # - # You MUST close the SMTP session after sending messages, by calling + # + # You MUST close the SMTP session after sending messages, by calling # the #finish method: - # + # # # using SMTP#finish # smtp = Net::SMTP.start('your.smtp.server', 25) # smtp.send_message msgstr, 'from@address', 'to@address' # smtp.finish - # + # # You can also use the block form of SMTP.start/SMTP#start. This closes # the SMTP session automatically: - # + # # # using block form of SMTP.start # Net::SMTP.start('your.smtp.server', 25) do |smtp| # smtp.send_message msgstr, 'from@address', 'to@address' # end - # + # # I strongly recommend this scheme. This form is simpler and more robust. - # + # # === HELO domain - # + # # In almost all situations, you must provide a third argument # to SMTP.start/SMTP#start. This is the domain name which you are on # (the host to send mail from). It is called the "HELO domain". # The SMTP server will judge whether it should send or reject # the SMTP session by inspecting the HELO domain. - # + # # Net::SMTP.start('your.smtp.server', 25, # 'mail.from.domain') { |smtp| ... } - # + # # === SMTP Authentication - # + # # The Net::SMTP class supports three authentication schemes; # PLAIN, LOGIN and CRAM MD5. (SMTP Authentication: [RFC2554]) - # To use SMTP authentication, pass extra arguments to + # To use SMTP authentication, pass extra arguments to # SMTP.start/SMTP#start. - # + # # # PLAIN # Net::SMTP.start('your.smtp.server', 25, 'mail.from.domain', # 'Your Account', 'Your Password', :plain) # # LOGIN # Net::SMTP.start('your.smtp.server', 25, 'mail.from.domain', # 'Your Account', 'Your Password', :login) - # + # # # CRAM MD5 # Net::SMTP.start('your.smtp.server', 25, 'mail.from.domain', # 'Your Account', 'Your Password', :cram_md5) @@ -196,7 +196,7 @@ module Net def SMTP.default_ssl_context OpenSSL::SSL::SSLContext.new end - + # # Creates a new Net::SMTP object. # @@ -223,7 +223,7 @@ module Net @starttls = false @ssl_context = nil end - + # Provide human-readable stringification of class state. def inspect "#<#{self.class} #{@address}:#{@port} started=#{@started}>" @@ -235,7 +235,7 @@ module Net end # - # Set whether to use ESMTP or not. This should be done before + # Set whether to use ESMTP or not. This should be done before # calling #start. Note that if #start is called in ESMTP mode, # and the connection fails due to a ProtocolError, the SMTP # object will automatically switch to plain SMTP mode and @@ -310,7 +310,7 @@ module Net end alias enable_ssl enable_tls - + # Disables SMTP/TLS for this object. Must be called before the # connection is established to have any effect. def disable_tls @@ -336,7 +336,7 @@ module Net def starttls_auto? @starttls == :auto end - + # Enables SMTP/TLS (STARTTLS) for this object. # +context+ is a OpenSSL::SSL::SSLContext object. def enable_starttls(context = SMTP.default_ssl_context) @@ -413,7 +413,7 @@ module Net # Creates a new Net::SMTP object and connects to the server. # # This method is equivalent to: - # + # # Net::SMTP.new(address, port).start(helo_domain, account, password, authtype) # # === Example @@ -437,7 +437,7 @@ module Net # +port+ is the port to connect to; it defaults to port 25. # # +helo+ is the _HELO_ _domain_ provided by the client to the - # server (see overview comments); it defaults to 'localhost'. + # server (see overview comments); it defaults to 'localhost'. # # The remaining arguments are used for SMTP authentication, if required # or desired. +user+ is the account name; +secret+ is your password @@ -476,33 +476,33 @@ module Net # +helo+ is the _HELO_ _domain_ that you'll dispatch mails from; see # the discussion in the overview notes. # - # If both of +user+ and +secret+ are given, SMTP authentication - # will be attempted using the AUTH command. +authtype+ specifies + # If both of +user+ and +secret+ are given, SMTP authentication + # will be attempted using the AUTH command. +authtype+ specifies # the type of authentication to attempt; it must be one of # :login, :plain, and :cram_md5. See the notes on SMTP Authentication - # in the overview. + # in the overview. # # === Block Usage # # When this methods is called with a block, the newly-started SMTP # object is yielded to the block, and automatically closed after - # the block call finishes. Otherwise, it is the caller's + # the block call finishes. Otherwise, it is the caller's # responsibility to close the session when finished. # # === Example # # This is very similar to the class method SMTP.start. # - # require 'net/smtp' + # require 'net/smtp' # smtp = Net::SMTP.new('smtp.mail.server', 25) # smtp.start(helo_domain, account, password, authtype) do |smtp| # smtp.send_message msgstr, 'from@example.com', ['dest@example.com'] - # end + # end # # The primary use of this method (as opposed to SMTP.start) # is probably to set debugging (#set_debug_output) or ESMTP # (#esmtp=), which must be done before the session is - # started. + # started. # # === Errors # @@ -548,7 +548,7 @@ module Net check_auth_method(authtype || DEFAULT_AUTH_TYPE) check_auth_args user, secret end - s = timeout(@open_timeout) { TCPSocket.open(@address, @port) } + s = timeout(@open_timeout) { TCPSocket.open(@address, @port) } logging "Connection opened: #{@address}:#{@port}" @socket = new_internet_message_io(tls? ? tlsconnect(s) : s) check_response critical { recv_response() } @@ -621,7 +621,7 @@ module Net # # Sends +msgstr+ as a message. Single CR ("\r") and LF ("\n") found # in the +msgstr+, are converted into the CR LF pair. You cannot send a - # binary message with this method. +msgstr+ should include both + # binary message with this method. +msgstr+ should include both # the message headers and body. # # +from_addr+ is a String representing the source mail address. @@ -852,7 +852,7 @@ module Net # From: john@example.com # To: betty@example.com # Subject: I found a bug - # + # # Check vm.c:58879. # EndMessage # diff --git a/lib/net/telnet.rb b/lib/net/telnet.rb index 67fd656c63..98285a944b 100644 --- a/lib/net/telnet.rb +++ b/lib/net/telnet.rb @@ -1,7 +1,7 @@ # = net/telnet.rb - Simple Telnet Client Library -# +# # Author:: Wakou Aoyama <wakou@ruby-lang.org> -# Documentation:: William Webber and Wakou Aoyama +# Documentation:: William Webber and Wakou Aoyama # # This file holds the class Net::Telnet, which provides client-side # telnet functionality. @@ -13,7 +13,7 @@ require "socket" require "delegate" require "timeout" require "English" - + module Net # @@ -50,11 +50,11 @@ module Net # have to handle authentication yourself. # # For some protocols, it will be possible to specify the +Prompt+ - # option once when you create the Telnet object and use #cmd() calls; + # option once when you create the Telnet object and use #cmd() calls; # for others, you will have to specify the response sequence to # look for as the Match option to every #cmd() call, or call - # #puts() and #waitfor() directly; for yet others, you will have - # to use #sysread() instead of #waitfor() and parse server + # #puts() and #waitfor() directly; for yet others, you will have + # to use #sysread() instead of #waitfor() and parse server # responses yourself. # # It is worth noting that when you create a new Net::Telnet object, @@ -63,21 +63,21 @@ module Net # to already open sockets, or to any read-write IO object. This # can be useful, for instance, for setting up a test fixture for # unit testing. - # + # # == Examples - # + # # === Log in and send a command, echoing all output to stdout - # + # # localhost = Net::Telnet::new("Host" => "localhost", # "Timeout" => 10, # "Prompt" => /[$%#>] \z/n) # localhost.login("username", "password") { |c| print c } # localhost.cmd("command") { |c| print c } # localhost.close - # - # + # + # # === Check a POP server to see if you have mail - # + # # pop = Net::Telnet::new("Host" => "your_destination_host_here", # "Port" => 110, # "Telnetmode" => false, @@ -97,73 +97,73 @@ module Net # :stopdoc: IAC = 255.chr # "\377" # "\xff" # interpret as command - DONT = 254.chr # "\376" # "\xfe" # you are not to use option - DO = 253.chr # "\375" # "\xfd" # please, you use option - WONT = 252.chr # "\374" # "\xfc" # I won't use option - WILL = 251.chr # "\373" # "\xfb" # I will use option - SB = 250.chr # "\372" # "\xfa" # interpret as subnegotiation - GA = 249.chr # "\371" # "\xf9" # you may reverse the line - EL = 248.chr # "\370" # "\xf8" # erase the current line - EC = 247.chr # "\367" # "\xf7" # erase the current character - AYT = 246.chr # "\366" # "\xf6" # are you there - AO = 245.chr # "\365" # "\xf5" # abort output--but let prog finish - IP = 244.chr # "\364" # "\xf4" # interrupt process--permanently - BREAK = 243.chr # "\363" # "\xf3" # break - DM = 242.chr # "\362" # "\xf2" # data mark--for connect. cleaning - NOP = 241.chr # "\361" # "\xf1" # nop - SE = 240.chr # "\360" # "\xf0" # end sub negotiation - EOR = 239.chr # "\357" # "\xef" # end of record (transparent mode) - ABORT = 238.chr # "\356" # "\xee" # Abort process - SUSP = 237.chr # "\355" # "\xed" # Suspend process - EOF = 236.chr # "\354" # "\xec" # End of file - SYNCH = 242.chr # "\362" # "\xf2" # for telfunc calls - - OPT_BINARY = 0.chr # "\000" # "\x00" # Binary Transmission - OPT_ECHO = 1.chr # "\001" # "\x01" # Echo - OPT_RCP = 2.chr # "\002" # "\x02" # Reconnection - OPT_SGA = 3.chr # "\003" # "\x03" # Suppress Go Ahead - OPT_NAMS = 4.chr # "\004" # "\x04" # Approx Message Size Negotiation - OPT_STATUS = 5.chr # "\005" # "\x05" # Status - OPT_TM = 6.chr # "\006" # "\x06" # Timing Mark - OPT_RCTE = 7.chr # "\a" # "\x07" # Remote Controlled Trans and Echo - OPT_NAOL = 8.chr # "\010" # "\x08" # Output Line Width - OPT_NAOP = 9.chr # "\t" # "\x09" # Output Page Size - OPT_NAOCRD = 10.chr # "\n" # "\x0a" # Output Carriage-Return Disposition - OPT_NAOHTS = 11.chr # "\v" # "\x0b" # Output Horizontal Tab Stops - OPT_NAOHTD = 12.chr # "\f" # "\x0c" # Output Horizontal Tab Disposition - OPT_NAOFFD = 13.chr # "\r" # "\x0d" # Output Formfeed Disposition - OPT_NAOVTS = 14.chr # "\016" # "\x0e" # Output Vertical Tabstops - OPT_NAOVTD = 15.chr # "\017" # "\x0f" # Output Vertical Tab Disposition - OPT_NAOLFD = 16.chr # "\020" # "\x10" # Output Linefeed Disposition - OPT_XASCII = 17.chr # "\021" # "\x11" # Extended ASCII - OPT_LOGOUT = 18.chr # "\022" # "\x12" # Logout - OPT_BM = 19.chr # "\023" # "\x13" # Byte Macro - OPT_DET = 20.chr # "\024" # "\x14" # Data Entry Terminal - OPT_SUPDUP = 21.chr # "\025" # "\x15" # SUPDUP - OPT_SUPDUPOUTPUT = 22.chr # "\026" # "\x16" # SUPDUP Output - OPT_SNDLOC = 23.chr # "\027" # "\x17" # Send Location - OPT_TTYPE = 24.chr # "\030" # "\x18" # Terminal Type - OPT_EOR = 25.chr # "\031" # "\x19" # End of Record - OPT_TUID = 26.chr # "\032" # "\x1a" # TACACS User Identification - OPT_OUTMRK = 27.chr # "\e" # "\x1b" # Output Marking - OPT_TTYLOC = 28.chr # "\034" # "\x1c" # Terminal Location Number - OPT_3270REGIME = 29.chr # "\035" # "\x1d" # Telnet 3270 Regime - OPT_X3PAD = 30.chr # "\036" # "\x1e" # X.3 PAD - OPT_NAWS = 31.chr # "\037" # "\x1f" # Negotiate About Window Size - OPT_TSPEED = 32.chr # " " # "\x20" # Terminal Speed - OPT_LFLOW = 33.chr # "!" # "\x21" # Remote Flow Control - OPT_LINEMODE = 34.chr # "\"" # "\x22" # Linemode - OPT_XDISPLOC = 35.chr # "#" # "\x23" # X Display Location - OPT_OLD_ENVIRON = 36.chr # "$" # "\x24" # Environment Option - OPT_AUTHENTICATION = 37.chr # "%" # "\x25" # Authentication Option - OPT_ENCRYPT = 38.chr # "&" # "\x26" # Encryption Option - OPT_NEW_ENVIRON = 39.chr # "'" # "\x27" # New Environment Option - OPT_EXOPL = 255.chr # "\377" # "\xff" # Extended-Options-List - - NULL = "\000" - CR = "\015" - LF = "\012" - EOL = CR + LF + DONT = 254.chr # "\376" # "\xfe" # you are not to use option + DO = 253.chr # "\375" # "\xfd" # please, you use option + WONT = 252.chr # "\374" # "\xfc" # I won't use option + WILL = 251.chr # "\373" # "\xfb" # I will use option + SB = 250.chr # "\372" # "\xfa" # interpret as subnegotiation + GA = 249.chr # "\371" # "\xf9" # you may reverse the line + EL = 248.chr # "\370" # "\xf8" # erase the current line + EC = 247.chr # "\367" # "\xf7" # erase the current character + AYT = 246.chr # "\366" # "\xf6" # are you there + AO = 245.chr # "\365" # "\xf5" # abort output--but let prog finish + IP = 244.chr # "\364" # "\xf4" # interrupt process--permanently + BREAK = 243.chr # "\363" # "\xf3" # break + DM = 242.chr # "\362" # "\xf2" # data mark--for connect. cleaning + NOP = 241.chr # "\361" # "\xf1" # nop + SE = 240.chr # "\360" # "\xf0" # end sub negotiation + EOR = 239.chr # "\357" # "\xef" # end of record (transparent mode) + ABORT = 238.chr # "\356" # "\xee" # Abort process + SUSP = 237.chr # "\355" # "\xed" # Suspend process + EOF = 236.chr # "\354" # "\xec" # End of file + SYNCH = 242.chr # "\362" # "\xf2" # for telfunc calls + + OPT_BINARY = 0.chr # "\000" # "\x00" # Binary Transmission + OPT_ECHO = 1.chr # "\001" # "\x01" # Echo + OPT_RCP = 2.chr # "\002" # "\x02" # Reconnection + OPT_SGA = 3.chr # "\003" # "\x03" # Suppress Go Ahead + OPT_NAMS = 4.chr # "\004" # "\x04" # Approx Message Size Negotiation + OPT_STATUS = 5.chr # "\005" # "\x05" # Status + OPT_TM = 6.chr # "\006" # "\x06" # Timing Mark + OPT_RCTE = 7.chr # "\a" # "\x07" # Remote Controlled Trans and Echo + OPT_NAOL = 8.chr # "\010" # "\x08" # Output Line Width + OPT_NAOP = 9.chr # "\t" # "\x09" # Output Page Size + OPT_NAOCRD = 10.chr # "\n" # "\x0a" # Output Carriage-Return Disposition + OPT_NAOHTS = 11.chr # "\v" # "\x0b" # Output Horizontal Tab Stops + OPT_NAOHTD = 12.chr # "\f" # "\x0c" # Output Horizontal Tab Disposition + OPT_NAOFFD = 13.chr # "\r" # "\x0d" # Output Formfeed Disposition + OPT_NAOVTS = 14.chr # "\016" # "\x0e" # Output Vertical Tabstops + OPT_NAOVTD = 15.chr # "\017" # "\x0f" # Output Vertical Tab Disposition + OPT_NAOLFD = 16.chr # "\020" # "\x10" # Output Linefeed Disposition + OPT_XASCII = 17.chr # "\021" # "\x11" # Extended ASCII + OPT_LOGOUT = 18.chr # "\022" # "\x12" # Logout + OPT_BM = 19.chr # "\023" # "\x13" # Byte Macro + OPT_DET = 20.chr # "\024" # "\x14" # Data Entry Terminal + OPT_SUPDUP = 21.chr # "\025" # "\x15" # SUPDUP + OPT_SUPDUPOUTPUT = 22.chr # "\026" # "\x16" # SUPDUP Output + OPT_SNDLOC = 23.chr # "\027" # "\x17" # Send Location + OPT_TTYPE = 24.chr # "\030" # "\x18" # Terminal Type + OPT_EOR = 25.chr # "\031" # "\x19" # End of Record + OPT_TUID = 26.chr # "\032" # "\x1a" # TACACS User Identification + OPT_OUTMRK = 27.chr # "\e" # "\x1b" # Output Marking + OPT_TTYLOC = 28.chr # "\034" # "\x1c" # Terminal Location Number + OPT_3270REGIME = 29.chr # "\035" # "\x1d" # Telnet 3270 Regime + OPT_X3PAD = 30.chr # "\036" # "\x1e" # X.3 PAD + OPT_NAWS = 31.chr # "\037" # "\x1f" # Negotiate About Window Size + OPT_TSPEED = 32.chr # " " # "\x20" # Terminal Speed + OPT_LFLOW = 33.chr # "!" # "\x21" # Remote Flow Control + OPT_LINEMODE = 34.chr # "\"" # "\x22" # Linemode + OPT_XDISPLOC = 35.chr # "#" # "\x23" # X Display Location + OPT_OLD_ENVIRON = 36.chr # "$" # "\x24" # Environment Option + OPT_AUTHENTICATION = 37.chr # "%" # "\x25" # Authentication Option + OPT_ENCRYPT = 38.chr # "&" # "\x26" # Encryption Option + OPT_NEW_ENVIRON = 39.chr # "'" # "\x27" # New Environment Option + OPT_EXOPL = 255.chr # "\377" # "\xff" # Extended-Options-List + + NULL = "\000" + CR = "\015" + LF = "\012" + EOL = CR + LF REVISION = '$Id$' # :startdoc: @@ -174,13 +174,13 @@ module Net # provided: see below). If a block is provided, it is yielded # status messages on the attempt to connect to the server, of # the form: - # + # # Trying localhost... # Connected to localhost. # # +options+ is a hash of options. The following example lists # all options and their default values. - # + # # host = Net::Telnet::new( # "Host" => "localhost", # default: "localhost" # "Port" => 23, # default: 23 @@ -198,16 +198,16 @@ module Net # # The options have the following meanings: # - # Host:: the hostname or IP address of the host to connect to, as a String. + # Host:: the hostname or IP address of the host to connect to, as a String. # Defaults to "localhost". # # Port:: the port to connect to. Defaults to 23. # - # Binmode:: if false (the default), newline substitution is performed. + # Binmode:: if false (the default), newline substitution is performed. # Outgoing LF is # converted to CRLF, and incoming CRLF is converted to LF. If # true, this substitution is not performed. This value can - # also be set with the #binmode() method. The + # also be set with the #binmode() method. The # outgoing conversion only applies to the #puts() and #print() # methods, not the #write() method. The precise nature of # the newline conversion is also affected by the telnet options @@ -217,13 +217,13 @@ module Net # and all received traffic to. In the case of a proper # Telnet session, this will include the client input as # echoed by the host; otherwise, it only includes server - # responses. Output is appended verbatim to this file. + # responses. Output is appended verbatim to this file. # By default, no output log is kept. # # Dump_log:: as for Output_log, except that output is written in hexdump # format (16 bytes per line as hex pairs, followed by their # printable equivalent), with connection status messages - # preceded by '#', sent traffic preceded by '>', and + # preceded by '#', sent traffic preceded by '>', and # received traffic preceded by '<'. By default, not dump log # is kept. # @@ -233,7 +233,7 @@ module Net # ready to receive a new command. By default, this regular # expression is /[$%#>] \z/n. # - # Telnetmode:: a boolean value, true by default. In telnet mode, + # Telnetmode:: a boolean value, true by default. In telnet mode, # traffic received from the host is parsed for special # command sequences, and these sequences are escaped # in outgoing traffic sent using #puts() or #print() @@ -255,11 +255,11 @@ module Net # minutes), but other attempts to read data from the host # will hand indefinitely if no data is forthcoming. # - # Waittime:: the amount of time to wait after seeing what looks like a + # Waittime:: the amount of time to wait after seeing what looks like a # prompt (that is, received data that matches the Prompt # option regular expression) to see if more data arrives. # If more data does arrive in this time, Net::Telnet assumes - # that what it saw was not really a prompt. This is to try to + # that what it saw was not really a prompt. This is to try to # avoid false matches, but it can also lead to missing real # prompts (if, for instance, a background process writes to # the terminal soon after the prompt is displayed). By @@ -267,12 +267,12 @@ module Net # # Proxy:: a proxy object to used instead of opening a direct connection # to the host. Must be either another Net::Telnet object or - # an IO object. If it is another Net::Telnet object, this + # an IO object. If it is another Net::Telnet object, this # instance will use that one's socket for communication. If an # IO object, it is used directly for communication. Any other # kind of object will cause an error to be raised. # - def initialize(options) # :yield: mesg + def initialize(options) # :yield: mesg @options = options @options["Host"] = "localhost" unless @options.has_key?("Host") @options["Port"] = 23 unless @options.has_key?("Port") @@ -280,7 +280,7 @@ module Net @options["Timeout"] = 10 unless @options.has_key?("Timeout") @options["Waittime"] = 0 unless @options.has_key?("Waittime") unless @options.has_key?("Binmode") - @options["Binmode"] = false + @options["Binmode"] = false else unless (true == @options["Binmode"] or false == @options["Binmode"]) raise ArgumentError, "Binmode option must be true or false" @@ -288,7 +288,7 @@ module Net end unless @options.has_key?("Telnetmode") - @options["Telnetmode"] = true + @options["Telnetmode"] = true else unless (true == @options["Telnetmode"] or false == @options["Telnetmode"]) raise ArgumentError, "Telnetmode option must be true or false" @@ -374,7 +374,7 @@ module Net # The socket the Telnet object is using. Note that this object becomes # a delegate of the Telnet object, so normally you invoke its methods # directly on the Telnet object. - attr :sock + attr :sock # Set telnet command interpretation on (+mode+ == true) or off # (+mode+ == false), or return the current value (+mode+ not @@ -408,7 +408,7 @@ module Net def binmode(mode = nil) case mode when nil - @options["Binmode"] + @options["Binmode"] when true, false @options["Binmode"] = mode else @@ -428,7 +428,7 @@ module Net # Preprocess received data from the host. # # Performs newline conversion and detects telnet command sequences. - # Called automatically by #waitfor(). You should only use this + # Called automatically by #waitfor(). You should only use this # method yourself if you have read input directly using sysread() # or similar, and even then only if in telnet mode. def preprocess(string) @@ -494,9 +494,9 @@ module Net # Read data from the host until a certain sequence is matched. # # If a block is given, the received data will be yielded as it - # is read in (not necessarily all in one go), or nil if EOF + # is read in (not necessarily all in one go), or nil if EOF # occurs before any data is received. Whether a block is given - # or not, all data read will be returned in a single string, or again + # or not, all data read will be returned in a single string, or again # nil if EOF occurs before any data is received. Note that # received data includes the matched sequence we were looking for. # @@ -510,7 +510,7 @@ module Net # into a regular expression. Used only if Match and # Prompt are not specified. # Timeout:: the number of seconds to wait for data from the host - # before raising a TimeoutError. If set to false, + # before raising a TimeoutError. If set to false, # no timeout will occur. If not specified, the # Timeout option value specified when this instance # was created will be used, or, failing that, the @@ -527,7 +527,7 @@ module Net # EOFError will be raised. Otherwise, defaults to the old # behaviour that the function will return whatever data # has been received already, or nil if nothing was received. - # + # def waitfor(options) # :yield: recvdata time_out = @options["Timeout"] waittime = @options["Waittime"] @@ -622,7 +622,7 @@ module Net # Sends a string to the host. # # This does _not_ automatically append a newline to the string. Embedded - # newlines may be converted and telnet command sequences escaped + # newlines may be converted and telnet command sequences escaped # depending upon the values of telnetmode, binmode, and telnet options # set by the host. def print(string) @@ -657,7 +657,7 @@ module Net # data until is sees the prompt or other matched sequence. # # If a block is given, the received data will be yielded to it as - # it is read in. Whether a block is given or not, the received data + # it is read in. Whether a block is given or not, the received data # will be return as a string. Note that the received data includes # the prompt and in most cases the host's echo of our command. # @@ -702,7 +702,7 @@ module Net # # The username and password can either be provided as two string # arguments in that order, or as a hash with keys "Name" and - # "Password". + # "Password". # # This method looks for the strings "login" and "Password" from the # host to determine when to send the username and password. If the diff --git a/lib/observer.rb b/lib/observer.rb index 472a154395..ee3f01b793 100644 --- a/lib/observer.rb +++ b/lib/observer.rb @@ -7,7 +7,7 @@ # # The Observer pattern, also known as Publish/Subscribe, provides a simple # mechanism for one object to inform a set of interested third-party objects -# when its state changes. +# when its state changes. # # == Mechanism # @@ -39,14 +39,14 @@ # contracts are correct, nothing else can warn you. # # require "observer" -# +# # class Ticker ### Periodically fetch a stock price. # include Observable -# +# # def initialize(symbol) # @symbol = symbol # end -# +# # def run # lastPrice = nil # loop do @@ -67,14 +67,14 @@ # 60 + rand(80) # end # end -# +# # class Warner ### An abstract observer of Ticker objects. # def initialize(ticker, limit) # @limit = limit # ticker.add_observer(self) # end # end -# +# # class WarnLow < Warner # def update(time, price) # callback for observer # if price < @limit @@ -82,7 +82,7 @@ # end # end # end -# +# # class WarnHigh < Warner # def update(time, price) # callback for observer # if price > @limit diff --git a/lib/optparse.rb b/lib/optparse.rb index 19793f8d4d..ea1eaae52d 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -1,15 +1,15 @@ # # optparse.rb - command-line option analysis with the OptionParser class. -# +# # Author:: Nobu Nakada # Documentation:: Nobu Nakada and Gavin Sinclair. # -# See OptionParser for documentation. +# See OptionParser for documentation. # -# == Developer Documentation (not for RDoc output) -# +# == Developer Documentation (not for RDoc output) +# # === Class tree # # - OptionParser:: front end @@ -51,7 +51,7 @@ # solution. # # === Features -# +# # 1. The argument specification and the code to handle it are written in the # same place. # 2. It can output an option summary; you don't need to maintain this string @@ -88,12 +88,12 @@ # require 'optparse/time' # require 'ostruct' # require 'pp' -# +# # class OptparseExample -# +# # CODES = %w[iso-2022-jp shift_jis euc-jp utf8 binary] # CODE_ALIASES = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" } -# +# # # # # Return a structure describing the options. # # @@ -106,19 +106,19 @@ # options.encoding = "utf8" # options.transfer_type = :auto # options.verbose = false -# +# # opts = OptionParser.new do |opts| # opts.banner = "Usage: example.rb [options]" -# +# # opts.separator "" # opts.separator "Specific options:" -# +# # # Mandatory argument. # opts.on("-r", "--require LIBRARY", # "Require the LIBRARY before executing your script") do |lib| # options.library << lib # end -# +# # # Optional argument; multi-line description. # opts.on("-i", "--inplace [EXTENSION]", # "Edit ARGV files in place", @@ -127,28 +127,28 @@ # options.extension = ext || '' # options.extension.sub!(/\A\.?(?=.)/, ".") # Ensure extension begins with dot. # end -# +# # # Cast 'delay' argument to a Float. # opts.on("--delay N", Float, "Delay N seconds before executing") do |n| # options.delay = n # end -# +# # # Cast 'time' argument to a Time object. # opts.on("-t", "--time [TIME]", Time, "Begin execution at given time") do |time| # options.time = time # end -# +# # # Cast to octal integer. # opts.on("-F", "--irs [OCTAL]", OptionParser::OctalInteger, # "Specify record separator (default \\0)") do |rs| # options.record_separator = rs # end -# +# # # List of arguments. # opts.on("--list x,y,z", Array, "Example 'list' of arguments") do |list| # options.list = list # end -# +# # # Keyword completion. We are specifying a specific set of arguments (CODES # # and CODE_ALIASES - notice the latter is a Hash), and the user may provide # # the shortest unambiguous text. @@ -157,41 +157,41 @@ # " (#{code_list})") do |encoding| # options.encoding = encoding # end -# +# # # Optional argument with keyword completion. # opts.on("--type [TYPE]", [:text, :binary, :auto], # "Select transfer type (text, binary, auto)") do |t| # options.transfer_type = t # end -# +# # # Boolean switch. # opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| # options.verbose = v # end -# +# # opts.separator "" # opts.separator "Common options:" -# +# # # No argument, shows at tail. This will print an options summary. # # Try it and see! # opts.on_tail("-h", "--help", "Show this message") do # puts opts # exit # end -# +# # # Another typical switch to print the version. # opts.on_tail("--version", "Show version") do # puts OptionParser::Version.join('.') # exit # end # end -# +# # opts.parse!(args) # options # end # parse() -# +# # end # class OptparseExample -# +# # options = OptparseExample.parse(ARGV) # pp options # @@ -276,7 +276,7 @@ class OptionParser # Individual switch class. Not important to the user. # # Defined within Switch are several Switch-derived classes: NoArgument, - # RequiredArgument, etc. + # RequiredArgument, etc. # class Switch attr_reader :pattern, :conv, :short, :long, :arg, :desc, :block @@ -511,13 +511,13 @@ class OptionParser class List # Map from acceptable argument types to pattern and converter pairs. attr_reader :atype - + # Map from short style option switches to actual switch objects. attr_reader :short - + # Map from long style option switches to actual switch objects. attr_reader :long - + # List of all switches and summary string. attr_reader :list @@ -574,7 +574,7 @@ class OptionParser # # Inserts +switch+ at the head of the list, and associates short, long # and negated long options. Arguments are: - # + # # +switch+:: OptionParser::Switch instance to be inserted. # +short_opts+:: List of short style options. # +long_opts+:: List of long style options. @@ -590,7 +590,7 @@ class OptionParser # # Appends +switch+ at the tail of the list, and associates short, long # and negated long options. Arguments are: - # + # # +switch+:: OptionParser::Switch instance to be inserted. # +short_opts+:: List of short style options. # +long_opts+:: List of long style options. @@ -756,7 +756,7 @@ class OptionParser # Initializes a new instance and evaluates the optional block in context # of the instance. Arguments +args+ are passed to #new, see there for # description of parameters. - # + # # This method is *deprecated*, its behavior corresponds to the older #new # method. # @@ -1049,7 +1049,7 @@ class OptionParser # There is also a special form which matches character range (not full # set of regular expression): # "-[a-z]MANDATORY" - # "-[a-z][OPTIONAL]" + # "-[a-z][OPTIONAL]" # "-[a-z]" # # [Argument style and description:] @@ -1061,7 +1061,7 @@ class OptionParser # [Description:] # Description string for the option. # "Run verbosely" - # + # # [Handler:] # Handler for the parsed argument value. Either give a block or pass a # Proc or Method as an argument. diff --git a/lib/ostruct.rb b/lib/ostruct.rb index 0ac6852433..aea0c8e124 100644 --- a/lib/ostruct.rb +++ b/lib/ostruct.rb @@ -12,13 +12,13 @@ # OpenStruct allows you to create data objects and set arbitrary attributes. # For example: # -# require 'ostruct' +# require 'ostruct' # # record = OpenStruct.new # record.name = "John Smith" # record.age = 70 # record.pension = 300 -# +# # puts record.name # -> "John Smith" # puts record.address # -> nil # @@ -41,7 +41,7 @@ class OpenStruct # # p data # -> <OpenStruct country="Australia" population=20000000> # - # By default, the resulting OpenStruct object will have no attributes. + # By default, the resulting OpenStruct object will have no attributes. # def initialize(hash=nil) @table = {} @@ -53,7 +53,7 @@ class OpenStruct end end - # Duplicate an OpenStruct object members. + # Duplicate an OpenStruct object members. def initialize_copy(orig) super @table = @table.dup diff --git a/lib/prime.rb b/lib/prime.rb index ce71d5e00f..ec3f8fa8cb 100644 --- a/lib/prime.rb +++ b/lib/prime.rb @@ -21,9 +21,9 @@ class Integer def Integer.from_prime_division(pd) Prime.int_from_prime_division(pd) end - + # Returns the factorization of +self+. - # + # # See Prime#prime_division for more details. def prime_division(generator = Prime::Generator23.new) Prime.prime_division(self, generator) @@ -34,7 +34,7 @@ class Integer Prime.prime?(self) end - # Iterates the given block over all prime numbers. + # Iterates the given block over all prime numbers. # # See +Prime+#each for more details. def Integer.each_prime(ubound, &block) # :yields: prime @@ -51,11 +51,11 @@ end # end # # == Retrieving the instance -# +Prime+.new is obsolete. Now +Prime+ has the default instance and you can +# +Prime+.new is obsolete. Now +Prime+ has the default instance and you can # access it as +Prime+.instance. # # For convenience, each instance method of +Prime+.instance can be accessed -# as a class method of +Prime+. +# as a class method of +Prime+. # # e.g. # Prime.instance.prime?(2) #=> true @@ -64,19 +64,19 @@ end # == Generators # A "generator" provides an implementation of enumerating pseudo-prime # numbers and it remembers the position of enumeration and upper bound. -# Futhermore, it is a external iterator of prime enumeration which is +# Futhermore, it is a external iterator of prime enumeration which is # compatible to an Enumerator. # # +Prime+::+PseudoPrimeGenerator+ is the base class for generators. # There are few implementations of generator. # # [+Prime+::+EratosthenesGenerator+] -# Uses eratosthenes's sieve. +# Uses eratosthenes's sieve. # [+Prime+::+TrialDivisionGenerator+] # Uses the trial division method. # [+Prime+::+Generator23+] # Generates all positive integers which is not divided by 2 nor 3. -# This sequence is very bad as a pseudo-prime sequence. But this +# This sequence is very bad as a pseudo-prime sequence. But this # is faster and uses much less memory than other generators. So, # it is suitable for factorizing an integer which is not large but # has many prime factors. e.g. for Prime#prime? . @@ -106,23 +106,23 @@ class Prime # # == Parameters # +ubound+:: - # Optional. An arbitrary positive number. + # Optional. An arbitrary positive number. # The upper bound of enumeration. The method enumerates - # prime numbers infinitely if +ubound+ is nil. + # prime numbers infinitely if +ubound+ is nil. # +generator+:: # Optional. An implementation of pseudo-prime generator. # # == Return value # An evaluated value of the given block at the last time. # Or an enumerator which is compatible to an +Enumerator+ - # if no block given. + # if no block given. # # == Description # Calls +block+ once for each prime numer, passing the prime as # a parameter. # # +ubound+:: - # Upper bound of prime numbers. The iterator stops after + # Upper bound of prime numbers. The iterator stops after # yields all prime numbers p <= +ubound+. # # == Note @@ -156,9 +156,9 @@ class Prime # Re-composes a prime factorization and returns the product. # # == Parameters - # +pd+:: Array of pairs of integers. The each internal + # +pd+:: Array of pairs of integers. The each internal # pair consists of a prime number -- a prime factor -- - # and a natural number -- an exponent. + # and a natural number -- an exponent. # # == Example # For [[p_1, e_1], [p_2, e_2], ...., [p_n, e_n]], it returns @@ -176,7 +176,7 @@ class Prime # == Parameters # +value+:: An arbitrary integer. # +generator+:: Optional. A pseudo-prime generator. - # +generator+.succ must return the next + # +generator+.succ must return the next # pseudo-prime number in the ascendent # order. It must generate all prime numbers, # but may generate non prime numbers. @@ -185,7 +185,7 @@ class Prime # +ZeroDivisionError+:: when +value+ is zero. # # == Example - # For an arbitrary integer + # For an arbitrary integer # n = p_1**e_1 * p_2**e_2 * .... * p_n**e_n, # prime_division(n) returns # [[p_1, e_1], [p_2, e_2], ...., [p_n, e_n]]. @@ -231,9 +231,9 @@ class Prime end # returns the next pseudo-prime number, and move the internal - # position forward. + # position forward. # - # +PseudoPrimeGenerator+#succ raises +NotImplementedError+. + # +PseudoPrimeGenerator+#succ raises +NotImplementedError+. def succ raise NotImplementedError, "need to define `succ'" end @@ -278,7 +278,7 @@ class Prime end end end - + # An implementation of +PseudoPrimeGenerator+. # # Uses +EratosthenesSieve+. @@ -286,7 +286,7 @@ class Prime def initialize @last_prime = nil end - + def succ @last_prime = @last_prime ? EratosthenesSieve.instance.next_to(@last_prime) : 2 end @@ -296,13 +296,13 @@ class Prime alias next succ end - # An implementation of +PseudoPrimeGenerator+ which uses + # An implementation of +PseudoPrimeGenerator+ which uses # a prime table generated by trial division. class TrialDivisionGenerator<PseudoPrimeGenerator def initialize @index = -1 end - + def succ TrialDivision.instance[@index += 1] end @@ -315,15 +315,15 @@ class Prime # Generates all integer which are greater than 2 and # are not divided by 2 nor 3. # - # This is a pseudo-prime generator, suitable on - # checking primality of a integer by brute force + # This is a pseudo-prime generator, suitable on + # checking primality of a integer by brute force # method. class Generator23<PseudoPrimeGenerator def initialize @prime = 1 @step = nil end - + def succ loop do if (@step) @@ -358,7 +358,7 @@ class Prime # There must be no primes between @primes[-1] and @next_to_check. @primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101] - # @next_to_check % 6 must be 1. + # @next_to_check % 6 must be 1. @next_to_check = 103 # @primes[-1] - @primes[-1] % 6 + 7 @ulticheck_index = 3 # @primes.index(@primes.reverse.find {|n| # n < Math.sqrt(@@next_to_check) }) @@ -372,7 +372,7 @@ class Prime alias primes cache alias primes_so_far cache - # Returns the +index+th prime number. + # Returns the +index+th prime number. # # +index+ is a 0-based index. def [](index) @@ -390,7 +390,7 @@ class Prime @primes.push @next_to_check if @primes[2..@ulticheck_index].find {|prime| @next_to_check % prime == 0 }.nil? @next_to_check += 4 @primes.push @next_to_check if @primes[2..@ulticheck_index].find {|prime| @next_to_check % prime == 0 }.nil? - @next_to_check += 2 + @next_to_check += 2 end return @primes[index] end diff --git a/lib/pstore.rb b/lib/pstore.rb index fdc518eaec..7b7080338e 100644 --- a/lib/pstore.rb +++ b/lib/pstore.rb @@ -15,49 +15,49 @@ require "thread" # # PStore implements a file based persistence mechanism based on a Hash. User # code can store hierarchies of Ruby objects (values) into the data store file -# by name (keys). An object hierarchy may be just a single object. User code +# by name (keys). An object hierarchy may be just a single object. User code # may later read values back from the data store or even update data, as needed. -# +# # The transactional behavior ensures that any changes succeed or fail together. # This can be used to ensure that the data store is not left in a transitory # state, where some values were updated but others were not. -# -# Behind the scenes, Ruby objects are stored to the data store file with -# Marshal. That carries the usual limitations. Proc objects cannot be +# +# Behind the scenes, Ruby objects are stored to the data store file with +# Marshal. That carries the usual limitations. Proc objects cannot be # marshalled, for example. # # == Usage example: -# +# # require "pstore" -# +# # # a mock wiki object... # class WikiPage # def initialize( page_name, author, contents ) # @page_name = page_name # @revisions = Array.new -# +# # add_revision(author, contents) # end -# +# # attr_reader :page_name -# +# # def add_revision( author, contents ) # @revisions << { :created => Time.now, # :author => author, # :contents => contents } # end -# +# # def wiki_page_references # [@page_name] + @revisions.last[:contents].scan(/\b(?:[A-Z]+[a-z]+){2,}/) # end -# +# # # ... # end -# +# # # create a new page... # home_page = WikiPage.new( "HomePage", "James Edward Gray II", # "A page about the JoysOfDocumentation..." ) -# +# # # then we want to update page data and the index together, or not at all... # wiki = PStore.new("wiki_pages.pstore") # wiki.transaction do # begin transaction; do all of this or none of it @@ -68,9 +68,9 @@ require "thread" # # update wiki index... # wiki[:wiki_index].push(*home_page.wiki_page_references) # end # commit changes to wiki data store file -# +# # ### Some time later... ### -# +# # # read wiki data... # wiki.transaction(true) do # begin read-only transaction, no changes allowed # wiki.roots.each do |data_root_name| @@ -102,7 +102,7 @@ class PStore # The error type thrown by all PStore methods. class Error < StandardError end - + # Whether PStore should do its best to prevent file corruptions, even when under # unlikely-to-occur error conditions such as out-of-space conditions and other # unusual OS filesystem errors. Setting this flag comes at the price in the form @@ -112,13 +112,13 @@ class PStore # all POSIX platforms: Linux, MacOS X, FreeBSD, etc). The default value is false. attr_accessor :ultra_safe - # - # To construct a PStore object, pass in the _file_ path where you would like + # + # To construct a PStore object, pass in the _file_ path where you would like # the data to be stored. # # PStore objects are always reentrant. But if _thread_safe_ is set to true, # then it will become thread-safe at the cost of a minor performance hit. - # + # def initialize(file, thread_safe = false) dir = File::dirname(file) unless File::directory? dir @@ -142,10 +142,10 @@ class PStore def in_transaction raise PStore::Error, "not in transaction" unless @transaction end - # + # # Raises PStore::Error if the calling code is not in a PStore#transaction or # if the code is in a read-only PStore#transaction. - # + # def in_transaction_wr() in_transaction() raise PStore::Error, "in read-only transaction" if @rdonly @@ -153,9 +153,9 @@ class PStore private :in_transaction, :in_transaction_wr # - # Retrieves a value from the PStore file data, by _name_. The hierarchy of + # Retrieves a value from the PStore file data, by _name_. The hierarchy of # Ruby objects stored under that root _name_ will be returned. - # + # # *WARNING*: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # @@ -164,12 +164,12 @@ class PStore @table[name] end # - # This method is just like PStore#[], save that you may also provide a - # _default_ value for the object. In the event the specified _name_ is not - # found in the data store, your _default_ will be returned instead. If you do - # not specify a default, PStore::Error will be raised if the object is not + # This method is just like PStore#[], save that you may also provide a + # _default_ value for the object. In the event the specified _name_ is not + # found in the data store, your _default_ will be returned instead. If you do + # not specify a default, PStore::Error will be raised if the object is not # found. - # + # # *WARNING*: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # @@ -188,11 +188,11 @@ class PStore # Stores an individual Ruby object or a hierarchy of Ruby objects in the data # store file under the root _name_. Assigning to a _name_ already in the data # store clobbers the old data. - # + # # == Example: - # + # # require "pstore" - # + # # store = PStore.new("data_file.pstore") # store.transaction do # begin transaction # # load some data into the store... @@ -200,7 +200,7 @@ class PStore # store[:obj_heirarchy] = { "Kev Jackson" => ["rational.rb", "pstore.rb"], # "James Gray" => ["erb.rb", "pstore.rb"] } # end # commit changes to data store file - # + # # *WARNING*: This method is only valid in a PStore#transaction and it cannot # be read-only. It will raise PStore::Error if called at any other time. # @@ -210,7 +210,7 @@ class PStore end # # Removes an object hierarchy from the data store, by _name_. - # + # # *WARNING*: This method is only valid in a PStore#transaction and it cannot # be read-only. It will raise PStore::Error if called at any other time. # @@ -221,7 +221,7 @@ class PStore # # Returns the names of all object hierarchies currently in the store. - # + # # *WARNING*: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # @@ -231,7 +231,7 @@ class PStore end # # Returns true if the supplied _name_ is currently in the data store. - # + # # *WARNING*: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # @@ -247,22 +247,22 @@ class PStore # # Ends the current PStore#transaction, committing any changes to the data # store immediately. - # + # # == Example: - # + # # require "pstore" - # + # # store = PStore.new("data_file.pstore") # store.transaction do # begin transaction # # load some data into the store... # store[:one] = 1 # store[:two] = 2 - # + # # store.commit # end transaction here, committing changes - # + # # store[:three] = 3 # this change is never reached # end - # + # # *WARNING*: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # @@ -274,21 +274,21 @@ class PStore # # Ends the current PStore#transaction, discarding any changes to the data # store. - # + # # == Example: - # + # # require "pstore" - # + # # store = PStore.new("data_file.pstore") # store.transaction do # begin transaction # store[:one] = 1 # this change is not applied, see below... # store[:two] = 2 # this change is not applied, see below... - # + # # store.abort # end transaction here, discard all changes - # + # # store[:three] = 3 # this change is never reached # end - # + # # *WARNING*: This method is only valid in a PStore#transaction. It will # raise PStore::Error if called at any other time. # @@ -300,19 +300,19 @@ class PStore # # Opens a new transaction for the data store. Code executed inside a block - # passed to this method may read and write data to and from the data store + # passed to this method may read and write data to and from the data store # file. - # + # # At the end of the block, changes are committed to the data store - # automatically. You may exit the transaction early with a call to either + # automatically. You may exit the transaction early with a call to either # PStore#commit or PStore#abort. See those methods for details about how - # changes are handled. Raising an uncaught Exception in the block is + # changes are handled. Raising an uncaught Exception in the block is # equivalent to calling PStore#abort. - # + # # If _read_only_ is set to +true+, you will only be allowed to read from the # data store during the transaction and any attempts to change the data will # raise a PStore::Error. - # + # # Note that PStore does not support nested transactions. # def transaction(read_only = false, &block) # :yields: pstore @@ -326,11 +326,11 @@ class PStore if file begin @table, checksum, original_data_size = load_data(file, read_only) - + catch(:pstore_abort_transaction) do value = yield(self) end - + if !@abort && !read_only save_data(checksum, original_data_size, file) end @@ -349,19 +349,19 @@ class PStore ensure @transaction = false end - + private # Constant for relieving Ruby's garbage collector. EMPTY_STRING = "" EMPTY_MARSHAL_DATA = Marshal.dump({}) EMPTY_MARSHAL_CHECKSUM = Digest::MD5.digest(EMPTY_MARSHAL_DATA) - + class DummyMutex def synchronize yield end end - + # # Open the specified filename (either in read-only mode or in # read-write mode) and lock it for reading or writing. @@ -391,7 +391,7 @@ class PStore return file end end - + # Load the given PStore file. # If +read_only+ is true, the unmarshalled Hash will be returned. # If +read_only+ is false, a 3-tuple will be returned: the unmarshalled @@ -427,7 +427,7 @@ class PStore [table, checksum, size] end end - + def on_windows? is_windows = RUBY_PLATFORM =~ /mswin/ || RUBY_PLATFORM =~ /mingw/ || @@ -438,7 +438,7 @@ class PStore end is_windows end - + # Check whether Marshal.dump supports the 'canonical' option. This option # makes sure that Marshal.dump always dumps data structures in the same order. # This is important because otherwise, the checksums that we generate may differ. @@ -454,7 +454,7 @@ class PStore end result end - + def save_data(original_checksum, original_file_size, file) # We only want to save the new data if the size or checksum has changed. # This results in less filesystem calls, which is good for performance. @@ -464,7 +464,7 @@ class PStore new_data = dump(@table) end new_checksum = Digest::MD5.digest(new_data) - + if new_data.size != original_file_size || new_checksum != original_checksum if @ultra_safe && !on_windows? # Windows doesn't support atomic file renames. @@ -473,10 +473,10 @@ class PStore save_data_with_fast_strategy(new_data, file) end end - + new_data.replace(EMPTY_STRING) end - + def save_data_with_atomic_file_rename_strategy(data, file) temp_filename = "#{@filename}.tmp.#{Process.pid}.#{rand 1000000}" temp_file = File.new(temp_filename, WR_ACCESS) @@ -492,7 +492,7 @@ class PStore temp_file.close end end - + def save_data_with_fast_strategy(data, file) file.rewind file.truncate(0) diff --git a/lib/racc/parser.rb b/lib/racc/parser.rb index e87a250e56..fc9b390d59 100644 --- a/lib/racc/parser.rb +++ b/lib/racc/parser.rb @@ -388,7 +388,7 @@ module Racc toks.each {|t| out.print ' ', racc_token2str(t) } end out.puts " --> #{racc_token2str(sim)}" - + racc_print_stacks tstack, vstack @racc_debug_out.puts end diff --git a/lib/rake.rb b/lib/rake.rb index d46c49d526..337dc3dacf 100755 --- a/lib/rake.rb +++ b/lib/rake.rb @@ -115,7 +115,7 @@ class String File.join(partial_dirs) end protected :pathmap_partial - + # Preform the pathmap replacement operations on the given path. The # patterns take the form 'pat1,rep1;pat2,rep2...'. def pathmap_replace(patterns, &block) @@ -362,9 +362,9 @@ module Rake def inspect to_s end - + protected - + def lookup(name) if @hash.has_key?(name) @hash[name] @@ -1734,7 +1734,7 @@ module Rake [task_name, arg_names, []] end private :resolve_args_without_dependencies - + # Resolve task arguments for a task or rule when there are # dependencies declared. # @@ -1765,7 +1765,7 @@ module Rake [task_name, arg_names, deps] end private :resolve_args_with_dependencies - + # If a rule can be found that matches the task name, enhance the # task with the prerequisites and actions from the rule. Set the # source attribute of the task appropriately for the rule. Return @@ -2108,7 +2108,7 @@ module Rake 80 end - # Calculate the dynamic width of the + # Calculate the dynamic width of the def dynamic_width @dynamic_width ||= (dynamic_width_stty.nonzero? || dynamic_width_tput) end @@ -2124,7 +2124,7 @@ module Rake def unix? RUBY_PLATFORM =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i end - + def windows? Win32.windows? end @@ -2184,7 +2184,7 @@ module Rake ], ['--execute-continue', '-E CODE', "Execute some Ruby code, then continue with normal task processing.", - lambda { |value| eval(value) } + lambda { |value| eval(value) } ], ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.", lambda { |value| $:.push(value) } @@ -2196,9 +2196,9 @@ module Rake lambda { |value| verbose(false) } ], ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.", - lambda { |value| + lambda { |value| value ||= '' - @rakefiles.clear + @rakefiles.clear @rakefiles << value } ], @@ -2272,12 +2272,12 @@ module Rake opts.banner = "rake [-f rakefile] {options} targets..." opts.separator "" opts.separator "Options are ..." - + opts.on_tail("-h", "--help", "-H", "Display this help message.") do puts opts exit end - + standard_rake_options.each { |args| opts.on(*args) } parsed_argv = opts.parse(ARGV) @@ -2365,7 +2365,7 @@ module Rake end end end - + # The standard directory containing system wide rake files. if Win32.windows? def standard_system_dir #:nodoc: diff --git a/lib/rake/clean.rb b/lib/rake/clean.rb index 4ee2c5ac95..fd751dceb2 100644 --- a/lib/rake/clean.rb +++ b/lib/rake/clean.rb @@ -16,8 +16,8 @@ require 'rake' CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"] -CLEAN.clear_exclude.exclude { |fn| - fn.pathmap("%f") == 'core' && File.directory?(fn) +CLEAN.clear_exclude.exclude { |fn| + fn.pathmap("%f") == 'core' && File.directory?(fn) } desc "Remove any temporary products." diff --git a/lib/rake/gempackagetask.rb b/lib/rake/gempackagetask.rb index 1e4632a26b..00b0157547 100644 --- a/lib/rake/gempackagetask.rb +++ b/lib/rake/gempackagetask.rb @@ -35,10 +35,10 @@ module Rake # s.files = PKG_FILES # s.description = <<EOF # Rake is a Make-like program implemented in Ruby. Tasks - # and dependencies are specified in standard Ruby syntax. + # and dependencies are specified in standard Ruby syntax. # EOF # end - # + # # Rake::GemPackageTask.new(spec) do |pkg| # pkg.need_zip = true # pkg.need_tar = true @@ -84,7 +84,7 @@ module Rake } end end - + def gem_file if @gem_spec.platform == Gem::Platform::RUBY "#{package_name}.gem" @@ -92,6 +92,6 @@ module Rake "#{package_name}-#{@gem_spec.platform}.gem" end end - + end end diff --git a/lib/rake/packagetask.rb b/lib/rake/packagetask.rb index 6158eaf3f6..f05f7cd49e 100644 --- a/lib/rake/packagetask.rb +++ b/lib/rake/packagetask.rb @@ -25,13 +25,13 @@ module Rake # of date. # # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tgz"</b>] - # Create a gzipped tar package (if <em>need_tar</em> is true). + # Create a gzipped tar package (if <em>need_tar</em> is true). # # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.gz"</b>] - # Create a gzipped tar package (if <em>need_tar_gz</em> is true). + # Create a gzipped tar package (if <em>need_tar_gz</em> is true). # # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.bz2"</b>] - # Create a bzip2'd tar package (if <em>need_tar_bz2</em> is true). + # Create a bzip2'd tar package (if <em>need_tar_bz2</em> is true). # # [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.zip"</b>] # Create a zip package archive (if <em>need_zip</em> is true). @@ -74,7 +74,7 @@ module Rake # Zip command for zipped archives. The default is 'zip'. attr_accessor :zip_command - # Create a Package Task with the given name and version. + # Create a Package Task with the given name and version. def initialize(name=nil, version=nil) init(name, version) yield self if block_given? @@ -102,11 +102,11 @@ module Rake desc "Build all the packages" task :package - + desc "Force a rebuild of the package files" task :repackage => [:clobber_package, :package] - - desc "Remove package products" + + desc "Remove package products" task :clobber_package do rm_r package_dir rescue nil end @@ -128,7 +128,7 @@ module Rake end end end - + if need_zip task :package => ["#{package_dir}/#{zip_file}"] file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do @@ -160,7 +160,7 @@ module Rake def package_name @version ? "#{@name}-#{@version}" : @name end - + def package_dir_path "#{package_dir}/#{package_name}" end diff --git a/lib/rake/rdoctask.rb b/lib/rake/rdoctask.rb index 6cfbda1d6a..6c751a7cba 100644 --- a/lib/rake/rdoctask.rb +++ b/lib/rake/rdoctask.rb @@ -11,7 +11,7 @@ module Rake # The RDocTask will create the following targets: # # [<b><em>rdoc</em></b>] - # Main task for this RDOC task. + # Main task for this RDOC task. # # [<b>:clobber_<em>rdoc</em></b>] # Delete all the rdoc files. This target is automatically @@ -80,7 +80,7 @@ module Rake yield self if block_given? define end - + # Create the tasks defined by this task lib. def define if name.to_s != "rdoc" @@ -89,17 +89,17 @@ module Rake desc "Build the #{name} HTML Files" task name - + desc "Force a rebuild of the RDOC files" task "re#{name}" => ["clobber_#{name}", name] - - desc "Remove rdoc products" + + desc "Remove rdoc products" task "clobber_#{name}" do rm_r rdoc_dir rescue nil end - + task :clobber => ["clobber_#{name}"] - + directory @rdoc_dir task name => [rdoc_target] file rdoc_target => @rdoc_files + [Rake.application.rakefile] do diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb index 79154e422b..f1e4f0b15d 100644 --- a/lib/rake/testtask.rb +++ b/lib/rake/testtask.rb @@ -10,7 +10,7 @@ module Rake # Create a task that runs a set of tests. # # Example: - # + # # Rake::TestTask.new do |t| # t.libs << "test" # t.test_files = FileList['test/test*.rb'] @@ -63,7 +63,7 @@ module Rake # * :rake -- Rake provided test loading script (default). # * :testrb -- Ruby provided test loading script. # * :direct -- Load tests using command line loader. - # + # attr_accessor :loader # Array of commandline options to pass to ruby when running test loader. diff --git a/lib/rbconfig/datadir.rb b/lib/rbconfig/datadir.rb index 5b8f07754a..040adc09a9 100644 --- a/lib/rbconfig/datadir.rb +++ b/lib/rbconfig/datadir.rb @@ -10,7 +10,7 @@ module Config # Only define datadir if it doesn't already exist. unless Config.respond_to?(:datadir) - + # Return the path to the data directory associated with the given # package name. Normally this is just # "#{Config::CONFIG['datadir']}/#{package_name}", but may be diff --git a/lib/rdoc.rb b/lib/rdoc.rb index f4fc3867cf..043d3420be 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -69,7 +69,7 @@ $DEBUG_RDOC = nil # always will override those in +RDOCOPT+. # # Run -# +# # % rdoc --help # # for full details on rdoc's options. @@ -96,7 +96,7 @@ $DEBUG_RDOC = nil # # =begin rdoc # Documentation to be processed by RDoc. -# +# # ... # =end # @@ -112,7 +112,7 @@ $DEBUG_RDOC = nil # # FIXME: fails if the birthday falls on February 29th # #++ # # The DOB is returned as a Time object. -# +# # def get_dob(person) # # ... # end @@ -138,7 +138,7 @@ $DEBUG_RDOC = nil # # def fred # :yields: index, position # # ... -# +# # yield line, address # # which will get documented as @@ -251,12 +251,12 @@ $DEBUG_RDOC = nil # module also will be omitted. By default, though, modules and # classes within that class of module _will_ be documented. This is # turned off by adding the +all+ modifier. -# +# # module MyModule # :nodoc: # class Input # end # end -# +# # module OtherModule # :nodoc: all # class Output # end @@ -290,7 +290,7 @@ $DEBUG_RDOC = nil # comment block may have one or more lines before the :section: directive. # These will be removed, and any identical lines at the end of the block are # also removed. This allows you to add visual cues such as: -# +# # # ---------------------------------------- # # :section: My Section # # This is the section that I wrote. diff --git a/lib/rdoc/code_objects.rb b/lib/rdoc/code_objects.rb index 0916b03398..3fdd86314d 100644 --- a/lib/rdoc/code_objects.rb +++ b/lib/rdoc/code_objects.rb @@ -340,7 +340,7 @@ module RDoc meth.add_alias(new_meth) add_method(new_meth) end - + def add_alias(an_alias) meth = find_instance_method_named(an_alias.old_name) @@ -453,7 +453,7 @@ module RDoc @method_list.each {|m| yield m} end - def each_attribute + def each_attribute @attributes.each {|a| yield a} end @@ -658,7 +658,7 @@ module RDoc def self.find_class_named(name) @@all_classes.each_value do |c| - res = c.find_class_named(name) + res = c.find_class_named(name) return res if res end nil @@ -767,7 +767,7 @@ module RDoc raise NoMethodError, "#{full_name} is a module" if module? if @superclass.nil? or @superclass == 'Object' then - @superclass = superclass + @superclass = superclass end end diff --git a/lib/rdoc/diagram.rb b/lib/rdoc/diagram.rb index 4aa2ec5656..d308d36dee 100644 --- a/lib/rdoc/diagram.rb +++ b/lib/rdoc/diagram.rb @@ -313,7 +313,7 @@ module RDoc def wrap_in_image_map(src, dot) res = "" dot_map = `dot -Tismap #{src}` - + if(!dot_map.empty?) res << %{<map id="map" name="map">\n} dot_map.split($/).each do |area| diff --git a/lib/rdoc/generator.rb b/lib/rdoc/generator.rb index d695e661d1..86196b4cf6 100644 --- a/lib/rdoc/generator.rb +++ b/lib/rdoc/generator.rb @@ -137,7 +137,7 @@ module RDoc::Generator end RDoc::TopLevel.all_classes_and_modules.each do |cls| - build_class_list(classes, options, cls, files[0], + build_class_list(classes, options, cls, files[0], RDoc::Generator::CLASS_DIR) end diff --git a/lib/rdoc/generator/chm/chm.rb b/lib/rdoc/generator/chm/chm.rb index cceeca5dfc..c362318d91 100644 --- a/lib/rdoc/generator/chm/chm.rb +++ b/lib/rdoc/generator/chm/chm.rb @@ -6,7 +6,7 @@ module RDoc::Generator::CHM::CHM HTML = RDoc::Generator::HTML::HTML INDEX = HTML::INDEX - + STYLE = HTML::STYLE CLASS_INDEX = HTML::CLASS_INDEX diff --git a/lib/rdoc/generator/html.rb b/lib/rdoc/generator/html.rb index d136de7b00..60e0c175fe 100644 --- a/lib/rdoc/generator/html.rb +++ b/lib/rdoc/generator/html.rb @@ -305,9 +305,9 @@ class RDoc::Generator::HTML open 'index.html', 'w' do |f| style_url = style_url '', @options.css - + classes = @classes.sort.map { |klass| klass.value_hash } - + values = { 'initial_page' => @main_url, 'style_url' => style_url('', @options.css), @@ -315,7 +315,7 @@ class RDoc::Generator::HTML 'charset' => @options.charset, 'classes' => classes, } - + values['inline_source'] = @options.inline_source main.write_html_on f, values diff --git a/lib/rdoc/generator/html/hefss.rb b/lib/rdoc/generator/html/hefss.rb index 540c23d869..01425a4556 100644 --- a/lib/rdoc/generator/html/hefss.rb +++ b/lib/rdoc/generator/html/hefss.rb @@ -125,9 +125,9 @@ EOF STYLE = FACTORY.get_STYLE() METHOD_LIST = FACTORY.get_METHOD_LIST() - + BODY = FACTORY.get_BODY() - + FILE_PAGE = FACTORY.get_FILE_PAGE() CLASS_PAGE = FACTORY.get_CLASS_PAGE() diff --git a/lib/rdoc/generator/html/html.rb b/lib/rdoc/generator/html/html.rb index 823d8056e7..5e5b4d5531 100644 --- a/lib/rdoc/generator/html/html.rb +++ b/lib/rdoc/generator/html/html.rb @@ -11,7 +11,7 @@ require 'rdoc/generator/html/common' # '[source]' link. # # This template *also* forms the basis of the frameless template. -# +# # == Authors # # * Michael Granger <ged@FaerieMUD.org> diff --git a/lib/rdoc/generator/html/kilmer.rb b/lib/rdoc/generator/html/kilmer.rb index 4c5a9ee8b0..233a9259a2 100644 --- a/lib/rdoc/generator/html/kilmer.rb +++ b/lib/rdoc/generator/html/kilmer.rb @@ -126,9 +126,9 @@ EOF STYLE = FACTORY.get_STYLE() METHOD_LIST = FACTORY.get_METHOD_LIST() - + BODY = FACTORY.get_BODY() - + FILE_PAGE = FACTORY.get_FILE_PAGE() CLASS_PAGE = FACTORY.get_CLASS_PAGE() diff --git a/lib/rdoc/generator/html/kilmerfactory.rb b/lib/rdoc/generator/html/kilmerfactory.rb index ef6f3f3b4d..1407840839 100644 --- a/lib/rdoc/generator/html/kilmerfactory.rb +++ b/lib/rdoc/generator/html/kilmerfactory.rb @@ -61,8 +61,8 @@ class RDoc::Generator::HTML::KilmerFactory # If not supplied, this defaults to "Attributes". # attr_reader :attribute_list_heading - - # + + # # ====Description: # This method constructs a KilmerFactory instance, which # can be used to build Kilmer-style template classes. @@ -72,7 +72,7 @@ class RDoc::Generator::HTML::KilmerFactory # ====Parameters: # [style_attributes] # A Hash describing the appearance of the Kilmer-style. - # + # def initialize(style_attributes) @central_css = style_attributes[:central_css] if(!@central_css) @@ -103,7 +103,7 @@ class RDoc::Generator::HTML::KilmerFactory def get_STYLE return @central_css end - + def get_METHOD_LIST return %{ <% if values["diagram"] then %> diff --git a/lib/rdoc/generator/html/one_page_html.rb b/lib/rdoc/generator/html/one_page_html.rb index 51ae32351a..5bae2f34f7 100644 --- a/lib/rdoc/generator/html/one_page_html.rb +++ b/lib/rdoc/generator/html/one_page_html.rb @@ -54,7 +54,7 @@ module RDoc::Generator::HTML::ONE_PAGE_HTML <% sections["method_list"].each do |method_list| %> <% if method_list["methods"] then %> <% method_list["methods"].each do |methods| %> -<h4><%= methods["type"] %> <%= methods["category"] %> method: +<h4><%= methods["type"] %> <%= methods["category"] %> method: <% if methods["callseq"] then %> <a name="<%= methods["aref"] %>"><%= methods["callseq"] %></a> <% end %> diff --git a/lib/rdoc/generator/texinfo.rb b/lib/rdoc/generator/texinfo.rb index 70db875af9..99a1452f21 100644 --- a/lib/rdoc/generator/texinfo.rb +++ b/lib/rdoc/generator/texinfo.rb @@ -51,7 +51,7 @@ module RDoc def initialize(values, file = 'texinfo.erb') @v, @file = [values, file] end - + def template ::File.read(::File.join(BASE_DIR, 'texinfo', @file)) end diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb index 9d22b38946..a584a79b75 100644 --- a/lib/rdoc/markup.rb +++ b/lib/rdoc/markup.rb @@ -27,9 +27,9 @@ require 'rdoc' # convert multiple input strings. # # require 'rdoc/markup/to_html' -# +# # h = RDoc::Markup::ToHtml.new -# +# # puts h.convert(input_string) # # You can extend the RDoc::Markup parser to recognise new markup @@ -41,22 +41,22 @@ require 'rdoc' # # require 'rdoc/markup' # require 'rdoc/markup/to_html' -# +# # class WikiHtml < RDoc::Markup::ToHtml # def handle_special_WIKIWORD(special) # "<font color=red>" + special.text + "</font>" # end # end -# +# # m = RDoc::Markup.new # m.add_word_pair("{", "}", :STRIKE) # m.add_html("no", :STRIKE) -# +# # m.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD) -# +# # wh = WikiHtml.new # wh.add_tag(:STRIKE, "<strike>", "</strike>") -# +# # puts "<body>#{wh.convert ARGF.read}</body>" # #-- diff --git a/lib/rdoc/markup/fragments.rb b/lib/rdoc/markup/fragments.rb index b7f9b605c8..0031b809b4 100644 --- a/lib/rdoc/markup/fragments.rb +++ b/lib/rdoc/markup/fragments.rb @@ -203,7 +203,7 @@ class RDoc::Markup # normal paragraph text. # # this is code - # + # # and more code # # You'll end up with the fragments Paragraph, BlankLine, Verbatim, diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index dce7a69b12..0165042d84 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -309,7 +309,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter # convert -- to em-dash, (-- to en-dash) gsub(/---?/, '—'). #gsub(/--/, '–'). - + # convert ... to elipsis (and make sure .... becomes .<elipsis>) gsub(/\.\.\.\./, '.…').gsub(/\.\.\./, '…'). diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb index dc64b30da1..e73fbf5c8f 100644 --- a/lib/rdoc/markup/to_html_crossref.rb +++ b/lib/rdoc/markup/to_html_crossref.rb @@ -10,7 +10,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml attr_accessor :context # Regular expressions to match class and method references. - # + # # 1.) There can be a '\' in front of text to suppress # any cross-references (note, however, that the single '\' # is written as '\\\\' in order to escape it twice, once diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index 1d92bd4748..2b069f4265 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -65,7 +65,7 @@ class RDoc::Options # Formatter to mark up text with attr_accessor :formatter - + ## # image format for diagrams diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb index 6b1233c62d..275d3cc8f9 100644 --- a/lib/rdoc/parser.rb +++ b/lib/rdoc/parser.rb @@ -22,14 +22,14 @@ require 'rdoc/stats' # following incantation # # require "rdoc/parser" -# +# # class RDoc::Parser::Xyz < RDoc::Parser # parse_files_matching /\.xyz$/ # <<<< -# +# # def initialize(file_name, body, options) # ... # end -# +# # def scan # ... # end diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 933838debd..c3fb5e5b19 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -79,7 +79,7 @@ require 'rdoc/known_classes' # * Encapsulate the writing and reading of the configuration # * file. ... # */ -# +# # /* # * Document-method: read_value # * @@ -124,7 +124,7 @@ class RDoc::Parser::C < RDoc::Parser end def do_classes - @content.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do + @content.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do |var_name, class_name| handle_class_module(var_name, "module", class_name, nil, nil) end diff --git a/lib/rdoc/parser/f95.rb b/lib/rdoc/parser/f95.rb index fd372b098b..0959db4936 100644 --- a/lib/rdoc/parser/f95.rb +++ b/lib/rdoc/parser/f95.rb @@ -79,17 +79,17 @@ require 'rdoc/parser' # ! # ! Comment blocks for the modules (or the programs). # ! -# +# # private -# +# # logical :: a ! a private variable # real, public :: b ! a public variable # integer, parameter :: c = 0 ! a public constant -# +# # public :: c # public :: MULTI_ARRAY # public :: hoge, foo -# +# # type MULTI_ARRAY # ! # ! Comment blocks for the derived-types. @@ -97,9 +97,9 @@ require 'rdoc/parser' # real, pointer :: var(:) =>null() ! Comments block for the variables. # integer :: num = 0 # end type MULTI_ARRAY -# +# # contains -# +# # subroutine hoge( in, & ! Comment blocks between continuation lines are ignored. # & out ) # ! @@ -109,32 +109,32 @@ require 'rdoc/parser' # character(*),intent(out),allocatable,target :: in # ! Comment blocks can be # ! written under Fortran statements. -# +# # character(32) :: file ! This comment parsed as a variable in below NAMELIST. # integer :: id -# +# # namelist /varinfo_nml/ file, id # ! # ! Comment blocks for the NAMELISTs. # ! Information about variables are described above. # ! -# +# # .... -# +# # end subroutine hoge -# +# # integer function foo( in ) # ! # ! This part is considered as comment block. -# +# # ! Comment blocks under blank lines are ignored. # ! # integer, intent(in):: inA ! This part is considered as comment block. -# +# # ! This part is ignored. -# +# # end function foo -# +# # subroutine hide( in, & # & out ) !:nodoc: # ! @@ -145,11 +145,11 @@ require 'rdoc/parser' # ! defined operators, defined assignments, # ! list of imported modules ("use" statement). # ! -# +# # .... -# +# # end subroutine hide -# +# # end module hogehoge class RDoc::Parser::F95 < RDoc::Parser @@ -295,7 +295,7 @@ class RDoc::Parser::F95 < RDoc::Parser @stats.add_module f9x_module - f9x_comment = COMMENTS_ARE_UPPER ? + f9x_comment = COMMENTS_ARE_UPPER ? find_comments(pre_comment.join("\n")) + "\n" + module_trailing : module_trailing + "\n" + find_comments(module_code.sub(/^.*$\n/i, '')) f9x_module.comment = f9x_comment @@ -320,8 +320,8 @@ class RDoc::Parser::F95 < RDoc::Parser program_code = module_program_code program_trailing = module_program_trailing # progress "p" # HACK what stats thingy does this correspond to? - program_comment = COMMENTS_ARE_UPPER ? - find_comments(pre_comment.join("\n")) + "\n" + program_trailing : + program_comment = COMMENTS_ARE_UPPER ? + find_comments(pre_comment.join("\n")) + "\n" + program_trailing : program_trailing + "\n" + find_comments(program_code.sub(/^.*$\n/i, '')) program_comment = "\n\n= <i>Program</i> <tt>#{program_name}</tt>\n\n" \ + program_comment @@ -410,12 +410,12 @@ class RDoc::Parser::F95 < RDoc::Parser # This information is used when "add_method" and # "set_visibility_for" are called. # - visibility_default, visibility_info = + visibility_default, visibility_info = parse_visibility(remaining_lines.join("\n"), visibility, container) @@public_methods.concat visibility_info if visibility_default == :public if !cascaded_modules_list.empty? - cascaded_modules = + cascaded_modules = Attr.new("Cascaded Modules", "Imported modules all of whose components are published again", "", @@ -499,7 +499,7 @@ class RDoc::Parser::F95 < RDoc::Parser type_trailing = find_comments($4) next if type_trailing =~ /^:nodoc:/ type_visibility = $1 - type_comment = COMMENTS_ARE_UPPER ? + type_comment = COMMENTS_ARE_UPPER ? find_comments($~.pre_match) + "\n" + type_trailing : type_trailing + "\n" + find_comments(type_code.sub(/^.*$\n/i, '')) type_element_visibility_public = true @@ -567,8 +567,8 @@ class RDoc::Parser::F95 < RDoc::Parser end if !derived_types_comment.empty? - derived_types_table = - Attr.new("Derived Types", "Derived_Types", "", + derived_types_table = + Attr.new("Derived Types", "Derived_Types", "", derived_types_comment) container.add_attribute(derived_types_table) end @@ -733,8 +733,8 @@ class RDoc::Parser::F95 < RDoc::Parser subroutine_trailing = procedure_trailing subroutine_code = procedure_code - subroutine_comment = COMMENTS_ARE_UPPER ? - pre_comment.join("\n") + "\n" + subroutine_trailing : + subroutine_comment = COMMENTS_ARE_UPPER ? + pre_comment.join("\n") + "\n" + subroutine_trailing : subroutine_trailing + "\n" + subroutine_code.sub(/^.*$\n/i, '') subroutine = AnyMethod.new("subroutine", subroutine_name) parse_subprogram(subroutine, subroutine_params, @@ -787,7 +787,7 @@ class RDoc::Parser::F95 < RDoc::Parser # The visibility of procedure is specified # - set_visibility(container, procedure_name, + set_visibility(container, procedure_name, visibility_default, @@public_methods) # The alias for this procedure from external modules @@ -871,11 +871,11 @@ class RDoc::Parser::F95 < RDoc::Parser next if !old_meth nolink = old_meth.visibility == :private ? true : nil nolink = nil if @options.show_all - new_meth = - initialize_external_method(generic_name, proc, - old_meth.params, nil, - old_meth.comment, - old_meth.clone.token_stream[0].text, + new_meth = + initialize_external_method(generic_name, proc, + old_meth.params, nil, + old_meth.comment, + old_meth.clone.token_stream[0].text, true, nolink) new_meth.singleton = old_meth.singleton @@ -937,10 +937,10 @@ class RDoc::Parser::F95 < RDoc::Parser end if indicated_method - external_method = - initialize_external_method(generic_name, proc, - indicated_method.params, - indicated_file, + external_method = + initialize_external_method(generic_name, proc, + indicated_method.params, + indicated_file, indicated_method.comment) @stats.add_method external_method @@ -1004,12 +1004,12 @@ class RDoc::Parser::F95 < RDoc::Parser # Parse arguments, comment, code of subroutine and function. Return # AnyMethod object. - def parse_subprogram(subprogram, params, comment, code, + def parse_subprogram(subprogram, params, comment, code, before_contains=nil, function=nil, prefix=nil) subprogram.singleton = false prefix = "" if !prefix arguments = params.sub(/\(/, "").sub(/\)/, "").split(",") if params - args_comment, params_opt = + args_comment, params_opt = find_arguments(arguments, code.sub(/^s*?contains\s*?(!.*?)?$.*/im, ""), nil, nil, true) params_opt = "( " + params_opt + " ) " if params_opt @@ -1086,7 +1086,7 @@ class RDoc::Parser::F95 < RDoc::Parser if arg == defitem.varname.strip.chomp || all args_rdocforms << <<-"EOF" -#{indent}<tt><b>#{defitem.varname.chomp.strip}#{defitem.arraysuffix}</b> #{defitem.inivalue}</tt> :: +#{indent}<tt><b>#{defitem.varname.chomp.strip}#{defitem.arraysuffix}</b> #{defitem.inivalue}</tt> :: #{indent} <tt>#{defitem.types.chomp.strip}</tt> EOF if !defitem.comment.chomp.strip.empty? @@ -1096,7 +1096,7 @@ EOF } args_rdocforms << <<-"EOF" -#{indent} <tt></tt> :: +#{indent} <tt></tt> :: #{indent} <tt></tt> #{indent} #{comment.chomp.strip} EOF @@ -1130,7 +1130,7 @@ EOF before_contains = "" if !before_contains while lines =~ /^\s*?namelist\s+\/\s*?(\w+)\s*?\/([\s\w\,]+)$/i lines = $~.post_match - nml_comment = COMMENTS_ARE_UPPER ? + nml_comment = COMMENTS_ARE_UPPER ? find_comments($~.pre_match) : find_comments($~.post_match) nml_name = $1 nml_args = $2.split(",") @@ -1193,7 +1193,7 @@ EOF if internal external_alias_header = "#{INTERNAL_ALIAS_MES} " - external_alias_text = external_alias_header + old + external_alias_text = external_alias_header + old elsif file external_alias_header = "#{EXTERNAL_ALIAS_MES} " external_alias_text = external_alias_header + file + "#" + old @@ -1325,8 +1325,8 @@ EOF subname.upcase == alias_item["old_name"].upcase && @options.ignore_case - new_meth = initialize_external_method(alias_item["new_name"], - subname, params, @file_name, + new_meth = initialize_external_method(alias_item["new_name"], + subname, params, @file_name, comment) new_meth.visibility = alias_item["visibility"] @@ -1402,7 +1402,7 @@ EOF brank_flag = false now_continuing = false next "" - else + else brank_flag = false now_continuing = false ignore = false @@ -1595,7 +1595,7 @@ EOF comment_block = Array.new checked = false lines.each do |line| - if !checked + if !checked if /^\s?#{INTERNAL_ALIAS_MES}/ =~ line || /^\s?#{EXTERNAL_ALIAS_MES}/ =~ line checked = true @@ -1676,9 +1676,9 @@ EOF def to_s return <<-EOF -<Fortran95Definition: +<Fortran95Definition: varname=#{@varname}, types=#{types}, -inivalue=#{@inivalue}, arraysuffix=#{@arraysuffix}, nodoc=#{@nodoc}, +inivalue=#{@inivalue}, arraysuffix=#{@arraysuffix}, nodoc=#{@nodoc}, comment= #{@comment} > diff --git a/lib/rdoc/parser/perl.rb b/lib/rdoc/parser/perl.rb index 43d1e9ff69..0023a013a6 100644 --- a/lib/rdoc/parser/perl.rb +++ b/lib/rdoc/parser/perl.rb @@ -15,7 +15,7 @@ require 'rdoc/parser' # # We would like to support all the markup the POD provides # so that it will convert happily to HTML. At the moment -# I don't think I can do that: time constraints. +# I don't think I can do that: time constraints. # class RDoc::Parser::PerlPOD < RDoc::Parser @@ -45,39 +45,39 @@ class RDoc::Parser::PerlPOD < RDoc::Parser # but I think it would obscure the intent, scatter the # code all over tha place. This machine is necessary # because POD requires that directives be preceded by - # blank lines, so reading line by line is necessary, + # blank lines, so reading line by line is necessary, # and preserving state about what is seen is necesary. def scan @top_level.comment ||= "" - state=:code_blank + state=:code_blank line_number = 0 line = nil # This started out as a really long nested case statement, # which also led to repetitive code. I'd like to avoid that # so I'm using a "table" instead. - + # Firstly we need some procs to do the transition and processing # work. Because these are procs they are closures, and they can # use variables in the local scope. # # First, the "nothing to see here" stuff. - code_noop = lambda do + code_noop = lambda do if line =~ /^\s+$/ state = :code_blank end end - pod_noop = lambda do + pod_noop = lambda do if line =~ /^\s+$/ state = :pod_blank end @top_level.comment += filter(line) end - begin_noop = lambda do + begin_noop = lambda do if line =~ /^\s+$/ state = :begin_blank end @@ -151,7 +151,7 @@ class RDoc::Parser::PerlPOD < RDoc::Parser def filter(comment) return '' if comment =~ /^=pod\s*$/ comment.gsub!(/^=pod/, '==') - comment.gsub!(/^=head(\d+)/) do + comment.gsub!(/^=head(\d+)/) do "=" * $1.to_i end comment.gsub!(/=item/, ''); diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 865cb79d39..cf6c1ad221 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -1373,7 +1373,7 @@ end # # ## # # This method tries over and over until it is tired -# +# # def go_go_go(thing_to_try, tries = 10) # :args: thing_to_try # puts thing_to_try # go_go_go thing_to_try, tries - 1 @@ -1393,7 +1393,7 @@ end # # :call-seq: # # my_method(Range) # # my_method(offset, length) -# +# # def my_method(*args) # end # @@ -1404,7 +1404,7 @@ end # # ## # # My method is awesome -# +# # def my_method(&block) # :yields: happy, times # block.call 1, 2 # end @@ -1416,7 +1416,7 @@ end # # ## # # This is a meta-programmed method! -# +# # add_my_method :meta_method, :arg1, :arg2 # # The parser looks at the token after the identifier to determine the name, in @@ -1447,10 +1447,10 @@ end # ## # # :method: ghost_method # # There is a method here, but you can't see it! -# +# # ## # # this is a comment for a regular method -# +# # def regular_method() end # # Note that by default, the :method: directive will be ignored if there is a diff --git a/lib/rdoc/ri/display.rb b/lib/rdoc/ri/display.rb index 7b0158c18a..f6b647fbc1 100644 --- a/lib/rdoc/ri/display.rb +++ b/lib/rdoc/ri/display.rb @@ -119,35 +119,35 @@ class RDoc::RI::DefaultDisplay return display_class_method_list(klass) end end - + ## # Given a Hash mapping a class' methods to method types (returned by # display_class_method_list), this method allows the user to # choose one of the methods. - + def get_class_method_choice(method_map) if CAN_USE_READLINE # prepare abbreviations for tab completion abbreviations = method_map.keys.abbrev - Readline.completion_proc = proc do |string| + Readline.completion_proc = proc do |string| abbreviations.values.uniq.grep(/^#{string}/) end end - + @formatter.raw_print_line "\nEnter the method name you want.\n" @formatter.raw_print_line "Class methods can be preceeded by '::' and instance methods by '#'.\n" if CAN_USE_READLINE @formatter.raw_print_line "You can use tab to autocomplete.\n" @formatter.raw_print_line "Enter a blank line to exit.\n" - + choice_string = Readline.readline(">> ").strip else @formatter.raw_print_line "Enter a blank line to exit.\n" @formatter.raw_print_line ">> " choice_string = $stdin.gets.strip end - + if choice_string == '' return nil else @@ -172,7 +172,7 @@ class RDoc::RI::DefaultDisplay end end end - + ## # Display methods on +klass+ @@ -187,16 +187,16 @@ class RDoc::RI::DefaultDisplay :instance_methods, :instance_method_extensions, ] - + class_data.each do |data_type| data = klass.send data_type - + unless data.nil? or data.empty? then @formatter.blankline - + heading = data_type.to_s.split('_').join(' ').capitalize << ':' @formatter.display_heading heading, 2, '' - + method_names = [] data.each do |item| method_names << item.name @@ -268,7 +268,7 @@ class RDoc::RI::DefaultDisplay end end end - + ## # Display a list of +methods+ and allow the user to select one of them. @@ -280,9 +280,9 @@ class RDoc::RI::DefaultDisplay methods.each_with_index do |method, index| @formatter.raw_print_line "%3d %s [%s]\n" % [index + 1, method.full_name, method.source_path] end - + @formatter.raw_print_line ">> " - + choice = $stdin.gets.strip! if(choice == '') @@ -294,7 +294,7 @@ class RDoc::RI::DefaultDisplay if ((choice == 0) || (choice > methods.size)) then @formatter.raw_print_line "Invalid choice!\n" else - method = methods[choice - 1] + method = methods[choice - 1] display_method_info(method) end end diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index 0c91232b70..89534a5972 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -527,7 +527,7 @@ Options may also be set in the 'RI' environment variable. ancestors = [orig_klass] ancestors.push(*cache.includes.map { |inc| inc['name'] }) ancestors << cache.superclass - + ancestor_index = ancestors.index(klass) if ancestor_index diff --git a/lib/rdoc/ri/formatter.rb b/lib/rdoc/ri/formatter.rb index 933882abc4..258907d141 100644 --- a/lib/rdoc/ri/formatter.rb +++ b/lib/rdoc/ri/formatter.rb @@ -114,7 +114,7 @@ class RDoc::RI::Formatter txt = txt.gsub(%r{<tt>(.*?)</tt>}, '+\1+') txt.gsub!(%r{<code>(.*?)</code>}, '+\1+') txt.gsub!(%r{<b>(.*?)</b>}, '*\1*') - txt.gsub!(%r{<em>(.*?)</em>}, '_\1_') + txt.gsub!(%r{<em>(.*?)</em>}, '_\1_') txt end diff --git a/lib/rdoc/ri/util.rb b/lib/rdoc/ri/util.rb index 4e91eb978d..51cf881bdd 100644 --- a/lib/rdoc/ri/util.rb +++ b/lib/rdoc/ri/util.rb @@ -60,7 +60,7 @@ class RDoc::RI::NameDescriptor end if @method_name =~ /::|\.|#/ or !tokens.empty? - raise RDoc::RI::Error.new("Bad argument: #{arg}") + raise RDoc::RI::Error.new("Bad argument: #{arg}") end if separator && separator != '.' @is_class_method = separator == "::" diff --git a/lib/rexml/attlistdecl.rb b/lib/rexml/attlistdecl.rb index ea5a98b69e..ec4e6c3b8d 100644 --- a/lib/rexml/attlistdecl.rb +++ b/lib/rexml/attlistdecl.rb @@ -31,7 +31,7 @@ module REXML @element_name, @pairs, @contents = *source end end - + # Access the attlist attribute/value pairs. # value = attlist_decl[ attribute_name ] def [](key) diff --git a/lib/rexml/attribute.rb b/lib/rexml/attribute.rb index febcc288b1..28a5923608 100644 --- a/lib/rexml/attribute.rb +++ b/lib/rexml/attribute.rb @@ -14,7 +14,7 @@ module REXML attr_reader :element # The normalized value of this attribute. That is, the attribute with # entities intact. - attr_writer :normalized + attr_writer :normalized PATTERN = /\s*(#{NAME_STR})\s*=\s*(["'])(.*?)\2/um NEEDS_A_SECOND_CHECK = /(<|&((#{Entity::NAME});|(#0*((?:\d+)|(?:x[a-fA-F0-9]+)));)?)/um @@ -22,18 +22,18 @@ module REXML # Constructor. # FIXME: The parser doesn't catch illegal characters in attributes # - # first:: + # first:: # Either: an Attribute, which this new attribute will become a # clone of; or a String, which is the name of this attribute # second:: # If +first+ is an Attribute, then this may be an Element, or nil. # If nil, then the Element parent of this attribute is the parent - # of the +first+ Attribute. If the first argument is a String, - # then this must also be a String, and is the content of the attribute. + # of the +first+ Attribute. If the first argument is a String, + # then this must also be a String, and is the content of the attribute. # If this is the content, it must be fully normalized (contain no # illegal characters). # parent:: - # Ignored unless +first+ is a String; otherwise, may be the Element + # Ignored unless +first+ is a String; otherwise, may be the Element # parent of this attribute, or nil. # # @@ -61,7 +61,7 @@ module REXML end # Returns the namespace of the attribute. - # + # # e = Element.new( "elns:myelement" ) # e.add_attribute( "nsa:a", "aval" ) # e.add_attribute( "b", "bval" ) @@ -78,7 +78,7 @@ module REXML end # Returns the namespace URL, if defined, or nil otherwise - # + # # e = Element.new("el") # e.add_attributes({"xmlns:ns", "http://url"}) # e.namespace( "ns" ) # -> "http://url" @@ -157,7 +157,7 @@ module REXML end # Removes this Attribute from the tree, and returns true if successfull - # + # # This method is usually not called directly. def remove @element.attributes.delete self.name unless @element.nil? diff --git a/lib/rexml/cdata.rb b/lib/rexml/cdata.rb index 123a7c3d82..e1235d60f8 100644 --- a/lib/rexml/cdata.rb +++ b/lib/rexml/cdata.rb @@ -17,7 +17,7 @@ module REXML end # Make a copy of this object - # + # # _Examples_ # c = CData.new( "Some text" ) # d = c.clone diff --git a/lib/rexml/child.rb b/lib/rexml/child.rb index 033057da55..fd59d7283a 100644 --- a/lib/rexml/child.rb +++ b/lib/rexml/child.rb @@ -15,8 +15,8 @@ module REXML # if supplied, the parent of this child will be set to the # supplied value, and self will be added to the parent def initialize( parent = nil ) - @parent = nil - # Declare @parent, but don't define it. The next line sets the + @parent = nil + # Declare @parent, but don't define it. The next line sets the # parent. parent.add( self ) if parent end @@ -68,7 +68,7 @@ module REXML parent.insert_after self, other end - # Sets the previous sibling of this child. This can be used to insert a + # Sets the previous sibling of this child. This can be used to insert a # child before some other child. # a = Element.new("a") # b = a.add_element("b") diff --git a/lib/rexml/comment.rb b/lib/rexml/comment.rb index d5be89b652..e401090376 100644 --- a/lib/rexml/comment.rb +++ b/lib/rexml/comment.rb @@ -14,11 +14,11 @@ module REXML ## # Constructor. The first argument can be one of three types: - # @param first If String, the contents of this comment are set to the + # @param first If String, the contents of this comment are set to the # argument. If Comment, the argument is duplicated. If # Source, the argument is scanned for a comment. - # @param second If the first argument is a Source, this argument - # should be nil, not supplied, or a Parent to be set as the parent + # @param second If the first argument is a Source, this argument + # should be nil, not supplied, or a Parent to be set as the parent # of this object def initialize( first, second = nil ) #puts "IN COMMENT CONSTRUCTOR; SECOND IS #{second.type}" diff --git a/lib/rexml/doctype.rb b/lib/rexml/doctype.rb index 35beabc566..1a946a1587 100644 --- a/lib/rexml/doctype.rb +++ b/lib/rexml/doctype.rb @@ -15,11 +15,11 @@ module REXML STOP = ">" SYSTEM = "SYSTEM" PUBLIC = "PUBLIC" - DEFAULT_ENTITIES = { - 'gt'=>EntityConst::GT, - 'lt'=>EntityConst::LT, - 'quot'=>EntityConst::QUOT, - "apos"=>EntityConst::APOS + DEFAULT_ENTITIES = { + 'gt'=>EntityConst::GT, + 'lt'=>EntityConst::LT, + 'quot'=>EntityConst::QUOT, + "apos"=>EntityConst::APOS } # name is the name of the doctype @@ -33,7 +33,7 @@ module REXML # dt = DocType.new( doctype_to_clone ) # # Incomplete. Shallow clone of doctype # - # +Note+ that the constructor: + # +Note+ that the constructor: # # Doctype.new( Source.new( "<!DOCTYPE foo 'bar'>" ) ) # @@ -139,8 +139,8 @@ module REXML @entities = DEFAULT_ENTITIES.clone if @entities == DEFAULT_ENTITIES @entities[ child.name ] = child if child.kind_of? Entity end - - # This method retrieves the public identifier identifying the document's + + # This method retrieves the public identifier identifying the document's # DTD. # # Method contributed by Henrik Martensson @@ -152,7 +152,7 @@ module REXML strip_quotes(@long_name) end end - + # This method retrieves the system identifier identifying the document's DTD # # Method contributed by Henrik Martensson @@ -164,16 +164,16 @@ module REXML @uri.kind_of?(String) ? strip_quotes(@uri) : nil end end - + # This method returns a list of notations that have been declared in the - # _internal_ DTD subset. Notations in the external DTD subset are not + # _internal_ DTD subset. Notations in the external DTD subset are not # listed. # # Method contributed by Henrik Martensson def notations children().select {|node| node.kind_of?(REXML::NotationDecl)} end - + # Retrieves a named notation. Only notations declared in the internal # DTD subset can be retrieved. # @@ -183,9 +183,9 @@ module REXML notation_decl.name == name } end - + private - + # Method contributed by Henrik Martensson def strip_quotes(quoted_string) quoted_string =~ /^[\'\"].*[\'\"]$/ ? @@ -217,7 +217,7 @@ module REXML output << to_s end end - + public class ElementDecl < Declaration def initialize( src ) @@ -250,7 +250,7 @@ module REXML def to_s "<!NOTATION #@name #@middle#{ - @public ? ' ' + public.inspect : '' + @public ? ' ' + public.inspect : '' }#{ @system ? ' ' +@system.inspect : '' }>" @@ -259,7 +259,7 @@ module REXML def write( output, indent=-1 ) output << to_s end - + # This method retrieves the name of the notation. # # Method contributed by Henrik Martensson diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb index 48f1a0ec6c..0fde6df1a1 100644 --- a/lib/rexml/document.rb +++ b/lib/rexml/document.rb @@ -25,7 +25,7 @@ module REXML DECLARATION = XMLDecl.default # Constructor - # @param source if supplied, must be a Document, String, or IO. + # @param source if supplied, must be a Document, String, or IO. # Documents have their context and Element attributes cloned. # Strings are expected to be valid XML documents. IOs are expected # to be sources of valid XML documents. @@ -69,11 +69,11 @@ module REXML @children.unshift child child.parent = self elsif child.kind_of? DocType - # Find first Element or DocType node and insert the decl right + # Find first Element or DocType node and insert the decl right # before it. If there is no such node, just insert the child at the # end. If there is a child and it is an DocType, then replace it. insert_before_index = 0 - @children.find { |x| + @children.find { |x| insert_before_index += 1 x.kind_of?(Element) || x.kind_of?(DocType) } @@ -167,7 +167,7 @@ module REXML # indent:: # An integer. If -1, no indenting will be used; otherwise, the # indentation will be twice this number of spaces, and children will be - # indented an additional amount. For a value of 3, every item will be + # indented an additional amount. For a value of 3, every item will be # indented 3 more levels, or 6 more spaces (2 * 3). Defaults to -1 # transitive:: # If transitive is true and indent is >= 0, then the output will be @@ -178,7 +178,7 @@ module REXML # Internet Explorer is the worst piece of crap to have ever been # written, with the possible exception of Windows itself. Since IE is # unable to parse proper XML, we have to provide a hack to generate XML - # that IE's limited abilities can handle. This hack inserts a space + # that IE's limited abilities can handle. This hack inserts a space # before the /> on empty tags. Defaults to false def write( output=$stdout, indent=-1, transitive=false, ie_hack=false ) if xml_decl.encoding != "UTF-8" && !output.kind_of?(Output) @@ -197,7 +197,7 @@ module REXML formatter.write( self, output ) end - + def Document::parse_stream( source, listener ) Parsers::StreamParser.new( source, listener ).parse end @@ -215,7 +215,7 @@ module REXML end attr_reader :entity_expansion_count - + def record_entity_expansion @entity_expansion_count += 1 if @entity_expansion_count > @@entity_expansion_limit diff --git a/lib/rexml/dtd/entitydecl.rb b/lib/rexml/dtd/entitydecl.rb index 0adda6f7b9..a9286b2b90 100644 --- a/lib/rexml/dtd/entitydecl.rb +++ b/lib/rexml/dtd/entitydecl.rb @@ -49,7 +49,7 @@ module REXML def EntityDecl.parse_source source, listener md = source.match( PATTERN_RE, true ) thing = md[0].squeeze(" \t\n\r") - listener.send inspect.downcase, thing + listener.send inspect.downcase, thing end end end diff --git a/lib/rexml/dtd/notationdecl.rb b/lib/rexml/dtd/notationdecl.rb index eae71f2e52..17d1b9ef29 100644 --- a/lib/rexml/dtd/notationdecl.rb +++ b/lib/rexml/dtd/notationdecl.rb @@ -32,7 +32,7 @@ module REXML def NotationDecl.parse_source source, listener md = source.match( PATTERN_RE, true ) thing = md[0].squeeze(" \t\n\r") - listener.send inspect.downcase, thing + listener.send inspect.downcase, thing end end end diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb index 92308a5c99..7a3abc65e5 100644 --- a/lib/rexml/element.rb +++ b/lib/rexml/element.rb @@ -30,13 +30,13 @@ module REXML attr_accessor :context # Constructor - # arg:: + # arg:: # if not supplied, will be set to the default value. # If a String, the name of this object will be set to the argument. - # If an Element, the object will be shallowly cloned; name, + # If an Element, the object will be shallowly cloned; name, # attributes, and namespaces will be copied. Children will +not+ be # copied. - # parent:: + # parent:: # if supplied, must be a Parent, and will be used as # the parent of this object. # context:: @@ -97,7 +97,7 @@ module REXML self.class.new self end - # Evaluates to the root node of the document that this element + # Evaluates to the root node of the document that this element # belongs to. If this element doesn't belong to a document, but does # belong to another Element, the parent's root will be returned, until the # earliest ancestor is found. @@ -137,8 +137,8 @@ module REXML # is the case if: # 1. Neither :+respect_whitespace+ nor :+compress_whitespace+ has any value # 2. The context has :+respect_whitespace+ set to :+all+ or - # an array containing the name of this element, and - # :+compress_whitespace+ isn't set to :+all+ or an array containing the + # an array containing the name of this element, and + # :+compress_whitespace+ isn't set to :+all+ or an array containing the # name of this element. # The evaluation is tested against +expanded_name+, and so is namespace # sensitive. @@ -162,7 +162,7 @@ module REXML @ignore_whitespace_nodes = false if @context if @context[:ignore_whitespace_nodes] - @ignore_whitespace_nodes = + @ignore_whitespace_nodes = (@context[:ignore_whitespace_nodes] == :all or @context[:ignore_whitespace_nodes].include? expanded_name) end @@ -206,13 +206,13 @@ module REXML return namespaces end - # Evalutas to the URI for a prefix, or the empty string if no such + # Evalutas to the URI for a prefix, or the empty string if no such # namespace is declared for this element. Evaluates recursively for # ancestors. Returns the default namespace, if there is one. - # prefix:: + # prefix:: # the prefix to search for. If not supplied, returns the default # namespace if one exists - # Returns:: + # Returns:: # the namespace URI as a String, or nil if no such namespace # exists. If the namespace is undefined, returns an empty string # doc = Document.new("<a xmlns='1' xmlns:y='2'><b/><c xmlns:z='3'/></a>") @@ -235,10 +235,10 @@ module REXML end # Adds a namespace to this element. - # prefix:: + # prefix:: # the prefix string, or the namespace URI if +uri+ is not # supplied - # uri:: + # uri:: # the namespace URI. May be nil, in which +prefix+ is used as # the URI # Evaluates to: this Element @@ -280,12 +280,12 @@ module REXML # Adds a child to this element, optionally setting attributes in # the element. - # element:: + # element:: # optional. If Element, the element is added. # Otherwise, a new Element is constructed with the argument (see # Element.initialize). - # attrs:: - # If supplied, must be a Hash containing String name,value + # attrs:: + # If supplied, must be a Hash containing String name,value # pairs, which will be used to set the attributes of the new Element. # Returns:: the Element that was added # el = doc.add_element 'my-tag' @@ -302,9 +302,9 @@ module REXML end # Deletes a child element. - # element:: - # Must be an +Element+, +String+, or +Integer+. If Element, - # the element is removed. If String, the element is found (via XPath) + # element:: + # Must be an +Element+, +String+, or +Integer+. If Element, + # the element is removed. If String, the element is found (via XPath) # and removed. <em>This means that any parent can remove any # descendant.<em> If Integer, the Element indexed by that number will be # removed. @@ -327,14 +327,14 @@ module REXML # Iterates through the child elements, yielding for each Element that # has a particular attribute set. - # key:: + # key:: # the name of the attribute to search for - # value:: + # value:: # the value of the attribute - # max:: - # (optional) causes this method to return after yielding + # max:: + # (optional) causes this method to return after yielding # for this number of matching children - # name:: + # name:: # (optional) if supplied, this is an XPath that filters # the children to check. # @@ -348,7 +348,7 @@ module REXML # # Yields d # doc.root.each_element_with_attribute( 'id', '1', 0, 'd' ) {|e| p e} def each_element_with_attribute( key, value=nil, max=0, name=nil, &block ) # :yields: Element - each_with_something( proc {|child| + each_with_something( proc {|child| if value.nil? child.attributes[key] != nil else @@ -359,13 +359,13 @@ module REXML # Iterates through the children, yielding for each Element that # has a particular text set. - # text:: + # text:: # the text to search for. If nil, or not supplied, will iterate # over all +Element+ children that contain at least one +Text+ node. - # max:: + # max:: # (optional) causes this method to return after yielding # for this number of matching children - # name:: + # name:: # (optional) if supplied, this is an XPath that filters # the children to check. # @@ -379,7 +379,7 @@ module REXML # # Yields d # doc.each_element_with_text(nil, 0, 'd'){|e|p e} def each_element_with_text( text=nil, max=0, name=nil, &block ) # :yields: Element - each_with_something( proc {|child| + each_with_something( proc {|child| if text.nil? child.has_text? else @@ -408,7 +408,7 @@ module REXML # doc.root.elements['c'].next_element #-> nil def next_element element = next_sibling - element = element.next_sibling until element.nil? or element.kind_of? Element + element = element.next_sibling until element.nil? or element.kind_of? Element return element end @@ -477,7 +477,7 @@ module REXML # this method with a nil argument. In this case, the next Text # child becomes the first Text child. In no case is the order of # any siblings disturbed. - # text:: + # text:: # If a String, a new Text child is created and added to # this Element as the first Text child. If Text, the text is set # as the first Child element. If nil, then any existing first Text @@ -520,7 +520,7 @@ module REXML # Note that at the end of this example, the branch has <b>3</b> nodes; the 'e' # element and <b>2</b> Text node children. def add_text( text ) - if text.kind_of? String + if text.kind_of? String if @children[-1].kind_of? Text @children[-1] << text return @@ -559,7 +559,7 @@ module REXML end prefix = nil if prefix == 'xmlns' - ret_val = + ret_val = attributes.get_attribute( "#{prefix ? prefix + ':' : ''}#{name}" ) return ret_val unless ret_val.nil? @@ -586,7 +586,7 @@ module REXML # the attribute is added to the list of Element attributes. If String, # the argument is used as the name of the new attribute, and the value # parameter must be supplied. - # value:: + # value:: # Required if +key+ is a String, and ignored if the first argument is # an Attribute. This is a String, and is used as the value # of the new Attribute. This should be the unnormalized value of the @@ -621,7 +621,7 @@ module REXML # either an Attribute or a String. In either case, the # attribute is found by matching the attribute name to the argument, # and then removed. If no attribute is found, no action is taken. - # Returns:: + # Returns:: # the attribute removed, or nil if this Element did not contain # a matching attribute # e = Element.new('E') @@ -638,7 +638,7 @@ module REXML # Other Utilities # ################################################# - # Get an array of all CData children. + # Get an array of all CData children. # IMMUTABLE def cdatas find_all { |child| child.kind_of? CData }.freeze @@ -681,7 +681,7 @@ module REXML # Internet Explorer is the worst piece of crap to have ever been # written, with the possible exception of Windows itself. Since IE is # unable to parse proper XML, we have to provide a hack to generate XML - # that IE's limited abilities can handle. This hack inserts a space + # that IE's limited abilities can handle. This hack inserts a space # before the /> on empty tags. Defaults to false # # out = '' @@ -707,8 +707,8 @@ module REXML def __to_xpath_helper node rv = node.expanded_name.clone if node.parent - results = node.parent.find_all {|n| - n.kind_of?(REXML::Element) and n.expanded_name == node.expanded_name + results = node.parent.find_all {|n| + n.kind_of?(REXML::Element) and n.expanded_name == node.expanded_name } if results.length > 1 idx = results.index( node ) @@ -734,7 +734,7 @@ module REXML # A class which provides filtering of children for Elements, and # XPath search support. You are expected to only encounter this class as - # the <tt>element.elements</tt> object. Therefore, you are + # the <tt>element.elements</tt> object. Therefore, you are # _not_ expected to instantiate this yourself. class Elements include Enumerable @@ -746,7 +746,7 @@ module REXML # Fetches a child element. Filters only Element children, regardless of # the XPath match. - # index:: + # index:: # the search parameter. This is either an Integer, which # will be used to find the index'th child Element, or an XPath, # which will be used to search for the Element. <em>Because @@ -756,7 +756,7 @@ module REXML # child element is at index 1, not 0, and the +n+th element is at index # +n+, not <tt>n-1</tt>. This is because XPath indexes element children # starting from 1, not 0, and the indexes should be the same. - # name:: + # name:: # optional, and only used in the first argument is an # Integer. In that case, the index'th child Element that has the # supplied name will be returned. Note again that the indexes start at 1. @@ -772,12 +772,12 @@ module REXML num = 0 @element.find { |child| child.kind_of? Element and - (name.nil? ? true : child.has_name?( name )) and + (name.nil? ? true : child.has_name?( name )) and (num += 1) == index } else return XPath::first( @element, index ) - #{ |element| + #{ |element| # return element if element.kind_of? Element #} #return nil @@ -787,7 +787,7 @@ module REXML # Sets an element, replacing any previous matching element. If no # existing element is found ,the element is added. # index:: Used to find a matching element to replace. See [](). - # element:: + # element:: # The element to replace the existing element with # the previous element # Returns:: nil if no previous element was found. @@ -812,12 +812,12 @@ module REXML @element.find{ |child| child.kind_of? Element}.nil? end - # Returns the index of the supplied child (starting at 1), or -1 if + # Returns the index of the supplied child (starting at 1), or -1 if # the element is not a child # element:: an +Element+ child def index element rv = 0 - found = @element.find do |child| + found = @element.find do |child| child.kind_of? Element and (rv += 1) and child == element @@ -827,7 +827,7 @@ module REXML end # Deletes a child Element - # element:: + # element:: # Either an Element, which is removed directly; an # xpath, where the first matching child is removed; or an Integer, # where the n'th Element is removed. @@ -854,7 +854,7 @@ module REXML # deleted = doc.elements.delete_all 'a/c' #-> [<c/>, <c/>, <c/>, <c/>] def delete_all( xpath ) rv = [] - XPath::each( @element, xpath) {|element| + XPath::each( @element, xpath) {|element| rv << element if element.kind_of? Element } rv.each do |element| @@ -865,7 +865,7 @@ module REXML end # Adds an element - # element:: + # element:: # if supplied, is either an Element, String, or # Source (see Element.initialize). If not supplied or nil, a # new, default Element will be constructed @@ -890,8 +890,8 @@ module REXML # Iterates through all of the child Elements, optionally filtering # them by a given XPath - # xpath:: - # optional. If supplied, this is a String XPath, and is used to + # xpath:: + # optional. If supplied, this is a String XPath, and is used to # filter the children, so that only matching children are yielded. Note # that XPaths are automatically filtered for Elements, so that # non-Element children will not be yielded @@ -908,8 +908,8 @@ module REXML def collect( xpath=nil, &block ) collection = [] - XPath::each( @element, xpath ) {|e| - collection << yield(e) if e.kind_of?(Element) + XPath::each( @element, xpath ) {|e| + collection << yield(e) if e.kind_of?(Element) } collection end @@ -944,7 +944,7 @@ module REXML # supplied XPath matches non-Element children. # doc = Document.new '<a>sean<b/>elliott<c/></a>' # doc.root.elements.to_a #-> [ <b/>, <c/> ] - # doc.root.elements.to_a("child::node()") #-> [ <b/>, <c/> ] + # doc.root.elements.to_a("child::node()") #-> [ <b/>, <c/> ] # XPath.match(doc.root, "child::node()") #-> [ sean, <b/>, elliott, <c/> ] def to_a( xpath=nil ) rv = XPath.match( @element, xpath ) @@ -964,7 +964,7 @@ module REXML # ATTRIBUTES # ######################################################################## - # A class that defines the set of Attributes of an Element and provides + # A class that defines the set of Attributes of an Element and provides # operations for accessing elements in that set. class Attributes < Hash # Constructor @@ -976,11 +976,11 @@ module REXML # Fetches an attribute value. If you want to get the Attribute itself, # use get_attribute() # name:: an XPath attribute name. Namespaces are relevant here. - # Returns:: + # Returns:: # the String value of the matching attribute, or +nil+ if no # matching attribute was found. This is the unnormalized value # (with entities expanded). - # + # # doc = Document.new "<a foo:att='1' bar:att='2' att='<'/>" # doc.root.attributes['att'] #-> '<' # doc.root.attributes['bar:att'] #-> '2' @@ -1006,7 +1006,7 @@ module REXML # Iterates over the attributes of an Element. Yields actual Attribute # nodes, not String values. - # + # # doc = Document.new '<a x="1" y="2"/>' # doc.root.attributes.each_attribute {|attr| # p attr.expanded_name+" => "+attr.value @@ -1033,7 +1033,7 @@ module REXML end # Fetches an attribute - # name:: + # name:: # the name by which to search for the attribute. Can be a # <tt>prefix:name</tt> namespace name. # Returns:: The first matching attribute, or nil if there was none. This @@ -1077,10 +1077,10 @@ module REXML # Sets an attribute, overwriting any existing attribute value by the # same name. Namespace is significant. # name:: the name of the attribute - # value:: + # value:: # (optional) If supplied, the value of the attribute. If # nil, any existing matching attribute is deleted. - # Returns:: + # Returns:: # Owning element # doc = Document.new "<a x:foo='1' foo='3'/>" # doc.root.attributes['y:foo'] = '2' @@ -1109,13 +1109,13 @@ module REXML old_attr[value.prefix] = value elsif old_attr.prefix != value.prefix # Check for conflicting namespaces - raise ParseException.new( + raise ParseException.new( "Namespace conflict in adding attribute \"#{value.name}\": "+ "Prefix \"#{old_attr.prefix}\" = "+ "\"#{@element.namespace(old_attr.prefix)}\" and prefix "+ - "\"#{value.prefix}\" = \"#{@element.namespace(value.prefix)}\"") if + "\"#{value.prefix}\" = \"#{@element.namespace(value.prefix)}\"") if value.prefix != "xmlns" and old_attr.prefix != "xmlns" and - @element.namespace( old_attr.prefix ) == + @element.namespace( old_attr.prefix ) == @element.namespace( value.prefix ) store value.name, { old_attr.prefix => old_attr, value.prefix => value } @@ -1125,7 +1125,7 @@ module REXML return @element end - # Returns an array of Strings containing all of the prefixes declared + # Returns an array of Strings containing all of the prefixes declared # by this set of # attributes. The array does not include the default # namespace declaration, if one exists. # doc = Document.new("<a xmlns='foo' xmlns:x='bar' xmlns:y='twee' "+ @@ -1164,7 +1164,7 @@ module REXML end # Removes an attribute - # attribute:: + # attribute:: # either a String, which is the name of the attribute to remove -- # namespaces are significant here -- or the attribute to remove. # Returns:: the owning element @@ -1212,12 +1212,12 @@ module REXML alias :<< :add # Deletes all attributes matching a name. Namespaces are significant. - # name:: + # name:: # A String; all attributes that match this path will be removed # Returns:: an Array of the Attributes that were removed def delete_all( name ) rv = [] - each_attribute { |attribute| + each_attribute { |attribute| rv << attribute if attribute.expanded_name == name } rv.each{ |attr| attr.remove } @@ -1227,7 +1227,7 @@ module REXML # The +get_attribute_ns+ method retrieves a method by its namespace # and name. Thus it is possible to reliably identify an attribute # even if an XML processor has changed the prefix. - # + # # Method contributed by Henrik Martensson def get_attribute_ns(namespace, name) result = nil @@ -1236,7 +1236,7 @@ module REXML namespace == attribute.namespace() && ( !namespace.empty? || !attribute.fully_expanded_name.index(':') ) # foo will match xmlns:foo, but only if foo isn't also an attribute - result = attribute if !result or !namespace.empty? or + result = attribute if !result or !namespace.empty? or !attribute.fully_expanded_name.index(':') end } diff --git a/lib/rexml/encoding.rb b/lib/rexml/encoding.rb index 608c69cd65..3feffb80f4 100644 --- a/lib/rexml/encoding.rb +++ b/lib/rexml/encoding.rb @@ -29,7 +29,7 @@ module REXML if enc and enc != UTF_8 @encoding = enc raise ArgumentError, "Bad encoding name #@encoding" unless @encoding =~ /^[\w-]+$/ - @encoding.untaint + @encoding.untaint begin require 'rexml/encodings/ICONV.rb' Encoding.apply(self, "ICONV") diff --git a/lib/rexml/encodings/CP-1252.rb b/lib/rexml/encodings/CP-1252.rb index 2ef6a1a291..587c5bdd68 100644 --- a/lib/rexml/encodings/CP-1252.rb +++ b/lib/rexml/encodings/CP-1252.rb @@ -58,7 +58,7 @@ module REXML end array_enc.pack('C*') end - + # Convert to UTF-8 def decode_cp1252(str) array_latin9 = str.unpack('C*') diff --git a/lib/rexml/encodings/ISO-8859-15.rb b/lib/rexml/encodings/ISO-8859-15.rb index 953267250e..08a19cb755 100644 --- a/lib/rexml/encodings/ISO-8859-15.rb +++ b/lib/rexml/encodings/ISO-8859-15.rb @@ -46,7 +46,7 @@ module REXML end array_enc.pack('C*') end - + # Convert to UTF-8 def from_iso_8859_15(str) array_latin9 = str.unpack('C*') diff --git a/lib/rexml/encodings/UNILE.rb b/lib/rexml/encodings/UNILE.rb index d054140c40..1a18f0c932 100644 --- a/lib/rexml/encodings/UNILE.rb +++ b/lib/rexml/encodings/UNILE.rb @@ -18,7 +18,7 @@ module REXML def decode_unile(str) array_enc=str.unpack('C*') array_utf8 = [] - 0.step(array_enc.size-1, 2){|i| + 0.step(array_enc.size-1, 2){|i| array_utf8 << (array_enc.at(i) + array_enc.at(i+1)*0x100) } array_utf8.pack('U*') diff --git a/lib/rexml/encodings/UTF-16.rb b/lib/rexml/encodings/UTF-16.rb index 007c493d9c..2ec058eed5 100644 --- a/lib/rexml/encodings/UTF-16.rb +++ b/lib/rexml/encodings/UTF-16.rb @@ -19,7 +19,7 @@ module REXML str = str[2..-1] if /^\376\377/n =~ str array_enc=str.unpack('C*') array_utf8 = [] - 0.step(array_enc.size-1, 2){|i| + 0.step(array_enc.size-1, 2){|i| array_utf8 << (array_enc.at(i+1) + array_enc.at(i)*0x100) } array_utf8.pack('U*') diff --git a/lib/rexml/entity.rb b/lib/rexml/entity.rb index d2f27ecd44..5e3edf4eeb 100644 --- a/lib/rexml/entity.rb +++ b/lib/rexml/entity.rb @@ -30,7 +30,7 @@ module REXML # is read from a stream. If you start poking around with the accessors, # you can easily create a non-conformant Entity. The best thing to do is # dump the stupid DTDs and use XMLSchema instead. - # + # # e = Entity.new( 'amp', '&' ) def initialize stream, value=nil, parent=nil, reference=false super(parent) @@ -38,7 +38,7 @@ module REXML if stream.kind_of? Array @name = stream[1] if stream[-1] == '%' - @reference = true + @reference = true stream.pop else @reference = false diff --git a/lib/rexml/formatters/default.rb b/lib/rexml/formatters/default.rb index b4d63bc5b5..56a1d93783 100644 --- a/lib/rexml/formatters/default.rb +++ b/lib/rexml/formatters/default.rb @@ -21,7 +21,7 @@ module REXML def write( node, output ) case node - when Document + when Document if node.xml_decl.encoding != "UTF-8" && !output.kind_of?(Output) output = Output.new( output, node.xml_decl.encoding ) end @@ -70,7 +70,7 @@ module REXML if node.children.empty? output << " " if @ie_hack - output << "/" + output << "/" else output << ">" node.children.each { |child| diff --git a/lib/rexml/formatters/pretty.rb b/lib/rexml/formatters/pretty.rb index 84c442e8bb..17d217d1dc 100644 --- a/lib/rexml/formatters/pretty.rb +++ b/lib/rexml/formatters/pretty.rb @@ -48,7 +48,7 @@ module REXML if @ie_hack output << " " end - output << "/" + output << "/" else output << ">" # If compact and all children are text, and if the formatted output diff --git a/lib/rexml/formatters/transitive.rb b/lib/rexml/formatters/transitive.rb index 6083f0390b..3a52e03f01 100644 --- a/lib/rexml/formatters/transitive.rb +++ b/lib/rexml/formatters/transitive.rb @@ -31,7 +31,7 @@ module REXML output << ' '*@level if node.children.empty? output << " " if @ie_hack - output << "/" + output << "/" else output << ">" # If compact and all children are text, and if the formatted output diff --git a/lib/rexml/functions.rb b/lib/rexml/functions.rb index fc9c4701c4..2d30e5fe92 100644 --- a/lib/rexml/functions.rb +++ b/lib/rexml/functions.rb @@ -48,7 +48,7 @@ module REXML # UNTESTED def Functions::local_name( node_set=nil ) get_namespace( node_set ) do |node| - return node.local_name + return node.local_name end end @@ -57,7 +57,7 @@ module REXML end def Functions::name( node_set=nil ) - get_namespace( node_set ) do |node| + get_namespace( node_set ) do |node| node.expanded_name end end @@ -66,7 +66,7 @@ module REXML def Functions::get_namespace( node_set = nil ) if node_set == nil yield @@context[:node] if defined? @@context[:node].namespace - else + else if node_set.respond_to? :each node_set.each { |node| yield node if defined? node.namespace } elsif node_set.respond_to? :namespace @@ -81,15 +81,15 @@ module REXML # # A number is converted to a string as follows # - # NaN is converted to the string NaN + # NaN is converted to the string NaN # - # positive zero is converted to the string 0 + # positive zero is converted to the string 0 # - # negative zero is converted to the string 0 + # negative zero is converted to the string 0 # - # positive infinity is converted to the string Infinity + # positive infinity is converted to the string Infinity # - # negative infinity is converted to the string -Infinity + # negative infinity is converted to the string -Infinity # # if the number is an integer, the number is represented in decimal form # as a Number with no decimal point and no leading zeros, preceded by a @@ -156,7 +156,7 @@ module REXML string(string).include?(string(test)) end - # Kouhei fixed this + # Kouhei fixed this def Functions::substring_before( string, test ) ruby_string = string(string) ruby_index = ruby_string.index(string(test)) @@ -166,7 +166,7 @@ module REXML ruby_string[ 0...ruby_index ] end end - + # Kouhei fixed this too def Functions::substring_after( string, test ) ruby_string = string(string) @@ -175,11 +175,11 @@ module REXML "" end - # Take equal portions of Mike Stok and Sean Russell; mix + # Take equal portions of Mike Stok and Sean Russell; mix # vigorously, and pour into a tall, chilled glass. Serves 10,000. def Functions::substring( string, start, length=nil ) ruby_string = string(string) - ruby_length = if length.nil? + ruby_length = if length.nil? ruby_string.length.to_f else number(length) @@ -188,15 +188,15 @@ module REXML # Handle the special cases return '' if ( - ruby_length.nan? or + ruby_length.nan? or ruby_start.nan? or ruby_start.infinite? ) infinite_length = ruby_length.infinite? == 1 ruby_length = ruby_string.length if infinite_length - - # Now, get the bounds. The XPath bounds are 1..length; the ruby bounds + + # Now, get the bounds. The XPath bounds are 1..length; the ruby bounds # are 0..length. Therefore, we have to offset the bounds by one. ruby_start = ruby_start.round - 1 ruby_length = ruby_length.round @@ -247,7 +247,7 @@ module REXML 0.upto(from.length - 1) { |pos| from_char = from[pos] unless map.has_key? from_char - map[from_char] = + map[from_char] = if pos < to.length to[pos] else @@ -359,7 +359,7 @@ module REXML nodes = [nodes] unless nodes.kind_of? Array nodes.inject(0) { |r,n| r += number(string(n)) } end - + def Functions::floor( number ) number(number).floor end diff --git a/lib/rexml/instruction.rb b/lib/rexml/instruction.rb index 50bf95d17a..f8b734a5b5 100644 --- a/lib/rexml/instruction.rb +++ b/lib/rexml/instruction.rb @@ -13,7 +13,7 @@ module REXML attr_accessor :target, :content # Constructs a new Instruction - # @param target can be one of a number of things. If String, then + # @param target can be one of a number of things. If String, then # the target of this instruction is set to this. If an Instruction, # then the Instruction is shallowly cloned (target and content are # copied). If a Source, then the source is scanned and parsed for @@ -37,7 +37,7 @@ module REXML def clone Instruction.new self end - + # == DEPRECATED # See the rexml/formatters package # diff --git a/lib/rexml/namespace.rb b/lib/rexml/namespace.rb index 8d43fc85ad..aeb339ee83 100644 --- a/lib/rexml/namespace.rb +++ b/lib/rexml/namespace.rb @@ -40,7 +40,7 @@ module REXML # source file. def fully_expanded_name ns = prefix - return "#{ns}:#@name" if ns.size > 0 + return "#{ns}:#@name" if ns.size > 0 return @name end end diff --git a/lib/rexml/node.rb b/lib/rexml/node.rb index eb39141944..85457f1ad0 100644 --- a/lib/rexml/node.rb +++ b/lib/rexml/node.rb @@ -57,7 +57,7 @@ module REXML } end - # Find (and return) first subnode (recursively) for which the block + # Find (and return) first subnode (recursively) for which the block # evaluates to true. Returns +nil+ if none was found. def find_first_recursive(&block) # :yields: node each_recursive {|node| diff --git a/lib/rexml/output.rb b/lib/rexml/output.rb index 997f2b117d..b7f17b9dff 100644 --- a/lib/rexml/output.rb +++ b/lib/rexml/output.rb @@ -3,7 +3,7 @@ require 'rexml/encoding' module REXML class Output include Encoding - + attr_reader :encoding def initialize real_IO, encd="iso-8859-1" diff --git a/lib/rexml/parent.rb b/lib/rexml/parent.rb index a20aaaef6b..7ed1761654 100644 --- a/lib/rexml/parent.rb +++ b/lib/rexml/parent.rb @@ -6,14 +6,14 @@ module REXML # object. class Parent < Child include Enumerable - + # Constructor # @param parent if supplied, will be set as the parent of this object def initialize parent=nil super(parent) @children = [] end - + def add( object ) #puts "PARENT GOTS #{size} CHILDREN" object.parent = self @@ -21,47 +21,47 @@ module REXML #puts "PARENT NOW GOTS #{size} CHILDREN" object end - + alias :push :add alias :<< :push - + def unshift( object ) object.parent = self @children.unshift object end - + def delete( object ) found = false @children.delete_if {|c| c.equal?(object) and found = true } object.parent = nil if found end - + def each(&block) @children.each(&block) end - + def delete_if( &block ) @children.delete_if(&block) end - + def delete_at( index ) @children.delete_at index end - + def each_index( &block ) @children.each_index(&block) end - + # Fetches a child at a given index # @param index the Integer index of the child to fetch def []( index ) @children[index] end - + alias :each_child :each - - - + + + # Set an index entry. See Array.[]= # @param index the index of the element to set # @param opt either the object to set, or an Integer length @@ -71,7 +71,7 @@ module REXML args[-1].parent = self @children[*args[0..-2]] = args[-1] end - + # Inserts an child before another child # @param child1 this is either an xpath or an Element. If an Element, # child2 will be inserted before child1 in the child list of the parent. @@ -91,7 +91,7 @@ module REXML end self end - + # Inserts an child after another child # @param child1 this is either an xpath or an Element. If an Element, # child2 will be inserted after child1 in the child list of the parent. @@ -111,11 +111,11 @@ module REXML end self end - + def to_a @children.dup end - + # Fetches the index of a given child # @param child the child to get the index of # @return the index of the child, or nil if the object is not a child @@ -125,24 +125,24 @@ module REXML @children.find { |i| count += 1 ; i.hash == child.hash } count end - + # @return the number of children of this parent def size @children.size end - + alias :length :size - + # Replaces one child with another, making sure the nodelist is correct # @param to_replace the child to replace (must be a Child) - # @param replacement the child to insert into the nodelist (must be a + # @param replacement the child to insert into the nodelist (must be a # Child) def replace_child( to_replace, replacement ) @children.map! {|c| c.equal?( to_replace ) ? replacement : c } to_replace.parent = nil replacement.parent = self end - + # Deeply clones this object. This creates a complete duplicate of this # Parent, including all descendants. def deep_clone @@ -156,9 +156,9 @@ module REXML end cl end - + alias :children :to_a - + def parent? true end diff --git a/lib/rexml/parseexception.rb b/lib/rexml/parseexception.rb index feb7a7e638..0481f72818 100644 --- a/lib/rexml/parseexception.rb +++ b/lib/rexml/parseexception.rb @@ -30,7 +30,7 @@ module REXML err << "Last 80 unconsumed characters:\n" err << @source.buffer[0..80].gsub(/\n/, ' ') end - + err end @@ -40,12 +40,12 @@ module REXML end def line - @source.current_line[2] if @source and defined? @source.current_line and + @source.current_line[2] if @source and defined? @source.current_line and @source.current_line end def context @source.current_line end - end + end end diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb index 162d029a62..2f758265bb 100644 --- a/lib/rexml/parsers/baseparser.rb +++ b/lib/rexml/parsers/baseparser.rb @@ -105,11 +105,11 @@ module REXML EREFERENCE = /&(?!#{NAME};)/ - DEFAULT_ENTITIES = { - 'gt' => [/>/, '>', '>', />/], - 'lt' => [/</, '<', '<', /</], - 'quot' => [/"/, '"', '"', /"/], - "apos" => [/'/, "'", "'", /'/] + DEFAULT_ENTITIES = { + 'gt' => [/>/, '>', '>', />/], + 'lt' => [/</, '<', '<', /</], + 'quot' => [/"/, '"', '"', /"/], + "apos" => [/'/, "'", "'", /'/] } @@ -180,9 +180,9 @@ module REXML # Peek at the +depth+ event in the stack. The first element on the stack # is at depth 0. If +depth+ is -1, will parse to the end of the input # stream and return the last event, which is always :end_document. - # Be aware that this causes the stream to be parsed up to the +depth+ - # event, so you can effectively pre-parse the entire document (pull the - # entire thing into memory) using this method. + # Be aware that this causes the stream to be parsed up to the +depth+ + # event, so you can effectively pre-parse the entire document (pull the + # entire thing into memory) using this method. def peek depth=0 raise %Q[Illegal argument "#{depth}"] if depth < -1 temp = [] @@ -265,7 +265,7 @@ module REXML if @document_status == :in_doctype md = @source.match(/\s*(.*?>)/um) case md[1] - when SYSTEMENTITY + when SYSTEMENTITY match = @source.match( SYSTEMENTITY, true )[1] return [ :externalentity, match ] @@ -344,7 +344,7 @@ module REXML #md = @source.match_to_consume( '>', CLOSE_MATCH) md = @source.match( CLOSE_MATCH, true ) raise REXML::ParseException.new( "Missing end tag for "+ - "'#{last_tag}' (got \"#{md[1]}\")", + "'#{last_tag}' (got \"#{md[1]}\")", @source) unless last_tag == md[1] return [ :end_element, last_tag ] elsif @source.buffer[1] == ?! @@ -377,7 +377,7 @@ module REXML unless md # Check for missing attribute quotes raise REXML::ParseException.new("missing attribute quote", @source) if @source.match(MISSING_ATTRIBUTE_QUOTES ) - raise REXML::ParseException.new("malformed XML: missing tag start", @source) + raise REXML::ParseException.new("malformed XML: missing tag start", @source) end attributes = {} prefixes = Set.new @@ -386,7 +386,7 @@ module REXML if md[4].size > 0 attrs = md[4].scan( ATTRIBUTE_PATTERN ) raise REXML::ParseException.new( "error parsing attributes: [#{attrs.join ', '}], excess = \"#$'\"", @source) if $' and $'.strip.size > 0 - attrs.each { |a,b,c,d,e| + attrs.each { |a,b,c,d,e| if b == "xmlns" if c == "xml" if d != "http://www.w3.org/XML/1998/namespace" @@ -409,10 +409,10 @@ module REXML raise REXML::ParseException.new( msg, @source, self) end - attributes[a] = e + attributes[a] = e } end - + # Verify that all of the prefixes have been defined for prefix in prefixes unless @nsstack.find{|k| k.member?(prefix)} @@ -466,7 +466,7 @@ module REXML # Doing it like this rather than in a loop improves the speed copy.gsub!( EREFERENCE, '&' ) entities.each do |key, value| - copy.gsub!( value, "&#{key};" ) unless entity_filter and + copy.gsub!( value, "&#{key};" ) unless entity_filter and entity_filter.include?(entity) end if entities copy.gsub!( EREFERENCE, '&' ) diff --git a/lib/rexml/parsers/pullparser.rb b/lib/rexml/parsers/pullparser.rb index 36dc7160c3..68a4ff7eae 100644 --- a/lib/rexml/parsers/pullparser.rb +++ b/lib/rexml/parsers/pullparser.rb @@ -68,7 +68,7 @@ module REXML event = @parser.pull case event[0] when :entitydecl - @entities[ event[1] ] = + @entities[ event[1] ] = event[2] unless event[2] =~ /PUBLIC|SYSTEM/ when :text unnormalized = @parser.unnormalize( event[1], @entities ) diff --git a/lib/rexml/parsers/sax2parser.rb b/lib/rexml/parsers/sax2parser.rb index 72131401c3..d0f0c5155e 100644 --- a/lib/rexml/parsers/sax2parser.rb +++ b/lib/rexml/parsers/sax2parser.rb @@ -20,7 +20,7 @@ module REXML def source @parser.source end - + def add_listener( listener ) @parser.add_listener( listener ) end @@ -44,7 +44,7 @@ module REXML # :entitydecl, :notationdecl, :cdata, :xmldecl, :comment # # There is an additional symbol that can be listened for: :progress. - # This will be called for every event generated, passing in the current + # This will be called for every event generated, passing in the current # stream position. # # Array contains regular expressions or strings which will be matched @@ -72,7 +72,7 @@ module REXML add([nil, nil, args[0]]) end end - + def deafen( listener=nil, &blok ) if listener @listeners.delete_if {|item| item[-1] == listener } @@ -81,10 +81,10 @@ module REXML @procs.delete_if {|item| item[-1] == blok } end end - + def parse @procs.each { |sym,match,block| block.call if sym == :start_document } - @listeners.each { |sym,match,block| + @listeners.each { |sym,match,block| block.start_document if sym == :start_document or sym.nil? } root = context = [] @@ -126,8 +126,8 @@ module REXML listeners = get_listeners( :start_element, event[1] ) # notify observers procs.each { |ob| ob.call( uri, local, event[1], event[2] ) } if procs - listeners.each { |ob| - ob.start_element( uri, local, event[1], event[2] ) + listeners.each { |ob| + ob.start_element( uri, local, event[1], event[2] ) } if listeners when :end_element @tag_stack.pop @@ -140,8 +140,8 @@ module REXML listeners = get_listeners( :end_element, event[1] ) # notify observers procs.each { |ob| ob.call( uri, local, event[1] ) } if procs - listeners.each { |ob| - ob.end_element( uri, local, event[1] ) + listeners.each { |ob| + ob.end_element( uri, local, event[1] ) } if listeners namespace_mapping = @namespace_stack.pop @@ -160,7 +160,7 @@ module REXML #handle( :characters, normalized ) copy = event[1].clone - esub = proc { |match| + esub = proc { |match| if @entities.has_key?($1) @entities[$1].gsub(Text::REFERENCE, &esub) else @@ -178,7 +178,7 @@ module REXML when :entitydecl @entities[ event[1] ] = event[2] if event.size == 3 handle( *event ) - when :processing_instruction, :comment, :attlistdecl, + when :processing_instruction, :comment, :attlistdecl, :elementdecl, :cdata, :notationdecl, :xmldecl handle( *event ) end @@ -193,8 +193,8 @@ module REXML listeners = get_listeners( symbol, tag ) # notify observers procs.each { |ob| ob.call( *arguments ) } if procs - listeners.each { |l| - l.send( symbol.to_s, *arguments ) + listeners.each { |l| + l.send( symbol.to_s, *arguments ) } if listeners end @@ -205,7 +205,7 @@ module REXML @procs.find_all do |sym, match, block| #puts sym.inspect+"=="+symbol.inspect+ "\t"+match.inspect+"=="+name.inspect+ "\t"+( (sym.nil? or symbol == sym) and ((name.nil? and match.nil?) or match.nil? or ( (name == match) or (match.kind_of? Regexp and name =~ match)))).to_s ( - (sym.nil? or symbol == sym) and + (sym.nil? or symbol == sym) and ((name.nil? and match.nil?) or match.nil? or ( (name == match) or (match.kind_of? Regexp and name =~ match) @@ -218,7 +218,7 @@ module REXML return nil if @listeners.size == 0 @listeners.find_all do |sym, match, block| ( - (sym.nil? or symbol == sym) and + (sym.nil? or symbol == sym) and ((name.nil? and match.nil?) or match.nil? or ( (name == match) or (match.kind_of? Regexp and name =~ match) @@ -237,7 +237,7 @@ module REXML end end - def get_namespace( prefix ) + def get_namespace( prefix ) uris = (@namespace_stack.find_all { |ns| not ns[prefix].nil? }) || (@namespace_stack.find { |ns| not ns[nil].nil? }) uris[-1][prefix] unless uris.nil? or 0 == uris.size diff --git a/lib/rexml/parsers/streamparser.rb b/lib/rexml/parsers/streamparser.rb index 256d0f611c..073fcc2c21 100644 --- a/lib/rexml/parsers/streamparser.rb +++ b/lib/rexml/parsers/streamparser.rb @@ -5,11 +5,11 @@ module REXML @listener = listener @parser = BaseParser.new( source ) end - + def add_listener( listener ) @parser.add_listener( listener ) end - + def parse # entity string while true diff --git a/lib/rexml/parsers/treeparser.rb b/lib/rexml/parsers/treeparser.rb index 30327d0dfd..7f618cb319 100644 --- a/lib/rexml/parsers/treeparser.rb +++ b/lib/rexml/parsers/treeparser.rb @@ -42,8 +42,8 @@ module REXML if @build_context[-1].instance_of? Text @build_context[-1] << event[1] else - @build_context.add( - Text.new(event[1], @build_context.whitespace, nil, true) + @build_context.add( + Text.new(event[1], @build_context.whitespace, nil, true) ) unless ( @build_context.ignore_whitespace_nodes and event[1].strip.size==0 diff --git a/lib/rexml/parsers/xpathparser.rb b/lib/rexml/parsers/xpathparser.rb index 49450b4aef..aafa72ab9e 100644 --- a/lib/rexml/parsers/xpathparser.rb +++ b/lib/rexml/parsers/xpathparser.rb @@ -53,8 +53,8 @@ module REXML string << "*" when :text string << "text()" - when :following, :following_sibling, - :ancestor, :ancestor_or_self, :descendant, + when :following, :following_sibling, + :ancestor, :ancestor_or_self, :descendant, :namespace, :preceding, :preceding_sibling string << "/" unless string.size == 0 string << op.to_s.tr("_", "-") @@ -97,7 +97,7 @@ module REXML case op when :node string << "node()" - when :attribute, :child, :following, :following_sibling, + when :attribute, :child, :following, :following_sibling, :ancestor, :ancestor_or_self, :descendant, :descendant_or_self, :namespace, :preceding, :preceding_sibling, :self, :parent string << "/" unless string.size == 0 @@ -249,7 +249,7 @@ module REXML parsed.concat(n) end - + if path.size > 0 if path[0] == ?/ if path[1] == ?/ @@ -332,12 +332,12 @@ module REXML predicates << expr[1..-2] if expr end #puts "PREDICATES = #{predicates.inspect}" - predicates.each{ |pred| + predicates.each{ |pred| #puts "ORING #{pred}" preds = [] parsed << :predicate parsed << preds - OrExpr(pred, preds) + OrExpr(pred, preds) } #puts "PREDICATES = #{predicates.inspect}" path @@ -600,13 +600,13 @@ module REXML #puts "LITERAL or NUMBER: #$1" varname = $1.nil? ? $2 : $1 path = $' - parsed << :literal + parsed << :literal parsed << (varname.include?('.') ? varname.to_f : varname.to_i) when LITERAL #puts "LITERAL or NUMBER: #$1" varname = $1.nil? ? $2 : $1 path = $' - parsed << :literal + parsed << :literal parsed << varname when /^\(/ #/ path, contents = get_group(path) @@ -649,7 +649,7 @@ module REXML return nil unless depth==0 [string[ind..-1], string[0..ind-1]] end - + def parse_args( string ) arguments = [] ind = 0 @@ -683,7 +683,7 @@ module REXML s = string[0,ind].strip arguments << s unless s == "" string = string[ind+1..-1] - ind = -1 + ind = -1 end end end diff --git a/lib/rexml/quickpath.rb b/lib/rexml/quickpath.rb index fd2ebdd0ca..95fc72b7c2 100644 --- a/lib/rexml/quickpath.rb +++ b/lib/rexml/quickpath.rb @@ -68,7 +68,7 @@ module REXML ns = $1 rest = $' elements.delete_if do |element| - !(element.kind_of? Element and + !(element.kind_of? Element and (element.expanded_name == name or (element.name == name and element.namespace == Functions.namespace_context[ns]))) @@ -135,16 +135,16 @@ module REXML matches = filter(elements.collect{|element| element.next_sibling}.uniq, rest) when "previous-sibling" - matches = filter(elements.collect{|element| + matches = filter(elements.collect{|element| element.previous_sibling}.uniq, rest ) end return matches.uniq end # A predicate filters a node-set with respect to an axis to produce a - # new node-set. For each node in the node-set to be filtered, the - # PredicateExpr is evaluated with that node as the context node, with - # the number of nodes in the node-set as the context size, and with the + # new node-set. For each node in the node-set to be filtered, the + # PredicateExpr is evaluated with that node as the context node, with + # the number of nodes in the node-set as the context size, and with the # proximity position of the node in the node-set with respect to the # axis as the context position; if PredicateExpr evaluates to true for # that node, the node is included in the new node-set; otherwise, it is @@ -157,7 +157,7 @@ module REXML # number, then the result will be converted as if by a call to the # boolean function. Thus a location path para[3] is equivalent to # para[position()=3]. - def QuickPath::predicate( elements, path ) + def QuickPath::predicate( elements, path ) ind = 1 bcount = 1 while bcount > 0 @@ -175,13 +175,13 @@ module REXML # Let's do some Ruby trickery to avoid some work: predicate.gsub!( /&/u, "&&" ) predicate.gsub!( /=/u, "==" ) - predicate.gsub!( /@(\w[-\w.]*)/u, 'attribute("\1")' ) + predicate.gsub!( /@(\w[-\w.]*)/u, 'attribute("\1")' ) predicate.gsub!( /\bmod\b/u, "%" ) predicate.gsub!( /\b(\w[-\w.]*\()/u ) { fname = $1 fname.gsub( /-/u, "_" ) } - + Functions.pair = [ 0, elements.size ] results = [] elements.each do |element| diff --git a/lib/rexml/rexml.rb b/lib/rexml/rexml.rb index 810af31356..ab2f44561b 100644 --- a/lib/rexml/rexml.rb +++ b/lib/rexml/rexml.rb @@ -5,20 +5,20 @@ # non-validating[http://www.w3.org/TR/2004/REC-xml-20040204/#sec-conformance] # toolkit with an intuitive API. REXML passes 100% of the non-validating Oasis # tests[http://www.oasis-open.org/committees/xml-conformance/xml-test-suite.shtml], -# and provides tree, stream, SAX2, pull, and lightweight APIs. REXML also -# includes a full XPath[http://www.w3c.org/tr/xpath] 1.0 implementation. Since +# and provides tree, stream, SAX2, pull, and lightweight APIs. REXML also +# includes a full XPath[http://www.w3c.org/tr/xpath] 1.0 implementation. Since # Ruby 1.8, REXML is included in the standard Ruby distribution. # # Main page:: http://www.germane-software.com/software/rexml # Author:: Sean Russell <serATgermaneHYPHENsoftwareDOTcom> # Date:: 2008/019 # Version:: 3.1.7.3 -# +# # This API documentation can be downloaded from the REXML home page, or can # be accessed online[http://www.germane-software.com/software/rexml_doc] # # A tutorial is available in the REXML distribution in docs/tutorial.html, -# or can be accessed +# or can be accessed # online[http://www.germane-software.com/software/rexml/docs/tutorial.html] module REXML COPYRIGHT = "Copyright © 2001-2008 Sean Russell <ser@germane-software.com>" diff --git a/lib/rexml/sax2listener.rb b/lib/rexml/sax2listener.rb index 9545b08a93..6830e4483a 100644 --- a/lib/rexml/sax2listener.rb +++ b/lib/rexml/sax2listener.rb @@ -1,11 +1,11 @@ module REXML # A template for stream parser listeners. # Note that the declarations (attlistdecl, elementdecl, etc) are trivially - # processed; REXML doesn't yet handle doctype entity declarations, so you + # processed; REXML doesn't yet handle doctype entity declarations, so you # have to parse them out yourself. # === Missing methods from SAX2 # ignorable_whitespace - # === Methods extending SAX2 + # === Methods extending SAX2 # +WARNING+ # These methods are certainly going to change, until DTDs are fully # supported. Be aware of this. @@ -58,7 +58,7 @@ module REXML # The argument passed to this method is an array of the entity # declaration. It can be in a number of formats, but in general it # returns (example, result): - # <!ENTITY % YN '"Yes"'> + # <!ENTITY % YN '"Yes"'> # ["%", "YN", "'\"Yes\"'", "\""] # <!ENTITY % YN 'Yes'> # ["%", "YN", "'Yes'", "s"] @@ -93,5 +93,5 @@ module REXML end def progress position end - end + end end diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb index d4335138a1..3f6d4ffa26 100644 --- a/lib/rexml/source.rb +++ b/lib/rexml/source.rb @@ -69,9 +69,9 @@ module REXML # usual scan() method. For one thing, the pattern argument has some # requirements; for another, the source can be consumed. You can easily # confuse this method. Originally, the patterns were easier - # to construct and this method more robust, because this method - # generated search regexes on the fly; however, this was - # computationally expensive and slowed down the entire REXML package + # to construct and this method more robust, because this method + # generated search regexes on the fly; however, this was + # computationally expensive and slowed down the entire REXML package # considerably, since this is by far the most commonly called method. # @param pattern must be a Regexp, and must be in the form of # /^\s*(#{your pattern, with no groups})(.*)/. The first group @@ -194,7 +194,7 @@ module REXML def read begin str = @source.readline(@line_break) - str = decode(str) if @to_utf and str + str = decode(str) if @to_utf and str @buffer << str if not @to_utf and @buffer.respond_to? :force_encoding @buffer.force_encoding Encoding::UTF_8 @@ -225,7 +225,7 @@ module REXML rv.taint rv end - + def empty? super and ( @source.nil? || @source.eof? ) end diff --git a/lib/rexml/streamlistener.rb b/lib/rexml/streamlistener.rb index 3a4ef9f769..619c529578 100644 --- a/lib/rexml/streamlistener.rb +++ b/lib/rexml/streamlistener.rb @@ -1,14 +1,14 @@ module REXML # A template for stream parser listeners. # Note that the declarations (attlistdecl, elementdecl, etc) are trivially - # processed; REXML doesn't yet handle doctype entity declarations, so you + # processed; REXML doesn't yet handle doctype entity declarations, so you # have to parse them out yourself. module StreamListener # Called when a tag is encountered. # @p name the tag name # @p attrs an array of arrays of attribute/value pairs, suitable for # use with assoc or rassoc. IE, <tag attr1="value1" attr2="value2"> - # will result in + # will result in # tag_start( "tag", # [["attr1","value1"],["attr2","value2"]]) def tag_start name, attrs end @@ -56,7 +56,7 @@ module REXML # The argument passed to this method is an array of the entity # declaration. It can be in a number of formats, but in general it # returns (example, result): - # <!ENTITY % YN '"Yes"'> + # <!ENTITY % YN '"Yes"'> # ["%", "YN", "'\"Yes\"'", "\""] # <!ENTITY % YN 'Yes'> # ["%", "YN", "'Yes'", "s"] diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb index fac5ac3e41..d09dc3ac54 100644 --- a/lib/rexml/text.rb +++ b/lib/rexml/text.rb @@ -19,7 +19,7 @@ module REXML attr_accessor :raw NEEDS_A_SECOND_CHECK = /(<|&((#{Entity::NAME});|(#0*((?:\d+)|(?:x[a-fA-F0-9]+)));)?)/um - NUMERICENTITY = /�*((?:\d+)|(?:x[a-fA-F0-9]+));/ + NUMERICENTITY = /�*((?:\d+)|(?:x[a-fA-F0-9]+));/ VALID_CHAR = [ 0x9, 0xA, 0xD, (0x20..0xD7FF), @@ -50,25 +50,25 @@ module REXML | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 - )*$/nx; + )*$/nx; end # Constructor # +arg+ if a String, the content is set to the String. If a Text, - # the object is shallowly cloned. + # the object is shallowly cloned. # # +respect_whitespace+ (boolean, false) if true, whitespace is # respected # # +parent+ (nil) if this is a Parent object, the parent - # will be set to this. + # will be set to this. # # +raw+ (nil) This argument can be given three values. - # If true, then the value of used to construct this object is expected to - # contain no unescaped XML markup, and REXML will not change the text. If + # If true, then the value of used to construct this object is expected to + # contain no unescaped XML markup, and REXML will not change the text. If # this value is false, the string may contain any characters, and REXML will # escape any and all defined entities whose values are contained in the - # text. If this value is nil (the default), then the raw value of the + # text. If this value is nil (the default), then the raw value of the # parent will be used as the raw value for this node. If there is no raw # value for the parent, and no value is supplied, the default is false. # Use this field if you have entities defined for some text, and you don't @@ -89,14 +89,14 @@ module REXML # In the last example, the +entity_filter+ argument is ignored. # # +pattern+ INTERNAL USE ONLY - def initialize(arg, respect_whitespace=false, parent=nil, raw=nil, + def initialize(arg, respect_whitespace=false, parent=nil, raw=nil, entity_filter=nil, illegal=NEEDS_A_SECOND_CHECK ) @raw = false if parent super( parent ) - @raw = parent.raw + @raw = parent.raw else @parent = nil end @@ -208,12 +208,12 @@ module REXML # escaped, meaning that it is a valid XML text node string, and all # entities that can be escaped, have been inserted. This method respects # the entity filter set in the constructor. - # - # # Assume that the entity "s" is defined to be "sean", and that the + # + # # Assume that the entity "s" is defined to be "sean", and that the # # entity "r" is defined to be "russell" - # t = Text.new( "< & sean russell", false, nil, false, ['s'] ) + # t = Text.new( "< & sean russell", false, nil, false, ['s'] ) # t.to_s #-> "< & &s; russell" - # t = Text.new( "< & &s; russell", false, nil, false ) + # t = Text.new( "< & &s; russell", false, nil, false ) # t.to_s #-> "< & &s; russell" # u = Text.new( "sean russell", false, nil, true ) # u.to_s #-> "sean russell" @@ -233,9 +233,9 @@ module REXML # console. This ignores the 'raw' attribute setting, and any # entity_filter. # - # # Assume that the entity "s" is defined to be "sean", and that the + # # Assume that the entity "s" is defined to be "sean", and that the # # entity "r" is defined to be "russell" - # t = Text.new( "< & sean russell", false, nil, false, ['s'] ) + # t = Text.new( "< & sean russell", false, nil, false, ['s'] ) # t.value #-> "< & sean russell" # t = Text.new( "< & &s; russell", false, nil, false ) # t.value #-> "< & sean russell" @@ -246,7 +246,7 @@ module REXML @unnormalized = Text::unnormalize( @string, doctype ) end - # Sets the contents of this text node. This expects the text to be + # Sets the contents of this text node. This expects the text to be # unnormalized. It returns self. # # e = Element.new( "a" ) @@ -259,7 +259,7 @@ module REXML @normalized = nil @raw = false end - + def wrap(string, width, addnewline=false) # Recursively wrap string at width. return string if string.length <= width @@ -282,11 +282,11 @@ module REXML new_string.strip! unless indentfirstline return new_string end - + # == DEPRECATED # See REXML::Formatters # - def write( writer, indent=-1, transitive=false, ie_hack=false ) + def write( writer, indent=-1, transitive=false, ie_hack=false ) Kernel.warn("#{self.class.name}.write is deprecated. See REXML::Formatters") formatter = if indent > -1 REXML::Formatters::Pretty.new( indent ) @@ -337,7 +337,7 @@ module REXML if copy =~ illegal raise ParseException.new( "malformed text: Illegal character #$& in \"#{copy}\"" ) end if illegal - + copy.gsub!( /\r\n?/, "\n" ) if copy.include? ?& copy.gsub!( SETUTITSBUS[0], SLAICEPS[0] ) @@ -365,8 +365,8 @@ module REXML if doctype # Replace all ampersands that aren't part of an entity doctype.entities.each_value do |entity| - copy = copy.gsub( entity.value, - "&#{entity.name};" ) if entity.value and + copy = copy.gsub( entity.value, + "&#{entity.name};" ) if entity.value and not( entity_filter and entity_filter.include?(entity) ) end else diff --git a/lib/rexml/validation/relaxng.rb b/lib/rexml/validation/relaxng.rb index 2b863710b4..2441901d7b 100644 --- a/lib/rexml/validation/relaxng.rb +++ b/lib/rexml/validation/relaxng.rb @@ -79,7 +79,7 @@ module REXML when "mixed" states << Interleave.new( self ) states[-2] << states[-1] - states[-1] << TEXT + states[-1] << TEXT when "define" states << [ event[2]["name"] ] when "ref" @@ -102,7 +102,7 @@ module REXML case event[1] when "element", "attribute" states[-1] << event - when "zeroOrMore", "oneOrMore", "choice", "optional", + when "zeroOrMore", "oneOrMore", "choice", "optional", "interleave", "group", "mixed" states.pop when "define" @@ -139,7 +139,7 @@ module REXML @events.each {|s| s.reset if s.kind_of? State } end - def previous=( previous ) + def previous=( previous ) @previous << previous end @@ -183,7 +183,7 @@ module REXML end def inspect - "< #{to_s} #{@events.collect{|e| + "< #{to_s} #{@events.collect{|e| pre = e == @events[@current] ? '#' : '' pre + e.inspect unless self == e }.join(', ')} >" @@ -201,15 +201,15 @@ module REXML protected def expand_ref_in( arry, ind ) new_events = [] - @references[ arry[ind].to_s ].each{ |evt| + @references[ arry[ind].to_s ].each{ |evt| add_event_to_arry(new_events,evt) } arry[ind,1] = new_events end - def add_event_to_arry( arry, evt ) + def add_event_to_arry( arry, evt ) evt = generate_event( evt ) - if evt.kind_of? String + if evt.kind_of? String arry[-1].event_arg = evt if arry[-1].kind_of? Event and @value @value = false else @@ -272,7 +272,7 @@ module REXML end def matches?(event) - @events[@current].matches?(event) || + @events[@current].matches?(event) || (@current == 0 and @previous[-1].matches?(event)) end @@ -319,7 +319,7 @@ module REXML end def reset - super + super @ord = 0 end @@ -345,7 +345,7 @@ module REXML end def matches?( event ) - @events[@current].matches?(event) || + @events[@current].matches?(event) || (@current == 0 and @ord > 0 and @previous[-1].matches?(event)) end @@ -412,7 +412,7 @@ module REXML #puts "IN CHOICE EXPECTED" #puts "EVENTS = #{@events.inspect}" return [@events[@current]] if @events.size > 0 - return @choices.collect do |x| + return @choices.collect do |x| if x[0].kind_of? State x[0].expected else @@ -426,12 +426,12 @@ module REXML end protected - def add_event_to_arry( arry, evt ) + def add_event_to_arry( arry, evt ) if evt.kind_of? State or evt.class == Ref arry << [evt] - elsif evt[0] == :text + elsif evt[0] == :text if arry[-1] and - arry[-1][-1].kind_of?( Event ) and + arry[-1][-1].kind_of?( Event ) and arry[-1][-1].event_type == :text and @value arry[-1][-1].event_arg = evt[1] @@ -478,7 +478,7 @@ module REXML @choices[idx] = old @choice += 1 end - + #puts "In next with #{event.inspect}." #puts "events is #{@events.inspect}" @events = [] unless @events @@ -490,7 +490,7 @@ module REXML next_current(event) unless @events[@current] return nil unless @events[@current] - expand_ref_in( @events, @current ) if @events[@current].class == Ref + expand_ref_in( @events, @current ) if @events[@current].class == Ref #puts "In next with #{event.inspect}." #puts "Next (#@current) is #{@events[@current]}" if ( @events[@current].kind_of? State ) @@ -530,7 +530,7 @@ module REXML #puts "IN CHOICE EXPECTED" #puts "EVENTS = #{@events.inspect}" return [@events[@current]] if @events[@current] - return @choices[@choice..-1].collect do |x| + return @choices[@choice..-1].collect do |x| if x[0].kind_of? State x[0].expected else diff --git a/lib/rexml/validation/validation.rb b/lib/rexml/validation/validation.rb index 93f5bfb329..f0ffa78912 100644 --- a/lib/rexml/validation/validation.rb +++ b/lib/rexml/validation/validation.rb @@ -14,7 +14,7 @@ module REXML def dump puts @root.inspect end - def validate( event ) + def validate( event ) #puts "Current: #@current" #puts "Event: #{event.inspect}" @attr_stack = [] unless defined? @attr_stack @@ -33,12 +33,12 @@ module REXML sattr = [:start_attribute, nil] eattr = [:end_attribute] text = [:text, nil] - k,v = event[2].find { |key,value| + k,v = event[2].find { |key,value| sattr[1] = key #puts "Looking for #{sattr.inspect}" m = @current.next( sattr ) #puts "Got #{m.inspect}" - if m + if m # If the state has text children... #puts "Looking for #{eattr.inspect}" #puts "Expect #{m.expected}" diff --git a/lib/rexml/xpath.rb b/lib/rexml/xpath.rb index b22969ec8c..5f7ecefe29 100644 --- a/lib/rexml/xpath.rb +++ b/lib/rexml/xpath.rb @@ -64,7 +64,7 @@ module REXML parser.parse(path, element).each( &block ) end - # Returns an array of nodes matching a given XPath. + # Returns an array of nodes matching a given XPath. def XPath::match element, path=nil, namespaces=nil, variables={} parser = XPathParser.new parser.namespaces = namespaces diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb index ead5adaf7f..11950ecd93 100644 --- a/lib/rexml/xpath_parser.rb +++ b/lib/rexml/xpath_parser.rb @@ -88,7 +88,7 @@ module REXML case path[0] when :document - # do nothing + # do nothing return first( path[1..-1], node ) when :child for c in node.children @@ -123,7 +123,7 @@ module REXML end - def match( path_stack, nodeset ) + def match( path_stack, nodeset ) #puts "MATCH: path_stack = #{path_stack.inspect}" #puts "MATCH: nodeset = #{nodeset.inspect}" r = expr( path_stack, nodeset ) @@ -136,7 +136,7 @@ module REXML # Returns a String namespace for a node, given a prefix # The rules are: - # + # # 1. Use the supplied namespace mapping first. # 2. If no mapping was supplied, use the context node to look up the namespace def get_namespace( node, prefix ) @@ -187,8 +187,8 @@ module REXML #puts "node.namespace == #{ns.inspect} => #{node.namespace == ns}" end end - !(node.node_type == :element and - node.name == name and + !(node.node_type == :element and + node.name == name and node.namespace == ns ) end node_types = ELEMENTS @@ -205,7 +205,7 @@ module REXML when :processing_instruction target = path_stack.shift nodeset.delete_if do |node| - (node.node_type != :processing_instruction) or + (node.node_type != :processing_instruction) or ( target!='' and ( node.target != target ) ) end @@ -231,7 +231,7 @@ module REXML when :literal return path_stack.shift - + when :attribute new_nodeset = [] case path_stack.shift @@ -481,23 +481,23 @@ module REXML when :function func_name = path_stack.shift.tr('-','_') arguments = path_stack.shift - #puts "FUNCTION 0: #{func_name}(#{arguments.collect{|a|a.inspect}.join(', ')})" + #puts "FUNCTION 0: #{func_name}(#{arguments.collect{|a|a.inspect}.join(', ')})" subcontext = context ? nil : { :size => nodeset.size } res = [] cont = context - nodeset.each_with_index { |n, i| + nodeset.each_with_index { |n, i| if subcontext subcontext[:node] = n subcontext[:index] = i cont = subcontext end arg_clone = arguments.dclone - args = arg_clone.collect { |arg| + args = arg_clone.collect { |arg| #puts "FUNCTION 1: Calling expr( #{arg.inspect}, [#{n.inspect}] )" - expr( arg, [n], cont ) + expr( arg, [n], cont ) } - #puts "FUNCTION 2: #{func_name}(#{args.collect{|a|a.inspect}.join(', ')})" + #puts "FUNCTION 2: #{func_name}(#{args.collect{|a|a.inspect}.join(', ')})" Functions.context = cont res << Functions.send( func_name, *args ) #puts "FUNCTION 3: #{res[-1].inspect}" @@ -515,10 +515,10 @@ module REXML # FIXME # The next two methods are BAD MOJO! # This is my achilles heel. If anybody thinks of a better - # way of doing this, be my guest. This really sucks, but + # way of doing this, be my guest. This really sucks, but # it is a wonder it works at all. # ######################################################## - + def descendant_or_self( path_stack, nodeset ) rs = [] #puts "#"*80 @@ -547,7 +547,7 @@ module REXML # Reorders an array of nodes so that they are in document order # It tries to do this efficiently. # - # FIXME: I need to get rid of this, but the issue is that most of the XPath + # FIXME: I need to get rid of this, but the issue is that most of the XPath # interpreter functions as a filter, which means that we lose context going # in and out of function calls. If I knew what the index of the nodes was, # I wouldn't have to do this. Maybe add a document IDX for each node? @@ -555,7 +555,7 @@ module REXML def document_order( array_of_nodes ) new_arry = [] array_of_nodes.each { |node| - node_idx = [] + node_idx = [] np = node.node_type == :attribute ? node.element : node while np.parent and np.parent.node_type == :element node_idx << np.parent.index( np ) @@ -579,7 +579,7 @@ module REXML # Builds a nodeset of all of the preceding nodes of the supplied node, # in reverse document order - # preceding:: includes every element in the document that precedes this node, + # preceding:: includes every element in the document that precedes this node, # except for ancestors def preceding( node ) #puts "IN PRECEDING" @@ -609,9 +609,9 @@ module REXML #puts "NODE: #{node.inspect}" #puts "PREVIOUS NODE: #{node.previous_sibling_node.inspect}" #puts "PARENT NODE: #{node.parent}" - psn = node.previous_sibling_node + psn = node.previous_sibling_node if psn.nil? - if node.parent.nil? or node.parent.class == Document + if node.parent.nil? or node.parent.class == Document return nil end return node.parent @@ -647,9 +647,9 @@ module REXML end def next_sibling_node(node) - psn = node.next_sibling_node + psn = node.next_sibling_node while psn.nil? - if node.parent.nil? or node.parent.class == Document + if node.parent.nil? or node.parent.class == Document return nil end node = node.parent diff --git a/lib/rinda/rinda.rb b/lib/rinda/rinda.rb index 6c59e68654..18e284a544 100644 --- a/lib/rinda/rinda.rb +++ b/lib/rinda/rinda.rb @@ -58,7 +58,7 @@ module Rinda ## # The number of elements in the tuple. - + def size @tuple.size end @@ -162,7 +162,7 @@ module Rinda end return true end - + ## # Alias for #match. @@ -171,7 +171,7 @@ module Rinda end end - + ## # <i>Documentation?</i> @@ -184,7 +184,7 @@ module Rinda @drb_uri = uri @drb_ref = ref end - + ## # This DRbObjectTemplate matches +ro+ if the remote object's drburi and # drbref are the same. +nil+ is used as a wildcard. @@ -213,14 +213,14 @@ module Rinda def initialize(ts) @ts = ts end - + ## # Adds +tuple+ to the proxied TupleSpace. See TupleSpace#write. def write(tuple, sec=nil) @ts.write(tuple, sec) end - + ## # Takes +tuple+ from the proxied TupleSpace. See TupleSpace#take. @@ -229,14 +229,14 @@ module Rinda @ts.move(DRbObject.new(port), tuple, sec, &block) port[0] end - + ## # Reads +tuple+ from the proxied TupleSpace. See TupleSpace#read. def read(tuple, sec=nil, &block) @ts.read(tuple, sec, &block) end - + ## # Reads all tuples matching +tuple+ from the proxied TupleSpace. See # TupleSpace#read_all. @@ -244,7 +244,7 @@ module Rinda def read_all(tuple) @ts.read_all(tuple) end - + ## # Registers for notifications of event +ev+ on the proxied TupleSpace. # See TupleSpace#notify diff --git a/lib/rinda/ring.rb b/lib/rinda/ring.rb index 4dc7c7d79a..b25fd99856 100644 --- a/lib/rinda/ring.rb +++ b/lib/rinda/ring.rb @@ -49,7 +49,7 @@ module Rinda end end end - + ## # Extracts the response URI from +msg+ and adds it to TupleSpace where it # will be picked up by +reply_service+ for notification. @@ -74,7 +74,7 @@ module Rinda end end end - + ## # Pulls lookup tuples out of the TupleSpace and sends their DRb object the # address of the local TupleSpace. @@ -104,7 +104,7 @@ module Rinda # created RingFinger. def self.finger - unless @@finger + unless @@finger @@finger = self.new @@finger.lookup_ring_any end @@ -207,7 +207,7 @@ module Rinda @rings.push(it) end end - + @primary = queue.pop raise('RingNotFound') if @primary.nil? @primary diff --git a/lib/rinda/tuplespace.rb b/lib/rinda/tuplespace.rb index 6ca30a7b4b..113aa0de15 100644 --- a/lib/rinda/tuplespace.rb +++ b/lib/rinda/tuplespace.rb @@ -73,14 +73,14 @@ module Rinda end ## - # Reset the expiry time according to +sec_or_renewer+. + # Reset the expiry time according to +sec_or_renewer+. # # +nil+:: it is set to expire in the far future. # +false+:: it has expired. # Numeric:: it will expire in that many seconds. # # Otherwise the argument refers to some kind of renewer object - # which will reset its expiry time. + # which will reset its expiry time. def renew(sec_or_renewer) sec, @renewer = get_renewer(sec_or_renewer) @@ -168,7 +168,7 @@ module Rinda def match(tuple) @tuple.match(tuple) end - + alias === match def make_tuple(ary) # :nodoc: @@ -224,11 +224,11 @@ module Rinda # # ts = Rinda::TupleSpace.new # observer = ts.notify 'write', [nil] - # + # # Thread.start do # observer.each { |t| p t } # end - # + # # 3.times { |i| ts.write [i] } # # Outputs: @@ -276,7 +276,7 @@ module Rinda it = pop yield(it) end - rescue + rescue ensure cancel end @@ -295,16 +295,16 @@ module Rinda def initialize @bin = [] end - + def add(tuple) @bin.push(tuple) end - + def delete(tuple) idx = @bin.rindex(tuple) @bin.delete_at(idx) if idx end - + def find(&blk) @bin.reverse_each do |x| return x if yield(x) diff --git a/lib/rss/0.9.rb b/lib/rss/0.9.rb index 7b24e7596d..37dc7af94e 100644 --- a/lib/rss/0.9.rb +++ b/lib/rss/0.9.rb @@ -8,7 +8,7 @@ module RSS def self.append_features(klass) super - + klass.install_must_call_validator('', "") end end @@ -123,7 +123,7 @@ module RSS def not_need_to_call_setup_maker_variables %w(image textInput) end - + class SkipDays < Element include RSS09 @@ -146,11 +146,11 @@ module RSS self.content = args[0] end end - + end - + end - + class SkipHours < Element include RSS09 @@ -174,13 +174,13 @@ module RSS end end end - + end - + class Image < Element include RSS09 - + %w(url title link).each do |name| install_text_element(name, "", nil) end @@ -239,9 +239,9 @@ module RSS end end end - + class Item < Element - + include RSS09 [ @@ -269,7 +269,7 @@ module RSS @enclosure.setup_maker(item) if @enclosure @source.setup_maker(item) if @source end - + class Source < Element include RSS09 @@ -279,7 +279,7 @@ module RSS ].each do |name, uri, required| install_get_attribute(name, uri, required) end - + content_setup def initialize(*args) @@ -341,7 +341,7 @@ module RSS class Category < Element include RSS09 - + [ ["domain", "", false] ].each do |name, uri, required| @@ -369,11 +369,11 @@ module RSS category.domain = domain category.content = content end - + end end - + class TextInput < Element include RSS09 @@ -399,9 +399,9 @@ module RSS maker.textinput end end - + end - + end RSS09::ELEMENTS.each do |name| @@ -412,7 +412,7 @@ module RSS private def initial_start_rss(tag_name, prefix, attrs, ns) check_ns(tag_name, prefix, ns, "") - + @rss = Rss.new(attrs['version'], @version, @encoding, @standalone) @rss.do_validate = @do_validate @rss.xml_stylesheets = @xml_stylesheets @@ -422,7 +422,7 @@ module RSS end @proc_stack.push(pr) end - + end end diff --git a/lib/rss/1.0.rb b/lib/rss/1.0.rb index f04e61c5eb..f2f89739b6 100644 --- a/lib/rss/1.0.rb +++ b/lib/rss/1.0.rb @@ -8,7 +8,7 @@ module RSS def self.append_features(klass) super - + klass.install_must_call_validator('', ::RSS::URI) end @@ -64,13 +64,13 @@ module RSS URI end end - + [ ["resource", [URI, ""], true] ].each do |name, uri, required| install_get_attribute(name, uri, required) end - + def initialize(*args) if Utils.element_initialize_arguments?(args) super @@ -98,10 +98,10 @@ module RSS end @tag_name = 'Seq' - + install_have_children_element("li", URI, "*") install_must_call_validator('rdf', ::RSS::RDF::URI) - + def initialize(*args) if Utils.element_initialize_arguments?(args) super @@ -114,7 +114,7 @@ module RSS def full_name tag_name_with_prefix(PREFIX) end - + def setup_maker(target) lis.each do |li| target << li.resource @@ -135,10 +135,10 @@ module RSS end @tag_name = 'Bag' - + install_have_children_element("li", URI, "*") install_must_call_validator('rdf', URI) - + def initialize(*args) if Utils.element_initialize_arguments?(args) super @@ -151,7 +151,7 @@ module RSS def full_name tag_name_with_prefix(PREFIX) end - + def setup_maker(target) lis.each do |li| target << li.resource @@ -162,7 +162,7 @@ module RSS class Channel < Element include RSS10 - + class << self def required_uri @@ -202,17 +202,17 @@ module RSS def maker_target(maker) maker.channel end - + def setup_maker_attributes(channel) channel.about = about end class Image < Element - + include RSS10 class << self - + def required_uri ::RSS::URI end @@ -225,7 +225,7 @@ module RSS install_get_attribute(name, uri, required, nil, nil, "#{PREFIX}:#{name}") end - + def initialize(*args) if Utils.element_initialize_arguments?(args) super @@ -237,11 +237,11 @@ module RSS end class Textinput < Element - + include RSS10 class << self - + def required_uri ::RSS::URI end @@ -254,7 +254,7 @@ module RSS install_get_attribute(name, uri, required, nil, nil, "#{PREFIX}:#{name}") end - + def initialize(*args) if Utils.element_initialize_arguments?(args) super @@ -264,7 +264,7 @@ module RSS end end end - + class Items < Element include RSS10 @@ -272,16 +272,16 @@ module RSS Seq = ::RSS::RDF::Seq class << self - + def required_uri ::RSS::URI end - + end install_have_child_element("Seq", URI, nil) install_must_call_validator('rdf', URI) - + def initialize(*args) if Utils.element_initialize_arguments?(args) super @@ -309,7 +309,7 @@ module RSS include RSS10 class << self - + def required_uri ::RSS::URI end @@ -351,7 +351,7 @@ module RSS def required_uri ::RSS::URI end - + end diff --git a/lib/rss/2.0.rb b/lib/rss/2.0.rb index 3798da4eb7..9622c598d9 100644 --- a/lib/rss/2.0.rb +++ b/lib/rss/2.0.rb @@ -29,7 +29,7 @@ module RSS Category = Item::Category class Item - + [ ["comments", "?"], ["author", "?"], @@ -57,9 +57,9 @@ module RSS _setup_maker_element(item) @guid.setup_maker(item) if @guid end - + class Guid < Element - + include RSS09 [ diff --git a/lib/rss/converter.rb b/lib/rss/converter.rb index 745d6de965..3e79eba4fb 100644 --- a/lib/rss/converter.rb +++ b/lib/rss/converter.rb @@ -3,7 +3,7 @@ require "rss/utils" module RSS class Converter - + include Utils def initialize(to_enc, from_enc=nil) @@ -63,11 +63,11 @@ module RSS raise UnknownConversionMethodError.new(to_enc, from_enc) end end - + def def_else_enc(to_enc, from_enc) def_iconv_convert(to_enc, from_enc, 0) end - + def def_same_enc() def_convert do |value| value @@ -101,40 +101,40 @@ module RSS def def_to_euc_jp_from_utf_8 def_uconv_convert_if_can('u8toeuc', 'EUC-JP', 'UTF-8', '-We') end - + def def_to_utf_8_from_euc_jp def_uconv_convert_if_can('euctou8', 'UTF-8', 'EUC-JP', '-Ew') end - + def def_to_shift_jis_from_utf_8 def_uconv_convert_if_can('u8tosjis', 'Shift_JIS', 'UTF-8', '-Ws') end - + def def_to_utf_8_from_shift_jis def_uconv_convert_if_can('sjistou8', 'UTF-8', 'Shift_JIS', '-Sw') end - + def def_to_euc_jp_from_shift_jis require "nkf" def_convert do |value| "NKF.nkf('-Se', #{value})" end end - + def def_to_shift_jis_from_euc_jp require "nkf" def_convert do |value| "NKF.nkf('-Es', #{value})" end end - + def def_to_euc_jp_from_iso_2022_jp require "nkf" def_convert do |value| "NKF.nkf('-Je', #{value})" end end - + def def_to_iso_2022_jp_from_euc_jp require "nkf" def_convert do |value| @@ -147,7 +147,7 @@ module RSS "#{value}.unpack('C*').pack('U*')" end end - + def def_to_iso_8859_1_from_utf_8 def_convert do |value| <<-EOC @@ -164,7 +164,7 @@ module RSS EOC end end - + end - + end diff --git a/lib/rss/dublincore.rb b/lib/rss/dublincore.rb index 7ba239f8f1..53a4ca70d6 100644 --- a/lib/rss/dublincore.rb +++ b/lib/rss/dublincore.rb @@ -25,7 +25,7 @@ module RSS def #{full_name} @#{full_name}.first and @#{full_name}.first.value end - + def #{full_name}=(new_value) @#{full_name}[0] = Utils.new_with_value_if_need(#{klass_name}, new_value) end @@ -50,7 +50,7 @@ module RSS EOC end end - + module DublinCoreModel extend BaseModel @@ -76,26 +76,26 @@ module RSS DATE_ELEMENTS = { "date" => "w3cdtf", } - + ELEMENT_NAME_INFOS = DublinCoreModel::TEXT_ELEMENTS.to_a DublinCoreModel::DATE_ELEMENTS.each do |name, | ELEMENT_NAME_INFOS << [name, nil] end - + ELEMENTS = TEXT_ELEMENTS.keys + DATE_ELEMENTS.keys ELEMENTS.each do |name, plural_name| module_eval(<<-EOC, *get_file_and_line_from_caller(0)) class DublinCore#{Utils.to_class_name(name)} < Element include RSS10 - + content_setup class << self def required_prefix DC_PREFIX end - + def required_uri DC_URI end @@ -105,7 +105,7 @@ module RSS alias_method(:value, :content) alias_method(:value=, :content=) - + def initialize(*args) if Utils.element_initialize_arguments?(args) super @@ -114,7 +114,7 @@ module RSS self.content = args[0] end end - + def full_name tag_name_with_prefix(DC_PREFIX) end diff --git a/lib/rss/image.rb b/lib/rss/image.rb index c4714aea12..e79e9f5e65 100644 --- a/lib/rss/image.rb +++ b/lib/rss/image.rb @@ -15,7 +15,7 @@ module RSS BaseListener.install_class_name(IMAGE_URI, name, "Image#{class_name}") IMAGE_ELEMENTS << "#{IMAGE_PREFIX}_#{name}" end - + module ImageModelUtils def validate_one_tag_name(ignore_unknown_element, name, tags) if !ignore_unknown_element @@ -25,7 +25,7 @@ module RSS raise TooMuchTagError.new(name, tag_name) if tags.size > 1 end end - + module ImageItemModel include ImageModelUtils extend BaseModel @@ -43,12 +43,12 @@ module RSS include DublinCoreModel @tag_name = "item" - + class << self def required_prefix IMAGE_PREFIX end - + def required_uri IMAGE_URI end @@ -102,11 +102,11 @@ module RSS end end end - + module ImageFaviconModel include ImageModelUtils extend BaseModel - + def self.append_features(klass) super @@ -122,12 +122,12 @@ module RSS include DublinCoreModel @tag_name = "favicon" - + class << self def required_prefix IMAGE_PREFIX end - + def required_uri IMAGE_URI end @@ -154,7 +154,7 @@ module RSS end set_size(new_value) end - + alias image_size= size= alias image_size size diff --git a/lib/rss/maker/0.9.rb b/lib/rss/maker/0.9.rb index cc7db8c638..ed992028cf 100644 --- a/lib/rss/maker/0.9.rb +++ b/lib/rss/maker/0.9.rb @@ -4,14 +4,14 @@ require "rss/maker/base" module RSS module Maker - + class RSS09 < RSSBase - + def initialize(feed_version) super @feed_type = "rss" end - + private def make_feed Rss.new(@feed_version, @version, @encoding, @standalone) @@ -38,20 +38,20 @@ module RSS raise NotSetError.new("maker.channel", _not_set_required_variables) end end - + private def setup_items(rss) @maker.items.to_feed(rss) end - + def setup_image(rss) @maker.image.to_feed(rss) end - + def setup_textinput(rss) @maker.textinput.to_feed(rss) end - + def variables super + ["pubDate"] end @@ -78,7 +78,7 @@ module RSS end end end - + class Day < DayBase def to_feed(rss, days) day = Rss::Channel::SkipDays::Day.new @@ -96,7 +96,7 @@ module RSS end end end - + class SkipHours < SkipHoursBase def to_feed(rss, channel) unless @hours.empty? @@ -108,7 +108,7 @@ module RSS end end end - + class Hour < HourBase def to_feed(rss, hours) hour = Rss::Channel::SkipHours::Hour.new @@ -126,7 +126,7 @@ module RSS end end end - + class Cloud < CloudBase def to_feed(*args) end @@ -243,7 +243,7 @@ module RSS true end end - + class Items < ItemsBase def to_feed(rss) if rss.channel @@ -253,7 +253,7 @@ module RSS setup_other_elements(rss, rss.items) end end - + class Item < ItemBase def to_feed(rss) item = Rss::Channel::Item.new @@ -439,7 +439,7 @@ module RSS end end end - + class Textinput < TextinputBase def to_feed(rss) textInput = Rss::Channel::TextInput.new diff --git a/lib/rss/maker/1.0.rb b/lib/rss/maker/1.0.rb index a1e2594f70..676f662915 100644 --- a/lib/rss/maker/1.0.rb +++ b/lib/rss/maker/1.0.rb @@ -60,7 +60,7 @@ module RSS rss.channel.items = items set_parent(rss.channel, items) end - + def setup_image(rss) if @maker.image.have_required_values? image = RDF::Channel::Image.new(@maker.image.url) @@ -91,11 +91,11 @@ module RSS class SkipDays < SkipDaysBase def to_feed(*args) end - + class Day < DayBase end end - + class SkipHours < SkipHoursBase def to_feed(*args) end @@ -103,7 +103,7 @@ module RSS class Hour < HourBase end end - + class Cloud < CloudBase def to_feed(*args) end @@ -403,7 +403,7 @@ module RSS end end end - + class Textinput < TextinputBase def to_feed(rss) if @link diff --git a/lib/rss/maker/2.0.rb b/lib/rss/maker/2.0.rb index 67d68126ac..15b1349c2a 100644 --- a/lib/rss/maker/2.0.rb +++ b/lib/rss/maker/2.0.rb @@ -4,9 +4,9 @@ require "rss/maker/0.9" module RSS module Maker - + class RSS20 < RSS09 - + def initialize(feed_version="2.0") super end @@ -17,17 +17,17 @@ module RSS def required_variable_names %w(link) end - + class SkipDays < RSS09::Channel::SkipDays class Day < RSS09::Channel::SkipDays::Day end end - + class SkipHours < RSS09::Channel::SkipHours class Hour < RSS09::Channel::SkipHours::Hour end end - + class Cloud < RSS09::Channel::Cloud def to_feed(rss, channel) cloud = Rss::Channel::Cloud.new @@ -51,7 +51,7 @@ module RSS category.to_feed(rss, channel) end end - + class Category < RSS09::Channel::Categories::Category def to_feed(rss, channel) category = Rss::Channel::Category.new @@ -81,14 +81,14 @@ module RSS end end end - + class Image < RSS09::Image private def required_element? false end end - + class Items < RSS09::Items class Item < RSS09::Items::Item private @@ -179,7 +179,7 @@ module RSS category.to_feed(rss, item) end end - + class Category < RSS09::Items::Item::Categories::Category def to_feed(rss, item) category = Rss::Channel::Item::Category.new @@ -212,11 +212,11 @@ module RSS end end end - + class Textinput < RSS09::Textinput end end - + add_maker("2.0", "2.0", RSS20) add_maker("rss2.0", "2.0", RSS20) end diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb index 3a7d255ae9..615088f8f7 100644 --- a/lib/rss/maker/base.rb +++ b/lib/rss/maker/base.rb @@ -395,7 +395,7 @@ module RSS end EOC end - + attr_reader :feed_version alias_method(:rss_version, :feed_version) attr_accessor :version, :encoding, :standalone @@ -409,7 +409,7 @@ module RSS @encoding = "UTF-8" @standalone = nil end - + def make yield(self) to_feed @@ -423,7 +423,7 @@ module RSS feed.validate feed end - + private remove_method :make_xml_stylesheets def make_xml_stylesheets @@ -440,7 +440,7 @@ module RSS attr_accessor attribute add_need_initialize_variable(attribute) end - + def to_feed(feed) xss = ::RSS::XMLStyleSheet.new guess_type_if_need(xss) @@ -463,7 +463,7 @@ module RSS end end end - + class ChannelBase < Base include SetupDefaultDate @@ -538,7 +538,7 @@ module RSS end end end - + class SkipHoursBase < Base def_array_element("hour") @@ -549,7 +549,7 @@ module RSS end end end - + class CloudBase < Base %w(domain port path registerProcedure protocol).each do |element| attr_accessor element @@ -619,7 +619,7 @@ module RSS include AtomTextConstructBase end end - + class ImageBase < Base %w(title url width height description).each do |element| attr_accessor element @@ -630,18 +630,18 @@ module RSS @maker.channel.link end end - + class ItemsBase < Base def_array_element("item") attr_accessor :do_sort, :max_size - + def initialize(maker) super @do_sort = false @max_size = -1 end - + def normalize if @max_size >= 0 sort_if_need[0...@max_size] diff --git a/lib/rss/maker/dublincore.rb b/lib/rss/maker/dublincore.rb index ff4813fe19..9069c27d06 100644 --- a/lib/rss/maker/dublincore.rb +++ b/lib/rss/maker/dublincore.rb @@ -90,7 +90,7 @@ EOC class ChannelBase include DublinCoreModel end - + class ImageBase; include DublinCoreModel; end class ItemsBase class ItemBase diff --git a/lib/rss/maker/image.rb b/lib/rss/maker/image.rb index b95cf4c714..e2b36e0a08 100644 --- a/lib/rss/maker/image.rb +++ b/lib/rss/maker/image.rb @@ -89,7 +89,7 @@ EOC end class ChannelBase; include Maker::ImageFaviconModel; end - + class ItemsBase class ItemBase; include Maker::ImageItemModel; end end diff --git a/lib/rss/maker/taxonomy.rb b/lib/rss/maker/taxonomy.rb index 211603840f..13ae9aa805 100644 --- a/lib/rss/maker/taxonomy.rb +++ b/lib/rss/maker/taxonomy.rb @@ -72,12 +72,12 @@ EOC class TaxonomyTopicBase < Base include DublinCoreModel include TaxonomyTopicsModel - + attr_accessor :value add_need_initialize_variable("value") alias_method(:taxo_link, :value) alias_method(:taxo_link=, :value=) - + def have_required_values? @value end @@ -88,11 +88,11 @@ EOC class RSSBase include TaxonomyTopicModel end - + class ChannelBase include TaxonomyTopicsModel end - + class ItemsBase class ItemBase include TaxonomyTopicsModel diff --git a/lib/rss/maker/trackback.rb b/lib/rss/maker/trackback.rb index 278fe53ebe..00f001cb85 100644 --- a/lib/rss/maker/trackback.rb +++ b/lib/rss/maker/trackback.rb @@ -19,7 +19,7 @@ module RSS class TrackBackAboutBase < Base attr_accessor :value add_need_initialize_variable("value") - + alias_method(:resource, :value) alias_method(:resource=, :value=) alias_method(:content, :value) diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb index 9b28f0fa8a..225e07d504 100644 --- a/lib/rss/parser.rb +++ b/lib/rss/parser.rb @@ -98,7 +98,7 @@ module RSS return rss if maybe_xml?(rss) uri = to_uri(rss) - + if uri.respond_to?(:read) uri.read elsif !rss.tainted? and File.readable?(rss) @@ -133,7 +133,7 @@ module RSS listener.raise_for_undefined_entity? end end - + def initialize(rss) @listener = self.class.listener.new @rss = rss @@ -196,13 +196,13 @@ module RSS def available_tags(uri) (@@accessor_bases[uri] || {}).keys end - + # register uri against this name. def register_uri(uri, name) @@registered_uris[name] ||= {} @@registered_uris[name][uri] = nil end - + # test if this uri is registered against this name def uri_registered?(uri, name) @@registered_uris[name].has_key?(uri) @@ -228,11 +228,11 @@ module RSS install_accessor_base(uri, name, accessor_base) def_get_text_element(uri, name, *get_file_and_line_from_caller(1)) end - + def raise_for_undefined_entity? true end - + private # set the accessor for the uri, tag_name pair def install_accessor_base(uri, tag_name, accessor_base) @@ -279,7 +279,7 @@ module RSS @xml_element = nil @last_xml_element = nil end - + # set instance vars for version, encoding, standalone def xmldecl(version, encoding, standalone) @version, @encoding, @standalone = version, encoding, standalone diff --git a/lib/rss/rexmlparser.rb b/lib/rss/rexmlparser.rb index 4dabf59199..7112ac3669 100644 --- a/lib/rss/rexmlparser.rb +++ b/lib/rss/rexmlparser.rb @@ -7,7 +7,7 @@ if ([$1.to_i, $2.to_i] <=> [2, 5]) < 0 end module RSS - + class REXMLParser < BaseParser class << self @@ -15,7 +15,7 @@ module RSS REXMLListener end end - + private def _parse begin @@ -28,9 +28,9 @@ module RSS raise NotWellFormedError.new(line){e.message} end end - + end - + class REXMLListener < BaseListener include REXML::StreamListener @@ -41,7 +41,7 @@ module RSS false end end - + def xmldecl(version, encoding, standalone) super(version, encoding, standalone == "yes") # Encoding is converted to UTF-8 when REXML parse XML. diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb index 4b943ec55b..d1f6181a47 100644 --- a/lib/rss/rss.rb +++ b/lib/rss/rss.rb @@ -249,7 +249,7 @@ EOC # accessor convert_attr_reader name date_writer(name, type, disp_name) - + install_element(name) do |n, elem_name| <<-EOC if @#{n} @@ -634,7 +634,7 @@ EOC include SetupMaker INDENT = " " - + MUST_CALL_VALIDATORS = {} MODELS = [] GET_ATTRIBUTES = [] @@ -830,7 +830,7 @@ EOC def full_name tag_name end - + def converter=(converter) @converter = converter targets = children.dup @@ -865,7 +865,7 @@ EOC ensure @do_validate = do_validate end - + def validate_for_stream(tags, ignore_unknown_element=true) validate_attribute __validate(ignore_unknown_element, tags, false) @@ -985,7 +985,7 @@ EOC end_tag = "\n#{indent}</#{full_name}>" end end - + start_tag + content.join("\n") + end_tag end @@ -1010,7 +1010,7 @@ EOC end attrs end - + def tag_name_with_prefix(prefix) "#{prefix}:#{tag_name}" end @@ -1210,7 +1210,7 @@ EOC module RootElementMixin include XMLStyleSheetMixin - + attr_reader :output_encoding attr_reader :feed_type, :feed_subtype, :feed_version attr_accessor :version, :encoding, :standalone @@ -1296,7 +1296,7 @@ EOC rv << "?>\n" rv end - + def ns_declarations decls = {} self.class::NSPOOL.collect do |prefix, uri| diff --git a/lib/rss/syndication.rb b/lib/rss/syndication.rb index 3eb15429f6..c375645dd6 100644 --- a/lib/rss/syndication.rb +++ b/lib/rss/syndication.rb @@ -8,11 +8,11 @@ module RSS RDF.install_ns(SY_PREFIX, SY_URI) module SyndicationModel - + extend BaseModel - + ELEMENTS = [] - + def self.append_features(klass) super diff --git a/lib/rss/taxonomy.rb b/lib/rss/taxonomy.rb index 276f63b05d..b82e55dacc 100644 --- a/lib/rss/taxonomy.rb +++ b/lib/rss/taxonomy.rb @@ -24,7 +24,7 @@ module RSS module TaxonomyTopicsModel extend BaseModel - + def self.append_features(klass) super @@ -37,21 +37,21 @@ module RSS class TaxonomyTopics < Element include RSS10 - + Bag = ::RSS::RDF::Bag class << self def required_prefix TAXO_PREFIX end - + def required_uri TAXO_URI end end @tag_name = "topics" - + install_have_child_element("Bag", RDF::URI, nil) install_must_call_validator('rdf', RDF::URI) @@ -84,10 +84,10 @@ module RSS end end end - + module TaxonomyTopicModel extend BaseModel - + def self.append_features(klass) super var_name = "#{TAXO_PREFIX}_topic" @@ -99,12 +99,12 @@ module RSS include DublinCoreModel include TaxonomyTopicsModel - + class << self def required_prefix TAXO_PREFIX end - + def required_uri TAXO_URI end @@ -115,7 +115,7 @@ module RSS install_get_attribute("about", ::RSS::RDF::URI, true, nil, nil, "#{RDF::PREFIX}:about") install_text_element("link", TAXO_URI, "?", "#{TAXO_PREFIX}_link") - + def initialize(*args) if Utils.element_initialize_arguments?(args) super diff --git a/lib/rss/trackback.rb b/lib/rss/trackback.rb index ee2491f332..59fedb5f3e 100644 --- a/lib/rss/trackback.rb +++ b/lib/rss/trackback.rb @@ -23,7 +23,7 @@ module RSS module BaseTrackBackModel ELEMENTS = %w(ping about) - + def append_features(klass) super @@ -47,7 +47,7 @@ module RSS end EOC end - + [%w(about s)].each do |name, postfix| var_name = "#{TRACKBACK_PREFIX}_#{name}" klass_name = "TrackBack#{Utils.to_class_name(name)}" @@ -105,7 +105,7 @@ module RSS def required_prefix TRACKBACK_PREFIX end - + def required_uri TRACKBACK_URI end @@ -141,17 +141,17 @@ module RSS include RSS10 class << self - + def required_prefix TRACKBACK_PREFIX end - + def required_uri TRACKBACK_URI end end - + @tag_name = "about" [ @@ -163,7 +163,7 @@ module RSS alias_method(:value, :resource) alias_method(:value=, :resource=) - + def initialize(*args) if Utils.element_initialize_arguments?(args) super @@ -185,7 +185,7 @@ module RSS def setup_maker_attributes(about) about.resource = self.resource end - + end end @@ -197,7 +197,7 @@ module RSS include RSS09 @tag_name = "ping" - + content_setup class << self @@ -205,13 +205,13 @@ module RSS def required_prefix TRACKBACK_PREFIX end - + def required_uri TRACKBACK_URI end end - + alias_method(:value, :content) alias_method(:value=, :content=) @@ -223,26 +223,26 @@ module RSS self.content = args[0] end end - + def full_name tag_name_with_prefix(TRACKBACK_PREFIX) end - + end class TrackBackAbout < Element include RSS09 @tag_name = "about" - + content_setup class << self - + def required_prefix TRACKBACK_PREFIX end - + def required_uri TRACKBACK_URI end @@ -260,11 +260,11 @@ module RSS self.content = args[0] end end - + def full_name tag_name_with_prefix(TRACKBACK_PREFIX) end - + end end diff --git a/lib/rss/utils.rb b/lib/rss/utils.rb index 0e4001e1f3..75b05d45c7 100644 --- a/lib/rss/utils.rb +++ b/lib/rss/utils.rb @@ -8,7 +8,7 @@ module RSS "#{part[0, 1].upcase}#{part[1..-1]}" end.join("") end - + def get_file_and_line_from_caller(i=0) file, line, = caller[i].split(':') line = line.to_i @@ -21,7 +21,7 @@ module RSS s.to_s.gsub(/&/, "&").gsub(/\"/, """).gsub(/>/, ">").gsub(/</, "<") end alias h html_escape - + # If +value+ is an instance of class +klass+, return it, else # create a new instance of +klass+ with value +value+. def new_with_value_if_need(klass, value) diff --git a/lib/rss/xml-stylesheet.rb b/lib/rss/xml-stylesheet.rb index 559d6bcd56..96ee95050e 100644 --- a/lib/rss/xml-stylesheet.rb +++ b/lib/rss/xml-stylesheet.rb @@ -8,7 +8,7 @@ module RSS super @xml_stylesheets = [] end - + private def xml_stylesheet_pi xsss = @xml_stylesheets.collect do |xss| @@ -94,7 +94,7 @@ module RSS xss.__send__("#{attr}=", __send__(attr)) end end - + private def guess_type(filename) /\.([^.]+)$/ =~ filename diff --git a/lib/rss/xmlparser.rb b/lib/rss/xmlparser.rb index 3dfe7d461a..aa902be396 100644 --- a/lib/rss/xmlparser.rb +++ b/lib/rss/xmlparser.rb @@ -26,9 +26,9 @@ module XML end module RSS - + class REXMLLikeXMLParser < ::XML::Parser - + include ::XML::Encoding_ja def listener=(listener) @@ -38,7 +38,7 @@ module RSS def startElement(name, attrs) @listener.tag_start(name, attrs) end - + def endElement(name) @listener.tag_end(name) end @@ -64,7 +64,7 @@ module RSS XMLParserListener end end - + private def _parse begin @@ -75,13 +75,13 @@ module RSS raise NotWellFormedError.new(parser.line){e.message} end end - + end - + class XMLParserListener < BaseListener include ListenerMixin - + def xmldecl(version, encoding, standalone) super # Encoding is converted to UTF-8 when XMLParser parses XML. diff --git a/lib/rss/xmlscanner.rb b/lib/rss/xmlscanner.rb index 61b9fa6bf4..1cdf81c0c3 100644 --- a/lib/rss/xmlscanner.rb +++ b/lib/rss/xmlscanner.rb @@ -2,15 +2,15 @@ require 'xmlscan/scanner' require 'stringio' module RSS - + class XMLScanParser < BaseParser - + class << self def listener XMLScanListener end end - + private def _parse begin @@ -26,11 +26,11 @@ module RSS raise NotWellFormedError.new(lineno){e.message} end end - + end class XMLScanListener < BaseListener - + include XMLScan::Visitor include ListenerMixin diff --git a/lib/rubygems/builder.rb b/lib/rubygems/builder.rb index 6fd8528f56..1c18c38d48 100644 --- a/lib/rubygems/builder.rb +++ b/lib/rubygems/builder.rb @@ -11,7 +11,7 @@ module Gem # to produce a .gem file. # class Builder - + include UserInteraction ## # Constructs a builder instance for the provided specification @@ -38,7 +38,7 @@ module Gem say success @spec.file_name end - + def success <<-EOM Successfully built RubyGem diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb index dd9a1aee15..5a8dec451e 100644 --- a/lib/rubygems/command_manager.rb +++ b/lib/rubygems/command_manager.rb @@ -15,12 +15,12 @@ module Gem # sub-commands supported by the gem command. class CommandManager include UserInteraction - + # Return the authoritative instance of the command manager. def self.instance @command_manager ||= CommandManager.new end - + # Register all the subcommands supported by the gem command. def initialize @commands = {} @@ -52,24 +52,24 @@ module Gem register_command :update register_command :which end - + # Register the command object. def register_command(command_obj) @commands[command_obj] = false end - + # Return the registered command from the command name. def [](command_name) command_name = command_name.intern return nil if @commands[command_name].nil? @commands[command_name] ||= load_and_instantiate(command_name) end - + # Return a list of all command names (as strings). def command_names @commands.keys.collect {|key| key.to_s}.sort end - + # Run the config specified by +args+. def run(args) process_args(args) @@ -88,7 +88,7 @@ module Gem if args.size == 0 say Gem::Command::HELP terminate_interaction(1) - end + end case args[0] when '-h', '--help' say Gem::Command::HELP @@ -122,7 +122,7 @@ module Gem len = cmd_name.length self.command_names.select { |n| cmd_name == n[0,len] } end - + private def load_and_instantiate(command_name) @@ -143,4 +143,4 @@ module Gem end end end -end +end diff --git a/lib/rubygems/commands/check_command.rb b/lib/rubygems/commands/check_command.rb index 17c2c8f9c7..4eefca4232 100644 --- a/lib/rubygems/commands/check_command.rb +++ b/lib/rubygems/commands/check_command.rb @@ -46,7 +46,7 @@ class Gem::Commands::CheckCommand < Gem::Command say "\t#{error_entry.problem}" say end - else + else say "#{key} is error-free" end say diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb index 82180d485c..2790ae7e3e 100644 --- a/lib/rubygems/commands/rdoc_command.rb +++ b/lib/rubygems/commands/rdoc_command.rb @@ -20,12 +20,12 @@ module Gem 'installed gems') do |value, options| options[:all] = value end - add_option('--[no-]rdoc', + add_option('--[no-]rdoc', 'Include RDoc generated documents') do |value, options| options[:include_rdoc] = value end - add_option('--[no-]ri', + add_option('--[no-]ri', 'Include RI generated documents' ) do |value, options| options[:include_ri] = value diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb index 96da19c0f7..96f2e2c94d 100644 --- a/lib/rubygems/commands/search_command.rb +++ b/lib/rubygems/commands/search_command.rb @@ -32,6 +32,6 @@ module Gem super end end - + end end diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb index 934516ed91..545ef1a55a 100644 --- a/lib/rubygems/config_file.rb +++ b/lib/rubygems/config_file.rb @@ -30,7 +30,7 @@ class Gem::ConfigFile PLATFORM_DEFAULTS = {} - system_config_path = + system_config_path = begin require 'Win32API' @@ -45,7 +45,7 @@ class Gem::ConfigFile end SYSTEM_WIDE_CONFIG_FILE = File.join system_config_path, 'gemrc' - + # List of arguments supplied to the config file object. attr_reader :args diff --git a/lib/rubygems/digest/digest_adapter.rb b/lib/rubygems/digest/digest_adapter.rb index d5a00b059d..370446b205 100755 --- a/lib/rubygems/digest/digest_adapter.rb +++ b/lib/rubygems/digest/digest_adapter.rb @@ -6,12 +6,12 @@ #++ module Gem - - # There is an incompatibility between the way Ruby 1.8.5 and 1.8.6 - # handles digests. This DigestAdapter will take a pre-1.8.6 digest + + # There is an incompatibility between the way Ruby 1.8.5 and 1.8.6 + # handles digests. This DigestAdapter will take a pre-1.8.6 digest # and adapt it to the 1.8.6 API. # - # Note that only the digest and hexdigest methods are adapted, + # Note that only the digest and hexdigest methods are adapted, # since these are the only functions used by Gems. # class DigestAdapter diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index 36e9ec18f6..a521c7b572 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -15,7 +15,7 @@ class Gem::Ext::Builder def self.make(dest_path, results) unless File.exist? 'Makefile' then - raise Gem::InstallError, "Makefile not found:\n\n#{results.join "\n"}" + raise Gem::InstallError, "Makefile not found:\n\n#{results.join "\n"}" end mf = File.read('Makefile') diff --git a/lib/rubygems/format.rb b/lib/rubygems/format.rb index 7dc127d5f4..49a3951e26 100644 --- a/lib/rubygems/format.rb +++ b/lib/rubygems/format.rb @@ -17,7 +17,7 @@ module Gem class Format attr_accessor :spec, :file_entries, :gem_path extend Gem::UserInteraction - + ## # Constructs an instance of a Format object, representing the gem's # data structure. @@ -27,9 +27,9 @@ module Gem def initialize(gem_path) @gem_path = gem_path end - + ## - # Reads the named gem file and returns a Format object, representing + # Reads the named gem file and returns a Format object, representing # the data from the gem file # # file_path:: [String] Path to the gem file diff --git a/lib/rubygems/gem_runner.rb b/lib/rubygems/gem_runner.rb index 5f91398b5b..7edc93d68f 100644 --- a/lib/rubygems/gem_runner.rb +++ b/lib/rubygems/gem_runner.rb @@ -38,7 +38,7 @@ module Gem end cmd.run(Gem.configuration.args) end_time = Time.now - if Gem.configuration.benchmark + if Gem.configuration.benchmark printf "\nExecution time: %0.2f seconds.\n", end_time-start_time puts "Press Enter to finish" STDIN.gets diff --git a/lib/rubygems/old_format.rb b/lib/rubygems/old_format.rb index ef5d621f52..4b8db70bc6 100644 --- a/lib/rubygems/old_format.rb +++ b/lib/rubygems/old_format.rb @@ -16,7 +16,7 @@ module Gem # class OldFormat attr_accessor :spec, :file_entries, :gem_path - + ## # Constructs an instance of a Format object, representing the gem's # data structure. @@ -26,9 +26,9 @@ module Gem def initialize(gem_path) @gem_path = gem_path end - + ## - # Reads the named gem file and returns a Format object, representing + # Reads the named gem file and returns a Format object, representing # the data from the gem file # # file_path:: [String] Path to the gem file @@ -58,8 +58,8 @@ module Gem end format end - - private + + private ## # Skips the Ruby self-install header. After calling this method, the # IO index will be set after the Ruby code. @@ -79,7 +79,7 @@ module Gem raise Gem::Exception.new("Failed to find end of ruby script while reading gem") end end - + ## # Reads the specification YAML from the supplied IO and constructs # a Gem::Specification from it. After calling this method, the @@ -100,7 +100,7 @@ module Gem raise Gem::Exception.new("Failed to parse gem specification out of gem file") end end - + ## # Reads lines from the supplied IO until a end-of-yaml (---) is # reached diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb index c194cc0530..fa78126a0d 100644 --- a/lib/rubygems/package/tar_header.rb +++ b/lib/rubygems/package/tar_header.rb @@ -233,7 +233,7 @@ class Gem::Package::TarHeader ] header = header.pack PACK_FORMAT - + header << ("\0" * ((512 - header.size) % 512)) end diff --git a/lib/rubygems/package/tar_writer.rb b/lib/rubygems/package/tar_writer.rb index 6e11440e22..04a15c7779 100644 --- a/lib/rubygems/package/tar_writer.rb +++ b/lib/rubygems/package/tar_writer.rb @@ -169,7 +169,7 @@ class Gem::Package::TarWriter name = newname if name.size > 100 or prefix.size > 155 then - raise Gem::Package::TooLongFileName + raise Gem::Package::TooLongFileName end end diff --git a/lib/rubygems/security.rb b/lib/rubygems/security.rb index abf3cf4a6a..5cd3fb756f 100644 --- a/lib/rubygems/security.rb +++ b/lib/rubygems/security.rb @@ -218,7 +218,7 @@ require 'rubygems/gem_openssl' # # # signing key (still kept in an undisclosed location!) # s.signing_key = '/mnt/floppy/alf-private_key.pem' -# +# # # certificate chain (includes the issuer certificate now too) # s.cert_chain = ['/home/alf/doc/seattlerb-public_cert.pem', # '/home/alf/doc/alf_at_seattle-public_cert.pem'] @@ -274,7 +274,7 @@ require 'rubygems/gem_openssl' # # convert a PEM format X509 certificate into DER format: # # (note: Windows .cer files are X509 certificates in DER format) # $ openssl x509 -in input.pem -outform der -out output.der -# +# # # print out the certificate in a human-readable format: # $ openssl x509 -in input.pem -noout -text # @@ -282,7 +282,7 @@ require 'rubygems/gem_openssl' # # # convert a PEM format RSA key into DER format: # $ openssl rsa -in input_key.pem -outform der -out output_key.der -# +# # # print out the key in a human readable format: # $ openssl rsa -in input_key.pem -noout -text # diff --git a/lib/rubygems/source_index.rb b/lib/rubygems/source_index.rb index 8a8db2ef0d..57f6c30ae6 100644 --- a/lib/rubygems/source_index.rb +++ b/lib/rubygems/source_index.rb @@ -376,7 +376,7 @@ class Gem::SourceIndex end def ==(other) # :nodoc: - self.class === other and @gems == other.gems + self.class === other and @gems == other.gems end def dump diff --git a/lib/rubygems/source_info_cache.rb b/lib/rubygems/source_info_cache.rb index fdb30ad8d3..4289cdb52a 100644 --- a/lib/rubygems/source_info_cache.rb +++ b/lib/rubygems/source_info_cache.rb @@ -286,7 +286,7 @@ class Gem::SourceInfoCache next unless Gem.sources.include? source_uri # TODO - Remove this gunk after 2008/11 unless pattern.kind_of?(Gem::Dependency) - pattern = Gem::Dependency.new(pattern, Gem::Requirement.default) + pattern = Gem::Dependency.new(pattern, Gem::Requirement.default) end sic_entry.source_index.search pattern, platform_only end.flatten.compact @@ -306,7 +306,7 @@ class Gem::SourceInfoCache # TODO - Remove this gunk after 2008/11 unless pattern.kind_of?(Gem::Dependency) - pattern = Gem::Dependency.new(pattern, Gem::Requirement.default) + pattern = Gem::Dependency.new(pattern, Gem::Requirement.default) end sic_entry.source_index.search(pattern, only_platform).each do |spec| diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index b3a42cf902..634b88f1f0 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -256,7 +256,7 @@ module Gem # Defines a _singular_ version of an existing _plural_ attribute (i.e. one # whose value is expected to be an array). This means just creating a # helper method that takes a single value and appends it to the array. - # These are created for convenience, so that in a spec, one can write + # These are created for convenience, so that in a spec, one can write # # s.require_path = 'mylib' # @@ -266,13 +266,13 @@ module Gem # # That above convenience is available courtesy of: # - # attribute_alias_singular :require_path, :require_paths + # attribute_alias_singular :require_path, :require_paths def self.attribute_alias_singular(singular, plural) define_method("#{singular}=") { |val| send("#{plural}=", [val]) } - define_method("#{singular}") { + define_method("#{singular}") { val = send("#{plural}") val.nil? ? nil : val.first } @@ -427,7 +427,7 @@ module Gem end alias has_test_suite? has_unit_tests? # :nodoc: deprecated - + ## # Specification constructor. Assigns the default values to the # attributes, adds this spec to the list of loaded specs (see @@ -476,7 +476,7 @@ module Gem # routine (#initialize). This method makes up for that and deals with # gems of different ages. # - # 'input' can be anything that YAML.load() accepts: String or IO. + # 'input' can be anything that YAML.load() accepts: String or IO. def self.from_yaml(input) input = normalize_yaml_input input @@ -493,12 +493,12 @@ module Gem unless (spec.instance_variables.include? '@specification_version' or spec.instance_variables.include? :@specification_version) and spec.instance_variable_get :@specification_version - spec.instance_variable_set :@specification_version, + spec.instance_variable_set :@specification_version, NONEXISTENT_SPECIFICATION_VERSION end spec - end + end ## # Loads ruby format gemspec from +filename+ @@ -522,7 +522,7 @@ module Gem result = "--- " + result unless result =~ /^--- / result end - + ## # Sets the rubygems_version to the current RubyGems version @@ -624,7 +624,7 @@ module Gem # Checks if this specification meets the requirement of +dependency+. def satisfies_requirement?(dependency) - return @name == dependency.name && + return @name == dependency.name && dependency.version_requirements.satisfied_by?(@version) end @@ -804,7 +804,7 @@ module Gem raise Gem::InvalidSpecificationException, "missing value for attribute #{symbol}" end - end + end if require_paths.empty? then raise Gem::InvalidSpecificationException, @@ -850,9 +850,9 @@ module Gem # Normalize the list of files so that: # * All file lists have redundancies removed. # * Files referenced in the extra_rdoc_files are included in the package - # file list. + # file list. # - # Also, the summary and description are converted to a normal format. + # Also, the summary and description are converted to a normal format. def normalize if defined?(@extra_rdoc_files) and @extra_rdoc_files then @@ -935,11 +935,11 @@ module Gem else raise Exception, "ruby_code case not handled: #{obj.class}" end end - + private :ruby_code # :section: Required gemspec attributes - + ## # The version of RubyGems used to create this gem @@ -979,7 +979,7 @@ module Gem ## # A contact email for this gem - + attribute :email ## @@ -990,7 +990,7 @@ module Gem ## # The rubyforge project this gem lives under. i.e. RubyGems' # rubyforge_project is "rubygems". - + attribute :rubyforge_project ## @@ -1108,7 +1108,7 @@ module Gem ## # Singular accessor for executables - + attribute_alias_singular :executable, :executables ## diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb index 8b23d3236e..85541c9fc3 100644 --- a/lib/rubygems/test_utilities.rb +++ b/lib/rubygems/test_utilities.rb @@ -11,9 +11,9 @@ require 'rubygems/remote_fetcher' # @fetcher = Gem::FakeFetcher.new # @fetcher.data['http://gems.example.com/yaml'] = source_index.to_yaml # Gem::RemoteFetcher.fetcher = @fetcher -# +# # # invoke RubyGems code -# +# # paths = @fetcher.paths # assert_equal 'http://gems.example.com/yaml', paths.shift # assert paths.empty?, paths.join(', ') diff --git a/lib/scanf.rb b/lib/scanf.rb index cbb98b6f9f..386270b924 100644 --- a/lib/scanf.rb +++ b/lib/scanf.rb @@ -63,7 +63,7 @@ to the beginning of the format string, and yields a new array of conversions to the block every time the format string is matched (including partial matches, but not including complete failures). The actual return value of scanf when called with a block is an array -containing the results of all the executions of the block. +containing the results of all the executions of the block. str = "123 abc 456 def 789 ghi" str.scanf("%d%s") { |num,str| [ num * 2, str.upcase ] } @@ -100,7 +100,7 @@ and <tt>tests/scanftests.rb</tt> for examples.) [u] Same as d. -[i] +[i] Matches an optionally signed integer. The integer is read in base 16 if it begins with `0x' or `0X', in base 8 if it begins with `0', and in base 10 other- wise. Only characters that correspond to the @@ -280,7 +280,7 @@ Project contributors:: Nolan Darilek, Jason Johnston Thanks to Hal Fulton for hosting the Codefest. -Thanks to Matz for suggestions about the class design. +Thanks to Matz for suggestions about the class design. Thanks to Gavin Sinclair for some feedback on the documentation. @@ -332,7 +332,7 @@ module Scanf @spec_string = str h = '[A-Fa-f0-9]' - @re_string, @handler = + @re_string, @handler = case @spec_string # %[[:...:]] @@ -482,7 +482,7 @@ module Scanf return width_left || cc_no_width end - + end class FormatString @@ -672,10 +672,10 @@ class String if b block_scanf(fstr,&b) else - fs = + fs = if fstr.is_a? Scanf::FormatString - fstr - else + fstr + else Scanf::FormatString.new(fstr) end fs.match(self) diff --git a/lib/set.rb b/lib/set.rb index f930c5e4a9..7b8896c335 100644 --- a/lib/set.rb +++ b/lib/set.rb @@ -4,15 +4,15 @@ #++ # Copyright (c) 2002-2008 Akinori MUSHA <knu@iDaemons.org> # -# Documentation by Akinori MUSHA and Gavin Sinclair. +# Documentation by Akinori MUSHA and Gavin Sinclair. # # All rights reserved. You can redistribute and/or modify it under the same # terms as Ruby. # # $Id$ # -# == Overview -# +# == Overview +# # This library provides the Set class, which deals with a collection # of unordered values with no duplicates. It is a hybrid of Array's # intuitive inter-operation facilities and Hash's fast lookup. If you @@ -555,33 +555,33 @@ end # == RestricedSet class # RestricedSet implements a set with restrictions defined by a given # block. -# +# # === Super class # Set -# +# # === Class Methods # --- RestricedSet::new(enum = nil) { |o| ... } # --- RestricedSet::new(enum = nil) { |rset, o| ... } # Creates a new restricted set containing the elements of the given # enumerable object. Restrictions are defined by the given block. -# +# # If the block's arity is 2, it is called with the RestrictedSet # itself and an object to see if the object is allowed to be put in # the set. -# +# # Otherwise, the block is called with an object to see if the object # is allowed to be put in the set. -# +# # === Instance Methods # --- restriction_proc # Returns the restriction procedure of the set. -# +# # =end -# +# # class RestricedSet < Set # def initialize(*args, &block) # @proc = block or raise ArgumentError, "missing a block" -# +# # if @proc.arity == 2 # instance_eval %{ # def add(o) @@ -589,7 +589,7 @@ end # self # end # alias << add -# +# # def add?(o) # if include?(o) || !@proc.call(self, o) # nil @@ -598,17 +598,17 @@ end # self # end # end -# +# # def replace(enum) # clear # enum.each { |o| add(o) } -# +# # self # end -# +# # def merge(enum) # enum.each { |o| add(o) } -# +# # self # end # } @@ -616,12 +616,12 @@ end # instance_eval %{ # def add(o) # if @proc.call(o) -# @hash[o] = true +# @hash[o] = true # end # self # end # alias << add -# +# # def add?(o) # if include?(o) || !@proc.call(o) # nil @@ -632,10 +632,10 @@ end # end # } # end -# +# # super(*args) # end -# +# # def restriction_proc # @proc # end @@ -1241,33 +1241,33 @@ end # class TC_RestricedSet < Test::Unit::TestCase # def test_s_new # assert_raises(ArgumentError) { RestricedSet.new } -# +# # s = RestricedSet.new([-1,2,3]) { |o| o > 0 } # assert_equal([2,3], s.sort) # end -# +# # def test_restriction_proc # s = RestricedSet.new([-1,2,3]) { |o| o > 0 } -# +# # f = s.restriction_proc # assert_instance_of(Proc, f) # assert(f[1]) # assert(!f[0]) # end -# +# # def test_replace # s = RestricedSet.new(-3..3) { |o| o > 0 } # assert_equal([1,2,3], s.sort) -# +# # s.replace([-2,0,3,4,5]) # assert_equal([3,4,5], s.sort) # end -# +# # def test_merge # s = RestricedSet.new { |o| o > 0 } # s.merge(-5..5) # assert_equal([1,2,3,4,5], s.sort) -# +# # s.merge([10,-10,-8,8]) # assert_equal([1,2,3,4,5,8,10], s.sort) # end diff --git a/lib/shell.rb b/lib/shell.rb index 6a64cb263f..d2ce26d3b3 100644 --- a/lib/shell.rb +++ b/lib/shell.rb @@ -1,12 +1,12 @@ # -# shell.rb - +# shell.rb - # $Release Version: 0.7 $ # $Revision: 1.9 $ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "e2mmap" diff --git a/lib/shell/builtin-command.rb b/lib/shell/builtin-command.rb index b65056de0f..e489da4eca 100644 --- a/lib/shell/builtin-command.rb +++ b/lib/shell/builtin-command.rb @@ -1,12 +1,12 @@ # -# shell/builtin-command.rb - +# shell/builtin-command.rb - # $Release Version: 0.7 $ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "shell/filter" @@ -25,7 +25,7 @@ class Shell def initialize(sh, *opts) super sh end - + def each(rs = nil) # do nothing end @@ -36,7 +36,7 @@ class Shell super sh @strings = strings end - + def each(rs = nil) rs = @shell.record_separator unless rs for str in @strings @@ -70,7 +70,7 @@ class Shell end def each(rs = nil) - if @pattern[0] == ?/ + if @pattern[0] == ?/ @files = Dir[@pattern] else prefix = @shell.pwd+"/" diff --git a/lib/shell/command-processor.rb b/lib/shell/command-processor.rb index 900b31a22d..e224d91368 100644 --- a/lib/shell/command-processor.rb +++ b/lib/shell/command-processor.rb @@ -1,12 +1,12 @@ # -# shell/command-controller.rb - +# shell/command-controller.rb - # $Release Version: 0.7 $ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "e2mmap" @@ -39,7 +39,7 @@ class Shell for m in CommandProcessor.instance_methods(false) - NoDelegateMethods add_delegate_command_to_shell(m) end - + def self.method_added(id) add_delegate_command_to_shell(id) end @@ -84,7 +84,7 @@ class Shell # Shell#test # # - - # + # # CommandProcessor#foreach(path, rs) # path: String # rs: String - record separator @@ -168,7 +168,7 @@ class Shell # sh["e", "foo"] # sh[:exists?, "foo"] # sh["exists?", "foo"] - # + # alias top_level_test test def test(command, file1, file2=nil) file1 = expand_path(file1) @@ -211,11 +211,11 @@ class Shell # CommandProcessor#mkdir(*path) # path: String # same as Dir.mkdir() - # + # def mkdir(*path) @shell.check_point notify("mkdir #{path.join(' ')}") - + perm = nil if path.last.kind_of?(Integer) perm = path.pop @@ -236,7 +236,7 @@ class Shell # CommandProcessor#rmdir(*path) # path: String # same as Dir.rmdir() - # + # def rmdir(*path) @shell.check_point notify("rmdir #{path.join(' ')}") @@ -256,7 +256,7 @@ class Shell # example: # print sh.system("ls", "-l") # sh.system("ls", "-l") | sh.head > STDOUT - # + # def system(command, *opts) if opts.empty? if command =~ /\*|\?|\{|\}|\[|\]|<|>|\(|\)|~|&|\||\\|\$|;|'|`|"|\n/ @@ -338,7 +338,7 @@ class Shell def notify(*opts, &block) Shell.notify(*opts) {|mes| yield mes if iterator? - + mes.gsub!("%pwd", "#{@cwd}") mes.gsub!("%cwd", "#{@cwd}") } @@ -383,10 +383,10 @@ class Shell SystemCommand.new(@shell, '#{path}', *opts) end]), nil, __FILE__, __LINE__ - 1) rescue SyntaxError - Shell.notify "warn: Can't define #{command} path: #{path}." + Shell.notify "warn: Can't define #{command} path: #{path}." end Shell.notify "Define #{command} path: #{path}.", Shell.debug? - Shell.notify("Definition of #{command}: ", d, + Shell.notify("Definition of #{command}: ", d, Shell.debug.kind_of?(Integer) && Shell.debug > 1) end @@ -418,7 +418,7 @@ class Shell @shell.__send__(:#{command}, *(CommandProcessor.alias_map[:#{ali}].call *opts)) end]), nil, __FILE__, __LINE__ - 1) - + else args = opts.collect{|opt| '"' + opt + '"'}.join(",") eval((d = %Q[def #{ali}(*opts) @@ -426,22 +426,22 @@ class Shell end]), nil, __FILE__, __LINE__ - 1) end rescue SyntaxError - Shell.notify "warn: Can't alias #{ali} command: #{command}." + Shell.notify "warn: Can't alias #{ali} command: #{command}." Shell.notify("Definition of #{ali}: ", d) raise end Shell.notify "Define #{ali} command: #{command}.", Shell.debug? - Shell.notify("Definition of #{ali}: ", d, + Shell.notify("Definition of #{ali}: ", d, Shell.debug.kind_of?(Integer) && Shell.debug > 1) self end - + def self.unalias_command(ali) ali = ali.id2name if ali.kind_of?(Symbol) @alias_map.delete ali.intern undef_system_command(ali) end - + # # CommandProcessor.def_builtin_commands(delegation_class, command_specs) # delegation_class: Class or Module @@ -472,7 +472,7 @@ class Shell #{delegation_class}.#{meth}(#{call_arg_str}) end] Shell.notify "Define #{meth}(#{arg_str})", Shell.debug? - Shell.notify("Definition of #{meth}: ", d, + Shell.notify("Definition of #{meth}: ", d, Shell.debug.kind_of?(Integer) && Shell.debug > 1) eval d end @@ -513,7 +513,7 @@ class Shell #---------------------------------------------------------------------- # - # class initializing methods - + # class initializing methods - # #---------------------------------------------------------------------- def self.add_delegate_command_to_shell(id) @@ -561,7 +561,7 @@ class Shell normal_delegation_file_methods = [ ["atime", ["FILENAME"]], ["basename", ["fn", "*opts"]], - ["chmod", ["mode", "*FILENAMES"]], + ["chmod", ["mode", "*FILENAMES"]], ["chown", ["owner", "group", "*FILENAME"]], ["ctime", ["FILENAMES"]], ["delete", ["*FILENAMES"]], @@ -584,7 +584,7 @@ class Shell alias_method :rm, :delete # method related FileTest - def_builtin_commands(FileTest, + def_builtin_commands(FileTest, FileTest.singleton_methods(false).collect{|m| [m, ["FILENAME"]]}) end diff --git a/lib/shell/error.rb b/lib/shell/error.rb index 8bb96c22da..dbb788a6fc 100644 --- a/lib/shell/error.rb +++ b/lib/shell/error.rb @@ -1,12 +1,12 @@ # -# shell/error.rb - +# shell/error.rb - # $Release Version: 0.7 $ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "e2mmap" diff --git a/lib/shell/filter.rb b/lib/shell/filter.rb index 3bb683db22..3f88d0f5d2 100644 --- a/lib/shell/filter.rb +++ b/lib/shell/filter.rb @@ -1,12 +1,12 @@ # -# shell/filter.rb - +# shell/filter.rb - # $Release Version: 0.7 $ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # class Shell @@ -28,7 +28,7 @@ class Shell def input=(filter) @input = filter end - + def each(rs = nil) rs = @shell.record_separator unless rs if @input diff --git a/lib/shell/process-controller.rb b/lib/shell/process-controller.rb index f2bf1d44c8..829ff7900a 100644 --- a/lib/shell/process-controller.rb +++ b/lib/shell/process-controller.rb @@ -1,12 +1,12 @@ # -# shell/process-controller.rb - +# shell/process-controller.rb - # $Release Version: 0.7 $ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "forwardable" @@ -26,7 +26,7 @@ class Shell class<<self extend Forwardable - def_delegator("@ProcessControllersMonitor", + def_delegator("@ProcessControllersMonitor", "synchronize", "process_controllers_exclusive") def active_process_controllers @@ -118,7 +118,7 @@ class Shell def waiting_jobs @waiting_jobs end - + def jobs_exist? @jobs_sync.synchronize(:SH) do @active_jobs.empty? or @waiting_jobs.empty? @@ -158,7 +158,7 @@ class Shell else command = @waiting_jobs.shift # command.notify "job(%id) pre-start.", @shell.debug? - + return unless command end @active_jobs.push command @@ -253,7 +253,7 @@ class Shell end pid = fork { - Thread.list.each do |th| + Thread.list.each do |th| # th.kill unless [Thread.main, Thread.current].include?(th) th.kill unless Thread.current == th end @@ -261,7 +261,7 @@ class Shell STDIN.reopen(pipe_peer_in) STDOUT.reopen(pipe_peer_out) - ObjectSpace.each_object(IO) do |io| + ObjectSpace.each_object(IO) do |io| if ![STDIN, STDOUT, STDERR].include?(io) io.close unless io.closed? end @@ -295,9 +295,9 @@ class Shell "You can use Shell#transact or Shell#check_point for more safe execution.") redo end - + # command.notify "job(%id) pre-pre-finish.", @shell.debug? - @job_monitor.synchronize do + @job_monitor.synchronize do # command.notify "job(%id) pre-finish.", @shell.debug? terminate_job(command) # command.notify "job(%id) pre-finish2.", @shell.debug? diff --git a/lib/shell/system-command.rb b/lib/shell/system-command.rb index da5d4cb898..af9b0a8e37 100644 --- a/lib/shell/system-command.rb +++ b/lib/shell/system-command.rb @@ -1,12 +1,12 @@ # -# shell/system-command.rb - +# shell/system-command.rb - # $Release Version: 0.7 $ # $Revision$ # by Keiju ISHITSUKA(keiju@ruby-lang.org) # # -- # -# +# # require "shell/filter" @@ -20,7 +20,7 @@ class Shell super(sh) @command = command @opts = opts - + @input_queue = Queue.new @pid = nil @@ -140,9 +140,9 @@ class Shell end # ex) - # if you wish to output: + # if you wish to output: # "shell: job(#{@command}:#{@pid}) close pipe-out." - # then + # then # mes: "job(%id) close pipe-out." # yorn: Boolean(@shell.debug? or @shell.verbose?) def notify(*opts, &block) diff --git a/lib/shell/version.rb b/lib/shell/version.rb index dd50b06d55..6e4c170351 100644 --- a/lib/shell/version.rb +++ b/lib/shell/version.rb @@ -6,7 +6,7 @@ # # -- # -# +# # class Shell diff --git a/lib/sync.rb b/lib/sync.rb index f4dea76d1f..36c4c08d45 100644 --- a/lib/sync.rb +++ b/lib/sync.rb @@ -34,7 +34,7 @@ # Sync#lock(mode) -- mode = :EX, :SH, :UN # Sync#unlock # Sync#synchronize(mode) {...} -# +# # unless defined? Thread @@ -43,25 +43,25 @@ end module Sync_m RCS_ID='-$Header$-' - + # lock mode UN = :UN SH = :SH EX = :EX - + # exceptions class Err < StandardError def Err.Fail(*opt) fail self, sprintf(self::Message, *opt) end - + class UnknownLocker < Err Message = "Thread(%s) not locked." def UnknownLocker.Fail(th) super(th.inspect) end end - + class LockModeFailer < Err Message = "Unknown lock mode(%s)" def LockModeFailer.Fail(mode) @@ -72,7 +72,7 @@ module Sync_m end end end - + def Sync_m.define_aliases(cl) cl.module_eval %q{ alias locked? sync_locked? @@ -84,7 +84,7 @@ module Sync_m alias synchronize sync_synchronize } end - + def Sync_m.append_features(cl) super # do nothing for Modules @@ -92,12 +92,12 @@ module Sync_m define_aliases(cl) unless cl.instance_of?(Module) self end - + def Sync_m.extend_object(obj) super obj.sync_extend end - + def sync_extend unless (defined? locked? and defined? shared? and @@ -115,15 +115,15 @@ module Sync_m def sync_locked? sync_mode != UN end - + def sync_shared? sync_mode == SH end - + def sync_exclusive? sync_mode == EX end - + # locking methods. def sync_try_lock(mode = EX) return unlock if mode == UN @@ -132,7 +132,7 @@ module Sync_m end ret end - + def sync_lock(m = EX) return unlock if m == UN @@ -153,21 +153,21 @@ module Sync_m end self end - + def sync_unlock(m = EX) wakeup_threads = [] @sync_mutex.synchronize do if sync_mode == UN Err::UnknownLocker.Fail(Thread.current) end - + m = sync_mode if m == EX and sync_mode == SH - + runnable = false case m when UN Err::UnknownLocker.Fail(Thread.current) - + when EX if sync_ex_locker == Thread.current if (self.sync_ex_count = sync_ex_count - 1) == 0 @@ -182,12 +182,12 @@ module Sync_m else Err::UnknownLocker.Fail(Thread.current) end - + when SH if (count = sync_sh_locker[Thread.current]).nil? Err::UnknownLocker.Fail(Thread.current) else - if (sync_sh_locker[Thread.current] = count - 1) == 0 + if (sync_sh_locker[Thread.current] = count - 1) == 0 sync_sh_locker.delete(Thread.current) if sync_sh_locker.empty? and sync_ex_count == 0 self.sync_mode = UN @@ -196,7 +196,7 @@ module Sync_m end end end - + if runnable if sync_upgrade_waiting.size > 0 th, count = sync_upgrade_waiting.shift @@ -218,7 +218,7 @@ module Sync_m end self end - + def sync_synchronize(mode = EX) sync_lock(mode) begin @@ -229,7 +229,7 @@ module Sync_m end attr_accessor :sync_mode - + attr_accessor :sync_waiting attr_accessor :sync_upgrade_waiting attr_accessor :sync_sh_locker @@ -258,7 +258,7 @@ module Sync_m super sync_initialize end - + def sync_try_lock_sub(m) case m when SH @@ -282,7 +282,7 @@ module Sync_m end when EX if sync_mode == UN or - sync_mode == SH && sync_sh_locker.size == 1 && sync_sh_locker.include?(Thread.current) + sync_mode == SH && sync_sh_locker.size == 1 && sync_sh_locker.include?(Thread.current) self.sync_mode = m self.sync_ex_locker = Thread.current self.sync_ex_count = 1 diff --git a/lib/tempfile.rb b/lib/tempfile.rb index 601bb8d2f8..e3934b5d08 100644 --- a/lib/tempfile.rb +++ b/lib/tempfile.rb @@ -87,7 +87,7 @@ class Tempfile < DelegateClass(File) else prefix, suffix = basename, '' end - + t = Time.now.strftime("%Y%m%d") path = "#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}-#{n}#{suffix}" end @@ -167,7 +167,7 @@ class Tempfile < DelegateClass(File) def callback(data) # :nodoc: pid = $$ Proc.new { - if pid == $$ + if pid == $$ path, tmpfile, cleanlist = *data print "removing ", path, "..." if $DEBUG diff --git a/lib/test/unit.rb b/lib/test/unit.rb index 729ddf6adf..3e2b388273 100644 --- a/lib/test/unit.rb +++ b/lib/test/unit.rb @@ -45,7 +45,7 @@ module Test reject_pat = Regexp.union(reject.map {|r| /#{r}/ }) files.reject! {|f| reject_pat =~ f } - + files.each {|f| d = File.dirname(File.expand_path(f)) unless $:.include? d diff --git a/lib/thread.rb b/lib/thread.rb index e5585c30bd..cb6d8c62fc 100644 --- a/lib/thread.rb +++ b/lib/thread.rb @@ -20,7 +20,7 @@ if $DEBUG Thread.abort_on_exception = true end -# +# # ConditionVariable objects augment class Mutex. Using condition variables, # it is possible to suspend while in the middle of a critical section until a # resource becomes available. @@ -31,7 +31,7 @@ end # # mutex = Mutex.new # resource = ConditionVariable.new -# +# # a = Thread.new { # mutex.synchronize { # # Thread 'a' now needs the resource @@ -39,7 +39,7 @@ end # # 'a' can now have the resource # } # } -# +# # b = Thread.new { # mutex.synchronize { # # Thread 'b' has finished using the resource @@ -55,7 +55,7 @@ class ConditionVariable @waiters = [] @waiters_mutex = Mutex.new end - + # # Releases the lock held in +mutex+ and waits; reacquires the lock on wakeup. # @@ -68,7 +68,7 @@ class ConditionVariable mutex.sleep end end - + # # Wakes up the first thread in line waiting for this lock. # @@ -80,7 +80,7 @@ class ConditionVariable retry end end - + # # Wakes up all threads waiting for this lock. # @@ -106,9 +106,9 @@ end # Example: # # require 'thread' -# +# # queue = Queue.new -# +# # producer = Thread.new do # 5.times do |i| # sleep rand(i) # simulate expense @@ -116,7 +116,7 @@ end # puts "#{i} produced" # end # end -# +# # consumer = Thread.new do # 5.times do |i| # value = queue.pop @@ -124,7 +124,7 @@ end # puts "consumed #{value}" # end # end -# +# # consumer.join # class Queue @@ -296,7 +296,7 @@ class SizedQueue < Queue @queue_wait.push Thread.current @mutex.sleep end - + @que.push obj begin t = @waiting.shift @@ -305,7 +305,7 @@ class SizedQueue < Queue retry end } - + begin t.run if t rescue ThreadError diff --git a/lib/thwait.rb b/lib/thwait.rb index 029b259157..09d99a6c5b 100644 --- a/lib/thwait.rb +++ b/lib/thwait.rb @@ -15,7 +15,7 @@ # each thread termination. # * th = ThreadsWait.new(thread1,...) # creates synchronization object, specifying thread(s) to wait. -# +# # methods: # * th.threads # list threads to be synchronized @@ -23,7 +23,7 @@ # is there any thread to be synchronized. # * th.finished? # is there already terminated thread. -# * th.join(thread1,...) +# * th.join(thread1,...) # wait for specified thread(s). # * th.join_nowait(threa1,...) # specifies thread(s) to wait. non-blocking. @@ -52,11 +52,11 @@ require "e2mmap.rb" # class ThreadsWait RCS_ID='-$Id: thwait.rb,v 1.3 1998/06/26 03:19:34 keiju Exp keiju $-' - + extend Exception2MessageMapper def_exception("ErrNoWaitingThread", "No threads for waiting.") def_exception("ErrNoFinishedThread", "No finished threads.") - + # # Waits until all specified threads have terminated. If a block is provided, # it is executed for each thread termination. @@ -71,7 +71,7 @@ class ThreadsWait tw.all_waits end end - + # # Creates a ThreadsWait object, specifying the threads to wait on. # Non-blocking. @@ -81,24 +81,24 @@ class ThreadsWait @wait_queue = Queue.new join_nowait(*threads) unless threads.empty? end - + # Returns the array of threads in the wait queue. attr :threads - + # # Returns +true+ if there are no threads to be synchronized. # def empty? @threads.empty? end - + # # Returns +true+ if any thread has terminated. # def finished? !@wait_queue.empty? end - + # # Waits for specified threads to terminate. # @@ -106,7 +106,7 @@ class ThreadsWait join_nowait(*threads) next_wait end - + # # Specifies the threads that this object will wait for, but does not actually # wait. @@ -124,7 +124,7 @@ class ThreadsWait end end end - + # # Waits until any of the specified threads has terminated, and returns the one # that does. @@ -141,7 +141,7 @@ class ThreadsWait ThreadsWait.fail ErrNoFinishedThread end end - + # # Waits until all of the specified threads are terminated. If a block is # supplied for the method, it is executed for each thread termination. diff --git a/lib/time.rb b/lib/time.rb index 53e6697e76..031a4135ef 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -98,7 +98,7 @@ class Time # In RFC 3339, -00:00 is used for the time in UTC is known, # but the offset to local time is unknown. # They are not appropriate for specific time zone such as - # Europe/London because time zone neutral, + # Europe/London because time zone neutral, # So -00:00 and -0000 are treated as UTC. if /\A(?:-00:00|-0000|-00|UTC|Z|UT)\z/i =~ zone true diff --git a/lib/timeout.rb b/lib/timeout.rb index 19ccb96d3e..893b5f8f58 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -63,7 +63,7 @@ module Timeout raise Error, e.message, e.backtrace ensure if y and y.alive? - y.kill + y.kill y.join # make sure y is dead. end end diff --git a/lib/tracer.rb b/lib/tracer.rb index 1fdc608960..8e6586d7c6 100644 --- a/lib/tracer.rb +++ b/lib/tracer.rb @@ -1,12 +1,12 @@ # -# tracer.rb - +# tracer.rb - # $Release Version: 0.2$ # $Revision: 1.8 $ # by Keiju ISHITSUKA(Nippon Rational Inc.) # # -- # -# +# # # @@ -22,7 +22,7 @@ class Tracer alias verbose? verbose attr_accessor :stdout end - + EVENT_SYMBOL = { "line" => "-", "call" => ">", @@ -32,7 +32,7 @@ class Tracer "c-call" => ">", "c-return" => "<", } - + def initialize @threads = Hash.new if defined? Thread.main @@ -45,7 +45,7 @@ class Tracer @filters = [] end - + def stdout Tracer.stdout end @@ -63,7 +63,7 @@ class Tracer stdout.print "Trace on\n" if Tracer.verbose? end end - + def off set_trace_func nil stdout.print "Trace off\n" if Tracer.verbose? @@ -76,7 +76,7 @@ class Tracer def set_get_line_procs(file, p = proc) @get_line_procs[file] = p end - + def get_line(file, line) if p = @get_line_procs[file] return p.call(line) @@ -85,7 +85,7 @@ class Tracer unless list = SCRIPT_LINES__[file] begin f = open(file) - begin + begin SCRIPT_LINES__[file] = list = f.readlines ensure f.close @@ -101,7 +101,7 @@ class Tracer "-\n" end end - + def get_thread_no if no = @threads[Thread.current.object_id] no @@ -109,14 +109,14 @@ class Tracer @threads[Thread.current.object_id] = @threads.size end end - + def trace_func(event, file, line, id, binding, klass, *) return if file == __FILE__ - + for p in @filters return unless p.call event, file, line, id, binding, klass end - + # saved_crit = Thread.critical # Thread.critical = true stdout.printf("#%d:%s:%d:%s:%s: %s", @@ -137,11 +137,11 @@ class Tracer Single.on end end - + def Tracer.off Single.off end - + def Tracer.set_get_line_procs(file_name, p = proc) Single.set_get_line_procs(file_name, p) end @@ -149,14 +149,14 @@ class Tracer def Tracer.add_filter(p = proc) Single.add_filter(p) end - + end SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__ if $0 == __FILE__ # direct call - + $0 = ARGV[0] ARGV.shift Tracer.on @@ -1,11 +1,11 @@ -# +# # = un.rb -# +# # Copyright (c) 2003 WATANABE Hirofumi <eban@ruby-lang.org> -# +# # This program is free software. # You can distribute/modify this program under the same terms of Ruby. -# +# # == Utilities to replace common UNIX commands in Makefiles etc # # == SYNOPSIS diff --git a/lib/uri.rb b/lib/uri.rb index f7110f18fd..41bb09b467 100644 --- a/lib/uri.rb +++ b/lib/uri.rb @@ -3,11 +3,11 @@ # # Author:: Akira Yamada <akira@ruby-lang.org> # Documentation:: Akira Yamada <akira@ruby-lang.org>, Dmitry V. Sabanin <sdmitry@lrn.ru> -# License:: +# License:: # Copyright (c) 2001 akira yamada <akira@ruby-lang.org> # You can redistribute it and/or modify it under the same term as Ruby. # Revision:: $Id$ -# +# # See URI for documentation # diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 827ed7883d..828b2b8a4a 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -2,7 +2,7 @@ # # Author:: Akira Yamada <akira@ruby-lang.org> # Revision:: $Id$ -# License:: +# License:: # You can redistribute it and/or modify it under the same term as Ruby. # @@ -34,7 +34,7 @@ module URI UNRESERVED = "-_.!~*'()#{ALNUM}" # reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | # "$" | "," - # reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | + # reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | # "$" | "," | "[" | "]" (RFC 2732) RESERVED = ";/?:@&=+$,\\[\\]" @@ -103,7 +103,7 @@ module URI # null uri when @regexp[:ABS_URI] - scheme, opaque, userinfo, host, port, + scheme, opaque, userinfo, host, port, registry, path, query, fragment = $~[1..-1] # URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] @@ -119,19 +119,19 @@ module URI # server = [ [ userinfo "@" ] hostport ] if !scheme - raise InvalidURIError, + raise InvalidURIError, "bad URI(absolute but no scheme): #{uri}" end if !opaque && (!path && (!host && !registry)) raise InvalidURIError, - "bad URI(absolute but no path): #{uri}" + "bad URI(absolute but no path): #{uri}" end when @regexp[:REL_URI] scheme = nil opaque = nil - userinfo, host, port, registry, + userinfo, host, port, registry, rel_segment, abs_path, query, fragment = $~[1..-1] if rel_segment && abs_path path = rel_segment + abs_path @@ -158,7 +158,7 @@ module URI path = '' if !path && !opaque # (see RFC2396 Section 5.2) ret = [ - scheme, + scheme, userinfo, host, port, # X registry, # X path, # Y @@ -170,16 +170,16 @@ module URI end def parse(uri) - scheme, userinfo, host, port, + scheme, userinfo, host, port, registry, path, opaque, query, fragment = self.split(uri) if scheme && URI.scheme_list.include?(scheme.upcase) - URI.scheme_list[scheme.upcase].new(scheme, userinfo, host, port, - registry, path, opaque, query, + URI.scheme_list[scheme.upcase].new(scheme, userinfo, host, port, + registry, path, opaque, query, fragment, self) else - Generic.new(scheme, userinfo, host, port, - registry, path, opaque, query, + Generic.new(scheme, userinfo, host, port, + registry, path, opaque, query, fragment, self) end end @@ -457,7 +457,7 @@ module URI end end else - raise ArgumentError, + raise ArgumentError, "expected Array of or Hash of components of #{klass.to_s} (#{klass.component[1..-1].join(', ')})" end tmp[:scheme] = klass.to_s.sub(/\A.*::/, '').downcase @@ -538,7 +538,7 @@ module URI def self.scheme_list @@schemes end - + # # Base class for all URI exceptions. # @@ -579,7 +579,7 @@ module URI # * Opaque # * Query # * Fragment - # + # # == Usage # # require 'uri' @@ -604,7 +604,7 @@ module URI # == Description # # Creates one of the URI's subclasses instance from the string. - # + # # == Raises # # URI::InvalidURIError @@ -617,11 +617,11 @@ module URI # uri = URI.parse("http://www.ruby-lang.org/") # p uri # # => #<URI::HTTP:0x202281be URL:http://www.ruby-lang.org/> - # p uri.scheme - # # => "http" - # p uri.host - # # => "www.ruby-lang.org" - # + # p uri.scheme + # # => "http" + # p uri.host + # # => "www.ruby-lang.org" + # def self.parse(uri) DEFAULT_PARSER.parse(uri) end @@ -658,7 +658,7 @@ module URI # # == Args # - # +str+:: + # +str+:: # String to extract URIs from. # +schemes+:: # Limit URI matching to a specific schemes. @@ -686,25 +686,25 @@ module URI # # == Args # - # +match_schemes+:: + # +match_schemes+:: # Array of schemes. If given, resulting regexp matches to URIs # whose scheme is one of the match_schemes. - # + # # == Description # Returns a Regexp object which matches to URI-like strings. # The Regexp object returned by this method includes arbitrary # number of capture group (parentheses). Never rely on it's number. - # + # # == Usage # # require 'uri' # # # extract first URI from html_string # html_string.slice(URI.regexp) - # + # # # remove ftp URIs # html_string.sub(URI.regexp(['ftp']) - # + # # # You should not rely on the number of parentheses # html_string.scan(URI.regexp) do |*matches| # p $& diff --git a/lib/uri/ftp.rb b/lib/uri/ftp.rb index 3afdce01b4..a40b958497 100644 --- a/lib/uri/ftp.rb +++ b/lib/uri/ftp.rb @@ -17,12 +17,12 @@ module URI DEFAULT_PORT = 21 COMPONENT = [ - :scheme, + :scheme, :userinfo, :host, :port, :path, :typecode ].freeze # - # Typecode is "a", "i" or "d". + # Typecode is "a", "i" or "d". # # * "a" indicates a text file (the FTP command was ASCII) # * "i" indicates a binary file (FTP command IMAGE) @@ -31,7 +31,7 @@ module URI TYPECODE = ['a', 'i', 'd'].freeze TYPECODE_PREFIX = ';type='.freeze - def self.new2(user, password, host, port, path, + def self.new2(user, password, host, port, path, typecode = nil, arg_check = true) typecode = nil if typecode.size == 0 if typecode && !TYPECODE.include?(typecode) @@ -42,22 +42,22 @@ module URI # do escape self.new('ftp', - [user, password], - host, port, nil, - typecode ? path + TYPECODE_PREFIX + typecode : path, + [user, password], + host, port, nil, + typecode ? path + TYPECODE_PREFIX + typecode : path, nil, nil, nil, arg_check) end # # == Description # - # Creates a new URI::FTP object from components, with syntax checking. + # Creates a new URI::FTP object from components, with syntax checking. # - # The components accepted are +userinfo+, +host+, +port+, +path+ and + # The components accepted are +userinfo+, +host+, +port+, +path+ and # +typecode+. # - # The components should be provided either as an Array, or as a Hash - # with keys formed by preceding the component names with a colon. + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. # # If an Array is used, the components must be passed in the order # [userinfo, host, port, path, typecode] @@ -67,11 +67,11 @@ module URI # # require 'uri' # - # uri = URI::FTP.build(['user:password', 'ftp.example.com', nil, + # uri = URI::FTP.build(['user:password', 'ftp.example.com', nil, # '/path/file.> zip', 'i']) # puts uri.to_s -> ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=a # - # uri2 = URI::FTP.build({:host => 'ftp.example.com', + # uri2 = URI::FTP.build({:host => 'ftp.example.com', # :path => 'ruby/src'}) # puts uri2.to_s -> ftp://ftp.example.com/ruby/src # @@ -92,7 +92,7 @@ module URI if tmp[:typecode] if tmp[:typecode].size == 1 - tmp[:typecode] = TYPECODE_PREFIX + tmp[:typecode] + tmp[:typecode] = TYPECODE_PREFIX + tmp[:typecode] end tmp[:path] << tmp[:typecode] end @@ -109,7 +109,7 @@ module URI # Unlike build(), this method does not escape the path component as # required by RFC1738; instead it is treated as per RFC2396. # - # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+, + # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+, # +opaque+, +query+ and +fragment+, in that order. # def initialize(*arg) @@ -119,7 +119,7 @@ module URI if tmp typecode = @path[tmp + TYPECODE_PREFIX.size..-1] self.set_path(@path[0..tmp - 1]) - + if arg[-1] self.typecode = typecode else @@ -164,9 +164,9 @@ module URI # RFC 1738 specifically states that the path for an FTP URI does not # include the / which separates the URI path from the URI host. Example: # - # ftp://ftp.example.com/pub/ruby + # ftp://ftp.example.com/pub/ruby # - # The above URI indicates that the client should connect to + # The above URI indicates that the client should connect to # ftp.example.com then cd pub/ruby from the initial login directory. # # If you want to cd to an absolute directory, you must include an diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index 65c6c7379d..adc3805265 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -9,7 +9,7 @@ require 'uri/common' module URI - + # # Base class for all URI classes. # Implements generic URI syntax as per RFC 2396. @@ -31,10 +31,10 @@ module URI end COMPONENT = [ - :scheme, - :userinfo, :host, :port, :registry, - :path, :opaque, - :query, + :scheme, + :userinfo, :host, :port, :registry, + :path, :opaque, + :query, :fragment ].freeze @@ -62,7 +62,7 @@ module URI # == Description # # At first, tries to create a new URI::Generic instance using - # URI::Generic::build. But, if exception URI::InvalidComponentError is raised, + # URI::Generic::build. But, if exception URI::InvalidComponentError is raised, # then it URI::Escape.escape all URI components and tries again. # # @@ -71,7 +71,7 @@ module URI return self.build(args) rescue InvalidComponentError if args.kind_of?(Array) - return self.build(args.collect{|x| + return self.build(args.collect{|x| if x @parser.escape(x) else @@ -117,7 +117,7 @@ module URI end end else - raise ArgumentError, + raise ArgumentError, "expected Array of or Hash of components of #{self.class} (#{self.class.component.join(', ')})" end @@ -155,10 +155,10 @@ module URI # # Creates a new URI::Generic instance from ``generic'' components without check. # - def initialize(scheme, - userinfo, host, port, registry, - path, opaque, - query, + def initialize(scheme, + userinfo, host, port, registry, + path, opaque, + query, fragment, parser = DEFAULT_PARSER, arg_check = false) @@ -196,10 +196,10 @@ module URI self.set_fragment(fragment) end if @registry && !self.class.use_registry - raise InvalidURIError, + raise InvalidURIError, "the scheme #{@scheme} does not accept registry part: #{@registry} (or bad hostname?)" end - + @scheme.freeze if @scheme self.set_path('') if !@path && !@opaque # (see RFC2396 Section 5.2) self.set_port(self.default_port) if self.default_port && !@port @@ -264,7 +264,7 @@ module URI def check_user(v) if @registry || @opaque - raise InvalidURIError, + raise InvalidURIError, "can not set user with registry or opaque" end @@ -281,7 +281,7 @@ module URI def check_password(v, user = @user) if @registry || @opaque - raise InvalidURIError, + raise InvalidURIError, "can not set password with registry or opaque" end return v unless v @@ -317,7 +317,7 @@ module URI set_user(user) # returns user end - + def password=(password) check_password(password) set_password(password) @@ -325,7 +325,7 @@ module URI end def set_userinfo(user, password = nil) - unless password + unless password user, password = split_userinfo(user) end @user = user @@ -382,7 +382,7 @@ module URI return v unless v if @registry || @opaque - raise InvalidURIError, + raise InvalidURIError, "can not set host with registry or opaque" elsif @parser.regexp[:HOST] !~ v raise InvalidComponentError, @@ -408,7 +408,7 @@ module URI return v unless v if @registry || @opaque - raise InvalidURIError, + raise InvalidURIError, "can not set port with registry or opaque" elsif !v.kind_of?(Fixnum) && @parser.regexp[:PORT] !~ v raise InvalidComponentError, @@ -444,7 +444,7 @@ module URI # authority = server | reg_name # server = [ [ userinfo "@" ] hostport ] if @host || @port || @user # userinfo = @user + ':' + @password - raise InvalidURIError, + raise InvalidURIError, "can not set registry with host, port, or userinfo" elsif v && @parser.regexp[:REGISTRY] !~ v raise InvalidComponentError, @@ -471,18 +471,18 @@ module URI # absoluteURI = scheme ":" ( hier_part | opaque_part ) # hier_part = ( net_path | abs_path ) [ "?" query ] if v && @opaque - raise InvalidURIError, + raise InvalidURIError, "path conflicts with opaque" end if @scheme if v && v != '' && @parser.regexp[:ABS_PATH] !~ v - raise InvalidComponentError, + raise InvalidComponentError, "bad component(expected absolute path component): #{v}" end else if v && v != '' && @parser.regexp[:ABS_PATH] !~ v && @parser.regexp[:REL_PATH] !~ v - raise InvalidComponentError, + raise InvalidComponentError, "bad component(expected relative path component): #{v}" end end @@ -509,12 +509,12 @@ module URI # absoluteURI = scheme ":" ( hier_part | opaque_part ) # hier_part = ( net_path | abs_path ) [ "?" query ] if @opaque - raise InvalidURIError, + raise InvalidURIError, "query conflicts with opaque" end if v && v != '' && @parser.regexp[:QUERY] !~ v - raise InvalidComponentError, + raise InvalidComponentError, "bad component(expected query component): #{v}" end @@ -540,7 +540,7 @@ module URI # absoluteURI = scheme ":" ( hier_part | opaque_part ) # hier_part = ( net_path | abs_path ) [ "?" query ] if @host || @port || @user || @path # userinfo = @user + ':' + @password - raise InvalidURIError, + raise InvalidURIError, "can not set opaque with host, port, userinfo or path" elsif v && @parser.regexp[:OPAQUE] !~ v raise InvalidComponentError, @@ -566,7 +566,7 @@ module URI return v unless v if v && v != '' && @parser.regexp[:FRAGMENT] !~ v - raise InvalidComponentError, + raise InvalidComponentError, "bad component(expected fragment component): #{v}" end @@ -784,12 +784,12 @@ module URI end if self.relative? && oth.relative? - raise BadURIError, + raise BadURIError, "both URI are relative" end if self.absolute? && oth.absolute? - #raise BadURIError, + #raise BadURIError, # "both URI are absolute" # hmm... should return oth for usability? return oth, oth @@ -810,7 +810,7 @@ module URI src_path = split_path(src) dst_path = split_path(dst) - # hmm... dst has abnormal absolute path, + # hmm... dst has abnormal absolute path, # like "/./", "/../", "/x/../", ... if dst_path.include?('..') || dst_path.include?('.') @@ -855,11 +855,11 @@ module URI end if self.relative? - raise BadURIError, + raise BadURIError, "relative URI: #{self}" end if oth.relative? - raise BadURIError, + raise BadURIError, "relative URI: #{oth}" end @@ -867,7 +867,7 @@ module URI return self, self.dup end rel = URI::Generic.new(nil, # it is relative URI - self.userinfo, self.host, self.port, + self.userinfo, self.host, self.port, self.registry, self.path, self.opaque, self.query, self.fragment, @parser) @@ -955,7 +955,7 @@ module URI # uri = URI.parse('http://my.example.com') # p uri.route_to('http://my.example.com/main.rbx?page=1') # #=> #<URI::Generic:0x2020c2f6 URL:/main.rbx?page=1> - # + # def route_to(oth) case oth when Generic @@ -971,7 +971,7 @@ module URI # # Returns normalized URI - # + # def normalize uri = dup uri.normalize! @@ -987,7 +987,7 @@ module URI end if host && host != host.downcase set_host(self.host.downcase) - end + end end def path_query @@ -1001,7 +1001,7 @@ module URI # # Constructs String from URI - # + # def to_s str = '' if @scheme @@ -1103,7 +1103,7 @@ module URI if component.include?(c) self.send(c) else - raise ArgumentError, + raise ArgumentError, "expected of components of #{self.class} (#{self.class.component.join(', ')})" end end diff --git a/lib/uri/http.rb b/lib/uri/http.rb index 87eb8893f2..69a7658918 100644 --- a/lib/uri/http.rb +++ b/lib/uri/http.rb @@ -14,18 +14,18 @@ module URI # The syntax of HTTP URIs is defined in RFC1738 section 3.3. # # Note that the Ruby URI library allows HTTP URLs containing usernames and - # passwords. This is not legal as per the RFC, but used to be - # supported in Internet Explorer 5 and 6, before the MS04-004 security + # passwords. This is not legal as per the RFC, but used to be + # supported in Internet Explorer 5 and 6, before the MS04-004 security # update. See <URL:http://support.microsoft.com/kb/834489>. # class HTTP < Generic DEFAULT_PORT = 80 COMPONENT = [ - :scheme, - :userinfo, :host, :port, - :path, - :query, + :scheme, + :userinfo, :host, :port, + :path, + :query, :fragment ].freeze @@ -37,21 +37,21 @@ module URI # The components accepted are userinfo, host, port, path, query and # fragment. # - # The components should be provided either as an Array, or as a Hash - # with keys formed by preceding the component names with a colon. + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. # # If an Array is used, the components must be passed in the order # [userinfo, host, port, path, query, fragment]. # # Example: # - # newuri = URI::HTTP.build({:host => 'www.example.com', + # newuri = URI::HTTP.build({:host => 'www.example.com', # :path> => '/foo/bar'}) # - # newuri = URI::HTTP.build([nil, "www.example.com", nil, "/path", + # newuri = URI::HTTP.build([nil, "www.example.com", nil, "/path", # "query", 'fragment']) # - # Currently, if passed userinfo components this method generates + # Currently, if passed userinfo components this method generates # invalid HTTP URIs as per RFC 1738. # def self.build(args) @@ -63,10 +63,10 @@ module URI # == Description # # Create a new URI::HTTP object from generic URI components as per - # RFC 2396. No HTTP-specific syntax checking (as per RFC 1738) is + # RFC 2396. No HTTP-specific syntax checking (as per RFC 1738) is # performed. # - # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+, + # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+, # +opaque+, +query+ and +fragment+, in that order. # # Example: diff --git a/lib/uri/ldap.rb b/lib/uri/ldap.rb index 163d2cda24..6739a018af 100644 --- a/lib/uri/ldap.rb +++ b/lib/uri/ldap.rb @@ -1,10 +1,10 @@ # # = uri/ldap.rb # -# Author:: +# Author:: # Takaaki Tateishi <ttate@jaist.ac.jp> # Akira Yamada <akira@ruby-lang.org> -# License:: +# License:: # URI::LDAP is copyrighted free software by Takaaki Tateishi and Akira Yamada. # You can redistribute it and/or modify it under the same term as Ruby. # Revision:: $Id$ @@ -21,7 +21,7 @@ module URI class LDAP < Generic DEFAULT_PORT = 389 - + COMPONENT = [ :scheme, :host, :port, diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb index 38f972e1fb..4fab6e23a5 100644 --- a/lib/uri/mailto.rb +++ b/lib/uri/mailto.rb @@ -68,20 +68,20 @@ module URI # # If a Hash is used, the keys are the component names preceded by colons. # - # The headers can be supplied as a pre-encoded string, such as + # The headers can be supplied as a pre-encoded string, such as # "subject=subscribe&cc=address", or as an Array of Arrays like # [['subject', 'subscribe'], ['cc', 'address']] # # Examples: - # + # # require 'uri' - # + # # m1 = URI::MailTo.build(['joe@example.com', 'subject=Ruby']) # puts m1.to_s -> mailto:joe@example.com?subject=Ruby - # + # # m2 = URI::MailTo.build(['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]]) # puts m2.to_s -> mailto:john@example.com?Subject=Ruby&Cc=jack@example.com - # + # # m3 = URI::MailTo.build({:to => 'listman@example.com', :headers => [['subject', 'subscribe']]}) # puts m3.to_s -> mailto:listman@example.com?subject=subscribe # @@ -183,7 +183,7 @@ module URI return true unless v return true if v.size == 0 - if @parser.regexp[:OPAQUE] !~ v || + if @parser.regexp[:OPAQUE] !~ v || /\A(#{HEADER_PATTERN}(?:\&#{HEADER_PATTERN})*)\z/o !~ v raise InvalidComponentError, "bad component(expected opaque component): #{v}" @@ -210,12 +210,12 @@ module URI end def to_s - @scheme + ':' + - if @to + @scheme + ':' + + if @to @to else '' - end + + end + if @headers.size > 0 '?' + @headers.collect{|x| x.join('=')}.join('&') else @@ -227,7 +227,7 @@ module URI '' end end - + # Returns the RFC822 e-mail text equivalent of the URL, as a String. # # Example: diff --git a/lib/webrick/cgi.rb b/lib/webrick/cgi.rb index 7114651193..7099d14689 100644 --- a/lib/webrick/cgi.rb +++ b/lib/webrick/cgi.rb @@ -77,7 +77,7 @@ module WEBrick res.set_error(ex) rescue HTTPStatus::Status => ex res.status = ex.code - rescue Exception => ex + rescue Exception => ex @logger.error(ex) res.set_error(ex, true) ensure @@ -122,7 +122,7 @@ module WEBrick include Enumerable private - + def initialize(config, env, stdin, stdout) @config = config @env = env @@ -130,7 +130,7 @@ module WEBrick @body_part = stdin @out_port = stdout @out_port.binmode - + @server_addr = @env["SERVER_ADDR"] || "0.0.0.0" @server_name = @env["SERVER_NAME"] @server_port = @env["SERVER_PORT"] @@ -164,7 +164,7 @@ module WEBrick httpv = @config[:HTTPVersion] return "#{meth} #{url} HTTP/#{httpv}" end - + def setup_header @env.each{|key, value| case key @@ -175,7 +175,7 @@ module WEBrick end } end - + def add_header(hdrname, value) unless value.empty? @header_part << hdrname << ": " << value << CRLF @@ -185,21 +185,21 @@ module WEBrick def input @header_part.eof? ? @body_part : @header_part end - + public - + def peeraddr [nil, @remote_port, @remote_host, @remote_addr] end - + def addr [nil, @server_port, @server_name, @server_addr] end - + def gets(eol=LF, size=nil) input.gets(eol, size) end - + def read(size=nil) input.read(size) end @@ -211,7 +211,7 @@ module WEBrick def eof? input.eof? end - + def <<(data) @out_port << data end @@ -256,5 +256,5 @@ module WEBrick end end end - end -end + end +end diff --git a/lib/webrick/config.rb b/lib/webrick/config.rb index 121669c13a..946312e915 100644 --- a/lib/webrick/config.rb +++ b/lib/webrick/config.rb @@ -83,7 +83,7 @@ module WEBrick } DigestAuth = { - :Algorithm => 'MD5-sess', # or 'MD5' + :Algorithm => 'MD5-sess', # or 'MD5' :Domain => nil, # an array includes domain names. :Qop => [ 'auth' ], # 'auth' or 'auth-int' or both. :UseOpaque => true, diff --git a/lib/webrick/httpauth/authenticator.rb b/lib/webrick/httpauth/authenticator.rb index f90d1bf75b..d93f12a97a 100644 --- a/lib/webrick/httpauth/authenticator.rb +++ b/lib/webrick/httpauth/authenticator.rb @@ -25,7 +25,7 @@ module WEBrick unless config[sym] raise ArgumentError, "Argument #{sym.inspect} missing." end - } + } @realm = config[:Realm] @userdb = config[:UserDB] @logger = config[:Logger] || Log::new($stderr) @@ -40,8 +40,8 @@ module WEBrick def check_scheme(req) unless credentials = req[@request_field] error("no credentials in the request.") - return nil - end + return nil + end unless match = /^#{@auth_scheme}\s+/i.match(credentials) error("invalid scheme in %s.", credentials) info("%s: %s", @request_field, credentials) if $DEBUG @@ -60,7 +60,7 @@ module WEBrick if @logger.error? log(:error, fmt, *args) end - end + end def info(fmt, *args) if @logger.info? diff --git a/lib/webrick/httpauth/digestauth.rb b/lib/webrick/httpauth/digestauth.rb index eec064ca26..aac87a06df 100644 --- a/lib/webrick/httpauth/digestauth.rb +++ b/lib/webrick/httpauth/digestauth.rb @@ -118,16 +118,16 @@ module WEBrick } if !check_uri(req, auth_req) - raise HTTPStatus::BadRequest + raise HTTPStatus::BadRequest end - if auth_req['realm'] != @realm + if auth_req['realm'] != @realm error('%s: realm unmatch. "%s" for "%s"', auth_req['username'], auth_req['realm'], @realm) return false end - auth_req['algorithm'] ||= 'MD5' + auth_req['algorithm'] ||= 'MD5' if auth_req['algorithm'] != @algorithm && (@opera_hack && auth_req['algorithm'] != @algorithm.upcase) error('%s: algorithm unmatch. "%s" for "%s"', @@ -230,7 +230,7 @@ module WEBrick def split_param_value(string) ret = {} while string.bytesize != 0 - case string + case string when /^\s*([\w\-\.\*\%\!]+)=\s*\"((\\.|[^\"])*)\"\s*,?/ key = $1 matched = $2 @@ -320,7 +320,7 @@ module WEBrick uri = auth_req['uri'] if uri != req.request_uri.to_s && uri != req.unparsed_uri && (@internet_explorer_hack && uri != req.path) - error('%s: uri unmatch. "%s" for "%s"', auth_req['username'], + error('%s: uri unmatch. "%s" for "%s"', auth_req['username'], auth_req['uri'], req.request_uri.to_s) return false end diff --git a/lib/webrick/httpauth/userdb.rb b/lib/webrick/httpauth/userdb.rb index 33e01405f4..0285f89352 100644 --- a/lib/webrick/httpauth/userdb.rb +++ b/lib/webrick/httpauth/userdb.rb @@ -18,7 +18,7 @@ module WEBrick def set_passwd(realm, user, pass) self[user] = pass - end + end def get_passwd(realm, user, reload_db=false) # reload_db is dummy diff --git a/lib/webrick/httpproxy.rb b/lib/webrick/httpproxy.rb index f35a177777..ce99c55d8f 100644 --- a/lib/webrick/httpproxy.rb +++ b/lib/webrick/httpproxy.rb @@ -64,7 +64,7 @@ module WEBrick def proxy_service(req, res) # Proxy Authentication - proxy_auth(req, res) + proxy_auth(req, res) begin self.send("do_#{req.request_method}", req, res) @@ -81,7 +81,7 @@ module WEBrick handler.call(req, res) end end - + def do_CONNECT(req, res) # Proxy Authentication proxy_auth(req, res) @@ -264,7 +264,7 @@ module WEBrick http = Net::HTTP.new(uri.host, uri.port, upstream.host, upstream.port) http.start do if @config[:ProxyTimeout] - ################################## these issues are + ################################## these issues are http.open_timeout = 30 # secs # necessary (maybe bacause http.read_timeout = 60 # secs # Ruby's bug, but why?) ################################## diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb index 3a8d744016..ff9b6d7849 100644 --- a/lib/webrick/httprequest.rb +++ b/lib/webrick/httprequest.rb @@ -304,7 +304,7 @@ module WEBrick end elsif self['content-length'] || @remaining_size @remaining_size ||= self['content-length'].to_i - while @remaining_size > 0 + while @remaining_size > 0 sz = [@buffer_size, @remaining_size].min break unless buf = read_data(socket, sz) @remaining_size -= buf.bytesize diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb index 740a8fe921..98c4a357fa 100644 --- a/lib/webrick/httpresponse.rb +++ b/lib/webrick/httpresponse.rb @@ -201,10 +201,10 @@ module WEBrick def set_error(ex, backtrace=false) case ex - when HTTPStatus::Status + when HTTPStatus::Status @keep_alive = false if HTTPStatus::error?(ex.code) self.status = ex.code - else + else @keep_alive = false self.status = HTTPStatus::RC_INTERNAL_SERVER_ERROR end diff --git a/lib/webrick/httpserver.rb b/lib/webrick/httpserver.rb index 495be263b3..929d856a4a 100644 --- a/lib/webrick/httpserver.rb +++ b/lib/webrick/httpserver.rb @@ -36,12 +36,12 @@ module WEBrick [ $stderr, AccessLog::REFERER_LOG_FORMAT ] ] end - + @virtual_hosts = Array.new end def run(sock) - while true + while true res = HTTPResponse.new(@config) req = HTTPRequest.new(@config) server = self diff --git a/lib/webrick/httpservlet/cgihandler.rb b/lib/webrick/httpservlet/cgihandler.rb index f504f4d63b..ab36b906f1 100644 --- a/lib/webrick/httpservlet/cgihandler.rb +++ b/lib/webrick/httpservlet/cgihandler.rb @@ -1,11 +1,11 @@ -# +# # cgihandler.rb -- CGIHandler Class -# +# # Author: IPR -- Internet Programming with Ruby -- writers # Copyright (c) 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou # Copyright (c) 2002 Internet Programming with Ruby writers. All rights # reserved. -# +# # $IPR: cgihandler.rb,v 1.27 2003/03/21 19:56:01 gotoyuzo Exp $ require 'rbconfig' @@ -68,16 +68,16 @@ module WEBrick if errmsg.bytesize > 0 @logger.error("CGIHandler: #{@script_filename}:\n" + errmsg) end - end + end cgi_err.close(true) end - + if status != 0 @logger.error("CGIHandler: #{@script_filename} exit with #{status}") end data = "" unless data - raw_header, body = data.split(/^[\xd\xa]+/, 2) + raw_header, body = data.split(/^[\xd\xa]+/, 2) raise HTTPStatus::InternalServerError, "Premature end of script headers: #{@script_filename}" if body.nil? diff --git a/lib/webrick/httpservlet/erbhandler.rb b/lib/webrick/httpservlet/erbhandler.rb index 49792193ba..845db07169 100644 --- a/lib/webrick/httpservlet/erbhandler.rb +++ b/lib/webrick/httpservlet/erbhandler.rb @@ -1,11 +1,11 @@ -# +# # erbhandler.rb -- ERBHandler Class -# +# # Author: IPR -- Internet Programming with Ruby -- writers # Copyright (c) 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou # Copyright (c) 2002 Internet Programming with Ruby writers. All rights # reserved. -# +# # $IPR: erbhandler.rb,v 1.25 2003/02/24 19:25:31 gotoyuzo Exp $ require 'webrick/httpservlet/abstract.rb' diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb index f1cc88bed9..1cac0cabe3 100644 --- a/lib/webrick/httpservlet/filehandler.rb +++ b/lib/webrick/httpservlet/filehandler.rb @@ -32,7 +32,7 @@ module WEBrick if not_modified?(req, res, mtime, res['etag']) res.body = '' raise HTTPStatus::NotModified - elsif req['range'] + elsif req['range'] make_partial_content(req, res, @local_path, st.size) raise HTTPStatus::PartialContent else @@ -402,7 +402,7 @@ module WEBrick res.body << "<A HREF=\"?M=#{d1}\">Last modified</A> " res.body << "<A HREF=\"?S=#{d1}\">Size</A>\n" res.body << "<HR>\n" - + list.unshift [ "..", File::mtime(local_path+"/.."), -1 ] list.each{ |name, time, size| if name == ".." @@ -420,7 +420,7 @@ module WEBrick } res.body << "</PRE><HR>" - res.body << <<-_end_of_html_ + res.body << <<-_end_of_html_ <ADDRESS> #{HTMLUtils::escape(@config[:ServerSoftware])}<BR> at #{req.host}:#{req.port} diff --git a/lib/webrick/httpservlet/prochandler.rb b/lib/webrick/httpservlet/prochandler.rb index 783cb27896..2be3c854c1 100644 --- a/lib/webrick/httpservlet/prochandler.rb +++ b/lib/webrick/httpservlet/prochandler.rb @@ -1,11 +1,11 @@ -# +# # prochandler.rb -- ProcHandler Class -# +# # Author: IPR -- Internet Programming with Ruby -- writers # Copyright (c) 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou # Copyright (c) 2002 Internet Programming with Ruby writers. All rights # reserved. -# +# # $IPR: prochandler.rb,v 1.7 2002/09/21 12:23:42 gotoyuzo Exp $ require 'webrick/httpservlet/abstract.rb' @@ -16,7 +16,7 @@ module WEBrick class ProcHandler < AbstractServlet def get_instance(server, *options) self - end + end def initialize(proc) @proc = proc diff --git a/lib/webrick/httpstatus.rb b/lib/webrick/httpstatus.rb index a4b42f5a90..d022ddb446 100644 --- a/lib/webrick/httpstatus.rb +++ b/lib/webrick/httpstatus.rb @@ -19,7 +19,7 @@ module WEBrick class Error < Status; end class ClientError < Error; end class ServerError < Error; end - + class EOFError < StandardError; end StatusMessage = { @@ -84,7 +84,7 @@ module WEBrick class #{err_name} < #{parent} def self.code() RC_#{var_name} end def self.reason_phrase() StatusMessage[code] end - def code() self::class::code end + def code() self::class::code end def reason_phrase() self::class::reason_phrase end alias to_i code end diff --git a/lib/webrick/httputils.rb b/lib/webrick/httputils.rb index f921364786..bed24e09dd 100644 --- a/lib/webrick/httputils.rb +++ b/lib/webrick/httputils.rb @@ -98,7 +98,7 @@ module WEBrick next if /^#/ =~ line line.chomp! mimetype, ext0 = line.split(/\s+/, 2) - next unless ext0 + next unless ext0 next if ext0.empty? ext0.split(/\s+/).each{ |ext| hash[ext] = mimetype } } @@ -216,7 +216,7 @@ module WEBrick super("") else @raw_header = EmptyRawHeader - @header = EmptyHeader + @header = EmptyHeader super(args.shift) unless args.empty? @next_data = self.class.new(*args) @@ -250,7 +250,7 @@ module WEBrick def append_data(data) tmp = self while tmp - unless tmp.next_data + unless tmp.next_data tmp.next_data = data break end @@ -317,7 +317,7 @@ module WEBrick if form_data.has_key?(key) form_data[key].append_data(data) else - form_data[key] = data + form_data[key] = data end end data = FormData.new diff --git a/lib/webrick/log.rb b/lib/webrick/log.rb index 5d4fd0a174..0ffa12dd96 100644 --- a/lib/webrick/log.rb +++ b/lib/webrick/log.rb @@ -72,7 +72,7 @@ module WEBrick end class Log < BasicLog - attr_accessor :time_format + attr_accessor :time_format def initialize(log_file=nil, level=nil) super(log_file, level) diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb index d0b6f2b693..c4d23bd67b 100644 --- a/lib/webrick/server.rb +++ b/lib/webrick/server.rb @@ -157,7 +157,7 @@ module WEBrick begin sock = svr.accept sock.sync = true - Utils::set_non_blocking(sock) + Utils::set_non_blocking(sock) Utils::set_close_on_exec(sock) rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINVAL => ex diff --git a/lib/webrick/ssl.rb b/lib/webrick/ssl.rb index 03bfdf4aa0..896206b483 100644 --- a/lib/webrick/ssl.rb +++ b/lib/webrick/ssl.rb @@ -2,7 +2,7 @@ # ssl.rb -- SSL/TLS enhancement for GenericServer # # Copyright (c) 2003 GOTOU Yuuzou All rights reserved. -# +# # $Id$ require 'webrick' @@ -41,7 +41,7 @@ module WEBrick case p when 0; $stderr.putc "." # BN_generate_prime when 1; $stderr.putc "+" # BN_generate_prime - when 2; $stderr.putc "*" # searching good prime, + when 2; $stderr.putc "*" # searching good prime, # n = #of try, # but also data from BN_generate_prime when 3; $stderr.putc "\n" # found good prime, n==0 - p, n==1 - q, @@ -88,7 +88,7 @@ module WEBrick if @config[:SSLEnable] unless ssl_context @ssl_context = setup_ssl_context(@config) - @logger.info("\n" + @config[:SSLCertificate].to_text) + @logger.info("\n" + @config[:SSLCertificate].to_text) end listeners.collect!{|svr| ssvr = ::OpenSSL::SSL::SSLServer.new(svr, ssl_context) diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb index f2ecfc19a8..dee9363441 100644 --- a/lib/webrick/utils.rb +++ b/lib/webrick/utils.rb @@ -86,13 +86,13 @@ module WEBrick RAND_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789" + - "abcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyz" def random_string(len) rand_max = RAND_CHARS.bytesize - ret = "" + ret = "" len.times{ ret << RAND_CHARS[rand(rand_max)] } - ret + ret end module_function :random_string diff --git a/lib/xmlrpc/base64.rb b/lib/xmlrpc/base64.rb index f9a21c703a..bfa8c0a2d5 100644 --- a/lib/xmlrpc/base64.rb +++ b/lib/xmlrpc/base64.rb @@ -9,19 +9,19 @@ Released under the same term of license as Ruby. = XMLRPC::Base64 == Description -This class is necessary for (('xmlrpc4r')) to determine that a string should -be transmitted base64-encoded and not as a raw-string. -You can use (({XMLRPC::Base64})) on the client and server-side as a +This class is necessary for (('xmlrpc4r')) to determine that a string should +be transmitted base64-encoded and not as a raw-string. +You can use (({XMLRPC::Base64})) on the client and server-side as a parameter and/or return-value. == Class Methods --- XMLRPC::Base64.new( str, state = :dec ) Creates a new (({XMLRPC::Base64})) instance with string ((|str|)) as the - internal string. When ((|state|)) is (({:dec})) it assumes that the - string ((|str|)) is not in base64 format (perhaps already decoded), - otherwise if ((|state|)) is (({:enc})) it decodes ((|str|)) + internal string. When ((|state|)) is (({:dec})) it assumes that the + string ((|str|)) is not in base64 format (perhaps already decoded), + otherwise if ((|state|)) is (({:enc})) it decodes ((|str|)) and stores it as the internal string. - + --- XMLRPC::Base64.decode( str ) Decodes string ((|str|)) with base64 and returns that value. @@ -40,7 +40,7 @@ parameter and/or return-value. module XMLRPC class Base64 - + def initialize(str, state = :dec) case state when :enc @@ -51,11 +51,11 @@ class Base64 raise ArgumentError, "wrong argument; either :enc or :dec" end end - + def decoded - @str + @str end - + def encoded Base64.encode(@str) end diff --git a/lib/xmlrpc/client.rb b/lib/xmlrpc/client.rb index 9d0a8bbaf0..65c9cd0c9c 100644 --- a/lib/xmlrpc/client.rb +++ b/lib/xmlrpc/client.rb @@ -26,7 +26,7 @@ Released under the same term of license as Ruby. or require "xmlrpc/client" - + server = XMLRPC::Client.new("www.ruby-lang.org", "/RPC2", 80) ok, param = server.call2("michael.add", 4, 5) if ok then @@ -40,14 +40,14 @@ or == Description Class (({XMLRPC::Client})) provides remote procedure calls to a XML-RPC server. After setting the connection-parameters with ((<XMLRPC::Client.new>)) which -creates a new (({XMLRPC::Client})) instance, you can execute a remote procedure +creates a new (({XMLRPC::Client})) instance, you can execute a remote procedure by sending the ((<call|XMLRPC::Client#call>)) or ((<call2|XMLRPC::Client#call2>)) -message to this new instance. The given parameters indicate which method to +message to this new instance. The given parameters indicate which method to call on the remote-side and of course the parameters for the remote procedure. == Class Methods --- XMLRPC::Client.new( host=nil, path=nil, port=nil, proxy_host=nil, proxy_port=nil, user=nil, password=nil, use_ssl=false, timeout =nil) - Creates an object which represents the remote XML-RPC server on the + Creates an object which represents the remote XML-RPC server on the given host ((|host|)). If the server is CGI-based, ((|path|)) is the path to the CGI-script, which will be called, otherwise (in the case of a standalone server) ((|path|)) should be (({"/RPC2"})). @@ -59,8 +59,8 @@ call on the remote-side and of course the parameters for the remote procedure. Default values for ((|host|)), ((|path|)) and ((|port|)) are 'localhost', '/RPC2' and '80' respectively using SSL '443'. - If ((|user|)) and ((|password|)) are given, each time a request is send, - a Authorization header is send. Currently only Basic Authentification is + If ((|user|)) and ((|password|)) are given, each time a request is send, + a Authorization header is send. Currently only Basic Authentification is implemented no Digest. If ((|use_ssl|)) is set to (({true})), comunication over SSL is enabled. @@ -76,9 +76,9 @@ call on the remote-side and of course the parameters for the remote procedure. : proxy Is of the form "host:port". - + : timeout - Defaults to 30. + Defaults to 30. --- XMLRPC::Client.new3( hash={} ) --- XMLRPC::Client.new_from_hash( hash={} ) @@ -97,10 +97,10 @@ call on the remote-side and of course the parameters for the remote procedure. == Instance Methods --- XMLRPC::Client#call( method, *args ) - Invokes the method named ((|method|)) with the parameters given by + Invokes the method named ((|method|)) with the parameters given by ((|args|)) on the XML-RPC server. - The parameter ((|method|)) is converted into a (({String})) and should - be a valid XML-RPC method-name. + The parameter ((|method|)) is converted into a (({String})) and should + be a valid XML-RPC method-name. Each parameter of ((|args|)) must be of one of the following types, where (({Hash})), (({Struct})) and (({Array})) can contain any of these listed ((:types:)): * (({Fixnum})), (({Bignum})) @@ -110,31 +110,31 @@ call on the remote-side and of course the parameters for the remote procedure. * (({Hash})), (({Struct})) * (({Array})) * (({Date})), (({Time})), (({XMLRPC::DateTime})) - * (({XMLRPC::Base64})) - * A Ruby object which class includes XMLRPC::Marshallable (only if Config::ENABLE_MARSHALLABLE is (({true}))). + * (({XMLRPC::Base64})) + * A Ruby object which class includes XMLRPC::Marshallable (only if Config::ENABLE_MARSHALLABLE is (({true}))). That object is converted into a hash, with one additional key/value pair "___class___" which contains the class name for restoring later that object. - - The method returns the return-value from the RPC - ((-stands for Remote Procedure Call-)). + + The method returns the return-value from the RPC + ((-stands for Remote Procedure Call-)). The type of the return-value is one of the above shown, only that a (({Bignum})) is only allowed when it fits in 32-bit and that a XML-RPC (('dateTime.iso8601')) type is always returned as - a ((<(({XMLRPC::DateTime}))|URL:datetime.html>)) object and + a ((<(({XMLRPC::DateTime}))|URL:datetime.html>)) object and a (({Struct})) is never returned, only a (({Hash})), the same for a (({Symbol})), where - always a (({String})) is returned. + always a (({String})) is returned. A (({XMLRPC::Base64})) is returned as a (({String})) from xmlrpc4r version 1.6.1 on. - - If the remote procedure returned a fault-structure, then a + + If the remote procedure returned a fault-structure, then a (({XMLRPC::FaultException})) exception is raised, which has two accessor-methods (({faultCode})) and (({faultString})) of type (({Integer})) and (({String})). --- XMLRPC::Client#call2( method, *args ) The difference between this method and ((<call|XMLRPC::Client#call>)) is, that this method do ((*not*)) raise a (({XMLRPC::FaultException})) exception. - The method returns an array of two values. The first value indicates if + The method returns an array of two values. The first value indicates if the second value is a return-value ((({true}))) or an object of type - (({XMLRPC::FaultException})). + (({XMLRPC::FaultException})). Both are explained in ((<call|XMLRPC::Client#call>)). Simple to remember: The "2" in "call2" denotes the number of values it returns. @@ -151,19 +151,19 @@ call on the remote-side and of course the parameters for the remote procedure. # => [7, -1] --- XMLRPC::Client#multicall2( *methods ) - Same as ((<XMLRPC::Client#multicall>)), but returns like ((<XMLRPC::Client#call2>)) two parameters + Same as ((<XMLRPC::Client#multicall>)), but returns like ((<XMLRPC::Client#call2>)) two parameters instead of raising an (({XMLRPC::FaultException})). --- XMLRPC::Client#proxy( prefix, *args ) Returns an object of class (({XMLRPC::Client::Proxy})), initialized with ((|prefix|)) and ((|args|)). A proxy object returned by this method behaves like ((<XMLRPC::Client#call>)), i.e. a call on that object will raise a - (({XMLRPC::FaultException})) when a fault-structure is returned by that call. + (({XMLRPC::FaultException})) when a fault-structure is returned by that call. --- XMLRPC::Client#proxy2( prefix, *args ) Almost the same like ((<XMLRPC::Client#proxy>)) only that a call on the returned (({XMLRPC::Client::Proxy})) object behaves like ((<XMLRPC::Client#call2>)), i.e. - a call on that object will return two parameters. + a call on that object will return two parameters. @@ -175,21 +175,21 @@ call on the remote-side and of course the parameters for the remote procedure. --- XMLRPC::Client#proxy_async(...) --- XMLRPC::Client#proxy2_async(...) In contrast to corresponding methods without "_async", these can be - called concurrently and use for each request a new connection, where the + called concurrently and use for each request a new connection, where the non-asynchronous counterparts use connection-alive (one connection for all requests) - if possible. + if possible. - Note, that you have to use Threads to call these methods concurrently. + Note, that you have to use Threads to call these methods concurrently. The following example calls two methods concurrently: - + Thread.new { p client.call_async("michael.add", 4, 5) } - + Thread.new { p client.call_async("michael.div", 7, 9) } - + --- XMLRPC::Client#timeout --- XMLRPC::Client#user @@ -200,12 +200,12 @@ call on the remote-side and of course the parameters for the remote procedure. --- XMLRPC::Client#user= (new_user) --- XMLRPC::Client#password= (new_password) Set the corresponding attributes. - + --- XMLRPC::Client#set_writer( writer ) Sets the XML writer to use for generating XML output. Should be an instance of a class from module (({XMLRPC::XMLWriter})). - If this method is not called, then (({XMLRPC::Config::DEFAULT_WRITER})) is used. + If this method is not called, then (({XMLRPC::Config::DEFAULT_WRITER})) is used. --- XMLRPC::Client#set_parser( parser ) Sets the XML parser to use for parsing XML documents. @@ -220,7 +220,7 @@ call on the remote-side and of course the parameters for the remote procedure. Set extra HTTP headers that are included in the request. --- XMLRPC::Client#http_header_extra - Access the via ((<XMLRPC::Client#http_header_extra=>)) assigned header. + Access the via ((<XMLRPC::Client#http_header_extra=>)) assigned header. --- XMLRPC::Client#http_last_response Returns the (({Net::HTTPResponse})) object of the last RPC. @@ -240,31 +240,31 @@ call on the remote-side and of course the parameters for the remote procedure. == Description Class (({XMLRPC::Client::Proxy})) makes XML-RPC calls look nicer! -You can call any method onto objects of that class - the object handles +You can call any method onto objects of that class - the object handles (({method_missing})) and will forward the method call to a XML-RPC server. Don't use this class directly, but use instead method ((<XMLRPC::Client#proxy>)) or ((<XMLRPC::Client#proxy2>)). == Class Methods ---- XMLRPC::Client::Proxy.new( server, prefix, args=[], meth=:call, delim="." ) +--- XMLRPC::Client::Proxy.new( server, prefix, args=[], meth=:call, delim="." ) Creates an object which provides (({method_missing})). ((|server|)) must be of type (({XMLRPC::Client})), which is the XML-RPC server to be used for a XML-RPC call. ((|prefix|)) and ((|delim|)) will be prepended to the methodname - called onto this object. + called onto this object. Parameter ((|meth|)) is the method (call, call2, call_async, call2_async) to use for a RPC. ((|args|)) are arguments which are automatically given to every XML-RPC call before the arguments provides through (({method_missing})). - + == Instance Methods Every method call is forwarded to the XML-RPC server defined in ((<new|XMLRPC::Client::Proxy#new>)). - + Note: Inherited methods from class (({Object})) cannot be used as XML-RPC names, because they get around -(({method_missing})). - +(({method_missing})). + = History @@ -283,7 +283,7 @@ require "net/http" module XMLRPC class Client - + USER_AGENT = "XMLRPC::Client (Ruby #{RUBY_VERSION})" include ParserWriterChooseMixin @@ -292,11 +292,11 @@ module XMLRPC # Constructors ------------------------------------------------------------------- - def initialize(host=nil, path=nil, port=nil, proxy_host=nil, proxy_port=nil, + def initialize(host=nil, path=nil, port=nil, proxy_host=nil, proxy_port=nil, user=nil, password=nil, use_ssl=nil, timeout=nil) @http_header_extra = nil - @http_last_response = nil + @http_last_response = nil @cookie = nil @host = host || "localhost" @@ -325,7 +325,7 @@ module XMLRPC # HTTP object for synchronous calls Net::HTTP.version_1_2 - @http = Net::HTTP.new(@host, @port, @proxy_host, @proxy_port) + @http = Net::HTTP.new(@host, @port, @proxy_host, @proxy_port) @http.use_ssl = @use_ssl if @use_ssl @http.read_timeout = @timeout @http.open_timeout = @timeout @@ -341,7 +341,7 @@ module XMLRPC if match = /^([^:]+):\/\/(([^@]+)@)?([^\/]+)(\/.*)?$/.match(uri) proto = match[1] user, passwd = (match[3] || "").split(":") - host, port = match[4].split(":") + host, port = match[4].split(":") path = match[5] if proto != "http" and proto != "https" @@ -351,7 +351,7 @@ module XMLRPC else raise "Wrong URI as parameter!" end - + proxy_host, proxy_port = (proxy || "").split(":") self.new(host, path, port, proxy_host, proxy_port, user, passwd, (proto == "https"), timeout) @@ -384,7 +384,7 @@ module XMLRPC # Cookie support attr_accessor :cookie - + attr_reader :timeout, :user, :password @@ -407,13 +407,13 @@ module XMLRPC # Call methods -------------------------------------------------------------- def call(method, *args) - ok, param = call2(method, *args) + ok, param = call2(method, *args) if ok param else raise param end - end + end def call2(method, *args) request = create().methodCall(method, *args) @@ -422,13 +422,13 @@ module XMLRPC end def call_async(method, *args) - ok, param = call2_async(method, *args) + ok, param = call2_async(method, *args) if ok param else raise param end - end + end def call2_async(method, *args) request = create().methodCall(method, *args) @@ -467,7 +467,7 @@ module XMLRPC # Proxy generating methods ------------------------------------------ - + def proxy(prefix=nil, *args) Proxy.new(self, prefix, args, :call) end @@ -498,10 +498,10 @@ module XMLRPC end def do_rpc(request, async=false) - header = { + header = { "User-Agent" => USER_AGENT, "Content-Type" => "text/xml; charset=utf-8", - "Content-Length" => request.size.to_s, + "Content-Length" => request.size.to_s, "Connection" => (async ? "close" : "keep-alive") } @@ -512,41 +512,41 @@ module XMLRPC # add authorization header header["Authorization"] = @auth end - + resp = nil @http_last_response = nil if async - # use a new HTTP object for each call + # use a new HTTP object for each call Net::HTTP.version_1_2 - http = Net::HTTP.new(@host, @port, @proxy_host, @proxy_port) + http = Net::HTTP.new(@host, @port, @proxy_host, @proxy_port) http.use_ssl = @use_ssl if @use_ssl http.read_timeout = @timeout http.open_timeout = @timeout - + # post request http.start { - resp = http.post2(@path, request, header) + resp = http.post2(@path, request, header) } else # reuse the HTTP object for each call => connection alive is possible # we must start connection explicitely first time so that http.request # does not assume that we don't want keepalive @http.start if not @http.started? - + # post request - resp = @http.post2(@path, request, header) + resp = @http.post2(@path, request, header) end - + @http_last_response = resp data = resp.body if resp.code == "401" # Authorization Required - raise "Authorization failed.\nHTTP-Error: #{resp.code} #{resp.message}" + raise "Authorization failed.\nHTTP-Error: #{resp.code} #{resp.message}" elsif resp.code[0,1] != "2" - raise "HTTP-Error: #{resp.code} #{resp.message}" + raise "HTTP-Error: #{resp.code} #{resp.message}" end ct = parse_content_type(resp["Content-Type"]).first @@ -559,8 +559,8 @@ module XMLRPC end expected = resp["Content-Length"] || "<unknown>" - if data.nil? or data.size == 0 - raise "Wrong size. Was #{data.size}, should be #{expected}" + if data.nil? or data.size == 0 + raise "Wrong size. Was #{data.size}, should be #{expected}" elsif expected != "<unknown>" and expected.to_i != data.size and resp["Transfer-Encoding"].nil? raise "Wrong size. Was #{data.size}, should be #{expected}" end @@ -581,11 +581,11 @@ module XMLRPC meth = :call2 meth = :call2_async if async - ok, params = self.send(meth, "system.multicall", + ok, params = self.send(meth, "system.multicall", methods.collect {|m| {'methodName' => m[0], 'params' => m[1..-1]} } ) - if ok + if ok params = params.collect do |param| if param.is_a? Array param[0] @@ -593,7 +593,7 @@ module XMLRPC XMLRPC::FaultException.new(param["faultCode"], param["faultString"]) else raise "Wrong multicall return value" - end + end end end @@ -607,7 +607,7 @@ module XMLRPC def initialize(server, prefix, args=[], meth=:call, delim=".") @server = server @prefix = prefix ? prefix + delim : "" - @args = args + @args = args @meth = meth end diff --git a/lib/xmlrpc/config.rb b/lib/xmlrpc/config.rb index c4d2c41aac..34c3bbaf1b 100644 --- a/lib/xmlrpc/config.rb +++ b/lib/xmlrpc/config.rb @@ -8,7 +8,7 @@ module XMLRPC module Config DEFAULT_WRITER = XMLWriter::Simple # or XMLWriter::XMLParser - + # available parser: # * XMLParser::NQXMLTreeParser # * XMLParser::NQXMLStreamParser @@ -21,16 +21,16 @@ module XMLRPC # enable <nil/> tag ENABLE_NIL_CREATE = false ENABLE_NIL_PARSER = false - + # allows integers greater than 32-bit if true ENABLE_BIGINT = false # enable marshalling ruby objects which include XMLRPC::Marshallable - ENABLE_MARSHALLING = true + ENABLE_MARSHALLING = true # enable multiCall extension by default ENABLE_MULTICALL = false - + # enable Introspection extension by default ENABLE_INTROSPECTION = false diff --git a/lib/xmlrpc/create.rb b/lib/xmlrpc/create.rb index 530d229f66..2d38a44b30 100644 --- a/lib/xmlrpc/create.rb +++ b/lib/xmlrpc/create.rb @@ -1,6 +1,6 @@ # # Creates XML-RPC call/response documents -# +# # Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de) # # $Id$ @@ -41,7 +41,7 @@ module XMLRPC def element(name, attrs, *children) raise "attributes not yet implemented" unless attrs.nil? if children.empty? - "<#{name}/>" + "<#{name}/>" else "<#{name}>" + children.join("") + "</#{name}>" end @@ -69,7 +69,7 @@ module XMLRPC end def document(*params) - XML::SimpleTree::Document.new(*params) + XML::SimpleTree::Document.new(*params) end def pi(name, *params) @@ -120,9 +120,9 @@ module XMLRPC tree = @writer.document( @writer.pi("xml", 'version="1.0"'), - @writer.ele("methodCall", + @writer.ele("methodCall", @writer.tag("methodName", name), - @writer.ele("params", *parameter) + @writer.ele("params", *parameter) ) ) @@ -137,29 +137,29 @@ module XMLRPC # if is_ret == false then the params array must # contain only one element, which is a structure # of a fault return-value. - # - # if is_ret == true then a normal + # + # if is_ret == true then a normal # return-value of all the given params is created. # def methodResponse(is_ret, *params) - if is_ret + if is_ret resp = params.collect do |param| @writer.ele("param", conv2value(param)) end - + resp = [@writer.ele("params", *resp)] else - if params.size != 1 or params[0] === XMLRPC::FaultException + if params.size != 1 or params[0] === XMLRPC::FaultException raise ArgumentError, "no valid fault-structure given" end resp = @writer.ele("fault", conv2value(params[0].to_h)) end - + tree = @writer.document( @writer.pi("xml", 'version="1.0"'), - @writer.ele("methodResponse", resp) + @writer.ele("methodResponse", resp) ) @writer.document_to_str(tree) + "\n" @@ -178,7 +178,7 @@ module XMLRPC def conv2value(param) val = case param - when Fixnum + when Fixnum @writer.tag("i4", param.to_s) when Bignum @@ -194,10 +194,10 @@ module XMLRPC when TrueClass, FalseClass @writer.tag("boolean", param ? "1" : "0") - when Symbol + when Symbol @writer.tag("string", param.to_s) - when String + when String @writer.tag("string", param) when NilClass @@ -211,51 +211,51 @@ module XMLRPC @writer.tag("double", param.to_s) when Struct - h = param.members.collect do |key| + h = param.members.collect do |key| value = param[key] - @writer.ele("member", + @writer.ele("member", @writer.tag("name", key.to_s), - conv2value(value) + conv2value(value) ) end - @writer.ele("struct", *h) + @writer.ele("struct", *h) when Hash # TODO: can a Hash be empty? - + h = param.collect do |key, value| - @writer.ele("member", + @writer.ele("member", @writer.tag("name", key.to_s), - conv2value(value) + conv2value(value) ) end - @writer.ele("struct", *h) + @writer.ele("struct", *h) when Array # TODO: can an Array be empty? a = param.collect {|v| conv2value(v) } - - @writer.ele("array", + + @writer.ele("array", @writer.ele("data", *a) ) when Time, Date, ::DateTime - @writer.tag("dateTime.iso8601", param.strftime("%Y%m%dT%H:%M:%S")) + @writer.tag("dateTime.iso8601", param.strftime("%Y%m%dT%H:%M:%S")) when XMLRPC::DateTime - @writer.tag("dateTime.iso8601", + @writer.tag("dateTime.iso8601", format("%.4d%02d%02dT%02d:%02d:%02d", *param.to_a)) - + when XMLRPC::Base64 - @writer.tag("base64", param.encoded) + @writer.tag("base64", param.encoded) - else + else if Config::ENABLE_MARSHALLING and param.class.included_modules.include? XMLRPC::Marshallable # convert Ruby object into Hash ret = {"___class___" => param.class.name} - param.instance_variables.each {|v| + param.instance_variables.each {|v| name = v[1..-1] val = param.instance_variable_get(v) @@ -266,16 +266,16 @@ module XMLRPC end } return conv2value(ret) - else + else ok, pa = wrong_type(param) if ok return conv2value(pa) - else + else raise "Wrong type!" end end end - + @writer.ele("value", val) end @@ -283,7 +283,7 @@ module XMLRPC false end - + end # class Create end # module XMLRPC diff --git a/lib/xmlrpc/datetime.rb b/lib/xmlrpc/datetime.rb index f66ef8963a..d6c80a2cb9 100644 --- a/lib/xmlrpc/datetime.rb +++ b/lib/xmlrpc/datetime.rb @@ -10,19 +10,19 @@ Released under the same term of license as Ruby. = XMLRPC::DateTime == Description This class is important to handle XMLRPC (('dateTime.iso8601')) values, -correcly, because normal UNIX-dates (class (({Date}))) only handle dates +correcly, because normal UNIX-dates (class (({Date}))) only handle dates from year 1970 on, and class (({Time})) handles dates without the time -component. (({XMLRPC::DateTime})) is able to store a XMLRPC +component. (({XMLRPC::DateTime})) is able to store a XMLRPC (('dateTime.iso8601')) value correctly. == Class Methods --- XMLRPC::DateTime.new( year, month, day, hour, min, sec ) Creates a new (({XMLRPC::DateTime})) instance with the - parameters ((|year|)), ((|month|)), ((|day|)) as date and + parameters ((|year|)), ((|month|)), ((|day|)) as date and ((|hour|)), ((|min|)), ((|sec|)) as time. Raises (({ArgumentError})) if a parameter is out of range, or ((|year|)) is not of type (({Integer})). - + == Instance Methods --- XMLRPC::DateTime#year --- XMLRPC::DateTime#month @@ -50,7 +50,7 @@ component. (({XMLRPC::DateTime})) is able to store a XMLRPC --- XMLRPC::DateTime#to_time Return a (({Time})) object of the date/time which (({self})) represents. - If the (('year')) is below 1970, this method returns (({nil})), + If the (('year')) is below 1970, this method returns (({nil})), because (({Time})) cannot handle years below 1970. The used timezone is GMT. @@ -68,7 +68,7 @@ require "date" module XMLRPC class DateTime - + attr_reader :year, :month, :day, :hour, :min, :sec def year= (value) @@ -102,14 +102,14 @@ class DateTime end alias mon month - alias mon= month= - + alias mon= month= + def initialize(year, month, day, hour, min, sec) self.year, self.month, self.day = year, month, day self.hour, self.min, self.sec = hour, min, sec end - + def to_time if @year >= 1970 Time.gm(*to_a) diff --git a/lib/xmlrpc/httpserver.rb b/lib/xmlrpc/httpserver.rb index 020e6cbcd9..66d52139db 100644 --- a/lib/xmlrpc/httpserver.rb +++ b/lib/xmlrpc/httpserver.rb @@ -1,7 +1,7 @@ # -# Implements a simple HTTP-server by using John W. Small's (jsmall@laser.net) +# Implements a simple HTTP-server by using John W. Small's (jsmall@laser.net) # ruby-generic-server. -# +# # Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de) # # $Id$ @@ -14,8 +14,8 @@ class HttpServer < GServer ## # handle_obj specifies the object, that receives calls to request_handler - # and ip_auth_handler - def initialize(handle_obj, port = 8080, host = DEFAULT_HOST, maxConnections = 4, + # and ip_auth_handler + def initialize(handle_obj, port = 8080, host = DEFAULT_HOST, maxConnections = 4, stdlog = $stdout, audit = true, debug = true) @handler = handle_obj super(port, host, maxConnections, stdlog, audit, debug) @@ -24,7 +24,7 @@ class HttpServer < GServer private # Constants ----------------------------------------------- - + CRLF = "\r\n" HTTP_PROTO = "HTTP/1.0" SERVER_NAME = "HttpServer (Ruby #{RUBY_VERSION})" @@ -46,27 +46,27 @@ private } # Classes ------------------------------------------------- - + class Request attr_reader :data, :header, :method, :path, :proto - + def initialize(data, method=nil, path=nil, proto=nil) @header, @data = Table.new, data @method, @path, @proto = method, path, proto end - + def content_length len = @header['Content-Length'] return nil if len.nil? - return len.to_i + return len.to_i end - + end - + class Response attr_reader :header attr_accessor :body, :status, :status_message - + def initialize(status=200) @status = status @status_message = nil @@ -82,7 +82,7 @@ private include Enumerable def initialize(hash={}) - @hash = hash + @hash = hash update(hash) end @@ -113,7 +113,7 @@ private def http_header(header=nil) new_header = Table.new(DEFAULT_HEADER) - new_header.update(header) unless header.nil? + new_header.update(header) unless header.nil? new_header["Connection"] = "close" new_header["Date"] = http_date(Time.now) @@ -127,7 +127,7 @@ private def http_resp(status_code, status_message=nil, header=nil, body=nil) status_message ||= StatusCodeMapping[status_code] - + str = "" str << "#{HTTP_PROTO} #{status_code} #{status_message}" << CRLF http_header(header).writeTo(str) @@ -137,8 +137,8 @@ private end # Main Serve Loop ----------------------------------------- - - def serve(io) + + def serve(io) # perform IP authentification unless @handler.ip_auth_handler(io) io << http_resp(403, "Forbidden") @@ -149,10 +149,10 @@ private if io.gets =~ /^(\S+)\s+(\S+)\s+(\S+)/ request = Request.new(io, $1, $2, $3) else - io << http_resp(400, "Bad Request") + io << http_resp(400, "Bad Request") return end - + # parse HTTP headers while (line=io.gets) !~ /^(\n|\r)/ if line =~ /^([\w-]+):\s*(.*)$/ @@ -160,15 +160,15 @@ private end end - io.binmode + io.binmode response = Response.new # execute request handler @handler.request_handler(request, response) - + # write response back to the client io << http_resp(response.status, response.status_message, - response.header, response.body) + response.header, response.body) rescue Exception => e io << http_resp(500, "Internal Server Error") diff --git a/lib/xmlrpc/marshal.rb b/lib/xmlrpc/marshal.rb index 26510124c2..d121828312 100644 --- a/lib/xmlrpc/marshal.rb +++ b/lib/xmlrpc/marshal.rb @@ -1,6 +1,6 @@ # # Marshalling of XML-RPC methodCall and methodResponse -# +# # Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de) # # $Id$ @@ -17,7 +17,7 @@ module XMLRPC include ParserWriterChooseMixin # class methods ------------------------------- - + class << self def dump_call( methodName, *params ) @@ -52,7 +52,7 @@ module XMLRPC create.methodCall( methodName, *params ) end - def dump_response( param ) + def dump_response( param ) create.methodResponse( ! param.kind_of?( XMLRPC::FaultException ) , param ) end diff --git a/lib/xmlrpc/parser.rb b/lib/xmlrpc/parser.rb index 2cf0530c9f..d078de2f4b 100644 --- a/lib/xmlrpc/parser.rb +++ b/lib/xmlrpc/parser.rb @@ -1,6 +1,6 @@ # # Parser for XML-RPC call and response -# +# # Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de) # # $Id$ @@ -60,7 +60,7 @@ module XMLRPC @faultCode = faultCode @faultString = faultString end - + # returns a hash def to_h {"faultCode" => @faultCode, "faultString" => @faultString} @@ -77,7 +77,7 @@ module XMLRPC when "0" then false when "1" then true else - raise "RPC-value of type boolean is wrong" + raise "RPC-value of type boolean is wrong" end end @@ -122,7 +122,7 @@ module XMLRPC def self.struct(hash) # convert to marhalled object klass = hash["___class___"] - if klass.nil? or Config::ENABLE_MARSHALLING == false + if klass.nil? or Config::ENABLE_MARSHALLING == false hash else begin @@ -130,9 +130,9 @@ module XMLRPC klass.split("::").each {|const| mod = mod.const_get(const.strip)} obj = mod.allocate - + hash.delete "___class___" - hash.each {|key, value| + hash.each {|key, value| obj.instance_variable_set("@#{ key }", value) if key =~ /^([\w_][\w_0-9]*)$/ } obj @@ -143,11 +143,11 @@ module XMLRPC end def self.fault(hash) - if hash.kind_of? Hash and hash.size == 2 and - hash.has_key? "faultCode" and hash.has_key? "faultString" and + if hash.kind_of? Hash and hash.size == 2 and + hash.has_key? "faultCode" and hash.has_key? "faultString" and hash["faultCode"].kind_of? Integer and hash["faultString"].kind_of? String - XMLRPC::FaultException.new(hash["faultCode"], hash["faultString"]) + XMLRPC::FaultException.new(hash["faultCode"], hash["faultString"]) else raise "wrong fault-structure: #{hash.inspect}" end @@ -182,9 +182,9 @@ module XMLRPC # TODO: add nil? unless %w(i4 int boolean string double dateTime.iso8601 base64).include? node.nodeName - if node.nodeName == "value" + if node.nodeName == "value" if not node.childNodes.to_a.detect {|n| _nodeType(n) == :ELEMENT}.nil? - remove << nd if nd.nodeValue.strip == "" + remove << nd if nd.nodeValue.strip == "" end else remove << nd if nd.nodeValue.strip == "" @@ -194,7 +194,7 @@ module XMLRPC remove << nd else removeWhitespacesAndComments(nd) - end + end end remove.each { |i| node.removeChild(i) } @@ -203,13 +203,13 @@ module XMLRPC def nodeMustBe(node, name) cmp = case name - when Array + when Array name.include?(node.nodeName) when String name == node.nodeName else raise "error" - end + end if not cmp then raise "wrong xml-rpc (name)" @@ -233,7 +233,7 @@ module XMLRPC def assert(b) if not b then - raise "assert-fail" + raise "assert-fail" end end @@ -249,21 +249,21 @@ module XMLRPC raise "wrong xml-rpc (size)" end end - + def integer(node) #TODO: check string for float because to_i returnsa # 0 when wrong string - nodeMustBe(node, %w(i4 int)) + nodeMustBe(node, %w(i4 int)) hasOnlyOneChild(node) - + Convert.int(text(node.firstChild)) end def boolean(node) - nodeMustBe(node, "boolean") + nodeMustBe(node, "boolean") hasOnlyOneChild(node) - + Convert.boolean(text(node.firstChild)) end @@ -274,36 +274,36 @@ module XMLRPC end def string(node) - nodeMustBe(node, "string") + nodeMustBe(node, "string") text_zero_one(node) end def double(node) #TODO: check string for float because to_f returnsa # 0.0 when wrong string - nodeMustBe(node, "double") + nodeMustBe(node, "double") hasOnlyOneChild(node) - + Convert.double(text(node.firstChild)) end def dateTime(node) nodeMustBe(node, "dateTime.iso8601") hasOnlyOneChild(node) - + Convert.dateTime( text(node.firstChild) ) end def base64(node) nodeMustBe(node, "base64") #hasOnlyOneChild(node) - + Convert.base64(text_zero_one(node)) end def member(node) nodeMustBe(node, "member") - assert( node.childNodes.to_a.size == 2 ) + assert( node.childNodes.to_a.size == 2 ) [ name(node[0]), value(node[1]) ] end @@ -311,13 +311,13 @@ module XMLRPC def name(node) nodeMustBe(node, "name") #hasOnlyOneChild(node) - text_zero_one(node) + text_zero_one(node) end def array(node) nodeMustBe(node, "array") - hasOnlyOneChild(node, "data") - data(node.firstChild) + hasOnlyOneChild(node, "data") + data(node.firstChild) end def data(node) @@ -325,15 +325,15 @@ module XMLRPC node.childNodes.to_a.collect do |val| value(val) - end + end end def param(node) nodeMustBe(node, "param") hasOnlyOneChild(node, "value") - value(node.firstChild) + value(node.firstChild) end - + def methodResponse(node) nodeMustBe(node, "methodResponse") hasOnlyOneChild(node, %w(params fault)) @@ -341,7 +341,7 @@ module XMLRPC case child.nodeName when "params" - [ true, params(child,false) ] + [ true, params(child,false) ] when "fault" [ false, fault(child) ] else @@ -353,13 +353,13 @@ module XMLRPC def methodName(node) nodeMustBe(node, "methodName") hasOnlyOneChild(node) - text(node.firstChild) + text(node.firstChild) end def params(node, call=true) nodeMustBe(node, "params") - if call + if call node.childNodes.to_a.collect do |n| param(n) end @@ -372,7 +372,7 @@ module XMLRPC def fault(node) nodeMustBe(node, "fault") hasOnlyOneChild(node, "value") - f = value(node.firstChild) + f = value(node.firstChild) Convert.fault(f) end @@ -388,13 +388,13 @@ module XMLRPC end def struct(node) - nodeMustBe(node, "struct") + nodeMustBe(node, "struct") hash = {} node.childNodes.to_a.each do |me| - n, v = member(me) + n, v = member(me) hash[n] = v - end + end Convert.struct(hash) end @@ -403,9 +403,9 @@ module XMLRPC def value(node) nodeMustBe(node, "value") nodes = node.childNodes.to_a.size - if nodes == 0 + if nodes == 0 return "" - elsif nodes > 1 + elsif nodes > 1 raise "wrong xml-rpc (size)" end @@ -423,14 +423,14 @@ module XMLRPC when "dateTime.iso8601" then dateTime(child) when "base64" then base64(child) when "struct" then struct(child) - when "array" then array(child) - when "nil" + when "array" then array(child) + when "nil" if Config::ENABLE_NIL_PARSER v_nil(child) else raise "wrong/unknown XML-RPC type 'nil'" end - else + else raise "wrong/unknown XML-RPC type" end else @@ -441,7 +441,7 @@ module XMLRPC def methodCall(node) nodeMustBe(node, "methodCall") - assert( (1..2).include?( node.childNodes.to_a.size ) ) + assert( (1..2).include?( node.childNodes.to_a.size ) ) name = methodName(node[0]) if node.childNodes.to_a.size == 2 then @@ -461,7 +461,7 @@ module XMLRPC raise "No valid method response!" if parser.method_name != nil if parser.fault != nil # is a fault structure - [false, parser.fault] + [false, parser.fault] else # is a normal return value raise "Missing return value!" if parser.params.size == 0 @@ -508,7 +508,7 @@ module XMLRPC @value = nil when "nil" raise "wrong/unknown XML-RPC type 'nil'" unless Config::ENABLE_NIL_PARSER - @value = :nil + @value = :nil when "array" @val_stack << @values @values = [] @@ -517,7 +517,7 @@ module XMLRPC @name = [] @structs << @struct - @struct = {} + @struct = {} end end @@ -538,7 +538,7 @@ module XMLRPC @value = Convert.base64(@data) when "value" @value = @data if @value.nil? - @values << (@value == :nil ? nil : @value) + @values << (@value == :nil ? nil : @value) when "array" @value = @values @values = @val_stack.pop @@ -548,9 +548,9 @@ module XMLRPC @name = @names.pop @struct = @structs.pop when "name" - @name[0] = @data + @name[0] = @data when "member" - @struct[@name[0]] = @values.pop + @struct[@name[0]] = @values.pop when "param" @params << @values[0] @@ -560,7 +560,7 @@ module XMLRPC @fault = Convert.fault(@values[0]) when "methodName" - @method_name = @data + @method_name = @data end @data = nil @@ -592,7 +592,7 @@ module XMLRPC @parser_class = XMLRPCParser end - class XMLRPCParser + class XMLRPCParser include StreamParserMixin def parse(str) @@ -620,9 +620,9 @@ module XMLRPC def initialize require "xmltreebuilder" - # The new XMLParser library (0.6.2+) uses a slightly different DOM implementation. + # The new XMLParser library (0.6.2+) uses a slightly different DOM implementation. # The following code removes the differences between both versions. - if defined? XML::DOM::Builder + if defined? XML::DOM::Builder return if defined? XML::DOM::Node::DOCUMENT # code below has been already executed klass = XML::DOM::Node klass.const_set("DOCUMENT", klass::DOCUMENT_NODE) @@ -637,8 +637,8 @@ module XMLRPC def _nodeType(node) tp = node.nodeType if tp == XML::SimpleTree::Node::TEXT then :TEXT - elsif tp == XML::SimpleTree::Node::COMMENT then :COMMENT - elsif tp == XML::SimpleTree::Node::ELEMENT then :ELEMENT + elsif tp == XML::SimpleTree::Node::COMMENT then :COMMENT + elsif tp == XML::SimpleTree::Node::ELEMENT then :ELEMENT else :ELSE end end @@ -647,14 +647,14 @@ module XMLRPC def methodResponse_document(node) assert( node.nodeType == XML::SimpleTree::Node::DOCUMENT ) hasOnlyOneChild(node, "methodResponse") - + methodResponse(node.firstChild) end def methodCall_document(node) assert( node.nodeType == XML::SimpleTree::Node::DOCUMENT ) hasOnlyOneChild(node, "methodCall") - + methodCall(node.firstChild) end @@ -688,7 +688,7 @@ module XMLRPC end def createCleanedTree(str) - doc = ::NQXML::TreeParser.new(str).document.rootNode + doc = ::NQXML::TreeParser.new(str).document.rootNode removeWhitespacesAndComments(doc) doc end @@ -701,7 +701,7 @@ module XMLRPC @parser_class = StreamListener end - class StreamListener + class StreamListener include StreamParserMixin alias :tag_start :startElement @@ -716,7 +716,7 @@ module XMLRPC def parse(str) parser = REXML::Document.parse_stream(str, self) end - end + end end # --------------------------------------------------------------------------- @@ -751,7 +751,7 @@ module XMLRPC startElement(name) endElement(name) end - + def on_chardata(str) character(str) end @@ -784,7 +784,7 @@ module XMLRPC # valid_name? # valid_chardata? # valid_char? - # parse_error + # parse_error end end @@ -792,8 +792,8 @@ module XMLRPC XMLParser = XMLTreeParser NQXMLParser = NQXMLTreeParser - Classes = [XMLStreamParser, XMLTreeParser, - NQXMLStreamParser, NQXMLTreeParser, + Classes = [XMLStreamParser, XMLTreeParser, + NQXMLStreamParser, NQXMLTreeParser, REXMLStreamParser, XMLScanStreamParser] # yields an instance of each installed parser diff --git a/lib/xmlrpc/server.rb b/lib/xmlrpc/server.rb index 131173fa70..6b5c5d4253 100644 --- a/lib/xmlrpc/server.rb +++ b/lib/xmlrpc/server.rb @@ -14,23 +14,23 @@ Released under the same term of license as Ruby. = XMLRPC::BasicServer == Description Is the base class for all XML-RPC server-types (CGI, standalone). -You can add handler and set a default handler. +You can add handler and set a default handler. Do not use this server, as this is/should be an abstract class. === How the method to call is found -The arity (number of accepted arguments) of a handler (method or (({Proc})) object) is -compared to the given arguments submitted by the client for a RPC ((-Remote Procedure Call-)). -A handler is only called if it accepts the number of arguments, otherwise the search -for another handler will go on. When at the end no handler was found, +The arity (number of accepted arguments) of a handler (method or (({Proc})) object) is +compared to the given arguments submitted by the client for a RPC ((-Remote Procedure Call-)). +A handler is only called if it accepts the number of arguments, otherwise the search +for another handler will go on. When at the end no handler was found, the ((<default_handler|XMLRPC::BasicServer#set_default_handler>)) will be called. With this technique it is possible to do overloading by number of parameters, but only for (({Proc})) handler, because you cannot define two methods of the same name in -the same class. +the same class. == Class Methods --- XMLRPC::BasicServer.new( class_delim="." ) - Creates a new (({XMLRPC::BasicServer})) instance, which should not be + Creates a new (({XMLRPC::BasicServer})) instance, which should not be done, because (({XMLRPC::BasicServer})) is an abstract class. This method should be called from a subclass indirectly by a (({super})) call in the method (({initialize})). The paramter ((|class_delim|)) is used @@ -40,24 +40,24 @@ the same class. == Instance Methods --- XMLRPC::BasicServer#add_handler( name, signature=nil, help=nil ) { aBlock } Adds ((|aBlock|)) to the list of handlers, with ((|name|)) as the name of the method. - Parameters ((|signature|)) and ((|help|)) are used by the Introspection method if specified, - where ((|signature|)) is either an Array containing strings each representing a type of it's - signature (the first is the return value) or an Array of Arrays if the method has multiple + Parameters ((|signature|)) and ((|help|)) are used by the Introspection method if specified, + where ((|signature|)) is either an Array containing strings each representing a type of it's + signature (the first is the return value) or an Array of Arrays if the method has multiple signatures. Value type-names are "int, boolean, double, string, dateTime.iso8601, base64, array, struct". Parameter ((|help|)) is a String with informations about how to call this method etc. A handler method or code-block can return the types listed at - ((<XMLRPC::Client#call|URL:client.html#index:0>)). - When a method fails, it can tell it the client by throwing an + ((<XMLRPC::Client#call|URL:client.html#index:0>)). + When a method fails, it can tell it the client by throwing an (({XMLRPC::FaultException})) like in this example: s.add_handler("michael.div") do |a,b| if b == 0 raise XMLRPC::FaultException.new(1, "division by zero") else - a / b + a / b end - end + end The client gets in the case of (({b==0})) an object back of type (({XMLRPC::FaultException})) that has a ((|faultCode|)) and ((|faultString|)) field. @@ -67,10 +67,10 @@ the same class. To add an object write: server.add_handler("michael", MyHandlerClass.new) All public methods of (({MyHandlerClass})) are accessible to - the XML-RPC clients by (('michael."name of method"')). This is - where the ((|class_delim|)) in ((<new|XMLRPC::BasicServer.new>)) - has it's role, a XML-RPC method-name is defined by - ((|prefix|)) + ((|class_delim|)) + (('"name of method"')). + the XML-RPC clients by (('michael."name of method"')). This is + where the ((|class_delim|)) in ((<new|XMLRPC::BasicServer.new>)) + has it's role, a XML-RPC method-name is defined by + ((|prefix|)) + ((|class_delim|)) + (('"name of method"')). --- XMLRPC::BasicServer#add_handler( interface, obj ) This is the third form of ((<add_handler|XMLRPC::BasicServer#add_handler>)). @@ -91,11 +91,11 @@ the same class. It is a (({Proc})) object or (({nil})). --- XMLRPC::BasicServer#set_default_handler ( &handler ) - Sets ((|handler|)) as the default-handler, which is called when + Sets ((|handler|)) as the default-handler, which is called when no handler for a method-name is found. ((|handler|)) is a code-block. The default-handler is called with the (XML-RPC) method-name as first argument, and the other arguments are the parameters given by the client-call. - + If no block is specified the default of (({XMLRPC::BasicServer})) is used, which raises a XMLRPC::FaultException saying "method missing". @@ -103,7 +103,7 @@ the same class. --- XMLRPC::BasicServer#set_writer( writer ) Sets the XML writer to use for generating XML output. Should be an instance of a class from module (({XMLRPC::XMLWriter})). - If this method is not called, then (({XMLRPC::Config::DEFAULT_WRITER})) is used. + If this method is not called, then (({XMLRPC::Config::DEFAULT_WRITER})) is used. --- XMLRPC::BasicServer#set_parser( parser ) Sets the XML parser to use for parsing XML documents. @@ -111,7 +111,7 @@ the same class. If this method is not called, then (({XMLRPC::Config::DEFAULT_PARSER})) is used. --- XMLRPC::BasicServer#add_introspection - Adds the introspection handlers "system.listMethods", "system.methodSignature" and "system.methodHelp", + Adds the introspection handlers "system.listMethods", "system.methodSignature" and "system.methodHelp", where only the first one works. --- XMLRPC::BasicServer#add_multicall @@ -123,7 +123,7 @@ the same class. --- XMLRPC::BasicServer#set_service_hook ( &handler ) A service-hook is called for each service request (RPC). You can use a service-hook for example to wrap existing methods and catch exceptions of them or - convert values to values recognized by XMLRPC. You can disable it by passing (({nil})) as parameter + convert values to values recognized by XMLRPC. You can disable it by passing (({nil})) as parameter ((|handler|)) . The service-hook is called with a (({Proc})) object and with the parameters for this (({Proc})). @@ -132,7 +132,7 @@ the same class. server.set_service_hook {|obj, *args| begin ret = obj.call(*args) # call the original service-method - # could convert the return value + # could convert the return value resuce # rescue exceptions end @@ -157,7 +157,7 @@ class BasicServer include ParserWriterChooseMixin include ParseContentType - ERR_METHOD_MISSING = 1 + ERR_METHOD_MISSING = 1 ERR_UNCAUGHT_EXCEPTION = 2 ERR_MC_WRONG_PARAM = 3 ERR_MC_MISSING_PARAMS = 4 @@ -169,7 +169,7 @@ class BasicServer def initialize(class_delim=".") @handler = [] - @default_handler = nil + @default_handler = nil @service_hook = nil @class_delim = class_delim @@ -183,7 +183,7 @@ class BasicServer def add_handler(prefix, obj_or_signature=nil, help=nil, &block) if block_given? # proc-handler - @handler << [prefix, block, obj_or_signature, help] + @handler << [prefix, block, obj_or_signature, help] else if prefix.kind_of? String # class-handler @@ -208,7 +208,7 @@ class BasicServer @service_hook = handler self end - + def get_default_handler @default_handler end @@ -216,18 +216,18 @@ class BasicServer def set_default_handler (&handler) @default_handler = handler self - end + end def add_multicall add_handler("system.multicall", %w(array array), "Multicall Extension") do |arrStructs| - unless arrStructs.is_a? Array + unless arrStructs.is_a? Array raise XMLRPC::FaultException.new(ERR_MC_WRONG_PARAM, "system.multicall expects an array") end arrStructs.collect {|call| if call.is_a? Hash methodName = call["methodName"] - params = call["params"] + params = call["params"] if params.nil? multicall_fault(ERR_MC_MISSING_PARAMS, "Missing params") @@ -246,16 +246,16 @@ class BasicServer [val] else # exception - multicall_fault(val.faultCode, val.faultString) + multicall_fault(val.faultCode, val.faultString) end end end - end - + end + else multicall_fault(ERR_MC_EXPECTED_STRUCT, "system.multicall expected struct") end - } + } end # end add_handler self end @@ -284,7 +284,7 @@ class BasicServer sig.each {|s| sigs << s} else # sig is a single signature, e.g. ["array"] - sigs << sig + sigs << sig end end end @@ -292,11 +292,11 @@ class BasicServer end add_handler("system.methodHelp", %w(string string), "Returns help on using this method") do |meth| - help = nil + help = nil @handler.each do |name, obj, sig, hlp| - if obj.kind_of? Proc and name == meth + if obj.kind_of? Proc and name == meth help = hlp - break + break end end help || "" @@ -306,18 +306,18 @@ class BasicServer end - + def process(data) - method, params = parser().parseMethodCall(data) + method, params = parser().parseMethodCall(data) handle(method, *params) end - + private # -------------------------------------------------------------- def multicall_fault(nr, str) {"faultCode" => nr, "faultString" => str} end - + # # method dispatch # @@ -333,17 +333,17 @@ class BasicServer if check_arity(obj, args.size) if @service_hook.nil? - return obj.call(*args) + return obj.call(*args) else return @service_hook.call(obj, *args) end end - end - + end + if @default_handler.nil? raise XMLRPC::FaultException.new(ERR_METHOD_MISSING, "Method #{methodname} missing or wrong number of parameters!") else - @default_handler.call(methodname, *args) + @default_handler.call(methodname, *args) end end @@ -357,7 +357,7 @@ class BasicServer if ary >= 0 n_args == ary else - n_args >= (ary+1).abs + n_args >= (ary+1).abs end end @@ -366,8 +366,8 @@ class BasicServer def call_method(methodname, *args) begin [true, dispatch(methodname, *args)] - rescue XMLRPC::FaultException => e - [false, e] + rescue XMLRPC::FaultException => e + [false, e] rescue Exception => e [false, XMLRPC::FaultException.new(ERR_UNCAUGHT_EXCEPTION, "Uncaught exception #{e.message} in method #{methodname}")] end @@ -388,8 +388,8 @@ end = XMLRPC::CGIServer == Synopsis require "xmlrpc/server" - - s = XMLRPC::CGIServer.new + + s = XMLRPC::CGIServer.new s.add_handler("michael.add") do |a,b| a + b @@ -399,15 +399,15 @@ end if b == 0 raise XMLRPC::FaultException.new(1, "division by zero") else - a / b + a / b end - end + end s.set_default_handler do |name, *args| raise XMLRPC::FaultException.new(-99, "Method #{name} missing" + " or wrong number of parameters!") end - + s.serve == Description @@ -419,7 +419,7 @@ Implements a CGI-based XML-RPC server. == Class Methods --- XMLRPC::CGIServer.new( *a ) Creates a new (({XMLRPC::CGIServer})) instance. All parameters given - are by-passed to ((<XMLRPC::BasicServer.new>)). You can only create + are by-passed to ((<XMLRPC::BasicServer.new>)). You can only create ((*one*)) (({XMLRPC::CGIServer})) instance, because more than one makes no sense. @@ -427,7 +427,7 @@ Implements a CGI-based XML-RPC server. --- XMLRPC::CGIServer#serve Call this after you have added all you handlers to the server. This method processes a XML-RPC methodCall and sends the answer - back to the client. + back to the client. Make sure that you don't write to standard-output in a handler, or in any other part of your program, this would case a CGI-based server to fail! =end @@ -443,14 +443,14 @@ class CGIServer < BasicServer def initialize(*a) super(*a) end - + def serve catch(:exit_serve) { length = ENV['CONTENT_LENGTH'].to_i - http_error(405, "Method Not Allowed") unless ENV['REQUEST_METHOD'] == "POST" + http_error(405, "Method Not Allowed") unless ENV['REQUEST_METHOD'] == "POST" http_error(400, "Bad Request") unless parse_content_type(ENV['CONTENT_TYPE']).first == "text/xml" - http_error(411, "Length Required") unless length > 0 + http_error(411, "Length Required") unless length > 0 # TODO: do we need a call to binmode? $stdin.binmode if $stdin.respond_to? :binmode @@ -467,7 +467,7 @@ class CGIServer < BasicServer def http_error(status, message) err = "#{status} #{message}" - msg = <<-"MSGEND" + msg = <<-"MSGEND" <html> <head> <title>#{err}</title> @@ -487,7 +487,7 @@ class CGIServer < BasicServer h = {} header.each {|key, value| h[key.to_s.capitalize] = value} h['Status'] ||= "200 OK" - h['Content-length'] ||= body.size.to_s + h['Content-length'] ||= body.size.to_s str = "" h.each {|key, value| str << "#{key}: #{value}\r\n"} @@ -507,7 +507,7 @@ Use it in the same way as CGIServer! == Superclass ((<XMLRPC::BasicServer>)) -=end +=end class ModRubyServer < BasicServer @@ -523,9 +523,9 @@ class ModRubyServer < BasicServer length = header['Content-length'].to_i - http_error(405, "Method Not Allowed") unless @ap.request_method == "POST" + http_error(405, "Method Not Allowed") unless @ap.request_method == "POST" http_error(400, "Bad Request") unless parse_content_type(header['Content-type']).first == "text/xml" - http_error(411, "Length Required") unless length > 0 + http_error(411, "Length Required") unless length > 0 # TODO: do we need a call to binmode? @ap.binmode @@ -542,7 +542,7 @@ class ModRubyServer < BasicServer def http_error(status, message) err = "#{status} #{message}" - msg = <<-"MSGEND" + msg = <<-"MSGEND" <html> <head> <title>#{err}</title> @@ -562,12 +562,12 @@ class ModRubyServer < BasicServer h = {} header.each {|key, value| h[key.to_s.capitalize] = value} h['Status'] ||= "200 OK" - h['Content-length'] ||= body.size.to_s + h['Content-length'] ||= body.size.to_s h.each {|key, value| @ap.headers_out[key] = value } - @ap.content_type = h["Content-type"] - @ap.status = status.to_i - @ap.send_http_header + @ap.content_type = h["Content-type"] + @ap.status = status.to_i + @ap.send_http_header @ap.print body end @@ -578,8 +578,8 @@ end = XMLRPC::Server == Synopsis require "xmlrpc/server" - - s = XMLRPC::Server.new(8080) + + s = XMLRPC::Server.new(8080) s.add_handler("michael.add") do |a,b| a + b @@ -589,15 +589,15 @@ end if b == 0 raise XMLRPC::FaultException.new(1, "division by zero") else - a / b + a / b end - end + end s.set_default_handler do |name, *args| raise XMLRPC::FaultException.new(-99, "Method #{name} missing" + " or wrong number of parameters!") end - + s.serve == Description @@ -610,13 +610,13 @@ program. == Class Methods --- XMLRPC::Server.new( port=8080, host="127.0.0.1", maxConnections=4, stdlog=$stdout, audit=true, debug=true, *a ) Creates a new (({XMLRPC::Server})) instance, which is a XML-RPC server listening on - port ((|port|)) and accepts requests for the host ((|host|)), which is by default only the localhost. + port ((|port|)) and accepts requests for the host ((|host|)), which is by default only the localhost. The server is not started, to start it you have to call ((<serve|XMLRPC::Server#serve>)). Parameters ((|audit|)) and ((|debug|)) are obsolete! - All additionally given parameters in ((|*a|)) are by-passed to ((<XMLRPC::BasicServer.new>)). - + All additionally given parameters in ((|*a|)) are by-passed to ((<XMLRPC::BasicServer.new>)). + == Instance Methods --- XMLRPC::Server#serve Call this after you have added all you handlers to the server. @@ -624,7 +624,7 @@ program. --- XMLRPC::Server#shutdown Stops and shuts the server down. - + =end class WEBrickServlet < BasicServer; end # forward declaration @@ -634,22 +634,22 @@ class Server < WEBrickServlet def initialize(port=8080, host="127.0.0.1", maxConnections=4, stdlog=$stdout, audit=true, debug=true, *a) super(*a) require 'webrick' - @server = WEBrick::HTTPServer.new(:Port => port, :BindAddress => host, :MaxClients => maxConnections, + @server = WEBrick::HTTPServer.new(:Port => port, :BindAddress => host, :MaxClients => maxConnections, :Logger => WEBrick::Log.new(stdlog)) @server.mount("/", self) end - + def serve signals = %w[INT TERM HUP] & Signal.list.keys signals.each { |signal| trap(signal) { @server.shutdown } } @server.start end - + def shutdown @server.shutdown end - + end =begin @@ -668,16 +668,16 @@ end if b == 0 raise XMLRPC::FaultException.new(1, "division by zero") else - a / b + a / b end - end + end s.set_default_handler do |name, *args| raise XMLRPC::FaultException.new(-99, "Method #{name} missing" + " or wrong number of parameters!") end - httpserver = WEBrick::HTTPServer.new(:Port => 8080) + httpserver = WEBrick::HTTPServer.new(:Port => 8080) httpserver.mount("/RPC2", s) trap("HUP") { httpserver.shutdown } # use 1 instead of "HUP" on Windows httpserver.start @@ -691,7 +691,7 @@ end --- XMLRPC::WEBrickServlet#get_valid_ip Return the via method ((<set_valid_ip|XMLRPC::Server#set_valid_ip>)) specified valid IP addresses. - + == Description Implements a servlet for use with WEBrick, a pure Ruby (HTTP-) server framework. @@ -707,10 +707,10 @@ class WEBrickServlet < BasicServer @valid_ip = nil end - # deprecated from WEBrick/1.2.2. + # deprecated from WEBrick/1.2.2. # but does not break anything. def require_path_info? - false + false end def get_instance(config, *options) @@ -732,7 +732,7 @@ class WEBrickServlet < BasicServer def service(request, response) - if @valid_ip + if @valid_ip raise WEBrick::HTTPStatus::Forbidden unless @valid_ip.any? { |ip| request.peeraddr[3] =~ ip } end @@ -741,9 +741,9 @@ class WEBrickServlet < BasicServer "unsupported method `#{request.request_method}'." end - if parse_content_type(request['Content-type']).first != "text/xml" + if parse_content_type(request['Content-type']).first != "text/xml" raise WEBrick::HTTPStatus::BadRequest - end + end length = (request['Content-length'] || 0).to_i @@ -756,14 +756,14 @@ class WEBrickServlet < BasicServer end resp = process(data) - if resp.nil? or resp.size <= 0 + if resp.nil? or resp.size <= 0 raise WEBrick::HTTPStatus::InternalServerError end response.status = 200 response['Content-Length'] = resp.size response['Content-Type'] = "text/xml; charset=utf-8" - response.body = resp + response.body = resp end end @@ -773,6 +773,6 @@ end # module XMLRPC =begin = History - $Id$ + $Id$ =end diff --git a/lib/xmlrpc/utils.rb b/lib/xmlrpc/utils.rb index 4c2b63c9c6..60d4ef5d99 100644 --- a/lib/xmlrpc/utils.rb +++ b/lib/xmlrpc/utils.rb @@ -1,12 +1,12 @@ # # Defines ParserWriterChooseMixin, which makes it possible to choose a # different XML writer and/or XML parser then the default one. -# The Mixin is used in client.rb (class Client) and server.rb (class +# The Mixin is used in client.rb (class Client) and server.rb (class # BasicServer) -# +# # Copyright (C) 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de) # -# $Id$ +# $Id$ # module XMLRPC @@ -15,7 +15,7 @@ module XMLRPC # This module enables a user-class to be marshalled # by XML-RPC for Ruby into a Hash, with one additional # key/value pair "___class___" => ClassName - # + # module Marshallable end @@ -72,9 +72,9 @@ module XMLRPC mname = nil sig = [sig] if sig.kind_of? String - sig = sig.collect do |s| + sig = sig.collect do |s| name, si = parse_sig(s) - raise "Wrong signatures!" if mname != nil and name != mname + raise "Wrong signatures!" if mname != nil and name != mname mname = name si end @@ -83,12 +83,12 @@ module XMLRPC end private # --------------------------------- - + def parse_sig(sig) # sig is a String if sig =~ /^\s*(\w+)\s+([^(]+)(\(([^)]*)\))?\s*$/ params = [$1] - name = $2.strip + name = $2.strip $4.split(",").each {|i| params << i.strip} if $4 != nil return name, params else @@ -109,10 +109,10 @@ module XMLRPC instance_eval(&p) end - def get_methods(obj, delim=".") + def get_methods(obj, delim=".") prefix = @prefix + delim - @methods.collect { |name, meth, sig, help| - [prefix + name, obj.method(meth).to_proc, sig, help] + @methods.collect { |name, meth, sig, help| + [prefix + name, obj.method(meth).to_proc, sig, help] } end @@ -132,7 +132,7 @@ module XMLRPC def get_methods(obj, delim=".") prefix = @prefix + delim obj.class.public_instance_methods(false).collect { |name| - [prefix + name, obj.method(name).to_proc, nil, nil] + [prefix + name, obj.method(name).to_proc, nil, nil] } end end @@ -141,16 +141,16 @@ module XMLRPC end # module Service - # + # # short-form to create a Service::Interface # def self.interface(prefix, &p) - Service::Interface.new(prefix, &p) + Service::Interface.new(prefix, &p) end # short-cut for creating a PublicInstanceMethodsInterface def self.iPIMethods(prefix) - Service::PublicInstanceMethodsInterface.new(prefix) + Service::PublicInstanceMethodsInterface.new(prefix) end diff --git a/lib/yaml.rb b/lib/yaml.rb index 12853401c1..0c95b7e82c 100644 --- a/lib/yaml.rb +++ b/lib/yaml.rb @@ -4,7 +4,7 @@ # = yaml.rb: top-level module with methods for loading and parsing YAML documents # # Author:: why the lucky stiff -# +# require 'stringio' require 'yaml/error' @@ -24,18 +24,18 @@ require 'yaml/constants' # serialization format. Together with the Unicode standard for characters, it # provides all the information necessary to understand YAML Version 1.0 # and construct computer programs to process it. -# +# # See http://yaml.org/ for more information. For a quick tutorial, please # visit YAML In Five Minutes (http://yaml.kwiki.org/?YamlInFiveMinutes). -# +# # == About This Library -# +# # The YAML 1.0 specification outlines four stages of YAML loading and dumping. # This library honors all four of those stages, although data is really only # available to you in three stages. -# +# # The four stages are: native, representation, serialization, and presentation. -# +# # The native stage refers to data which has been loaded completely into Ruby's # own types. (See +YAML::load+.) # @@ -43,14 +43,14 @@ require 'yaml/constants' # +YAML::BaseNode+ objects. In this stage, the document is available as a # tree of node objects. You can perform YPath queries and transformations # at this level. (See +YAML::parse+.) -# +# # The serialization stage happens inside the parser. The YAML parser used in # Ruby is called Syck. Serialized nodes are available in the extension as # SyckNode structs. -# +# # The presentation stage is the YAML document itself. This is accessible # to you as a string. (See +YAML::dump+.) -# +# # For more information about the various information models, see Chapter # 3 of the YAML 1.0 Specification (http://yaml.org/spec/#id2491269). # @@ -102,7 +102,7 @@ module YAML # # Converts _obj_ to YAML and writes the YAML result to _io_. - # + # # File.open( 'animals.yaml', 'w' ) do |out| # YAML.dump( ['badger', 'elephant', 'tiger'], out ) # end @@ -168,8 +168,8 @@ module YAML # Can also load from a string. # # YAML.parse( "--- :locked" ) - # #=> #<YAML::Syck::Node:0x82edddc - # @type_id="tag:ruby.yaml.org,2002:sym", + # #=> #<YAML::Syck::Node:0x82edddc + # @type_id="tag:ruby.yaml.org,2002:sym", # @value=":locked", @kind=:scalar> # def YAML.parse( io ) @@ -263,7 +263,7 @@ module YAML end # - # Loads all documents from the current _io_ stream, + # Loads all documents from the current _io_ stream, # returning a +YAML::Stream+ object containing all # loaded documents. # @@ -271,7 +271,7 @@ module YAML d = nil parser.load_documents( io ) do |doc| d = YAML::Stream.new if not d - d.add( doc ) + d.add( doc ) end return d end @@ -288,7 +288,7 @@ module YAML def YAML.dump_stream( *objs ) d = YAML::Stream.new objs.each do |doc| - d.add( doc ) + d.add( doc ) end d.emit end @@ -378,7 +378,7 @@ module YAML # Allocate an Emitter if needed # def YAML.quick_emit( oid, opts = {}, &e ) - out = + out = if opts.is_a? YAML::Emitter opts else @@ -390,7 +390,7 @@ module YAML end out.emit( oid, &e ) end - + end require 'yaml/rubytypes' @@ -422,7 +422,7 @@ module Kernel # # _produces:_ # - # --- !ruby/struct:S + # --- !ruby/struct:S # name: dave # state: TX # diff --git a/lib/yaml/baseemitter.rb b/lib/yaml/baseemitter.rb index 4bdc796cbf..59d9eddc76 100644 --- a/lib/yaml/baseemitter.rb +++ b/lib/yaml/baseemitter.rb @@ -42,7 +42,7 @@ module YAML '|' else '>' - end + end indt = $&.to_i if block =~ /\d+/ if valx =~ /(\A\n*[ \t#]|^---\s+)/ indt = options(:Indent) unless indt.to_i > 0 @@ -64,8 +64,8 @@ module YAML valx = fold( YAML::escape( valx, esc_skip ) + "\"" ).chomp self << '"' + indent_text( valx, indt, false ) else - if block[0] == ?> - valx = fold( valx ) + if block[0] == ?> + valx = fold( valx ) end #p [block, indt] self << block + indent_text( valx, indt ) @@ -84,7 +84,7 @@ module YAML # Emit double-quoted string # def double( value ) - "\"#{YAML.escape( value )}\"" + "\"#{YAML.escape( value )}\"" end # @@ -150,8 +150,8 @@ module YAML @seq_map = false else # FIXME - # if @buffer.length == 1 and options(:UseHeader) == false and type.length.zero? - # @headless = 1 + # if @buffer.length == 1 and options(:UseHeader) == false and type.length.zero? + # @headless = 1 # end defkey = @options.delete( :DefaultKey ) @@ -174,7 +174,7 @@ module YAML self << "\n" indent! end - self << ": " + self << ": " v[1].to_yaml( :Emitter => self ) } end @@ -187,7 +187,7 @@ module YAML # @seq_map = false # else self << "\n" - indent! + indent! # end end @@ -207,8 +207,8 @@ module YAML self << "[]" else # FIXME - # if @buffer.length == 1 and options(:UseHeader) == false and type.length.zero? - # @headless = 1 + # if @buffer.length == 1 and options(:UseHeader) == false and type.length.zero? + # @headless = 1 # end # diff --git a/lib/yaml/constants.rb b/lib/yaml/constants.rb index fb833d3077..728d3b7932 100644 --- a/lib/yaml/constants.rb +++ b/lib/yaml/constants.rb @@ -13,7 +13,7 @@ module YAML # Parser tokens # WORD_CHAR = 'A-Za-z0-9' - PRINTABLE_CHAR = '-_A-Za-z0-9!?/()$\'". ' + PRINTABLE_CHAR = '-_A-Za-z0-9!?/()$\'". ' NOT_PLAIN_CHAR = '\x7f\x0-\x1f\x80-\x9f' ESCAPE_CHAR = '[\\x00-\\x09\\x0b-\\x1f]' INDICATOR_CHAR = '*&!|\\\\^@%{}[]=' @@ -27,7 +27,7 @@ module YAML \x18 \x19 \x1a \e \x1c \x1d \x1e \x1f } UNESCAPES = { - 'a' => "\x07", 'b' => "\x08", 't' => "\x09", + 'a' => "\x07", 'b' => "\x08", 't' => "\x09", 'n' => "\x0a", 'v' => "\x0b", 'f' => "\x0c", 'r' => "\x0d", 'e' => "\x1b", '\\' => '\\', } diff --git a/lib/yaml/dbm.rb b/lib/yaml/dbm.rb index 87d6009250..a28fd04f19 100644 --- a/lib/yaml/dbm.rb +++ b/lib/yaml/dbm.rb @@ -35,14 +35,14 @@ class DBM < ::DBM def delete( key ) v = super( key ) if String === v - v = YAML::load( v ) + v = YAML::load( v ) end v end def delete_if del_keys = keys.dup del_keys.delete_if { |k| yield( k, fetch( k ) ) == false } - del_keys.each { |k| delete( k ) } + del_keys.each { |k| delete( k ) } self end def reject diff --git a/lib/yaml/encoding.rb b/lib/yaml/encoding.rb index 57dc553606..98e83c3853 100644 --- a/lib/yaml/encoding.rb +++ b/lib/yaml/encoding.rb @@ -23,9 +23,9 @@ module YAML if $3 ["#$3".hex ].pack('U*') elsif $2 - [$2].pack( "H2" ) + [$2].pack( "H2" ) else - UNESCAPES[$1] + UNESCAPES[$1] end } end diff --git a/lib/yaml/error.rb b/lib/yaml/error.rb index 15865a9aa9..75de0ec18a 100644 --- a/lib/yaml/error.rb +++ b/lib/yaml/error.rb @@ -26,7 +26,7 @@ module YAML # # YAML Error classes # - + class Error < StandardError; end class ParseError < Error; end class TypeError < StandardError; end diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb index ae65b355e1..b2745b4542 100644 --- a/lib/yaml/rubytypes.rb +++ b/lib/yaml/rubytypes.rb @@ -64,7 +64,7 @@ class Struct end if not struct_type struct_def = [ tag.split( ':', 4 ).last ] - struct_type = Struct.new( *struct_def.concat( val.keys.collect { |k| k.intern } ) ) + struct_type = Struct.new( *struct_def.concat( val.keys.collect { |k| k.intern } ) ) end # @@ -317,7 +317,7 @@ class Time utc_same_instant = self.dup.utc utc_same_writing = Time.utc(year,month,day,hour,min,sec,usec) difference_to_utc = utc_same_writing - utc_same_instant - if (difference_to_utc < 0) + if (difference_to_utc < 0) difference_sign = '-' absolute_difference = -difference_to_utc else @@ -388,9 +388,9 @@ class Rational Rational( val['numerator'], val['denominator'] ) end end - def to_yaml( opts = {} ) + def to_yaml( opts = {} ) YAML::quick_emit( self, opts ) do |out| - out.map( taguri, nil ) do |map| + out.map( taguri, nil ) do |map| map.add( 'denominator', denominator ) map.add( 'numerator', numerator ) end @@ -435,7 +435,7 @@ class FalseClass end end -class NilClass +class NilClass yaml_as "tag:yaml.org,2002:null" def to_yaml( opts = {} ) YAML::quick_emit( nil, opts ) do |out| diff --git a/lib/yaml/stream.rb b/lib/yaml/stream.rb index 060fbc4200..651a1bbbef 100644 --- a/lib/yaml/stream.rb +++ b/lib/yaml/stream.rb @@ -11,7 +11,7 @@ module YAML @options = opts @documents = [] end - + def []( i ) @documents[ i ] end diff --git a/lib/yaml/stringio.rb b/lib/yaml/stringio.rb index 8ad949fa2b..b0fda19e28 100644 --- a/lib/yaml/stringio.rb +++ b/lib/yaml/stringio.rb @@ -13,7 +13,7 @@ rescue LoadError end def pos @pos - end + end def eof @eof end diff --git a/lib/yaml/tag.rb b/lib/yaml/tag.rb index 0fb6bef9a0..add3c49894 100644 --- a/lib/yaml/tag.rb +++ b/lib/yaml/tag.rb @@ -4,13 +4,13 @@ # = yaml/tag.rb: methods for associating a taguri to a class. # # Author:: why the lucky stiff -# +# module YAML # A dictionary of taguris which map to # Ruby classes. @@tagged_classes = {} - - # + + # # Associates a taguri _tag_ with a Ruby class _cls_. The taguri is used to give types # to classes when loading YAML. Taguris are of the form: # @@ -19,7 +19,7 @@ module YAML # The +authorityName+ is a domain name or email address. The +date+ is the date the type # was issued in YYYY or YYYY-MM or YYYY-MM-DD format. The +specific+ is a name for # the type being added. - # + # # For example, built-in YAML types have 'yaml.org' as the +authorityName+ and '2002' as the # +date+. The +specific+ is simply the name of the type: # diff --git a/lib/yaml/types.rb b/lib/yaml/types.rb index 3871c628fe..60aebc0481 100644 --- a/lib/yaml/types.rb +++ b/lib/yaml/types.rb @@ -58,7 +58,7 @@ module YAML # # YAML Hash class to support comments and defaults # - class SpecialHash < ::Hash + class SpecialHash < ::Hash attr_accessor :default def inspect self.default.to_s @@ -112,7 +112,7 @@ module YAML if ( tmp = self.assoc( k ) ) and not set tmp[1] = val else - self << [ k, val ] + self << [ k, val ] end val end @@ -163,7 +163,7 @@ module YAML self.assoc( k ).to_a end def []=( k, val ) - self << [ k, val ] + self << [ k, val ] val end def has_key?( k ) diff --git a/test/cgi/test_cgi_core.rb b/test/cgi/test_cgi_core.rb index fa86cf14cd..3f75b04fd4 100644 --- a/test/cgi/test_cgi_core.rb +++ b/test/cgi/test_cgi_core.rb @@ -135,7 +135,7 @@ class CGICoreTest < Test::Unit::TestCase assert_equal({"str"=>"\xBE\xBE\xB9\xBE".force_encoding("UTF-8")},hash) $stdin.rewind - assert_raise(CGI::InvalidEncoding) do + assert_raise(CGI::InvalidEncoding) do cgi = CGI.new(:accept_charset=>"UTF-8") end diff --git a/test/cgi/test_cgi_tag_helper.rb b/test/cgi/test_cgi_tag_helper.rb index 6e726b93a3..29306578b0 100644 --- a/test/cgi/test_cgi_tag_helper.rb +++ b/test/cgi/test_cgi_tag_helper.rb @@ -326,7 +326,7 @@ class CGITagHelperTest < Test::Unit::TestCase assert_match(/^<INPUT .*NAME="foo".*>bb<INPUT .*NAME="foo".*>dd$/,str) end end - + =begin def test_cgi_tag_helper_html4 ## html4 diff --git a/test/csv/test_csv_parsing.rb b/test/csv/test_csv_parsing.rb index e391687537..a9e6cd400c 100644 --- a/test/csv/test_csv_parsing.rb +++ b/test/csv/test_csv_parsing.rb @@ -12,22 +12,22 @@ require "timeout" require "csv" -# -# Following tests are my interpretation of the -# {CSV RCF}[http://www.ietf.org/rfc/rfc4180.txt]. I only deviate from that +# +# Following tests are my interpretation of the +# {CSV RCF}[http://www.ietf.org/rfc/rfc4180.txt]. I only deviate from that # document in one place (intentionally) and that is to make the default row # separator <tt>$/</tt>. -# +# class TestCSVParsing < Test::Unit::TestCase BIG_DATA = "123456789\n" * 1024 - + def test_mastering_regex_example ex = %Q{Ten Thousand,10000, 2710 ,,"10,000","It's ""10 Grand"", baby",10K} assert_equal( [ "Ten Thousand", "10000", " 2710 ", nil, "10,000", "It's \"10 Grand\", baby", "10K" ], CSV.parse_line(ex) ) end - + # Old Ruby 1.8 CSV library tests. def test_std_lib_csv [ ["\t", ["\t"]], @@ -79,7 +79,7 @@ class TestCSVParsing < Test::Unit::TestCase assert_equal(csv_test.last, CSV.parse_line(csv_test.first)) end end - + # From: http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/6496 def test_aras_edge_cases [ [%Q{a,b}, ["a", "b"]], @@ -102,35 +102,35 @@ class TestCSVParsing < Test::Unit::TestCase assert_equal(edge_case.last, CSV.parse_line(edge_case.first)) end end - + def test_james_edge_cases # A read at eof? should return nil. assert_equal(nil, CSV.parse_line("")) - # + # # With Ruby 1.8 CSV it's impossible to tell an empty line from a line # containing a single +nil+ field. The old CSV library returns # <tt>[nil]</tt> in these cases, but <tt>Array.new</tt> makes more sense to # me. - # + # assert_equal(Array.new, CSV.parse_line("\n1,2,3\n")) end - + def test_malformed_csv assert_raise(CSV::MalformedCSVError) do CSV.parse_line("1,2\r,3", row_sep: "\n") end - + bad_data = <<-END_DATA.gsub(/^ +/, "") line,1,abc line,2,"def\nghi" - + line,4,some\rjunk line,5,jkl END_DATA lines = bad_data.lines.to_a assert_equal(6, lines.size) assert_match(/\Aline,4/, lines.find { |l| l =~ /some\rjunk/ }) - + csv = CSV.new(bad_data) begin loop do @@ -141,20 +141,20 @@ class TestCSVParsing < Test::Unit::TestCase assert_equal( "Unquoted fields do not allow \\r or \\n (line 4).", $!.message ) end - + assert_raise(CSV::MalformedCSVError) { CSV.parse_line('1,2,"3...') } - + bad_data = <<-END_DATA.gsub(/^ +/, "") line,1,abc line,2,"def\nghi" - + line,4,8'10" line,5,jkl END_DATA lines = bad_data.lines.to_a assert_equal(6, lines.size) assert_match(/\Aline,4/, lines.find { |l| l =~ /8'10"/ }) - + csv = CSV.new(bad_data) begin loop do @@ -165,22 +165,22 @@ class TestCSVParsing < Test::Unit::TestCase assert_equal("Illegal quoting on line 4.", $!.message) end end - + def test_the_parse_fails_fast_when_it_can_for_unquoted_fields assert_parse_errors_out('valid,fields,bad start"' + BIG_DATA) end - + def test_the_parse_fails_fast_when_it_can_for_unescaped_quotes assert_parse_errors_out('valid,fields,"bad start"unescaped' + BIG_DATA) end - + def test_field_size_limit_controls_lookahead assert_parse_errors_out( 'valid,fields,"' + BIG_DATA + '"', field_size_limit: 2048 ) end - + private - + def assert_parse_errors_out(*args) assert_raise(CSV::MalformedCSVError) do Timeout.timeout(0.2) do diff --git a/test/csv/test_csv_writing.rb b/test/csv/test_csv_writing.rb index 98e41fe9c4..eacba49613 100644 --- a/test/csv/test_csv_writing.rb +++ b/test/csv/test_csv_writing.rb @@ -76,19 +76,19 @@ class TestCSVWriting < Test::Unit::TestCase assert_equal(test_case.first + $/, CSV.generate_line(test_case.last)) end end - + def test_col_sep assert_equal( "a;b;;c\n", CSV.generate_line( ["a", "b", nil, "c"], col_sep: ";" ) ) assert_equal( "a\tb\t\tc\n", CSV.generate_line( ["a", "b", nil, "c"], col_sep: "\t" ) ) end - + def test_row_sep assert_equal( "a,b,,c\r\n", CSV.generate_line( ["a", "b", nil, "c"], row_sep: "\r\n" ) ) end - + def test_force_quotes assert_equal( %Q{"1","b","","already ""quoted"""\n}, CSV.generate_line( [1, "b", nil, %Q{already "quoted"}], diff --git a/test/csv/test_data_converters.rb b/test/csv/test_data_converters.rb index 781450dc9e..1ad5093424 100644 --- a/test/csv/test_data_converters.rb +++ b/test/csv/test_data_converters.rb @@ -15,18 +15,18 @@ class TestDataConverters < Test::Unit::TestCase def setup @data = "Numbers,:integer,1,:float,3.015" @parser = CSV.new(@data) - + @custom = lambda { |field| field =~ /\A:(\S.*?)\s*\Z/ ? $1.to_sym : field } - + @win_safe_time_str = Time.now.strftime("%a %b %d %H:%M:%S %Y") end - + def test_builtin_integer_converter # does convert [-5, 1, 10000000000].each do |n| assert_equal(n, CSV::Converters[:integer][n.to_s]) end - + # does not convert (%w{junk 1.0} + [""]).each do |str| assert_equal(str, CSV::Converters[:integer][str]) @@ -38,7 +38,7 @@ class TestDataConverters < Test::Unit::TestCase [-5.1234, 0, 2.3e-11].each do |n| assert_equal(n, CSV::Converters[:float][n.to_s]) end - + # does not convert (%w{junk 1..0 .015F} + [""]).each do |str| assert_equal(str, CSV::Converters[:float][str]) @@ -64,43 +64,43 @@ class TestDataConverters < Test::Unit::TestCase # does not convert assert_instance_of(String, CSV::Converters[:date_time]["junk"]) end - + def test_convert_with_builtin # setup parser... assert(@parser.respond_to?(:convert)) assert_nothing_raised(Exception) { @parser.convert(:integer) } - + # and use assert_equal(["Numbers", ":integer", 1, ":float", "3.015"], @parser.shift) - + setup # reset - + # setup parser... assert_nothing_raised(Exception) { @parser.convert(:float) } - + # and use assert_equal(["Numbers", ":integer", 1.0, ":float", 3.015], @parser.shift) end - + def test_convert_order # floats first, then integers... - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do @parser.convert(:float) @parser.convert(:integer) end - + # gets us nothing but floats assert_equal( [String, String, Float, String, Float], @parser.shift.map { |field| field.class } ) - + setup # reset # integers have precendance... - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do @parser.convert(:integer) @parser.convert(:float) end - + # gives us proper number conversion assert_equal( [String, String, Fixnum, String, Float], @parser.shift.map { |field| field.class } ) @@ -109,7 +109,7 @@ class TestDataConverters < Test::Unit::TestCase def test_builtin_numeric_combo_converter # setup parser... assert_nothing_raised(Exception) { @parser.convert(:numeric) } - + # and use assert_equal( [String, String, Fixnum, String, Float], @parser.shift.map { |field| field.class } ) @@ -120,18 +120,18 @@ class TestDataConverters < Test::Unit::TestCase @data << ",#{@win_safe_time_str}" # add a DateTime field @parser = CSV.new(@data) # reset parser assert_nothing_raised(Exception) { @parser.convert(:all) } - + # and use assert_equal( [String, String, Fixnum, String, Float, DateTime], @parser.shift.map { |field| field.class } ) end - + def test_convert_with_custom_code # define custom converter... assert_nothing_raised(Exception) do @parser.convert { |field| field =~ /\A:(\S.*?)\s*\Z/ ? $1.to_sym : field } end - + # and use assert_equal(["Numbers", :integer, "1", :float, "3.015"], @parser.shift) @@ -140,11 +140,11 @@ class TestDataConverters < Test::Unit::TestCase # mix built-in and custom... assert_nothing_raised(Exception) { @parser.convert(:numeric) } assert_nothing_raised(Exception) { @parser.convert(&@custom) } - + # and use assert_equal(["Numbers", :integer, 1, :float, 3.015], @parser.shift) end - + def test_convert_with_custom_code_using_field_info # define custom converter that uses field information... assert_nothing_raised(Exception) do @@ -153,26 +153,26 @@ class TestDataConverters < Test::Unit::TestCase info.index == 4 ? Float(field).floor : field end end - + # and use assert_equal(["Numbers", ":integer", "1", ":float", 3], @parser.shift) end - + def test_convert_with_custom_code_using_field_info_header @parser = CSV.new(@data, headers: %w{one two three four five}) - + # define custom converter that uses field header information... assert_nothing_raised(Exception) do @parser.convert do |field, info| info.header == "three" ? Integer(field) * 100 : field end end - + # and use assert_equal( ["Numbers", ":integer", 100, ":float", "3.015"], @parser.shift.fields ) end - + def test_shortcut_interface assert_equal( ["Numbers", ":integer", 1, ":float", 3.015], CSV.parse_line(@data, converters: :numeric) ) @@ -183,14 +183,14 @@ class TestDataConverters < Test::Unit::TestCase assert_equal( ["Numbers", :integer, 1, :float, 3.015], CSV.parse_line(@data, converters: [:numeric, @custom]) ) end - + def test_unconverted_fields [ [ @data, ["Numbers", :integer, 1, :float, 3.015], %w{Numbers :integer 1 :float 3.015} ], ["\n", Array.new, Array.new] ].each do |test, fields, unconverted| row = nil - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do row = CSV.parse_line( test, converters: [:numeric, @custom], unconverted_fields: true ) @@ -206,7 +206,7 @@ class TestDataConverters < Test::Unit::TestCase 1,2,3 END_CSV row = nil - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do row = CSV.parse_line( data, converters: :numeric, unconverted_fields: true, @@ -217,7 +217,7 @@ class TestDataConverters < Test::Unit::TestCase assert_respond_to(row, :unconverted_fields) assert_equal(%w{1 2 3}, row.unconverted_fields) - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do row = CSV.parse_line( data, converters: :numeric, unconverted_fields: true, @@ -230,7 +230,7 @@ class TestDataConverters < Test::Unit::TestCase assert_respond_to(row, :unconverted_fields) assert_equal(%w{first second third}, row.unconverted_fields) - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do row = CSV.parse_line( data, converters: :numeric, unconverted_fields: true, @@ -244,7 +244,7 @@ class TestDataConverters < Test::Unit::TestCase assert_respond_to(row, :unconverted_fields) assert_equal(%w{first second third}, row.unconverted_fields) - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do row = CSV.parse_line( data, converters: :numeric, unconverted_fields: true, diff --git a/test/csv/test_encodings.rb b/test/csv/test_encodings.rb index 0a300af291..63f7207c29 100644 --- a/test/csv/test_encodings.rb +++ b/test/csv/test_encodings.rb @@ -15,43 +15,43 @@ class TestEncodings < Test::Unit::TestCase def setup @temp_csv_path = File.join(File.dirname(__FILE__), "temp.csv") end - + def teardown File.unlink(@temp_csv_path) if File.exist? @temp_csv_path end - + ######################################## ### Hand Test Some Popular Encodings ### ######################################## - + def test_parses_utf8_encoding assert_parses( [ %w[ one two … ], %w[ 1 … 3 ], %w[ … 5 6 ] ], "UTF-8" ) end - + def test_parses_latin1_encoding assert_parses( [ %w[ one two Résumé ], %w[ 1 Résumé 3 ], %w[ Résumé 5 6 ] ], "ISO-8859-1" ) end - + def test_parses_utf16be_encoding assert_parses( [ %w[ one two … ], %w[ 1 … 3 ], %w[ … 5 6 ] ], "UTF-16BE" ) end - + def test_parses_shift_jis_encoding assert_parses( [ %w[ 一 二 三 ], %w[ å›› 五 å… ], %w[ 七 å…« ä¹ ] ], "Shift_JIS" ) end - + ########################################################### ### Try Simple Reading for All Non-dummy Ruby Encodings ### ########################################################### - + def test_reading_with_most_encodings each_encoding do |encoding| begin @@ -62,7 +62,7 @@ class TestEncodings < Test::Unit::TestCase end end end - + def test_regular_expression_escaping each_encoding do |encoding| begin @@ -73,18 +73,18 @@ class TestEncodings < Test::Unit::TestCase end end end - + ####################################################################### ### Stress Test ASCII Compatible and Non-ASCII Compatible Encodings ### ####################################################################### - + def test_auto_line_ending_detection # arrange data to place a \r at the end of CSV's read ahead point encode_for_tests([["a" * 509]], row_sep: "\r\n") do |data| assert_equal("\r\n".encode(data.encoding), CSV.new(data).row_sep) end end - + def test_csv_chars_are_transcoded encode_for_tests([%w[abc def]]) do |data| %w[col_sep row_sep quote_char].each do |csv_char| @@ -93,7 +93,7 @@ class TestEncodings < Test::Unit::TestCase end end end - + def test_parser_works_with_encoded_headers encode_for_tests([%w[one two three], %w[1 2 3]]) do |data| parsed = CSV.parse(data, headers: true) @@ -105,7 +105,7 @@ class TestEncodings < Test::Unit::TestCase end end end - + def test_built_in_converters_transcode_to_utf_8_then_convert encode_for_tests([%w[one two three], %w[1 2 3]]) do |data| parsed = CSV.parse(data, converters: :integer) @@ -114,7 +114,7 @@ class TestEncodings < Test::Unit::TestCase assert_equal([1, 2, 3], parsed[1]) end end - + def test_built_in_header_converters_transcode_to_utf_8_then_convert encode_for_tests([%w[one two three], %w[1 2 3]]) do |data| parsed = CSV.parse( data, headers: true, @@ -125,7 +125,7 @@ class TestEncodings < Test::Unit::TestCase "Wrong data encoding." ) end end - + def test_open_allows_you_to_set_encodings encode_for_tests([%w[abc def]]) do |data| # read and write in encoding @@ -136,7 +136,7 @@ class TestEncodings < Test::Unit::TestCase "Wrong data encoding." ) end end - + # read and write with transcoding File.open(@temp_csv_path, "wb:UTF-32BE:#{data.encoding.name}") do |f| f << data @@ -149,7 +149,7 @@ class TestEncodings < Test::Unit::TestCase end end end - + def test_foreach_allows_you_to_set_encodings encode_for_tests([%w[abc def]]) do |data| # read and write in encoding @@ -158,7 +158,7 @@ class TestEncodings < Test::Unit::TestCase assert( row.all? { |f| f.encoding == data.encoding }, "Wrong data encoding." ) end - + # read and write with transcoding File.open(@temp_csv_path, "wb:UTF-32BE:#{data.encoding.name}") do |f| f << data @@ -170,7 +170,7 @@ class TestEncodings < Test::Unit::TestCase end end end - + def test_read_allows_you_to_set_encodings encode_for_tests([%w[abc def]]) do |data| # read and write in encoding @@ -178,7 +178,7 @@ class TestEncodings < Test::Unit::TestCase rows = CSV.read(@temp_csv_path, encoding: data.encoding.name) assert( rows.flatten.all? { |f| f.encoding == data.encoding }, "Wrong data encoding." ) - + # read and write with transcoding File.open(@temp_csv_path, "wb:UTF-32BE:#{data.encoding.name}") do |f| f << data @@ -189,22 +189,22 @@ class TestEncodings < Test::Unit::TestCase "Wrong data encoding." ) end end - + ################################# ### Write CSV in any Encoding ### ################################# - + def test_can_write_csv_in_any_encoding each_encoding do |encoding| # test generate_line with encoding hint csv = %w[abc d|ef].map { |f| f.encode(encoding) }. to_csv(col_sep: "|", encoding: encoding.name) assert_equal(encoding, csv.encoding) - + # test generate_line with encoding guessing from fields csv = %w[abc d|ef].map { |f| f.encode(encoding) }.to_csv(col_sep: "|") assert_equal(encoding, csv.encoding) - + # writing to files data = encode_ary([%w[abc d,ef], %w[123 456 ]], encoding) CSV.open(@temp_csv_path, "wb:#{encoding.name}") do |f| @@ -213,9 +213,9 @@ class TestEncodings < Test::Unit::TestCase assert_equal(data, CSV.read(@temp_csv_path, encoding: encoding.name)) end end - + private - + def assert_parses(fields, encoding, options = { }) encoding = Encoding.find(encoding) unless encoding.is_a? Encoding fields = encode_ary(fields, encoding) @@ -225,11 +225,11 @@ class TestEncodings < Test::Unit::TestCase assert_equal(encoding, field.encoding, "Field[#{i + 1}] was transcoded.") end end - + def encode_ary(ary, encoding) ary.map { |row| row.map { |field| field.encode(encoding) } } end - + def ary_to_data(ary, options = { }) encoding = ary.flatten.first.encoding quote_char = (options[:quote_char] || '"').encode(encoding) @@ -241,12 +241,12 @@ class TestEncodings < Test::Unit::TestCase }.join(col_sep) + row_sep }.join.encode(encoding) end - + def encode_for_tests(data, options = { }) yield ary_to_data(encode_ary(data, "UTF-8"), options) yield ary_to_data(encode_ary(data, "UTF-16BE"), options) end - + def each_encoding Encoding.list.each do |encoding| next if encoding.dummy? # skip "dummy" encodings diff --git a/test/csv/test_features.rb b/test/csv/test_features.rb index 9ed3f98191..58efd1c9b3 100644 --- a/test/csv/test_features.rb +++ b/test/csv/test_features.rb @@ -30,17 +30,17 @@ class TestCSVFeatures < Test::Unit::TestCase [%Q{,"\r"}, [nil,"\r"]], [%Q{"\r\n,"}, ["\r\n,"]], [%Q{"\r\n,",}, ["\r\n,", nil]] ] - + def setup @sample_data = <<-END_DATA.gsub(/^ +/, "") line,1,abc line,2,"def\nghi" - + line,4,jkl END_DATA @csv = CSV.new(@sample_data) end - + def test_col_sep [";", "\t"].each do |sep| TEST_CASES.each do |test_case| @@ -51,7 +51,7 @@ class TestCSVFeatures < Test::Unit::TestCase end assert_equal([",,,", nil], CSV.parse_line(",,,;", col_sep: ";")) end - + def test_row_sep assert_raise(CSV::MalformedCSVError) do CSV.parse_line("1,2,3\n,4,5\r\n", row_sep: "\r\n") @@ -59,7 +59,7 @@ class TestCSVFeatures < Test::Unit::TestCase assert_equal( ["1", "2", "3\n", "4", "5"], CSV.parse_line(%Q{1,2,"3\n",4,5\r\n}, row_sep: "\r\n")) end - + def test_quote_char TEST_CASES.each do |test_case| assert_equal( test_case.last.map { |t| t.tr('"', "'") unless t.nil? }, @@ -67,31 +67,31 @@ class TestCSVFeatures < Test::Unit::TestCase quote_char: "'" ) ) end end - + def test_csv_char_readers %w[col_sep row_sep quote_char].each do |reader| csv = CSV.new("abc,def", reader.to_sym => "|") assert_equal("|", csv.send(reader)) end end - + def test_row_sep_auto_discovery ["\r\n", "\n", "\r"].each do |line_end| data = "1,2,3#{line_end}4,5#{line_end}" discovered = CSV.new(data).row_sep assert_equal(line_end, discovered) end - + assert_equal("\n", CSV.new("\n\r\n\r").row_sep) - + assert_equal($/, CSV.new("").row_sep) - + assert_equal($/, CSV.new(STDERR).row_sep) end - + def test_lineno assert_equal(5, @sample_data.lines.to_a.size) - + 4.times do |line_count| assert_equal(line_count, @csv.lineno) assert_not_nil(@csv.shift) @@ -99,24 +99,24 @@ class TestCSVFeatures < Test::Unit::TestCase end assert_nil(@csv.shift) end - + def test_readline test_lineno - + @csv.rewind - + test_lineno end - + def test_unknown_options assert_raise(ArgumentError) { CSV.new(String.new, unknown: :error) } end - + def test_skip_blanks assert_equal(4, @csv.to_a.size) @csv = CSV.new(@sample_data, skip_blanks: true) - + count = 0 @csv.each do |row| count += 1 @@ -124,7 +124,7 @@ class TestCSVFeatures < Test::Unit::TestCase end assert_equal(3, count) end - + def test_csv_behavior_readers %w[ unconverted_fields return_headers write_headers skip_blanks force_quotes ].each do |behavior| @@ -134,47 +134,47 @@ class TestCSVFeatures < Test::Unit::TestCase assert(csv.send("#{behavior}?"), "Behavior change now registered.") end end - + def test_converters_reader # no change assert_equal( [:integer], CSV.new("abc,def", converters: [:integer]).converters ) - + # just one assert_equal( [:integer], CSV.new("abc,def", converters: :integer).converters ) - + # expanded assert_equal( [:integer, :float], CSV.new("abc,def", converters: :numeric).converters ) - + # custom csv = CSV.new("abc,def", converters: [:integer, lambda { }]) assert_equal(2, csv.converters.size) assert_equal(:integer, csv.converters.first) assert_instance_of(Proc, csv.converters.last) end - + def test_header_converters_reader # no change hc = :header_converters assert_equal([:downcase], CSV.new("abc,def", hc => [:downcase]).send(hc)) - + # just one assert_equal([:downcase], CSV.new("abc,def", hc => :downcase).send(hc)) - + # custom csv = CSV.new("abc,def", hc => [:symbol, lambda { }]) assert_equal(2, csv.send(hc).size) assert_equal(:symbol, csv.send(hc).first) assert_instance_of(Proc, csv.send(hc).last) end - + # reported by Kev Jackson def test_failing_to_escape_col_sep_bug_fix assert_nothing_raised(Exception) { CSV.new(String.new, col_sep: "|") } end - + # reported by Chris Roos def test_failing_to_reset_headers_in_rewind_bug_fix csv = CSV.new("forename,surname", headers: true, return_headers: true) @@ -182,7 +182,7 @@ class TestCSVFeatures < Test::Unit::TestCase csv.rewind csv.each { |row| assert row.header_row? } end - + # reported by Dave Burt def test_leading_empty_fields_with_multibyte_col_sep_bug_fix data = <<-END_DATA.gsub(/^\s+/, "") @@ -192,7 +192,7 @@ class TestCSVFeatures < Test::Unit::TestCase parsed = CSV.parse(data, col_sep: "<=>") assert_equal([[nil, nil, "A", "B", "C"], ["1", "2", "3"]], parsed) end - + def test_gzip_reader_bug_fix zipped = nil assert_nothing_raised(NoMethodError) do @@ -204,7 +204,7 @@ class TestCSVFeatures < Test::Unit::TestCase end assert_equal("\r\n", zipped.row_sep) end - + def test_gzip_writer_bug_fix file = File.join(File.dirname(__FILE__), "temp.gz") zipped = nil @@ -214,13 +214,13 @@ class TestCSVFeatures < Test::Unit::TestCase zipped << %w[one two three] zipped << [1, 2, 3] zipped.close - + assert( Zlib::GzipReader.open(file) { |f| f.read }. include?($INPUT_RECORD_SEPARATOR), "@row_sep did not default" ) File.unlink(file) end - + def test_inspect_is_smart_about_io_types str = CSV.new("string,data").inspect assert(str.include?("io_type:StringIO"), "IO type not detected.") @@ -234,14 +234,14 @@ class TestCSVFeatures < Test::Unit::TestCase assert(str.include?("io_type:File"), "IO type not detected.") File.unlink(path) end - + def test_inspect_shows_key_attributes str = @csv.inspect %w[lineno col_sep row_sep quote_char].each do |attr_name| assert_match(/\b#{attr_name}:[^\s>]+/, str) end end - + def test_inspect_shows_headers_when_available CSV.new("one,two,three\n1,2,3\n", headers: true) do |csv| assert(csv.inspect.include?("headers:true"), "Header hint not shown.") @@ -249,7 +249,7 @@ class TestCSVFeatures < Test::Unit::TestCase assert_match(/headers:\[[^\]]+\]/, csv.inspect) end end - + def test_inspect_encoding_is_ascii_compatible CSV.new("one,two,three\n1,2,3\n".encode("UTF-16BE")) do |csv| assert( Encoding.compatible?( Encoding.find("US-ASCII"), @@ -257,7 +257,7 @@ class TestCSVFeatures < Test::Unit::TestCase "inspect() was not ASCII compatible." ) end end - + def test_version assert_not_nil(CSV::VERSION) assert_instance_of(String, CSV::VERSION) diff --git a/test/csv/test_headers.rb b/test/csv/test_headers.rb index 6ce5675816..6e56ffc27c 100644 --- a/test/csv/test_headers.rb +++ b/test/csv/test_headers.rb @@ -19,12 +19,12 @@ class TestCSVHeaders < Test::Unit::TestCase 1,2,3 END_CSV end - + def test_first_row [:first_row, true].each do |setting| # two names for the same setting # activate headers csv = nil - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do csv = CSV.parse(@data, headers: setting) end @@ -44,11 +44,11 @@ class TestCSVHeaders < Test::Unit::TestCase assert_nil(csv[2]) end end - + def test_array_of_headers # activate headers csv = nil - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do csv = CSV.parse(@data, headers: [:my, :new, :headers]) end @@ -73,7 +73,7 @@ class TestCSVHeaders < Test::Unit::TestCase # empty assert_nil(csv[3]) - + # with return and convert assert_nothing_raised(Exception) do csv = CSV.parse( @data, headers: [:my, :new, :headers], @@ -87,11 +87,11 @@ class TestCSVHeaders < Test::Unit::TestCase assert(row.header_row?) assert(!row.field_row?) end - + def test_csv_header_string # activate headers csv = nil - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do csv = CSV.parse(@data, headers: "my,new,headers") end @@ -115,7 +115,7 @@ class TestCSVHeaders < Test::Unit::TestCase # empty assert_nil(csv[3]) - + # with return and convert assert_nothing_raised(Exception) do csv = CSV.parse( @data, headers: "my,new,headers", @@ -129,11 +129,11 @@ class TestCSVHeaders < Test::Unit::TestCase assert(row.header_row?) assert(!row.field_row?) end - + def test_csv_header_string_inherits_separators # parse with custom col_sep csv = nil - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do csv = CSV.parse( @data.tr(",", "|"), col_sep: "|", headers: "my|new|headers" ) end @@ -144,7 +144,7 @@ class TestCSVHeaders < Test::Unit::TestCase assert_instance_of(CSV::Row, row) assert_equal([%w{my first}, %w{new second}, %w{headers third}], row.to_a) end - + def test_return_headers # activate headers and request they are returned csv = nil @@ -180,14 +180,14 @@ class TestCSVHeaders < Test::Unit::TestCase # empty assert_nil(csv[3]) end - + def test_converters # create test data where headers and fields look alike data = <<-END_MATCHING_CSV.gsub(/^\s+/, "") 1,2,3 1,2,3 END_MATCHING_CSV - + # normal converters do not affect headers csv = CSV.parse( data, headers: true, return_headers: true, @@ -195,9 +195,9 @@ class TestCSVHeaders < Test::Unit::TestCase assert_equal([%w{1 1}, %w{2 2}, %w{3 3}], csv[0].to_a) assert_equal([["1", 1], ["2", 2], ["3", 3]], csv[1].to_a) assert_nil(csv[2]) - + # header converters do affect headers (only) - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do csv = CSV.parse( data, headers: true, return_headers: true, converters: :numeric, @@ -207,21 +207,21 @@ class TestCSVHeaders < Test::Unit::TestCase assert_equal([[:"1", 1], [:"2", 2], [:"3", 3]], csv[1].to_a) assert_nil(csv[2]) end - + def test_builtin_downcase_converter csv = CSV.parse( "One,TWO Three", headers: true, return_headers: true, header_converters: :downcase ) assert_equal(%w{one two\ three}, csv.headers) end - + def test_builtin_symbol_converter csv = CSV.parse( "One,TWO Three", headers: true, return_headers: true, header_converters: :symbol ) assert_equal([:one, :two_three], csv.headers) end - + def test_custom_converter converter = lambda { |header| header.tr(" ", "_") } csv = CSV.parse( "One,TWO Three", @@ -230,56 +230,56 @@ class TestCSVHeaders < Test::Unit::TestCase header_converters: converter ) assert_equal(%w{One TWO_Three}, csv.headers) end - + def test_table_support csv = nil - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do csv = CSV.parse(@data, headers: true) end - + assert_instance_of(CSV::Table, csv) end - + def test_skip_blanks @data = <<-END_CSV.gsub(/^ +/, "") - + A,B,C - + 1,2,3 - - - + + + END_CSV - + expected = [%w[1 2 3]] CSV.parse(@data, headers: true, skip_blanks: true) do |row| assert_equal(expected.shift, row.fields) end - + expected = [%w[A B C], %w[1 2 3]] CSV.parse( @data, headers: true, - return_headers: true, + return_headers: true, skip_blanks: true ) do |row| assert_equal(expected.shift, row.fields) end end - + def test_headers_reader # no headers assert_nil(CSV.new(@data).headers) - + # headers csv = CSV.new(@data, headers: true) assert_equal(true, csv.headers) # before headers are read csv.shift # set headers assert_equal(%w[first second third], csv.headers) # after headers are read end - + def test_blank_row_bug_fix @data += "\n#{@data}" # add a blank row - + # ensure that everything returned is a Row object CSV.parse(@data, headers: true) do |row| assert_instance_of(CSV::Row, row) diff --git a/test/csv/test_interface.rb b/test/csv/test_interface.rb index b9e634a559..a6028f92f3 100644 --- a/test/csv/test_interface.rb +++ b/test/csv/test_interface.rb @@ -14,7 +14,7 @@ require "csv" class TestCSVInterface < Test::Unit::TestCase def setup @path = File.join(File.dirname(__FILE__), "temp_test_data.csv") - + File.open(@path, "w") do |file| file << "1\t2\t3\r\n" file << "4\t5\r\n" @@ -22,19 +22,19 @@ class TestCSVInterface < Test::Unit::TestCase @expected = [%w{1 2 3}, %w{4 5}] end - + def teardown File.unlink(@path) end - + ### Test Read Interface ### - + def test_foreach CSV.foreach(@path, col_sep: "\t", row_sep: "\r\n") do |row| assert_equal(@expected.shift, row) end end - + def test_open_and_close csv = CSV.open(@path, "r+", col_sep: "\t", row_sep: "\r\n") assert_not_nil(csv) @@ -42,7 +42,7 @@ class TestCSVInterface < Test::Unit::TestCase assert_equal(false, csv.closed?) csv.close assert(csv.closed?) - + ret = CSV.open(@path) do |new_csv| csv = new_csv assert_instance_of(CSV, new_csv) @@ -51,7 +51,7 @@ class TestCSVInterface < Test::Unit::TestCase assert(csv.closed?) assert_equal("Return value.", ret) end - + def test_parse data = File.read(@path) assert_equal( @expected, @@ -61,27 +61,27 @@ class TestCSVInterface < Test::Unit::TestCase assert_equal(@expected.shift, row) end end - + def test_parse_line row = CSV.parse_line("1;2;3", col_sep: ";") assert_not_nil(row) assert_instance_of(Array, row) assert_equal(%w{1 2 3}, row) - + # shortcut interface row = "1;2;3".parse_csv(col_sep: ";") assert_not_nil(row) assert_instance_of(Array, row) assert_equal(%w{1 2 3}, row) end - + def test_read_and_readlines assert_equal( @expected, CSV.read(@path, col_sep: "\t", row_sep: "\r\n") ) assert_equal( @expected, CSV.readlines(@path, col_sep: "\t", row_sep: "\r\n") ) - - + + data = CSV.open(@path, col_sep: "\t", row_sep: "\r\n") do |csv| csv.read end @@ -91,13 +91,13 @@ class TestCSVInterface < Test::Unit::TestCase end assert_equal(@expected, data) end - + def test_table table = CSV.table(@path, col_sep: "\t", row_sep: "\r\n") assert_instance_of(CSV::Table, table) assert_equal([[:"1", :"2", :"3"], [4, 5, nil]], table.to_a) end - + def test_shift # aliased as gets() and readline() CSV.open(@path, "r+", col_sep: "\t", row_sep: "\r\n") do |csv| assert_equal(@expected.shift, csv.shift) @@ -105,7 +105,7 @@ class TestCSVInterface < Test::Unit::TestCase assert_equal(nil, csv.shift) end end - + ### Test Write Interface ### def test_generate @@ -123,13 +123,13 @@ class TestCSVInterface < Test::Unit::TestCase end assert_equal(%Q{1,2,3\n4,,5\nlast,"""row"""\n}, str) end - + def test_generate_line line = CSV.generate_line(%w{1 2 3}, col_sep: ";") assert_not_nil(line) assert_instance_of(String, line) assert_equal("1;2;3\n", line) - + # shortcut interface line = %w{1 2 3}.to_csv(col_sep: ";") assert_not_nil(line) @@ -173,7 +173,7 @@ class TestCSVInterface < Test::Unit::TestCase csv.each { |line| assert_equal(lines.shift, line.to_hash) } end end - + def test_write_hash_with_headers_array File.unlink(@path) @@ -216,7 +216,7 @@ class TestCSVInterface < Test::Unit::TestCase csv.each { |line| assert_equal(lines.shift, line.to_hash) } end end - + def test_write_headers File.unlink(@path) @@ -241,10 +241,10 @@ class TestCSVInterface < Test::Unit::TestCase csv.each { |line| assert_equal(lines.shift, line.to_hash) } end end - + def test_append # aliased add_row() and puts() File.unlink(@path) - + CSV.open(@path, "w", col_sep: "\t", row_sep: "\r\n") do |csv| @expected.each { |row| csv << row } end @@ -253,19 +253,19 @@ class TestCSVInterface < Test::Unit::TestCase # same thing using CSV::Row objects File.unlink(@path) - + CSV.open(@path, "w", col_sep: "\t", row_sep: "\r\n") do |csv| @expected.each { |row| csv << CSV::Row.new(Array.new, row) } end test_shift end - + ### Test Read and Write Interface ### - + def test_filter assert_respond_to(CSV, :filter) - + expected = [[1, 2, 3], [4, 5]] CSV.filter( "1;2;3\n4;5\n", (result = String.new), in_col_sep: ";", out_col_sep: ",", @@ -276,27 +276,27 @@ class TestCSVInterface < Test::Unit::TestCase end assert_equal("2,4,6,\"Added\r\"\n8,10,\"Added\r\"\n", result) end - + def test_instance csv = String.new - + first = nil - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do first = CSV.instance(csv, col_sep: ";") first << %w{a b c} end - + assert_equal("a;b;c\n", csv) - + second = nil - assert_nothing_raised(Exception) do + assert_nothing_raised(Exception) do second = CSV.instance(csv, col_sep: ";") second << [1, 2, 3] end - + assert_equal(first.object_id, second.object_id) assert_equal("a;b;c\n1;2;3\n", csv) - + # shortcuts assert_equal(STDOUT, CSV.instance.instance_eval { @io }) assert_equal(STDOUT, CSV { |new_csv| new_csv.instance_eval { @io } }) diff --git a/test/csv/test_row.rb b/test/csv/test_row.rb index d0b0cdc406..f9aa959701 100644 --- a/test/csv/test_row.rb +++ b/test/csv/test_row.rb @@ -15,27 +15,27 @@ class TestCSVRow < Test::Unit::TestCase def setup @row = CSV::Row.new(%w{A B C A A}, [1, 2, 3, 4]) end - + def test_initialize # basic row = CSV::Row.new(%w{A B C}, [1, 2, 3]) assert_not_nil(row) assert_instance_of(CSV::Row, row) assert_equal([["A", 1], ["B", 2], ["C", 3]], row.to_a) - + # missing headers row = CSV::Row.new(%w{A}, [1, 2, 3]) assert_not_nil(row) assert_instance_of(CSV::Row, row) assert_equal([["A", 1], [nil, 2], [nil, 3]], row.to_a) - + # missing fields row = CSV::Row.new(%w{A B C}, [1, 2]) assert_not_nil(row) assert_instance_of(CSV::Row, row) assert_equal([["A", 1], ["B", 2], ["C", nil]], row.to_a) end - + def test_row_type # field rows row = CSV::Row.new(%w{A B C}, [1, 2, 3]) # implicit @@ -50,11 +50,11 @@ class TestCSVRow < Test::Unit::TestCase assert(row.header_row?) assert(!row.field_row?) end - + def test_headers assert_equal(%w{A B C A A}, @row.headers) end - + def test_field # by name assert_equal(2, @row.field("B")) @@ -62,11 +62,11 @@ class TestCSVRow < Test::Unit::TestCase # by index assert_equal(3, @row.field(2)) - + # missing assert_nil(@row.field("Missing")) assert_nil(@row.field(10)) - + # minimum index assert_equal(1, @row.field("A")) assert_equal(1, @row.field("A", 0)) @@ -76,24 +76,24 @@ class TestCSVRow < Test::Unit::TestCase assert_equal(nil, @row.field("A", 4)) assert_equal(nil, @row.field("A", 5)) end - + def test_set_field # set field by name assert_equal(100, @row["A"] = 100) - + # set field by index assert_equal(300, @row[3] = 300) - + # set field by name and minimum index assert_equal([:a, :b, :c], @row["A", 4] = [:a, :b, :c]) - + # verify the changes assert_equal( [ ["A", 100], ["B", 2], ["C", 3], ["A", 300], ["A", [:a, :b, :c]] ], @row.to_a ) - + # assigning an index past the end assert_equal("End", @row[10] = "End") assert_equal( [ ["A", 100], @@ -107,7 +107,7 @@ class TestCSVRow < Test::Unit::TestCase [nil, nil], [nil, nil], [nil, "End"] ], @row.to_a ) - + # assigning a new field by header assert_equal("New", @row[:new] = "New") assert_equal( [ ["A", 100], @@ -123,7 +123,7 @@ class TestCSVRow < Test::Unit::TestCase [nil, "End"], [:new, "New"] ], @row.to_a ) end - + def test_append # add a value assert_equal(@row, @row << "Value") @@ -133,7 +133,7 @@ class TestCSVRow < Test::Unit::TestCase ["A", 4], ["A", nil], [nil, "Value"] ], @row.to_a ) - + # add a pair assert_equal(@row, @row << %w{Header Field}) assert_equal( [ ["A", 1], @@ -143,7 +143,7 @@ class TestCSVRow < Test::Unit::TestCase ["A", nil], [nil, "Value"], %w{Header Field} ], @row.to_a ) - + # a pair with Hash syntax assert_equal(@row, @row << {key: :value}) assert_equal( [ ["A", 1], @@ -154,7 +154,7 @@ class TestCSVRow < Test::Unit::TestCase [nil, "Value"], %w{Header Field}, [:key, :value] ], @row.to_a ) - + # multiple fields at once assert_equal(@row, @row.push(100, 200, [:last, 300])) assert_equal( [ ["A", 1], @@ -169,39 +169,39 @@ class TestCSVRow < Test::Unit::TestCase [nil, 200], [:last, 300] ], @row.to_a ) end - + def test_delete # by index assert_equal(["B", 2], @row.delete(1)) # by header assert_equal(["C", 3], @row.delete("C")) - + # using a block assert_equal(@row, @row.delete_if { |h, f| h == "A" and not f.nil? }) assert_equal([["A", nil]], @row.to_a) end - + def test_fields # all fields assert_equal([1, 2, 3, 4, nil], @row.fields) - + # by header assert_equal([1, 3], @row.fields("A", "C")) - + # by index assert_equal([2, 3, nil], @row.fields(1, 2, 10)) - + # by both assert_equal([2, 3, 4], @row.fields("B", "C", 3)) - + # with minimum indices assert_equal([2, 3, 4], @row.fields("B", "C", ["A", 3])) - + # by header range assert_equal([2, 3], @row.values_at("B".."C")) end - + def test_index # basic usage assert_equal(0, @row.index("A")) @@ -218,20 +218,20 @@ class TestCSVRow < Test::Unit::TestCase assert_equal(4, @row.index("A", 4)) assert_equal(nil, @row.index("A", 5)) end - + def test_queries # headers assert(@row.header?("A")) assert(@row.header?("C")) assert(!@row.header?("Z")) assert(@row.include?("A")) # alias - + # fields assert(@row.field?(4)) assert(@row.field?(nil)) assert(!@row.field?(10)) end - + def test_each # array style ary = @row.to_a @@ -239,25 +239,25 @@ class TestCSVRow < Test::Unit::TestCase assert_equal(ary.first.first, pair.first) assert_equal(ary.shift.last, pair.last) end - + # hash style ary = @row.to_a @row.each do |header, field| assert_equal(ary.first.first, header) assert_equal(ary.shift.last, field) end - + # verify that we can chain the call assert_equal(@row, @row.each { }) end - + def test_enumerable assert_equal( [["A", 1], ["A", 4], ["A", nil]], @row.select { |pair| pair.first == "A" } ) - + assert_equal(10, @row.inject(0) { |sum, (header, n)| sum + (n || 0) }) end - + def test_to_a row = CSV::Row.new(%w{A B C}, [1, 2, 3]).to_a assert_instance_of(Array, row) @@ -267,27 +267,27 @@ class TestCSVRow < Test::Unit::TestCase end assert_equal([["A", 1], ["B", 2], ["C", 3]], row) end - + def test_to_hash assert_equal({"A" => nil, "B" => 2, "C" => 3}, @row.to_hash) end - + def test_to_csv # normal conversion assert_equal("1,2,3,4,\n", @row.to_csv) assert_equal("1,2,3,4,\n", @row.to_s) # alias - + # with options assert_equal( "1|2|3|4|\r\n", @row.to_csv(col_sep: "|", row_sep: "\r\n") ) end - + def test_array_delegation assert(!@row.empty?, "Row was empty.") - + assert_equal([@row.headers.size, @row.fields.size].max, @row.size) end - + def test_inspect_shows_header_field_pairs str = @row.inspect @row.each do |header, field| @@ -295,13 +295,13 @@ class TestCSVRow < Test::Unit::TestCase "Header field pair not found." ) end end - + def test_inspect_encoding_is_ascii_compatible assert( Encoding.compatible?( Encoding.find("US-ASCII"), @row.inspect.encoding ), "inspect() was not ASCII compatible." ) end - + def test_inspect_shows_symbol_headers_as_bare_attributes str = CSV::Row.new(@row.headers.map { |h| h.to_sym }, @row.fields).inspect @row.each do |header, field| diff --git a/test/csv/test_serialization.rb b/test/csv/test_serialization.rb index 878619f58a..f8e6df1b1d 100644 --- a/test/csv/test_serialization.rb +++ b/test/csv/test_serialization.rb @@ -16,48 +16,48 @@ class Hash def self.csv_load( meta, headers, fields ) self[*headers.zip(fields).to_a.flatten.map { |e| eval(e) }] end - + def csv_headers keys.map { |key| key.inspect } end - + def csv_dump( headers ) headers.map { |header| fetch(eval(header)).inspect } end end class TestSerialization < Test::Unit::TestCase - + ### Classes Used to Test Serialization ### - + class ReadOnlyName def initialize( first, last ) @first, @last = first, last end attr_reader :first, :last - + def ==( other ) %w{first last}.all? { |att| send(att) == other.send(att) } end end Name = Struct.new(:first, :last) - + class FullName < Name def initialize( first, last, suffix = nil ) super(first, last) - + @suffix = suffix end - + attr_accessor :suffix - + def ==( other ) %w{first last suffix}.all? { |att| send(att) == other.send(att) } end end - + ### Tests ### def test_class_dump @@ -66,8 +66,8 @@ class TestSerialization < Test::Unit::TestCase %w{Greg Brown} ].map do |first, last| ReadOnlyName.new(first, last) end - - assert_nothing_raised(Exception) do + + assert_nothing_raised(Exception) do @data = CSV.dump(@names) end assert_equal(<<-END_CLASS_DUMP.gsub(/^\s*/, ""), @data) @@ -78,15 +78,15 @@ class TestSerialization < Test::Unit::TestCase Greg,Brown END_CLASS_DUMP end - + def test_struct_dump @names = [ %w{James Gray}, %w{Dana Gray}, %w{Greg Brown} ].map do |first, last| Name.new(first, last) end - - assert_nothing_raised(Exception) do + + assert_nothing_raised(Exception) do @data = CSV.dump(@names) end assert_equal(<<-END_STRUCT_DUMP.gsub(/^\s*/, ""), @data) @@ -97,15 +97,15 @@ class TestSerialization < Test::Unit::TestCase Greg,Brown END_STRUCT_DUMP end - + def test_inherited_struct_dump @names = [ %w{James Gray II}, %w{Dana Gray}, %w{Greg Brown} ].map do |first, last, suffix| FullName.new(first, last, suffix) end - - assert_nothing_raised(Exception) do + + assert_nothing_raised(Exception) do @data = CSV.dump(@names) end assert_equal(<<-END_STRUCT_DUMP.gsub(/^\s*/, ""), @data) @@ -116,7 +116,7 @@ class TestSerialization < Test::Unit::TestCase ,Greg,Brown END_STRUCT_DUMP end - + def test_load %w{ test_class_dump test_struct_dump @@ -128,13 +128,13 @@ class TestSerialization < Test::Unit::TestCase end end end - + def test_io test_class_dump - + data_file = File.join(File.dirname(__FILE__), "temp_test_data.csv") CSV.dump(@names, File.open(data_file, "w")) - + assert(File.exist?(data_file)) assert_equal(<<-END_IO_DUMP.gsub(/^\s*/, ""), File.read(data_file)) class,TestSerialization::ReadOnlyName @@ -143,12 +143,12 @@ class TestSerialization < Test::Unit::TestCase Dana,Gray Greg,Brown END_IO_DUMP - + assert_equal(@names, CSV.load(File.open(data_file))) - + File.unlink(data_file) end - + def test_custom_dump_and_load obj = {1 => "simple", test: Hash} assert_equal(obj, CSV.load(CSV.dump([obj])).first) diff --git a/test/csv/test_table.rb b/test/csv/test_table.rb index d0b4d10103..e87f1b2545 100644 --- a/test/csv/test_table.rb +++ b/test/csv/test_table.rb @@ -27,32 +27,32 @@ class TestCSVTable < Test::Unit::TestCase assert_not_nil(@table) assert_instance_of(CSV::Table, @table) end - + def test_modes assert_equal(:col_or_row, @table.mode) - + # non-destructive changes, intended for one shot calls cols = @table.by_col assert_equal(:col_or_row, @table.mode) assert_equal(:col, cols.mode) assert_equal(@table, cols) - + rows = @table.by_row assert_equal(:col_or_row, @table.mode) assert_equal(:row, rows.mode) assert_equal(@table, rows) - + # destructive mode changing calls assert_equal(@table, @table.by_row!) assert_equal(:row, @table.mode) assert_equal(@table, @table.by_col_or_row!) assert_equal(:col_or_row, @table.mode) end - + def test_headers assert_equal(@rows.first.headers, @table.headers) end - + def test_index ################## ### Mixed Mode ### @@ -60,40 +60,40 @@ class TestCSVTable < Test::Unit::TestCase # by row @rows.each_index { |i| assert_equal(@rows[i], @table[i]) } assert_equal(nil, @table[100]) # empty row - + # by col @rows.first.headers.each do |header| assert_equal(@rows.map { |row| row[header] }, @table[header]) end assert_equal([nil] * @rows.size, @table["Z"]) # empty col - + # by cell, row then col assert_equal(2, @table[0][1]) assert_equal(6, @table[1]["C"]) - + # by cell, col then row assert_equal(5, @table["B"][1]) assert_equal(9, @table["C"][2]) - + # with headers (by col) assert_equal(["B", 2, 5, 8], @header_table["B"]) - + ################### ### Column Mode ### ################### @table.by_col! - + assert_equal([2, 5, 8], @table[1]) assert_equal([2, 5, 8], @table["B"]) - + ################ ### Row Mode ### ################ @table.by_row! - + assert_equal(@rows[1], @table[1]) assert_raise(TypeError) { @table["B"] } - + ############################ ### One Shot Mode Change ### ############################ @@ -101,7 +101,7 @@ class TestCSVTable < Test::Unit::TestCase assert_equal([2, 5, 8], @table.by_col[1]) assert_equal(@rows[1], @table[1]) end - + def test_set_row_or_column ################## ### Mixed Mode ### @@ -113,7 +113,7 @@ class TestCSVTable < Test::Unit::TestCase @table[3] = CSV::Row.new(%w[A B C], [13, 14, 15]) assert_equal( [%w[A B C], [1, 2, 3], [4, 5, 6], [10, 11, 12], [13, 14, 15]], @table.to_a ) - + # set col @table["Type"] = "data" assert_equal( [ %w[A B C Type], @@ -147,7 +147,7 @@ class TestCSVTable < Test::Unit::TestCase 10,,12,data,3 13,,15,data, END_RESULT - + # with headers @header_table["Type"] = "data" assert_equal(%w[Type data data data], @header_table["Type"]) @@ -156,7 +156,7 @@ class TestCSVTable < Test::Unit::TestCase ### Column Mode ### ################### @table.by_col! - + @table[1] = [2, 5, 11, 14] assert_equal( [ %w[A B C Type Index], [1, 2, 3, "data", 1], @@ -164,7 +164,7 @@ class TestCSVTable < Test::Unit::TestCase [10, 11, 12, "data", 3], [13, 14, 15, "data", nil] ], @table.to_a ) - + @table["Extra"] = "new stuff" assert_equal( [ %w[A B C Type Index Extra], [1, 2, 3, "data", 1, "new stuff"], @@ -177,7 +177,7 @@ class TestCSVTable < Test::Unit::TestCase ### Row Mode ### ################ @table.by_row! - + @table[1] = (1..6).to_a assert_equal( [ %w[A B C Type Index Extra], [1, 2, 3, "data", 1, "new stuff"], @@ -185,10 +185,10 @@ class TestCSVTable < Test::Unit::TestCase [10, 11, 12, "data", 3, "new stuff"], [13, 14, 15, "data", nil, "new stuff"] ], @table.to_a ) - + assert_raise(TypeError) { @table["Extra"] = nil } end - + def test_each ###################### ### Mixed/Row Mode ### @@ -201,43 +201,43 @@ class TestCSVTable < Test::Unit::TestCase # verify that we can chain the call assert_equal(@table, @table.each { }) - + ################### ### Column Mode ### ################### @table.by_col! - + headers = @table.headers @table.each do |header, column| assert_equal(headers.shift, header) assert_equal(@table[header], column) end - + ############################ ### One Shot Mode Change ### ############################ @table.by_col_or_row! - + @table.each { |row| assert_instance_of(CSV::Row, row) } @table.by_col.each { |tuple| assert_instance_of(Array, tuple) } @table.each { |row| assert_instance_of(CSV::Row, row) } end - + def test_enumerable assert_equal( @rows.values_at(0, 2), @table.select { |row| (row["B"] % 2).zero? } ) - + assert_equal(@rows[1], @table.find { |row| row["C"] > 5 }) end - + def test_to_a assert_equal([%w[A B C], [1, 2, 3], [4, 5, 6], [7, 8, 9]], @table.to_a) - + # with headers assert_equal( [%w[A B C], [1, 2, 3], [4, 5, 6], [7, 8, 9]], @header_table.to_a ) end - + def test_to_csv csv = <<-END_CSV.gsub(/^\s+/, "") A,B,C @@ -245,11 +245,11 @@ class TestCSVTable < Test::Unit::TestCase 4,5,6 7,8,9 END_CSV - + # normal conversion assert_equal(csv, @table.to_csv) assert_equal(csv, @table.to_s) # alias - + # with options assert_equal( csv.gsub(",", "|").gsub("\n", "\r\n"), @table.to_csv(col_sep: "|", row_sep: "\r\n") ) @@ -257,36 +257,36 @@ class TestCSVTable < Test::Unit::TestCase # with headers assert_equal(csv, @header_table.to_csv) end - + def test_append # verify that we can chain the call assert_equal(@table, @table << [10, 11, 12]) - + # Array append assert_equal(CSV::Row.new(%w[A B C], [10, 11, 12]), @table[-1]) - + # Row append assert_equal(@table, @table << CSV::Row.new(%w[A B C], [13, 14, 15])) assert_equal(CSV::Row.new(%w[A B C], [13, 14, 15]), @table[-1]) end - + def test_delete ################## ### Mixed Mode ### ################## # delete a row assert_equal(@rows[1], @table.delete(1)) - + # delete a col assert_equal(@rows.map { |row| row["A"] }, @table.delete("A")) - + # verify resulting table assert_equal(<<-END_RESULT.gsub(/^\s+/, ""), @table.to_csv) B,C 2,3 8,9 END_RESULT - + ################### ### Column Mode ### ################### @@ -295,7 +295,7 @@ class TestCSVTable < Test::Unit::TestCase assert_equal(@rows.map { |row| row[0] }, @table.delete(0)) assert_equal(@rows.map { |row| row["C"] }, @table.delete("C")) - + # verify resulting table assert_equal(<<-END_RESULT.gsub(/^\s+/, ""), @table.to_csv) B @@ -303,7 +303,7 @@ class TestCSVTable < Test::Unit::TestCase 5 8 END_RESULT - + ################ ### Row Mode ### ################ @@ -312,7 +312,7 @@ class TestCSVTable < Test::Unit::TestCase assert_equal(@rows[1], @table.delete(1)) assert_raise(TypeError) { @table.delete("C") } - + # verify resulting table assert_equal(<<-END_RESULT.gsub(/^\s+/, ""), @table.to_csv) A,B,C @@ -320,7 +320,7 @@ class TestCSVTable < Test::Unit::TestCase 7,8,9 END_RESULT end - + def test_delete_if ###################### ### Mixed/Row Mode ### @@ -333,13 +333,13 @@ class TestCSVTable < Test::Unit::TestCase A,B,C 4,5,6 END_RESULT - + ################### ### Column Mode ### ################### setup @table.by_col! - + assert_equal(@table, @table.delete_if { |h, v| h > "A" }) assert_equal(<<-END_RESULT.gsub(/^\s+/, ""), @table.to_csv) A @@ -348,7 +348,7 @@ class TestCSVTable < Test::Unit::TestCase 7 END_RESULT end - + def test_values_at ################## ### Mixed Mode ### @@ -356,27 +356,27 @@ class TestCSVTable < Test::Unit::TestCase # rows assert_equal(@rows.values_at(0, 2), @table.values_at(0, 2)) assert_equal(@rows.values_at(1..2), @table.values_at(1..2)) - + # cols assert_equal([[1, 3], [4, 6], [7, 9]], @table.values_at("A", "C")) assert_equal([[2, 3], [5, 6], [8, 9]], @table.values_at("B".."C")) - + ################### ### Column Mode ### ################### @table.by_col! - + assert_equal([[1, 3], [4, 6], [7, 9]], @table.values_at(0, 2)) assert_equal([[1, 3], [4, 6], [7, 9]], @table.values_at("A", "C")) - + ################ ### Row Mode ### ################ @table.by_row! - + assert_equal(@rows.values_at(0, 2), @table.values_at(0, 2)) assert_raise(TypeError) { @table.values_at("A", "C") } - + ############################ ### One Shot Mode Change ### ############################ @@ -384,22 +384,22 @@ class TestCSVTable < Test::Unit::TestCase assert_equal([[1, 3], [4, 6], [7, 9]], @table.by_col.values_at(0, 2)) assert_equal(@rows.values_at(0, 2), @table.values_at(0, 2)) end - + def test_array_delegation assert(!@table.empty?, "Table was empty.") - + assert_equal(@rows.size, @table.size) end - + def test_inspect_shows_current_mode str = @table.inspect assert(str.include?("mode:#{@table.mode}"), "Mode not shown.") - + @table.by_col! str = @table.inspect assert(str.include?("mode:#{@table.mode}"), "Mode not shown.") end - + def test_inspect_encoding_is_ascii_compatible assert( Encoding.compatible?( Encoding.find("US-ASCII"), @table.inspect.encoding ), diff --git a/test/date/test_date_base.rb b/test/date/test_date_base.rb index 4b9bcf2aa4..a8dc2ee6b2 100644 --- a/test/date/test_date_base.rb +++ b/test/date/test_date_base.rb @@ -262,19 +262,19 @@ class TestDateBase < Test::Unit::TestCase end end - # October 1582 + # October 1582 # S M Tu W Th F S # 274 275 276 277 288 289 # 290 291 292 293 294 295 296 # 297 298 299 300 301 302 303 - # 304 + # 304 - # October 1582 + # October 1582 # S M Tu W Th F S # -92 -91 -90 -89 -78 -77 # -76 -75 -74 -73 -72 -71 -70 # -69 -68 -67 -66 -65 -64 -63 - # -62 + # -62 def test_valid_ordinal__italy valid_ordinal_p = :_valid_ordinal? @@ -286,7 +286,7 @@ class TestDateBase < Test::Unit::TestCase end end - # September 1752 + # September 1752 # S M Tu W Th F S # 245 246 258 259 260 # 261 262 263 264 265 266 267 @@ -327,12 +327,12 @@ class TestDateBase < Test::Unit::TestCase end end - # October 1582 + # October 1582 # S M Tu W Th F S # 1 2 3 4 15 16 # 17 18 19 20 21 22 23 # 24 25 26 27 28 29 30 - # 31 + # 31 def test_valid_civil__italy valid_civil_p = :_valid_civil? @@ -356,7 +356,7 @@ class TestDateBase < Test::Unit::TestCase end end - # September 1752 + # September 1752 # S M Tu W Th F S # 1 2 14 15 16 # 17 18 19 20 21 22 23 diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb index c44523fd98..959a6e5d95 100644 --- a/test/date/test_date_parse.rb +++ b/test/date/test_date_parse.rb @@ -110,7 +110,7 @@ class TestDateParse < Test::Unit::TestCase # broken iso 8601 (?) # [['1999-05-23T235521Z',false],[1999,5,23,23,55,21,'Z',0,nil]], # cp - [['19990523T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil]], + [['19990523T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil]], [['19990523235521.1234-100',true],[1999,5,23,23,55,21,'-100',-1*3600,nil]], [['19990523235521.1234-10',true],[1999,5,23,23,55,21,'-10',-10*3600,nil]], diff --git a/test/date/test_date_strftime.rb b/test/date/test_date_strftime.rb index 4131af3aab..117517256c 100644 --- a/test/date/test_date_strftime.rb +++ b/test/date/test_date_strftime.rb @@ -382,7 +382,7 @@ class TestDateStrftime < Test::Unit::TestCase H18.09.01).each do |s| assert_equal(s, Date.parse(s).jisx0301) end - + end end diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb index 1845a6db55..14fd83899e 100644 --- a/test/dbm/test_dbm.rb +++ b/test/dbm/test_dbm.rb @@ -37,7 +37,7 @@ if defined? DBM DBM.open("#{@tmpdir}/#{@prefix}_rdonly") {|dbm| dbm['foo'] = 'FOO' } - + File.chmod(0400, *Dir.glob("#{@tmpdir}/#{@prefix}_rdonly.*")) assert_instance_of(DBM, @dbm_rdonly = DBM.new("#{@tmpdir}/#{@prefix}_rdonly", nil)) @@ -530,7 +530,7 @@ if defined? DBM DBM.open("#{@tmproot}/a") {} # create a db. v = DBM.open("#{@tmproot}/a", nil, DBM::READER) {|d| # Errno::EPERM is raised on Solaris which use ndbm. - # DBMError is raised on Debian which use gdbm. + # DBMError is raised on Debian which use gdbm. assert_raise(Errno::EPERM, DBMError) { d["k"] = "v" } true } diff --git a/test/dl/test_base.rb b/test/dl/test_base.rb index e24ed7ba2c..439739bcf5 100644 --- a/test/dl/test_base.rb +++ b/test/dl/test_base.rb @@ -47,7 +47,7 @@ module DL @libc = dlopen(LIBC_SO) @libm = dlopen(LIBM_SO) end - + def assert_match(expected, actual, message="") assert(expected === actual, message) end diff --git a/test/dl/test_import.rb b/test/dl/test_import.rb index 8514f8298e..c70cb9a6d0 100644 --- a/test/dl/test_import.rb +++ b/test/dl/test_import.rb @@ -54,7 +54,7 @@ module DL def test_unsigned_result() d = (2 ** 31) + 1 - + r = LIBC.strtoul(d.to_s, 0, 0) assert_equal(d, r) end @@ -75,7 +75,7 @@ module DL def test_value() i = LIBC.value('int', 2) assert_equal(2, i.value) - + d = LIBC.value('double', 2.0) assert_equal(2.0, d.value) diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index e06139a9d6..e1d3aeedf2 100644 --- a/test/drb/drbtest.rb +++ b/test/drb/drbtest.rb @@ -98,7 +98,7 @@ module DRbCore assert_equal(6, @there.sample(onecky, 1, 2)) ary = @there.to_a assert_kind_of(DRb::DRbObject, ary) - + assert(@there.respond_to?(:to_a, true)) assert(@there.respond_to?(:eval, true)) assert(! @there.respond_to?(:eval, false)) diff --git a/test/drb/test_acl.rb b/test/drb/test_acl.rb index d8955e0e75..7fe30f4c4a 100644 --- a/test/drb/test_acl.rb +++ b/test/drb/test_acl.rb @@ -192,4 +192,4 @@ class ACLTest < Test::Unit::TestCase end end - + diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb index 57cf7175d7..0548dc7aa0 100644 --- a/test/drb/test_drb.rb +++ b/test/drb/test_drb.rb @@ -18,11 +18,11 @@ class TestDRbYield < Test::Unit::TestCase @there.echo_yield_1([]) {|one| assert_equal([], one) } - + @there.echo_yield_1(1) {|one| assert_equal(1, one) } - + @there.echo_yield_1(nil) {|one| assert_equal(nil, one) } @@ -140,7 +140,7 @@ class TestDRbRubyYield < TestDRbYield def setup @there = self end - + def teardown end end @@ -150,15 +150,15 @@ class TestDRbRuby18Yield < TestDRbRubyYield def echo_yield(*arg, &proc) proc.call(*arg) end - + def echo_yield_0(&proc) proc.call end - + def echo_yield_1(a, &proc) proc.call(a) end - + def echo_yield_2(a, b, &proc) proc.call(a, b) end @@ -217,7 +217,7 @@ class TestDRbEval # < Test::Unit::TestCase def teardown @ext.stop_service if @ext end - + def test_01_safe1_safe4_eval assert_raise(SecurityError) do @there.method_missing(:instance_eval, 'ENV.inspect') @@ -239,7 +239,7 @@ class TestDRbEval # < Test::Unit::TestCase four = @there.four assert_equal(1, four.method_missing(:send, :eval, '1')) - + remote_class = four.remote_class assert_equal(1, remote_class.class_eval('1')) @@ -292,7 +292,7 @@ class TestDRbLarge < Test::Unit::TestCase ary = ["Hello, World"] * 102400 exception = nil begin - @there.size(ary) + @there.size(ary) rescue StandardError exception = $! end diff --git a/test/drb/ut_large.rb b/test/drb/ut_large.rb index d6717c5589..9545f78f4b 100644 --- a/test/drb/ut_large.rb +++ b/test/drb/ut_large.rb @@ -6,7 +6,7 @@ class DRbLarge include DRbUndumped def size(ary) - ary.size + ary.size end def sum(ary) diff --git a/test/drb/ut_safe1.rb b/test/drb/ut_safe1.rb index 4df8e1e5a1..97b4df24ab 100644 --- a/test/drb/ut_safe1.rb +++ b/test/drb/ut_safe1.rb @@ -8,7 +8,7 @@ if __FILE__ == $0 it end - DRb.start_service('druby://localhost:0', [1, 2, 'III', 4, "five", 6], + DRb.start_service('druby://localhost:0', [1, 2, 'III', 4, "five", 6], {:safe_level => 1}) es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) DRb.thread.join diff --git a/test/drb/ut_timerholder.rb b/test/drb/ut_timerholder.rb index 141cb73302..6f66dd3393 100644 --- a/test/drb/ut_timerholder.rb +++ b/test/drb/ut_timerholder.rb @@ -34,7 +34,7 @@ class TimerHolderTest < RUNIT::TestCase assert(!holder.include?(key)) holder.delete(key) end - + def test_00 do_test(0.5) end diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb index be9df0dbc3..3c54e8a50a 100644 --- a/test/erb/test_erb.rb +++ b/test/erb/test_erb.rb @@ -73,7 +73,7 @@ class TestERBCore < Test::Unit::TestCase * <%= n %> <% end %> EOS - + ans = <<EOS %% hi = hello @@ -118,7 +118,7 @@ EOS % n=0 * 2 EOS - + erb = @erb.new(src, safe, 2) assert_equal(ans, erb.result) erb = @erb.new(src, safe, '<>') @@ -212,7 +212,7 @@ end%> %%% EOS ans = <<EOS -% +% % %%><%0 % %%><%1 %% @@ -234,7 +234,7 @@ EOS klass.module_eval do def_erb_method('hello_world', erb) end - assert(klass.new.respond_to?('hello_world')) + assert(klass.new.respond_to?('hello_world')) end def test_def_method_without_filename @@ -300,7 +300,7 @@ EOS def test_keep_lineno src = <<EOS -Hello, +Hello, % x = "World" <%= x%> % raise("lineno") @@ -316,21 +316,21 @@ EOS src = <<EOS %> -Hello, +Hello, <% x = "World%%> "%> <%= x%> EOS ans = <<EOS -%>Hello, +%>Hello, World%> EOS assert_equal(ans, ERB.new(src, nil, '>').result) ans = <<EOS %> -Hello, +Hello, World%> EOS @@ -338,7 +338,7 @@ EOS ans = <<EOS %> -Hello, +Hello, World%> @@ -346,7 +346,7 @@ EOS assert_equal(ans, ERB.new(src).result) src = <<EOS -Hello, +Hello, <% x = "World%%> "%> <%= x%> @@ -381,7 +381,7 @@ EOS % y = 'Hello' <%- x = "World%%> "-%> -<%= x %><%- x = nil -%> +<%= x %><%- x = nil -%> <% raise("lineno") %> EOS @@ -417,19 +417,19 @@ NotSkip <%- y = x -%> NotSkip <%- up = w.upcase -%> * <%= up %> <%- end -%> -KeepNewLine <%- z = nil -%> +KeepNewLine <%- z = nil -%> EOS ans = <<EOS NotSkip NotSkip * HELLO * WORLD - NotSkip + NotSkip * hello * HELLO * world * WORLD -KeepNewLine +KeepNewLine EOS assert_equal(ans, ERB.new(src, nil, '-').result) assert_equal(ans, ERB.new(src, nil, '-%').result) diff --git a/test/erb/test_erb_m17n.rb b/test/erb/test_erb_m17n.rb index 432cb4fd74..640b1e6c51 100644 --- a/test/erb/test_erb_m17n.rb +++ b/test/erb/test_erb_m17n.rb @@ -16,7 +16,7 @@ class TestERB < Test::Unit::TestCase erb = ERB.new("γεια σας".encode("ISO-8859-7")) assert_equal Encoding::ISO_8859_7, erb.result.encoding - assert_raise(ArgumentError, /ASCII compatible/) { + assert_raise(ArgumentError, /ASCII compatible/) { ERB.new("ã“ã‚“ã«ã¡ã¯".force_encoding("ISO-2022-JP")) # dummy encoding } end diff --git a/test/fileutils/fileasserts.rb b/test/fileutils/fileasserts.rb index d784544555..bad87e9ce0 100644 --- a/test/fileutils/fileasserts.rb +++ b/test/fileutils/fileasserts.rb @@ -94,7 +94,7 @@ EOT <#{expected_str}> expected but was <#{actual_str}>. EOT - # subsecond timestamp is not portable. + # subsecond timestamp is not portable. assert_block(full_message) { expected.tv_sec == actual.tv_sec } } end diff --git a/test/gdbm/test_gdbm.rb b/test/gdbm/test_gdbm.rb index 7e28d5121d..03b5eb792b 100644 --- a/test/gdbm/test_gdbm.rb +++ b/test/gdbm/test_gdbm.rb @@ -696,7 +696,7 @@ if defined? GDBM def test_newdb_open GDBM.open("#{@tmproot}/a.dbm") {|dbm| dbm["k"] = "v" - } + } v = GDBM.open("#{@tmproot}/a.dbm", nil, GDBM::NEWDB) {|d| assert_equal(0, d.length) assert_nil(d["k"]) diff --git a/test/json/test_json.rb b/test/json/test_json.rb index 02da6d4e7a..ae77f7b14f 100755 --- a/test/json/test_json.rb +++ b/test/json/test_json.rb @@ -134,7 +134,7 @@ class TC_JSON < Test::Unit::TestCase assert_equal(@ary, parse('[[1],["foo"],[3.14],[47.11e+2],[2718.0E-3],[null],[[1,-2,3]]'\ ',[false],[true]]')) - assert_equal(@ary, parse(%Q{ [ [1] , ["foo"] , [3.14] \t , [47.11e+2] + assert_equal(@ary, parse(%Q{ [ [1] , ["foo"] , [3.14] \t , [47.11e+2] , [2718.0E-3 ],\r[ null] , [[1, -2, 3 ]], [false ],[ true]\n ] })) end diff --git a/test/json/test_json_addition.rb b/test/json/test_json_addition.rb index 95b6166261..2650db68f0 100755 --- a/test/json/test_json_addition.rb +++ b/test/json/test_json_addition.rb @@ -17,7 +17,7 @@ class TC_JSONAddition < Test::Unit::TestCase def ==(other) a == other.a end - + def self.json_create(object) new(*object['args']) end diff --git a/test/json/test_json_rails.rb b/test/json/test_json_rails.rb index 52dc29f388..91eb9ee9ea 100644 --- a/test/json/test_json_rails.rb +++ b/test/json/test_json_rails.rb @@ -17,7 +17,7 @@ class TC_JSONRails < Test::Unit::TestCase def ==(other) a == other.a end - + def self.json_create(object) new(*object['args']) end diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb index 50d1fe2eae..271c50e802 100644 --- a/test/net/http/test_http.rb +++ b/test/net/http/test_http.rb @@ -253,7 +253,7 @@ module TestNetHTTP_version_1_2_methods assert_kind_of String, res.body assert_equal $test_net_http_data, res.body end - + def _test_send_request__POST(http) data = 'aaabbb cc ddddddddddd lkjoiu4j3qlkuoa' res = http.send_request('POST', '/', data) diff --git a/test/net/http/test_https_proxy.rb b/test/net/http/test_https_proxy.rb index 4f26342339..5618830587 100644 --- a/test/net/http/test_https_proxy.rb +++ b/test/net/http/test_https_proxy.rb @@ -34,4 +34,4 @@ class HTTPSProxyTest < Test::Unit::TestCase t.join if t end end if defined?(OpenSSL) - + diff --git a/test/nkf/test_kconv.rb b/test/nkf/test_kconv.rb index d396b4be47..8581f10e4e 100644 --- a/test/nkf/test_kconv.rb +++ b/test/nkf/test_kconv.rb @@ -21,7 +21,7 @@ class TestKconv < Test::Unit::TestCase \x1b\x24\x42\x25\x2a\x25\x56\x25\x38\x25\x27\x25\x2f\x25\x48\x3b\x58\x38\x7e\ \x25\x57\x25\x6d\x25\x30\x25\x69\x25\x5f\x25\x73\x25\x30\x38\x40\x38\x6c\x1b\x28\x42 \x52\x75\x62\x79".force_encoding('ISO-2022-JP') - end + end def test_eucjp diff --git a/test/openssl/ssl_server.rb b/test/openssl/ssl_server.rb index 6e620629c5..d3ad55d236 100644 --- a/test/openssl/ssl_server.rb +++ b/test/openssl/ssl_server.rb @@ -53,7 +53,7 @@ tcps = nil port = port + i break rescue Errno::EADDRINUSE - next + next end } ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx) diff --git a/test/openssl/test_ec.rb b/test/openssl/test_ec.rb index 66dbf54b4d..282bb67624 100644 --- a/test/openssl/test_ec.rb +++ b/test/openssl/test_ec.rb @@ -88,7 +88,7 @@ class OpenSSL::TestEC < Test::Unit::TestCase for key in @keys sig = key.dsa_sign_asn1(@data1) assert_equal(key.dsa_verify_asn1(@data1, sig), true) - + assert_raise(OpenSSL::PKey::ECError) { key.dsa_sign_asn1(@data2) } end end diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb index 271459f55e..9d22a87e29 100644 --- a/test/openssl/test_pair.rb +++ b/test/openssl/test_pair.rb @@ -57,7 +57,7 @@ module SSLPair ensure if th && th.alive? th.kill - th.join + th.join end end end diff --git a/test/openssl/test_pkcs7.rb b/test/openssl/test_pkcs7.rb index 2cdd9343ff..d86de36cc7 100644 --- a/test/openssl/test_pkcs7.rb +++ b/test/openssl/test_pkcs7.rb @@ -35,7 +35,7 @@ class OpenSSL::TestPKCS7 < Test::Unit::TestCase @ca_cert, @rsa2048, OpenSSL::Digest::SHA1.new) end - def issue_cert(*args) + def issue_cert(*args) OpenSSL::TestUtils.issue_cert(*args) end @@ -77,7 +77,7 @@ class OpenSSL::TestPKCS7 < Test::Unit::TestCase assert_equal(@ee1_cert.serial, signers[0].serial) assert_equal(@ee1_cert.issuer.to_s, signers[0].issuer.to_s) - # A signed-data which have multiple signatures can be created + # A signed-data which have multiple signatures can be created # through the following steps. # 1. create two signed-data # 2. copy signerInfo and certificate from one to another @@ -85,7 +85,7 @@ class OpenSSL::TestPKCS7 < Test::Unit::TestCase tmp1 = OpenSSL::PKCS7.sign(@ee1_cert, @rsa1024, data, [], flag) tmp2 = OpenSSL::PKCS7.sign(@ee2_cert, @rsa1024, data, [], flag) tmp1.add_signer(tmp2.signers[0]) - tmp1.add_certificate(@ee2_cert) + tmp1.add_certificate(@ee2_cert) p7 = OpenSSL::PKCS7.new(tmp1.to_der) certs = p7.certificates diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 2c5886bb42..5053634a84 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -82,7 +82,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase end Thread.start do - Thread.current.abort_on_exception = true + Thread.current.abort_on_exception = true server_proc.call(ctx, ssl) end end @@ -93,7 +93,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase ctx_proc = args[:ctx_proc] server_proc = args[:server_proc] server_proc ||= method(:readwrite_loop) - + store = OpenSSL::X509::Store.new store.add_cert(@ca_cert) store.purpose = OpenSSL::X509::PURPOSE_SSL_CLIENT @@ -120,7 +120,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase begin server = Thread.new do - Thread.current.abort_on_exception = true + Thread.current.abort_on_exception = true server_loop(ctx, ssls, server_proc) end @@ -532,7 +532,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase ctx.session_add(saved_session) end connections += 1 - + readwrite_loop(ctx, ssl) end diff --git a/test/openssl/test_x509cert.rb b/test/openssl/test_x509cert.rb index c092ce5796..398ab2ff34 100644 --- a/test/openssl/test_x509cert.rb +++ b/test/openssl/test_x509cert.rb @@ -28,7 +28,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase def test_serial [1, 2**32, 2**100].each{|s| cert = issue_cert(@ca, @rsa2048, s, Time.now, Time.now+3600, [], - nil, nil, OpenSSL::Digest::SHA1.new) + nil, nil, OpenSSL::Digest::SHA1.new) assert_equal(s, cert.serial) cert = OpenSSL::X509::Certificate.new(cert.to_der) assert_equal(s, cert.serial) @@ -60,25 +60,25 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase def test_validity now = Time.now until now && now.usec != 0 cert = issue_cert(@ca, @rsa2048, 1, now, now+3600, [], - nil, nil, OpenSSL::Digest::SHA1.new) + nil, nil, OpenSSL::Digest::SHA1.new) assert_not_equal(now, cert.not_before) assert_not_equal(now+3600, cert.not_after) now = Time.at(now.to_i) cert = issue_cert(@ca, @rsa2048, 1, now, now+3600, [], - nil, nil, OpenSSL::Digest::SHA1.new) + nil, nil, OpenSSL::Digest::SHA1.new) assert_equal(now.getutc, cert.not_before) assert_equal((now+3600).getutc, cert.not_after) now = Time.at(0) cert = issue_cert(@ca, @rsa2048, 1, now, now, [], - nil, nil, OpenSSL::Digest::SHA1.new) + nil, nil, OpenSSL::Digest::SHA1.new) assert_equal(now.getutc, cert.not_before) assert_equal(now.getutc, cert.not_after) now = Time.at(0x7fffffff) cert = issue_cert(@ca, @rsa2048, 1, now, now, [], - nil, nil, OpenSSL::Digest::SHA1.new) + nil, nil, OpenSSL::Digest::SHA1.new) assert_equal(now.getutc, cert.not_before) assert_equal(now.getutc, cert.not_after) end @@ -91,7 +91,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase ["authorityKeyIdentifier","keyid:always",false], ] ca_cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, ca_exts, - nil, nil, OpenSSL::Digest::SHA1.new) + nil, nil, OpenSSL::Digest::SHA1.new) ca_cert.extensions.each_with_index{|ext, i| assert_equal(ca_exts[i].first, ext.oid) assert_equal(ca_exts[i].last, ext.critical?) @@ -105,7 +105,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase ["subjectAltName","email:ee1@ruby-lang.org",false], ] ee1_cert = issue_cert(@ee1, @rsa1024, 2, Time.now, Time.now+1800, ee1_exts, - ca_cert, @rsa2048, OpenSSL::Digest::SHA1.new) + ca_cert, @rsa2048, OpenSSL::Digest::SHA1.new) assert_equal(ca_cert.subject.to_der, ee1_cert.issuer.to_der) ee1_cert.extensions.each_with_index{|ext, i| assert_equal(ee1_exts[i].first, ext.oid) @@ -120,7 +120,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase ["subjectAltName","email:ee2@ruby-lang.org",false], ] ee2_cert = issue_cert(@ee2, @rsa1024, 3, Time.now, Time.now+1800, ee2_exts, - ca_cert, @rsa2048, OpenSSL::Digest::MD5.new) + ca_cert, @rsa2048, OpenSSL::Digest::MD5.new) assert_equal(ca_cert.subject.to_der, ee2_cert.issuer.to_der) ee2_cert.extensions.each_with_index{|ext, i| assert_equal(ee2_exts[i].first, ext.oid) @@ -131,7 +131,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase def test_sign_and_verify cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [], - nil, nil, OpenSSL::Digest::SHA1.new) + nil, nil, OpenSSL::Digest::SHA1.new) assert_equal(false, cert.verify(@rsa1024)) assert_equal(true, cert.verify(@rsa2048)) assert_equal(false, cert.verify(@dsa256)) @@ -140,7 +140,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase assert_equal(false, cert.verify(@rsa2048)) cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [], - nil, nil, OpenSSL::Digest::MD5.new) + nil, nil, OpenSSL::Digest::MD5.new) assert_equal(false, cert.verify(@rsa1024)) assert_equal(true, cert.verify(@rsa2048)) assert_equal(false, cert.verify(@dsa256)) @@ -149,25 +149,25 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase assert_equal(false, cert.verify(@rsa2048)) cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [], - nil, nil, OpenSSL::Digest::DSS1.new) + nil, nil, OpenSSL::Digest::DSS1.new) assert_equal(false, cert.verify(@rsa1024)) assert_equal(false, cert.verify(@rsa2048)) assert_equal(false, cert.verify(@dsa256)) assert_equal(true, cert.verify(@dsa512)) - cert.not_after = Time.now + cert.not_after = Time.now assert_equal(false, cert.verify(@dsa512)) assert_raise(OpenSSL::X509::CertificateError){ cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [], - nil, nil, OpenSSL::Digest::DSS1.new) + nil, nil, OpenSSL::Digest::DSS1.new) } assert_raise(OpenSSL::X509::CertificateError){ cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [], - nil, nil, OpenSSL::Digest::MD5.new) + nil, nil, OpenSSL::Digest::MD5.new) } assert_raise(OpenSSL::X509::CertificateError){ cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [], - nil, nil, OpenSSL::Digest::SHA1.new) + nil, nil, OpenSSL::Digest::SHA1.new) } end end diff --git a/test/openssl/test_x509crl.rb b/test/openssl/test_x509crl.rb index 444a00a586..e1f4e009cd 100644 --- a/test/openssl/test_x509crl.rb +++ b/test/openssl/test_x509crl.rb @@ -125,13 +125,13 @@ class OpenSSL::TestX509CRL < Test::Unit::TestCase def test_extension cert_exts = [ ["basicConstraints", "CA:TRUE", true], - ["subjectKeyIdentifier", "hash", false], - ["authorityKeyIdentifier", "keyid:always", false], + ["subjectKeyIdentifier", "hash", false], + ["authorityKeyIdentifier", "keyid:always", false], ["subjectAltName", "email:xyzzy@ruby-lang.org", false], ["keyUsage", "cRLSign, keyCertSign", true], ] crl_exts = [ - ["authorityKeyIdentifier", "keyid:always", false], + ["authorityKeyIdentifier", "keyid:always", false], ["issuerAltName", "issuer:copy", false], ] diff --git a/test/openssl/utils.rb b/test/openssl/utils.rb index 07a1835f9d..2edb7b0c99 100644 --- a/test/openssl/utils.rb +++ b/test/openssl/utils.rb @@ -96,7 +96,7 @@ Q1VB8qkJN7rA7/2HrCR3gTsWNb1YhAsnFsoeRscC+LxXoXi9OAIUBG98h4tilg6S cert end - def issue_crl(revoke_info, serial, lastup, nextup, extensions, + def issue_crl(revoke_info, serial, lastup, nextup, extensions, issuer, issuer_key, digest) crl = OpenSSL::X509::CRL.new crl.issuer = issuer.subject diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb index 8adfd0159a..d92092339a 100644 --- a/test/ostruct/test_ostruct.rb +++ b/test/ostruct/test_ostruct.rb @@ -20,7 +20,7 @@ class TC_OpenStruct < Test::Unit::TestCase o2.instance_eval{@table = {:a => 'b'}} assert_not_equal(o1, o2) end - + def test_inspect foo = OpenStruct.new assert_equal("#<OpenStruct>", foo.inspect) diff --git a/test/rdoc/test_rdoc_info_formatting.rb b/test/rdoc/test_rdoc_info_formatting.rb index c10532aa17..110c84b2d1 100644 --- a/test/rdoc/test_rdoc_info_formatting.rb +++ b/test/rdoc/test_rdoc_info_formatting.rb @@ -40,7 +40,7 @@ class TestRDocInfoFormatting < MiniTest::Unit::TestCase def test_escaping assert_match(/@@ and @\{@\} should be at-sign-prefixed/) end - + # This tests that *bold* and <b>bold me</b> become @strong{bolded} def test_bold # Seems like a limitation of the Info format: @strong{bold} @@ -139,7 +139,7 @@ Second inner item. Second outer item. @end itemize") end - + def test_internal_hyperlinks # be sure to test multi-word hyperlinks as well. end diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb index baacda8285..ccc5e95799 100644 --- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb +++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb @@ -32,7 +32,7 @@ class TestRDocMarkupToHtmlCrossref < MiniTest::Unit::TestCase # predicable. RDoc::Generator::Method.reset top_level = RDoc::TopLevel.new @source_file_name - + options = RDoc::Options.new options.quiet = true @@ -107,7 +107,7 @@ class TestRDocMarkupToHtmlCrossref < MiniTest::Unit::TestCase # def verify_class_crossref(xref, reference, class_name) class_file_name = class_name.gsub(/::/, "/") - + result = "<a href=\"../classes/#{class_file_name}.html\">#{reference}</a>" verify_convert xref, reference, result @@ -120,7 +120,7 @@ class TestRDocMarkupToHtmlCrossref < MiniTest::Unit::TestCase # def verify_method_crossref(xref, reference, class_name, method_seq) class_file_name = class_name.gsub(/::/, "/") - + result = "<a href=\"../classes/#{class_file_name}.html##{method_seq}\">#{reference}</a>" verify_convert xref, reference, result @@ -145,7 +145,7 @@ class TestRDocMarkupToHtmlCrossref < MiniTest::Unit::TestCase # bogus does not exist and so no cross-reference should be generated. verify_no_crossref xref, "bogus" verify_no_crossref xref, "\\bogus" - + # Ref_Class1 is in the top-level namespace, and so a cross-reference always # should be generated, unless markup is suppressed. verify_class_crossref xref, "Ref_Class1", "Ref_Class1" diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb index ebf96594c8..ce93b5b3f7 100644 --- a/test/rdoc/test_rdoc_parser_c.rb +++ b/test/rdoc/test_rdoc_parser_c.rb @@ -176,11 +176,11 @@ void Init_foo(){ comment = <<-EOF.chomp - + Multiline comment goes here because this comment spans multiple lines. Multiline comment goes here because this comment spans multiple lines. - - + + EOF assert_equal ['MULTILINE', 'INT2FIX(1)', comment], constants.shift assert_equal ['MULTILINE_VALUE', '1', comment], constants.shift @@ -189,8 +189,8 @@ void Init_foo(){ Multiline comment goes here because this comment spans multiple lines. Multiline comment goes here because this comment spans multiple lines. - - + + EOF assert_equal ['MULTILINE_NOT_EMPTY', 'INT2FIX(1)', comment], constants.shift diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb index 3845fb2907..7fe626c302 100644 --- a/test/rdoc/test_rdoc_parser_ruby.rb +++ b/test/rdoc/test_rdoc_parser_ruby.rb @@ -177,7 +177,7 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase assert_equal 'Foo', foo.full_name assert_equal comment, foo.comment end - + def test_parse_class_mistaken_for_module # # The code below is not strictly legal Ruby (Foo must have been defined diff --git a/test/rdoc/test_rdoc_ri_default_display.rb b/test/rdoc/test_rdoc_ri_default_display.rb index 1182b046c3..966325ef5c 100644 --- a/test/rdoc/test_rdoc_ri_default_display.rb +++ b/test/rdoc/test_rdoc_ri_default_display.rb @@ -169,7 +169,7 @@ Instance method extensions: ------------------------------------------------------- SomeClass::some_method SomeClass::some_method(arg1, arg2) - From + From ------------------------------------------------------------------------------ [no description] EOF diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb index 846f80d247..c9a88c2f68 100644 --- a/test/readline/test_readline.rb +++ b/test/readline/test_readline.rb @@ -36,7 +36,7 @@ class TestReadline < Test::Unit::TestCase def teardown Readline.instance_variable_set("@completion_proc", nil) end - + def test_safe_level_4 method_args = [ @@ -119,7 +119,7 @@ class TestReadline < Test::Unit::TestCase Readline.input = "This is not a file." end end - + def test_output= assert_raise(TypeError) do Readline.output = "This is not a file." @@ -156,7 +156,7 @@ class TestReadline < Test::Unit::TestCase rescue NotImplementedError end end - + # vi_editing_mode # emacs_editing_mode def test_editing_mode diff --git a/test/readline/test_readline_history.rb b/test/readline/test_readline_history.rb index 0640d08eba..a5d8c686da 100644 --- a/test/readline/test_readline_history.rb +++ b/test/readline/test_readline_history.rb @@ -73,7 +73,7 @@ class Readline::TestHistory < Test::Unit::TestCase }.join end end - + def test_to_s expected = "HISTORY" assert_equal(expected, HISTORY.to_s) @@ -101,7 +101,7 @@ class Readline::TestHistory < Test::Unit::TestCase HISTORY[i] end end - + invalid_indexes = [100_000_000_000_000_000_000, -100_000_000_000_000_000_000] invalid_indexes.each do |i| @@ -127,7 +127,7 @@ class Readline::TestHistory < Test::Unit::TestCase assert_raise(IndexError, NotImplementedError, "index=<0>") do HISTORY[0] = "set: 0" end - + lines = push_history(5) invalid_indexes = [5, 6, 100, -6, -7, -100] invalid_indexes.each do |i| @@ -135,7 +135,7 @@ class Readline::TestHistory < Test::Unit::TestCase HISTORY[i] = "set: #{i}" end end - + invalid_indexes = [100_000_000_000_000_000_000, -100_000_000_000_000_000_000] invalid_indexes.each do |i| @@ -180,13 +180,13 @@ class Readline::TestHistory < Test::Unit::TestCase def test_pop begin assert_equal(nil, HISTORY.pop) - + lines = push_history(5) (1..5).each do |i| assert_external_string_equal(lines[-i], HISTORY.pop) assert_equal(lines.length - i, HISTORY.length) end - + assert_equal(nil, HISTORY.pop) rescue NotImplementedError end @@ -195,13 +195,13 @@ class Readline::TestHistory < Test::Unit::TestCase def test_shift begin assert_equal(nil, HISTORY.shift) - + lines = push_history(5) (0..4).each do |i| assert_external_string_equal(lines[i], HISTORY.shift) assert_equal(lines.length - (i + 1), HISTORY.length) end - + assert_equal(nil, HISTORY.shift) rescue NotImplementedError end @@ -276,7 +276,7 @@ class Readline::TestHistory < Test::Unit::TestCase assert_raise(IndexError, NotImplementedError, "index=<0>") do HISTORY.delete_at(0) end - + lines = push_history(5) invalid_indexes = [5, 6, 100, -6, -7, -100] invalid_indexes.each do |i| @@ -284,7 +284,7 @@ class Readline::TestHistory < Test::Unit::TestCase HISTORY.delete_at(i) end end - + invalid_indexes = [100_000_000_000_000_000_000, -100_000_000_000_000_000_000] invalid_indexes.each do |i| diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb index 0b1c512bf1..0d94cf70da 100644 --- a/test/rinda/test_rinda.rb +++ b/test/rinda/test_rinda.rb @@ -16,7 +16,7 @@ class MockClock nil end end - + def initialize @now = 2 @reso = 1 @@ -32,7 +32,7 @@ class MockClock def at(n) n end - + def _forward(n=nil) now ,= @ts.take([nil, :now]) @now = now + n @@ -114,7 +114,7 @@ module TupleSpaceTestModule end th.value end - + def test_00_tuple tuple = Rinda::TupleEntry.new([1,2,3]) assert(!tuple.canceled?) @@ -283,7 +283,7 @@ module TupleSpaceTestModule @ts.write([:ans, s]) s end - + assert_equal(10, thread_join(taker)) tuple = @ts.take([:ans, nil]) assert_equal(10, tuple[1]) @@ -314,7 +314,7 @@ module TupleSpaceTestModule assert_equal(10, tuple[1]) assert_equal([], @ts.read_all([nil, nil])) end - + def test_core_03_notify notify1 = @ts.notify(nil, [:req, Integer]) notify2 = @ts.notify(nil, [:ans, Integer], 8) @@ -417,7 +417,7 @@ module TupleSpaceTestModule assert_equal([[:removeme, 1]], @ts.read_all([nil, nil])) entry.cancel assert_equal([], @ts.read_all([nil, nil])) - + template = nil taker = Thread.new do @ts.take([:take, nil], 10) do |t| @@ -427,7 +427,7 @@ module TupleSpaceTestModule end end end - + sleep(2) assert_raise(Rinda::RequestCanceledError) do @@ -435,7 +435,7 @@ module TupleSpaceTestModule end assert(template.canceled?) - + @ts.write([:take, 1]) assert_equal([[:take, 1]], @ts.read_all([nil, nil])) @@ -464,7 +464,7 @@ module TupleSpaceTestModule end assert(template.canceled?) - + @ts.write([:take, 1]) assert_equal([[:take, 1]], @ts.read_all([nil, nil])) @@ -475,7 +475,7 @@ module TupleSpaceTestModule @sec = sec @n = n end - + def renew return -1 if @n <= 0 @n -= 1 @@ -488,7 +488,7 @@ module TupleSpaceTestModule assert(!tuple.canceled?) assert(tuple.expired?) assert(!tuple.alive?) - + tuple = Rinda::TupleEntry.new([1,2,3], 1) assert(!tuple.canceled?) assert(!tuple.expired?) diff --git a/test/rinda/test_tuplebag.rb b/test/rinda/test_tuplebag.rb index e1ca1bde6c..3e30127f0f 100644 --- a/test/rinda/test_tuplebag.rb +++ b/test/rinda/test_tuplebag.rb @@ -150,7 +150,7 @@ class TestTupleBag < Test::Unit::TestCase t = tup(:val, 1) @tb.push t - + assert_equal t, @tb.find(tem(:val, 1)) end diff --git a/test/ripper/test_files.rb b/test/ripper/test_files.rb index c2d7a50a3f..2bbe4a0060 100644 --- a/test/ripper/test_files.rb +++ b/test/ripper/test_files.rb @@ -22,4 +22,4 @@ end rescue LoadError end - + diff --git a/test/rss/rss-assertions.rb b/test/rss/rss-assertions.rb index 0a84e4f16d..86f9dd87c0 100644 --- a/test/rss/rss-assertions.rb +++ b/test/rss/rss-assertions.rb @@ -14,7 +14,7 @@ module RSS ::RSS::Parser.parse(rss, false).validate end end - + def assert_ns(prefix, uri) _wrap_assertion do begin @@ -26,7 +26,7 @@ module RSS end end end - + def assert_missing_tag(tag, parent) _wrap_assertion do begin @@ -38,7 +38,7 @@ module RSS end end end - + def assert_too_much_tag(tag, parent) _wrap_assertion do begin @@ -50,7 +50,7 @@ module RSS end end end - + def assert_missing_attribute(tag, attrname) _wrap_assertion do begin @@ -62,7 +62,7 @@ module RSS end end end - + def assert_not_expected_tag(tag, uri, parent) _wrap_assertion do begin @@ -75,7 +75,7 @@ module RSS end end end - + def assert_not_available_value(tag, value, attribute=nil) _wrap_assertion do begin @@ -101,7 +101,7 @@ module RSS end end end - + def assert_xml_declaration(version, encoding, standalone, rss) _wrap_assertion do assert_equal(version, rss.version) @@ -109,7 +109,7 @@ module RSS assert_equal(standalone, rss.standalone) end end - + def assert_xml_stylesheet_attrs(attrs, xsl) _wrap_assertion do n_attrs = normalized_attrs(attrs) @@ -118,7 +118,7 @@ module RSS end end end - + def assert_xml_stylesheet(target, attrs, xsl) _wrap_assertion do if attrs.has_key?(:href) @@ -133,7 +133,7 @@ module RSS end end end - + def assert_xml_stylesheet_pis(attrs_ary, rss=nil) _wrap_assertion do if rss.nil? @@ -806,7 +806,7 @@ EOA end end end - + def assert_multiple_dublin_core(elems, target) _wrap_assertion do elems.each do |name, values, plural| @@ -816,7 +816,7 @@ EOA end end end - + def assert_syndication(elems, target) _wrap_assertion do elems.each do |name, value| @@ -826,7 +826,7 @@ EOA end end end - + def assert_content(elems, target) _wrap_assertion do elems.each do |name, value| @@ -834,7 +834,7 @@ EOA end end end - + def assert_trackback(attrs, target) _wrap_assertion do n_attrs = normalized_attrs(attrs) diff --git a/test/rss/rss-testcase.rb b/test/rss/rss-testcase.rb index 79f8cb87e8..6a7093a8da 100644 --- a/test/rss/rss-testcase.rb +++ b/test/rss/rss-testcase.rb @@ -37,11 +37,11 @@ module RSS CLOUD_PATH = "/RPC2" CLOUD_REGISTER_PROCEDURE = "ourFavoriteSongs.rssPleaseNotify" CLOUD_PROTOCOL = "xml-rpc" - + ENCLOSURE_URL = "http://www.scripting.com/mp3s/weatherReportSuite.mp3" ENCLOSURE_LENGTH = "12216320" ENCLOSURE_TYPE = "audio/mpeg" - + CATEGORY_DOMAIN = "http://www.superopendirectory.com/" FEED_TITLE = "dive into mark" @@ -375,7 +375,7 @@ EOA rdf.items << item assert_not_equal("", rdf.to_s) end - + def setup_rss20(rss) assert_equal("", rss.to_s) @@ -389,7 +389,7 @@ EOA rss.channel = channel assert_not_equal("", rss.to_s) end - + def setup_dummy_channel(maker) about = "http://hoge.com" title = "fugafuga" @@ -421,7 +421,7 @@ EOA url = "http://hoge.com/hoge.png" maker.channel.link = link if maker.channel.link.nil? - + maker.image.title = title maker.image.url = url end diff --git a/test/rss/test_1.0.rb b/test/rss/test_1.0.rb index 9cb7607590..52ad24cfcd 100644 --- a/test/rss/test_1.0.rb +++ b/test/rss/test_1.0.rb @@ -6,32 +6,32 @@ require "rss/1.0" module RSS class TestRSS10Core < TestCase - + def setup @rdf_prefix = "rdf" @rdf_uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" @uri = "http://purl.org/rss/1.0/" end - + def test_RDF version = "1.0" encoding = "UTF-8" standalone = false - + rdf = RDF.new(version, encoding, standalone) setup_rss10(rdf) doc = REXML::Document.new(rdf.to_s) - + xmldecl = doc.xml_decl - + %w(version encoding).each do |x| assert_equal(instance_eval(x), xmldecl.__send__(x)) end assert_equal(standalone, !xmldecl.standalone.nil?) - + assert_equal(@rdf_uri, doc.root.namespace) end - + def test_not_displayed_xml_stylesheets rdf = RDF.new() plain_rdf = rdf.to_s @@ -40,7 +40,7 @@ module RSS assert_equal(plain_rdf, rdf.to_s) end end - + def test_xml_stylesheets [ [{:href => "a.xsl", :type => "text/xsl"}], @@ -52,7 +52,7 @@ module RSS assert_xml_stylesheet_pis(attrs_ary) end end - + def test_channel about = "http://hoge.com" title = "fugafuga" @@ -77,7 +77,7 @@ module RSS %w(title link description image items textinput).each do |x| channel.__send__("#{x}=", instance_eval(x)) end - + doc = REXML::Document.new(make_RDF(<<-EOR)) #{channel} <items> @@ -85,7 +85,7 @@ module RSS </items> EOR c = doc.root.elements[1] - + assert_equal(about, c.attributes["about"]) %w(title link description image textinput).each do |x| elem = c.elements[x] @@ -105,52 +105,52 @@ EOR assert_equal(@uri, c.elements["items"].namespace) assert_equal("items", c.elements["items"].name) end - + def test_channel_image resource = "http://hoge.com/hoge.png" image = RDF::Channel::Image.new(resource) - + doc = REXML::Document.new(make_RDF(image.to_s)) i = doc.root.elements[1] - + assert_equal("image", i.name) assert_equal(@uri, i.namespace) - + res = i.attributes.get_attribute("resource") - + assert_equal(@rdf_uri, res.namespace) assert_equal(resource, res.value) end - + def test_channel_textinput resource = "http://hoge.com/hoge.png" textinput = RDF::Channel::Textinput.new(resource) - + doc = REXML::Document.new(make_RDF(textinput.to_s)) t = doc.root.elements[1] - + assert_equal("textinput", t.name) assert_equal(@uri, t.namespace) - + res = t.attributes.get_attribute("resource") - + assert_equal(@rdf_uri, res.namespace) assert_equal(resource, res.value) end - + def test_channel_items item_link = "http://example.com/item" items = RDF::Channel::Items.new li = items.Seq.class::Li.new(item_link) items.Seq.lis << li - + doc = REXML::Document.new(make_RDF(items.to_s)) i = doc.root.elements[1] - + assert_equal("items", i.name) assert_equal(@uri, i.namespace) - + assert_equal(1, i.elements.size) seq = i.elements[1] assert_equal("Seq", seq.name) @@ -162,16 +162,16 @@ EOR assert_equal(@rdf_uri, l.namespace) assert_equal(item_link, l.attributes["resource"]) end - + def test_seq item_link = "http://example.com/item" seq = RDF::Seq.new li = seq.class::Li.new(item_link) seq.lis << li - + doc = REXML::Document.new(make_RDF(seq.to_s)) s = doc.root.elements[1] - + assert_equal("Seq", s.name) assert_equal(@rdf_uri, s.namespace) @@ -181,37 +181,37 @@ EOR assert_equal(@rdf_uri, l.namespace) assert_equal(item_link, l.attributes["resource"]) end - + def test_li resource = "http://hoge.com/" li = RDF::Li.new(resource) - + doc = REXML::Document.new(make_RDF(li.to_s)) l = doc.root.elements[1] - + assert_equal("li", l.name) assert_equal(@rdf_uri, l.namespace(l.prefix)) - + res = l.attributes.get_attribute("resource") - + assert_equal('', res.instance_eval("@prefix")) assert_equal(resource, res.value) end - + def test_image about = "http://hoge.com" title = "fugafuga" url = "http://hoge.com/hoge" link = "http://hoge.com/fuga" - + image = RDF::Image.new(about) %w(title url link).each do |x| image.__send__("#{x}=", instance_eval(x)) end - + doc = REXML::Document.new(make_RDF(image.to_s)) i = doc.root.elements[1] - + assert_equal(about, i.attributes["about"]) %w(title url link).each do |x| elem = i.elements[x] @@ -220,21 +220,21 @@ EOR assert_equal(instance_eval(x), elem.text) end end - + def test_item about = "http://hoge.com" title = "fugafuga" link = "http://hoge.com/fuga" description = "hogehogehoge" - + item = RDF::Item.new(about) %w(title link description).each do |x| item.__send__("#{x}=", instance_eval(x)) end - + doc = REXML::Document.new(make_RDF(item.to_s)) i = doc.root.elements[1] - + assert_equal(about, i.attributes["about"]) %w(title link description).each do |x| elem = i.elements[x] @@ -243,22 +243,22 @@ EOR assert_equal(instance_eval(x), elem.text) end end - + def test_textinput about = "http://hoge.com" title = "fugafuga" link = "http://hoge.com/fuga" name = "foo" description = "hogehogehoge" - + textinput = RDF::Textinput.new(about) %w(title link name description).each do |x| textinput.__send__("#{x}=", instance_eval(x)) end - + doc = REXML::Document.new(make_RDF(textinput.to_s)) t = doc.root.elements[1] - + assert_equal(about, t.attributes["about"]) %w(title link name description).each do |x| elem = t.elements[x] diff --git a/test/rss/test_2.0.rb b/test/rss/test_2.0.rb index 5a63efbcb9..884afcc816 100644 --- a/test/rss/test_2.0.rb +++ b/test/rss/test_2.0.rb @@ -8,28 +8,28 @@ module RSS def setup @rss_version = "2.0" end - + def test_Rss version = "1.0" encoding = "UTF-8" standalone = false - + rss = Rss.new(@rss_version, version, encoding, standalone) setup_rss20(rss) - + doc = REXML::Document.new(rss.to_s(false)) - + xmldecl = doc.xml_decl - + %w(version encoding).each do |x| assert_equal(instance_eval(x), xmldecl.__send__(x)) end assert_equal(standalone, !xmldecl.standalone.nil?) - + assert_equal("", doc.root.namespace) assert_equal(@rss_version, doc.root.attributes["version"]) end - + def test_not_displayed_xml_stylesheets rss = Rss.new(@rss_version) plain_rss = rss.to_s @@ -38,7 +38,7 @@ module RSS assert_equal(plain_rss, rss.to_s) end end - + def test_xml_stylesheets [ [{:href => "a.xsl", :type => "text/xsl"}], @@ -57,7 +57,7 @@ module RSS title = "fugafuga" link = "http://hoge.com" description = "fugafugafugafuga" - + language = "en-us" copyright = "Copyright 2002, Spartanburg Herald-Journal" managingEditor = "geo@herald.com (George Matesky)" @@ -81,7 +81,7 @@ module RSS rating = '(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" for "http://www.rsac.org" on "1996.04.16T08:15-0500" r (n 0 s 0 v 0 l 0))' channel = Rss::Channel.new - + elems = %w(title link description language copyright managingEditor webMaster pubDate lastBuildDate generator docs ttl rating) @@ -94,10 +94,10 @@ module RSS channel.categories << Rss::Channel::Category.new(cat[:domain], cat[:content]) end - + doc = REXML::Document.new(make_rss20(channel.to_s)) c = doc.root.elements[1] - + elems.each do |x| elem = c.elements[x] assert_equal(x, elem.name) @@ -139,10 +139,10 @@ module RSS cloud_params[:registerProcedure], cloud_params[:protocol]) cloud_params[:port] = cloud.port - + doc = REXML::Document.new(cloud.to_s) cloud_elem = doc.root - + actual = {} cloud_elem.attributes.each do |name, value| value = value.to_i if name == "port" @@ -169,7 +169,7 @@ module RSS doc = REXML::Document.new(image.to_s) image_elem = doc.root - + image_params.each do |name, value| value = image.__send__(name) actual = image_elem.elements[name.to_s].text @@ -177,7 +177,7 @@ module RSS assert_equal(value, actual) end end - + def test_channel_textInput textInput_params = { :title => "fugafuga", @@ -192,13 +192,13 @@ module RSS doc = REXML::Document.new(textInput.to_s) input_elem = doc.root - + textInput_params.each do |name, value| actual = input_elem.elements[name.to_s].text assert_equal(value, actual) end end - + def test_channel_skip_days skipDays_values = [ "Sunday", @@ -208,15 +208,15 @@ module RSS skipDays_values.each do |value| skipDays.days << Rss::Channel::SkipDays::Day.new(value) end - + doc = REXML::Document.new(skipDays.to_s) days_elem = doc.root - + skipDays_values.each_with_index do |value, i| assert_equal(value, days_elem.elements[i + 1].text) end end - + def test_channel_skip_hours skipHours_values = [ "0", @@ -229,7 +229,7 @@ module RSS doc = REXML::Document.new(skipHours.to_s) hours_elem = doc.root - + skipHours_values.each_with_index do |value, i| expected = skipHours.hours[i].content assert_equal(expected, hours_elem.elements[i + 1].text.to_i) @@ -260,7 +260,7 @@ module RSS item = Rss::Channel::Item.new channel.items << item - + elems = %w(title link description author comments pubDate) elems.each do |x| value = instance_eval(x) @@ -271,7 +271,7 @@ module RSS item.categories << Rss::Channel::Category.new(cat[:domain], cat[:content]) end - + doc = REXML::Document.new(channel.to_s) channel_elem = doc.root @@ -311,7 +311,7 @@ module RSS enclosure_params[:length], enclosure_params[:type]) enclosure_params[:length] = enclosure.length - + doc = REXML::Document.new(enclosure.to_s) enclosure_elem = doc.root @@ -322,7 +322,7 @@ module RSS end assert_equal(enclosure_params, actual) end - + def test_item_guid test_params = [ { @@ -345,10 +345,10 @@ module RSS else assert_equal(guid.isPermaLink, guid.PermaLink?) end - + doc = REXML::Document.new(guid.to_s) guid_elem = doc.root - + actual = {} actual[:content] = guid_elem.text if guid_elem.text guid_elem.attributes.each do |name, value| @@ -358,7 +358,7 @@ module RSS assert_equal(guid_params, actual) end end - + def test_item_source source_params = { :url => "http://www.tomalak.org/links2.xml", @@ -370,7 +370,7 @@ module RSS doc = REXML::Document.new(source.to_s) source_elem = doc.root - + actual = {} actual[:content] = source_elem.text source_elem.attributes.each do |name, value| diff --git a/test/rss/test_accessor.rb b/test/rss/test_accessor.rb index ceb31fc9c2..f2b8508a6d 100644 --- a/test/rss/test_accessor.rb +++ b/test/rss/test_accessor.rb @@ -11,11 +11,11 @@ module RSS channel = Rss::Channel.new channel.pubDate = nil assert_nil(channel.pubDate) - + time = Time.now channel.pubDate = time assert_equal(time, channel.pubDate) - + time = Time.parse(Time.now.rfc822) channel.pubDate = time.rfc822 assert_equal(time, channel.pubDate) @@ -25,35 +25,35 @@ module RSS assert_not_available_value("pubDate", value) do channel.pubDate = value end - + channel.do_validate = false time = Time.parse(Time.now.iso8601) value = time.iso8601 channel.pubDate = value assert_equal(time, channel.pubDate) - + channel.pubDate = nil assert_nil(channel.pubDate) end - + def test_integer image_item = RDF::Item::ImageItem.new image_item.width = nil assert_nil(image_item.width) - + width = 10 image_item.width = width assert_equal(width, image_item.width) - + width = 10.0 image_item.width = width assert_equal(width, image_item.width) - + width = "10" image_item.width = width assert_equal(width.to_i, image_item.width) - + width = "10.0" assert_not_available_value("image:width", width) do image_item.width = width @@ -63,29 +63,29 @@ module RSS width = "10.0" image_item.width = width assert_equal(width.to_i, image_item.width) - + image_item.width = nil assert_nil(image_item.width) end - + def test_positive_integer channel = RDF::Channel.new channel.sy_updateFrequency = nil assert_nil(channel.sy_updateFrequency) - + freq = 10 channel.sy_updateFrequency = freq assert_equal(freq, channel.sy_updateFrequency) - + freq = 10.0 channel.sy_updateFrequency = freq assert_equal(freq, channel.sy_updateFrequency) - + freq = "10" channel.sy_updateFrequency = freq assert_equal(freq.to_i, channel.sy_updateFrequency) - + freq = "10.0" assert_not_available_value("sy:updateFrequency", freq) do channel.sy_updateFrequency = freq @@ -95,7 +95,7 @@ module RSS freq = "10.0" channel.sy_updateFrequency = freq assert_equal(freq.to_i, channel.sy_updateFrequency) - + channel.sy_updateFrequency = nil assert_nil(channel.sy_updateFrequency) end diff --git a/test/rss/test_content.rb b/test/rss/test_content.rb index 02db59186b..f59b0c8e83 100644 --- a/test/rss/test_content.rb +++ b/test/rss/test_content.rb @@ -10,15 +10,15 @@ module RSS def setup @prefix = "content" @uri = "http://purl.org/rss/1.0/modules/content/" - + @elems = { :encoded => "<em>ATTENTION</em>", } - + @content_nodes = @elems.collect do |name, value| "<#{@prefix}:#{name}>#{CGI.escapeHTML(value.to_s)}</#{@prefix}:#{name}>" end.join("\n") - + @rss10_source = make_RDF(<<-EOR, {@prefix => @uri}) #{make_channel()} #{make_image()} @@ -79,7 +79,7 @@ EOR end end end - + def test_to_s @elems.each do |name, value| excepted = make_element("#{@prefix}:#{name}", {}, value) diff --git a/test/rss/test_maker_0.9.rb b/test/rss/test_maker_0.9.rb index f397f92646..61b272d130 100644 --- a/test/rss/test_maker_0.9.rb +++ b/test/rss/test_maker_0.9.rb @@ -16,20 +16,20 @@ module RSS assert_raise(LocalJumpError) do RSS::Maker.make("0.91") end - + rss = RSS::Maker.make("0.9") do |maker| setup_dummy_channel(maker) setup_dummy_image(maker) end assert_equal("0.92", rss.rss_version) - + rss = RSS::Maker.make("0.91") do |maker| setup_dummy_channel(maker) setup_dummy_image(maker) end assert_equal("0.91", rss.rss_version) - + rss = RSS::Maker.make("0.91") do |maker| setup_dummy_channel(maker) setup_dummy_image(maker) @@ -112,7 +112,7 @@ module RSS maker.image.title = image_title end channel = rss.channel - + assert_equal(title, channel.title) assert_equal(link, channel.link) assert_equal(description, channel.description) @@ -132,7 +132,7 @@ module RSS skipHours.each_with_index do |hour, i| assert_equal(hour.to_i, channel.skipHours.hours[i].content) end - + assert(channel.items.empty?) assert_equal(image_url, channel.image.url) @@ -185,7 +185,7 @@ module RSS end end end - + def test_image title = "fugafuga" link = "http://hoge.com" @@ -197,7 +197,7 @@ module RSS rss = RSS::Maker.make("0.91") do |maker| setup_dummy_channel(maker) maker.channel.link = link - + maker.image.title = title maker.image.url = url maker.image.width = width @@ -216,7 +216,7 @@ module RSS RSS::Maker.make("0.91") do |maker| # setup_dummy_channel(maker) maker.channel.link = link - + maker.image.title = title maker.image.url = url maker.image.width = width @@ -252,7 +252,7 @@ module RSS setup_dummy_channel(maker) # maker.channel.link = link maker.channel.link = nil - + maker.image.title = title maker.image.url = url maker.image.width = width @@ -274,7 +274,7 @@ module RSS end end end - + def test_items(with_convenience_way=true) title = "TITLE" link = "http://hoge.com/" @@ -288,7 +288,7 @@ module RSS rss = RSS::Maker.make("0.91") do |maker| setup_dummy_channel(maker) - + maker.items.new_item do |item| item.title = title item.link = link @@ -307,7 +307,7 @@ module RSS item_size = 5 rss = RSS::Maker.make("0.91") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |_item| _item.title = "#{title}#{i}" @@ -328,7 +328,7 @@ module RSS rss = RSS::Maker.make("0.91") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |_item| _item.title = "#{title}#{i}" @@ -391,7 +391,7 @@ module RSS end end end - + def test_not_valid_textInput title = "fugafuga" description = "text hoge fuga" diff --git a/test/rss/test_maker_1.0.rb b/test/rss/test_maker_1.0.rb index bee3206a3a..ab6f6ade6b 100644 --- a/test/rss/test_maker_1.0.rb +++ b/test/rss/test_maker_1.0.rb @@ -19,7 +19,7 @@ module RSS setup_dummy_item(maker) end assert_equal("1.0", rss.rss_version) - + rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) maker.encoding = "EUC-JP" @@ -137,8 +137,8 @@ module RSS end end end - - + + def test_image title = "fugafuga" link = "http://hoge.com" @@ -147,7 +147,7 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) maker.channel.link = link - + maker.image.title = title maker.image.url = url @@ -164,7 +164,7 @@ module RSS RSS::Maker.make("1.0") do |maker| # setup_dummy_channel(maker) maker.channel.link = link - + maker.image.title = title maker.image.url = url end @@ -179,7 +179,7 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) maker.channel.link = link - + # maker.image.url = url maker.image.title = title @@ -191,7 +191,7 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) maker.channel.link = link - + maker.image.url = url # maker.image.title = title @@ -205,7 +205,7 @@ module RSS setup_dummy_channel(maker) # maker.channel.link = link maker.channel.link = nil - + maker.image.url = url maker.image.title = title @@ -227,7 +227,7 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + maker.items.new_item do |item| item.title = title item.link = link @@ -241,11 +241,11 @@ module RSS assert_equal(link, item.link) assert_nil(item.description) - + item_size = 5 rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |_item| _item.title = "#{title}#{i}" @@ -265,7 +265,7 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |_item| _item.title = "#{title}#{i}" @@ -292,7 +292,7 @@ module RSS max_size = item_size / 2 rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |_item| _item.title = "#{title}#{i}" @@ -329,7 +329,7 @@ module RSS max_size = -2 rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |_item| _item.title = "#{title}#{i}" @@ -398,7 +398,7 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + maker.textinput.link = link maker.textinput.title = title maker.textinput.description = description @@ -425,7 +425,7 @@ module RSS end end end - + def test_not_valid_textinput title = "fugafuga" description = "text hoge fuga" @@ -447,7 +447,7 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + maker.textinput.link = link # maker.textinput.title = title maker.textinput.description = description @@ -460,7 +460,7 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + maker.textinput.link = link maker.textinput.title = title # maker.textinput.description = description @@ -473,7 +473,7 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + maker.textinput.link = link maker.textinput.title = title maker.textinput.description = description diff --git a/test/rss/test_maker_2.0.rb b/test/rss/test_maker_2.0.rb index 9fe6543dd9..7285f11a72 100644 --- a/test/rss/test_maker_2.0.rb +++ b/test/rss/test_maker_2.0.rb @@ -13,15 +13,15 @@ module RSS assert_raise(LocalJumpError) do RSS::Maker.make("2.0") end - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) end assert_equal("2.0", rss.rss_version) - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) - + maker.encoding = "EUC-JP" end assert_equal("2.0", rss.rss_version) @@ -29,7 +29,7 @@ module RSS rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) - + maker.standalone = "yes" end assert_equal("2.0", rss.rss_version) @@ -37,7 +37,7 @@ module RSS rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) - + maker.encoding = "EUC-JP" maker.standalone = "yes" end @@ -72,7 +72,7 @@ module RSS ] generator = "RSS Maker" ttl = "60" - + rss = RSS::Maker.make("2.0") do |maker| maker.channel.title = title maker.channel.link = link @@ -96,18 +96,18 @@ module RSS new_hour.content = hour end end - + categories.each do |category| maker.channel.categories.new_category do |new_category| new_category.content = category end end - + maker.channel.generator = generator maker.channel.ttl = ttl end channel = rss.channel - + assert_equal(title, channel.title) assert_equal(link, channel.link) assert_equal(description, channel.description) @@ -127,11 +127,11 @@ module RSS skipHours.each_with_index do |hour, i| assert_equal(hour.to_i, channel.skipHours.hours[i].content) end - + channel.categories.each_with_index do |category, i| assert_equal(categories[i], category.content) end - + assert_equal(generator, channel.generator) assert_equal(ttl.to_i, channel.ttl) @@ -145,7 +145,7 @@ module RSS link = "http://hoge.com" description = "fugafugafugafuga" language = "ja" - + assert_not_set_error("maker.channel", %w(title)) do RSS::Maker.make("2.0") do |maker| # maker.channel.title = title @@ -182,7 +182,7 @@ module RSS assert_not_nil(rss) end - + def test_cloud domain = "rpc.sys.com" port = "80" @@ -206,7 +206,7 @@ module RSS assert_equal(registerProcedure, cloud.registerProcedure) assert_equal(protocol, cloud.protocol) end - + def test_not_valid_cloud domain = "rpc.sys.com" port = "80" @@ -269,7 +269,7 @@ module RSS end assert_nil(rss.channel.cloud) end - + def test_image title = "fugafuga" @@ -282,7 +282,7 @@ module RSS rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) maker.channel.link = link - + maker.image.title = title maker.image.url = url maker.image.width = width @@ -301,7 +301,7 @@ module RSS RSS::Maker.make("2.0") do |maker| # setup_dummy_channel(maker) maker.channel.link = link - + maker.image.title = title maker.image.url = url maker.image.width = width @@ -322,7 +322,7 @@ module RSS rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) maker.channel.link = link - + # maker.image.title = title maker.image.url = url maker.image.width = width @@ -336,7 +336,7 @@ module RSS setup_dummy_channel(maker) # maker.channel.link = link maker.channel.link = nil - + maker.image.title = title maker.image.url = url maker.image.width = width @@ -348,7 +348,7 @@ module RSS rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) maker.channel.link = link - + maker.image.title = title # maker.image.url = url maker.image.width = width @@ -357,7 +357,7 @@ module RSS end assert_nil(rss.image) end - + def test_items(with_convenience_way=true) title = "TITLE" link = "http://hoge.com/" @@ -374,7 +374,7 @@ module RSS item_size = 5 rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |item| item.title = "#{title}#{i}" @@ -400,7 +400,7 @@ module RSS rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |item| item.title = "#{title}#{i}" @@ -467,7 +467,7 @@ module RSS def test_guid isPermaLink = "true" content = "http://inessential.com/2002/09/01.php#a2" - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -483,7 +483,7 @@ module RSS def test_not_valid_guid content = "http://inessential.com/2002/09/01.php#a2" - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -493,12 +493,12 @@ module RSS end assert_nil(rss.channel.items.last.guid) end - + def test_enclosure url = "http://www.scripting.com/mp3s/weatherReportSuite.mp3" length = "12216320" type = "audio/mpeg" - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -518,7 +518,7 @@ module RSS url = "http://www.scripting.com/mp3s/weatherReportSuite.mp3" length = "12216320" type = "audio/mpeg" - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -529,7 +529,7 @@ module RSS enclosure.type = type end assert_nil(rss.channel.items.last.enclosure) - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -540,7 +540,7 @@ module RSS enclosure.type = type end assert_nil(rss.channel.items.last.enclosure) - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -557,7 +557,7 @@ module RSS def test_source url = "http://static.userland.com/tomalak/links2.xml" content = "Tomalak's Realm" - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -574,7 +574,7 @@ module RSS def test_not_valid_source url = "http://static.userland.com/tomalak/links2.xml" content = "Tomalak's Realm" - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -584,7 +584,7 @@ module RSS source.content = content end assert_nil(rss.channel.items.last.source) - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -595,11 +595,11 @@ module RSS end assert_nil(rss.channel.items.last.source) end - + def test_category domain = "http://www.fool.com/cusips" content = "MSFT" - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -616,7 +616,7 @@ module RSS def test_not_valid_category content = "Grateful Dead" - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) setup_dummy_item(maker) @@ -627,7 +627,7 @@ module RSS end assert(rss.channel.items.last.categories.empty?) end - + def test_textInput title = "fugafuga" description = "text hoge fuga" @@ -659,7 +659,7 @@ module RSS end end end - + def test_not_valid_textInput title = "fugafuga" description = "text hoge fuga" @@ -678,7 +678,7 @@ module RSS rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) - + maker.textinput.title = title # maker.textinput.description = description maker.textinput.name = name @@ -688,7 +688,7 @@ module RSS rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) - + maker.textinput.title = title maker.textinput.description = description # maker.textinput.name = name @@ -698,7 +698,7 @@ module RSS rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) - + maker.textinput.title = title maker.textinput.description = description maker.textinput.name = name diff --git a/test/rss/test_maker_content.rb b/test/rss/test_maker_content.rb index 53750bb095..393adcb715 100644 --- a/test/rss/test_maker_content.rb +++ b/test/rss/test_maker_content.rb @@ -7,7 +7,7 @@ module RSS def setup @uri = "http://purl.org/rss/1.0/modules/content/" - + @elements = { :encoded => "<em>ATTENTION</em>", } diff --git a/test/rss/test_maker_dc.rb b/test/rss/test_maker_dc.rb index 72a967231a..626ec8d753 100644 --- a/test/rss/test_maker_dc.rb +++ b/test/rss/test_maker_dc.rb @@ -7,12 +7,12 @@ module RSS def setup @uri = "http://purl.org/dc/elements/1.1/" - + t = Time.iso8601("2000-01-01T12:00:05+00:00") class << t alias_method(:to_s, :iso8601) end - + @elements = { :title => "hoge", :description => @@ -103,7 +103,7 @@ module RSS def test_date t1 = Time.iso8601("2000-01-01T12:00:05+00:00") t2 = Time.iso8601("2005-01-01T12:00:05+00:00") - + rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) maker.channel.date = t1 @@ -121,7 +121,7 @@ module RSS assert_equal([t1, t2], rss.channel.dc_dates.collect{|x| x.value}) assert_equal([t2, t1], rss.items.last.dc_dates.collect{|x| x.value}) end - + private def accessor_name(name) "dc_#{name}" diff --git a/test/rss/test_maker_image.rb b/test/rss/test_maker_image.rb index 1fc8076c46..4fba2cf795 100644 --- a/test/rss/test_maker_image.rb +++ b/test/rss/test_maker_image.rb @@ -39,7 +39,7 @@ module RSS setup_dummy_textinput(maker) end - + setup_rss = RSS::Maker.make("1.0") do |maker| rss.setup_maker(maker) end @@ -49,7 +49,7 @@ module RSS assert_equal(@favicon_infos["about"], favicon.about) assert_equal(@favicon_infos["image_size"], favicon.image_size) assert_equal(@favicon_infos["dc_title"], favicon.dc_title) - + item = target.items.last.image_item assert_equal(@item_infos["about"], item.about) assert_equal(@item_infos["resource"], item.resource) diff --git a/test/rss/test_maker_sy.rb b/test/rss/test_maker_sy.rb index 309a3b70fd..3f026b5c9c 100644 --- a/test/rss/test_maker_sy.rb +++ b/test/rss/test_maker_sy.rb @@ -7,12 +7,12 @@ module RSS def setup @uri = "http://purl.org/rss/1.0/modules/syndication/" - + t = Time.iso8601("2000-01-01T12:00:05+00:00") class << t alias_method(:to_s, :iso8601) end - + @elements = { :updatePeriod => "hourly", :updateFrequency => "2", diff --git a/test/rss/test_maker_taxo.rb b/test/rss/test_maker_taxo.rb index 8feb4e1d33..c5cf18adc1 100644 --- a/test/rss/test_maker_taxo.rb +++ b/test/rss/test_maker_taxo.rb @@ -7,7 +7,7 @@ module RSS def setup @uri = "http://purl.org/rss/1.0/modules/taxonomy/" - + @resources = [ "http://meerkat.oreillynet.com/?c=cat23", "http://meerkat.oreillynet.com/?c=47", @@ -52,7 +52,7 @@ module RSS def _test_date t1 = Time.iso8601("2000-01-01T12:00:05+00:00") t2 = Time.iso8601("2005-01-01T12:00:05+00:00") - + rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) maker.channel.date = t1 @@ -70,7 +70,7 @@ module RSS assert_equal([t1, t2], rss.channel.dc_dates.collect{|x| x.value}) assert_equal([t2, t1], rss.items.last.dc_dates.collect{|x| x.value}) end - + private def set_topics(target, resources=@resources) resources.each do |value| diff --git a/test/rss/test_maker_trackback.rb b/test/rss/test_maker_trackback.rb index 58705c6f80..d9fe2ad01d 100644 --- a/test/rss/test_maker_trackback.rb +++ b/test/rss/test_maker_trackback.rb @@ -7,7 +7,7 @@ module RSS def setup @uri = "http://madskills.com/public/xml/rss/module/trackback/" - + @elements = { :ping => "http://bar.com/tb.cgi?tb_id=rssplustrackback", :abouts => [ diff --git a/test/rss/test_maker_xml-stylesheet.rb b/test/rss/test_maker_xml-stylesheet.rb index 81d97ddc0e..c1dd6f71ed 100644 --- a/test/rss/test_maker_xml-stylesheet.rb +++ b/test/rss/test_maker_xml-stylesheet.rb @@ -35,7 +35,7 @@ module RSS assert_equal(charset, xss.charset) assert_equal(alternate, xss.alternate) - + href = 'http://example.com/index.xsl' type = 'text/xsl' rss = RSS::Maker.make("1.0") do |maker| @@ -55,7 +55,7 @@ module RSS def test_not_valid_xml_stylesheet href = 'xss.XXX' type = "text/xsl" - + rss = RSS::Maker.make("1.0") do |maker| maker.xml_stylesheets.new_xml_stylesheet do |xss| # xss.href = href @@ -78,6 +78,6 @@ module RSS end assert(rss.xml_stylesheets.empty?) end - + end end diff --git a/test/rss/test_parser_1.0.rb b/test/rss/test_parser_1.0.rb index 216881b767..ddc82b157d 100644 --- a/test/rss/test_parser_1.0.rb +++ b/test/rss/test_parser_1.0.rb @@ -484,7 +484,7 @@ EOR assert_not_expected_tag(name, uri, "image") do Parser.parse(rss, true, false) end - + uri = CONTENT_URI name = "encoded" elem = "<#{name} xmlns='#{uri}'/>" diff --git a/test/rss/test_setup_maker_0.9.rb b/test/rss/test_setup_maker_0.9.rb index c20186cc8a..0bcb0cbdc9 100644 --- a/test/rss/test_setup_maker_0.9.rb +++ b/test/rss/test_setup_maker_0.9.rb @@ -64,7 +64,7 @@ module RSS setup_dummy_image(maker) end channel = new_rss.channel - + assert_equal(title, channel.title) assert_equal(link, channel.link) assert_equal(description, channel.description) @@ -99,19 +99,19 @@ module RSS rss = RSS::Maker.make("0.91") do |maker| setup_dummy_channel(maker) maker.channel.link = link - + maker.image.title = title maker.image.url = url maker.image.width = width maker.image.height = height maker.image.description = description end - + new_rss = RSS::Maker.make("0.91") do |maker| rss.channel.setup_maker(maker) rss.image.setup_maker(maker) end - + image = new_rss.image assert_equal(title, image.title) assert_equal(link, image.link) @@ -120,7 +120,7 @@ module RSS assert_equal(height.to_i, image.height) assert_equal(description, image.description) end - + def test_setup_maker_textinput title = "fugafuga" description = "text hoge fuga" @@ -142,7 +142,7 @@ module RSS rss.image.setup_maker(maker) rss.textinput.setup_maker(maker) end - + textInput = new_rss.channel.textInput assert_equal(title, textInput.title) assert_equal(description, textInput.description) @@ -156,10 +156,10 @@ module RSS description = "text hoge fuga" item_size = 5 - + rss = RSS::Maker.make("0.91") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |item| item.title = "#{title}#{i}" @@ -170,7 +170,7 @@ module RSS setup_dummy_image(maker) end - + new_rss = RSS::Maker.make("0.91") do |maker| rss.channel.setup_maker(maker) @@ -196,11 +196,11 @@ module RSS def test_setup_maker_items_backward_compatibility test_setup_maker_items(true) end - + def test_setup_maker encoding = "EUC-JP" standalone = true - + href = 'a.xsl' type = 'text/xsl' title = 'sample' @@ -228,7 +228,7 @@ module RSS new_rss = RSS::Maker.make("0.91") do |maker| rss.setup_maker(maker) end - + assert_equal("0.91", new_rss.rss_version) assert_equal(encoding, new_rss.encoding) assert_equal(standalone, new_rss.standalone) diff --git a/test/rss/test_setup_maker_1.0.rb b/test/rss/test_setup_maker_1.0.rb index 0b960d91c8..9f7bb1c1e8 100644 --- a/test/rss/test_setup_maker_1.0.rb +++ b/test/rss/test_setup_maker_1.0.rb @@ -10,7 +10,7 @@ module RSS class << t alias_method(:to_s, :iso8601) end - + @dc_elems = { :title => "hoge", :description => @@ -39,7 +39,7 @@ module RSS @content_elems = { :encoded => "<em>ATTENTION</em>", } - + @trackback_elems = { :ping => "http://bar.com/tb.cgi?tb_id=rssplustrackback", :about => [ @@ -67,7 +67,7 @@ module RSS }, ] end - + def test_setup_maker_channel about = "http://hoge.com" title = "fugafuga" @@ -79,7 +79,7 @@ module RSS maker.channel.title = title maker.channel.link = link maker.channel.description = description - + @dc_elems.each do |var, value| maker.channel.__send__("dc_#{var}=", value) end @@ -98,7 +98,7 @@ module RSS end end channel = new_rss.channel - + assert_equal(about, channel.about) assert_equal(title, channel.title) assert_equal(link, channel.link) @@ -110,23 +110,23 @@ module RSS @dc_elems.each do |var, value| assert_equal(value, channel.__send__("dc_#{var}")) end - + @sy_elems.each do |var, value| value = value.to_i if var == :updateFrequency assert_equal(value, channel.__send__("sy_#{var}")) end - + end def test_setup_maker_image title = "fugafuga" link = "http://hoge.com" url = "http://hoge.com/hoge.png" - + rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) maker.channel.link = link - + maker.image.title = title maker.image.url = url @@ -136,7 +136,7 @@ module RSS setup_dummy_item(maker) end - + new_rss = RSS::Maker.make("1.0") do |maker| rss.channel.setup_maker(maker) rss.image.setup_maker(maker) @@ -144,7 +144,7 @@ module RSS item.setup_maker(maker) end end - + image = new_rss.image assert_equal(url, image.about) assert_equal(url, new_rss.channel.image.resource) @@ -156,7 +156,7 @@ module RSS assert_equal(image.__send__("dc_#{var}"), value) end end - + def test_setup_maker_textinput title = "fugafuga" description = "text hoge fuga" @@ -165,7 +165,7 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + maker.textinput.link = link maker.textinput.title = title maker.textinput.description = description @@ -177,7 +177,7 @@ module RSS setup_dummy_item(maker) end - + new_rss = RSS::Maker.make("1.0") do |maker| rss.channel.setup_maker(maker) rss.textinput.setup_maker(maker) @@ -185,7 +185,7 @@ module RSS item.setup_maker(maker) end end - + textinput = new_rss.textinput assert_equal(link, textinput.about) assert_equal(link, new_rss.channel.textinput.resource) @@ -205,10 +205,10 @@ module RSS description = "text hoge fuga" item_size = 5 - + rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |item| item.title = "#{title}#{i}" @@ -232,7 +232,7 @@ module RSS end end end - + new_rss = RSS::Maker.make("1.0") do |maker| rss.channel.setup_maker(maker) @@ -244,7 +244,7 @@ module RSS end end end - + assert_equal(item_size, new_rss.items.size) new_rss.items.each_with_index do |item, i| assert_equal("#{link}#{i}", item.about) @@ -255,11 +255,11 @@ module RSS @dc_elems.each do |var, value| assert_equal(item.__send__("dc_#{var}"), value) end - + @content_elems.each do |var, value| assert_equal(item.__send__("content_#{var}"), value) end - + assert_equal(@trackback_elems[:ping], item.trackback_ping) assert_equal(@trackback_elems[:about].size, item.trackback_abouts.size) item.trackback_abouts.each_with_index do |about, j| @@ -274,10 +274,10 @@ module RSS description = "text hoge fuga" item_size = 5 - + rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| item = RSS::RDF::Item.new("#{link}#{i}") item.title = "#{title}#{i}" @@ -296,10 +296,10 @@ module RSS assert_equal("#{description}#{i}", item.description) end - + rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| item = RSS::RDF::Item.new("#{link}#{i}") item.title = "#{title}#{i}" @@ -322,11 +322,11 @@ module RSS def test_setup_maker_items_backward_compatibility test_setup_maker_items(true) end - + def test_setup_maker encoding = "EUC-JP" standalone = true - + href = 'a.xsl' type = 'text/xsl' title = 'sample' @@ -350,11 +350,11 @@ module RSS setup_dummy_channel(maker) setup_dummy_item(maker) end - + new_rss = RSS::Maker.make("1.0") do |maker| rss.setup_maker(maker) end - + assert_equal("1.0", new_rss.rss_version) assert_equal(encoding, new_rss.encoding) assert_equal(standalone, new_rss.standalone) @@ -372,7 +372,7 @@ module RSS def test_setup_maker_full encoding = "EUC-JP" standalone = true - + href = 'a.xsl' type = 'text/xsl' title = 'sample' @@ -387,18 +387,18 @@ module RSS image_title = "fugafuga" image_url = "http://hoge.com/hoge.png" - + textinput_title = "fugafuga" textinput_description = "text hoge fuga" textinput_name = "hoge" textinput_link = "http://hoge.com" - + item_title = "TITLE" item_link = "http://hoge.com/" item_description = "text hoge fuga" item_size = 5 - + rss = RSS::Maker.make("1.0") do |maker| maker.encoding = encoding maker.standalone = standalone @@ -422,13 +422,13 @@ module RSS @sy_elems.each do |var, value| maker.channel.__send__("sy_#{var}=", value) end - + maker.image.title = image_title maker.image.url = image_url @dc_elems.each do |var, value| maker.image.__send__("dc_#{var}=", value) end - + maker.textinput.link = textinput_link maker.textinput.title = textinput_title maker.textinput.description = textinput_description @@ -436,7 +436,7 @@ module RSS @dc_elems.each do |var, value| maker.textinput.__send__("dc_#{var}=", value) end - + item_size.times do |i| maker.items.new_item do |item| item.title = "#{item_title}#{i}" @@ -462,11 +462,11 @@ module RSS setup_taxo_topic(maker, @taxo_topic_elems) end - + new_rss = RSS::Maker.make("1.0") do |maker| rss.setup_maker(maker) end - + assert_equal("1.0", new_rss.rss_version) assert_equal(encoding, new_rss.encoding) assert_equal(standalone, new_rss.standalone) @@ -509,7 +509,7 @@ module RSS @dc_elems.each do |var, value| assert_equal(image.__send__("dc_#{var}"), value) end - + textinput = new_rss.textinput assert_equal(textinput_link, textinput.about) assert_equal(textinput_link, new_rss.channel.textinput.resource) @@ -531,11 +531,11 @@ module RSS @dc_elems.each do |var, value| assert_equal(item.__send__("dc_#{var}"), value) end - + @content_elems.each do |var, value| assert_equal(item.__send__("content_#{var}"), value) end - + assert_equal(@trackback_elems[:ping], item.trackback_ping) assert_equal(@trackback_elems[:about].size, item.trackback_abouts.size) item.trackback_abouts.each_with_index do |about, j| @@ -545,6 +545,6 @@ module RSS assert_taxo_topic(@taxo_topic_elems, new_rss) end - + end end diff --git a/test/rss/test_setup_maker_2.0.rb b/test/rss/test_setup_maker_2.0.rb index 8fb727de8d..17a066a8a0 100644 --- a/test/rss/test_setup_maker_2.0.rb +++ b/test/rss/test_setup_maker_2.0.rb @@ -62,7 +62,7 @@ module RSS new_category.content = category end end - + maker.channel.generator = generator maker.channel.ttl = ttl end @@ -71,7 +71,7 @@ module RSS rss.channel.setup_maker(maker) end channel = new_rss.channel - + assert_equal(title, channel.title) assert_equal(link, channel.link) assert_equal(description, channel.description) @@ -90,12 +90,12 @@ module RSS skipHours.each_with_index do |hour, i| assert_equal(hour.to_i, channel.skipHours.hours[i].content) end - + channel.categories.each_with_index do |category, i| assert_equal(categories[i], category.content) end - + assert_equal(generator, channel.generator) assert_equal(ttl.to_i, channel.ttl) @@ -116,19 +116,19 @@ module RSS rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) maker.channel.link = link - + maker.image.title = title maker.image.url = url maker.image.width = width maker.image.height = height maker.image.description = description end - + new_rss = RSS::Maker.make("2.0") do |maker| rss.channel.setup_maker(maker) rss.image.setup_maker(maker) end - + image = new_rss.image assert_equal(title, image.title) assert_equal(link, image.link) @@ -137,7 +137,7 @@ module RSS assert_equal(height.to_i, image.height) assert_equal(description, image.description) end - + def test_setup_maker_textinput title = "fugafuga" description = "text hoge fuga" @@ -157,7 +157,7 @@ module RSS rss.channel.setup_maker(maker) rss.textinput.setup_maker(maker) end - + textInput = new_rss.channel.textInput assert_equal(title, textInput.title) assert_equal(description, textInput.description) @@ -175,22 +175,22 @@ module RSS guid_isPermaLink = "true" guid_content = "http://inessential.com/2002/09/01.php#a2" - + enclosure_url = "http://www.scripting.com/mp3s/weatherReportSuite.mp3" enclosure_length = "12216320" enclosure_type = "audio/mpeg" source_url = "http://static.userland.com/tomalak/links2.xml" source_content = "Tomalak's Realm" - + category_domain = "http://www.fool.com/cusips" category_content = "MSFT" - + item_size = 5 - + rss = RSS::Maker.make("2.0") do |maker| setup_dummy_channel(maker) - + item_size.times do |i| maker.items.new_item do |item| item.title = "#{title}#{i}" @@ -216,7 +216,7 @@ module RSS end end end - + new_rss = RSS::Maker.make("2.0") do |maker| rss.channel.setup_maker(maker) @@ -228,7 +228,7 @@ module RSS end end end - + assert_equal(item_size, new_rss.items.size) new_rss.items.each_with_index do |item, i| assert_equal("#{title}#{i}", item.title) @@ -258,11 +258,11 @@ module RSS def test_setup_maker_items_backward_compatibility test_setup_maker_items(true) end - + def test_setup_maker encoding = "EUC-JP" standalone = true - + href = 'a.xsl' type = 'text/xsl' title = 'sample' @@ -285,11 +285,11 @@ module RSS setup_dummy_channel(maker) end - + new_rss = RSS::Maker.make("2.0") do |maker| rss.setup_maker(maker) end - + assert_equal("2.0", new_rss.rss_version) assert_equal(encoding, new_rss.encoding) assert_equal(standalone, new_rss.standalone) @@ -303,6 +303,6 @@ module RSS assert_equal(charset, xss.charset) assert_equal(alternate, xss.alternate) end - + end end diff --git a/test/rss/test_setup_maker_atom_feed.rb b/test/rss/test_setup_maker_atom_feed.rb index 03d33dbb9c..978b3cf123 100644 --- a/test/rss/test_setup_maker_atom_feed.rb +++ b/test/rss/test_setup_maker_atom_feed.rb @@ -299,7 +299,7 @@ module RSS def test_setup_maker encoding = "EUC-JP" standalone = true - + href = 'a.xsl' type = 'text/xsl' title = 'sample' diff --git a/test/rss/test_syndication.rb b/test/rss/test_syndication.rb index abd75e905e..69d6f44464 100644 --- a/test/rss/test_syndication.rb +++ b/test/rss/test_syndication.rb @@ -8,28 +8,28 @@ require "rss/syndication" module RSS class TestSyndication < TestCase - + def setup @prefix = "sy" @uri = "http://purl.org/rss/1.0/modules/syndication/" - + @parents = %w(channel) - + t = Time.iso8601("2000-01-01T12:00:05+00:00") class << t alias_method(:to_s, :iso8601) end - + @elems = { :updatePeriod => "hourly", :updateFrequency => "2", :updateBase => t, } - + @sy_nodes = @elems.collect do |name, value| "<#{@prefix}:#{name}>#{CGI.escapeHTML(value.to_s)}</#{@prefix}:#{name}>" end.join("\n") - + @rss_source = make_RDF(<<-EOR, {@prefix => @uri}) #{make_channel(@sy_nodes)} #{make_image()} @@ -39,13 +39,13 @@ EOR @rss = Parser.parse(@rss_source) end - + def test_parser - + assert_nothing_raised do Parser.parse(@rss_source) end - + @elems.each do |tag, value| assert_too_much_tag(tag.to_s, "channel") do Parser.parse(make_RDF(<<-EOR, {@prefix => @uri})) @@ -58,20 +58,20 @@ EOR end end - + def test_accessor - + t = Time.iso8601("2003-01-01T12:00:23+09:00") class << t alias_method(:to_s, :iso8601) end - + new_value = { :updatePeriod => "daily", :updateFrequency => "11", :updateBase => t, } - + @elems.each do |name, value| value = value.to_i if name == :updateFrequency @parents.each do |parent| @@ -82,7 +82,7 @@ EOR assert_equal(new_val, @rss.__send__(parent).__send__("sy_#{name}")) end end - + %w(hourly daily weekly monthly yearly).each do |x| @parents.each do |parent| assert_nothing_raised do @@ -90,7 +90,7 @@ EOR end end end - + %w(-2 0.3 -0.4).each do |x| @parents.each do |parent| assert_not_available_value("sy:updateBase", x) do @@ -98,11 +98,11 @@ EOR end end end - + end def test_to_s - + @elems.each do |name, value| excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>" @parents.each do |parent| @@ -110,7 +110,7 @@ EOR @rss.__send__(parent).__send__("sy_#{name}_element")) end end - + REXML::Document.new(@rss_source).root.each_element do |parent| if @parents.include?(parent.name) parent.each_element do |elem| diff --git a/test/rss/test_taxonomy.rb b/test/rss/test_taxonomy.rb index 5109f3d892..0370555d87 100644 --- a/test/rss/test_taxonomy.rb +++ b/test/rss/test_taxonomy.rb @@ -8,7 +8,7 @@ require "rss/taxonomy" module RSS class TestTaxonomy < TestCase - + def setup @prefix = "taxo" @uri = "http://purl.org/rss/1.0/modules/taxonomy/" @@ -19,9 +19,9 @@ module RSS @prefix => @uri, @dc_prefix => @dc_uri, } - + @topics_parents = %w(channel item) - + @topics_lis = [ "http://meerkat.oreillynet.com/?c=cat23", "http://meerkat.oreillynet.com/?c=47", @@ -81,7 +81,7 @@ module RSS end rv << "</#{@prefix}:topic>" end - + @rss_source = make_RDF(<<-EOR, @ns) #{make_channel(@topics_node)} #{make_image()} @@ -97,7 +97,7 @@ EOR assert_nothing_raised do Parser.parse(@rss_source) end - + assert_too_much_tag("topics", "channel") do Parser.parse(make_RDF(<<-EOR, @ns)) #{make_channel(@topics_node * 2)} @@ -112,7 +112,7 @@ EOR EOR end end - + def test_accessor topics = @rss.channel.taxo_topics assert_equal(@topics_lis.sort, @@ -136,7 +136,7 @@ EOR end end end - + def test_to_s @topics_parents.each do |parent| meth = "taxo_topics_element" diff --git a/test/rss/test_to_s.rb b/test/rss/test_to_s.rb index 66739591ea..4b38737bef 100644 --- a/test/rss/test_to_s.rb +++ b/test/rss/test_to_s.rb @@ -19,7 +19,7 @@ module RSS "http://example.com/1", "http://example.com/2", ] - + setup_xml_declaration_info setup_xml_stylesheet_infos setup_channel_info @@ -57,7 +57,7 @@ module RSS assert_image10(@image_info, rss.image) assert_textinput10(@textinput_info, rss.textinput) end - + def test_to_s_09 rss = RSS::Maker.make("0.91") do |maker| setup_full(maker) @@ -79,7 +79,7 @@ module RSS assert_image09(@image_info, rss.image) assert_textinput09(@textinput_info, rss.textinput) end - + def test_to_s_20 rss = RSS::Maker.make("2.0") do |maker| setup_full(maker) @@ -101,7 +101,7 @@ module RSS assert_image20(@image_info, rss.image) assert_textinput20(@textinput_info, rss.textinput) end - + private def setup_xml_declaration_info @version = "1.0" @@ -278,13 +278,13 @@ module RSS "updateBase" => Time.now - 3600, } end - + def setup_content_info @content_info = { "encoded" => "<p>p</p>", } end - + def setup_trackback_info @trackback_info = { "ping" => "http://example.com/tb.cgi?tb_id=XXX", @@ -323,7 +323,7 @@ module RSS def setup_channel(maker) channel = maker.channel info = @channel_info - + %w(about title link description language copyright managingEditor webMaster rating docs date lastBuildDate generator ttl).each do |name| @@ -341,7 +341,7 @@ module RSS new_hour = skipHours.new_hour new_hour.content = hour end - + cloud = channel.cloud %w(domain port path registerProcedure protocol).each do |name| cloud.__send__("#{name}=", info["cloud"][name]) @@ -352,7 +352,7 @@ module RSS category.__send__("#{name}=", info["category"][name]) end end - + def setup_image(maker) image = maker.image info = @image_info @@ -361,7 +361,7 @@ module RSS image.__send__("#{name}=", info[name]) end end - + def setup_items(maker) items = maker.items @@ -370,7 +370,7 @@ module RSS %w(title link description date author comments).each do |name| item.__send__("#{name}=", info[name]) end - + guid = item.guid %w(isPermaLink content).each do |name| guid.__send__("#{name}=", info["guid"][name]) @@ -410,7 +410,7 @@ module RSS target.__send__("#{prefix}_#{name}=", @content_info[name]) end end - + def setup_dublin_core(target) prefix = "dc" %w(title description creator subject publisher @@ -419,14 +419,14 @@ module RSS target.__send__("#{prefix}_#{name}=", @dc_info[name]) end end - + def setup_syndicate(target) prefix = "sy" %w(updatePeriod updateFrequency updateBase).each do |name| target.__send__("#{prefix}_#{name}=", @sy_info[name]) end end - + def setup_trackback(target) target.trackback_ping = @trackback_info["ping"] @trackback_info["abouts"].each do |about| @@ -439,7 +439,7 @@ module RSS def assert_channel10(attrs, channel) _wrap_assertion do n_attrs = normalized_attrs(attrs) - + names = %w(about title link description) assert_attributes(attrs, names, channel) @@ -458,7 +458,7 @@ module RSS assert_attributes(attrs, %w(resource), image) end end - + def assert_channel10_textinput(attrs, textinput) _wrap_assertion do assert_attributes(attrs, %w(resource), textinput) @@ -506,7 +506,7 @@ module RSS copyright pubDate lastBuildDate docs managingEditor webMaster) assert_attributes(attrs, names, channel) - + %w(skipHours skipDays).each do |name| value = n_attrs[name] if value @@ -525,7 +525,7 @@ module RSS end end end - + def assert_channel09_skipHours(contents, skipHours) _wrap_assertion do hours = skipHours.hours @@ -534,7 +534,7 @@ module RSS end end end - + def assert_image09(attrs, image) _wrap_assertion do names = %w(url link title description) @@ -552,7 +552,7 @@ module RSS end end end - + def assert_textinput09(attrs, textinput) _wrap_assertion do names = %w(title description name link) @@ -564,7 +564,7 @@ module RSS def assert_channel20(attrs, channel) _wrap_assertion do n_attrs = normalized_attrs(attrs) - + names = %w(title link description language copyright managingEditor webMaster pubDate lastBuildDate generator docs rating) @@ -584,11 +584,11 @@ module RSS def assert_channel20_skipDays(contents, skipDays) assert_channel09_skipDays(contents, skipDays) end - + def assert_channel20_skipHours(contents, skipHours) assert_channel09_skipHours(contents, skipHours) end - + def assert_channel20_cloud(attrs, cloud) _wrap_assertion do names = %w(domain path registerProcedure protocol) @@ -596,7 +596,7 @@ module RSS assert_attributes(attrs, names, cloud) end end - + def assert_channel20_categories(attrs, categories) _wrap_assertion do names = %w(domain content) @@ -605,7 +605,7 @@ module RSS end end end - + def assert_image20(attrs, image) _wrap_assertion do names = %w(url link title description) @@ -639,20 +639,20 @@ module RSS assert_attributes(attrs, %w(url content), source) end end - + def assert_items20_enclosure(attrs, enclosure) _wrap_assertion do names = ["url", ["length", :integer], "type"] assert_attributes(attrs, names, enclosure) end end - + def assert_items20_categories(attrs, categories) _wrap_assertion do assert_channel20_categories(attrs, categories) end end - + def assert_items20_guid(attrs, guid) _wrap_assertion do names = [["isPermaLink", :boolean], ["content"]] diff --git a/test/rss/test_trackback.rb b/test/rss/test_trackback.rb index 26812d9010..433e884deb 100644 --- a/test/rss/test_trackback.rb +++ b/test/rss/test_trackback.rb @@ -9,26 +9,26 @@ require "rss/trackback" module RSS class TestTrackBack < TestCase - + def setup @prefix = "trackback" @uri = "http://madskills.com/public/xml/rss/module/trackback/" - + @parents = %w(item) - + @elems = { :ping => "http://bar.com/tb.cgi?tb_id=rssplustrackback", :about => "http://foo.com/trackback/tb.cgi?tb_id=20020923", } - + @content_nodes = @elems.collect do |name, value| "<#{@prefix}:#{name} rdf:resource=\"#{CGI.escapeHTML(value.to_s)}\"/>" end.join("\n") - + @content_nodes2 = @elems.collect do |name, value| "<#{@prefix}:#{name}>#{CGI.escapeHTML(value.to_s)}</#{@prefix}:#{name}>" end.join("\n") - + @rss_source = make_RDF(<<-EOR, {@prefix => @uri}) #{make_channel()} #{make_image()} @@ -77,14 +77,14 @@ EOR end end - + def test_accessor - + new_value = { :ping => "http://baz.com/trackback/tb.cgi?tb_id=20030808", :about => "http://hoge.com/trackback/tb.cgi?tb_id=90030808", } - + @elems.each do |name, value| @parents.each do |parent| accessor = "#{RSS::TRACKBACK_PREFIX}_#{name}" @@ -104,11 +104,11 @@ EOR assert_equal(new_value[name], target20.__send__(accessor)) end end - + end def test_to_s - + @elems.each do |name, value| excepted = %Q!<#{@prefix}:#{name} rdf:resource="#{CGI.escapeHTML(value)}"/>! @parents.each do |parent| @@ -117,7 +117,7 @@ EOR assert_equal(excepted, @rss.__send__(parent).__send__(meth)) end end - + REXML::Document.new(@rss_source).root.each_element do |parent| if @parents.include?(parent.name) parent.each_element do |elem| @@ -127,9 +127,9 @@ EOR end end end - + end - + end end diff --git a/test/rss/test_xml-stylesheet.rb b/test/rss/test_xml-stylesheet.rb index b946af1294..cc19a38287 100644 --- a/test/rss/test_xml-stylesheet.rb +++ b/test/rss/test_xml-stylesheet.rb @@ -7,7 +7,7 @@ require "rss/xml-stylesheet" module RSS class TestXMLStyleSheet < TestCase - + def test_accessor [ {:href => "a.xsl", :type => "text/xsl"}, @@ -17,7 +17,7 @@ module RSS assert_xml_stylesheet_attrs(attrs, XMLStyleSheet.new(attrs)) end end - + def test_to_s [ {:href => "a.xsl", :type => "text/xsl"}, @@ -39,7 +39,7 @@ module RSS assert_xml_stylesheet(target, attrs, XMLStyleSheet.new(contents)) end end - + def test_bad_alternate %w(a ___ ??? BAD_ALTERNATE).each do |value| xss = XMLStyleSheet.new @@ -53,7 +53,7 @@ module RSS assert_nil(xss.alternate) end end - + def test_parse [ [{:href => "a.xsl", :type => "text/xsl"},], @@ -92,7 +92,7 @@ module RSS end end end - + def parse_pi(pi) /\A\s*<\?(\S+)([^(?:\?>)]+)\?>\s*\z/ =~ pi target = $1 @@ -103,6 +103,6 @@ module RSS end [target, contents] end - + end end diff --git a/test/ruby/allpairs.rb b/test/ruby/allpairs.rb index 393d0c3288..6cb2729b19 100644 --- a/test/ruby/allpairs.rb +++ b/test/ruby/allpairs.rb @@ -26,7 +26,7 @@ module AllPairs yield row } } - end + end def combine_block(tbl1, tbl2) result = [] @@ -49,7 +49,7 @@ module AllPairs tbl = [] make_basic_block(v) {|row| tbl << row - } + } tbls = [tbl] while tbl.first.length ** 2 < prime tbl = combine_block(tbl, tbl) diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index 4aba8a0bde..6900d03b70 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -4,7 +4,7 @@ require "timeout" module EnvUtil def rubybin unless ENV["RUBYOPT"] - + end if ruby = ENV["RUBY"] return ruby diff --git a/test/ruby/marshaltestlib.rb b/test/ruby/marshaltestlib.rb index 4486a78429..5da7ad95dc 100644 --- a/test/ruby/marshaltestlib.rb +++ b/test/ruby/marshaltestlib.rb @@ -290,7 +290,7 @@ module MarshalTestLib class MyStruct def ==(rhs) return true if __id__ == rhs.__id__ - return false unless rhs.is_a?(::Struct) + return false unless rhs.is_a?(::Struct) return false if self.class != rhs.class members.each do |member| return false if self.__send__(member) != rhs.__send__(member) @@ -483,7 +483,7 @@ module MarshalTestLib class MyStruct2 def ==(rhs) return true if __id__ == rhs.__id__ - return false unless rhs.is_a?(::Struct) + return false unless rhs.is_a?(::Struct) return false if self.class != rhs.class members.each do |member| return false if self.__send__(member) != rhs.__send__(member) diff --git a/test/ruby/test_alias.rb b/test/ruby/test_alias.rb index d72fe702af..10fd8f1112 100644 --- a/test/ruby/test_alias.rb +++ b/test/ruby/test_alias.rb @@ -45,7 +45,7 @@ class TestAlias < Test::Unit::TestCase assert_equal "foo", x.bar assert_raise(NoMethodError) { x.quux } end - + class C def m $SAFE diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index d21cad0851..92c309241f 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -125,27 +125,27 @@ class TestArray < Test::Unit::TestCase def test_beg_end_0 x = [1, 2, 3, 4, 5] - + assert_equal(1, x.first) assert_equal([1], x.first(1)) assert_equal([1, 2, 3], x.first(3)) - + assert_equal(5, x.last) assert_equal([5], x.last(1)) assert_equal([3, 4, 5], x.last(3)) - + assert_equal(1, x.shift) assert_equal([2, 3, 4], x.shift(3)) assert_equal([5], x) - + assert_equal([2, 3, 4, 5], x.unshift(2, 3, 4)) assert_equal([1, 2, 3, 4, 5], x.unshift(1)) assert_equal([1, 2, 3, 4, 5], x) - + assert_equal(5, x.pop) assert_equal([3, 4], x.pop(2)) assert_equal([1, 2], x) - + assert_equal([1, 2, 3, 4], x.push(3, 4)) assert_equal([1, 2, 3, 4, 5], x.push(5)) assert_equal([1, 2, 3, 4, 5], x) @@ -318,7 +318,7 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[10, 11, 12], a[9..11]) assert_equal(@cls[10, 11, 12], a[-91..-89]) - + assert_nil(a[10, -3]) # Ruby 1.8 feature change: # Array#[size..x] returns [] instead of nil. @@ -487,7 +487,7 @@ class TestArray < Test::Unit::TestCase a = @cls[ 1, 'cat', 1..1 ] assert_equal([ Fixnum, String, Range], a.collect! {|e| e.class} ) assert_equal([ Fixnum, String, Range], a) - + a = @cls[ 1, 'cat', 1..1 ] assert_equal([ 99, 99, 99], a.collect! { 99 } ) assert_equal([ 99, 99, 99], a) @@ -535,7 +535,7 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[1, 2, 3, 4], @cls[1, 2, 3, 4].concat(@cls[])) assert_equal(@cls[], @cls[].concat(@cls[])) assert_equal(@cls[@cls[1, 2], @cls[3, 4]], @cls[@cls[1, 2]].concat(@cls[@cls[3, 4]])) - + a = @cls[1, 2, 3] a.concat(a) assert_equal([1, 2, 3, 1, 2, 3], a) @@ -708,7 +708,7 @@ class TestArray < Test::Unit::TestCase a5 = @cls[ a1, @cls[], a3 ] assert_equal(@cls[1, 2, 3, 4, 5, 6], a5.flatten) assert_equal(@cls[], @cls[].flatten) - assert_equal(@cls[], + assert_equal(@cls[], @cls[@cls[@cls[@cls[],@cls[]],@cls[@cls[]],@cls[]],@cls[@cls[@cls[]]]].flatten) assert_raise(TypeError, "[ruby-dev:31197]") { [[]].flatten("") } @@ -734,7 +734,7 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[1, 2, 3, 4, 5, 6], a5) assert_equal(@cls[], @cls[].flatten) - assert_equal(@cls[], + assert_equal(@cls[], @cls[@cls[@cls[@cls[],@cls[]],@cls[@cls[]],@cls[]],@cls[@cls[@cls[]]]].flatten) end @@ -839,7 +839,7 @@ class TestArray < Test::Unit::TestCase a = @cls[ 1, 'cat', 1..1 ] assert_equal(@cls[ Fixnum, String, Range], a.map! {|e| e.class} ) assert_equal(@cls[ Fixnum, String, Range], a) - + a = @cls[ 1, 'cat', 1..1 ] assert_equal(@cls[ 99, 99, 99], a.map! { 99 } ) assert_equal(@cls[ 99, 99, 99], a) @@ -880,11 +880,11 @@ class TestArray < Test::Unit::TestCase assert_equal("ABC", @cls[ 65, 66, 67 ].pack("c3")) assert_equal("\377BC", @cls[ -1, 66, 67 ].pack("c*")) - + assert_equal("AB\n\x10", @cls["4142", "0a", "12"].pack("H4H2H1")) assert_equal("AB\n\x02", @cls["1424", "a0", "21"].pack("h4h2h1")) - assert_equal("abc=02def=\ncat=\n=01=\n", + assert_equal("abc=02def=\ncat=\n=01=\n", @cls["abc\002def", "cat", "\001"].pack("M9M3M4")) assert_equal("aGVsbG8K\n", @cls["hello\n"].pack("m")) @@ -1086,7 +1086,7 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[10, 11, 12], a.slice(9..11)) assert_equal(@cls[10, 11, 12], a.slice(-91..-89)) - + assert_nil(a.slice(-101..-1)) assert_nil(a.slice(10, -3)) @@ -1144,7 +1144,7 @@ class TestArray < Test::Unit::TestCase a.fill(1) assert_equal(@cls[1, 1, 1, 1], a.sort) - + assert_equal(@cls[], @cls[].sort) end @@ -1302,7 +1302,7 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[[1,1],[1,2],[2,1],[2,2]], @cls[1,2].product([1,2])) assert_equal(@cls[[1,3,5],[1,3,6],[1,4,5],[1,4,6], - [2,3,5],[2,3,6],[2,4,5],[2,4,6]], + [2,3,5],[2,3,6],[2,4,5],[2,4,6]], @cls[1,2].product([3,4],[5,6])) assert_equal(@cls[[1],[2]], @cls[1,2].product) assert_equal(@cls[], @cls[1,2].product([])) diff --git a/test/ruby/test_basicinstructions.rb b/test/ruby/test_basicinstructions.rb index 6ac93e037a..b3145be8b5 100644 --- a/test/ruby/test_basicinstructions.rb +++ b/test/ruby/test_basicinstructions.rb @@ -7,7 +7,7 @@ class Class end class TestBasicInstructions < Test::Unit::TestCase - + def test_immediates assert_equal((1==1), true) assert_equal((1==2), false) @@ -30,7 +30,7 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal false, (self == nil) assert_equal false, (self == 0) end - + def test_string expected = "str" + "ing" assert_equal expected, 'string' @@ -55,14 +55,14 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal :sym, :"#{s}" assert_equal :sym, :"#{"#{"#{s}"}"}" end - + def test_xstr assert_equal 'hoge', `echo hoge`.chomp assert_equal '3', `echo #{1 + 2}`.chomp hoge = 'huga' assert_equal 'huga', `echo #{hoge}`.chomp end - + def test_regexp assert_equal /test/, /test/ assert_equal 'test', /test/.source @@ -108,7 +108,7 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal 'c', a[2] assert_nil a[3] end - + def test_hash assert_equal({}, {}) assert_equal({1=>2}, {1=>2}) @@ -127,7 +127,7 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal((1...3), (1...2+1)) assert_equal(('a'..'z'), ('a'..'z')) end - + def test_not assert_equal true, !nil assert_equal true, !false diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index 0f1d18a8e5..031efdd7d1 100644 --- a/test/ruby/test_econv.rb +++ b/test/ruby/test_econv.rb @@ -22,7 +22,7 @@ class TestEncodingConverter < Test::Unit::TestCase def assert_errinfo(e_res, e_enc1, e_enc2, e_error_bytes, e_readagain_bytes, ec) assert_equal([e_res, e_enc1, e_enc2, - e_error_bytes && e_error_bytes.dup.force_encoding("ASCII-8BIT"), + e_error_bytes && e_error_bytes.dup.force_encoding("ASCII-8BIT"), e_readagain_bytes && e_readagain_bytes.dup.force_encoding("ASCII-8BIT")], ec.primitive_errinfo) end @@ -450,13 +450,13 @@ class TestEncodingConverter < Test::Unit::TestCase def test_errinfo_invalid_euc_jp ec = Encoding::Converter.new("EUC-JP", "Shift_JIS") - ec.primitive_convert(src="\xff", dst="", nil, 10) + ec.primitive_convert(src="\xff", dst="", nil, 10) assert_errinfo(:invalid_byte_sequence, "EUC-JP", "Shift_JIS", "\xFF", "", ec) end def test_errinfo_invalid_euc_jp2 ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") - ec.primitive_convert(src="\xff", dst="", nil, 10) + ec.primitive_convert(src="\xff", dst="", nil, 10) assert_errinfo(:invalid_byte_sequence, "EUC-JP", "UTF-8", "\xFF", "", ec) end @@ -504,7 +504,7 @@ class TestEncodingConverter < Test::Unit::TestCase assert_equal(nil, ec.insert_output("\xA1\xA1".force_encoding("EUC-JP"))) ec.primitive_convert("", dst, nil, 10, :partial_input=>true) - assert_equal("\e$B!!\e(B???\e$B!\"!!".force_encoding("ISO-2022-JP"), dst) + assert_equal("\e$B!!\e(B???\e$B!\"!!".force_encoding("ISO-2022-JP"), dst) ec.primitive_convert(src="\xa1\xa3", dst, nil, 10, :partial_input=>true) assert_equal("\e$B!!\e(B???\e$B!\"!!!\#".force_encoding("ISO-2022-JP"), dst) @@ -722,9 +722,9 @@ class TestEncodingConverter < Test::Unit::TestCase end def test_econv_new_hash - ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace) + ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace) assert_equal("a ? b", ec.convert("a \u3042 b")) - ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace, :replace => "X") + ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace, :replace => "X") assert_equal("a X b", ec.convert("a \u3042 b")) end diff --git a/test/ruby/test_encoding.rb b/test/ruby/test_encoding.rb index 9f48d30d1d..6e442b564b 100644 --- a/test/ruby/test_encoding.rb +++ b/test/ruby/test_encoding.rb @@ -14,7 +14,7 @@ class TestEncoding < Test::Unit::TestCase assert_equal(e, Encoding.find(e.name.downcase)) end end - + def test_enc_names aliases = Encoding.aliases aliases.each do |a, en| @@ -32,7 +32,7 @@ class TestEncoding < Test::Unit::TestCase assert_raise(TypeError) { e.dup } assert_raise(TypeError) { e.clone } assert_equal(e.object_id, Marshal.load(Marshal.dump(e)).object_id) - end + end end def test_find diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 2f4b0bfbbd..6dd40bed84 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -204,7 +204,7 @@ class TestEval < Test::Unit::TestCase end end - # + # # From ruby/test/ruby/test_eval.rb # diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index 536d358dd0..6d64ccf72b 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -137,7 +137,7 @@ class TestFiber < Test::Unit::TestCase end def test_tls - # + # def tvar(var, val) old = Thread.current[var] begin diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index d9fe5505fe..7ed2abb563 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -34,7 +34,7 @@ class TestFileExhaustive < Test::Unit::TestCase def make_file(content, file = @file) open(file, "w") {|fh| fh << content } end - + def make_tmp_filename(prefix) @hardlinkfile = @dir + "/" + prefix + File.basename(__FILE__) + ".#{$$}.test" end diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 42b249d0dc..1bd3df4c1a 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -10,7 +10,7 @@ class TestGc < Test::Unit::TestCase def test_gc prev_stress = GC.stress GC.stress = false - + assert_nothing_raised do 1.upto(10000) { tmp = [0,1,2,3,4,5,6,7,8,9] diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 06f3b7c6e5..77084f216f 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -113,7 +113,7 @@ class TestHash < Test::Unit::TestCase assert_instance_of(@cls, h) assert_equal('default', h.default) assert_equal('default', h['spurious']) - + end def test_AREF # '[]' @@ -539,7 +539,7 @@ class TestHash < Test::Unit::TestCase def test_shift h = @h.dup - + @h.length.times { k, v = h.shift assert(@h.key?(k)) diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 678a74a1d0..91da8c03c1 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1195,13 +1195,13 @@ class TestIO < Test::Unit::TestCase def test_sysopen t = make_tempfile - + fd = IO.sysopen(t.path) assert_kind_of(Integer, fd) f = IO.for_fd(fd) assert_equal("foo\nbar\nbaz\n", f.read) f.close - + fd = IO.sysopen(t.path, "w", 0666) assert_kind_of(Integer, fd) if defined?(Fcntl::F_GETFL) @@ -1211,7 +1211,7 @@ class TestIO < Test::Unit::TestCase end f.write("FOO\n") f.close - + fd = IO.sysopen(t.path, "r") assert_kind_of(Integer, fd) f = IO.for_fd(fd) @@ -1360,7 +1360,7 @@ class TestIO < Test::Unit::TestCase def test_initialize t = make_tempfile - + fd = IO.sysopen(t.path, "w") assert_kind_of(Integer, fd) f = IO.new(fd, "w") @@ -1374,7 +1374,7 @@ class TestIO < Test::Unit::TestCase f.instance_eval { initialize } end end - + def test_new_with_block assert_in_out_err([], "r, w = IO.pipe; IO.new(r) {}", [], /^.+$/) end diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 71299181ec..ce942a8528 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -576,7 +576,7 @@ EOT with_pipe(enc) {|r, w| w << "\xc2\xa1" w.close - s = r.getc + s = r.getc assert_equal(enc, s.encoding) } } @@ -897,7 +897,7 @@ EOT STDIN.reopen(io) STDIN.external_encoding STDIN.write "\u3042" - STDIN.flush + STDIN.flush End Process.wait pid f.rewind @@ -1360,7 +1360,7 @@ EOT } content = File.read("t", :mode=>"rb:ascii-8bit") assert_equal(expected.dup.force_encoding("ascii-8bit"), - content.force_encoding("ascii-8bit")) + content.force_encoding("ascii-8bit")) } end diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 2f435f645a..efdc20c186 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -960,8 +960,8 @@ class TestM17N < Test::Unit::TestCase end def test_sub2 - s = "\x80".force_encoding("ASCII-8BIT") - r = Regexp.new("\x80".force_encoding("ASCII-8BIT")) + s = "\x80".force_encoding("ASCII-8BIT") + r = Regexp.new("\x80".force_encoding("ASCII-8BIT")) s2 = s.sub(r, "") assert(s2.empty?) assert(s2.ascii_only?) diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb index 7d6794292b..2d43a56ab2 100644 --- a/test/ruby/test_m17n_comb.rb +++ b/test/ruby/test_m17n_comb.rb @@ -709,7 +709,7 @@ class TestM17NComb < Test::Unit::TestCase def test_str_chomp combination(STRINGS, STRINGS) {|s1, s2| if !s1.ascii_only? && !s2.ascii_only? && !Encoding.compatible?(s1,s2) - if s1.bytesize > s2.bytesize + if s1.bytesize > s2.bytesize assert_raise(Encoding::CompatibilityError) { s1.chomp(s2) } end next diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index e1f7299636..37336a08a6 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -100,7 +100,7 @@ class TestModule < Test::Unit::TestCase def AClass.cm3 "cm3" end - + private_class_method :cm1, "cm3" def aClass diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index e5c9b77ac1..5dc3caf561 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -20,7 +20,7 @@ class TestParse < Test::Unit::TestCase END assert_equal(42, x) end - + def test_alias_backref assert_raise(SyntaxError) do eval <<-END @@ -193,7 +193,7 @@ class TestParse < Test::Unit::TestCase class foo; end END end - + assert_raise(SyntaxError) do eval <<-END def foo @@ -350,7 +350,7 @@ class TestParse < Test::Unit::TestCase def test_words assert_equal([], %W( )) end - + def test_dstr @@foo = 1 assert_equal("foo 1 bar", "foo #@@foo bar") diff --git a/test/ruby/test_primitive.rb b/test/ruby/test_primitive.rb index 8ffbe549d6..46133eff8c 100644 --- a/test/ruby/test_primitive.rb +++ b/test/ruby/test_primitive.rb @@ -1,7 +1,7 @@ require 'test/unit' class TestRubyPrimitive < Test::Unit::TestCase - + def test_not assert_equal false, !true assert_equal true, !false @@ -143,7 +143,7 @@ class TestRubyPrimitive < Test::Unit::TestCase assert_equal 7, ($test_ruby_primitive_gvar = 7) assert_equal 7, ($test_ruby_primitive_gvar = 7) end - + class A7 @@c = 1 def m @@ -184,7 +184,7 @@ class TestRubyPrimitive < Test::Unit::TestCase assert_equal 3, A9.m assert_equal 4, A9.m end - + class A10 attr_accessor :a end @@ -257,7 +257,7 @@ class TestRubyPrimitive < Test::Unit::TestCase h[0] &&= 1 assert_equal 1, h[0] end - + def test_backref /a(b)(c)d/ =~ 'xyzabcdefgabcdefg' assert_equal 'b', $1 diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 8322fb1722..cb0548ba66 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -177,7 +177,7 @@ class TestProc < Test::Unit::TestCase b = proc { :foo } assert_equal(:foo, b.curry[]) end - + def test_curry_ski_fib s = proc {|f, g, x| f[x][g[x]] }.curry k = proc {|x, y| x }.curry @@ -292,7 +292,7 @@ class TestProc < Test::Unit::TestCase b2 = b1.dup assert(b1 == b2) end - + def test_to_proc b = proc { :foo } assert_equal(:foo, b.to_proc.call) @@ -687,7 +687,7 @@ class TestProc < Test::Unit::TestCase assert_equal([[:opt, :a], [:rest, :b], [:opt, :c], [:block, :d]], proc {|a, *b, c, &d|}.parameters) assert_equal([[:opt, :a], [:opt, :b], [:rest, :c], [:opt, :d], [:block, :e]], proc {|a, b=:b, *c, d, &e|}.parameters) assert_equal([[:opt, nil], [:block, :b]], proc {|(a), &b|}.parameters) - assert_equal([[:opt, :a], [:opt, :b], [:opt, :c], [:opt, :d], [:rest, :e], [:opt, :f], [:opt, :g], [:block, :h]], proc {|a,b,c=:c,d=:d,*e,f,g,&h|}.parameters) + assert_equal([[:opt, :a], [:opt, :b], [:opt, :c], [:opt, :d], [:rest, :e], [:opt, :f], [:opt, :g], [:block, :h]], proc {|a,b,c=:c,d=:d,*e,f,g,&h|}.parameters) end def pm0() end diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 793771017e..7058834fa6 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -467,9 +467,9 @@ class TestProcess < Test::Unit::TestCase assert_equal("errout", File.read("out")) Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", - STDOUT=>"out", + STDOUT=>"out", STDERR=>[:child, 3], - 3=>[:child, 4], + 3=>[:child, 4], 4=>[:child, STDOUT] ) assert_equal("errout", File.read("out")) diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index bf3861e74d..ee9c2144f3 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -22,7 +22,7 @@ class TestString < Test::Unit::TestCase def test_s_new assert_equal("RUBY", S("RUBY")) end - + def test_AREF # '[]' assert_equal("A", S("AooBar")[0]) assert_equal("B", S("FooBaB")[-1]) @@ -224,7 +224,7 @@ class TestString < Test::Unit::TestCase assert_equal(10, S("FeeFieFoo-Fum") =~ /Fum$/) assert_equal(nil, S("FeeFieFoo-Fum") =~ /FUM$/) - pre_1_7_1 do + pre_1_7_1 do $= = true assert_equal(10, S("FeeFieFoo-Fum") =~ /FUM$/) $= = false @@ -279,7 +279,7 @@ class TestString < Test::Unit::TestCase def test_VERY_EQUAL # '===' # assert_equal(true, S("foo") === :foo) casetest(S("abcdef"), S("abcdef")) - + pre_1_7_1 do $= = true casetest(S("CAT"), S('cat')) @@ -317,7 +317,7 @@ class TestString < Test::Unit::TestCase b = a.dup assert_equal(S("Hello"), a.capitalize!) assert_equal(S("hello"), b) - + end def test_center @@ -551,7 +551,7 @@ class TestString < Test::Unit::TestCase a.taint if taint a.untrust if untrust a.freeze if frozen - b = a.dup + b = a.dup assert_equal(a, b) assert(a.__id__ != b.__id__) @@ -560,7 +560,7 @@ class TestString < Test::Unit::TestCase assert_equal(a.untrusted?, b.untrusted?) end end - end + end end def test_each @@ -570,12 +570,12 @@ class TestString < Test::Unit::TestCase S("hello\nworld").lines.each {|x| res << x} assert_equal(S("hello\n"), res[0]) assert_equal(S("world"), res[1]) - + res=[] S("hello\n\n\nworld").lines(S('')).each {|x| res << x} assert_equal(S("hello\n\n\n"), res[0]) assert_equal(S("world"), res[1]) - + $/ = "!" res=[] S("hello!world").lines.each {|x| res << x} @@ -604,14 +604,14 @@ class TestString < Test::Unit::TestCase S("hello\n\n\nworld").lines(S('')).each {|x| res << x} assert_equal(S("hello\n\n\n"), res[0]) assert_equal(S("world"), res[1]) - + $/ = "!" res=[] S("hello!world").lines.each {|x| res << x} assert_equal(S("hello!"), res[0]) assert_equal(S("world"), res[1]) - + $/ = save s = nil @@ -635,7 +635,7 @@ class TestString < Test::Unit::TestCase assert_equal(S("h<e>ll<o>"), S("hello").gsub(/([aeiou])/, S('<\1>'))) assert_equal(S("h e l l o "), S("hello").gsub(/./) { |s| s[0].to_s + S(' ')}) - assert_equal(S("HELL-o"), + assert_equal(S("HELL-o"), S("hello").gsub(/(hell)(.)/) { |s| $1.upcase + S('-') + $2 }) a = S("hello") @@ -672,8 +672,8 @@ class TestString < Test::Unit::TestCase r.taint r.untrust a.gsub!(/./, r) - assert(a.tainted?) - assert(a.untrusted?) + assert(a.tainted?) + assert(a.untrusted?) a = S("hello") assert_nil(a.sub!(S('X'), S('Y'))) @@ -983,12 +983,12 @@ class TestString < Test::Unit::TestCase assert_nil( a.slice!(6) ) else assert_raise(IndexError) { a.slice!(6) } - end + end assert_equal(S("FooBar"), a) if @aref_slicebang_silent - assert_nil( a.slice!(-7) ) - else + assert_nil( a.slice!(-7) ) + else assert_raise(IndexError) { a.slice!(-7) } end assert_equal(S("FooBar"), a) @@ -1239,8 +1239,8 @@ class TestString < Test::Unit::TestCase r.taint r.untrust a.sub!(/./, r) - assert(a.tainted?) - assert(a.untrusted?) + assert(a.tainted?) + assert(a.untrusted?) end def test_succ @@ -1494,7 +1494,7 @@ class TestString < Test::Unit::TestCase assert_equal([ 65, 66, 67 ], S("ABC").unpack("c3")) assert_equal([ -1, 66, 67 ], S("\377BC").unpack("c*")) - + assert_equal([S("4142"), S("0a"), S("1")], S("AB\n\x10").unpack(S("H4H2H1"))) assert_equal([S("1424"), S("a0"), S("2")], S("AB\n\x02").unpack(S("h4h2h1"))) @@ -1659,7 +1659,7 @@ class TestString < Test::Unit::TestCase end def test_respond_to - o = Object.new + o = Object.new def o.respond_to?(arg) [:to_str].include?(arg) ? nil : super end def o.to_str() "" end def o.==(other) "" == other end diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index a19a78e605..f402da3907 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -69,7 +69,7 @@ class TestSymbol < Test::Unit::TestCase end def test_inspect_number - # 5) Inconsistency between :$0 and :$1? The first one is valid, but the + # 5) Inconsistency between :$0 and :$1? The first one is valid, but the # latter isn't. assert_inspect_evaled(':$0') assert_inspect_evaled(':$1') diff --git a/test/ruby/test_trace.rb b/test/ruby/test_trace.rb index 48294c9694..45bc599314 100644 --- a/test/ruby/test_trace.rb +++ b/test/ruby/test_trace.rb @@ -7,15 +7,15 @@ class TestTrace < Test::Unit::TestCase trace_var :$x, proc{$y = $x} $x = 40414 assert_equal($x, $y) - + untrace_var :$x $x = 19660208 assert_not_equal($x, $y) - + trace_var :$x, proc{$x *= 2} $x = 5 assert_equal(10, $x) - + untrace_var :$x end diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index b61d3d39db..0a4db06160 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -105,7 +105,7 @@ class TestTranscode < Test::Unit::TestCase all_ascii = (0..127).to_a.pack 'C*' encodings.each do |enc| test_start = all_ascii - assert_equal(test_start, test_start.encode('UTF-8',enc).encode(enc).force_encoding('ASCII-8BIT')) + assert_equal(test_start, test_start.encode('UTF-8',enc).encode(enc).force_encoding('ASCII-8BIT')) end end @@ -126,7 +126,7 @@ class TestTranscode < Test::Unit::TestCase all_bytes = (0..255).to_a.pack 'C*' encodings_8859.each do |enc| test_start = all_bytes - assert_equal(test_start, test_start.encode('UTF-8',enc).encode(enc).force_encoding('ASCII-8BIT')) + assert_equal(test_start, test_start.encode('UTF-8',enc).encode(enc).force_encoding('ASCII-8BIT')) end end @@ -224,7 +224,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u0153", "\x9C", 'windows-1252') # Å“ assert_raise(Encoding::UndefinedConversionError) { "\x9D".encode("utf-8", 'windows-1252') } check_both_ways("\u017E", "\x9E", 'windows-1252') # ž - check_both_ways("\u00A0", "\xA0", 'windows-1252') # non-breaking space + check_both_ways("\u00A0", "\xA0", 'windows-1252') # non-breaking space check_both_ways("\u00AF", "\xAF", 'windows-1252') # ¯ check_both_ways("\u00B0", "\xB0", 'windows-1252') # ° check_both_ways("\u00BF", "\xBF", 'windows-1252') # ¿ @@ -432,7 +432,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM437') # α check_both_ways("\u2229", "\xEF", 'IBM437') # ∩ check_both_ways("\u2261", "\xF0", 'IBM437') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM437') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM437') # non-breaking space end def test_IBM775 @@ -451,7 +451,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u00D3", "\xE0", 'IBM775') # Ó check_both_ways("\u2019", "\xEF", 'IBM775') # ’ check_both_ways("\u00AD", "\xF0", 'IBM775') # osft hyphen - check_both_ways("\u00A0", "\xFF", 'IBM775') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM775') # non-breaking space end def test_IBM852 @@ -470,7 +470,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u00D3", "\xE0", 'IBM852') # Ó check_both_ways("\u00B4", "\xEF", 'IBM852') # ´ check_both_ways("\u00AD", "\xF0", 'IBM852') # osft hyphen - check_both_ways("\u00A0", "\xFF", 'IBM852') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM852') # non-breaking space end def test_IBM855 @@ -489,7 +489,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u042F", "\xE0", 'IBM855') # Я check_both_ways("\u2116", "\xEF", 'IBM855') # â„– check_both_ways("\u00AD", "\xF0", 'IBM855') # osft hyphen - check_both_ways("\u00A0", "\xFF", 'IBM855') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM855') # non-breaking space end def test_IBM857 @@ -517,7 +517,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u00B1", "\xF1", 'IBM857') # ± assert_raise(Encoding::UndefinedConversionError) { "\xF2".encode("utf-8", 'IBM857') } check_both_ways("\u00BE", "\xF3", 'IBM857') # ¾ - check_both_ways("\u00A0", "\xFF", 'IBM857') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM857') # non-breaking space end def test_IBM860 @@ -536,7 +536,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM860') # α check_both_ways("\u2229", "\xEF", 'IBM860') # ∩ check_both_ways("\u2261", "\xF0", 'IBM860') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM860') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM860') # non-breaking space end def test_IBM861 @@ -555,7 +555,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM861') # α check_both_ways("\u2229", "\xEF", 'IBM861') # ∩ check_both_ways("\u2261", "\xF0", 'IBM861') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM861') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM861') # non-breaking space end def test_IBM862 @@ -574,7 +574,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM862') # α check_both_ways("\u2229", "\xEF", 'IBM862') # ∩ check_both_ways("\u2261", "\xF0", 'IBM862') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM862') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM862') # non-breaking space end def test_IBM863 @@ -593,7 +593,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM863') # α check_both_ways("\u2229", "\xEF", 'IBM863') # ∩ check_both_ways("\u2261", "\xF0", 'IBM863') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM863') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM863') # non-breaking space end def test_IBM865 @@ -612,7 +612,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM865') # α check_both_ways("\u2229", "\xEF", 'IBM865') # ∩ check_both_ways("\u2261", "\xF0", 'IBM865') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM865') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM865') # non-breaking space end def test_IBM866 @@ -631,7 +631,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u0440", "\xE0", 'IBM866') # Ñ€ check_both_ways("\u044F", "\xEF", 'IBM866') # Ñ check_both_ways("\u0401", "\xF0", 'IBM866') # Ð - check_both_ways("\u00A0", "\xFF", 'IBM866') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM866') # non-breaking space end def test_IBM869 @@ -658,7 +658,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B6", "\xE0", 'IBM869') # ζ check_both_ways("\u0384", "\xEF", 'IBM869') # ΄ check_both_ways("\u00AD", "\xF0", 'IBM869') # soft hyphen - check_both_ways("\u00A0", "\xFF", 'IBM869') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM869') # non-breaking space end def test_macCroatian @@ -906,7 +906,7 @@ class TestTranscode < Test::Unit::TestCase assert_raise(Encoding::UndefinedConversionError) { "\xFC".encode("utf-8", 'TIS-620') } assert_raise(Encoding::UndefinedConversionError) { "\xFF".encode("utf-8", 'TIS-620') } end - + def test_CP850 check_both_ways("\u00C7", "\x80", 'CP850') # Ç check_both_ways("\u00C5", "\x8F", 'CP850') # Ã… @@ -1265,7 +1265,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u73F1", "\xE0\xFE", 'euc-jp') # ç± assert_raise(Encoding::UndefinedConversionError) { "\xF4\xA7".encode("utf-8", 'euc-jp') } #check_both_ways("\u9ADC", "\xFC\xE3", 'euc-jp') # é«œ (IBM extended) - + check_both_ways("\u677E\u672C\u884C\u5F18", "\xBE\xBE\xCB\xDC\xB9\xD4\xB9\xB0", 'euc-jp') # æ¾æœ¬è¡Œå¼˜ check_both_ways("\u9752\u5C71\u5B66\u9662\u5927\u5B66", "\xC0\xC4\xBB\xB3\xB3\xD8\xB1\xA1\xC2\xE7\xB3\xD8", 'euc-jp') # é’å±±å¦é™¢å¤§å¦ check_both_ways("\u795E\u6797\u7FA9\u535A", "\xBF\xC0\xCE\xD3\xB5\xC1\xC7\xEE", 'euc-jp') # ç¥žæž—ç¾©åš @@ -1460,7 +1460,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u9F44", "\xF7\xFE", 'GB2312') # 齄 check_both_ways("\u9752\u5C71\u5B66\u9662\u5927\u5B66", "\xC7\xE0\xC9\xBD\xD1\xA7\xD4\xBA\xB4\xF3\xD1\xA7", 'GB2312') # é’å±±å¦é™¢å¤§å¦ end - + def test_gbk check_both_ways("\u4E02", "\x81\x40", 'GBK') # 丂 check_both_ways("\u4E8A", "\x81\x7E", 'GBK') # 亊 @@ -1577,33 +1577,33 @@ class TestTranscode < Test::Unit::TestCase def test_gb18030 # test from GBK - check_both_ways("\u4E02", "\x81\x40", 'GB18030') # - check_both_ways("\u4E8A", "\x81\x7E", 'GB18030') # - check_both_ways("\u4E90", "\x81\x80", 'GB18030') # + check_both_ways("\u4E02", "\x81\x40", 'GB18030') # + check_both_ways("\u4E8A", "\x81\x7E", 'GB18030') # + check_both_ways("\u4E90", "\x81\x80", 'GB18030') # check_both_ways("\u4FA2", "\x81\xFE", 'GB18030') # ä¾¢ - check_both_ways("\u5EC6", "\x8F\x40", 'GB18030') # + check_both_ways("\u5EC6", "\x8F\x40", 'GB18030') # check_both_ways("\u5F24", "\x8F\x7E", 'GB18030') # 弤 check_both_ways("\u5F28", "\x8F\x80", 'GB18030') # 弨 - check_both_ways("\u6007", "\x8F\xFE", 'GB18030') # - check_both_ways("\u6008", "\x90\x40", 'GB18030') # + check_both_ways("\u6007", "\x8F\xFE", 'GB18030') # + check_both_ways("\u6008", "\x90\x40", 'GB18030') # check_both_ways("\u6080", "\x90\x7E", 'GB18030') # æ‚€ - check_both_ways("\u6081", "\x90\x80", 'GB18030') # - check_both_ways("\u6146", "\x90\xFE", 'GB18030') # - check_both_ways("\u70DC", "\x9F\x40", 'GB18030') # + check_both_ways("\u6081", "\x90\x80", 'GB18030') # + check_both_ways("\u6146", "\x90\xFE", 'GB18030') # + check_both_ways("\u70DC", "\x9F\x40", 'GB18030') # check_both_ways("\u7134", "\x9F\x7E", 'GB18030') # ç„´ check_both_ways("\u7135", "\x9F\x80", 'GB18030') # 焵 - check_both_ways("\u71D3", "\x9F\xFE", 'GB18030') # - check_both_ways("\u71D6", "\xA0\x40", 'GB18030') # - check_both_ways("\u721A", "\xA0\x7E", 'GB18030') # - check_both_ways("\u721B", "\xA0\x80", 'GB18030') # - check_both_ways("\u72DB", "\xA0\xFE", 'GB18030') # + check_both_ways("\u71D3", "\x9F\xFE", 'GB18030') # + check_both_ways("\u71D6", "\xA0\x40", 'GB18030') # + check_both_ways("\u721A", "\xA0\x7E", 'GB18030') # + check_both_ways("\u721B", "\xA0\x80", 'GB18030') # + check_both_ways("\u72DB", "\xA0\xFE", 'GB18030') # check_both_ways("\u3000", "\xA1\xA1", 'GB18030') # full-width space - check_both_ways("\u3001", "\xA1\xA2", 'GB18030') # - check_both_ways("\u3013", "\xA1\xFE", 'GB18030') # + check_both_ways("\u3001", "\xA1\xA2", 'GB18030') # + check_both_ways("\u3013", "\xA1\xFE", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA2\xA0".encode("utf-8", 'GB18030') } check_both_ways("\u2170", "\xA2\xA1", 'GB18030') # â…° #assert_raise(Encoding::UndefinedConversionError) { "\xA2\xB0".encode("utf-8", 'GB18030') } - check_both_ways("\u2488", "\xA2\xB1", 'GB18030') # + check_both_ways("\u2488", "\xA2\xB1", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA2\xE4".encode("utf-8", 'GB18030') } check_both_ways("\u3220", "\xA2\xE5", 'GB18030') # ㈠#assert_raise(Encoding::UndefinedConversionError) { "\xA2\xF0".encode("utf-8", 'GB18030') } @@ -1612,72 +1612,72 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\uFF01", "\xA3\xA1", 'GB18030') # E check_both_ways("\uFFE3", "\xA3\xFE", 'GB18030') # E #assert_raise(Encoding::UndefinedConversionError) { "\xA4\xA0".encode("utf-8", 'GB18030') } - check_both_ways("\u3041", "\xA4\xA1", 'GB18030') # + check_both_ways("\u3041", "\xA4\xA1", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA5\xA0".encode("utf-8", 'GB18030') } check_both_ways("\u30A1", "\xA5\xA1", 'GB18030') # ã‚¡ - check_both_ways("\u0391", "\xA6\xA1", 'GB18030') # + check_both_ways("\u0391", "\xA6\xA1", 'GB18030') # check_both_ways("\u03B1", "\xA6\xC1", 'GB18030') # α #assert_raise(Encoding::UndefinedConversionError) { "\xA6\xED".encode("utf-8", 'GB18030') } check_both_ways("\uFE3B", "\xA6\xEE", 'GB18030') # E - check_both_ways("\u0410", "\xA7\xA1", 'GB18030') # + check_both_ways("\u0410", "\xA7\xA1", 'GB18030') # check_both_ways("\u0430", "\xA7\xD1", 'GB18030') # а - check_both_ways("\u02CA", "\xA8\x40", 'GB18030') # - check_both_ways("\u2587", "\xA8\x7E", 'GB18030') # + check_both_ways("\u02CA", "\xA8\x40", 'GB18030') # + check_both_ways("\u2587", "\xA8\x7E", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA8\x96".encode("utf-8", 'GB18030') } - check_both_ways("\u0101", "\xA8\xA1", 'GB18030') # + check_both_ways("\u0101", "\xA8\xA1", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA8\xBC".encode("utf-8", 'GB18030') } #assert_raise(Encoding::UndefinedConversionError) { "\xA8\xBF".encode("utf-8", 'GB18030') } #assert_raise(Encoding::UndefinedConversionError) { "\xA8\xC4".encode("utf-8", 'GB18030') } - check_both_ways("\u3105", "\xA8\xC5", 'GB18030') # + check_both_ways("\u3105", "\xA8\xC5", 'GB18030') # check_both_ways("\u3021", "\xA9\x40", 'GB18030') # 〡 #assert_raise(Encoding::UndefinedConversionError) { "\xA9\x58".encode("utf-8", 'GB18030') } #assert_raise(Encoding::UndefinedConversionError) { "\xA9\x5B".encode("utf-8", 'GB18030') } #assert_raise(Encoding::UndefinedConversionError) { "\xA9\x5D".encode("utf-8", 'GB18030') } - check_both_ways("\u3007", "\xA9\x96", 'GB18030') # + check_both_ways("\u3007", "\xA9\x96", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA9\xA3".encode("utf-8", 'GB18030') } check_both_ways("\u2500", "\xA9\xA4", 'GB18030') # ─ #assert_raise(Encoding::UndefinedConversionError) { "\xA9\xF0".encode("utf-8", 'GB18030') } - check_both_ways("\u7588", "\xAF\x40", 'GB18030') # - check_both_ways("\u7607", "\xAF\x7E", 'GB18030') # - check_both_ways("\u7608", "\xAF\x80", 'GB18030') # - check_both_ways("\u7644", "\xAF\xA0", 'GB18030') # + check_both_ways("\u7588", "\xAF\x40", 'GB18030') # + check_both_ways("\u7607", "\xAF\x7E", 'GB18030') # + check_both_ways("\u7608", "\xAF\x80", 'GB18030') # + check_both_ways("\u7644", "\xAF\xA0", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xAF\xA1".encode("utf-8", 'GB18030') } - check_both_ways("\u7645", "\xB0\x40", 'GB18030') # - check_both_ways("\u769B", "\xB0\x7E", 'GB18030') # - check_both_ways("\u769C", "\xB0\x80", 'GB18030') # + check_both_ways("\u7645", "\xB0\x40", 'GB18030') # + check_both_ways("\u769B", "\xB0\x7E", 'GB18030') # + check_both_ways("\u769C", "\xB0\x80", 'GB18030') # check_both_ways("\u5265", "\xB0\xFE", 'GB18030') # 剥 check_both_ways("\u7DFB", "\xBF\x40", 'GB18030') # ç·» check_both_ways("\u7E39", "\xBF\x7E", 'GB18030') # 縹 check_both_ways("\u7E3A", "\xBF\x80", 'GB18030') # 縺 check_both_ways("\u5080", "\xBF\xFE", 'GB18030') # å‚€ - check_both_ways("\u7E5E", "\xC0\x40", 'GB18030') # - check_both_ways("\u7E9E", "\xC0\x7E", 'GB18030') # + check_both_ways("\u7E5E", "\xC0\x40", 'GB18030') # + check_both_ways("\u7E9E", "\xC0\x7E", 'GB18030') # check_both_ways("\u7EAE", "\xC0\x80", 'GB18030') # 纮 - check_both_ways("\u4FD0", "\xC0\xFE", 'GB18030') # + check_both_ways("\u4FD0", "\xC0\xFE", 'GB18030') # check_both_ways("\u87A5", "\xCF\x40", 'GB18030') # 螥 check_both_ways("\u87F8", "\xCF\x7E", 'GB18030') # 蟸 check_both_ways("\u87FA", "\xCF\x80", 'GB18030') # 蟺 - check_both_ways("\u6653", "\xCF\xFE", 'GB18030') # + check_both_ways("\u6653", "\xCF\xFE", 'GB18030') # check_both_ways("\u8824", "\xD0\x40", 'GB18030') # è ¤ check_both_ways("\u887A", "\xD0\x7E", 'GB18030') # 衺 check_both_ways("\u887B", "\xD0\x80", 'GB18030') # è¡» - check_both_ways("\u7384", "\xD0\xFE", 'GB18030') # - check_both_ways("\u9019", "\xDF\x40", 'GB18030') # - check_both_ways("\u9081", "\xDF\x7E", 'GB18030') # - check_both_ways("\u9084", "\xDF\x80", 'GB18030') # + check_both_ways("\u7384", "\xD0\xFE", 'GB18030') # + check_both_ways("\u9019", "\xDF\x40", 'GB18030') # + check_both_ways("\u9081", "\xDF\x7E", 'GB18030') # + check_both_ways("\u9084", "\xDF\x80", 'GB18030') # check_both_ways("\u553C", "\xDF\xFE", 'GB18030') # 唼 - check_both_ways("\u90C2", "\xE0\x40", 'GB18030') # - check_both_ways("\u911C", "\xE0\x7E", 'GB18030') # - check_both_ways("\u911D", "\xE0\x80", 'GB18030') # + check_both_ways("\u90C2", "\xE0\x40", 'GB18030') # + check_both_ways("\u911C", "\xE0\x7E", 'GB18030') # + check_both_ways("\u911D", "\xE0\x80", 'GB18030') # check_both_ways("\u5E3C", "\xE0\xFE", 'GB18030') # 帼 check_both_ways("\u986F", "\xEF\x40", 'GB18030') # 顯 check_both_ways("\u98E4", "\xEF\x7E", 'GB18030') # 飤 check_both_ways("\u98E5", "\xEF\x80", 'GB18030') # 飥 - check_both_ways("\u7A14", "\xEF\xFE", 'GB18030') # - check_both_ways("\u9908", "\xF0\x40", 'GB18030') # - check_both_ways("\u9949", "\xF0\x7E", 'GB18030') # - check_both_ways("\u994A", "\xF0\x80", 'GB18030') # - check_both_ways("\u7619", "\xF0\xFE", 'GB18030') # + check_both_ways("\u7A14", "\xEF\xFE", 'GB18030') # + check_both_ways("\u9908", "\xF0\x40", 'GB18030') # + check_both_ways("\u9949", "\xF0\x7E", 'GB18030') # + check_both_ways("\u994A", "\xF0\x80", 'GB18030') # + check_both_ways("\u7619", "\xF0\xFE", 'GB18030') # check_both_ways("\u9F32", "\xFD\x40", 'GB18030') # é¼² check_both_ways("\u9F78", "\xFD\x7E", 'GB18030') # 齸 check_both_ways("\u9F79", "\xFD\x80", 'GB18030') # é½¹ @@ -1692,40 +1692,40 @@ class TestTranscode < Test::Unit::TestCase # new tests for GB18030 check_both_ways("\u9FA6", "\x82\x35\x8F\x33", 'GB18030') # 龦 check_both_ways("\uD7FF", "\x83\x36\xC7\x38", 'GB18030') # No name () - - check_both_ways("\u0452", "\x81\x30\xD3\x30", 'GB18030') # + + check_both_ways("\u0452", "\x81\x30\xD3\x30", 'GB18030') # check_both_ways("\u200F", "\x81\x36\xA5\x31", 'GB18030') # RIGHT-TO-LEFT MARK - + check_both_ways("\uE865", "\x83\x36\xD0\x30", 'GB18030') # No name (Private Use Area) check_both_ways("\uF92B", "\x84\x30\x85\x34", 'GB18030') # E - - check_both_ways("\u2643", "\x81\x37\xA8\x39", 'GB18030') # + + check_both_ways("\u2643", "\x81\x37\xA8\x39", 'GB18030') # check_both_ways("\u2E80", "\x81\x38\xFD\x38", 'GB18030') # ⺀ - + check_both_ways("\uFA2A", "\x84\x30\x9C\x38", 'GB18030') # E check_both_ways("\uFE2F", "\x84\x31\x85\x37", 'GB18030') # No name (Combining Half Marks) - + check_both_ways("\u3CE1", "\x82\x31\xD4\x38", 'GB18030') # 㳡 - check_both_ways("\u4055", "\x82\x32\xAF\x32", 'GB18030') # - - check_both_ways("\u361B", "\x82\x30\xA6\x33", 'GB18030') # - check_both_ways("\u3917", "\x82\x30\xF2\x37", 'GB18030') # - + check_both_ways("\u4055", "\x82\x32\xAF\x32", 'GB18030') # + + check_both_ways("\u361B", "\x82\x30\xA6\x33", 'GB18030') # + check_both_ways("\u3917", "\x82\x30\xF2\x37", 'GB18030') # + check_both_ways("\u49B8", "\x82\x34\xA1\x31", 'GB18030') # 䦸 check_both_ways("\u4C76", "\x82\x34\xE7\x33", 'GB18030') # 䱶 - + check_both_ways("\u4160", "\x82\x32\xC9\x37", 'GB18030') # ä… check_both_ways("\u4336", "\x82\x32\xF8\x37", 'GB18030') # 䌶 - - check_both_ways("\u478E", "\x82\x33\xE8\x38", 'GB18030') # - check_both_ways("\u4946", "\x82\x34\x96\x38", 'GB18030') # - - check_both_ways("\u44D7", "\x82\x33\xA3\x39", 'GB18030') # - check_both_ways("\u464B", "\x82\x33\xC9\x31", 'GB18030') # - + + check_both_ways("\u478E", "\x82\x33\xE8\x38", 'GB18030') # + check_both_ways("\u4946", "\x82\x34\x96\x38", 'GB18030') # + + check_both_ways("\u44D7", "\x82\x33\xA3\x39", 'GB18030') # + check_both_ways("\u464B", "\x82\x33\xC9\x31", 'GB18030') # + check_both_ways("\uFFE6", "\x84\x31\xA2\x34", 'GB18030') # E check_both_ways("\uFFFF", "\x84\x31\xA4\x39", 'GB18030') # not a character - + check_both_ways("\u{10000}", "\x90\x30\x81\x30", 'GB18030') # ð€€ check_both_ways("\u{10FFFE}", "\xE3\x32\x9A\x34", 'GB18030') # No name (Not a character) check_both_ways("\u{10FFFF}", "\xE3\x32\x9A\x35", 'GB18030') # No name (Not a character) @@ -1797,7 +1797,7 @@ class TestTranscode < Test::Unit::TestCase assert_raise(Encoding::UndefinedConversionError) { "\xF9\xD6".encode("utf-8", 'Big5') } check_both_ways("\u795E\u6797\u7FA9\u535A", "\xAF\xAB\xAA\x4C\xB8\x71\xB3\xD5", 'Big5') # ç¥žæž—ç¾©åš end - + def test_nothing_changed a = "James".force_encoding("US-ASCII") b = a.encode("Shift_JIS") diff --git a/test/ruby/test_unicode_escape.rb b/test/ruby/test_unicode_escape.rb index f64b184230..5887dbc3dc 100644 --- a/test/ruby/test_unicode_escape.rb +++ b/test/ruby/test_unicode_escape.rb @@ -58,10 +58,10 @@ EOS assert_equal(:ü, :"\u{fc}") # the NUL character is not allowed in symbols - assert_raise(SyntaxError) { eval %q(:"\u{0}")} + assert_raise(SyntaxError) { eval %q(:"\u{0}")} assert_raise(SyntaxError) { eval %q(:"\u0000")} - assert_raise(SyntaxError) { eval %q(:"\u{fc 0 0041}")} - assert_raise(SyntaxError) { eval %q(:"\x00")} + assert_raise(SyntaxError) { eval %q(:"\u{fc 0 0041}")} + assert_raise(SyntaxError) { eval %q(:"\x00")} assert_raise(SyntaxError) { eval %q(:"\0")} end @@ -137,7 +137,7 @@ EOS def test_dynamic_regexp assert_match(Regexp.new("Martin D\\u{FC}rst"), "Martin Dürst") end - + def test_syntax_variants # all hex digits assert_equal("\xC4\xA3\xE4\x95\xA7\xE8\xA6\xAB\xEC\xB7\xAF", "\u0123\u4567\u89AB\uCDEF") @@ -147,7 +147,7 @@ EOS assert_equal("\xC4\xA3\xE4\x95\xA7\xE8\xA6\xAB\xEC\xB7\xAF", "\u0123\u4567\u89aB\uCdEf") assert_equal("\xC4\xA3\xE4\x95\xA7\xE8\xA6\xAB\xEC\xB7\xAF", "\u0123\u4567\u89aB\ucDEF") end - + def test_fulton # examples from Hal Fulton's book (second edition), chapter 4 # precomposed e'pe'e @@ -188,7 +188,7 @@ EOS assert_equal('Straße', "Stra\u{DF}e") assert_equal("\x53\x74\x72\x61\xC3\x9F\x65", "Stra\u{DF}e") end - + def test_edge_cases # start and end of each outer plane assert_equal("\xF4\x8F\xBF\xBF", "\u{10FFFF}") diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index c0c386040f..a842c31c3f 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -35,7 +35,7 @@ class TestVariable < Test::Unit::TestCase def test_variable assert_instance_of(Fixnum, $$) - + # read-only variable assert_raise(NameError) do $$ = 5 diff --git a/test/ruby/test_whileuntil.rb b/test/ruby/test_whileuntil.rb index df5bda450d..5628317cb8 100644 --- a/test/ruby/test_whileuntil.rb +++ b/test/ruby/test_whileuntil.rb @@ -16,7 +16,7 @@ class TestWhileuntil < Test::Unit::TestCase tmp = open(tmpfilename, "r") assert_instance_of(File, tmp) - + while line = tmp.gets() break if /vt100/ =~ line end diff --git a/test/rubygems/gem_package_tar_test_case.rb b/test/rubygems/gem_package_tar_test_case.rb index 756b30ef27..08ee57d66b 100644 --- a/test/rubygems/gem_package_tar_test_case.rb +++ b/test/rubygems/gem_package_tar_test_case.rb @@ -49,7 +49,7 @@ class TarTestCase < RubyGemTestCase linkname 100 magic 6 version 2 - uname 32 + uname 32 gname 32 devmajor 8 devminor 8 @@ -68,7 +68,7 @@ class TarTestCase < RubyGemTestCase next end - assert_equal expected[offset, length], actual[offset, length], + assert_equal expected[offset, length], actual[offset, length], "Field #{name} of the tar header differs." offset += length diff --git a/test/rubygems/insure_session.rb b/test/rubygems/insure_session.rb index e56f9abcb8..4ae706494a 100644 --- a/test/rubygems/insure_session.rb +++ b/test/rubygems/insure_session.rb @@ -23,7 +23,7 @@ def install_session puts puts "with the appropriate admin privileges." puts "*****************************************************************" - puts + puts exit end gem 'session' diff --git a/test/rubygems/simple_gem.rb b/test/rubygems/simple_gem.rb index a6f14bc3c7..9bcb45878c 100644 --- a/test/rubygems/simple_gem.rb +++ b/test/rubygems/simple_gem.rb @@ -8,7 +8,7 @@ MD5SUM = "e3701f9db765a2358aef94c40ded71c8" if $0 == __FILE__ require 'optparse' - + options = {} ARGV.options do |opts| opts.on_tail("--help", "show this message") {puts opts; exit} @@ -19,45 +19,45 @@ end require 'rubygems' - @directory = options[:directory] || Gem.dir + @directory = options[:directory] || Gem.dir @force = options[:force] - - gem = Gem::Installer.new(__FILE__).install(@force, @directory) + + gem = Gem::Installer.new(__FILE__).install(@force, @directory) if options[:gen_rdoc] Gem::DocManager.new(gem).generate_rdoc end end __END__ ---- !ruby/object:Gem::Specification +--- !ruby/object:Gem::Specification rubygems_version: "1.0" name: testing -version: !ruby/object:Gem::Version +version: !ruby/object:Gem::Version version: 1.2.3 date: 2004-03-18 22:01:52.859121 -05:00 -platform: +platform: summary: This exercise the gem testing stuff. -require_paths: +require_paths: - lib -files: +files: - lib/foo.rb - lib/test - lib/test.rb - lib/test/wow.rb autorequire: test test_suite_file: foo -requirements: +requirements: - a computer processor ---- -- +--- +- size: 109 mode: 420 path: lib/foo.rb -- +- size: 0 mode: 420 path: lib/test.rb -- +- size: 15 mode: 420 path: lib/test/wow.rb diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index b1a9d9d0a2..fd9954018c 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -400,7 +400,7 @@ class TestGem < RubyGemTestCase def test_self_refresh util_make_gems - a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec" + a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec" FileUtils.mv a1_spec, @tempdir diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb index 016a6d0616..75babee39d 100644 --- a/test/rubygems/test_gem_commands_sources_command.rb +++ b/test/rubygems/test_gem_commands_sources_command.rb @@ -244,7 +244,7 @@ Will cause RubyGems to revert to legacy indexes, degrading performance. assert_equal "source cache successfully updated\n", @ui.output assert_equal '', @ui.error end - + def test_execute_update_legacy @cmd.handle_options %w[--update] @@ -269,6 +269,6 @@ source cache successfully updated assert_equal expected, @ui.output assert_equal '', @ui.error end - + end diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb index 3a57c05e79..bf38c11c18 100644 --- a/test/rubygems/test_gem_dependency_installer.rb +++ b/test/rubygems/test_gem_dependency_installer.rb @@ -14,7 +14,7 @@ class TestGemDependencyInstaller < RubyGemTestCase fp.puts "#!/usr/bin/ruby" end @a1, @a1_gem = util_gem 'a', '1' do |s| s.executables << 'a_bin' end - @aa1, @aa1_gem = util_gem 'aa', '1' + @aa1, @aa1_gem = util_gem 'aa', '1' @b1, @b1_gem = util_gem 'b', '1' do |s| s.add_dependency 'a' diff --git a/test/rubygems/test_gem_package_tar_input.rb b/test/rubygems/test_gem_package_tar_input.rb index 279026b149..5e6fb2badd 100644 --- a/test/rubygems/test_gem_package_tar_input.rb +++ b/test/rubygems/test_gem_package_tar_input.rb @@ -48,7 +48,7 @@ class TestGemPackageTarInput < TarTestCase meta = @spec.to_yaml f.write tar_file_header("metadata", "", 0644, meta.size) - f.write meta + "\0" * (1024 - meta.size) + f.write meta + "\0" * (1024 - meta.size) f.write "\0" * 1024 end diff --git a/test/rubygems/test_gem_package_tar_writer.rb b/test/rubygems/test_gem_package_tar_writer.rb index 4c2b475bf1..5f3e7efb6f 100644 --- a/test/rubygems/test_gem_package_tar_writer.rb +++ b/test/rubygems/test_gem_package_tar_writer.rb @@ -46,7 +46,7 @@ class TestTarWriter < TarTestCase def test_add_file_simple_padding @tar_writer.add_file_simple 'x', 0, 100 - assert_headers_equal tar_file_header('x', '', 0, 100), + assert_headers_equal tar_file_header('x', '', 0, 100), @io.string[0, 512] assert_equal "\0" * 512, @io.string[512, 512] @@ -61,7 +61,7 @@ class TestTarWriter < TarTestCase end def test_add_file_simple_size - assert_raises Gem::Package::TarWriter::FileOverflow do + assert_raises Gem::Package::TarWriter::FileOverflow do @tar_writer.add_file_simple("lib/foo/bar", 0, 10) do |io| io.write "1" * 11 end @@ -69,7 +69,7 @@ class TestTarWriter < TarTestCase end def test_add_file_unseekable - assert_raises Gem::Package::NonSeekableIO do + assert_raises Gem::Package::NonSeekableIO do Gem::Package::TarWriter.new(Object.new).add_file 'x', 0 end end diff --git a/test/rubygems/test_gem_source_index.rb b/test/rubygems/test_gem_source_index.rb index 48760292c0..977f2c2b59 100644 --- a/test/rubygems/test_gem_source_index.rb +++ b/test/rubygems/test_gem_source_index.rb @@ -594,7 +594,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}' end def test_refresh_bang - a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec" + a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec" FileUtils.mv a1_spec, @tempdir diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index d40e6787cd..79093ff3a5 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -490,7 +490,7 @@ end 'i386-mswin32_80' => 'a-1-x86-mswin32-80', 'i386-mingw32' => 'a-1-x86-mingw32' } - + test_cases.each do |arch, expected| util_set_arch arch @a1.platform = 'current' diff --git a/test/scanf/test_scanf.rb b/test/scanf/test_scanf.rb index 2e9e10ba5d..893b51e736 100644 --- a/test/scanf/test_scanf.rb +++ b/test/scanf/test_scanf.rb @@ -240,8 +240,8 @@ module ScanfTests [ "%*5f%*d %*d %s", "1.2e23 45 string", ["string"] ], [ "%f %*d %s", "12.e23 45 string", ["12.e23".to_f, "string"] ], [ "%5f %d %s", "1.2e23 string", ["1.2e2".to_f, 3, "string"] ], - [ "%s %f %s %d %x%c%c%c%c", - "float: 1.2e23 dec/hex: 135a23 abc", + [ "%s %f %s %d %x%c%c%c%c", + "float: 1.2e23 dec/hex: 135a23 abc", ["float:", "1.2e23".to_f, "dec/hex:", 135, "a23".hex, " ", "a", "b", "c" ] ], # Testing 's' @@ -305,7 +305,7 @@ class TestIOScanf extend ScanfTests tmpfilename = "#{Dir.tmpdir}/iotest.dat.#{$$}" - + i = 1 self.tests.each do |test| define_method("test_#{i}") do || diff --git a/test/scanf/test_scanfblocks.rb b/test/scanf/test_scanfblocks.rb index 907a3c2838..aea5033a54 100644 --- a/test/scanf/test_scanfblocks.rb +++ b/test/scanf/test_scanfblocks.rb @@ -20,7 +20,7 @@ class TestScanfBlock < Test::Unit::TestCase Brahms 1833 EOS end - + alias set_up setup def test_str1 res = @str.scanf("%s%d") { |name, year| "#{name} was born in #{year}." } @@ -63,7 +63,7 @@ alias set_up setup "Brahms was born in 1833." ],res) fh.close ensure - File.delete(fn) + File.delete(fn) end def test_io2 @@ -75,7 +75,7 @@ alias set_up setup assert_equal(fh.scanf("%d%f%s") {}, []) fh.close ensure - File.delete(fn) + File.delete(fn) end end diff --git a/test/socket/test_nonblock.rb b/test/socket/test_nonblock.rb index 665648a358..4e7807fa95 100644 --- a/test/socket/test_nonblock.rb +++ b/test/socket/test_nonblock.rb @@ -109,7 +109,7 @@ class TestSocketNonblock < Test::Unit::TestCase assert_raise(Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINVAL) { s2.recvfrom_nonblock(100) } s2.send("aaa", 0, s1.getsockname) IO.select [s1] - mesg, sockaddr = s1.recvfrom_nonblock(100) + mesg, sockaddr = s1.recvfrom_nonblock(100) assert_equal("aaa", mesg) port, addr = Socket.unpack_sockaddr_in(sockaddr) s2_port, s2_addr = Socket.unpack_sockaddr_in(s2.getsockname) diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb index fdf0ce72ea..e18f5d6e95 100644 --- a/test/socket/test_unix.rb +++ b/test/socket/test_unix.rb @@ -445,7 +445,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase serv = Socket.unix_server_socket(sockpath) c = Socket.unix(sockpath) s, = serv.accept - c.sendmsg("a", 0, nil, [:SOCKET, Socket::SCM_CREDS, ""]) + c.sendmsg("a", 0, nil, [:SOCKET, Socket::SCM_CREDS, ""]) msg, cliend_ai, rflags, cred = s.recvmsg assert_equal("a", msg) inspect = cred.inspect diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb index 1c19fad5c4..0c1ae5dc48 100644 --- a/test/stringio/test_stringio.rb +++ b/test/stringio/test_stringio.rb @@ -117,7 +117,7 @@ class TestStringIO < Test::Unit::TestCase def test_isatty assert_equal(false, StringIO.new("").isatty) end - + def test_path assert_equal(nil, StringIO.new("").path) end @@ -134,7 +134,7 @@ class TestStringIO < Test::Unit::TestCase def test_set_fcntl assert_raise(NotImplementedError) { StringIO.new("").fcntl } end - + def test_close f = StringIO.new("") f.close @@ -147,7 +147,7 @@ class TestStringIO < Test::Unit::TestCase ensure f.close unless f.closed? end - + def test_close_read f = StringIO.new("") f.close_read @@ -161,7 +161,7 @@ class TestStringIO < Test::Unit::TestCase ensure f.close unless f.closed? end - + def test_close_write f = StringIO.new("") f.close_write diff --git a/test/test_prime.rb b/test/test_prime.rb index 0dad7cf987..e7c025a55a 100644 --- a/test/test_prime.rb +++ b/test/test_prime.rb @@ -6,15 +6,15 @@ class TestPrime < Test::Unit::TestCase # The first 100 prime numbers PRIMES = [ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, - 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, - 89, 97, 101, 103, 107, 109, 113, 127, 131, - 137, 139, 149, 151, 157, 163, 167, 173, 179, - 181, 191, 193, 197, 199, 211, 223, 227, 229, - 233, 239, 241, 251, 257, 263, 269, 271, 277, - 281, 283, 293, 307, 311, 313, 317, 331, 337, - 347, 349, 353, 359, 367, 373, 379, 383, 389, - 397, 401, 409, 419, 421, 431, 433, 439, 443, - 449, 457, 461, 463, 467, 479, 487, 491, 499, + 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, + 89, 97, 101, 103, 107, 109, 113, 127, 131, + 137, 139, 149, 151, 157, 163, 167, 173, 179, + 181, 191, 193, 197, 199, 211, 223, 227, 229, + 233, 239, 241, 251, 257, 263, 269, 271, 277, + 281, 283, 293, 307, 311, 313, 317, 331, 337, + 347, 349, 353, 359, 367, 373, 379, 383, 389, + 397, 401, 409, 419, 421, 431, 433, 439, 443, + 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, ] def test_each @@ -36,7 +36,7 @@ class TestPrime < Test::Unit::TestCase end # Prime number theorem - assert primes.length >= max/Math.log(max) + assert primes.length >= max/Math.log(max) delta = 0.05 li = (2..max).step(delta).inject(0){|sum,x| sum + delta/Math.log(x)} assert primes.length <= li diff --git a/test/test_pstore.rb b/test/test_pstore.rb index 678ffa4a62..e10ce906cb 100644 --- a/test/test_pstore.rb +++ b/test/test_pstore.rb @@ -17,14 +17,14 @@ class PStoreTest < Test::Unit::TestCase assert_nil @pstore[:bar] end end - + def test_opening_new_file_in_readwrite_mode_should_result_in_empty_values @pstore.transaction do assert_nil @pstore[:foo] assert_nil @pstore[:bar] end end - + def test_data_should_be_loaded_correctly_when_in_readonly_mode @pstore.transaction do @pstore[:foo] = "bar" @@ -33,7 +33,7 @@ class PStoreTest < Test::Unit::TestCase assert_equal "bar", @pstore[:foo] end end - + def test_data_should_be_loaded_correctly_when_in_readwrite_mode @pstore.transaction do @pstore[:foo] = "bar" @@ -42,7 +42,7 @@ class PStoreTest < Test::Unit::TestCase assert_equal "bar", @pstore[:foo] end end - + def test_changes_after_commit_are_discarded @pstore.transaction do @pstore[:foo] = "bar" @@ -53,7 +53,7 @@ class PStoreTest < Test::Unit::TestCase assert_equal "bar", @pstore[:foo] end end - + def test_changes_are_not_written_on_abort @pstore.transaction do @pstore[:foo] = "bar" @@ -63,7 +63,7 @@ class PStoreTest < Test::Unit::TestCase assert_nil @pstore[:foo] end end - + def test_writing_inside_readonly_transaction_raises_error assert_raise(PStore::Error) do @pstore.transaction(true) do diff --git a/test/test_shellwords.rb b/test/test_shellwords.rb index e6ee3d6b4d..d48a8882c8 100644 --- a/test/test_shellwords.rb +++ b/test/test_shellwords.rb @@ -15,21 +15,21 @@ class TestShellwords < Test::Unit::TestCase assert_instance_of(Array, shellwords(@cmd)) assert_equal(4, shellwords(@cmd).length) end - + def test_unmatched_double_quote bad_cmd = 'one two "three' assert_raise ArgumentError do shellwords(bad_cmd) end end - + def test_unmatched_single_quote bad_cmd = "one two 'three" assert_raise ArgumentError do shellwords(bad_cmd) end end - + def test_unmatched_quotes bad_cmd = "one '"'"''""'"" assert_raise ArgumentError do diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index 0fe031bdee..dfc4acd8d3 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -12,20 +12,20 @@ class TestCommon < Test::Unit::TestCase end def test_extract - assert_equal(['http://example.com'], + assert_equal(['http://example.com'], URI.extract('http://example.com')) - assert_equal(['http://example.com'], + assert_equal(['http://example.com'], URI.extract('(http://example.com)')) - assert_equal(['http://example.com/foo)'], + assert_equal(['http://example.com/foo)'], URI.extract('(http://example.com/foo)')) - assert_equal(['http://example.jphttp://example.jp'], + assert_equal(['http://example.jphttp://example.jp'], URI.extract('http://example.jphttp://example.jp'), "[ruby-list:36086]") - assert_equal(['http://example.jphttp://example.jp'], + assert_equal(['http://example.jphttp://example.jp'], URI.extract('http://example.jphttp://example.jp', ['http']), "[ruby-list:36086]") - assert_equal(['http://', 'mailto:'].sort, + assert_equal(['http://', 'mailto:'].sort, URI.extract('ftp:// http:// mailto: https://', ['http', 'mailto']).sort) # reported by Doug Kearns <djkea2@mugca.its.monash.edu.au> - assert_equal(['From:', 'mailto:xxx@xxx.xxx.xxx]'].sort, + assert_equal(['From:', 'mailto:xxx@xxx.xxx.xxx]'].sort, URI.extract('From: XXX [mailto:xxx@xxx.xxx.xxx]').sort) end diff --git a/test/uri/test_ftp.rb b/test/uri/test_ftp.rb index 6311be81b7..0d76c4497b 100644 --- a/test/uri/test_ftp.rb +++ b/test/uri/test_ftp.rb @@ -14,7 +14,7 @@ class TestFTP < Test::Unit::TestCase exp = [ 'ftp', - 'user:pass', 'host.com', URI::FTP.default_port, + 'user:pass', 'host.com', URI::FTP.default_port, 'abc/def', nil, ] ary = [ @@ -28,7 +28,7 @@ class TestFTP < Test::Unit::TestCase end def test_paths - # If you think what's below is wrong, please read RubyForge bug 2055, + # If you think what's below is wrong, please read RubyForge bug 2055, # RFC 1738 section 3.2.2, and RFC 2396. u = URI.parse('ftp://ftp.example.com/foo/bar/file.ext') assert(u.path == 'foo/bar/file.ext') @@ -41,9 +41,9 @@ class TestFTP < Test::Unit::TestCase def test_assemble # uri/ftp is conservative and uses the older RFC 1738 rules, rather than # assuming everyone else has implemented RFC 2396. - uri = URI::FTP.build(['user:password', 'ftp.example.com', nil, + uri = URI::FTP.build(['user:password', 'ftp.example.com', nil, '/path/file.zip', 'i']) - assert(uri.to_s == + assert(uri.to_s == 'ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=i') end diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb index 0d481c369a..fcaa599724 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -19,9 +19,9 @@ class URI::TestGeneric < Test::Unit::TestCase assert_kind_of(URI::HTTP, @base_url) exp = [ - 'http', - nil, 'a', URI::HTTP.default_port, - '/b/c/d;p', + 'http', + nil, 'a', URI::HTTP.default_port, + '/b/c/d;p', 'q', nil ] @@ -33,8 +33,8 @@ class URI::TestGeneric < Test::Unit::TestCase assert_kind_of(URI::FTP, url) exp = [ - 'ftp', - nil, 'ftp.is.co.za', URI::FTP.default_port, + 'ftp', + nil, 'ftp.is.co.za', URI::FTP.default_port, 'rfc/rfc1808.txt', nil, ] ary = uri_to_ary(url) @@ -44,8 +44,8 @@ class URI::TestGeneric < Test::Unit::TestCase assert_kind_of(URI::FTP, url) exp = [ - 'ftp', - nil, 'ftp.is.co.za', URI::FTP.default_port, + 'ftp', + nil, 'ftp.is.co.za', URI::FTP.default_port, '/rfc/rfc1808.txt', nil, ] ary = uri_to_ary(url) @@ -56,7 +56,7 @@ class URI::TestGeneric < Test::Unit::TestCase assert_kind_of(URI::Generic, url) exp = [ - 'gopher', + 'gopher', nil, 'spinaltap.micro.umn.edu', nil, nil, '/00/Weather/California/Los%20Angeles', nil, nil, @@ -70,9 +70,9 @@ class URI::TestGeneric < Test::Unit::TestCase assert_kind_of(URI::HTTP, url) exp = [ - 'http', - nil, 'www.math.uio.no', URI::HTTP.default_port, - '/faq/compression-faq/part1.html', + 'http', + nil, 'www.math.uio.no', URI::HTTP.default_port, + '/faq/compression-faq/part1.html', nil, nil ] @@ -84,7 +84,7 @@ class URI::TestGeneric < Test::Unit::TestCase assert_kind_of(URI::Generic, url) exp = [ - 'mailto', + 'mailto', 'mduerst@ifi.unizh.ch', [] ] @@ -96,8 +96,8 @@ class URI::TestGeneric < Test::Unit::TestCase assert_kind_of(URI::Generic, url) exp = [ - 'news', - nil, nil, nil, nil, + 'news', + nil, nil, nil, nil, nil, 'comp.infosystems.www.servers.unix', nil, nil @@ -110,8 +110,8 @@ class URI::TestGeneric < Test::Unit::TestCase assert_kind_of(URI::Generic, url) exp = [ - 'telnet', - nil, 'melvyl.ucop.edu', nil, nil, + 'telnet', + nil, 'melvyl.ucop.edu', nil, nil, '/', nil, nil, nil diff --git a/test/uri/test_http.rb b/test/uri/test_http.rb index 6c8e700b77..a323d43a79 100644 --- a/test/uri/test_http.rb +++ b/test/uri/test_http.rb @@ -18,7 +18,7 @@ class TestHTTP < Test::Unit::TestCase def test_parse u = URI.parse('http://a') assert_kind_of(URI::HTTP, u) - assert_equal(['http', + assert_equal(['http', nil, 'a', URI::HTTP.default_port, '', nil, nil], uri_to_ary(u)) end diff --git a/test/uri/test_ldap.rb b/test/uri/test_ldap.rb index 0eaa113c94..14ef39242e 100644 --- a/test/uri/test_ldap.rb +++ b/test/uri/test_ldap.rb @@ -38,47 +38,47 @@ class TestLDAP < Test::Unit::TestCase # from RFC2255, section 6. urls = { 'ldap:///o=University%20of%20Michigan,c=US' => - ['ldap', nil, URI::LDAP::DEFAULT_PORT, - 'o=University%20of%20Michigan,c=US', + ['ldap', nil, URI::LDAP::DEFAULT_PORT, + 'o=University%20of%20Michigan,c=US', nil, nil, nil, nil], 'ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US' => - ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT, - 'o=University%20of%20Michigan,c=US', + ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT, + 'o=University%20of%20Michigan,c=US', nil, nil, nil, nil], 'ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress' => - ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT, + ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT, 'o=University%20of%20Michigan,c=US', 'postalAddress', nil, nil, nil], 'ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)' => - ['ldap', 'host.com', 6666, + ['ldap', 'host.com', 6666, 'o=University%20of%20Michigan,c=US', nil, 'sub', '(cn=Babs%20Jensen)', nil], 'ldap://ldap.itd.umich.edu/c=GB?objectClass?one' => - ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT, - 'c=GB', + ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT, + 'c=GB', 'objectClass', 'one', nil, nil], 'ldap://ldap.question.com/o=Question%3f,c=US?mail' => - ['ldap', 'ldap.question.com', URI::LDAP::DEFAULT_PORT, + ['ldap', 'ldap.question.com', URI::LDAP::DEFAULT_PORT, 'o=Question%3f,c=US', 'mail', nil, nil, nil], 'ldap://ldap.netscape.com/o=Babsco,c=US??(int=%5c00%5c00%5c00%5c04)' => - ['ldap', 'ldap.netscape.com', URI::LDAP::DEFAULT_PORT, + ['ldap', 'ldap.netscape.com', URI::LDAP::DEFAULT_PORT, 'o=Babsco,c=US', nil, '(int=%5c00%5c00%5c00%5c04)', nil, nil], 'ldap:///??sub??bindname=cn=Manager%2co=Foo' => - ['ldap', nil, URI::LDAP::DEFAULT_PORT, + ['ldap', nil, URI::LDAP::DEFAULT_PORT, '', nil, 'sub', nil, 'bindname=cn=Manager%2co=Foo'], 'ldap:///??sub??!bindname=cn=Manager%2co=Foo' => - ['ldap', nil, URI::LDAP::DEFAULT_PORT, + ['ldap', nil, URI::LDAP::DEFAULT_PORT, '', nil, 'sub', nil, '!bindname=cn=Manager%2co=Foo'], }.each do |url, ary| diff --git a/test/uri/test_mailto.rb b/test/uri/test_mailto.rb index 38715fcc9c..04fb6fdadc 100644 --- a/test/uri/test_mailto.rb +++ b/test/uri/test_mailto.rb @@ -29,46 +29,46 @@ class TestMailTo < Test::Unit::TestCase # mailto:infobot@example.com?subject=current-issue ok << ["mailto:infobot@example.com?subject=current-issue"] ok[-1] << ["infobot@example.com", ["subject=current-issue"]] - ok[-1] << {:to => "infobot@example.com", + ok[-1] << {:to => "infobot@example.com", :headers => ["subject=current-issue"]} # mailto:infobot@example.com?body=send%20current-issue ok << ["mailto:infobot@example.com?body=send%20current-issue"] ok[-1] << ["infobot@example.com", ["body=send%20current-issue"]] - ok[-1] << {:to => "infobot@example.com", + ok[-1] << {:to => "infobot@example.com", :headers => ["body=send%20current-issue"]} # mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index ok << ["mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index"] - ok[-1] << ["infobot@example.com", + ok[-1] << ["infobot@example.com", ["body=send%20current-issue%0D%0Asend%20index"]] - ok[-1] << {:to => "infobot@example.com", + ok[-1] << {:to => "infobot@example.com", :headers => ["body=send%20current-issue%0D%0Asend%20index"]} # mailto:foobar@example.com?In-Reply-To=%3c3469A91.D10AF4C@example.com ok << ["mailto:foobar@example.com?In-Reply-To=%3c3469A91.D10AF4C@example.com"] - ok[-1] << ["foobar@example.com", + ok[-1] << ["foobar@example.com", ["In-Reply-To=%3c3469A91.D10AF4C@example.com"]] - ok[-1] << {:to => "foobar@example.com", + ok[-1] << {:to => "foobar@example.com", :headers => ["In-Reply-To=%3c3469A91.D10AF4C@example.com"]} # mailto:majordomo@example.com?body=subscribe%20bamboo-l ok << ["mailto:majordomo@example.com?body=subscribe%20bamboo-l"] ok[-1] << ["majordomo@example.com", ["body=subscribe%20bamboo-l"]] - ok[-1] << {:to => "majordomo@example.com", + ok[-1] << {:to => "majordomo@example.com", :headers => ["body=subscribe%20bamboo-l"]} # mailto:joe@example.com?cc=bob@example.com&body=hello ok << ["mailto:joe@example.com?cc=bob@example.com&body=hello"] ok[-1] << ["joe@example.com", ["cc=bob@example.com", "body=hello"]] - ok[-1] << {:to => "joe@example.com", + ok[-1] << {:to => "joe@example.com", :headers => ["cc=bob@example.com", "body=hello"]} # mailto:?to=joe@example.com&cc=bob@example.com&body=hello ok << ["mailto:?to=joe@example.com&cc=bob@example.com&body=hello"] - ok[-1] << [nil, + ok[-1] << [nil, ["to=joe@example.com", "cc=bob@example.com", "body=hello"]] - ok[-1] << {:headers => ["to=joe@example.com", + ok[-1] << {:headers => ["to=joe@example.com", "cc=bob@example.com", "body=hello"]} # mailto:gorby%25kremvax@example.com @@ -79,7 +79,7 @@ class TestMailTo < Test::Unit::TestCase # mailto:unlikely%3Faddress@example.com?blat=foop ok << ["mailto:unlikely%3Faddress@example.com?blat=foop"] ok[-1] << ["unlikely%3Faddress@example.com", ["blat=foop"]] - ok[-1] << {:to => "unlikely%3Faddress@example.com", + ok[-1] << {:to => "unlikely%3Faddress@example.com", :headers => ["blat=foop"]} ok_all = ok.flatten.join("\0") diff --git a/test/webrick/test_cookie.rb b/test/webrick/test_cookie.rb index c8ded4c2dd..14771fd01c 100644 --- a/test/webrick/test_cookie.rb +++ b/test/webrick/test_cookie.rb @@ -61,7 +61,7 @@ class TestWEBrickCookie < Test::Unit::TestCase assert_equal("WILE_E_COYOTE", cookie.value) assert_equal(1, cookie.version) assert_equal("/acme", cookie.path) - + data = %(Shipping="FedEx"; Version="1"; Path="/acme"; Secure) cookie = WEBrick::Cookie.parse_set_cookie(data) assert_equal("Shipping", cookie.name) diff --git a/test/webrick/test_httpauth.rb b/test/webrick/test_httpauth.rb index a6e29474b3..56f96235f1 100644 --- a/test/webrick/test_httpauth.rb +++ b/test/webrick/test_httpauth.rb @@ -14,7 +14,7 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase server.mount_proc(path){|req, res| WEBrick::HTTPAuth.basic_auth(req, res, realm){|user, pass| user == "webrick" && pass == "supersecretpassword" - } + } res.body = "hoge" } http = Net::HTTP.new(addr, port) diff --git a/test/webrick/test_httpproxy.rb b/test/webrick/test_httpproxy.rb index 1f914e3a99..ab82ed8cd7 100644 --- a/test/webrick/test_httpproxy.rb +++ b/test/webrick/test_httpproxy.rb @@ -25,7 +25,7 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase # Testing GET or POST to the proxy server # Note that the proxy server works as the origin server. # +------+ - # V | + # V | # client -------> proxy ---+ # GET / POST GET / POST # @@ -176,7 +176,7 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase # Testing GET or POST through the upstream proxy server # Note that the upstream proxy server works as the origin server. # +------+ - # V | + # V | # client -------> proxy -------> proxy ---+ # GET / POST GET / POST GET / POST # diff --git a/test/webrick/test_httprequest.rb b/test/webrick/test_httprequest.rb index 92ad1e79ca..4a1db38bca 100644 --- a/test/webrick/test_httprequest.rb +++ b/test/webrick/test_httprequest.rb @@ -79,7 +79,7 @@ class TestWEBrickHTTPRequest < Test::Unit::TestCase Accept-Language: ja Content-Type: text/plain Content-Length: 7 - X-Empty-Header: + X-Empty-Header: foobar _end_of_message_ diff --git a/test/win32ole/test_folderitem2_invokeverb.rb b/test/win32ole/test_folderitem2_invokeverb.rb index 07cb9802d6..5a5d475059 100644 --- a/test/win32ole/test_folderitem2_invokeverb.rb +++ b/test/win32ole/test_folderitem2_invokeverb.rb @@ -32,7 +32,7 @@ if defined?(WIN32OLE) # Search the 'Create Shortcut (&S)' string in Japanese. # Yes, I know the string in the Windows 2000 Japanese Edition. # But I do not know about the string in any other Windows. - # + # verbs = @fi2.verbs verbs.extend(Enumerable) @cp = WIN32OLE.codepage @@ -40,7 +40,7 @@ if defined?(WIN32OLE) WIN32OLE.codepage = 932 rescue end - @shortcut = verbs.collect{|verb| + @shortcut = verbs.collect{|verb| verb.name }.find {|name| name.unpack("C*") == [131, 86, 131, 135, 129, 91, 131, 103, 131, 74, 131, 98, 131, 103, 130, 204, 141, 236, 144, 172, 40, 38, 83, 41] diff --git a/test/win32ole/test_nil2vtempty.rb b/test/win32ole/test_nil2vtempty.rb index 4be3902b6d..8508ecdf97 100644 --- a/test/win32ole/test_nil2vtempty.rb +++ b/test/win32ole/test_nil2vtempty.rb @@ -26,7 +26,7 @@ if defined?(WIN32OLE) rs = con.openSchema(4, [nil,nil,"DUMMY", "TABLE"]) assert(rs) assert_equal("_Recordset", rs.ole_type.name) - + rs = con.openSchema(4, [WIN32OLE_VARIANT::Empty, WIN32OLE_VARIANT::Empty, "DUMMY", "TABLE"]) assert(rs) assert_equal("_Recordset", rs.ole_type.name) diff --git a/test/win32ole/test_ole_methods.rb b/test/win32ole/test_ole_methods.rb index ca1c03b010..869828d22f 100644 --- a/test/win32ole/test_ole_methods.rb +++ b/test/win32ole/test_ole_methods.rb @@ -9,7 +9,7 @@ require "test/unit" if defined?(WIN32OLE) class TestWIN32OLE_FOR_PROPERTYPUTREF < Test::Unit::TestCase - + def setup @obj = WIN32OLE.new('Scripting.Dictionary') end diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb index b946aa6ff0..18da3bec7a 100644 --- a/test/win32ole/test_win32ole.rb +++ b/test/win32ole/test_win32ole.rb @@ -16,7 +16,7 @@ if defined?(WIN32OLE) def test_convert_bignum @dict1.add("a", 9999999999) @dict1.add("b", 999999999) - @dict1.add("c", @dict1.item("b") * 10 + 9) + @dict1.add("c", @dict1.item("b") * 10 + 9) assert_equal(9999999999, @dict1.item("a")) assert_equal(9999999999, @dict1.item("c")) end @@ -134,11 +134,11 @@ if defined?(WIN32OLE) @dict1.add("ary2", [[1,2,"a"], [3,4,"b"]]) assert_equal([[1,2,"a"], [3,4,"b"]], @dict1["ary2"]) - @dict1.add("ary3", [[[1]]]) - assert_equal([[[1]]], @dict1["ary3"]) + @dict1.add("ary3", [[[1]]]) + assert_equal([[[1]]], @dict1["ary3"]) - @dict1.add("ary4", [[[1], [2], [3]], [[4], [5], [6]]]) - assert_equal([[[1],[2], [3]], [[4], [5], [6]]], @dict1["ary4"]) + @dict1.add("ary4", [[[1], [2], [3]], [[4], [5], [6]]]) + assert_equal([[[1],[2], [3]], [[4], [5], [6]]], @dict1["ary4"]) end end @@ -303,7 +303,7 @@ if defined?(WIN32OLE) guid) end - # + # # WIN32OLE.codepage is initialized according to Encoding.default_external. # # def test_s_codepage @@ -342,7 +342,7 @@ if defined?(WIN32OLE) assert_equal("\xA4\xA2".force_encoding("CP20932"), obj.value) end - WIN32OLE.codepage = cp + WIN32OLE.codepage = cp file = fso.opentextfile(fname, 2, true) file.write [0x3042].pack("U*").force_encoding("UTF-8") file.close @@ -353,7 +353,7 @@ if defined?(WIN32OLE) assert_equal("\202\240", str) # This test fail if codepage 20932 (euc) is not installed. - begin + begin WIN32OLE.codepage = 20932 rescue WIN32OLERuntimeError end diff --git a/test/win32ole/test_win32ole_event.rb b/test/win32ole/test_win32ole_event.rb index dff9a68c9b..7e7ee10222 100644 --- a/test/win32ole/test_win32ole_event.rb +++ b/test/win32ole/test_win32ole_event.rb @@ -63,7 +63,7 @@ if defined?(WIN32OLE_EVENT) @db.close 10.times do |i| WIN32OLE_EVENT.new(@db) - GC.start + GC.start message_loop @db.open message_loop @@ -176,7 +176,7 @@ if defined?(WIN32OLE_EVENT) ev.on_event('WillConnect'){|*args| {:return => 1, :ConnectionString => CONNSTR} } - @db.connectionString = 'XXX' + @db.connectionString = 'XXX' @db.open assert(true) end @@ -186,7 +186,7 @@ if defined?(WIN32OLE_EVENT) ev.on_event('WillConnect'){|*args| {:ConnectionString => CONNSTR} } - @db.connectionString = 'XXX' + @db.connectionString = 'XXX' @db.open assert(true) end @@ -196,7 +196,7 @@ if defined?(WIN32OLE_EVENT) ev.on_event('WillConnect'){|*args| {'ConnectionString' => CONNSTR} } - @db.connectionString = 'XXX' + @db.connectionString = 'XXX' @db.open assert(true) end @@ -206,7 +206,7 @@ if defined?(WIN32OLE_EVENT) ev.on_event('WillConnect'){|*args| {'return' => 1, 'ConnectionString' => CONNSTR} } - @db.connectionString = 'XXX' + @db.connectionString = 'XXX' @db.open assert(true) end @@ -216,7 +216,7 @@ if defined?(WIN32OLE_EVENT) ev.on_event('WillConnect'){|*args| {0 => CONNSTR} } - @db.connectionString = 'XXX' + @db.connectionString = 'XXX' @db.open assert(true) end diff --git a/test/win32ole/test_win32ole_method.rb b/test/win32ole/test_win32ole_method.rb index f2ed0c622c..762ef1d795 100644 --- a/test/win32ole/test_win32ole_method.rb +++ b/test/win32ole/test_win32ole_method.rb @@ -6,7 +6,7 @@ require "test/unit" if defined?(WIN32OLE_METHOD) class TestWIN32OLE_METHOD < Test::Unit::TestCase - + def setup ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") @m_open = WIN32OLE_METHOD.new(ole_type, "open") @@ -125,7 +125,7 @@ if defined?(WIN32OLE_METHOD) def test_params params = @m_browse_for_folder.params assert_instance_of(Array, params) - assert_equal(4, params.size) + assert_equal(4, params.size) assert_instance_of(WIN32OLE_PARAM, params[0]) end diff --git a/test/win32ole/test_win32ole_param.rb b/test/win32ole/test_win32ole_param.rb index 1c866ca53e..3b831c3937 100644 --- a/test/win32ole/test_win32ole_param.rb +++ b/test/win32ole/test_win32ole_param.rb @@ -6,7 +6,7 @@ require "test/unit" if defined?(WIN32OLE_PARAM) class TestWIN32OLE_PARAM < Test::Unit::TestCase - + def setup ole_type = WIN32OLE_TYPE.new("Microsoft Internet Controls", "WebBrowser") m_navigate = WIN32OLE_METHOD.new(ole_type, "Navigate") diff --git a/test/win32ole/test_win32ole_type.rb b/test/win32ole/test_win32ole_type.rb index f8ea525ea9..8ecf2b2c27 100644 --- a/test/win32ole/test_win32ole_type.rb +++ b/test/win32ole/test_win32ole_type.rb @@ -51,7 +51,7 @@ if defined?(WIN32OLE_TYPE) assert_equal(0, ole_type.helpcontext) assert_equal([], ole_type.variables) assert(ole_type.ole_methods.select{|m|/NameSpace/i =~ m.name}.size > 0) - + ole_type2 = WIN32OLE_TYPE.new("{13709620-C279-11CE-A49E-444553540000}", "Shell") assert_instance_of(WIN32OLE_TYPE, ole_type) assert_equal(ole_type.name, ole_type2.name) @@ -184,7 +184,7 @@ if defined?(WIN32OLE_TYPE) assert_equal(1, otype.size) otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"} assert_equal(1, otype.size) - otype = ole_types.select{|t| t.name == "DWebBrowserEvents"} + otype = ole_types.select{|t| t.name == "DWebBrowserEvents"} assert_equal(1, otype.size) end @@ -197,7 +197,7 @@ if defined?(WIN32OLE_TYPE) assert_equal(0, otype.size) otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"} assert_equal(1, otype.size) - otype = ole_types.select{|t| t.name == "DWebBrowserEvents"} + otype = ole_types.select{|t| t.name == "DWebBrowserEvents"} assert_equal(0, otype.size) end @@ -210,7 +210,7 @@ if defined?(WIN32OLE_TYPE) assert_equal(0, otype.size) otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"} assert_equal(1, otype.size) - otype = ole_types.select{|t| t.name == "DWebBrowserEvents"} + otype = ole_types.select{|t| t.name == "DWebBrowserEvents"} assert_equal(1, otype.size) end @@ -223,7 +223,7 @@ if defined?(WIN32OLE_TYPE) assert_equal(0, otype.size) otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"} assert_equal(1, otype.size) - otype = ole_types.select{|t| t.name == "DWebBrowserEvents"} + otype = ole_types.select{|t| t.name == "DWebBrowserEvents"} assert_equal(0, otype.size) end diff --git a/test/win32ole/test_win32ole_variable.rb b/test/win32ole/test_win32ole_variable.rb index 43529d3bad..5fdcb07e4c 100644 --- a/test/win32ole/test_win32ole_variable.rb +++ b/test/win32ole/test_win32ole_variable.rb @@ -6,7 +6,7 @@ require "test/unit" if defined?(WIN32OLE_VARIABLE) class TestWIN32OLE_VARIABLE < Test::Unit::TestCase - + def setup ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var1 = ole_type.variables.find {|v| v.name == 'ssfDESKTOP'} diff --git a/test/win32ole/test_win32ole_variant.rb b/test/win32ole/test_win32ole_variant.rb index af3876837d..7bf6caac49 100644 --- a/test/win32ole/test_win32ole_variant.rb +++ b/test/win32ole/test_win32ole_variant.rb @@ -102,7 +102,7 @@ if defined?(WIN32OLE_VARIANT) assert_equal(0, obj.value) assert_equal(WIN32OLE::VARIANT::VT_UI4, obj.vartype) - + if defined?(WIN32OLE::VARIANT::VT_I8) obj = WIN32OLE_VARIANT.new(nil, WIN32OLE::VARIANT::VT_I8) assert_equal(0, obj.value) @@ -114,7 +114,7 @@ if defined?(WIN32OLE_VARIANT) assert_equal(0, obj.value) assert_equal(WIN32OLE::VARIANT::VT_UI8, obj.vartype) end - + obj = WIN32OLE_VARIANT.new(nil, WIN32OLE::VARIANT::VT_INT) assert_equal(0, obj.value) assert_equal(WIN32OLE::VARIANT::VT_INT, obj.vartype) @@ -251,7 +251,7 @@ if defined?(WIN32OLE_VARIANT) assert_equal(5, obj.value) assert_equal(WIN32OLE::VARIANT::VT_UINT|WIN32OLE::VARIANT::VT_BYREF, obj.vartype) end - + # This test is failed in cygwin. # The tagVARIANT definition has no union member pllVal in cygwin. def test_s_new_with_i8_byref @@ -263,7 +263,7 @@ if defined?(WIN32OLE_VARIANT) STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_new_with_i8_byref is skipped") end end - + # This test is failed in cygwin. # The tagVARIANT definition has no union member pullVal in cygwin. def test_s_new_with_ui8_byref @@ -319,7 +319,7 @@ if defined?(WIN32OLE_VARIANT) obj = WIN32OLE_VARIANT.array([2,3], WIN32OLE::VARIANT::VT_I4|WIN32OLE::VARIANT::VT_BYREF) assert_equal(WIN32OLE::VARIANT::VT_I4|WIN32OLE::VARIANT::VT_BYREF|WIN32OLE::VARIANT::VT_ARRAY, obj.vartype) assert_equal([[0, 0, 0],[0, 0, 0]], obj.value) - + obj = WIN32OLE_VARIANT.array([2,3], WIN32OLE::VARIANT::VT_I4|WIN32OLE::VARIANT::VT_ARRAY) assert_instance_of(WIN32OLE_VARIANT, obj) assert_equal(WIN32OLE::VARIANT::VT_I4|WIN32OLE::VARIANT::VT_ARRAY, obj.vartype) @@ -383,7 +383,7 @@ if defined?(WIN32OLE_VARIANT) end def test_conversion_str2cy - begin + begin WIN32OLE.locale = 0x0411 # set locale Japanese obj = WIN32OLE_VARIANT.new("\\10,000", WIN32OLE::VARIANT::VT_CY) assert_equal("10000", obj.value) @@ -464,7 +464,7 @@ if defined?(WIN32OLE_VARIANT) obj = WIN32OLE_VARIANT.new(["abc", "123"], vartype) assert_equal(vartype, obj.vartype) assert_equal(["abc", "123"], obj.value) - + vartype = WIN32OLE::VARIANT::VT_ARRAY|WIN32OLE::VARIANT::VT_BYREF|WIN32OLE::VARIANT::VT_BSTR obj = WIN32OLE_VARIANT.new(["abc", "123"], vartype) assert_equal(vartype, obj.vartype) diff --git a/test/win32ole/test_word.rb b/test/win32ole/test_word.rb index d5b2d91812..e2ca6d4d5c 100644 --- a/test/win32ole/test_word.rb +++ b/test/win32ole/test_word.rb @@ -38,7 +38,7 @@ if defined?(WIN32OLE) @obj = WIN32OLE.new('Word.Application') rescue WIN32OLERuntimeError @obj = nil - if !$skipped + if !$skipped $skipped = true end end diff --git a/test/xmlrpc/test_datetime.rb b/test/xmlrpc/test_datetime.rb index 528e0805fc..0a84904f65 100644 --- a/test/xmlrpc/test_datetime.rb +++ b/test/xmlrpc/test_datetime.rb @@ -67,10 +67,10 @@ class Test_DateTime < Test::Unit::TestCase def test_set_exception dt = createDateTime() - + assert_raise(ArgumentError) { dt.year = 4.5 } assert_nothing_raised(ArgumentError) { dt.year = -2000 } - + assert_raise(ArgumentError) { dt.month = 0 } assert_raise(ArgumentError) { dt.month = 13 } assert_nothing_raised(ArgumentError) { dt.month = 7 } @@ -99,7 +99,7 @@ class Test_DateTime < Test::Unit::TestCase def test_to_a y, m, d, h, mi, s = 1970, 3, 24, 12, 0, 5 dt = XMLRPC::DateTime.new(y, m, d, h, mi, s) - a = dt.to_a + a = dt.to_a assert_instance_of(Array, a) assert_equal(6, a.size, "Returned array has wrong size") @@ -115,8 +115,8 @@ class Test_DateTime < Test::Unit::TestCase def test_to_time1 y, m, d, h, mi, s = 1970, 3, 24, 12, 0, 5 dt = XMLRPC::DateTime.new(y, m, d, h, mi, s) - time = dt.to_time - + time = dt.to_time + assert_not_nil(time) assert_equal(y, time.year) @@ -130,15 +130,15 @@ class Test_DateTime < Test::Unit::TestCase def test_to_time2 dt = createDateTime() dt.year = 1969 - + assert_nil(dt.to_time) end def test_to_date1 y, m, d, h, mi, s = 1970, 3, 24, 12, 0, 5 dt = XMLRPC::DateTime.new(y, m, d, h, mi, s) - date = dt.to_date - + date = dt.to_date + assert_equal(y, date.year) assert_equal(m, date.month) assert_equal(d, date.day) @@ -147,7 +147,7 @@ class Test_DateTime < Test::Unit::TestCase def test_to_date2 dt = createDateTime() dt.year = 666 - + assert_equal(666, dt.to_date.year) end diff --git a/test/xmlrpc/test_features.rb b/test/xmlrpc/test_features.rb index 377d539f26..0f867068ef 100644 --- a/test/xmlrpc/test_features.rb +++ b/test/xmlrpc/test_features.rb @@ -29,7 +29,7 @@ class Test_Features < Test::Unit::TestCase XMLRPC::XMLWriter.each_installed_writer do |writer| c = XMLRPC::Create.new(writer) - str = c.methodCall("test", *@params) + str = c.methodCall("test", *@params) XMLRPC::XMLParser.each_installed_parser do |parser| para = nil diff --git a/test/xmlrpc/test_marshal.rb b/test/xmlrpc/test_marshal.rb index 38bc8c646f..267b43e2e2 100644 --- a/test/xmlrpc/test_marshal.rb +++ b/test/xmlrpc/test_marshal.rb @@ -42,7 +42,7 @@ class Test_Marshal < Test::Unit::TestCase end def test_parser_values - v1 = [ + v1 = [ 1, -7778, # integers 1.0, 0.0, -333.0, 2343434343.0, # floats false, true, true, false, # booleans @@ -72,9 +72,9 @@ class Test_Marshal < Test::Unit::TestCase assert_equal( v3_exp, m.load_response(m.dump_response(v3)) ) pers = m.load_response(m.dump_response(person)) - + assert( pers.is_a?(Person) ) - assert( person.name == pers.name ) + assert( person.name == pers.name ) end # missing, Date, Time, DateTime diff --git a/test/xmlrpc/test_parser.rb b/test/xmlrpc/test_parser.rb index 44ca1f88b7..1c50eaed46 100644 --- a/test/xmlrpc/test_parser.rb +++ b/test/xmlrpc/test_parser.rb @@ -7,16 +7,16 @@ module GenericParserTest def datafile(base) File.join(File.dirname(__FILE__), "data", base) end - + def load_data(name) [File.read(datafile(name) + ".xml"), YAML.load(File.read(datafile(name) + ".expected"))] end def setup @xml1, @expected1 = load_data('xml1') - @xml2, @expected2 = load_data('bug_covert') - @xml3, @expected3 = load_data('bug_bool') - @xml4, @expected4 = load_data('value') + @xml2, @expected2 = load_data('bug_covert') + @xml3, @expected3 = load_data('bug_bool') + @xml4, @expected4 = load_data('value') @cdata_xml, @cdata_expected = load_data('bug_cdata') @@ -27,7 +27,7 @@ module GenericParserTest end # test parseMethodResponse -------------------------------------------------- - + def test_parseMethodResponse1 assert_equal(@expected1, @p.parseMethodResponse(@xml1)) end @@ -67,7 +67,7 @@ module GenericParserTest end end -# create test class for each installed parser +# create test class for each installed parser XMLRPC::XMLParser.each_installed_parser do |parser| klass = parser.class name = klass.to_s.split("::").last diff --git a/test/xmlrpc/test_webrick_server.rb b/test/xmlrpc/test_webrick_server.rb index 38cfe2f896..47fa5487c3 100644 --- a/test/xmlrpc/test_webrick_server.rb +++ b/test/xmlrpc/test_webrick_server.rb @@ -18,9 +18,9 @@ class Test_Webrick < Test::Unit::TestCase if b == 0 raise XMLRPC::FaultException.new(1, "division by zero") else - a / b + a / b end - end + end s.set_default_handler do |name, *args| raise XMLRPC::FaultException.new(-99, "Method #{name} missing" + @@ -34,13 +34,13 @@ class Test_Webrick < Test::Unit::TestCase def setup_http_server(port, use_ssl) option = { - :Port => port, + :Port => port, :SSLEnable => use_ssl, } if use_ssl require 'webrick/https' option.update( - :SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE, + :SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE, :SSLCertName => [] ) end diff --git a/test/xmlrpc/webrick_testing.rb b/test/xmlrpc/webrick_testing.rb index 2ca52bad22..05c334045e 100644 --- a/test/xmlrpc/webrick_testing.rb +++ b/test/xmlrpc/webrick_testing.rb @@ -5,19 +5,19 @@ module WEBrick_Testing def initialize() super(self) end def <<(*args) end end - + def start_server(config={}) raise "already started" if @__server @__started = false @__server_thread = Thread.new { @__server = WEBrick::HTTPServer.new( - { + { :Logger => DummyLog.new, :AccessLog => [], :StartCallback => proc { @__started = true } }.update(config)) - yield @__server + yield @__server @__server.start @__started = false } diff --git a/test/yaml/test_yaml.rb b/test/yaml/test_yaml.rb index 837f34722f..4f612ebaef 100644 --- a/test/yaml/test_yaml.rb +++ b/test/yaml/test_yaml.rb @@ -21,7 +21,7 @@ class YAML_Unit_Tests < Test::Unit::TestCase assert_equal( obj, YAML::load( obj.to_yaml ) ) assert_equal( obj, YAML::parse( obj.to_yaml ).transform ) assert_equal( obj, YAML::load( - obj.to_yaml( :UseVersion => true, :UseHeader => true, :SortKeys => true ) + obj.to_yaml( :UseVersion => true, :UseHeader => true, :SortKeys => true ) ) ) end @@ -133,7 +133,7 @@ EOY def test_spec_simple_map_with_nested_sequences # Simple mapping with nested sequences assert_to_yaml( - { 'american' => + { 'american' => [ 'Boston Red Sox', 'Detroit Tigers', 'New York Yankees' ], 'national' => [ 'New York Mets', 'Chicago Cubs', 'Atlanta Braves' ] }, <<EOY @@ -171,7 +171,7 @@ EOY def test_spec_sequence_of_sequences # Simple sequence with inline sequences assert_parse_only( - [ + [ [ 'name', 'hr', 'avg' ], [ 'Mark McGwire', 65, 0.278 ], [ 'Sammy Sosa', 63, 0.288 ] @@ -241,11 +241,11 @@ EOY assert_to_yaml( [{"arrival"=>"EDI", "departure"=>"LAX", "fareref"=>"DOGMA", "currency"=>"GBP"}, {"arrival"=>"MEL", "departure"=>"SYD", "fareref"=>"MADF", "currency"=>"AUD"}, {"arrival"=>"MCO", "departure"=>"JFK", "fareref"=>"DFSF", "currency"=>"USD"}], <<EOY - - + - &F fareref: DOGMA &C currency: GBP &D departure: LAX - &A arrival: EDI + &A arrival: EDI - { *F: MADF, *C: AUD, *D: SYD, *A: MEL } - { *F: DFSF, *C: USD, *D: JFK, *A: MCO } EOY @@ -285,12 +285,12 @@ EOY ? # PLAY SCHEDULE - Detroit Tigers - Chicago Cubs -: +: - 2001-07-23 ? [ New York Yankees, Atlanta Braves ] -: [ 2001-07-02, 2001-08-12, +: [ 2001-07-02, 2001-08-12, 2001-08-14 ] EOY ) @@ -352,9 +352,9 @@ EOY def test_spec_sequence_shortcuts # Sequence shortcuts combined - assert_parse_only( + assert_parse_only( [ - [ + [ [ [ 'one' ] ], [ 'two', 'three' ], { 'four' => nil }, @@ -440,7 +440,7 @@ quoted: "\\ scalar.\\n" EOY ) - end + end def test_spec_type_int assert_parse_only( @@ -678,7 +678,7 @@ EOY def test_spec_force_implicit # Force implicit - assert_parse_only( + assert_parse_only( { 'integer' => 12, 'also int' => 12, 'string' => '12' }, <<EOY integer: 12 also int: ! "12" @@ -705,7 +705,7 @@ EOY assert_equal( doc['pool'].type_id, 'x-private:ball' ) assert_equal( doc['pool'].transform.value, { 'number' => 8, 'color' => 'black' } ) when 1 - assert_equal( doc['bearing'].type_id, 'x-private:ball' ) + assert_equal( doc['bearing'].type_id, 'x-private:ball' ) assert_equal( doc['bearing'].transform.value, { 'material' => 'steel' } ) end doc_ct += 1 @@ -734,7 +734,7 @@ EOY def test_spec_override_anchor # Override anchor a001 = "The alias node below is a repeated use of this value.\n" - assert_parse_only( + assert_parse_only( { 'anchor' => 'This scalar has an anchor.', 'override' => a001, 'alias' => a001 }, <<EOY anchor : &A001 This scalar has an anchor. override : &A001 > @@ -758,7 +758,7 @@ picture: !binary | Pz7Y6OjuDg4J+fn5OTk6enp 56enmleECcgggoBADs= -hmm: !somewhere.com,2002/type | +hmm: !somewhere.com,2002/type | family above is short for http://somewhere.com/type EOY @@ -843,7 +843,7 @@ EOY def test_spec_builtin_map # Assortment of mappings - assert_parse_only( + assert_parse_only( { 'empty' => {}, 'in-line' => { 'one' => 1, 'two' => 2 }, 'spanning' => { 'one' => 1, 'two' => 2 }, 'nested' => { 'first' => 'First entry', 'second' => @@ -945,9 +945,9 @@ EOY str1 = "This has one newline.\n" str2 = "This has no newline." str3 = "This has two newlines.\n\n" - assert_parse_only( - { 'clipped' => str1, 'same as "clipped" above' => str1, - 'stripped' => str2, 'same as "stripped" above' => str2, + assert_parse_only( + { 'clipped' => str1, 'same as "clipped" above' => str1, + 'stripped' => str2, 'same as "stripped" above' => str2, 'kept' => str3, 'same as "kept" above' => str3 }, <<EOY clipped: | This has one newline. @@ -967,7 +967,7 @@ same as "kept" above: "This has two newlines.\\n\\n" EOY ) end - + def test_spec_span_single_quote assert_parse_only( {"third"=>"a single quote ' must be escaped.", "second"=>"! : \\ etc. can be used freely.", "is same as"=>"this contains six spaces\nand one line break", "empty"=>"", "span"=>"this contains six spaces\nand one line break"}, <<EOY empty: '' @@ -975,7 +975,7 @@ second: '! : \\ etc. can be used freely.' third: 'a single quote '' must be escaped.' span: 'this contains six spaces - + and one line break' is same as: "this contains six spaces\\nand one line break" @@ -1000,9 +1000,9 @@ EOY def test_spec_builtin_time # Time assert_parse_only( - { "space separated" => mktime( 2001, 12, 14, 21, 59, 43, ".10", "-05:00" ), - "canonical" => mktime( 2001, 12, 15, 2, 59, 43, ".10" ), - "date (noon UTC)" => Date.new( 2002, 12, 14), + { "space separated" => mktime( 2001, 12, 14, 21, 59, 43, ".10", "-05:00" ), + "canonical" => mktime( 2001, 12, 15, 2, 59, 43, ".10" ), + "date (noon UTC)" => Date.new( 2002, 12, 14), "valid iso8601" => mktime( 2001, 12, 14, 21, 59, 43, ".10", "-05:00" ) }, <<EOY canonical: 2001-12-15T02:59:43.1Z valid iso8601: 2001-12-14t21:59:43.10-05:00 @@ -1015,7 +1015,7 @@ EOY def test_spec_builtin_binary arrow_gif = "GIF89a\f\000\f\000\204\000\000\377\377\367\365\365\356\351\351\345fff\000\000\000\347\347\347^^^\363\363\355\216\216\216\340\340\340\237\237\237\223\223\223\247\247\247\236\236\236iiiccc\243\243\243\204\204\204\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371!\376\016Made with GIMP\000,\000\000\000\000\f\000\f\000\000\005, \216\2010\236\343@\024\350i\020\304\321\212\010\034\317\200M$z\357\3770\205p\270\2601f\r\e\316\001\303\001\036\020' \202\n\001\000;" assert_parse_only( - { 'canonical' => arrow_gif, 'base64' => arrow_gif, + { 'canonical' => arrow_gif, 'base64' => arrow_gif, 'description' => "The binary value above is a tiny arrow encoded as a gif image.\n" }, <<EOY canonical: !binary "\\ R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOf\\ @@ -1041,7 +1041,7 @@ EOY end def test_ruby_regexp # Test Ruby regular expressions - assert_to_yaml( + assert_to_yaml( { 'simple' => /a.b/, 'complex' => %r'\A"((?:[^"]|\")+)"', 'case-insensitive' => /George McFly/i }, <<EOY case-insensitive: !ruby/regexp "/George McFly/i" @@ -1078,8 +1078,8 @@ EOY book_struct = Struct::new( "BookStruct", :author, :title, :year, :isbn ) assert_to_yaml( [ book_struct.new( "Yukihiro Matsumoto", "Ruby in a Nutshell", 2002, "0-596-00214-9" ), - book_struct.new( [ 'Dave Thomas', 'Andy Hunt' ], "The Pickaxe", 2002, - book_struct.new( "This should be the ISBN", "but I have another struct here", 2002, "None" ) + book_struct.new( [ 'Dave Thomas', 'Andy Hunt' ], "The Pickaxe", 2002, + book_struct.new( "This should be the ISBN", "but I have another struct here", 2002, "None" ) ) ], <<EOY - !ruby/struct:BookStruct :author: Yukihiro Matsumoto @@ -1109,7 +1109,7 @@ EOY def test_ruby_rational assert_to_yaml( Rational(1, 2), <<EOY ) ---- !ruby/object:Rational +--- !ruby/object:Rational numerator: 1 denominator: 2 EOY @@ -1121,7 +1121,7 @@ EOY def test_ruby_complex assert_to_yaml( Complex(3, 4), <<EOY ) ---- !ruby/object:Complex +--- !ruby/object:Complex image: 4 real: 3 EOY @@ -1143,7 +1143,7 @@ EOY # def test_document y = YAML::Stream.new( :Indent => 2, :UseVersion => 0 ) - y.add( + y.add( { 'hi' => 'hello', 'map' => { 'good' => 'two' }, 'time' => Time.now, diff --git a/test/yaml/test_yamlstore.rb b/test/yaml/test_yamlstore.rb index 7a3d90469e..69302095e5 100644 --- a/test/yaml/test_yamlstore.rb +++ b/test/yaml/test_yamlstore.rb @@ -17,14 +17,14 @@ class YAMLStoreTest < Test::Unit::TestCase assert_nil @yamlstore[:bar] end end - + def test_opening_new_file_in_readwrite_mode_should_result_in_empty_values @yamlstore.transaction do assert_nil @yamlstore[:foo] assert_nil @yamlstore[:bar] end end - + def test_data_should_be_loaded_correctly_when_in_readonly_mode @yamlstore.transaction do @yamlstore[:foo] = "bar" @@ -33,7 +33,7 @@ class YAMLStoreTest < Test::Unit::TestCase assert_equal "bar", @yamlstore[:foo] end end - + def test_data_should_be_loaded_correctly_when_in_readwrite_mode @yamlstore.transaction do @yamlstore[:foo] = "bar" @@ -42,7 +42,7 @@ class YAMLStoreTest < Test::Unit::TestCase assert_equal "bar", @yamlstore[:foo] end end - + def test_changes_after_commit_are_discarded @yamlstore.transaction do @yamlstore[:foo] = "bar" @@ -53,7 +53,7 @@ class YAMLStoreTest < Test::Unit::TestCase assert_equal "bar", @yamlstore[:foo] end end - + def test_changes_are_not_written_on_abort @yamlstore.transaction do @yamlstore[:foo] = "bar" @@ -63,7 +63,7 @@ class YAMLStoreTest < Test::Unit::TestCase assert_nil @yamlstore[:foo] end end - + def test_writing_inside_readonly_transaction_raises_error assert_raise(PStore::Error) do @yamlstore.transaction(true) do |