bbox(index)
click to toggle source
def bbox(index)
list(tk_send('bbox', index))
end
child_site()
click to toggle source
def child_site
window(tk_call(@path, 'childsite'))
end
clear()
click to toggle source
def clear
tk_call(@path, 'clear')
self
end
compare(idx1, op, idx2)
click to toggle source
def compare(idx1, op, idx2)
bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1),
op, _get_eval_enc_str(idx2)))
end
current_image_configinfo(index, slot = nil)
click to toggle source
def current_image_configinfo(index, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
conf = image_configinfo(index, slot)
{conf[0] => conf[4]}
else
ret = {}
image_configinfo(index).each{|conf|
ret[conf[0]] = conf[4] if conf.size > 2
}
ret
end
else
ret = {}
image_configinfo(index, slot).each{|k, conf|
ret[k] = conf[-1] if conf.kind_of?(Array)
}
ret
end
end
debug()
click to toggle source
def debug
bool(tk_send_without_enc('debug'))
end
debug=(boolean)
click to toggle source
def debug=(boolean)
tk_send_without_enc('debug', boolean)
boolean
end
delete(first, last=None)
click to toggle source
def delete(first, last=None)
tk_send_without_enc('delete', first, last)
self
end
dlineinfo(index)
click to toggle source
def dlineinfo(index)
list(tk_send_without_enc('dlineinfo', _get_eval_enc_str(index)))
end
export(file)
click to toggle source
def export(file)
tk_call(@path, 'export', file)
self
end
get(*index)
click to toggle source
def get(*index)
_fromUTF8(tk_send_without_enc('get', *index))
end
get_displaychars(*index)
click to toggle source
def get_displaychars(*index)
get('-displaychars', *index)
end
image_cget(index, slot)
click to toggle source
def image_cget(index, slot)
unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
image_cget_strict(index, slot)
else
begin
image_cget_strict(index, slot)
rescue => e
begin
if current_image_configinfo.has_key?(slot.to_s)
fail e
else
nil
end
rescue
fail e
end
end
end
end
image_cget_strict(index, slot)
click to toggle source
def image_cget_strict(index, slot)
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
_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),
"-#{slot}")))
end
end
image_cget_tkstring(index, slot)
click to toggle source
def image_cget_tkstring(index, slot)
_fromUTF8(tk_send_without_enc('image', 'cget',
_get_eval_enc_str(index), "-#{slot.to_s}"))
end
image_configinfo(index, slot = nil)
click to toggle source
def image_configinfo(index, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
conf = tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), false, true)
else
conf = tk_split_list(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), 0, false, true)
end
conf[0] = conf[0][1..-1]
conf
else
tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)), false, false).collect{|conflist|
conf = tk_split_simplelist(conflist, false, true)
conf[0] = conf[0][1..-1]
case conf[0]
when 'text', 'label', 'show', 'data', 'file'
else
if conf[3]
if conf[3].index('{')
conf[3] = tk_split_list(conf[3])
else
conf[3] = tk_tcl2ruby(conf[3])
end
end
if conf[4]
if conf[4].index('{')
conf[4] = tk_split_list(conf[4])
else
conf[4] = tk_tcl2ruby(conf[4])
end
end
end
conf[1] = conf[1][1..-1] if conf.size == 2
conf
}
end
else
if slot
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
conf = tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), false, true)
else
conf = tk_split_list(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), 0, false, true)
end
key = conf.shift[1..-1]
{ key => conf }
else
ret = {}
tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)), false, false).each{|conflist|
conf = tk_split_simplelist(conflist, false, true)
key = conf.shift[1..-1]
case key
when 'text', 'label', 'show', 'data', 'file'
else
if conf[2]
if conf[2].index('{')
conf[2] = tk_split_list(conf[2])
else
conf[2] = tk_tcl2ruby(conf[2])
end
end
if conf[3]
if conf[3].index('{')
conf[3] = tk_split_list(conf[3])
else
conf[3] = tk_tcl2ruby(conf[3])
end
end
end
if conf.size == 1
ret[key] = conf[0][1..-1]
else
ret[key] = conf
end
}
ret
end
end
end
image_names()
click to toggle source
def image_names
tk_split_simplelist(tk_send_without_enc('image', 'names'), false, true).collect{|elt|
tagid2obj(elt)
}
end
import(file, idx=nil)
click to toggle source
def import(file, idx=nil)
if idx
tk_call(@path, 'import', file, index(idx))
else
tk_call(@path, 'import', file)
end
self
end
index(idx)
click to toggle source
def index(idx)
tk_send_without_enc('index', _get_eval_enc_str(idx))
end
insert(index, *args)
click to toggle source
def insert(index, *args)
tk_send('insert', index, *args)
self
end
mark_gravity(mark, direction=nil)
click to toggle source
def mark_gravity(mark, direction=nil)
if direction
tk_send_without_enc('mark', 'gravity',
_get_eval_enc_str(mark), direction)
self
else
tk_send_without_enc('mark', 'gravity', _get_eval_enc_str(mark))
end
end
mark_names()
click to toggle source
def mark_names
tk_split_simplelist(tk_send_without_enc('mark', 'names'), false, true).collect{|elt|
tagid2obj(elt)
}
end
mark_next(index)
click to toggle source
def mark_next(index)
tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'next',
_get_eval_enc_str(index))))
end
mark_previous(index)
click to toggle source
def mark_previous(index)
tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous',
_get_eval_enc_str(index))))
end
mark_set(mark, index)
click to toggle source
def mark_set(mark, index)
tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark),
_get_eval_enc_str(index))
self
end
mark_unset(*marks)
click to toggle source
def mark_unset(*marks)
tk_send_without_enc('mark', 'unset',
*(marks.collect{|mark| _get_eval_enc_str(mark)}))
self
end
method_missing(id, *args)
click to toggle source
def method_missing(id, *args)
if @text.respond_to?(id)
@text.__send__(id, *args)
else
super(id, *args)
end
end
next_mark(index)
click to toggle source
previous_mark(index)
click to toggle source
rsearch(pat,start,stop=None)
click to toggle source
def rsearch(pat,start,stop=None)
rsearch_with_length(pat,start,stop)[0]
end
rsearch_with_length(pat,start,stop=None)
click to toggle source
def rsearch_with_length(pat,start,stop=None)
pat = pat.chr if pat.kind_of? Integer
if stop != None
return ["", 0] if compare(start,'<=',stop)
txt = get(stop,start)
if (pos = txt.rindex(pat))
match = $&
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
else
return [index(stop + " + #{pos} chars"), _ktext_length(match), match]
end
else
return ["", 0]
end
else
txt = get('1.0',start)
if (pos = txt.rindex(pat))
match = $&
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
else
return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
end
else
txt = get('1.0','end - 1 char')
if (pos = txt.rindex(pat))
match = $&
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup]
else
return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
end
else
return ["", 0]
end
end
end
end
scan_dragto(x, y)
click to toggle source
def scan_dragto(x, y)
tk_send_without_enc('scan', 'dragto', x, y)
self
end
scan_mark(x, y)
click to toggle source
def scan_mark(x, y)
tk_send_without_enc('scan', 'mark', x, y)
self
end
search(pat,start,stop=None)
click to toggle source
def search(pat,start,stop=None)
search_with_length(pat,start,stop)[0]
end
search_with_length(pat,start,stop=None)
click to toggle source
def search_with_length(pat,start,stop=None)
pat = pat.chr if pat.kind_of? Integer
if stop != None
return ["", 0] if compare(start,'>=',stop)
txt = get(start,stop)
if (pos = txt.index(pat))
match = $&
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
return [index(start + " + #{pos} chars"),
_ktext_length(pat), pat.dup]
else
return [index(start + " + #{pos} chars"),
_ktext_length(match), match]
end
else
return ["", 0]
end
else
txt = get(start,'end - 1 char')
if (pos = txt.index(pat))
match = $&
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
return [index(start + " + #{pos} chars"),
_ktext_length(pat), pat.dup]
else
return [index(start + " + #{pos} chars"),
_ktext_length(match), match]
end
else
txt = get('1.0','end - 1 char')
if (pos = txt.index(pat))
match = $&
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
if pat.kind_of? String
return [index("1.0 + #{pos} chars"),
_ktext_length(pat), pat.dup]
else
return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
end
else
return ["", 0]
end
end
end
end
see(index)
click to toggle source
def see(index)
tk_send_without_enc('see', index)
self
end
set_mark(mark, index)
click to toggle source
tksearch(*args)
click to toggle source
def tksearch(*args)
if args[0].kind_of?(Array)
opts = args.shift.collect{|opt| '-' + opt.to_s }
else
opts = []
end
opts << '--'
ret = tk_send('search', *(opts + args))
if ret == ""
nil
else
ret
end
end
tksearch_with_count(*args)
click to toggle source
def tksearch_with_count(*args)
if args[0].kind_of?(Array)
opts = args.shift.collect{|opt| '-' + opt.to_s }
else
opts = []
end
opts << '-count' << args.shift << '--'
ret = tk_send('search', *(opts + args))
if ret == ""
nil
else
ret
end
end
unset_mark(*marks)
click to toggle source
xview(*index)
click to toggle source
def xview(*index)
if index.size == 0
list(tk_send_without_enc('xview'))
else
tk_send_without_enc('xview', *index)
self
end
end
xview_moveto(*index)
click to toggle source
def xview_moveto(*index)
xview('moveto', *index)
end
yview(*index)
click to toggle source
def yview(*index)
if index.size == 0
list(tk_send_without_enc('yview'))
else
tk_send_without_enc('yview', *index)
self
end
end
yview_moveto(*index)
click to toggle source
def yview_moveto(*index)
yview('moveto', *index)
end