* {ext,lib,test}/**/*.rb: removed trailing spaces.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-03-06 03:56:38 +00:00
Родитель 9b52ae2e64
Коммит 287a34ae0d
856 изменённых файлов: 13989 добавлений и 13989 удалений

Просмотреть файл

@ -17,7 +17,7 @@ module LUSolve
end
if nrmrow>zero then
scales <<= one.div(nrmrow,prec)
else
else
raise "Singular matrix"
end
end

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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"

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -39,9 +39,9 @@ module DL
raise(RuntimeError, "sizeof(void*)?")
end
end
private
def align(addr, align)
d = addr % align
if( d == 0 )

Просмотреть файл

@ -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
#

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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'])

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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
#

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -173,7 +173,7 @@ class Ripper
@tokens[@match.begin(n)...@match.end(n)].map {|pos,type,str| str }
end
end
end
end

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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) ) )

Просмотреть файл

@ -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')

Просмотреть файл

@ -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')

Просмотреть файл

@ -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)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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'

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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)

Просмотреть файл

@ -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
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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 = {}

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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]

Просмотреть файл

@ -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

Просмотреть файл

@ -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) << ''

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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
}

Просмотреть файл

@ -9,8 +9,8 @@ module TkPalette
extend Tk
TkCommandNames = [
'tk_setPalette'.freeze,
'tk_bisque'.freeze,
'tk_setPalette'.freeze,
'tk_bisque'.freeze,
'tkDarken'.freeze
].freeze

Просмотреть файл

@ -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)

Просмотреть файл

@ -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)

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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'))

Просмотреть файл

@ -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

Просмотреть файл

@ -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))

Просмотреть файл

@ -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
]

Просмотреть файл

@ -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]

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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>, ...
#

Просмотреть файл

@ -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

Просмотреть файл

@ -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?

Просмотреть файл

@ -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))

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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))

Просмотреть файл

@ -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

Просмотреть файл

@ -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.
#

Просмотреть файл

@ -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

Просмотреть файл

@ -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'))

Просмотреть файл

@ -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

Просмотреть файл

@ -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.
#

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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.
#

Просмотреть файл

@ -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

Просмотреть файл

@ -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.
#

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше