2004-07-14 21:18:57 -04:00
|
|
|
#
|
|
|
|
# tkextlib/iwidgets/scrolledtext.rb
|
|
|
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
|
|
|
#
|
|
|
|
|
|
|
|
require 'tk'
|
|
|
|
require 'tk/text'
|
|
|
|
require 'tkextlib/iwidgets.rb'
|
|
|
|
|
|
|
|
module Tk
|
|
|
|
module Iwidgets
|
|
|
|
class Scrolledtext < Tk::Iwidgets::Scrolledwidget
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Tk::Iwidgets::Scrolledtext
|
|
|
|
TkCommandNames = ['::iwidgets::scrolledtext'.freeze].freeze
|
|
|
|
WidgetClassName = 'Scrolledtext'.freeze
|
|
|
|
WidgetClassNames[WidgetClassName] = self
|
|
|
|
|
* ext/tk/extconf.rb: improbe messages [ruby-core:06325].
* ext/tk/lib/tk.rb, ext/tk/lib/tk/canvas.rb, ext/tk/lib/tk/entry.rb,
ext/tk/lib/tk/frame.rb, ext/tk/lib/tk/image.rb,
ext/tk/lib/tk/itemconfig.rb, ext/tk/lib/tk/labelframe.rb,
ext/tk/lib/tk/listbox.rb, ext/tk/lib/tk/menu.rb,
ext/tk/lib/tk/radiobutton.rb, ext/tk/lib/tk/scale.rb,
ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tk/text.rb,
ext/tk/lib/tk/toplevel.rb: improve conversion of option values.
* ext/tk/lib/tkextlib/*: ditto.
* ext/tk/lib/tkextlib/*: update to support ActiveTcl8.4.11.2.
* ext/tk/lib/tkextlib/trofs/*: support Trofs 0.4.3.
* ext/tk/lib/tkextlib/tile/*: support Tile 0.7.2.
* ext/tk/lib/tkextlib/vu/*: support vu 2.3.0.
* ext/tk/lib/tkextlib/tcllib/*: support Tcllib 1.8 (Tklib 0.3).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-10-22 18:17:08 -04:00
|
|
|
def __strval_optkeys
|
|
|
|
super() << 'textbackground'
|
|
|
|
end
|
|
|
|
private :__strval_optkeys
|
|
|
|
|
|
|
|
def __font_optkeys
|
|
|
|
super() << 'textfont'
|
|
|
|
end
|
|
|
|
private :__font_optkeys
|
|
|
|
|
2004-07-14 21:18:57 -04:00
|
|
|
################################
|
|
|
|
|
|
|
|
def initialize(*args)
|
|
|
|
super(*args)
|
|
|
|
@text = component_widget('text')
|
|
|
|
end
|
|
|
|
|
|
|
|
def method_missing(id, *args)
|
* ext/tk/tcltklib.c: SEGV when tcltk-stubs is enabled.
* ext/tk/tcltklib.c: avoid error on a shared object.
* ext/tk/extconf.rb: support --with-tcltkversion
* ext/tk/README.tcltklib: add document about --with-tcltkversion
* ext/tk/lib/tk.rb, ext/tk/lib/multi-tk.rb, ext/tk/lib/remote-tk.rb:
not work on $SAFE==4
* ext/tk/lib/multi-tk.rb: Object#methods returns Symbols on Ruby1.9.
* ext/tk/lib/tk/timer.rb: add TkTimer#at_end(proc) to register the
procedure which called at end of the timer.
* ext/tk/lib/tk.rb, ext/tk/lib/tk/itemfont.rb, ext/tk/lib/font.rb:
support __IGNORE_UNKNOWN_CONFIGURE_OPTION__ about font options.
* ext/tk/lib/*: treat __IGNORE_UNKNOWN_CONFIGURE_OPTION__
* ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb,
ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb,
ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb: bug fix.
* ext/tk/lib/tk/text.rb: typo. call a wrong method.
* ext/tk/lib/tk/itemconfig.rb: ditto.
* ext/tk/lib/tk.rb, ext/tk/lib/tk/itemconfig.rb,
ext/tk/lib/tk/canvas.rb: support alias names of option keys.
* ext/tk/lib/tk/grid.rb: lack of module-method definitions.
* ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: increase supported
parameter patterns of configure method.
* ext/tk/lib/tk.rb: add TkWindow#grid_anchor, grid_column, grid_row.
* ext/tk/lib/tk/wm.rb: methods of Tk::Wm_for_General module cannot
pass the given block to methods of Tk::Wm module.
* ext/tk/lib/tk/wm.rb: Wm#overrideredirect overwrites arguemnt to
an invalid value.
* ext/tk/lib/tk.rb: fix memory (object) leak bug.
* ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: fix memory leak.
* ext/tk/sample/demos-jp/aniwave.rb, ext/tk/sample/demos-en/aniwave.rb:
bug fix.
* ext/tk/lib/tkextlib/blt/component.rb,
ext/tk/lib/tkextlib/tile/tentry.rb,
ext/tk/lib/tkextlib/tile/treeview.rb: ditto.
* ext/tk/lib/tkextlib/tile/tpaned.rb: improve TPaned#add.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget,
ext/tk/sample/demos-jp/style.rb, ext/tk/sample/demos-en/style.rb,
ext/tk/sample/demos-jp/bind.rb, ext/tk/sample/demos-en/bind.rb:
bug fix.
* ext/tk/sample/ttk_wrapper.rb: ditto.
* ext/tk/sample/ttk_wrapper.rb: support "if __FILE__ == $0" idiom.
* ext/tk/sample/tktextio.rb: add binding for 'Ctrl-u' at console mode.
* ext/tk/lib/tkextlib/tile.rb, ext/tk/lib/tkextlib/tile/style.rb,
ext/tk/sample/ttk_wrapper.rb: improve treating and control themes.
add Tk::Tile.themes and Tk::Tile.set_theme(theme).
* ext/tk/lib/tkextlib/tile.rb: lack of autoload definitions.
* ext/tk/lib/tkextlib/tile/tnotebook.rb: cannot use kanji (not UTF-8)
characters for headings.
* ext/tk/lib/tkextlib/tkDND/shape.rb: wrong package name.
* ext/tk/tkutil/tkutil.c: improve handling callback-subst-keys.
Now, support longnam-keys (e.g. '%CTT' on tkdnd-2.0; however, still
not support tkdnd-2.0 on tkextlib), and symbols of parameters (e.g.
:widget=>'%W', :keycode=>'%k', '%x'=>:x, '%X'=>:root_x, and so on;
those are attributes of event object). It means that Ruby/Tk accepts
not only "widget.bind(ev, '%W', '%k', ...){|w, k, ...| ... }", but
also "widget.bind(ev, :widget, :keycode, ...){|w, k, ...| ... }".
It is potentially incompatible, when user passes symbols to the
arguments of the callback block (the block receives the symbols as
strings). I think that is very rare case (probably, used by Ruby/Tk
experts only). When causes such trouble, please give strings instead
of such symbol parameters (e.g. call Symbol#to_s method).
* ext/tk/lib/tk/event.rb, ext/tk/lib/tk/validation.rb,
ext/tk/lib/tkextlib/blt/treeview.rb,
ext/tk/lib/tkextlib/winico/winico.rb: ditto.
* ext/tk/tkutil/tkutil.c: strings are available on subst_tables on
TkUtil::CallbackSubst class (it is useful on Ruby 1.9).
* ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tkextlib/iwidgets/hierarchy.rb,
ext/tk/lib/tkextlib/iwidgets/spinner.rb,
ext/tk/lib/tkextlib/iwidgets/entryfield.rb,
ext/tk/lib/tkextlib/iwidgets/calendar.rb,
ext/tk/lib/tkextlib/blt/dragdrop.rb,
ext/tk/lib/tkextlib/tkDND/tkdnd.rb,
ext/tk/lib/tkextlib/treectrl/tktreectrl.rb,
ext/tk/lib/tkextlib/tktable/tktable.rb: disable code piece became
unnecessary by reason of the changes of ext/tk/tkutil/tkutil.c.
* ext/tk/lib/tk.rb, ext/tk/lib/multi-tk.rb: change strategy to define
the constant WITH_ENCODING.
* ext/tk/lib/tk.rb: fix bug on Tk::Encoding.tk_encoding_names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 16:59:10 -04:00
|
|
|
if @text.respond_to?(id)
|
2004-07-14 21:18:57 -04:00
|
|
|
@text.__send__(id, *args)
|
|
|
|
else
|
|
|
|
super(id, *args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
################################
|
|
|
|
|
|
|
|
def child_site
|
|
|
|
window(tk_call(@path, 'childsite'))
|
|
|
|
end
|
|
|
|
|
|
|
|
def clear
|
|
|
|
tk_call(@path, 'clear')
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def import(file, idx=nil)
|
|
|
|
if idx
|
|
|
|
tk_call(@path, 'import', file, index(idx))
|
|
|
|
else
|
|
|
|
tk_call(@path, 'import', file)
|
|
|
|
end
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def export(file)
|
|
|
|
tk_call(@path, 'export', file)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
#####################################
|
|
|
|
|
|
|
|
include TkTextTagConfig
|
|
|
|
|
|
|
|
def tagid(tag)
|
|
|
|
if tag.kind_of?(Tk::Itk::Component)
|
|
|
|
tag.name
|
|
|
|
else
|
|
|
|
super(tag)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
private :tagid
|
|
|
|
|
|
|
|
def bbox(index)
|
|
|
|
list(tk_send('bbox', index))
|
|
|
|
end
|
|
|
|
def compare(idx1, op, idx2)
|
2009-03-05 22:56:38 -05:00
|
|
|
bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1),
|
2004-10-11 00:51:21 -04:00
|
|
|
op, _get_eval_enc_str(idx2)))
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def debug
|
|
|
|
bool(tk_send_without_enc('debug'))
|
|
|
|
end
|
|
|
|
def debug=(boolean)
|
|
|
|
tk_send_without_enc('debug', boolean)
|
|
|
|
#self
|
|
|
|
boolean
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete(first, last=None)
|
|
|
|
tk_send_without_enc('delete', first, last)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def dlineinfo(index)
|
|
|
|
list(tk_send_without_enc('dlineinfo', _get_eval_enc_str(index)))
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(*index)
|
|
|
|
_fromUTF8(tk_send_without_enc('get', *index))
|
|
|
|
end
|
|
|
|
def get_displaychars(*index)
|
|
|
|
# Tk8.5 feature
|
|
|
|
get('-displaychars', *index)
|
|
|
|
end
|
|
|
|
|
* ext/tk/tcltklib.c: SEGV when tcltk-stubs is enabled.
* ext/tk/tcltklib.c: avoid error on a shared object.
* ext/tk/extconf.rb: support --with-tcltkversion
* ext/tk/README.tcltklib: add document about --with-tcltkversion
* ext/tk/lib/tk.rb, ext/tk/lib/multi-tk.rb, ext/tk/lib/remote-tk.rb:
not work on $SAFE==4
* ext/tk/lib/multi-tk.rb: Object#methods returns Symbols on Ruby1.9.
* ext/tk/lib/tk/timer.rb: add TkTimer#at_end(proc) to register the
procedure which called at end of the timer.
* ext/tk/lib/tk.rb, ext/tk/lib/tk/itemfont.rb, ext/tk/lib/font.rb:
support __IGNORE_UNKNOWN_CONFIGURE_OPTION__ about font options.
* ext/tk/lib/*: treat __IGNORE_UNKNOWN_CONFIGURE_OPTION__
* ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb,
ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb,
ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb: bug fix.
* ext/tk/lib/tk/text.rb: typo. call a wrong method.
* ext/tk/lib/tk/itemconfig.rb: ditto.
* ext/tk/lib/tk.rb, ext/tk/lib/tk/itemconfig.rb,
ext/tk/lib/tk/canvas.rb: support alias names of option keys.
* ext/tk/lib/tk/grid.rb: lack of module-method definitions.
* ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: increase supported
parameter patterns of configure method.
* ext/tk/lib/tk.rb: add TkWindow#grid_anchor, grid_column, grid_row.
* ext/tk/lib/tk/wm.rb: methods of Tk::Wm_for_General module cannot
pass the given block to methods of Tk::Wm module.
* ext/tk/lib/tk/wm.rb: Wm#overrideredirect overwrites arguemnt to
an invalid value.
* ext/tk/lib/tk.rb: fix memory (object) leak bug.
* ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: fix memory leak.
* ext/tk/sample/demos-jp/aniwave.rb, ext/tk/sample/demos-en/aniwave.rb:
bug fix.
* ext/tk/lib/tkextlib/blt/component.rb,
ext/tk/lib/tkextlib/tile/tentry.rb,
ext/tk/lib/tkextlib/tile/treeview.rb: ditto.
* ext/tk/lib/tkextlib/tile/tpaned.rb: improve TPaned#add.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget,
ext/tk/sample/demos-jp/style.rb, ext/tk/sample/demos-en/style.rb,
ext/tk/sample/demos-jp/bind.rb, ext/tk/sample/demos-en/bind.rb:
bug fix.
* ext/tk/sample/ttk_wrapper.rb: ditto.
* ext/tk/sample/ttk_wrapper.rb: support "if __FILE__ == $0" idiom.
* ext/tk/sample/tktextio.rb: add binding for 'Ctrl-u' at console mode.
* ext/tk/lib/tkextlib/tile.rb, ext/tk/lib/tkextlib/tile/style.rb,
ext/tk/sample/ttk_wrapper.rb: improve treating and control themes.
add Tk::Tile.themes and Tk::Tile.set_theme(theme).
* ext/tk/lib/tkextlib/tile.rb: lack of autoload definitions.
* ext/tk/lib/tkextlib/tile/tnotebook.rb: cannot use kanji (not UTF-8)
characters for headings.
* ext/tk/lib/tkextlib/tkDND/shape.rb: wrong package name.
* ext/tk/tkutil/tkutil.c: improve handling callback-subst-keys.
Now, support longnam-keys (e.g. '%CTT' on tkdnd-2.0; however, still
not support tkdnd-2.0 on tkextlib), and symbols of parameters (e.g.
:widget=>'%W', :keycode=>'%k', '%x'=>:x, '%X'=>:root_x, and so on;
those are attributes of event object). It means that Ruby/Tk accepts
not only "widget.bind(ev, '%W', '%k', ...){|w, k, ...| ... }", but
also "widget.bind(ev, :widget, :keycode, ...){|w, k, ...| ... }".
It is potentially incompatible, when user passes symbols to the
arguments of the callback block (the block receives the symbols as
strings). I think that is very rare case (probably, used by Ruby/Tk
experts only). When causes such trouble, please give strings instead
of such symbol parameters (e.g. call Symbol#to_s method).
* ext/tk/lib/tk/event.rb, ext/tk/lib/tk/validation.rb,
ext/tk/lib/tkextlib/blt/treeview.rb,
ext/tk/lib/tkextlib/winico/winico.rb: ditto.
* ext/tk/tkutil/tkutil.c: strings are available on subst_tables on
TkUtil::CallbackSubst class (it is useful on Ruby 1.9).
* ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tkextlib/iwidgets/hierarchy.rb,
ext/tk/lib/tkextlib/iwidgets/spinner.rb,
ext/tk/lib/tkextlib/iwidgets/entryfield.rb,
ext/tk/lib/tkextlib/iwidgets/calendar.rb,
ext/tk/lib/tkextlib/blt/dragdrop.rb,
ext/tk/lib/tkextlib/tkDND/tkdnd.rb,
ext/tk/lib/tkextlib/treectrl/tktreectrl.rb,
ext/tk/lib/tkextlib/tktable/tktable.rb: disable code piece became
unnecessary by reason of the changes of ext/tk/tkutil/tkutil.c.
* ext/tk/lib/tk.rb, ext/tk/lib/multi-tk.rb: change strategy to define
the constant WITH_ENCODING.
* ext/tk/lib/tk.rb: fix bug on Tk::Encoding.tk_encoding_names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 16:59:10 -04:00
|
|
|
def image_cget_strict(index, slot)
|
2004-07-14 21:18:57 -04:00
|
|
|
case slot.to_s
|
|
|
|
when 'text', 'label', 'show', 'data', 'file'
|
2009-03-05 22:56:38 -05:00
|
|
|
_fromUTF8(tk_send_without_enc('image', 'cget',
|
2004-10-11 00:51:21 -04:00
|
|
|
_get_eval_enc_str(index), "-#{slot}"))
|
2004-07-14 21:18:57 -04:00
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget',
|
|
|
|
_get_eval_enc_str(index),
|
2004-10-11 00:51:21 -04:00
|
|
|
"-#{slot}")))
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
end
|
* ext/tk/tcltklib.c: SEGV when tcltk-stubs is enabled.
* ext/tk/tcltklib.c: avoid error on a shared object.
* ext/tk/extconf.rb: support --with-tcltkversion
* ext/tk/README.tcltklib: add document about --with-tcltkversion
* ext/tk/lib/tk.rb, ext/tk/lib/multi-tk.rb, ext/tk/lib/remote-tk.rb:
not work on $SAFE==4
* ext/tk/lib/multi-tk.rb: Object#methods returns Symbols on Ruby1.9.
* ext/tk/lib/tk/timer.rb: add TkTimer#at_end(proc) to register the
procedure which called at end of the timer.
* ext/tk/lib/tk.rb, ext/tk/lib/tk/itemfont.rb, ext/tk/lib/font.rb:
support __IGNORE_UNKNOWN_CONFIGURE_OPTION__ about font options.
* ext/tk/lib/*: treat __IGNORE_UNKNOWN_CONFIGURE_OPTION__
* ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb,
ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb,
ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb: bug fix.
* ext/tk/lib/tk/text.rb: typo. call a wrong method.
* ext/tk/lib/tk/itemconfig.rb: ditto.
* ext/tk/lib/tk.rb, ext/tk/lib/tk/itemconfig.rb,
ext/tk/lib/tk/canvas.rb: support alias names of option keys.
* ext/tk/lib/tk/grid.rb: lack of module-method definitions.
* ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: increase supported
parameter patterns of configure method.
* ext/tk/lib/tk.rb: add TkWindow#grid_anchor, grid_column, grid_row.
* ext/tk/lib/tk/wm.rb: methods of Tk::Wm_for_General module cannot
pass the given block to methods of Tk::Wm module.
* ext/tk/lib/tk/wm.rb: Wm#overrideredirect overwrites arguemnt to
an invalid value.
* ext/tk/lib/tk.rb: fix memory (object) leak bug.
* ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: fix memory leak.
* ext/tk/sample/demos-jp/aniwave.rb, ext/tk/sample/demos-en/aniwave.rb:
bug fix.
* ext/tk/lib/tkextlib/blt/component.rb,
ext/tk/lib/tkextlib/tile/tentry.rb,
ext/tk/lib/tkextlib/tile/treeview.rb: ditto.
* ext/tk/lib/tkextlib/tile/tpaned.rb: improve TPaned#add.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget,
ext/tk/sample/demos-jp/style.rb, ext/tk/sample/demos-en/style.rb,
ext/tk/sample/demos-jp/bind.rb, ext/tk/sample/demos-en/bind.rb:
bug fix.
* ext/tk/sample/ttk_wrapper.rb: ditto.
* ext/tk/sample/ttk_wrapper.rb: support "if __FILE__ == $0" idiom.
* ext/tk/sample/tktextio.rb: add binding for 'Ctrl-u' at console mode.
* ext/tk/lib/tkextlib/tile.rb, ext/tk/lib/tkextlib/tile/style.rb,
ext/tk/sample/ttk_wrapper.rb: improve treating and control themes.
add Tk::Tile.themes and Tk::Tile.set_theme(theme).
* ext/tk/lib/tkextlib/tile.rb: lack of autoload definitions.
* ext/tk/lib/tkextlib/tile/tnotebook.rb: cannot use kanji (not UTF-8)
characters for headings.
* ext/tk/lib/tkextlib/tkDND/shape.rb: wrong package name.
* ext/tk/tkutil/tkutil.c: improve handling callback-subst-keys.
Now, support longnam-keys (e.g. '%CTT' on tkdnd-2.0; however, still
not support tkdnd-2.0 on tkextlib), and symbols of parameters (e.g.
:widget=>'%W', :keycode=>'%k', '%x'=>:x, '%X'=>:root_x, and so on;
those are attributes of event object). It means that Ruby/Tk accepts
not only "widget.bind(ev, '%W', '%k', ...){|w, k, ...| ... }", but
also "widget.bind(ev, :widget, :keycode, ...){|w, k, ...| ... }".
It is potentially incompatible, when user passes symbols to the
arguments of the callback block (the block receives the symbols as
strings). I think that is very rare case (probably, used by Ruby/Tk
experts only). When causes such trouble, please give strings instead
of such symbol parameters (e.g. call Symbol#to_s method).
* ext/tk/lib/tk/event.rb, ext/tk/lib/tk/validation.rb,
ext/tk/lib/tkextlib/blt/treeview.rb,
ext/tk/lib/tkextlib/winico/winico.rb: ditto.
* ext/tk/tkutil/tkutil.c: strings are available on subst_tables on
TkUtil::CallbackSubst class (it is useful on Ruby 1.9).
* ext/tk/lib/tk/spinbox.rb, ext/tk/lib/tkextlib/iwidgets/hierarchy.rb,
ext/tk/lib/tkextlib/iwidgets/spinner.rb,
ext/tk/lib/tkextlib/iwidgets/entryfield.rb,
ext/tk/lib/tkextlib/iwidgets/calendar.rb,
ext/tk/lib/tkextlib/blt/dragdrop.rb,
ext/tk/lib/tkextlib/tkDND/tkdnd.rb,
ext/tk/lib/tkextlib/treectrl/tktreectrl.rb,
ext/tk/lib/tkextlib/tktable/tktable.rb: disable code piece became
unnecessary by reason of the changes of ext/tk/tkutil/tkutil.c.
* ext/tk/lib/tk.rb, ext/tk/lib/multi-tk.rb: change strategy to define
the constant WITH_ENCODING.
* ext/tk/lib/tk.rb: fix bug on Tk::Encoding.tk_encoding_names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 16:59:10 -04:00
|
|
|
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)
|
|
|
|
# error on known option
|
|
|
|
fail e
|
|
|
|
else
|
|
|
|
# unknown option
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
rescue
|
|
|
|
fail e # tag error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2004-07-14 21:18:57 -04:00
|
|
|
|
|
|
|
def image_configure(index, slot, value=None)
|
|
|
|
if slot.kind_of? Hash
|
2009-03-05 22:56:38 -05:00
|
|
|
_fromUTF8(tk_send_without_enc('image', 'configure',
|
|
|
|
_get_eval_enc_str(index),
|
2004-10-11 00:51:21 -04:00
|
|
|
*hash_kv(slot, true)))
|
2004-07-14 21:18:57 -04:00
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
_fromUTF8(tk_send_without_enc('image', 'configure',
|
|
|
|
_get_eval_enc_str(index),
|
|
|
|
"-#{slot}",
|
2004-10-11 00:51:21 -04:00
|
|
|
_get_eval_enc_str(value)))
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def image_configinfo(index, slot = nil)
|
|
|
|
if TkComm::GET_CONFIGINFO_AS_ARRAY
|
|
|
|
if slot
|
2004-10-11 00:51:21 -04:00
|
|
|
case slot.to_s
|
|
|
|
when 'text', 'label', 'show', 'data', 'file'
|
2005-05-25 07:09:59 -04:00
|
|
|
#conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
|
|
|
|
conf = tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), false, true)
|
2004-10-11 00:51:21 -04:00
|
|
|
else
|
2005-05-25 07:09:59 -04:00
|
|
|
#conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
|
|
|
|
conf = tk_split_list(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), 0, false, true)
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
conf[0] = conf[0][1..-1]
|
|
|
|
conf
|
2004-07-14 21:18:57 -04:00
|
|
|
else
|
2005-05-25 07:09:59 -04:00
|
|
|
#tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist|
|
|
|
|
# conf = tk_split_simplelist(conflist)
|
|
|
|
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)
|
2004-10-11 00:51:21 -04:00
|
|
|
conf[0] = conf[0][1..-1]
|
|
|
|
case conf[0]
|
|
|
|
when 'text', 'label', 'show', 'data', 'file'
|
|
|
|
else
|
|
|
|
if conf[3]
|
|
|
|
if conf[3].index('{')
|
2009-03-05 22:56:38 -05:00
|
|
|
conf[3] = tk_split_list(conf[3])
|
2004-10-11 00:51:21 -04:00
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
conf[3] = tk_tcl2ruby(conf[3])
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
if conf[4]
|
|
|
|
if conf[4].index('{')
|
2009-03-05 22:56:38 -05:00
|
|
|
conf[4] = tk_split_list(conf[4])
|
2004-10-11 00:51:21 -04:00
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
conf[4] = tk_tcl2ruby(conf[4])
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
|
|
|
|
conf
|
|
|
|
}
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
|
|
|
|
if slot
|
2004-10-11 00:51:21 -04:00
|
|
|
case slot.to_s
|
|
|
|
when 'text', 'label', 'show', 'data', 'file'
|
2005-05-25 07:09:59 -04:00
|
|
|
#conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
|
|
|
|
conf = tk_split_simplelist(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), false, true)
|
2004-10-11 00:51:21 -04:00
|
|
|
else
|
2005-05-25 07:09:59 -04:00
|
|
|
#conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}")))
|
|
|
|
conf = tk_split_list(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"), 0, false, true)
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
key = conf.shift[1..-1]
|
|
|
|
{ key => conf }
|
2004-07-14 21:18:57 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
ret = {}
|
2005-05-25 07:09:59 -04:00
|
|
|
#tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist|
|
|
|
|
# conf = tk_split_simplelist(conflist)
|
|
|
|
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)
|
2004-10-11 00:51:21 -04:00
|
|
|
key = conf.shift[1..-1]
|
|
|
|
case key
|
|
|
|
when 'text', 'label', 'show', 'data', 'file'
|
|
|
|
else
|
|
|
|
if conf[2]
|
|
|
|
if conf[2].index('{')
|
2009-03-05 22:56:38 -05:00
|
|
|
conf[2] = tk_split_list(conf[2])
|
2004-10-11 00:51:21 -04:00
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
conf[2] = tk_tcl2ruby(conf[2])
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
if conf[3]
|
|
|
|
if conf[3].index('{')
|
2009-03-05 22:56:38 -05:00
|
|
|
conf[3] = tk_split_list(conf[3])
|
2004-10-11 00:51:21 -04:00
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
conf[3] = tk_tcl2ruby(conf[3])
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if conf.size == 1
|
|
|
|
ret[key] = conf[0][1..-1] # alias info
|
|
|
|
else
|
|
|
|
ret[key] = conf
|
|
|
|
end
|
|
|
|
}
|
|
|
|
ret
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def current_image_configinfo(index, slot = nil)
|
|
|
|
if TkComm::GET_CONFIGINFO_AS_ARRAY
|
|
|
|
if slot
|
2004-10-11 00:51:21 -04:00
|
|
|
conf = image_configinfo(index, slot)
|
|
|
|
{conf[0] => conf[4]}
|
2004-07-14 21:18:57 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
ret = {}
|
|
|
|
image_configinfo(index).each{|conf|
|
|
|
|
ret[conf[0]] = conf[4] if conf.size > 2
|
|
|
|
}
|
|
|
|
ret
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
|
|
|
|
ret = {}
|
|
|
|
image_configinfo(index, slot).each{|k, conf|
|
2004-10-11 00:51:21 -04:00
|
|
|
ret[k] = conf[-1] if conf.kind_of?(Array)
|
2004-07-14 21:18:57 -04:00
|
|
|
}
|
|
|
|
ret
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def image_names
|
2005-05-25 07:09:59 -04:00
|
|
|
#tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'names'))).collect{|elt|
|
|
|
|
tk_split_simplelist(tk_send_without_enc('image', 'names'), false, true).collect{|elt|
|
2004-07-14 21:18:57 -04:00
|
|
|
tagid2obj(elt)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2005-03-10 05:13:30 -05:00
|
|
|
def index(idx)
|
|
|
|
tk_send_without_enc('index', _get_eval_enc_str(idx))
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def insert(index, *args)
|
|
|
|
tk_send('insert', index, *args)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def mark_names
|
2005-05-25 07:09:59 -04:00
|
|
|
#tk_split_simplelist(_fromUTF8(tk_send_without_enc('mark', 'names'))).collect{|elt|
|
|
|
|
tk_split_simplelist(tk_send_without_enc('mark', 'names'), false, true).collect{|elt|
|
2004-07-14 21:18:57 -04:00
|
|
|
tagid2obj(elt)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def mark_gravity(mark, direction=nil)
|
|
|
|
if direction
|
2009-03-05 22:56:38 -05:00
|
|
|
tk_send_without_enc('mark', 'gravity',
|
2004-10-11 00:51:21 -04:00
|
|
|
_get_eval_enc_str(mark), direction)
|
2004-07-14 21:18:57 -04:00
|
|
|
self
|
|
|
|
else
|
|
|
|
tk_send_without_enc('mark', 'gravity', _get_eval_enc_str(mark))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def mark_set(mark, index)
|
2009-03-05 22:56:38 -05:00
|
|
|
tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark),
|
2004-10-11 00:51:21 -04:00
|
|
|
_get_eval_enc_str(index))
|
2004-07-14 21:18:57 -04:00
|
|
|
self
|
|
|
|
end
|
|
|
|
alias set_mark mark_set
|
|
|
|
|
|
|
|
def mark_unset(*marks)
|
2009-03-05 22:56:38 -05:00
|
|
|
tk_send_without_enc('mark', 'unset',
|
2004-10-11 00:51:21 -04:00
|
|
|
*(marks.collect{|mark| _get_eval_enc_str(mark)}))
|
2004-07-14 21:18:57 -04:00
|
|
|
self
|
|
|
|
end
|
|
|
|
alias unset_mark mark_unset
|
|
|
|
|
|
|
|
def mark_next(index)
|
2009-03-05 22:56:38 -05:00
|
|
|
tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'next',
|
2004-10-11 00:51:21 -04:00
|
|
|
_get_eval_enc_str(index))))
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
alias next_mark mark_next
|
|
|
|
|
|
|
|
def mark_previous(index)
|
2009-03-05 22:56:38 -05:00
|
|
|
tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous',
|
2004-10-11 00:51:21 -04:00
|
|
|
_get_eval_enc_str(index))))
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
alias previous_mark mark_previous
|
|
|
|
|
|
|
|
def scan_mark(x, y)
|
|
|
|
tk_send_without_enc('scan', 'mark', x, y)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def scan_dragto(x, y)
|
|
|
|
tk_send_without_enc('scan', 'dragto', x, y)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def _ktext_length(txt)
|
2008-02-28 12:27:41 -05:00
|
|
|
if TkCore::WITH_ENCODING ### Ruby 1.9 !!!!!!!!!!!!!
|
2007-12-21 03:57:35 -05:00
|
|
|
return txt.length
|
|
|
|
end
|
|
|
|
###########################
|
|
|
|
|
2004-07-14 21:18:57 -04:00
|
|
|
if $KCODE !~ /n/i
|
|
|
|
return txt.gsub(/[^\Wa-zA-Z_\d]/, ' ').length
|
|
|
|
end
|
|
|
|
|
|
|
|
# $KCODE == 'NONE'
|
|
|
|
if JAPANIZED_TK
|
2009-03-05 22:56:38 -05:00
|
|
|
tk_call_without_enc('kstring', 'length',
|
2004-10-11 00:51:21 -04:00
|
|
|
_get_eval_enc_str(txt)).to_i
|
2004-07-14 21:18:57 -04:00
|
|
|
else
|
|
|
|
begin
|
2009-03-05 22:56:38 -05:00
|
|
|
tk_call_without_enc('encoding', 'convertto', 'ascii',
|
2004-10-11 00:51:21 -04:00
|
|
|
_get_eval_enc_str(txt)).length
|
2004-07-14 21:18:57 -04:00
|
|
|
rescue StandardError, NameError
|
2004-10-11 00:51:21 -04:00
|
|
|
# sorry, I have no plan
|
|
|
|
txt.length
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
private :_ktext_length
|
|
|
|
|
|
|
|
def tksearch(*args)
|
|
|
|
# call 'search' subcommand of text widget
|
|
|
|
# args ::= [<array_of_opts>] <pattern> <start_index> [<stop_index>]
|
|
|
|
# If <pattern> is regexp, then it must be a regular expression of Tcl
|
|
|
|
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
|
|
|
|
|
|
|
|
def tksearch_with_count(*args)
|
|
|
|
# call 'search' subcommand of text widget
|
|
|
|
# args ::= [<array_of_opts>] <var> <pattern> <start_index> [<stop_index>]
|
|
|
|
# If <pattern> is regexp, then it must be a regular expression of Tcl
|
|
|
|
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
|
|
|
|
|
|
|
|
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))
|
2004-10-11 00:51:21 -04:00
|
|
|
match = $&
|
|
|
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
|
|
|
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
|
|
|
|
if pat.kind_of? String
|
|
|
|
#return [index(start + " + #{pos} chars"), pat.split('').length]
|
2009-03-05 22:56:38 -05:00
|
|
|
return [index(start + " + #{pos} chars"),
|
2004-10-11 00:51:21 -04:00
|
|
|
_ktext_length(pat), pat.dup]
|
|
|
|
else
|
|
|
|
#return [index(start + " + #{pos} chars"), $&.split('').length]
|
2009-03-05 22:56:38 -05:00
|
|
|
return [index(start + " + #{pos} chars"),
|
2004-10-11 00:51:21 -04:00
|
|
|
_ktext_length(match), match]
|
|
|
|
end
|
2004-07-14 21:18:57 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
return ["", 0]
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
else
|
|
|
|
txt = get(start,'end - 1 char')
|
|
|
|
if (pos = txt.index(pat))
|
2004-10-11 00:51:21 -04:00
|
|
|
match = $&
|
|
|
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
|
|
|
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
|
|
|
|
if pat.kind_of? String
|
|
|
|
#return [index(start + " + #{pos} chars"), pat.split('').length]
|
2009-03-05 22:56:38 -05:00
|
|
|
return [index(start + " + #{pos} chars"),
|
2004-10-11 00:51:21 -04:00
|
|
|
_ktext_length(pat), pat.dup]
|
|
|
|
else
|
|
|
|
#return [index(start + " + #{pos} chars"), $&.split('').length]
|
2009-03-05 22:56:38 -05:00
|
|
|
return [index(start + " + #{pos} chars"),
|
2004-10-11 00:51:21 -04:00
|
|
|
_ktext_length(match), match]
|
|
|
|
end
|
2004-07-14 21:18:57 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
txt = get('1.0','end - 1 char')
|
|
|
|
if (pos = txt.index(pat))
|
|
|
|
match = $&
|
|
|
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
|
|
|
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
|
|
|
|
if pat.kind_of? String
|
|
|
|
#return [index("1.0 + #{pos} chars"), pat.split('').length]
|
2009-03-05 22:56:38 -05:00
|
|
|
return [index("1.0 + #{pos} chars"),
|
2004-10-11 00:51:21 -04:00
|
|
|
_ktext_length(pat), pat.dup]
|
|
|
|
else
|
|
|
|
#return [index("1.0 + #{pos} chars"), $&.split('').length]
|
|
|
|
return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
|
|
|
|
end
|
|
|
|
else
|
|
|
|
return ["", 0]
|
|
|
|
end
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def search(pat,start,stop=None)
|
|
|
|
search_with_length(pat,start,stop)[0]
|
|
|
|
end
|
|
|
|
|
|
|
|
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))
|
2004-10-11 00:51:21 -04:00
|
|
|
match = $&
|
|
|
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
|
|
|
pos = _ktext_length(txt[0..(pos-1)]) if pos > 0
|
|
|
|
if pat.kind_of? String
|
|
|
|
#return [index(stop + " + #{pos} chars"), pat.split('').length]
|
|
|
|
return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup]
|
|
|
|
else
|
|
|
|
#return [index(stop + " + #{pos} chars"), $&.split('').length]
|
|
|
|
return [index(stop + " + #{pos} chars"), _ktext_length(match), match]
|
|
|
|
end
|
2004-07-14 21:18:57 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
return ["", 0]
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
else
|
|
|
|
txt = get('1.0',start)
|
|
|
|
if (pos = txt.rindex(pat))
|
2004-10-11 00:51:21 -04:00
|
|
|
match = $&
|
|
|
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
|
|
|
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"), _ktext_length(pat), pat.dup]
|
|
|
|
else
|
|
|
|
#return [index("1.0 + #{pos} chars"), $&.split('').length]
|
|
|
|
return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
|
|
|
|
end
|
2004-07-14 21:18:57 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
txt = get('1.0','end - 1 char')
|
|
|
|
if (pos = txt.rindex(pat))
|
|
|
|
match = $&
|
|
|
|
#pos = txt[0..(pos-1)].split('').length if pos > 0
|
|
|
|
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"), _ktext_length(pat), pat.dup]
|
|
|
|
else
|
|
|
|
#return [index("1.0 + #{pos} chars"), $&.split('').length]
|
|
|
|
return [index("1.0 + #{pos} chars"), _ktext_length(match), match]
|
|
|
|
end
|
|
|
|
else
|
|
|
|
return ["", 0]
|
|
|
|
end
|
2004-07-14 21:18:57 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def rsearch(pat,start,stop=None)
|
|
|
|
rsearch_with_length(pat,start,stop)[0]
|
|
|
|
end
|
|
|
|
|
|
|
|
def see(index)
|
|
|
|
tk_send_without_enc('see', index)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
###############################
|
|
|
|
|
|
|
|
def xview(*index)
|
|
|
|
if index.size == 0
|
|
|
|
list(tk_send_without_enc('xview'))
|
|
|
|
else
|
|
|
|
tk_send_without_enc('xview', *index)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def xview_moveto(*index)
|
|
|
|
xview('moveto', *index)
|
|
|
|
end
|
|
|
|
def xview_scroll(*index)
|
|
|
|
xview('scroll', *index)
|
|
|
|
end
|
|
|
|
|
|
|
|
def yview(*index)
|
|
|
|
if index.size == 0
|
|
|
|
list(tk_send_without_enc('yview'))
|
|
|
|
else
|
|
|
|
tk_send_without_enc('yview', *index)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def yview_moveto(*index)
|
|
|
|
yview('moveto', *index)
|
|
|
|
end
|
|
|
|
def yview_scroll(*index)
|
|
|
|
yview('scroll', *index)
|
|
|
|
end
|
|
|
|
end
|