2000-04-10
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7194267b3b
commit
4a67017698
@ -350,6 +350,10 @@ module TkComm
|
|||||||
_bind_core('+', what, context, cmd, args)
|
_bind_core('+', what, context, cmd, args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def _bind_remove(what, context)
|
||||||
|
tk_call(*(what + ["<#{tk_event_sequence(context)}>", '']))
|
||||||
|
end
|
||||||
|
|
||||||
def _bindinfo(what, context=nil)
|
def _bindinfo(what, context=nil)
|
||||||
if context
|
if context
|
||||||
tk_call(*what+["<#{tk_event_sequence(context)}>"]).collect {|cmdline|
|
tk_call(*what+["<#{tk_event_sequence(context)}>"]).collect {|cmdline|
|
||||||
@ -366,7 +370,7 @@ module TkComm
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
private :install_bind, :tk_event_sequence,
|
private :install_bind, :tk_event_sequence,
|
||||||
:_bind_core, :_bind, :_bind_append, :_bindinfo
|
:_bind_core, :_bind, :_bind_append, ,:_bind_remove, :_bindinfo
|
||||||
|
|
||||||
def bind(tagOrClass, context, cmd=Proc.new, args=nil)
|
def bind(tagOrClass, context, cmd=Proc.new, args=nil)
|
||||||
_bind(["bind", tagOrClass], context, cmd, args)
|
_bind(["bind", tagOrClass], context, cmd, args)
|
||||||
@ -376,6 +380,10 @@ module TkComm
|
|||||||
_bind_append(["bind", tagOrClass], context, cmd, args)
|
_bind_append(["bind", tagOrClass], context, cmd, args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bind_remove(tagOrClass, context)
|
||||||
|
_bind_remove(['bind', tagOrClass], context)
|
||||||
|
end
|
||||||
|
|
||||||
def bindinfo(tagOrClass, context=nil)
|
def bindinfo(tagOrClass, context=nil)
|
||||||
_bindinfo(['bind', tagOrClass], context)
|
_bindinfo(['bind', tagOrClass], context)
|
||||||
end
|
end
|
||||||
@ -729,6 +737,10 @@ module TkBindCore
|
|||||||
Tk.bind_append(to_eval, context, cmd, args)
|
Tk.bind_append(to_eval, context, cmd, args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bind_remove(context)
|
||||||
|
Tk.bind_remove(to_eval, context)
|
||||||
|
end
|
||||||
|
|
||||||
def bindinfo(context=nil)
|
def bindinfo(context=nil)
|
||||||
Tk.bindinfo(to_eval, context)
|
Tk.bindinfo(to_eval, context)
|
||||||
end
|
end
|
||||||
|
@ -428,8 +428,16 @@ class TkText<TkTextWin
|
|||||||
rsearch_with_length(pat,start,stop)[0]
|
rsearch_with_length(pat,start,stop)[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
def _dump(type, *index)
|
def dump(type_info, *index)
|
||||||
str = tk_send('dump', type, *index)
|
args = type_info.collect{|inf|
|
||||||
|
if inf.kind_of? Array
|
||||||
|
inf[0] = '-' + inf[0]
|
||||||
|
inf
|
||||||
|
else
|
||||||
|
'-' + inf
|
||||||
|
end
|
||||||
|
}.flatten
|
||||||
|
str = tk_send('dump', *(args + index))
|
||||||
result = []
|
result = []
|
||||||
sel = nil
|
sel = nil
|
||||||
i = 0
|
i = 0
|
||||||
@ -501,24 +509,64 @@ class TkText<TkTextWin
|
|||||||
end
|
end
|
||||||
kvis # result is [[key1, value1, index1], [key2, value2, index2], ...]
|
kvis # result is [[key1, value1, index1], [key2, value2, index2], ...]
|
||||||
end
|
end
|
||||||
private :_dump
|
|
||||||
|
def _retrieve_braced_text(str, i)
|
||||||
|
cnt = 0
|
||||||
|
idx = i
|
||||||
|
while idx < str.size
|
||||||
|
case str[idx]
|
||||||
|
when ?{
|
||||||
|
cnt += 1
|
||||||
|
when ?}
|
||||||
|
cnt -= 1
|
||||||
|
if cnt == 0
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
idx += 1
|
||||||
|
end
|
||||||
|
return str[i+1..idx-1], idx + 2
|
||||||
|
end
|
||||||
|
private :_retrieve_braced_text
|
||||||
|
|
||||||
|
def _retrieve_backslashed_text(str, i)
|
||||||
|
j = i
|
||||||
|
idx = nil
|
||||||
|
loop {
|
||||||
|
idx = str.index(/ /, j)
|
||||||
|
if str[idx-1] == ?\\
|
||||||
|
j += 1
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
|
}
|
||||||
|
val = str[i..(idx-1)]
|
||||||
|
val.gsub!(/\\( |\{|\})/, '\1')
|
||||||
|
return val, idx + 1
|
||||||
|
end
|
||||||
|
private :_retrieve_backslashed_text
|
||||||
|
|
||||||
def dump_all(*index)
|
def dump_all(*index)
|
||||||
_dump('-all', *index)
|
dump(['all'], *index)
|
||||||
|
end
|
||||||
|
def dump_command(cmd, *index)
|
||||||
|
dump([['command', cmd]], *index)
|
||||||
end
|
end
|
||||||
def dump_mark(*index)
|
def dump_mark(*index)
|
||||||
_dump('-mark', *index)
|
dump(['mark'], *index)
|
||||||
end
|
end
|
||||||
def dump_tag(*index)
|
def dump_tag(*index)
|
||||||
_dump('-tag', *index)
|
dump(['tag'], *index)
|
||||||
end
|
end
|
||||||
def dump_text(*index)
|
def dump_text(*index)
|
||||||
_dump('-text', *index)
|
dump(['text'], *index)
|
||||||
end
|
end
|
||||||
def dump_window(*index)
|
def dump_window(*index)
|
||||||
_dump('-window', *index)
|
dump(['window'], *index)
|
||||||
|
end
|
||||||
|
def dump_image(*index)
|
||||||
|
dump(['image'], *index)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkTextTag<TkObject
|
class TkTextTag<TkObject
|
||||||
@ -831,42 +879,6 @@ class TkTextWindow<TkObject
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def _retrieve_braced_text(str, i)
|
|
||||||
cnt = 0
|
|
||||||
idx = i
|
|
||||||
while idx < str.size
|
|
||||||
case str[idx]
|
|
||||||
when ?{
|
|
||||||
cnt += 1
|
|
||||||
when ?}
|
|
||||||
cnt -= 1
|
|
||||||
if cnt == 0
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
idx += 1
|
|
||||||
end
|
|
||||||
return str[i+1..idx-1], idx + 2
|
|
||||||
end
|
|
||||||
private :_retrieve_braced_text
|
|
||||||
|
|
||||||
def _retrieve_backslashed_text(str, i)
|
|
||||||
j = i
|
|
||||||
idx = nil
|
|
||||||
loop {
|
|
||||||
idx = str.index(/ /, j)
|
|
||||||
if str[idx-1] == ?\\
|
|
||||||
j += 1
|
|
||||||
else
|
|
||||||
break
|
|
||||||
end
|
|
||||||
}
|
|
||||||
val = str[i..(idx-1)]
|
|
||||||
val.gsub!(/\\( |\{|\})/, '\1')
|
|
||||||
return val, idx + 1
|
|
||||||
end
|
|
||||||
private :_retrieve_backslashed_text
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class TkTextImage<TkObject
|
class TkTextImage<TkObject
|
||||||
|
Loading…
x
Reference in New Issue
Block a user