2003-07-27 15:35:06 -04:00
|
|
|
#
|
2004-10-11 00:51:21 -04:00
|
|
|
# multi-tk.rb - supports multi Tk interpreters
|
|
|
|
# by Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
require 'tcltklib'
|
2004-05-01 12:09:54 -04:00
|
|
|
require 'tkutil'
|
2003-07-27 15:35:06 -04:00
|
|
|
require 'thread'
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
if defined? Tk
|
2005-07-21 18:05:04 -04:00
|
|
|
fail RuntimeError,"'multi-tk' library must be required before requiring 'tk'"
|
2004-05-21 16:45:27 -04:00
|
|
|
end
|
|
|
|
|
2003-07-31 03:59:18 -04:00
|
|
|
################################################
|
2003-08-29 04:34:14 -04:00
|
|
|
# ignore exception on the mainloop?
|
2003-07-31 03:59:18 -04:00
|
|
|
|
2003-08-29 04:34:14 -04:00
|
|
|
TclTkLib.mainloop_abort_on_exception = true
|
2003-07-31 03:59:18 -04:00
|
|
|
# TclTkLib.mainloop_abort_on_exception = false
|
2003-08-29 04:34:14 -04:00
|
|
|
# TclTkLib.mainloop_abort_on_exception = nil
|
|
|
|
|
2003-07-31 03:59:18 -04:00
|
|
|
|
2004-09-08 02:23:41 -04:00
|
|
|
################################################
|
|
|
|
# add ThreadGroup check to TclTkIp.new
|
|
|
|
class << TclTkIp
|
|
|
|
alias __new__ new
|
|
|
|
private :__new__
|
|
|
|
|
|
|
|
def new(*args)
|
|
|
|
if Thread.current.group != ThreadGroup::Default
|
|
|
|
raise SecurityError, 'only ThreadGroup::Default can call TclTkIp.new'
|
|
|
|
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
|
|
|
obj = __new__(*args)
|
|
|
|
obj.instance_eval{
|
2009-07-12 19:08:32 -04:00
|
|
|
@force_default_encoding ||= TkUtil.untrust([false])
|
|
|
|
@encoding ||= TkUtil.untrust([nil])
|
* 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 @encoding.to_s; self.join(nil); end
|
|
|
|
}
|
|
|
|
obj
|
2004-09-08 02:23:41 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2006-07-10 05:52:30 -04:00
|
|
|
################################################
|
|
|
|
# use pseudo-toplevel feature of MultiTkIp ?
|
2009-03-05 22:56:38 -05:00
|
|
|
if (!defined?(Use_PseudoToplevel_Feature_of_MultiTkIp) ||
|
2006-07-10 05:52:30 -04:00
|
|
|
Use_PseudoToplevel_Feature_of_MultiTkIp)
|
|
|
|
module MultiTkIp_PseudoToplevel_Evaluable
|
|
|
|
#def pseudo_toplevel_eval(body = Proc.new)
|
|
|
|
# Thread.current[:TOPLEVEL] = self
|
|
|
|
# begin
|
|
|
|
# body.call
|
|
|
|
# ensure
|
|
|
|
# Thread.current[:TOPLEVEL] = nil
|
|
|
|
# end
|
|
|
|
#end
|
|
|
|
|
|
|
|
def pseudo_toplevel_evaluable?
|
|
|
|
@pseudo_toplevel_evaluable
|
|
|
|
end
|
|
|
|
|
|
|
|
def pseudo_toplevel_evaluable=(mode)
|
|
|
|
@pseudo_toplevel_evaluable = (mode)? true: false
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.extended(mod)
|
|
|
|
mod.__send__(:extend_object, mod)
|
|
|
|
mod.instance_variable_set('@pseudo_toplevel_evaluable', true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Object
|
|
|
|
alias __method_missing_alias_for_MultiTkIp__ method_missing
|
|
|
|
private :__method_missing_alias_for_MultiTkIp__
|
|
|
|
|
|
|
|
def method_missing(id, *args)
|
|
|
|
begin
|
2009-03-05 22:56:38 -05:00
|
|
|
has_top = (top = MultiTkIp.__getip.__pseudo_toplevel) &&
|
|
|
|
top.respond_to?(:pseudo_toplevel_evaluable?) &&
|
|
|
|
top.pseudo_toplevel_evaluable? &&
|
2006-07-10 05:52:30 -04:00
|
|
|
top.respond_to?(id)
|
|
|
|
rescue Exception => e
|
|
|
|
has_top = false
|
|
|
|
end
|
|
|
|
|
|
|
|
if has_top
|
|
|
|
top.__send__(id, *args)
|
|
|
|
else
|
|
|
|
__method_missing_alias_for_MultiTkIp__(id, *args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
# dummy
|
|
|
|
module MultiTkIp_PseudoToplevel_Evaluable
|
|
|
|
def pseudo_toplevel_evaluable?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
################################################
|
|
|
|
# exceptiopn to treat the return value from IP
|
|
|
|
class MultiTkIp_OK < Exception
|
2004-01-02 11:21:26 -05:00
|
|
|
def self.send(thread, ret=nil)
|
2003-07-27 15:35:06 -04:00
|
|
|
thread.raise self.new(ret)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(ret=nil)
|
|
|
|
super('succeed')
|
|
|
|
@return_value = ret
|
|
|
|
end
|
|
|
|
|
|
|
|
attr_reader :return_value
|
|
|
|
alias value return_value
|
|
|
|
end
|
|
|
|
MultiTkIp_OK.freeze
|
|
|
|
|
2003-07-31 03:59:18 -04:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
################################################
|
|
|
|
# methods for construction
|
|
|
|
class MultiTkIp
|
2009-08-03 15:01:03 -04:00
|
|
|
class Command_Queue < Queue
|
|
|
|
def initialize(interp)
|
|
|
|
@interp = interp
|
|
|
|
super()
|
|
|
|
end
|
|
|
|
|
|
|
|
def push(value)
|
|
|
|
if !@interp || @interp.deleted?
|
|
|
|
fail RuntimeError, "Tk interpreter is already deleted"
|
|
|
|
end
|
|
|
|
super(value)
|
|
|
|
end
|
|
|
|
alias << push
|
|
|
|
alias enq push
|
|
|
|
|
|
|
|
def close
|
|
|
|
@interp = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
Command_Queue.freeze
|
|
|
|
|
2006-07-10 05:52:30 -04:00
|
|
|
BASE_DIR = File.dirname(__FILE__)
|
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
WITH_RUBY_VM = Object.const_defined?(:RubyVM) && ::RubyVM.class == Class
|
* 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
|
|
|
WITH_ENCODING = defined?(::Encoding.default_external)
|
|
|
|
#WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
(@@SLAVE_IP_ID = ['slave'.freeze, TkUtil.untrust('0')]).instance_eval{
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
@mutex = Mutex.new
|
|
|
|
def mutex; @mutex; end
|
|
|
|
freeze
|
|
|
|
}
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@@IP_TABLE = TkUtil.untrust({}) unless defined?(@@IP_TABLE)
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@@INIT_IP_ENV = TkUtil.untrust([]) unless defined?(@@INIT_IP_ENV) # table of Procs
|
|
|
|
@@ADD_TK_PROCS = TkUtil.untrust([]) unless defined?(@@ADD_TK_PROCS) # table of [name, args, body]
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@@TK_TABLE_LIST = TkUtil.untrust([]) unless defined?(@@TK_TABLE_LIST)
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2005-11-18 03:39:29 -05:00
|
|
|
unless defined?(@@TK_CMD_TBL)
|
2009-07-12 19:08:32 -04:00
|
|
|
@@TK_CMD_TBL = TkUtil.untrust(Object.new)
|
2005-11-18 03:39:29 -05:00
|
|
|
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
# @@TK_CMD_TBL.instance_variable_set('@tbl', {}.taint)
|
2009-07-12 19:08:32 -04:00
|
|
|
tbl_obj = TkUtil.untrust(Hash.new{|hash,key|
|
|
|
|
fail IndexError, "unknown command ID '#{key}'"
|
|
|
|
})
|
|
|
|
@@TK_CMD_TBL.instance_variable_set('@tbl', tbl_obj)
|
2005-11-18 03:39:29 -05:00
|
|
|
|
|
|
|
class << @@TK_CMD_TBL
|
|
|
|
allow = [
|
2009-03-05 22:56:38 -05:00
|
|
|
'__send__', '__id__', 'freeze', 'inspect', 'kind_of?', 'object_id',
|
2005-11-18 03:39:29 -05:00
|
|
|
'[]', '[]=', 'delete', 'each', 'has_key?'
|
|
|
|
]
|
2007-12-21 03:57:35 -05:00
|
|
|
instance_methods.each{|m| undef_method(m) unless allow.index(m.to_s)}
|
2005-11-18 03:39:29 -05:00
|
|
|
|
|
|
|
def kind_of?(klass)
|
|
|
|
@tbl.kind_of?(klass)
|
|
|
|
end
|
|
|
|
|
|
|
|
def inspect
|
|
|
|
if Thread.current.group == ThreadGroup::Default
|
|
|
|
@tbl.inspect
|
|
|
|
else
|
|
|
|
ip = MultiTkIp.__getip
|
|
|
|
@tbl.reject{|idx, ent| ent.respond_to?(:ip) && ent.ip != ip}.inspect
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def [](idx)
|
|
|
|
return unless (ent = @tbl[idx])
|
|
|
|
if Thread.current.group == ThreadGroup::Default
|
|
|
|
ent
|
|
|
|
elsif ent.respond_to?(:ip)
|
|
|
|
(ent.ip == MultiTkIp.__getip)? ent: nil
|
|
|
|
else
|
|
|
|
ent
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def []=(idx,val)
|
|
|
|
if self.has_key?(idx) && Thread.current.group != ThreadGroup::Default
|
|
|
|
fail SecurityError,"cannot change the entried command"
|
|
|
|
end
|
|
|
|
@tbl[idx] = val
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete(idx, &blk)
|
|
|
|
# if gets an entry, is permited to delete
|
|
|
|
if self[idx]
|
2009-03-05 22:56:38 -05:00
|
|
|
@tbl.delete(idx)
|
2005-11-18 03:39:29 -05:00
|
|
|
elsif blk
|
|
|
|
blk.call(idx)
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def each(&blk)
|
|
|
|
if Thread.current.group == ThreadGroup::Default
|
|
|
|
@tbl.each(&blk)
|
|
|
|
else
|
|
|
|
ip = MultiTkIp.__getip
|
|
|
|
@tbl.each{|idx, ent|
|
|
|
|
blk.call(idx, ent) unless ent.respond_to?(:ip) && ent.ip != ip
|
|
|
|
}
|
|
|
|
end
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_key?(k)
|
|
|
|
@tbl.has_key?(k)
|
|
|
|
end
|
|
|
|
alias include? has_key?
|
|
|
|
alias key? has_key?
|
|
|
|
alias member? has_key?
|
|
|
|
end
|
|
|
|
|
|
|
|
@@TK_CMD_TBL.freeze
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
######################################
|
|
|
|
|
2006-04-05 12:08:45 -04:00
|
|
|
@@CB_ENTRY_CLASS = Class.new(TkCallbackEntry){
|
2003-07-27 15:35:06 -04:00
|
|
|
def initialize(ip, cmd)
|
|
|
|
@ip = ip
|
2009-07-12 19:08:32 -04:00
|
|
|
@safe = safe = $SAFE
|
|
|
|
# @cmd = cmd
|
|
|
|
cmd = MultiTkIp._proc_on_safelevel(&cmd)
|
|
|
|
@cmd = proc{|*args| cmd.call(safe, *args)}
|
2007-12-21 03:57:35 -05:00
|
|
|
self.freeze
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
attr_reader :ip, :cmd
|
2004-05-01 12:09:54 -04:00
|
|
|
def inspect
|
|
|
|
cmd.inspect
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
def call(*args)
|
2005-03-02 02:06:52 -05:00
|
|
|
unless @ip.deleted?
|
|
|
|
current = Thread.current
|
* 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
|
|
|
backup_ip = current[:callback_ip]
|
|
|
|
current[:callback_ip] = @ip
|
2005-03-02 02:06:52 -05:00
|
|
|
begin
|
2006-07-03 06:08:11 -04:00
|
|
|
ret = @ip.cb_eval(@cmd, *args)
|
|
|
|
fail ret if ret.kind_of?(Exception)
|
|
|
|
ret
|
2005-03-02 02:06:52 -05:00
|
|
|
rescue TkCallbackBreak, TkCallbackContinue => e
|
2004-10-11 00:51:21 -04:00
|
|
|
fail e
|
2005-07-21 18:05:04 -04:00
|
|
|
rescue SecurityError => e
|
|
|
|
# in 'exit', 'exit!', and 'abort' : security error --> delete IP
|
|
|
|
if e.backtrace[0] =~ /^(.+?):(\d+):in `(exit|exit!|abort)'/
|
|
|
|
@ip.delete
|
|
|
|
elsif @ip.safe?
|
|
|
|
if @ip.respond_to?(:cb_error)
|
|
|
|
@ip.cb_error(e)
|
|
|
|
else
|
|
|
|
nil # ignore
|
|
|
|
end
|
|
|
|
else
|
|
|
|
fail e
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
rescue Exception => e
|
2006-07-03 06:08:11 -04:00
|
|
|
fail e if e.message =~ /^TkCallback/
|
|
|
|
|
2005-03-02 02:06:52 -05:00
|
|
|
if @ip.safe?
|
2005-07-21 18:05:04 -04:00
|
|
|
if @ip.respond_to?(:cb_error)
|
|
|
|
@ip.cb_error(e)
|
|
|
|
else
|
|
|
|
nil # ignore
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
else
|
|
|
|
fail e
|
|
|
|
end
|
|
|
|
ensure
|
* 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
|
|
|
current[:callback_ip] = backup_ip
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
end
|
2003-09-07 03:10:44 -04:00
|
|
|
}.freeze
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
######################################
|
|
|
|
|
2004-05-01 12:09:54 -04:00
|
|
|
def _keys2opts(src_keys)
|
|
|
|
return nil if src_keys == nil
|
|
|
|
keys = {}; src_keys.each{|k, v| keys[k.to_s] = v}
|
|
|
|
#keys.collect{|k,v| "-#{k} #{v}"}.join(' ')
|
|
|
|
keys.collect{|k,v| "-#{k} #{TclTkLib._conv_listelement(TkComm::_get_eval_string(v))}"}.join(' ')
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
private :_keys2opts
|
|
|
|
|
2003-08-29 04:34:14 -04:00
|
|
|
def _check_and_return(thread, exception, wait=0)
|
2004-09-08 02:23:41 -04:00
|
|
|
unless thread
|
2005-03-02 02:06:52 -05:00
|
|
|
unless exception.kind_of?(MultiTkIp_OK)
|
2004-10-11 00:51:21 -04:00
|
|
|
msg = "#{exception.class}: #{exception.message}"
|
2005-03-02 02:06:52 -05:00
|
|
|
|
|
|
|
if @interp.deleted?
|
|
|
|
warn("Warning (#{self}): " + msg)
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
|
|
|
|
if safe?
|
|
|
|
warn("Warning (#{self}): " + msg) if $DEBUG
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
2005-03-02 02:06:52 -05:00
|
|
|
@interp._eval_without_enc(@interp._merge_tklist('bgerror', msg))
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue Exception => e
|
2005-03-02 02:06:52 -05:00
|
|
|
warn("Warning (#{self}): " + msg)
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
2004-09-08 02:23:41 -04:00
|
|
|
end
|
|
|
|
return nil
|
|
|
|
end
|
2003-08-29 04:34:14 -04:00
|
|
|
|
|
|
|
if wait == 0
|
|
|
|
# no wait
|
2004-09-29 11:54:32 -04:00
|
|
|
Thread.pass
|
|
|
|
if thread.stop?
|
2004-10-11 00:51:21 -04:00
|
|
|
thread.raise exception
|
2004-09-29 11:54:32 -04:00
|
|
|
end
|
2003-08-29 04:34:14 -04:00
|
|
|
return thread
|
|
|
|
end
|
|
|
|
|
|
|
|
# wait to stop the caller thread
|
2003-07-27 15:35:06 -04:00
|
|
|
wait.times{
|
|
|
|
if thread.stop?
|
2004-10-11 00:51:21 -04:00
|
|
|
# ready to send exception
|
|
|
|
thread.raise exception
|
|
|
|
return thread
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
# wait
|
|
|
|
Thread.pass
|
|
|
|
}
|
|
|
|
|
|
|
|
# unexpected error
|
|
|
|
thread.raise RuntimeError, "the thread may not wait for the return value"
|
|
|
|
return thread
|
|
|
|
end
|
|
|
|
|
2003-07-28 02:10:13 -04:00
|
|
|
######################################
|
|
|
|
|
2005-07-21 18:05:04 -04:00
|
|
|
def set_cb_error(cmd = Proc.new)
|
|
|
|
@cb_error_proc[0] = cmd
|
|
|
|
end
|
|
|
|
|
|
|
|
def cb_error(e)
|
|
|
|
if @cb_error_proc[0].respond_to?(:call)
|
|
|
|
@cb_error_proc[0].call(e)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
######################################
|
|
|
|
|
2003-07-28 02:10:13 -04:00
|
|
|
def set_safe_level(safe)
|
2004-09-14 04:01:55 -04:00
|
|
|
if safe > @safe_level[0]
|
|
|
|
@safe_level[0] = safe
|
|
|
|
@cmd_queue.enq([@system, 'set_safe_level', safe])
|
|
|
|
end
|
|
|
|
@safe_level[0]
|
2003-07-28 02:10:13 -04:00
|
|
|
end
|
2004-09-02 13:17:20 -04:00
|
|
|
def safe_level=(safe)
|
|
|
|
set_safe_level(safe)
|
|
|
|
end
|
2003-07-28 02:10:13 -04:00
|
|
|
def self.set_safe_level(safe)
|
|
|
|
__getip.set_safe_level(safe)
|
|
|
|
end
|
2004-09-02 13:17:20 -04:00
|
|
|
def self.safe_level=(safe)
|
|
|
|
self.set_safe_level(safe)
|
|
|
|
end
|
|
|
|
def safe_level
|
|
|
|
@safe_level[0]
|
|
|
|
end
|
|
|
|
def self.safe_level
|
|
|
|
__getip.safe_level
|
|
|
|
end
|
|
|
|
|
2004-09-17 02:05:33 -04:00
|
|
|
def wait_on_mainloop?
|
|
|
|
@wait_on_mainloop[0]
|
|
|
|
end
|
|
|
|
def wait_on_mainloop=(bool)
|
|
|
|
@wait_on_mainloop[0] = bool
|
|
|
|
end
|
|
|
|
|
|
|
|
def running_mainloop?
|
2005-07-21 18:05:04 -04:00
|
|
|
@wait_on_mainloop[1] > 0
|
2004-09-17 02:05:33 -04:00
|
|
|
end
|
|
|
|
|
2004-09-08 02:23:41 -04:00
|
|
|
def _destroy_slaves_of_slaveIP(ip)
|
|
|
|
unless ip.deleted?
|
2005-05-25 07:09:59 -04:00
|
|
|
# ip._split_tklist(ip._invoke('interp', 'slaves')).each{|name|
|
|
|
|
ip._split_tklist(ip._invoke_without_enc('interp', 'slaves')).each{|name|
|
|
|
|
name = _fromUTF8(name)
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
2004-12-27 06:04:21 -05:00
|
|
|
# ip._eval_without_enc("#{name} eval {foreach i [after info] {after cancel $i}}")
|
|
|
|
after_ids = ip._eval_without_enc("#{name} eval {after info}")
|
|
|
|
ip._eval_without_enc("#{name} eval {foreach i {#{after_ids}} {after cancel $i}}")
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
begin
|
|
|
|
# ip._invoke('interp', 'eval', name, 'destroy', '.')
|
|
|
|
ip._invoke(name, 'eval', 'destroy', '.')
|
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
|
|
|
|
# safe_base?
|
|
|
|
if ip._eval_without_enc("catch {::safe::interpConfigure #{name}}") == '0'
|
|
|
|
begin
|
|
|
|
ip._eval_without_enc("::safe::interpDelete #{name}")
|
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
end
|
2004-09-08 02:23:41 -04:00
|
|
|
=begin
|
2004-10-11 00:51:21 -04:00
|
|
|
if ip._invoke('interp', 'exists', name) == '1'
|
|
|
|
begin
|
|
|
|
ip._invoke(name, 'eval', 'exit')
|
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
end
|
2004-09-08 02:23:41 -04:00
|
|
|
=end
|
2004-10-11 00:51:21 -04:00
|
|
|
unless ip.deleted?
|
|
|
|
if ip._invoke('interp', 'exists', name) == '1'
|
|
|
|
begin
|
|
|
|
ip._invoke('interp', 'delete', name)
|
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2004-09-08 02:23:41 -04:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2004-09-17 02:05:33 -04:00
|
|
|
def _receiver_eval_proc_core(safe_level, thread, cmd, *args)
|
|
|
|
begin
|
|
|
|
#ret = proc{$SAFE = safe_level; cmd.call(*args)}.call
|
2005-03-02 02:06:52 -05:00
|
|
|
#ret = cmd.call(safe_level, *args)
|
|
|
|
normal_ret = false
|
|
|
|
ret = catch(:IRB_EXIT) do # IRB hack
|
|
|
|
retval = cmd.call(safe_level, *args)
|
|
|
|
normal_ret = true
|
|
|
|
retval
|
|
|
|
end
|
|
|
|
unless normal_ret
|
|
|
|
# catch IRB_EXIT
|
|
|
|
exit(ret)
|
|
|
|
end
|
|
|
|
ret
|
2004-09-17 02:05:33 -04:00
|
|
|
rescue SystemExit => e
|
|
|
|
# delete IP
|
|
|
|
unless @interp.deleted?
|
2009-03-05 22:56:38 -05:00
|
|
|
@slave_ip_tbl.each{|name, subip|
|
2004-10-11 00:51:21 -04:00
|
|
|
_destroy_slaves_of_slaveIP(subip)
|
|
|
|
begin
|
2004-12-27 06:04:21 -05:00
|
|
|
# subip._eval_without_enc("foreach i [after info] {after cancel $i}")
|
|
|
|
after_ids = subip._eval_without_enc("after info")
|
|
|
|
subip._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
2004-09-11 13:45:53 -04:00
|
|
|
=begin
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
subip._invoke('destroy', '.') unless subip.deleted?
|
|
|
|
rescue Exception
|
|
|
|
end
|
2004-09-11 13:45:53 -04:00
|
|
|
=end
|
2004-10-11 00:51:21 -04:00
|
|
|
# safe_base?
|
|
|
|
if @interp._eval_without_enc("catch {::safe::interpConfigure #{name}}") == '0'
|
|
|
|
begin
|
|
|
|
@interp._eval_without_enc("::safe::interpDelete #{name}")
|
|
|
|
rescue Exception
|
|
|
|
else
|
|
|
|
next if subip.deleted?
|
|
|
|
end
|
|
|
|
end
|
2009-03-05 22:56:38 -05:00
|
|
|
if subip.respond_to?(:safe_base?) && subip.safe_base? &&
|
2004-10-11 00:51:21 -04:00
|
|
|
!subip.deleted?
|
|
|
|
# do 'exit' to call the delete_hook procedure
|
|
|
|
begin
|
2009-03-05 22:56:38 -05:00
|
|
|
subip._eval_without_enc('exit')
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
else
|
|
|
|
begin
|
|
|
|
subip.delete unless subip.deleted?
|
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
begin
|
2004-12-27 06:04:21 -05:00
|
|
|
# @interp._eval_without_enc("foreach i [after info] {after cancel $i}")
|
|
|
|
after_ids = @interp._eval_without_enc("after info")
|
|
|
|
@interp._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
begin
|
|
|
|
@interp._invoke('destroy', '.') unless @interp.deleted?
|
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
if @safe_base && !@interp.deleted?
|
|
|
|
# do 'exit' to call the delete_hook procedure
|
|
|
|
@interp._eval_without_enc('exit')
|
|
|
|
else
|
|
|
|
@interp.delete unless @interp.deleted?
|
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
if e.backtrace[0] =~ /^(.+?):(\d+):in `(exit|exit!|abort)'/
|
2004-10-11 00:51:21 -04:00
|
|
|
_check_and_return(thread, MultiTkIp_OK.new($3 == 'exit'))
|
2004-09-17 02:05:33 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
_check_and_return(thread, MultiTkIp_OK.new(nil))
|
2004-09-17 02:05:33 -04:00
|
|
|
end
|
2004-09-11 13:45:53 -04:00
|
|
|
|
2005-03-02 02:06:52 -05:00
|
|
|
# if master? && !safe? && allow_ruby_exit?
|
|
|
|
if !@interp.deleted? && master? && !safe? && allow_ruby_exit?
|
2004-09-11 13:45:53 -04:00
|
|
|
=begin
|
2004-10-11 00:51:21 -04:00
|
|
|
ObjectSpace.each_object(TclTkIp){|obj|
|
|
|
|
obj.delete unless obj.deleted?
|
|
|
|
}
|
2004-09-11 13:45:53 -04:00
|
|
|
=end
|
2004-10-11 00:51:21 -04:00
|
|
|
#exit(e.status)
|
|
|
|
fail e
|
2004-09-17 02:05:33 -04:00
|
|
|
end
|
|
|
|
# break
|
|
|
|
|
|
|
|
rescue SecurityError => e
|
|
|
|
# in 'exit', 'exit!', and 'abort' : security error --> delete IP
|
|
|
|
if e.backtrace[0] =~ /^(.+?):(\d+):in `(exit|exit!|abort)'/
|
2004-10-11 00:51:21 -04:00
|
|
|
ret = ($3 == 'exit')
|
|
|
|
unless @interp.deleted?
|
|
|
|
@slave_ip_tbl.each{|name, subip|
|
|
|
|
_destroy_slaves_of_slaveIP(subip)
|
|
|
|
begin
|
2004-12-27 06:04:21 -05:00
|
|
|
# subip._eval_without_enc("foreach i [after info] {after cancel $i}")
|
|
|
|
after_ids = subip._eval_without_enc("after info")
|
|
|
|
subip._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
2004-09-11 13:45:53 -04:00
|
|
|
=begin
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
subip._invoke('destroy', '.') unless subip.deleted?
|
|
|
|
rescue Exception
|
|
|
|
end
|
2004-09-11 13:45:53 -04:00
|
|
|
=end
|
2004-10-11 00:51:21 -04:00
|
|
|
# safe_base?
|
|
|
|
if @interp._eval_without_enc("catch {::safe::interpConfigure #{name}}") == '0'
|
|
|
|
begin
|
|
|
|
@interp._eval_without_enc("::safe::interpDelete #{name}")
|
|
|
|
rescue Exception
|
|
|
|
else
|
|
|
|
next if subip.deleted?
|
|
|
|
end
|
|
|
|
end
|
2009-03-05 22:56:38 -05:00
|
|
|
if subip.respond_to?(:safe_base?) && subip.safe_base? &&
|
2004-10-11 00:51:21 -04:00
|
|
|
!subip.deleted?
|
|
|
|
# do 'exit' to call the delete_hook procedure
|
|
|
|
begin
|
2009-03-05 22:56:38 -05:00
|
|
|
subip._eval_without_enc('exit')
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
else
|
|
|
|
begin
|
|
|
|
subip.delete unless subip.deleted?
|
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
begin
|
2004-12-27 06:04:21 -05:00
|
|
|
# @interp._eval_without_enc("foreach i [after info] {after cancel $i}")
|
|
|
|
after_ids = @interp._eval_without_enc("after info")
|
|
|
|
@interp._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
=begin
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
@interp._invoke('destroy', '.') unless @interp.deleted?
|
|
|
|
rescue Exception
|
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
=end
|
2004-10-11 00:51:21 -04:00
|
|
|
if @safe_base && !@interp.deleted?
|
|
|
|
# do 'exit' to call the delete_hook procedure
|
|
|
|
@interp._eval_without_enc('exit')
|
|
|
|
else
|
|
|
|
@interp.delete unless @interp.deleted?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
_check_and_return(thread, MultiTkIp_OK.new(ret))
|
|
|
|
# break
|
2004-09-17 02:05:33 -04:00
|
|
|
|
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
# raise security error
|
|
|
|
_check_and_return(thread, e)
|
2004-09-17 02:05:33 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
rescue Exception => e
|
|
|
|
# raise exception
|
2005-03-02 02:06:52 -05:00
|
|
|
begin
|
|
|
|
bt = _toUTF8(e.backtrace.join("\n"))
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
if MultiTkIp::WITH_ENCODING
|
|
|
|
bt.force_encoding('utf-8')
|
|
|
|
else
|
|
|
|
bt.instance_variable_set(:@encoding, 'utf-8')
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
rescue Exception
|
|
|
|
bt = e.backtrace.join("\n")
|
|
|
|
end
|
|
|
|
begin
|
|
|
|
@interp._set_global_var('errorInfo', bt)
|
|
|
|
rescue Exception
|
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
_check_and_return(thread, e)
|
|
|
|
|
|
|
|
else
|
|
|
|
# no exception
|
|
|
|
_check_and_return(thread, MultiTkIp_OK.new(ret))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def _receiver_eval_proc(last_thread, safe_level, thread, cmd, *args)
|
|
|
|
if thread
|
|
|
|
Thread.new{
|
2004-10-11 00:51:21 -04:00
|
|
|
last_thread.join if last_thread
|
|
|
|
unless @interp.deleted?
|
|
|
|
_receiver_eval_proc_core(safe_level, thread, cmd, *args)
|
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
Thread.new{
|
2004-10-11 00:51:21 -04:00
|
|
|
unless @interp.deleted?
|
|
|
|
_receiver_eval_proc_core(safe_level, thread, cmd, *args)
|
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
}
|
|
|
|
last_thread
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private :_receiver_eval_proc, :_receiver_eval_proc_core
|
|
|
|
|
|
|
|
def _receiver_mainloop(check_root)
|
2005-07-21 18:05:04 -04:00
|
|
|
if @evloop_thread[0] && @evloop_thread[0].alive?
|
|
|
|
@evloop_thread[0]
|
|
|
|
else
|
|
|
|
@evloop_thread[0] = Thread.new{
|
|
|
|
while !@interp.deleted?
|
|
|
|
#if check_root
|
|
|
|
# inf = @interp._invoke_without_enc('info', 'command', '.')
|
|
|
|
# break if !inf.kind_of?(String) || inf != '.'
|
|
|
|
#end
|
|
|
|
break if check_root && !@interp.has_mainwindow?
|
|
|
|
sleep 0.5
|
|
|
|
end
|
|
|
|
}
|
|
|
|
@evloop_thread[0]
|
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def _create_receiver_and_watchdog(lvl = $SAFE)
|
|
|
|
lvl = $SAFE if lvl < $SAFE
|
|
|
|
|
|
|
|
# command-procedures receiver
|
|
|
|
receiver = Thread.new(lvl){|safe_level|
|
2005-07-21 18:05:04 -04:00
|
|
|
last_thread = {}
|
2004-09-08 02:23:41 -04:00
|
|
|
|
2004-09-17 02:05:33 -04:00
|
|
|
loop do
|
2004-10-11 00:51:21 -04:00
|
|
|
break if @interp.deleted?
|
|
|
|
thread, cmd, *args = @cmd_queue.deq
|
|
|
|
if thread == @system
|
|
|
|
# control command
|
|
|
|
case cmd
|
|
|
|
when 'set_safe_level'
|
|
|
|
begin
|
2009-03-05 22:56:38 -05:00
|
|
|
safe_level = args[0] if safe_level < args[0]
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
when 'call_mainloop'
|
|
|
|
thread = args.shift
|
2009-03-05 22:56:38 -05:00
|
|
|
_check_and_return(thread,
|
2004-10-11 00:51:21 -04:00
|
|
|
MultiTkIp_OK.new(_receiver_mainloop(*args)))
|
|
|
|
else
|
|
|
|
# ignore
|
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
# procedure
|
2009-03-05 22:56:38 -05:00
|
|
|
last_thread[thread] = _receiver_eval_proc(last_thread[thread],
|
|
|
|
safe_level, thread,
|
2005-07-21 18:05:04 -04:00
|
|
|
cmd, *args)
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
# watchdog of receiver
|
|
|
|
watchdog = Thread.new{
|
|
|
|
begin
|
2004-10-11 00:51:21 -04:00
|
|
|
loop do
|
|
|
|
sleep 1
|
2009-08-03 15:01:03 -04:00
|
|
|
if @interp.deleted?
|
|
|
|
receiver.kill
|
|
|
|
@cmd_queue.close
|
|
|
|
end
|
2004-10-11 00:51:21 -04:00
|
|
|
break unless receiver.alive?
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
rescue Exception
|
2004-10-11 00:51:21 -04:00
|
|
|
# ignore all kind of Exception
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
2009-08-03 15:01:03 -04:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
# receiver is dead
|
2009-08-03 15:01:03 -04:00
|
|
|
retry_count = 3
|
2003-07-27 15:35:06 -04:00
|
|
|
loop do
|
2009-08-03 15:01:03 -04:00
|
|
|
Thread.pass
|
|
|
|
begin
|
|
|
|
thread, cmd, *args = @cmd_queue.deq(true) # non-block
|
|
|
|
rescue ThreadError
|
|
|
|
# queue is empty
|
|
|
|
retry_count -= 1
|
|
|
|
break if retry_count <= 0
|
|
|
|
sleep 0.5
|
|
|
|
retry
|
|
|
|
end
|
2004-10-11 00:51:21 -04:00
|
|
|
next unless thread
|
|
|
|
if thread.alive?
|
|
|
|
if @interp.deleted?
|
|
|
|
thread.raise RuntimeError, 'the interpreter is already deleted'
|
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
thread.raise RuntimeError,
|
2004-10-11 00:51:21 -04:00
|
|
|
'the interpreter no longer receives command procedures'
|
|
|
|
end
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
# return threads
|
|
|
|
[receiver, watchdog]
|
|
|
|
end
|
|
|
|
private :_check_and_return, :_create_receiver_and_watchdog
|
|
|
|
|
|
|
|
######################################
|
|
|
|
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD
|
|
|
|
### Ruby 1.9 !!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
RUN_EVENTLOOP_ON_MAIN_THREAD = false
|
|
|
|
end
|
2008-02-28 12:27:41 -05:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
if self.const_defined? :DEFAULT_MASTER_NAME
|
|
|
|
name = DEFAULT_MASTER_NAME.to_s
|
|
|
|
else
|
|
|
|
name = nil
|
|
|
|
end
|
|
|
|
if self.const_defined?(:DEFAULT_MASTER_OPTS) &&
|
|
|
|
DEFAULT_MASTER_OPTS.kind_of?(Hash)
|
|
|
|
keys = DEFAULT_MASTER_OPTS
|
|
|
|
else
|
|
|
|
keys = {}
|
|
|
|
end
|
|
|
|
|
|
|
|
@@DEFAULT_MASTER = self.allocate
|
|
|
|
@@DEFAULT_MASTER.instance_eval{
|
2009-07-12 19:08:32 -04:00
|
|
|
@tk_windows = TkUtil.untrust({})
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@tk_table_list = TkUtil.untrust([])
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@slave_ip_tbl = TkUtil.untrust({})
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@slave_ip_top = TkUtil.untrust({})
|
2004-05-01 12:09:54 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@evloop_thread = TkUtil.untrust([])
|
2005-07-21 18:05:04 -04:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
unless keys.kind_of? Hash
|
|
|
|
fail ArgumentError, "expecting a Hash object for the 2nd argument"
|
|
|
|
end
|
|
|
|
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
if !WITH_RUBY_VM || RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
|
2007-12-21 03:57:35 -05:00
|
|
|
@interp = TclTkIp.new(name, _keys2opts(keys))
|
2008-02-28 12:27:41 -05:00
|
|
|
else ### Ruby 1.9 !!!!!!!!!!!
|
2007-12-21 03:57:35 -05:00
|
|
|
@interp_thread = Thread.new{
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
current = Thread.current
|
2009-07-12 19:08:32 -04:00
|
|
|
begin
|
|
|
|
current[:interp] = interp = TclTkIp.new(name, _keys2opts(keys))
|
|
|
|
rescue e
|
|
|
|
current[:interp] = e
|
|
|
|
raise e
|
|
|
|
end
|
2007-12-21 03:57:35 -05:00
|
|
|
#sleep
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
current[:mutex] = mutex = Mutex.new
|
|
|
|
current[:root_check] = cond_var = ConditionVariable.new
|
|
|
|
|
* 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
|
|
|
status = [nil]
|
|
|
|
def status.value
|
|
|
|
self[0]
|
|
|
|
end
|
|
|
|
def status.value=(val)
|
|
|
|
self[0] = val
|
|
|
|
end
|
|
|
|
current[:status] = status
|
|
|
|
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
begin
|
2009-07-12 19:08:32 -04:00
|
|
|
begin
|
|
|
|
#TclTkLib.mainloop_abort_on_exception = false
|
|
|
|
#Thread.current[:status].value = TclTkLib.mainloop(true)
|
|
|
|
interp.mainloop_abort_on_exception = true
|
|
|
|
current[:status].value = interp.mainloop(true)
|
|
|
|
rescue SystemExit=>e
|
|
|
|
current[:status].value = e
|
|
|
|
rescue Exception=>e
|
|
|
|
current[:status].value = e
|
|
|
|
retry if interp.has_mainwindow?
|
|
|
|
ensure
|
|
|
|
mutex.synchronize{ cond_var.broadcast }
|
|
|
|
end
|
|
|
|
|
|
|
|
#Thread.current[:status].value = TclTkLib.mainloop(false)
|
|
|
|
current[:status].value = interp.mainloop(false)
|
|
|
|
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
ensure
|
2009-07-12 19:08:32 -04:00
|
|
|
# interp must be deleted before the thread for interp is dead.
|
|
|
|
# If not, raise Tcl_Panic on Tcl_AsyncDelete because async handler
|
|
|
|
# deleted by the wrong thread.
|
|
|
|
interp.delete
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
end
|
2007-12-21 03:57:35 -05:00
|
|
|
}
|
|
|
|
until @interp_thread[:interp]
|
|
|
|
Thread.pass
|
|
|
|
end
|
|
|
|
# INTERP_THREAD.run
|
|
|
|
@interp = @interp_thread[:interp]
|
|
|
|
|
|
|
|
def self.mainloop(check_root = true)
|
|
|
|
begin
|
|
|
|
TclTkLib.set_eventloop_window_mode(true)
|
|
|
|
@interp_thread.value
|
|
|
|
ensure
|
|
|
|
TclTkLib.set_eventloop_window_mode(false)
|
|
|
|
end
|
|
|
|
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
|
|
|
@interp.instance_eval{
|
2009-07-12 19:08:32 -04:00
|
|
|
@force_default_encoding ||= TkUtil.untrust([false])
|
|
|
|
@encoding ||= TkUtil.untrust([nil])
|
* 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 @encoding.to_s; self.join(nil); end
|
|
|
|
}
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
@ip_name = nil
|
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@callback_status = TkUtil.untrust([])
|
2006-07-03 06:08:11 -04:00
|
|
|
|
2003-07-28 02:10:13 -04:00
|
|
|
@system = Object.new
|
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@wait_on_mainloop = TkUtil.untrust([true, 0])
|
2004-09-17 02:05:33 -04:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
@threadgroup = Thread.current.group
|
|
|
|
|
2004-09-11 13:45:53 -04:00
|
|
|
@safe_base = false
|
|
|
|
|
2004-09-02 13:17:20 -04:00
|
|
|
@safe_level = [$SAFE]
|
|
|
|
|
2009-08-03 15:01:03 -04:00
|
|
|
@cmd_queue = MultiTkIp::Command_Queue.new(@interp)
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2004-09-02 13:17:20 -04:00
|
|
|
@cmd_receiver, @receiver_watchdog = _create_receiver_and_watchdog(@safe_level[0])
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
@threadgroup.add @cmd_receiver
|
|
|
|
@threadgroup.add @receiver_watchdog
|
|
|
|
|
|
|
|
# NOT enclose @threadgroup for @@DEFAULT_MASTER
|
|
|
|
|
|
|
|
@@IP_TABLE[ThreadGroup::Default] = self
|
|
|
|
@@IP_TABLE[@threadgroup] = self
|
2004-09-08 02:23:41 -04:00
|
|
|
|
|
|
|
#################################
|
|
|
|
|
2006-07-10 05:52:30 -04:00
|
|
|
@pseudo_toplevel = [false, nil]
|
|
|
|
|
|
|
|
def self.__pseudo_toplevel
|
2009-03-05 22:56:38 -05:00
|
|
|
Thread.current.group == ThreadGroup::Default &&
|
2006-07-11 05:04:00 -04:00
|
|
|
MultiTkIp.__getip == @@DEFAULT_MASTER &&
|
|
|
|
self.__pseudo_toplevel_evaluable? && @pseudo_toplevel[1]
|
2006-07-10 05:52:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.__pseudo_toplevel=(m)
|
2009-03-05 22:56:38 -05:00
|
|
|
unless (Thread.current.group == ThreadGroup::Default &&
|
2006-07-10 05:52:30 -04:00
|
|
|
MultiTkIp.__getip == @@DEFAULT_MASTER)
|
|
|
|
fail SecurityError, "no permission to manipulate"
|
|
|
|
end
|
|
|
|
|
2006-07-11 06:15:47 -04:00
|
|
|
# if m.kind_of?(Module) && m.respond_to?(:pseudo_toplevel_evaluable?)
|
|
|
|
if m.respond_to?(:pseudo_toplevel_evaluable?)
|
2006-07-10 05:52:30 -04:00
|
|
|
@pseudo_toplevel[0] = true
|
|
|
|
@pseudo_toplevel[1] = m
|
|
|
|
else
|
|
|
|
fail ArgumentError, 'fail to set pseudo-toplevel'
|
|
|
|
end
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.__pseudo_toplevel_evaluable?
|
|
|
|
begin
|
|
|
|
@pseudo_toplevel[0] && @pseudo_toplevel[1].pseudo_toplevel_evaluable?
|
|
|
|
rescue Exception
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.__pseudo_toplevel_evaluable=(mode)
|
2009-03-05 22:56:38 -05:00
|
|
|
unless (Thread.current.group == ThreadGroup::Default &&
|
2006-07-10 05:52:30 -04:00
|
|
|
MultiTkIp.__getip == @@DEFAULT_MASTER)
|
|
|
|
fail SecurityError, "no permission to manipulate"
|
|
|
|
end
|
|
|
|
|
|
|
|
@pseudo_toplevel[0] = (mode)? true: false
|
|
|
|
end
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
2004-09-08 02:23:41 -04:00
|
|
|
@assign_request = Class.new(Exception){
|
|
|
|
def self.new(target, ret)
|
2004-10-11 00:51:21 -04:00
|
|
|
obj = super()
|
|
|
|
obj.target = target
|
|
|
|
obj.ret = ret
|
|
|
|
obj
|
2004-09-08 02:23:41 -04:00
|
|
|
end
|
|
|
|
attr_accessor :target, :ret
|
|
|
|
}
|
|
|
|
|
|
|
|
@assign_thread = Thread.new{
|
|
|
|
loop do
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
Thread.stop
|
|
|
|
rescue @assign_request=>req
|
|
|
|
begin
|
|
|
|
req.ret[0] = req.target.instance_eval{
|
2009-03-05 22:56:38 -05:00
|
|
|
@cmd_receiver, @receiver_watchdog =
|
2004-10-11 00:51:21 -04:00
|
|
|
_create_receiver_and_watchdog(@safe_level[0])
|
|
|
|
@threadgroup.add @cmd_receiver
|
|
|
|
@threadgroup.add @receiver_watchdog
|
|
|
|
@threadgroup.enclose
|
|
|
|
true
|
|
|
|
}
|
|
|
|
rescue Exception=>e
|
|
|
|
begin
|
|
|
|
req.ret[0] = e
|
|
|
|
rescue Exception
|
|
|
|
# ignore
|
|
|
|
end
|
|
|
|
end
|
|
|
|
rescue Exception
|
|
|
|
# ignore
|
|
|
|
end
|
2004-09-08 02:23:41 -04:00
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
def self.assign_receiver_and_watchdog(target)
|
|
|
|
ret = [nil]
|
|
|
|
@assign_thread.raise(@assign_request.new(target, ret))
|
|
|
|
while ret[0] == nil
|
2004-10-11 00:51:21 -04:00
|
|
|
unless @assign_thread.alive?
|
|
|
|
raise RuntimeError, 'lost the thread to assign a receiver and a watchdog thread'
|
|
|
|
end
|
2004-09-08 02:23:41 -04:00
|
|
|
end
|
|
|
|
if ret[0].kind_of?(Exception)
|
2004-10-11 00:51:21 -04:00
|
|
|
raise ret[0]
|
2004-09-08 02:23:41 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
ret[0]
|
2004-09-08 02:23:41 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
2006-07-10 05:52:30 -04:00
|
|
|
@init_ip_env_queue = Queue.new
|
|
|
|
Thread.new{
|
|
|
|
current = Thread.current
|
|
|
|
loop {
|
2008-02-28 12:27:41 -05:00
|
|
|
mtx, cond, ret, table, script = @init_ip_env_queue.deq
|
|
|
|
begin
|
2006-07-10 05:52:30 -04:00
|
|
|
ret[0] = table.each{|tg, ip| ip._init_ip_env(script) }
|
|
|
|
rescue Exception => e
|
|
|
|
ret[0] = e
|
|
|
|
ensure
|
2008-02-28 12:27:41 -05:00
|
|
|
mtx.synchronize{ cond.signal }
|
2006-07-10 05:52:30 -04:00
|
|
|
end
|
2008-02-28 12:27:41 -05:00
|
|
|
mtx = cond = ret = table = script = nil # clear variables for GC
|
2006-07-10 05:52:30 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def self.__init_ip_env__(table, script)
|
|
|
|
ret = []
|
2008-02-28 12:27:41 -05:00
|
|
|
mtx = (Thread.current[:MultiTk_ip_Mutex] ||= Mutex.new)
|
|
|
|
cond = (Thread.current[:MultiTk_ip_CondVar] ||= ConditionVariable.new)
|
|
|
|
mtx.synchronize{
|
|
|
|
@init_ip_env_queue.enq([mtx, cond, ret, table, script])
|
|
|
|
cond.wait(mtx)
|
|
|
|
}
|
2006-07-10 05:52:30 -04:00
|
|
|
if ret[0].kind_of?(Exception)
|
|
|
|
raise ret[0]
|
|
|
|
else
|
|
|
|
ret[0]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
#################################
|
|
|
|
|
2004-09-08 02:23:41 -04:00
|
|
|
class << self
|
|
|
|
undef :instance_eval
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
}
|
2006-07-10 05:52:30 -04:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
@@DEFAULT_MASTER.freeze # defend against modification
|
|
|
|
|
|
|
|
######################################
|
|
|
|
|
|
|
|
def self.inherited(subclass)
|
|
|
|
# trust if on ThreadGroup::Default or @@DEFAULT_MASTER's ThreadGroup
|
|
|
|
if @@IP_TABLE[Thread.current.group] == @@DEFAULT_MASTER
|
|
|
|
begin
|
2004-10-11 00:51:21 -04:00
|
|
|
class << subclass
|
|
|
|
self.methods.each{|m|
|
* 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
|
|
|
name = m.to_s
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
* 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
|
|
|
unless name == '__id__' || name == '__send__' || name == 'freeze'
|
2004-10-11 00:51:21 -04:00
|
|
|
undef_method(m)
|
|
|
|
end
|
|
|
|
rescue Exception
|
|
|
|
# ignore all exceptions
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
ensure
|
2004-10-11 00:51:21 -04:00
|
|
|
subclass.freeze
|
2009-03-05 22:56:38 -05:00
|
|
|
fail SecurityError,
|
2004-10-11 00:51:21 -04:00
|
|
|
"cannot create subclass of MultiTkIp on a untrusted ThreadGroup"
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
######################################
|
|
|
|
|
2005-07-21 18:05:04 -04:00
|
|
|
@@SAFE_OPT_LIST = [
|
2009-03-05 22:56:38 -05:00
|
|
|
'accessPath'.freeze,
|
|
|
|
'statics'.freeze,
|
|
|
|
'nested'.freeze,
|
2003-08-02 01:04:30 -04:00
|
|
|
'deleteHook'.freeze
|
|
|
|
].freeze
|
2003-09-07 03:10:44 -04:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
def _parse_slaveopts(keys)
|
|
|
|
name = nil
|
|
|
|
safe = false
|
|
|
|
safe_opts = {}
|
|
|
|
tk_opts = {}
|
|
|
|
|
|
|
|
keys.each{|k,v|
|
2004-05-01 12:09:54 -04:00
|
|
|
k_str = k.to_s
|
|
|
|
if k_str == 'name'
|
2009-03-05 22:56:38 -05:00
|
|
|
name = v
|
2004-05-01 12:09:54 -04:00
|
|
|
elsif k_str == 'safe'
|
2004-10-11 00:51:21 -04:00
|
|
|
safe = v
|
2005-07-21 18:05:04 -04:00
|
|
|
elsif @@SAFE_OPT_LIST.member?(k_str)
|
2004-10-11 00:51:21 -04:00
|
|
|
safe_opts[k_str] = v
|
2003-07-27 15:35:06 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
tk_opts[k_str] = v
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
}
|
|
|
|
|
2004-05-01 12:09:54 -04:00
|
|
|
if keys['without_tk'] || keys[:without_tk]
|
|
|
|
[name, safe, safe_opts, nil]
|
|
|
|
else
|
|
|
|
[name, safe, safe_opts, tk_opts]
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
private :_parse_slaveopts
|
|
|
|
|
|
|
|
def _create_slave_ip_name
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
@@SLAVE_IP_ID.mutex.synchronize{
|
|
|
|
name = @@SLAVE_IP_ID.join('')
|
|
|
|
@@SLAVE_IP_ID[1].succ!
|
|
|
|
name.freeze
|
|
|
|
}
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
private :_create_slave_ip_name
|
|
|
|
|
|
|
|
######################################
|
|
|
|
|
|
|
|
def __check_safetk_optkeys(optkeys)
|
|
|
|
# based on 'safetk.tcl'
|
|
|
|
new_keys = {}
|
2003-07-28 21:24:32 -04:00
|
|
|
optkeys.each{|k,v| new_keys[k.to_s] = v}
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
# check 'display'
|
|
|
|
if !new_keys.key?('display')
|
|
|
|
begin
|
2004-10-11 00:51:21 -04:00
|
|
|
#new_keys['display'] = @interp._invoke('winfo screen .')
|
|
|
|
new_keys['display'] = @interp._invoke('winfo', 'screen', '.')
|
2003-07-27 15:35:06 -04:00
|
|
|
rescue
|
2004-10-11 00:51:21 -04:00
|
|
|
if ENV[DISPLAY]
|
|
|
|
new_keys['display'] = ENV[DISPLAY]
|
|
|
|
elsif !new_keys.key?('use')
|
|
|
|
warn "Warning: no screen info or ENV[DISPLAY], so use ':0.0'"
|
|
|
|
new_keys['display'] = ':0.0'
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# check 'use'
|
|
|
|
if new_keys.key?('use')
|
|
|
|
# given 'use'
|
|
|
|
case new_keys['use']
|
|
|
|
when TkWindow
|
2004-10-11 00:51:21 -04:00
|
|
|
new_keys['use'] = TkWinfo.id(new_keys['use'])
|
|
|
|
#assoc_display = @interp._eval('winfo screen .')
|
|
|
|
assoc_display = @interp._invoke('winfo', 'screen', '.')
|
2003-07-27 15:35:06 -04:00
|
|
|
when /^\..*/
|
2004-10-11 00:51:21 -04:00
|
|
|
new_keys['use'] = @interp._invoke('winfo', 'id', new_keys['use'])
|
|
|
|
assoc_display = @interp._invoke('winfo', 'screen', new_keys['use'])
|
2003-07-27 15:35:06 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
pathname = @interp._invoke('winfo', 'pathname', new_keys['use'])
|
2005-06-03 01:08:40 -04:00
|
|
|
assoc_display = @interp._invoke('winfo', 'screen', pathname)
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue
|
|
|
|
assoc_display = new_keys['display']
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
# match display?
|
|
|
|
if assoc_display != new_keys['display']
|
2005-06-03 01:08:40 -04:00
|
|
|
if optkeys.key?(:display) || optkeys.key?('display')
|
2009-03-05 22:56:38 -05:00
|
|
|
fail RuntimeError,
|
|
|
|
"conflicting 'display'=>#{new_keys['display']} " +
|
2004-10-11 00:51:21 -04:00
|
|
|
"and display '#{assoc_display}' on 'use'=>#{new_keys['use']}"
|
|
|
|
else
|
|
|
|
new_keys['display'] = assoc_display
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# return
|
|
|
|
new_keys
|
|
|
|
end
|
|
|
|
private :__check_safetk_optkeys
|
|
|
|
|
|
|
|
def __create_safetk_frame(slave_ip, slave_name, app_name, keys)
|
2003-07-28 21:24:32 -04:00
|
|
|
# display option is used by ::safe::loadTk
|
|
|
|
loadTk_keys = {}
|
|
|
|
loadTk_keys['display'] = keys['display']
|
2003-07-27 15:35:06 -04:00
|
|
|
dup_keys = keys.dup
|
2003-07-28 21:24:32 -04:00
|
|
|
|
|
|
|
# keys for toplevel : allow followings
|
|
|
|
toplevel_keys = {}
|
|
|
|
['height', 'width', 'background', 'menu'].each{|k|
|
|
|
|
toplevel_keys[k] = dup_keys.delete(k) if dup_keys.key?(k)
|
|
|
|
}
|
|
|
|
toplevel_keys['classname'] = 'SafeTk'
|
|
|
|
toplevel_keys['screen'] = dup_keys.delete('display')
|
|
|
|
|
|
|
|
# other keys used by pack option of container frame
|
|
|
|
|
|
|
|
# create toplevel widget
|
2003-07-27 15:35:06 -04:00
|
|
|
begin
|
2003-07-28 21:24:32 -04:00
|
|
|
top = TkToplevel.new(toplevel_keys)
|
2005-03-02 02:06:52 -05:00
|
|
|
rescue NameError => e
|
|
|
|
fail e unless @interp.safe?
|
2003-07-27 15:35:06 -04:00
|
|
|
fail SecurityError, "unable create toplevel on the safe interpreter"
|
|
|
|
end
|
|
|
|
msg = "Untrusted Ruby/Tk applet (#{slave_name})"
|
|
|
|
if app_name.kind_of?(String)
|
|
|
|
top.title "#{app_name} (#{slave_name})"
|
|
|
|
else
|
|
|
|
top.title msg
|
|
|
|
end
|
|
|
|
|
|
|
|
# procedure to delete slave interpreter
|
|
|
|
slave_delete_proc = proc{
|
|
|
|
unless slave_ip.deleted?
|
2004-10-11 00:51:21 -04:00
|
|
|
#if slave_ip._invoke('info', 'command', '.') != ""
|
|
|
|
# slave_ip._invoke('destroy', '.')
|
|
|
|
#end
|
|
|
|
#slave_ip.delete
|
|
|
|
slave_ip._eval_without_enc('exit')
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
2005-01-25 00:09:22 -05:00
|
|
|
begin
|
|
|
|
top.destroy if top.winfo_exist?
|
|
|
|
rescue
|
|
|
|
# ignore
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
}
|
|
|
|
tag = TkBindTag.new.bind('Destroy', slave_delete_proc)
|
|
|
|
|
2004-05-01 12:09:54 -04:00
|
|
|
top.bindtags = top.bindtags.unshift(tag)
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
# create control frame
|
|
|
|
TkFrame.new(top, :bg=>'red', :borderwidth=>3, :relief=>'ridge') {|fc|
|
|
|
|
fc.bindtags = fc.bindtags.unshift(tag)
|
|
|
|
|
|
|
|
TkFrame.new(fc, :bd=>0){|f|
|
2009-03-05 22:56:38 -05:00
|
|
|
TkButton.new(f,
|
|
|
|
:text=>'Delete', :bd=>1, :padx=>2, :pady=>0,
|
2004-10-11 00:51:21 -04:00
|
|
|
:highlightthickness=>0, :command=>slave_delete_proc
|
|
|
|
).pack(:side=>:right, :fill=>:both)
|
|
|
|
f.pack(:side=>:right, :fill=>:both, :expand=>true)
|
2003-07-27 15:35:06 -04:00
|
|
|
}
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
TkLabel.new(fc, :text=>msg, :padx=>2, :pady=>0,
|
2004-10-11 00:51:21 -04:00
|
|
|
:anchor=>:w).pack(:side=>:left, :fill=>:both, :expand=>true)
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
fc.pack(:side=>:bottom, :fill=>:x)
|
|
|
|
}
|
|
|
|
|
|
|
|
# container frame for slave interpreter
|
2003-07-28 21:24:32 -04:00
|
|
|
dup_keys['fill'] = :both unless dup_keys.key?('fill')
|
|
|
|
dup_keys['expand'] = true unless dup_keys.key?('expand')
|
|
|
|
c = TkFrame.new(top, :container=>true).pack(dup_keys)
|
2006-04-18 04:43:10 -04:00
|
|
|
c.bind('Destroy', proc{top.destroy})
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2003-07-28 21:24:32 -04:00
|
|
|
# return keys
|
|
|
|
loadTk_keys['use'] = TkWinfo.id(c)
|
2004-05-01 12:09:54 -04:00
|
|
|
[loadTk_keys, top.path]
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
private :__create_safetk_frame
|
|
|
|
|
|
|
|
def __create_safe_slave_obj(safe_opts, app_name, tk_opts)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
# safe interpreter
|
|
|
|
ip_name = _create_slave_ip_name
|
|
|
|
slave_ip = @interp.create_slave(ip_name, true)
|
* 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
|
|
|
slave_ip.instance_eval{
|
2009-07-12 19:08:32 -04:00
|
|
|
@force_default_encoding ||= TkUtil.untrust([false])
|
|
|
|
@encoding ||= TkUtil.untrust([nil])
|
* 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 @encoding.to_s; self.join(nil); end
|
|
|
|
}
|
2003-07-27 15:35:06 -04:00
|
|
|
@slave_ip_tbl[ip_name] = slave_ip
|
2004-09-08 02:23:41 -04:00
|
|
|
def slave_ip.safe_base?
|
|
|
|
true
|
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
|
|
|
|
@interp._eval("::safe::interpInit #{ip_name}")
|
|
|
|
|
|
|
|
slave_ip._invoke('set', 'argv0', app_name) if app_name.kind_of?(String)
|
|
|
|
|
|
|
|
if tk_opts
|
|
|
|
tk_opts = __check_safetk_optkeys(tk_opts)
|
|
|
|
if tk_opts.key?('use')
|
2004-10-11 00:51:21 -04:00
|
|
|
@slave_ip_top[ip_name] = ''
|
2004-05-01 12:09:54 -04:00
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
tk_opts, top_path = __create_safetk_frame(slave_ip, ip_name, app_name,
|
2004-10-11 00:51:21 -04:00
|
|
|
tk_opts)
|
|
|
|
@slave_ip_top[ip_name] = top_path
|
2004-05-01 12:09:54 -04:00
|
|
|
end
|
|
|
|
@interp._eval("::safe::loadTk #{ip_name} #{_keys2opts(tk_opts)}")
|
2009-08-03 15:01:03 -04:00
|
|
|
@interp._invoke('__replace_slave_tk_commands__', ip_name)
|
2004-05-01 12:09:54 -04:00
|
|
|
else
|
|
|
|
@slave_ip_top[ip_name] = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
if safe_opts.key?('deleteHook') || safe_opts.key?(:deleteHook)
|
2009-03-05 22:56:38 -05:00
|
|
|
@interp._eval("::safe::interpConfigure #{ip_name} " +
|
2004-10-11 00:51:21 -04:00
|
|
|
_keys2opts(safe_opts))
|
2004-05-01 12:09:54 -04:00
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
@interp._eval("::safe::interpConfigure #{ip_name} " +
|
|
|
|
_keys2opts(safe_opts) + '-deleteHook {' +
|
2004-10-11 00:51:21 -04:00
|
|
|
TkComm._get_eval_string(proc{|slave|
|
|
|
|
self._default_delete_hook(slave)
|
|
|
|
}) + '}')
|
2004-05-01 12:09:54 -04:00
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
[slave_ip, ip_name]
|
|
|
|
end
|
|
|
|
|
|
|
|
def __create_trusted_slave_obj(name, keys)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
ip_name = _create_slave_ip_name
|
|
|
|
slave_ip = @interp.create_slave(ip_name, false)
|
* 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
|
|
|
slave_ip.instance_eval{
|
2009-07-12 19:08:32 -04:00
|
|
|
@force_default_encoding ||= TkUtil.untrust([false])
|
|
|
|
@encoding ||= TkUtil.untrust([nil])
|
* 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 @encoding.to_s; self.join(nil); end
|
|
|
|
}
|
2003-07-27 15:35:06 -04:00
|
|
|
slave_ip._invoke('set', 'argv0', name) if name.kind_of?(String)
|
|
|
|
slave_ip._invoke('set', 'argv', _keys2opts(keys))
|
|
|
|
@interp._invoke('load', '', 'Tk', ip_name)
|
2009-08-03 15:01:03 -04:00
|
|
|
@interp._invoke('__replace_slave_tk_commands__', ip_name)
|
2003-07-27 15:35:06 -04:00
|
|
|
@slave_ip_tbl[ip_name] = slave_ip
|
|
|
|
[slave_ip, ip_name]
|
|
|
|
end
|
|
|
|
|
|
|
|
######################################
|
|
|
|
|
|
|
|
def _create_slave_object(keys={})
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
ip = MultiTkIp.new_slave(self, keys={})
|
|
|
|
@slave_ip_tbl[ip.name] = ip
|
|
|
|
end
|
|
|
|
|
|
|
|
######################################
|
|
|
|
|
|
|
|
def initialize(master, safeip=true, keys={})
|
2003-09-08 09:16:57 -04:00
|
|
|
if $SAFE >= 4
|
|
|
|
fail SecurityError, "cannot create a new interpreter at level #{$SAFE}"
|
|
|
|
end
|
|
|
|
|
|
|
|
if safeip == nil && $SAFE >= 2
|
|
|
|
fail SecurityError, "cannot create a master-ip at level #{$SAFE}"
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
2005-03-02 02:06:52 -05:00
|
|
|
if master.deleted? && safeip == nil
|
|
|
|
fail RuntimeError, "cannot create a slave of a deleted interpreter"
|
|
|
|
end
|
|
|
|
|
|
|
|
if !master.deleted? && !master.master? && master.safe?
|
2003-09-08 09:16:57 -04:00
|
|
|
fail SecurityError, "safe-slave-ip cannot create a new interpreter"
|
|
|
|
end
|
|
|
|
|
|
|
|
if safeip == nil && !master.master?
|
|
|
|
fail SecurityError, "slave-ip cannot create a master-ip"
|
2003-09-07 03:10:44 -04:00
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
unless keys.kind_of? Hash
|
|
|
|
fail ArgumentError, "expecting a Hash object for the 2nd argument"
|
|
|
|
end
|
|
|
|
|
|
|
|
@tk_windows = {}
|
|
|
|
@tk_table_list = []
|
|
|
|
@slave_ip_tbl = {}
|
2004-05-01 12:09:54 -04:00
|
|
|
@slave_ip_top = {}
|
2005-07-21 18:05:04 -04:00
|
|
|
@cb_error_proc = []
|
|
|
|
@evloop_thread = []
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
TkUtil.untrust(@tk_windows) unless @tk_windows.tainted?
|
|
|
|
TkUtil.untrust(@tk_table_list) unless @tk_table_list.tainted?
|
|
|
|
TkUtil.untrust(@slave_ip_tbl) unless @slave_ip_tbl.tainted?
|
|
|
|
TkUtil.untrust(@slave_ip_top) unless @slave_ip_top.tainted?
|
|
|
|
TkUtil.untrust(@cb_error_proc) unless @cb_error_proc.tainted?
|
|
|
|
TkUtil.untrust(@evloop_thread) unless @evloop_thread.tainted?
|
2003-09-07 03:10:44 -04:00
|
|
|
|
2006-07-03 06:08:11 -04:00
|
|
|
@callback_status = []
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
name, safe, safe_opts, tk_opts = _parse_slaveopts(keys)
|
|
|
|
|
2004-09-02 13:17:20 -04:00
|
|
|
safe = 4 if safe && !safe.kind_of?(Fixnum)
|
|
|
|
|
2004-09-08 02:23:41 -04:00
|
|
|
@safe_base = false
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
if safeip == nil
|
|
|
|
# create master-ip
|
2008-02-28 12:27:41 -05:00
|
|
|
unless WITH_RUBY_VM
|
2007-12-21 03:57:35 -05:00
|
|
|
@interp = TclTkIp.new(name, _keys2opts(tk_opts))
|
* 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
|
|
|
@interp.instance_eval{
|
2009-07-12 19:08:32 -04:00
|
|
|
@force_default_encoding ||= TkUtil.untrust([false])
|
|
|
|
@encoding ||= TkUtil.untrust([nil])
|
* 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 @encoding.to_s; self.join(nil); end
|
|
|
|
}
|
|
|
|
|
2008-02-28 12:27:41 -05:00
|
|
|
else ### Ruby 1.9 !!!!!!!!!!!
|
2009-07-12 19:08:32 -04:00
|
|
|
=begin
|
2007-12-21 03:57:35 -05:00
|
|
|
@interp_thread = Thread.new{
|
|
|
|
Thread.current[:interp] = interp = TclTkIp.new(name, _keys2opts(tk_opts))
|
* 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
|
|
|
interp.instance_eval{
|
2009-07-12 19:08:32 -04:00
|
|
|
@force_default_encoding ||= TkUtil.untrust([false])
|
|
|
|
@encoding ||= TkUtil.untrust([nil])
|
* 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 @encoding.to_s; self.join(nil); end
|
|
|
|
}
|
|
|
|
|
2007-12-21 03:57:35 -05:00
|
|
|
#sleep
|
|
|
|
TclTkLib.mainloop(true)
|
|
|
|
}
|
|
|
|
until @interp_thread[:interp]
|
|
|
|
Thread.pass
|
|
|
|
end
|
|
|
|
# INTERP_THREAD.run
|
|
|
|
@interp = @interp_thread[:interp]
|
2009-07-12 19:08:32 -04:00
|
|
|
=end
|
|
|
|
@interp_thread = Thread.new{
|
|
|
|
current = Thread.current
|
|
|
|
begin
|
|
|
|
current[:interp] = interp = TclTkIp.new(name, _keys2opts(tk_opts))
|
|
|
|
rescue e
|
|
|
|
current[:interp] = e
|
|
|
|
raise e
|
|
|
|
end
|
|
|
|
#sleep
|
|
|
|
#TclTkLib.mainloop(true)
|
|
|
|
current[:mutex] = mutex = Mutex.new
|
|
|
|
current[:root_check] = cond_ver = ConditionVariable.new
|
|
|
|
|
|
|
|
status = [nil]
|
|
|
|
def status.value
|
|
|
|
self[0]
|
|
|
|
end
|
|
|
|
def status.value=(val)
|
|
|
|
self[0] = val
|
|
|
|
end
|
|
|
|
current[:status] = status
|
|
|
|
|
|
|
|
begin
|
2009-08-03 15:01:03 -04:00
|
|
|
begin
|
|
|
|
current[:status].value = interp.mainloop(true)
|
|
|
|
rescue SystemExit=>e
|
|
|
|
current[:status].value = e
|
|
|
|
rescue Exception=>e
|
|
|
|
current[:status].value = e
|
|
|
|
retry if interp.has_mainwindow?
|
|
|
|
ensure
|
|
|
|
mutex.synchronize{ cond_var.broadcast }
|
|
|
|
end
|
|
|
|
current[:status].value = interp.mainloop(false)
|
2009-07-12 19:08:32 -04:00
|
|
|
ensure
|
2009-08-03 15:01:03 -04:00
|
|
|
interp.delete
|
2009-07-12 19:08:32 -04:00
|
|
|
end
|
|
|
|
}
|
|
|
|
until @interp_thread[:interp]
|
|
|
|
Thread.pass
|
|
|
|
end
|
|
|
|
# INTERP_THREAD.run
|
|
|
|
@interp = @interp_thread[:interp]
|
|
|
|
|
|
|
|
@evloop_thread[0] = @interp_thread
|
|
|
|
|
|
|
|
def self.mainloop(check_root = true)
|
|
|
|
begin
|
|
|
|
TclTkLib.set_eventloop_window_mode(true)
|
|
|
|
@interp_thread.value
|
|
|
|
ensure
|
|
|
|
TclTkLib.set_eventloop_window_mode(false)
|
|
|
|
end
|
|
|
|
end
|
2007-12-21 03:57:35 -05:00
|
|
|
end
|
2004-09-11 13:45:53 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@interp.instance_eval{
|
|
|
|
@force_default_encoding ||= TkUtil.untrust([false])
|
|
|
|
@encoding ||= TkUtil.untrust([nil])
|
|
|
|
def @encoding.to_s; self.join(nil); end
|
|
|
|
}
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
@ip_name = nil
|
2009-07-12 19:08:32 -04:00
|
|
|
|
2004-09-02 13:17:20 -04:00
|
|
|
if safe
|
2004-10-11 00:51:21 -04:00
|
|
|
safe = $SAFE if safe < $SAFE
|
|
|
|
@safe_level = [safe]
|
2004-09-02 13:17:20 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
@safe_level = [$SAFE]
|
2004-09-02 13:17:20 -04:00
|
|
|
end
|
2009-07-12 19:08:32 -04:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
else
|
|
|
|
# create slave-ip
|
|
|
|
if safeip || master.safe?
|
2004-10-11 00:51:21 -04:00
|
|
|
@safe_base = true
|
2009-03-05 22:56:38 -05:00
|
|
|
@interp, @ip_name = master.__create_safe_slave_obj(safe_opts,
|
2004-10-11 00:51:21 -04:00
|
|
|
name, tk_opts)
|
2008-02-28 12:27:41 -05:00
|
|
|
# @interp_thread = nil if RUBY_VERSION < '1.9.0' ### !!!!!!!!!!!
|
|
|
|
@interp_thread = nil unless WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
|
2004-10-11 00:51:21 -04:00
|
|
|
if safe
|
|
|
|
safe = master.safe_level if safe < master.safe_level
|
|
|
|
@safe_level = [safe]
|
|
|
|
else
|
|
|
|
@safe_level = [4]
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
@interp, @ip_name = master.__create_trusted_slave_obj(name, tk_opts)
|
2008-02-28 12:27:41 -05:00
|
|
|
# @interp_thread = nil if RUBY_VERSION < '1.9.0' ### !!!!!!!!!!!
|
|
|
|
@interp_thread = nil unless WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
|
2004-10-11 00:51:21 -04:00
|
|
|
if safe
|
|
|
|
safe = master.safe_level if safe < master.safe_level
|
|
|
|
@safe_level = [safe]
|
|
|
|
else
|
|
|
|
@safe_level = [master.safe_level]
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
2009-03-05 22:56:38 -05:00
|
|
|
@set_alias_proc = proc{|name|
|
2004-10-11 00:51:21 -04:00
|
|
|
master._invoke('interp', 'alias', @ip_name, name, '', name)
|
2003-07-27 15:35:06 -04:00
|
|
|
}.freeze
|
|
|
|
end
|
|
|
|
|
2003-07-28 02:10:13 -04:00
|
|
|
@system = Object.new
|
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
@wait_on_mainloop = TkUtil.untrust([true, 0])
|
|
|
|
# @wait_on_mainloop = TkUtil.untrust([false, 0])
|
2004-09-17 02:05:33 -04:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
@threadgroup = ThreadGroup.new
|
|
|
|
|
2006-07-10 05:52:30 -04:00
|
|
|
@pseudo_toplevel = [false, nil]
|
|
|
|
|
2009-08-03 15:01:03 -04:00
|
|
|
@cmd_queue = MultiTkIp::Command_Queue.new(@interp)
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2004-09-08 02:23:41 -04:00
|
|
|
=begin
|
2004-09-02 13:17:20 -04:00
|
|
|
@cmd_receiver, @receiver_watchdog = _create_receiver_and_watchdog(@safe_level[0])
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
@threadgroup.add @cmd_receiver
|
|
|
|
@threadgroup.add @receiver_watchdog
|
|
|
|
|
|
|
|
@threadgroup.enclose
|
2004-09-08 02:23:41 -04:00
|
|
|
=end
|
|
|
|
@@DEFAULT_MASTER.assign_receiver_and_watchdog(self)
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
@@IP_TABLE[@threadgroup] = self
|
2009-03-05 22:56:38 -05:00
|
|
|
@@TK_TABLE_LIST.size.times{
|
2009-07-12 19:08:32 -04:00
|
|
|
@tk_table_list << TkUtil.untrust({})
|
2003-09-07 03:10:44 -04:00
|
|
|
}
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
_init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2004-09-08 02:23:41 -04:00
|
|
|
class << self
|
|
|
|
undef :instance_eval
|
|
|
|
end
|
|
|
|
|
2005-03-02 02:06:52 -05:00
|
|
|
# dummy call for initialization
|
|
|
|
self.eval_proc{ Tk.tk_call('set', 'tcl_patchLevel') }
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
self.freeze # defend against modification
|
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
|
|
|
|
######################################
|
|
|
|
|
|
|
|
def _default_delete_hook(slave)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2005-03-02 02:06:52 -05:00
|
|
|
@slave_ip_tbl.delete(slave)
|
|
|
|
top = @slave_ip_top.delete(slave)
|
|
|
|
if top.kind_of?(String)
|
2004-05-01 12:09:54 -04:00
|
|
|
# call default hook of safetk.tcl (ignore exceptions)
|
2005-03-02 02:06:52 -05:00
|
|
|
if top == ''
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
@interp._eval("::safe::disallowTk #{slave}")
|
|
|
|
rescue
|
|
|
|
warn("Waring: fail to call '::safe::disallowTk'") if $DEBUG
|
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
else # toplevel path
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
2005-03-02 02:06:52 -05:00
|
|
|
@interp._eval("::safe::tkDelete {} #{top} #{slave}")
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue
|
|
|
|
warn("Waring: fail to call '::safe::tkDelete'") if $DEBUG
|
|
|
|
begin
|
2005-03-02 02:06:52 -05:00
|
|
|
@interp._eval("destroy #{top}")
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue
|
|
|
|
warn("Waring: fail to destroy toplevel") if $DEBUG
|
|
|
|
end
|
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# get target IP
|
|
|
|
class MultiTkIp
|
2009-07-12 19:08:32 -04:00
|
|
|
@@CALLBACK_SUBTHREAD = Class.new(Thread){
|
|
|
|
def self.new(interp, &blk)
|
|
|
|
super(interp){|ip| Thread.current[:callback_ip] = ip; blk.call}
|
|
|
|
end
|
|
|
|
|
|
|
|
@table = TkUtil.untrust(Hash.new{|h,k| h[k] = TkUtil.untrust([])})
|
|
|
|
def self.table
|
|
|
|
@table
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
def self._ip_id_
|
|
|
|
__getip._ip_id_
|
|
|
|
end
|
|
|
|
def _ip_id_
|
2005-11-18 03:39:29 -05:00
|
|
|
# for RemoteTkIp
|
2004-05-21 16:45:27 -04:00
|
|
|
''
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
def self.__getip
|
2005-03-02 02:06:52 -05:00
|
|
|
current = Thread.current
|
2009-07-12 19:08:32 -04:00
|
|
|
if current.kind_of?(@@CALLBACK_SUBTHREAD)
|
|
|
|
return current[:callback_ip]
|
|
|
|
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
|
|
|
if TclTkLib.mainloop_thread? != false && current[:callback_ip]
|
|
|
|
return current[:callback_ip]
|
2005-03-02 02:06:52 -05:00
|
|
|
end
|
|
|
|
if current.group == ThreadGroup::Default
|
2003-07-27 15:35:06 -04:00
|
|
|
@@DEFAULT_MASTER
|
|
|
|
else
|
2005-03-02 02:06:52 -05:00
|
|
|
ip = @@IP_TABLE[current.group]
|
2003-07-27 15:35:06 -04:00
|
|
|
unless ip
|
2009-03-05 22:56:38 -05:00
|
|
|
fail SecurityError,
|
2004-10-11 00:51:21 -04:00
|
|
|
"cannot call Tk methods on #{Thread.current.inspect}"
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
ip
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# aliases of constructor
|
|
|
|
class << MultiTkIp
|
|
|
|
alias __new new
|
|
|
|
private :__new
|
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
def new_master(safe=nil, keys={}, &blk)
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
if MultiTkIp::WITH_RUBY_VM
|
|
|
|
#### TODO !!!!!!
|
2009-03-05 22:56:38 -05:00
|
|
|
fail RuntimeError,
|
2009-07-12 19:08:32 -04:00
|
|
|
'sorry, still not support multiple master-interpreters on RubyVM'
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
end
|
|
|
|
|
2004-09-13 03:25:02 -04:00
|
|
|
if safe.kind_of?(Hash)
|
|
|
|
keys = safe
|
|
|
|
elsif safe.kind_of?(Integer)
|
|
|
|
raise ArgumentError, "unexpected argument(s)" unless keys.kind_of?(Hash)
|
|
|
|
if !keys.key?(:safe) && !keys.key?('safe')
|
2004-10-11 00:51:21 -04:00
|
|
|
keys[:safe] = safe
|
2004-09-13 03:25:02 -04:00
|
|
|
end
|
|
|
|
elsif safe == nil
|
|
|
|
# do nothing
|
|
|
|
else
|
|
|
|
raise ArgumentError, "unexpected argument(s)"
|
|
|
|
end
|
|
|
|
|
2003-07-30 03:23:14 -04:00
|
|
|
ip = __new(__getip, nil, keys)
|
2005-07-21 18:05:04 -04:00
|
|
|
#ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
|
2009-07-12 19:08:32 -04:00
|
|
|
if block_given?
|
|
|
|
#Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)}
|
|
|
|
#Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; yield}.call)}
|
|
|
|
ip._proc_on_safelevel(&blk).call(ip.safe_level)
|
|
|
|
end
|
2003-07-30 03:23:14 -04:00
|
|
|
ip
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
alias new new_master
|
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
def new_slave(safe=nil, keys={}, &blk)
|
2004-09-13 03:25:02 -04:00
|
|
|
if safe.kind_of?(Hash)
|
|
|
|
keys = safe
|
|
|
|
elsif safe.kind_of?(Integer)
|
|
|
|
raise ArgumentError, "unexpected argument(s)" unless keys.kind_of?(Hash)
|
|
|
|
if !keys.key?(:safe) && !keys.key?('safe')
|
2004-10-11 00:51:21 -04:00
|
|
|
keys[:safe] = safe
|
2004-09-13 03:25:02 -04:00
|
|
|
end
|
|
|
|
elsif safe == nil
|
|
|
|
# do nothing
|
|
|
|
else
|
|
|
|
raise ArgumentError, "unexpected argument(s)"
|
|
|
|
end
|
|
|
|
|
2003-07-30 03:23:14 -04:00
|
|
|
ip = __new(__getip, false, keys)
|
2005-07-21 18:05:04 -04:00
|
|
|
# ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
|
|
|
|
if block_given?
|
2009-07-12 19:08:32 -04:00
|
|
|
#Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)}
|
|
|
|
#Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; yield}.call)}
|
|
|
|
ip._proc_on_safelevel(&blk).call(ip.safe_level)
|
2005-07-21 18:05:04 -04:00
|
|
|
end
|
2003-07-30 03:23:14 -04:00
|
|
|
ip
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
2004-05-21 16:45:27 -04:00
|
|
|
alias new_trusted_slave new_slave
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
def new_safe_slave(safe=4, keys={}, &blk)
|
2004-09-08 02:23:41 -04:00
|
|
|
if safe.kind_of?(Hash)
|
|
|
|
keys = safe
|
|
|
|
elsif safe.kind_of?(Integer)
|
|
|
|
raise ArgumentError, "unexpected argument(s)" unless keys.kind_of?(Hash)
|
|
|
|
if !keys.key?(:safe) && !keys.key?('safe')
|
2004-10-11 00:51:21 -04:00
|
|
|
keys[:safe] = safe
|
2004-09-08 02:23:41 -04:00
|
|
|
end
|
|
|
|
else
|
|
|
|
raise ArgumentError, "unexpected argument(s)"
|
|
|
|
end
|
|
|
|
|
2003-07-30 03:23:14 -04:00
|
|
|
ip = __new(__getip, true, keys)
|
2005-07-21 18:05:04 -04:00
|
|
|
# ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given?
|
|
|
|
if block_given?
|
2009-07-12 19:08:32 -04:00
|
|
|
#Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)}
|
|
|
|
#Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; yield}.call)}
|
|
|
|
ip._proc_on_safelevel(&blk).call(ip.safe_level)
|
2005-07-21 18:05:04 -04:00
|
|
|
end
|
2003-07-30 03:23:14 -04:00
|
|
|
ip
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
alias new_safeTk new_safe_slave
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# get info
|
|
|
|
class MultiTkIp
|
|
|
|
def inspect
|
|
|
|
s = self.to_s.chop!
|
2005-11-18 03:39:29 -05:00
|
|
|
if self.manipulable?
|
|
|
|
if master?
|
|
|
|
if @interp.deleted?
|
|
|
|
s << ':deleted-master'
|
|
|
|
else
|
|
|
|
s << ':master'
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
else
|
2005-11-18 03:39:29 -05:00
|
|
|
if @interp.deleted?
|
|
|
|
s << ':deleted-slave'
|
|
|
|
elsif @interp.safe?
|
|
|
|
s << ':safe-slave'
|
|
|
|
else
|
|
|
|
s << ':trusted-slave'
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
s << '>'
|
|
|
|
end
|
|
|
|
|
|
|
|
def master?
|
|
|
|
if @ip_name
|
|
|
|
false
|
|
|
|
else
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
2003-07-28 02:10:13 -04:00
|
|
|
def self.master?
|
|
|
|
__getip.master?
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
def slave?
|
|
|
|
not master?
|
|
|
|
end
|
2003-07-28 02:10:13 -04:00
|
|
|
def self.slave?
|
2004-09-08 02:23:41 -04:00
|
|
|
not self.master?
|
2003-07-28 02:10:13 -04:00
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
def alive?
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
begin
|
|
|
|
return false unless @cmd_receiver.alive?
|
|
|
|
return false if @interp.deleted?
|
|
|
|
return false if @interp._invoke('interp', 'exists', '') == '0'
|
|
|
|
rescue Exception
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
true
|
|
|
|
end
|
|
|
|
def self.alive?
|
|
|
|
__getip.alive?
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def path
|
2003-07-28 02:10:13 -04:00
|
|
|
@ip_name || ''
|
|
|
|
end
|
|
|
|
def self.path
|
|
|
|
__getip.path
|
|
|
|
end
|
|
|
|
def ip_name
|
|
|
|
@ip_name || ''
|
|
|
|
end
|
|
|
|
def self.ip_name
|
|
|
|
__getip.ip_name
|
|
|
|
end
|
|
|
|
def to_eval
|
|
|
|
@ip_name || ''
|
|
|
|
end
|
|
|
|
def self.to_eval
|
|
|
|
__getip.to_eval
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def slaves(all = false)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2009-03-05 22:56:38 -05:00
|
|
|
@interp._invoke('interp','slaves').split.map!{|name|
|
2003-07-27 15:35:06 -04:00
|
|
|
if @slave_ip_tbl.key?(name)
|
2004-10-11 00:51:21 -04:00
|
|
|
@slave_ip_tbl[name]
|
2003-07-27 15:35:06 -04:00
|
|
|
elsif all
|
2004-10-11 00:51:21 -04:00
|
|
|
name
|
2003-07-27 15:35:06 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
nil
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
}.compact!
|
|
|
|
end
|
2003-07-28 02:10:13 -04:00
|
|
|
def self.slaves(all = false)
|
|
|
|
__getip.slaves(all)
|
|
|
|
end
|
2005-11-18 03:39:29 -05:00
|
|
|
|
|
|
|
def manipulable?
|
|
|
|
return true if (Thread.current.group == ThreadGroup::Default)
|
|
|
|
ip = MultiTkIp.__getip
|
|
|
|
(ip == self) || ip._is_master_of?(@interp)
|
|
|
|
end
|
|
|
|
def self.manipulable?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def _is_master_of?(tcltkip_obj)
|
|
|
|
tcltkip_obj.slave_of?(@interp)
|
|
|
|
end
|
|
|
|
protected :_is_master_of?
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# instance methods to treat tables
|
|
|
|
class MultiTkIp
|
|
|
|
def _tk_cmd_tbl
|
2003-08-29 04:34:14 -04:00
|
|
|
tbl = {}
|
|
|
|
MultiTkIp.tk_cmd_tbl.each{|id, ent| tbl[id] = ent if ent.ip == self }
|
|
|
|
tbl
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def _tk_windows
|
|
|
|
@tk_windows
|
|
|
|
end
|
|
|
|
|
|
|
|
def _tk_table_list
|
|
|
|
@tk_table_list
|
|
|
|
end
|
|
|
|
|
2003-08-29 04:34:14 -04:00
|
|
|
def _add_new_tables
|
2009-03-05 22:56:38 -05:00
|
|
|
(@@TK_TABLE_LIST.size - @tk_table_list.size).times{
|
2009-07-12 19:08:32 -04:00
|
|
|
@tk_table_list << TkUtil.untrust({})
|
2003-09-07 03:10:44 -04:00
|
|
|
}
|
2003-08-29 04:34:14 -04:00
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
def _init_ip_env(script)
|
2006-06-18 11:05:01 -04:00
|
|
|
self.eval_proc{script.call(self)}
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def _add_tk_procs(name, args, body)
|
|
|
|
return if slave?
|
|
|
|
@interp._invoke('proc', name, args, body) if args && body
|
|
|
|
@interp._invoke('interp', 'slaves').split.each{|slave|
|
|
|
|
@interp._invoke('interp', 'alias', slave, name, '', name)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2006-07-10 05:52:30 -04:00
|
|
|
def _remove_tk_procs(*names)
|
|
|
|
return if slave?
|
|
|
|
names.each{|name|
|
|
|
|
name = name.to_s
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
|
|
|
|
return if @interp.deleted?
|
2006-07-10 05:52:30 -04:00
|
|
|
@interp._invoke('rename', name, '')
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
|
|
|
|
return if @interp.deleted?
|
2006-07-10 05:52:30 -04:00
|
|
|
@interp._invoke('interp', 'slaves').split.each{|slave|
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
return if @interp.deleted?
|
2006-07-10 05:52:30 -04:00
|
|
|
@interp._invoke('interp', 'alias', slave, name, '') rescue nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
def _init_ip_internal(init_ip_env, add_tk_procs)
|
2006-06-18 11:05:01 -04:00
|
|
|
#init_ip_env.each{|script| self.eval_proc{script.call(self)}}
|
|
|
|
init_ip_env.each{|script| self._init_ip_env(script)}
|
2009-03-05 22:56:38 -05:00
|
|
|
add_tk_procs.each{|name, args, body|
|
2003-07-27 15:35:06 -04:00
|
|
|
if master?
|
2004-10-11 00:51:21 -04:00
|
|
|
@interp._invoke('proc', name, args, body) if args && body
|
2003-07-27 15:35:06 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
@set_alias_proc.call(name)
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# class methods to treat tables
|
|
|
|
class MultiTkIp
|
|
|
|
def self.tk_cmd_tbl
|
|
|
|
@@TK_CMD_TBL
|
|
|
|
end
|
|
|
|
def self.tk_windows
|
|
|
|
__getip._tk_windows
|
|
|
|
end
|
|
|
|
def self.tk_object_table(id)
|
|
|
|
__getip._tk_table_list[id]
|
|
|
|
end
|
|
|
|
def self.create_table
|
2009-03-05 22:56:38 -05:00
|
|
|
if __getip.slave?
|
2006-07-10 05:52:30 -04:00
|
|
|
begin
|
|
|
|
raise SecurityError, "slave-IP has no permission creating a new table"
|
|
|
|
rescue SecurityError => e
|
|
|
|
#p e.backtrace
|
|
|
|
# Is called on a Ruby/Tk library?
|
|
|
|
caller_info = e.backtrace[1]
|
|
|
|
if caller_info =~ %r{^#{MultiTkIp::BASE_DIR}/(tk|tkextlib)/[^:]+\.rb:}
|
|
|
|
# Probably, caller is a Ruby/Tk library --> allow creating
|
|
|
|
else
|
|
|
|
raise e
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
id = @@TK_TABLE_LIST.size
|
|
|
|
obj = Object.new
|
|
|
|
@@TK_TABLE_LIST << obj
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
obj.instance_variable_set(:@id, id)
|
|
|
|
obj.instance_variable_set(:@mutex, Mutex.new)
|
|
|
|
obj.instance_eval{
|
|
|
|
def self.mutex
|
|
|
|
@mutex
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
def self.method_missing(m, *args)
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
MultiTkIp.tk_object_table(@id).__send__(m, *args)
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
}
|
2003-07-27 15:35:06 -04:00
|
|
|
obj.freeze
|
2003-08-29 04:34:14 -04:00
|
|
|
@@IP_TABLE.each{|tg, ip| ip._add_new_tables }
|
2003-07-27 15:35:06 -04:00
|
|
|
return obj
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.init_ip_env(script = Proc.new)
|
|
|
|
@@INIT_IP_ENV << script
|
2006-07-10 05:52:30 -04:00
|
|
|
if __getip.slave?
|
|
|
|
begin
|
|
|
|
raise SecurityError, "slave-IP has no permission initializing IP env"
|
|
|
|
rescue SecurityError => e
|
|
|
|
#p e.backtrace
|
|
|
|
# Is called on a Ruby/Tk library?
|
|
|
|
caller_info = e.backtrace[1]
|
|
|
|
if caller_info =~ %r{^#{MultiTkIp::BASE_DIR}/(tk|tkextlib)/[^:]+\.rb:}
|
|
|
|
# Probably, caller is a Ruby/Tk library --> allow creating
|
|
|
|
else
|
|
|
|
raise e
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
# @@IP_TABLE.each{|tg, ip|
|
2006-07-10 05:52:30 -04:00
|
|
|
# ip._init_ip_env(script)
|
|
|
|
# }
|
|
|
|
@@DEFAULT_MASTER.__init_ip_env__(@@IP_TABLE, script)
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.add_tk_procs(name, args=nil, body=nil)
|
2006-07-10 05:52:30 -04:00
|
|
|
if name.kind_of?(Array) # => an array of [name, args, body]
|
|
|
|
name.each{|param| self.add_tk_procs(*param)}
|
|
|
|
else
|
|
|
|
name = name.to_s
|
|
|
|
@@ADD_TK_PROCS << [name, args, body]
|
2009-03-05 22:56:38 -05:00
|
|
|
@@IP_TABLE.each{|tg, ip|
|
2006-07-10 05:52:30 -04:00
|
|
|
ip._add_tk_procs(name, args, body)
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.remove_tk_procs(*names)
|
|
|
|
names.each{|name|
|
|
|
|
name = name.to_s
|
2009-03-05 22:56:38 -05:00
|
|
|
@@ADD_TK_PROCS.delete_if{|elem|
|
2006-07-10 05:52:30 -04:00
|
|
|
elem.kind_of?(Array) && elem[0].to_s == name
|
|
|
|
}
|
|
|
|
}
|
2009-03-05 22:56:38 -05:00
|
|
|
@@IP_TABLE.each{|tg, ip|
|
2006-07-10 05:52:30 -04:00
|
|
|
ip._remove_tk_procs(*names)
|
2003-07-27 15:35:06 -04:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.init_ip_internal
|
|
|
|
__getip._init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# for callback operation
|
|
|
|
class MultiTkIp
|
2004-12-16 02:13:14 -05:00
|
|
|
def self.cb_entry_class
|
|
|
|
@@CB_ENTRY_CLASS
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
def self.get_cb_entry(cmd)
|
|
|
|
@@CB_ENTRY_CLASS.new(__getip, cmd).freeze
|
|
|
|
end
|
|
|
|
|
2006-07-03 06:08:11 -04:00
|
|
|
=begin
|
2003-07-27 15:35:06 -04:00
|
|
|
def cb_eval(cmd, *args)
|
2004-09-08 02:23:41 -04:00
|
|
|
#self.eval_callback{ TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *args)) }
|
2004-09-14 04:01:55 -04:00
|
|
|
#ret = self.eval_callback{ TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *args)) }
|
|
|
|
ret = self.eval_callback(*args){|safe, *params|
|
2005-06-06 21:33:12 -04:00
|
|
|
$SAFE=safe if $SAFE < safe
|
2005-03-02 02:06:52 -05:00
|
|
|
TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params))
|
2004-09-14 04:01:55 -04:00
|
|
|
}
|
2004-09-08 02:23:41 -04:00
|
|
|
if ret.kind_of?(Exception)
|
2005-03-02 02:06:52 -05:00
|
|
|
raise ret
|
2004-09-08 02:23:41 -04:00
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
ret
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
2006-07-03 06:08:11 -04:00
|
|
|
=end
|
2009-07-12 19:08:32 -04:00
|
|
|
def cb_eval(cmd, *args)
|
|
|
|
self.eval_callback(*args,
|
|
|
|
&_proc_on_safelevel{|*params|
|
|
|
|
TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params))
|
|
|
|
})
|
|
|
|
end
|
|
|
|
=begin
|
2006-07-03 06:08:11 -04:00
|
|
|
def cb_eval(cmd, *args)
|
|
|
|
self.eval_callback(*args){|safe, *params|
|
|
|
|
$SAFE=safe if $SAFE < safe
|
|
|
|
# TkUtil.eval_cmd(cmd, *params)
|
|
|
|
TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params))
|
|
|
|
}
|
|
|
|
end
|
2009-07-12 19:08:32 -04:00
|
|
|
=end
|
2006-07-03 06:08:11 -04:00
|
|
|
=begin
|
|
|
|
def cb_eval(cmd, *args)
|
|
|
|
@callback_status[0] ||= TkVariable.new
|
|
|
|
@callback_status[1] ||= TkVariable.new
|
|
|
|
st, val = @callback_status
|
|
|
|
th = Thread.new{
|
|
|
|
self.eval_callback(*args){|safe, *params|
|
|
|
|
#p [status, val, safe, *params]
|
|
|
|
$SAFE=safe if $SAFE < safe
|
|
|
|
begin
|
|
|
|
TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params))
|
|
|
|
rescue TkCallbackContinue
|
|
|
|
st.value = 4
|
|
|
|
rescue TkCallbackBreak
|
|
|
|
st.value = 3
|
|
|
|
rescue TkCallbackReturn
|
|
|
|
st.value = 2
|
|
|
|
rescue Exception => e
|
|
|
|
val.value = e.message
|
|
|
|
st.value = 1
|
|
|
|
else
|
|
|
|
st.value = 0
|
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
begin
|
|
|
|
st.wait
|
|
|
|
status = st.numeric
|
|
|
|
retval = val.value
|
|
|
|
rescue => e
|
|
|
|
fail e
|
|
|
|
end
|
|
|
|
|
|
|
|
if status == 1
|
|
|
|
fail RuntimeError, retval
|
|
|
|
elsif status == 2
|
|
|
|
fail TkCallbackReturn, "Tk callback returns 'return' status"
|
|
|
|
elsif status == 3
|
|
|
|
fail TkCallbackBreak, "Tk callback returns 'break' status"
|
|
|
|
elsif status == 4
|
|
|
|
fail TkCallbackContinue, "Tk callback returns 'continue' status"
|
|
|
|
else
|
|
|
|
''
|
|
|
|
end
|
|
|
|
end
|
|
|
|
=end
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2006-07-03 06:08:11 -04:00
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2006-07-10 05:52:30 -04:00
|
|
|
# pseudo-toplevel operation support
|
|
|
|
class MultiTkIp
|
|
|
|
# instance method
|
|
|
|
def __pseudo_toplevel
|
2006-07-11 05:04:00 -04:00
|
|
|
ip = MultiTkIp.__getip
|
|
|
|
(ip == @@DEFAULT_MASTER || ip == self) &&
|
|
|
|
self.__pseudo_toplevel_evaluable? && @pseudo_toplevel[1]
|
2006-07-10 05:52:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def __pseudo_toplevel=(m)
|
2009-03-05 22:56:38 -05:00
|
|
|
unless (Thread.current.group == ThreadGroup::Default &&
|
2006-07-10 05:52:30 -04:00
|
|
|
MultiTkIp.__getip == @@DEFAULT_MASTER)
|
|
|
|
fail SecurityError, "no permission to manipulate"
|
|
|
|
end
|
|
|
|
|
2006-07-11 06:15:47 -04:00
|
|
|
# if m.kind_of?(Module) && m.respond_to?(:pseudo_toplevel_evaluable?)
|
|
|
|
if m.respond_to?(:pseudo_toplevel_evaluable?)
|
2006-07-10 05:52:30 -04:00
|
|
|
@pseudo_toplevel[0] = true
|
|
|
|
@pseudo_toplevel[1] = m
|
|
|
|
else
|
|
|
|
fail ArgumentError, 'fail to set pseudo-toplevel'
|
|
|
|
end
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def __pseudo_toplevel_evaluable?
|
|
|
|
begin
|
|
|
|
@pseudo_toplevel[0] && @pseudo_toplevel[1].pseudo_toplevel_evaluable?
|
|
|
|
rescue Exception
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def __pseudo_toplevel_evaluable=(mode)
|
2009-03-05 22:56:38 -05:00
|
|
|
unless (Thread.current.group == ThreadGroup::Default &&
|
2006-07-10 05:52:30 -04:00
|
|
|
MultiTkIp.__getip == @@DEFAULT_MASTER)
|
|
|
|
fail SecurityError, "no permission to manipulate"
|
|
|
|
end
|
|
|
|
|
|
|
|
@pseudo_toplevel[0] = (mode)? true: false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
# evaluate a procedure on the proper interpreter
|
|
|
|
class MultiTkIp
|
2009-07-12 19:08:32 -04:00
|
|
|
# instance & class method
|
|
|
|
def _proc_on_safelevel(cmd=nil, &blk) # require a block for eval
|
|
|
|
if cmd
|
|
|
|
if cmd.kind_of?(Method)
|
|
|
|
_proc_on_safelevel{|*args| cmd.call(*args)}
|
|
|
|
else
|
|
|
|
_proc_on_safelevel(&cmd)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
#Proc.new{|safe, *args| $SAFE=safe if $SAFE < safe; yield(*args)}
|
|
|
|
Proc.new{|safe, *args|
|
|
|
|
# avoid security error on Exception objects
|
|
|
|
untrust_proc = proc{|err|
|
|
|
|
begin
|
|
|
|
err.untrust if err.respond_to?(:untrust)
|
|
|
|
rescue SecurityError
|
|
|
|
end
|
|
|
|
err
|
|
|
|
}
|
|
|
|
$SAFE=safe if $SAFE < safe;
|
|
|
|
begin
|
|
|
|
yield(*args)
|
|
|
|
rescue Exception => e
|
|
|
|
fail untrust_proc.call(e)
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def MultiTkIp._proc_on_safelevel(cmd=nil, &blk)
|
|
|
|
MultiTkIp.__getip._proc_on_safelevel(cmd, &blk)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _proc_on_current_safelevel(cmd=nil, &blk) # require a block for eval
|
|
|
|
safe = $SAFE
|
|
|
|
cmd = _proc_on_safelevel(cmd, &blk)
|
|
|
|
Proc.new{|*args| cmd.call(safe, *args)}
|
|
|
|
end
|
|
|
|
def MultiTkIp._proc_on_current_safelevel(cmd=nil, &blk)
|
|
|
|
MultiTkIp.__getip._proc_on_current_safelevel(cmd, &blk)
|
|
|
|
end
|
|
|
|
|
|
|
|
######################################
|
2003-07-27 15:35:06 -04:00
|
|
|
# instance method
|
2003-08-29 04:34:14 -04:00
|
|
|
def eval_proc_core(req_val, cmd, *args)
|
|
|
|
# check
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-09-02 13:17:20 -04:00
|
|
|
unless cmd.kind_of?(Proc) || cmd.kind_of?(Method)
|
2004-09-08 02:23:41 -04:00
|
|
|
raise RuntimeError, "A Proc/Method object is expected for the 'cmd' argument"
|
2003-08-29 04:34:14 -04:00
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
# on IP thread
|
2009-03-05 22:56:38 -05:00
|
|
|
if @cmd_receiver == Thread.current ||
|
2005-03-02 02:06:52 -05:00
|
|
|
(!req_val && TclTkLib.mainloop_thread? != false) # callback
|
2003-08-29 04:34:14 -04:00
|
|
|
begin
|
2005-07-25 01:11:19 -04:00
|
|
|
ret = cmd.call(safe_level, *args)
|
2005-03-02 02:06:52 -05:00
|
|
|
rescue SystemExit => e
|
2004-10-11 00:51:21 -04:00
|
|
|
# exit IP
|
2009-07-12 19:08:32 -04:00
|
|
|
warn("Warning: "+ e.inspect + " on " + self.inspect) if $DEBUG
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
self._eval_without_enc('exit')
|
2009-07-12 19:08:32 -04:00
|
|
|
rescue Exception => e
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
self.delete
|
|
|
|
ret = nil
|
2003-08-29 04:34:14 -04:00
|
|
|
rescue Exception => e
|
2004-10-11 00:51:21 -04:00
|
|
|
if $DEBUG
|
2009-03-05 22:56:38 -05:00
|
|
|
warn("Warning: " + e.class.inspect +
|
|
|
|
((e.message.length > 0)? ' "' + e.message + '"': '') +
|
2004-10-11 00:51:21 -04:00
|
|
|
" on " + self.inspect)
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
=begin
|
|
|
|
begin
|
|
|
|
bt = _toUTF8(e.backtrace.join("\n"))
|
|
|
|
bt.instance_variable_set(:@encoding, 'utf-8')
|
|
|
|
rescue Exception
|
|
|
|
bt = e.backtrace.join("\n")
|
|
|
|
end
|
|
|
|
begin
|
|
|
|
@interp._set_global_var('errorInfo', bt)
|
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
=end
|
2004-10-11 00:51:21 -04:00
|
|
|
ret = e
|
2003-08-29 04:34:14 -04:00
|
|
|
end
|
|
|
|
return ret
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
2004-09-08 02:23:41 -04:00
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
# send cmd to the proc-queue
|
2003-08-29 04:34:14 -04:00
|
|
|
unless req_val
|
2004-09-17 02:05:33 -04:00
|
|
|
begin
|
2004-10-11 00:51:21 -04:00
|
|
|
@cmd_queue.enq([nil, cmd, *args])
|
2004-09-17 02:05:33 -04:00
|
|
|
rescue Exception => e
|
2004-10-11 00:51:21 -04:00
|
|
|
# ignore
|
2004-12-27 06:04:21 -05:00
|
|
|
if $DEBUG
|
2009-03-05 22:56:38 -05:00
|
|
|
warn("Warning: " + e.class.inspect +
|
|
|
|
((e.message.length > 0)? ' "' + e.message + '"': '') +
|
|
|
|
" on " + self.inspect)
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
return e
|
2004-09-17 02:05:33 -04:00
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
return nil
|
|
|
|
end
|
|
|
|
|
2003-08-29 04:34:14 -04:00
|
|
|
# send and get return value by exception
|
2003-07-27 15:35:06 -04:00
|
|
|
begin
|
2003-08-29 04:34:14 -04:00
|
|
|
@cmd_queue.enq([Thread.current, cmd, *args])
|
2003-07-27 15:35:06 -04:00
|
|
|
Thread.stop
|
|
|
|
rescue MultiTkIp_OK => ret
|
|
|
|
# return value
|
|
|
|
return ret.value
|
2004-09-29 11:54:32 -04:00
|
|
|
rescue SystemExit => e
|
2003-08-29 04:34:14 -04:00
|
|
|
# exit IP
|
2009-07-12 19:08:32 -04:00
|
|
|
warn("Warning: " + e.inspect + " on " + self.inspect) if $DEBUG
|
2004-05-01 12:09:54 -04:00
|
|
|
begin
|
2004-10-11 00:51:21 -04:00
|
|
|
self._eval_without_enc('exit')
|
2004-05-01 12:09:54 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
if !self.deleted? && !safe? && allow_ruby_exit?
|
2004-10-11 00:51:21 -04:00
|
|
|
self.delete
|
|
|
|
fail e
|
2004-09-29 11:54:32 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
self.delete
|
2004-09-29 11:54:32 -04:00
|
|
|
end
|
2003-08-29 04:34:14 -04:00
|
|
|
rescue Exception => e
|
2004-09-08 02:23:41 -04:00
|
|
|
if $DEBUG
|
2009-03-05 22:56:38 -05:00
|
|
|
warn("Warning: " + e.class.inspect +
|
|
|
|
((e.message.length > 0)? ' "' + e.message + '"': '') +
|
|
|
|
" on " + self.inspect)
|
2004-09-08 02:23:41 -04:00
|
|
|
end
|
|
|
|
return e
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
2003-08-29 04:34:14 -04:00
|
|
|
return nil
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
private :eval_proc_core
|
|
|
|
|
2009-07-13 20:28:31 -04:00
|
|
|
if false && WITH_RUBY_VM ### Ruby 1.9
|
|
|
|
# Not stable, so disable this feature
|
2009-07-12 19:08:32 -04:00
|
|
|
def eval_callback(*args)
|
|
|
|
if block_given?
|
|
|
|
cmd = Proc.new
|
|
|
|
else
|
|
|
|
cmd = args.shift
|
|
|
|
end
|
|
|
|
begin
|
|
|
|
if @@CALLBACK_SUBTHREAD.table[self].index(Thread.current)
|
|
|
|
last_th = nil
|
|
|
|
else
|
|
|
|
last_th = @@CALLBACK_SUBTHREAD.table[self][-1]
|
|
|
|
end
|
|
|
|
@@CALLBACK_SUBTHREAD.new(self){
|
|
|
|
@@CALLBACK_SUBTHREAD.table[self] << Thread.current
|
|
|
|
begin
|
|
|
|
last_th.join if last_th
|
|
|
|
eval_proc_core(false, cmd, *args)
|
|
|
|
rescue Exception=>e
|
|
|
|
e
|
|
|
|
ensure
|
|
|
|
@@CALLBACK_SUBTHREAD.table[self].delete(Thread.current)
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else ### Ruby 1.8
|
2005-03-02 02:06:52 -05:00
|
|
|
def eval_callback(*args)
|
|
|
|
if block_given?
|
|
|
|
cmd = Proc.new
|
|
|
|
else
|
|
|
|
cmd = args.shift
|
|
|
|
end
|
|
|
|
begin
|
|
|
|
eval_proc_core(false, cmd, *args)
|
2009-07-12 19:08:32 -04:00
|
|
|
rescue Exception=>e
|
|
|
|
e
|
2005-03-02 02:06:52 -05:00
|
|
|
ensure
|
2004-09-14 04:01:55 -04:00
|
|
|
end
|
|
|
|
end
|
2009-07-12 19:08:32 -04:00
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
|
2009-07-12 19:08:32 -04:00
|
|
|
def eval_proc(*args, &blk)
|
|
|
|
if block_given?
|
|
|
|
cmd = _proc_on_safelevel(&blk)
|
|
|
|
else
|
|
|
|
unless (cmd = args.shift)
|
|
|
|
fail ArgumentError, "A Proc or Method object is expected for 1st argument"
|
|
|
|
end
|
|
|
|
cmd = _proc_on_safelevel(&cmd)
|
|
|
|
end
|
|
|
|
if TclTkLib.mainloop_thread? == true
|
|
|
|
# call from eventloop
|
|
|
|
current = Thread.current
|
|
|
|
backup_ip = current[:callback_ip]
|
|
|
|
current[:callback_ip] = self
|
|
|
|
begin
|
|
|
|
eval_proc_core(false, cmd, *args)
|
|
|
|
ensure
|
|
|
|
current[:callback_ip] = backup_ip
|
|
|
|
end
|
|
|
|
else
|
|
|
|
eval_proc_core(true,
|
|
|
|
proc{|safe, *params|
|
|
|
|
Thread.new{cmd.call(safe, *params)}.value
|
|
|
|
},
|
|
|
|
*args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
=begin
|
2004-09-14 04:01:55 -04:00
|
|
|
def eval_proc(*args)
|
2009-03-05 22:56:38 -05:00
|
|
|
# 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,
|
2004-09-17 02:05:33 -04:00
|
|
|
# use arguments of eval_proc method. They are passed to block-arguments.
|
2004-09-14 04:01:55 -04:00
|
|
|
if block_given?
|
|
|
|
cmd = Proc.new
|
|
|
|
else
|
|
|
|
unless (cmd = args.shift)
|
2004-10-11 00:51:21 -04:00
|
|
|
fail ArgumentError, "A Proc or Method object is expected for 1st argument"
|
2004-09-14 04:01:55 -04:00
|
|
|
end
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
if TclTkLib.mainloop_thread? == true
|
|
|
|
# call from eventloop
|
|
|
|
current = Thread.current
|
* 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
|
|
|
backup_ip = current[:callback_ip]
|
|
|
|
current[:callback_ip] = self
|
2005-03-02 02:06:52 -05:00
|
|
|
begin
|
2009-03-05 22:56:38 -05:00
|
|
|
eval_proc_core(false,
|
2005-07-21 18:05:04 -04:00
|
|
|
proc{|safe, *params|
|
|
|
|
$SAFE=safe if $SAFE < safe
|
|
|
|
cmd.call(*params)
|
2005-07-25 01:11:19 -04:00
|
|
|
}, *args)
|
2005-03-02 02:06:52 -05:00
|
|
|
ensure
|
* 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
|
|
|
current[:callback_ip] = backup_ip
|
2005-03-02 02:06:52 -05:00
|
|
|
end
|
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
eval_proc_core(true,
|
|
|
|
proc{|safe, *params|
|
2005-06-06 21:33:12 -04:00
|
|
|
$SAFE=safe if $SAFE < safe
|
2005-03-02 02:06:52 -05:00
|
|
|
Thread.new(*params, &cmd).value
|
|
|
|
},
|
2005-07-25 01:11:19 -04:00
|
|
|
*args)
|
2005-03-02 02:06:52 -05:00
|
|
|
end
|
2004-09-14 04:01:55 -04:00
|
|
|
end
|
2009-07-12 19:08:32 -04:00
|
|
|
=end
|
2003-07-27 15:35:06 -04:00
|
|
|
alias call eval_proc
|
2004-09-14 10:59:04 -04:00
|
|
|
|
2004-09-17 02:05:33 -04:00
|
|
|
def bg_eval_proc(*args)
|
|
|
|
if block_given?
|
|
|
|
cmd = Proc.new
|
|
|
|
else
|
|
|
|
unless (cmd = args.shift)
|
2004-10-11 00:51:21 -04:00
|
|
|
fail ArgumentError, "A Proc or Method object is expected for 1st argument"
|
2004-09-17 02:05:33 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
Thread.new{
|
2005-07-21 18:05:04 -04:00
|
|
|
eval_proc(cmd, *args)
|
|
|
|
=begin
|
2009-03-05 22:56:38 -05:00
|
|
|
eval_proc_core(false,
|
|
|
|
proc{|safe, *params|
|
2005-06-06 21:33:12 -04:00
|
|
|
$SAFE=safe if $SAFE < safe
|
|
|
|
Thread.new(*params, &cmd).value
|
2004-10-11 00:51:21 -04:00
|
|
|
},
|
2005-07-21 18:05:04 -04:00
|
|
|
safe_level, *args)
|
|
|
|
=end
|
2004-09-17 02:05:33 -04:00
|
|
|
}
|
|
|
|
end
|
|
|
|
alias background_eval_proc bg_eval_proc
|
2005-07-21 18:05:04 -04:00
|
|
|
alias thread_eval_proc bg_eval_proc
|
2004-09-17 02:05:33 -04:00
|
|
|
alias bg_call bg_eval_proc
|
|
|
|
alias background_call bg_eval_proc
|
|
|
|
|
2004-09-14 10:59:04 -04:00
|
|
|
def eval_string(cmd, *eval_args)
|
|
|
|
# cmd string ==> proc
|
|
|
|
unless cmd.kind_of?(String)
|
|
|
|
raise RuntimeError, "A String object is expected for the 'cmd' argument"
|
|
|
|
end
|
|
|
|
|
2009-03-05 22:56:38 -05:00
|
|
|
eval_proc_core(true,
|
|
|
|
proc{|safe|
|
2005-09-16 21:44:28 -04:00
|
|
|
Kernel.eval("$SAFE=#{safe} if $SAFE < #{safe};" << cmd,
|
|
|
|
*eval_args)
|
2005-07-28 05:14:59 -04:00
|
|
|
})
|
2004-09-14 10:59:04 -04:00
|
|
|
end
|
|
|
|
alias eval_str eval_string
|
2004-09-17 02:05:33 -04:00
|
|
|
|
2005-09-16 01:50:56 -04:00
|
|
|
def bg_eval_string(cmd, *eval_args)
|
2004-09-17 02:05:33 -04:00
|
|
|
# cmd string ==> proc
|
|
|
|
unless cmd.kind_of?(String)
|
|
|
|
raise RuntimeError, "A String object is expected for the 'cmd' argument"
|
|
|
|
end
|
|
|
|
Thread.new{
|
2009-03-05 22:56:38 -05:00
|
|
|
eval_proc_core(true,
|
|
|
|
proc{|safe|
|
2005-09-16 21:44:28 -04:00
|
|
|
Kernel.eval("$SAFE=#{safe} if $SAFE < #{safe};" << cmd,
|
|
|
|
*eval_args)
|
2005-07-28 05:14:59 -04:00
|
|
|
})
|
2004-09-17 02:05:33 -04:00
|
|
|
}
|
|
|
|
end
|
|
|
|
alias background_eval_string bg_eval_string
|
|
|
|
alias bg_eval_str bg_eval_string
|
|
|
|
alias background_eval_str bg_eval_string
|
2006-01-30 22:01:31 -05:00
|
|
|
|
|
|
|
def eval(*args, &blk)
|
|
|
|
if block_given?
|
|
|
|
eval_proc(*args, &blk)
|
|
|
|
elsif args[0]
|
|
|
|
if args[0].respond_to?(:call)
|
|
|
|
eval_proc(*args)
|
|
|
|
else
|
|
|
|
eval_string(*args)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
fail ArgumentError, "no argument to eval"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def bg_eval(*args, &blk)
|
|
|
|
if block_given?
|
|
|
|
bg_eval_proc(*args, &blk)
|
|
|
|
elsif args[0]
|
|
|
|
if args[0].respond_to?(:call)
|
|
|
|
bg_eval_proc(*args)
|
|
|
|
else
|
|
|
|
bg_eval_string(*args)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
fail ArgumentError, "no argument to eval"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
alias background_eval bg_eval
|
2003-08-29 04:34:14 -04:00
|
|
|
end
|
2004-09-14 04:01:55 -04:00
|
|
|
|
2003-08-29 04:34:14 -04:00
|
|
|
class << MultiTkIp
|
2003-07-27 15:35:06 -04:00
|
|
|
# class method
|
2004-09-14 04:01:55 -04:00
|
|
|
def eval_proc(*args, &blk)
|
|
|
|
# class ==> interp object
|
|
|
|
__getip.eval_proc(*args, &blk)
|
|
|
|
end
|
2003-08-29 04:34:14 -04:00
|
|
|
alias call eval_proc
|
2006-01-30 22:01:31 -05:00
|
|
|
|
|
|
|
def bg_eval_proc(*args, &blk)
|
|
|
|
# class ==> interp object
|
|
|
|
__getip.bg_eval_proc(*args, &blk)
|
|
|
|
end
|
|
|
|
alias background_eval_proc bg_eval_proc
|
|
|
|
alias thread_eval_proc bg_eval_proc
|
|
|
|
alias bg_call bg_eval_proc
|
|
|
|
alias background_call bg_eval_proc
|
|
|
|
|
|
|
|
def eval_string(cmd, *eval_args)
|
|
|
|
# class ==> interp object
|
|
|
|
__getip.eval_string(cmd, *eval_args)
|
|
|
|
end
|
|
|
|
alias eval_str eval_string
|
|
|
|
|
|
|
|
def bg_eval_string(cmd, *eval_args)
|
|
|
|
# class ==> interp object
|
|
|
|
__getip.bg_eval_string(cmd, *eval_args)
|
|
|
|
end
|
|
|
|
alias background_eval_string bg_eval_string
|
|
|
|
alias bg_eval_str bg_eval_string
|
|
|
|
alias background_eval_str bg_eval_string
|
|
|
|
|
|
|
|
def eval(*args, &blk)
|
|
|
|
# class ==> interp object
|
|
|
|
__getip.eval(*args, &blk)
|
|
|
|
end
|
|
|
|
def bg_eval(*args, &blk)
|
|
|
|
# class ==> interp object
|
|
|
|
__getip.bg_eval(*args, &blk)
|
|
|
|
end
|
|
|
|
alias background_eval bg_eval
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2003-08-29 04:34:14 -04:00
|
|
|
# event loop
|
2003-07-27 15:35:06 -04:00
|
|
|
# all master/slave IPs are controled by only one event-loop
|
2008-06-17 12:53:46 -04:00
|
|
|
class MultiTkIp
|
|
|
|
def self.default_master?
|
* 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
|
|
|
__getip == @@DEFAULT_MASTER
|
|
|
|
end
|
2008-06-17 12:53:46 -04:00
|
|
|
end
|
|
|
|
class << MultiTkIp
|
2003-07-27 15:35:06 -04:00
|
|
|
def mainloop(check_root = true)
|
2003-08-29 04:34:14 -04:00
|
|
|
__getip.mainloop(check_root)
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
def mainloop_watchdog(check_root = true)
|
2003-08-29 04:34:14 -04:00
|
|
|
__getip.mainloop_watchdog(check_root)
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
def do_one_event(flag = TclTkLib::EventFlag::ALL)
|
2003-08-29 04:34:14 -04:00
|
|
|
__getip.do_one_event(flag)
|
|
|
|
end
|
|
|
|
def mainloop_abort_on_exception
|
2004-05-01 12:09:54 -04:00
|
|
|
# __getip.mainloop_abort_on_exception
|
|
|
|
TclTkLib.mainloop_abort_on_exception
|
2003-08-29 04:34:14 -04:00
|
|
|
end
|
|
|
|
def mainloop_abort_on_exception=(mode)
|
2004-05-01 12:09:54 -04:00
|
|
|
# __getip.mainloop_abort_on_exception=(mode)
|
|
|
|
TclTkLib.mainloop_abort_on_exception=(mode)
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
def set_eventloop_tick(tick)
|
2003-08-29 04:34:14 -04:00
|
|
|
__getip.set_eventloop_tick(tick)
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
def get_eventloop_tick
|
2003-08-29 04:34:14 -04:00
|
|
|
__getip.get_eventloop_tick
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
def set_no_event_wait(tick)
|
2003-08-29 04:34:14 -04:00
|
|
|
__getip.set_no_event_wait(tick)
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
def get_no_event_wait
|
2003-08-29 04:34:14 -04:00
|
|
|
__getip.get_no_event_wait
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
def set_eventloop_weight(loop_max, no_event_tick)
|
2003-08-29 04:34:14 -04:00
|
|
|
__getip.set_eventloop_weight(loop_max, no_event_tick)
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
def get_eventloop_weight
|
2003-08-29 04:34:14 -04:00
|
|
|
__getip.get_eventloop_weight
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# class methods to delegate to TclTkIp
|
|
|
|
class << MultiTkIp
|
2003-07-31 16:52:40 -04:00
|
|
|
def method_missing(id, *args)
|
2004-05-21 16:45:27 -04:00
|
|
|
__getip.__send__(id, *args)
|
2003-07-31 16:52:40 -04:00
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
def make_safe
|
|
|
|
__getip.make_safe
|
|
|
|
end
|
|
|
|
|
|
|
|
def safe?
|
|
|
|
__getip.safe?
|
|
|
|
end
|
|
|
|
|
2004-09-08 02:23:41 -04:00
|
|
|
def safe_base?
|
|
|
|
begin
|
|
|
|
__getip.safe_base?
|
|
|
|
rescue
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2004-09-11 13:45:53 -04:00
|
|
|
def allow_ruby_exit?
|
|
|
|
__getip.allow_ruby_exit?
|
|
|
|
end
|
|
|
|
|
|
|
|
def allow_ruby_exit= (mode)
|
|
|
|
__getip.allow_ruby_exit = mode
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete
|
|
|
|
__getip.delete
|
|
|
|
end
|
|
|
|
|
2005-01-25 00:09:22 -05:00
|
|
|
def deleted?
|
2004-09-11 13:45:53 -04:00
|
|
|
__getip.deleted?
|
|
|
|
end
|
|
|
|
|
2005-07-21 18:05:04 -04:00
|
|
|
def has_mainwindow?
|
|
|
|
__getip.has_mainwindow?
|
|
|
|
end
|
|
|
|
|
2005-01-30 23:14:50 -05:00
|
|
|
def invalid_namespace?
|
|
|
|
__getip.invalid_namespace?
|
2005-01-25 00:09:22 -05:00
|
|
|
end
|
|
|
|
|
2004-09-29 11:54:32 -04:00
|
|
|
def abort(msg = nil)
|
|
|
|
__getip.abort(msg)
|
|
|
|
end
|
|
|
|
|
|
|
|
def exit(st = true)
|
2004-09-02 13:17:20 -04:00
|
|
|
__getip.exit(st)
|
|
|
|
end
|
|
|
|
|
2004-09-29 11:54:32 -04:00
|
|
|
def exit!(st = false)
|
|
|
|
__getip.exit!(st)
|
|
|
|
end
|
|
|
|
|
2004-08-30 09:42:19 -04:00
|
|
|
def restart(app_name = nil, keys = {})
|
|
|
|
init_ip_internal
|
|
|
|
|
|
|
|
__getip._invoke('set', 'argv0', app_name) if app_name
|
|
|
|
if keys.kind_of?(Hash)
|
|
|
|
__getip._invoke('set', 'argv', _keys2opts(keys))
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
__getip.restart
|
|
|
|
end
|
|
|
|
|
|
|
|
def _eval(str)
|
|
|
|
__getip._eval(str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _invoke(*args)
|
|
|
|
__getip._invoke(*args)
|
|
|
|
end
|
|
|
|
|
2004-05-01 12:09:54 -04:00
|
|
|
def _eval_without_enc(str)
|
|
|
|
__getip._eval_without_enc(str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _invoke_without_enc(*args)
|
|
|
|
__getip._invoke_without_enc(*args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _eval_with_enc(str)
|
|
|
|
__getip._eval_with_enc(str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _invoke_with_enc(*args)
|
|
|
|
__getip._invoke_with_enc(*args)
|
|
|
|
end
|
|
|
|
|
2005-07-05 01:56:31 -04:00
|
|
|
def _toUTF8(str, encoding=nil)
|
2003-07-27 15:35:06 -04:00
|
|
|
__getip._toUTF8(str, encoding)
|
|
|
|
end
|
|
|
|
|
2005-07-05 01:56:31 -04:00
|
|
|
def _fromUTF8(str, encoding=nil)
|
2003-07-27 15:35:06 -04:00
|
|
|
__getip._fromUTF8(str, encoding)
|
|
|
|
end
|
|
|
|
|
2003-10-14 11:25:45 -04:00
|
|
|
def _thread_vwait(var)
|
|
|
|
__getip._thread_vwait(var)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _thread_tkwait(mode, target)
|
|
|
|
__getip._thread_tkwait(mode, target)
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
def _return_value
|
|
|
|
__getip._return_value
|
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
|
|
|
|
def _get_variable(var, flag)
|
|
|
|
__getip._get_variable(var, flag)
|
|
|
|
end
|
|
|
|
def _get_variable2(var, idx, flag)
|
|
|
|
__getip._get_variable2(var, idx, flag)
|
|
|
|
end
|
|
|
|
def _set_variable(var, value, flag)
|
|
|
|
__getip._set_variable(var, value, flag)
|
|
|
|
end
|
|
|
|
def _set_variable2(var, idx, value, flag)
|
|
|
|
__getip._set_variable2(var, idx, value, flag)
|
|
|
|
end
|
|
|
|
def _unset_variable(var, flag)
|
|
|
|
__getip._unset_variable(var, flag)
|
|
|
|
end
|
|
|
|
def _unset_variable2(var, idx, flag)
|
|
|
|
__getip._unset_variable2(var, idx, flag)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _get_global_var(var)
|
|
|
|
__getip._get_global_var(var)
|
|
|
|
end
|
|
|
|
def _get_global_var2(var, idx)
|
|
|
|
__getip._get_global_var2(var, idx)
|
|
|
|
end
|
|
|
|
def _set_global_var(var, value)
|
|
|
|
__getip._set_global_var(var, value)
|
|
|
|
end
|
|
|
|
def _set_global_var2(var, idx, value)
|
|
|
|
__getip._set_global_var2(var, idx, value)
|
|
|
|
end
|
|
|
|
def _unset_global_var(var)
|
|
|
|
__getip._unset_global_var(var)
|
|
|
|
end
|
|
|
|
def _unset_global_var2(var, idx)
|
|
|
|
__getip._unset_global_var2(var, idx)
|
|
|
|
end
|
|
|
|
|
2006-07-03 06:08:11 -04:00
|
|
|
def _make_menu_embeddable(menu_path)
|
|
|
|
__getip._make_menu_embeddable(menu_path)
|
|
|
|
end
|
|
|
|
|
2004-05-01 12:09:54 -04:00
|
|
|
def _split_tklist(str)
|
|
|
|
__getip._split_tklist(str)
|
|
|
|
end
|
|
|
|
def _merge_tklist(*args)
|
|
|
|
__getip._merge_tklist(*args)
|
|
|
|
end
|
|
|
|
def _conv_listelement(arg)
|
|
|
|
__getip._conv_listelement(arg)
|
|
|
|
end
|
2005-03-30 03:44:19 -05:00
|
|
|
|
|
|
|
def _create_console
|
|
|
|
__getip._create_console
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2003-08-29 04:34:14 -04:00
|
|
|
# wrap methods on TclTkLib : not permit calling TclTkLib module methods
|
|
|
|
class << TclTkLib
|
|
|
|
def mainloop(check_root = true)
|
|
|
|
MultiTkIp.mainloop(check_root)
|
|
|
|
end
|
|
|
|
def mainloop_watchdog(check_root = true)
|
|
|
|
MultiTkIp.mainloop_watchdog(check_root)
|
|
|
|
end
|
|
|
|
def do_one_event(flag = TclTkLib::EventFlag::ALL)
|
|
|
|
MultiTkIp.do_one_event(flag)
|
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
#def mainloop_abort_on_exception
|
|
|
|
# MultiTkIp.mainloop_abort_on_exception
|
|
|
|
#end
|
|
|
|
#def mainloop_abort_on_exception=(mode)
|
|
|
|
# MultiTkIp.mainloop_abort_on_exception=(mode)
|
|
|
|
#end
|
2003-08-29 04:34:14 -04:00
|
|
|
def set_eventloop_tick(tick)
|
|
|
|
MultiTkIp.set_eventloop_tick(tick)
|
|
|
|
end
|
|
|
|
def get_eventloop_tick
|
|
|
|
MultiTkIp.get_eventloop_tick
|
|
|
|
end
|
|
|
|
def set_no_event_wait(tick)
|
|
|
|
MultiTkIp.set_no_event_wait(tick)
|
|
|
|
end
|
|
|
|
def get_no_event_wait
|
|
|
|
MultiTkIp.get_no_event_wait
|
|
|
|
end
|
|
|
|
def set_eventloop_weight(loop_max, no_event_tick)
|
|
|
|
MultiTkIp.set_eventloop_weight(loop_max, no_event_tick)
|
|
|
|
end
|
|
|
|
def get_eventloop_weight
|
|
|
|
MultiTkIp.get_eventloop_weight
|
|
|
|
end
|
2004-08-30 09:42:19 -04:00
|
|
|
def restart(*args)
|
|
|
|
MultiTkIp.restart(*args)
|
2003-08-29 04:34:14 -04:00
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
|
|
|
|
def _merge_tklist(*args)
|
|
|
|
MultiTkIp._merge_tklist(*args)
|
|
|
|
end
|
|
|
|
def _conv_listelement(arg)
|
|
|
|
MultiTkIp._conv_listelement(arg)
|
|
|
|
end
|
2003-08-29 04:34:14 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
# depend on TclTkIp
|
|
|
|
class MultiTkIp
|
2009-07-12 19:08:32 -04:00
|
|
|
# def mainloop(check_root = true, restart_on_dead = true)
|
|
|
|
def mainloop(check_root = true, restart_on_dead = false)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2007-12-21 03:57:35 -05:00
|
|
|
|
* 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 WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
|
2007-12-21 03:57:35 -05:00
|
|
|
return @interp_thread.value if @interp_thread
|
|
|
|
end
|
|
|
|
|
2004-09-17 02:05:33 -04:00
|
|
|
#return self if self.slave?
|
|
|
|
#return self if self != @@DEFAULT_MASTER
|
|
|
|
if self != @@DEFAULT_MASTER
|
|
|
|
if @wait_on_mainloop[0]
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
2005-07-21 18:05:04 -04:00
|
|
|
@wait_on_mainloop[1] += 1
|
|
|
|
if $SAFE >= 4
|
|
|
|
_receiver_mainloop(check_root).join
|
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
@cmd_queue.enq([@system, 'call_mainloop',
|
2005-07-21 18:05:04 -04:00
|
|
|
Thread.current, check_root])
|
|
|
|
Thread.stop
|
|
|
|
end
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue MultiTkIp_OK => ret
|
|
|
|
# return value
|
2005-03-02 02:06:52 -05:00
|
|
|
if ret.value.kind_of?(Thread)
|
|
|
|
return ret.value.value
|
|
|
|
else
|
|
|
|
return ret.value
|
|
|
|
end
|
2005-07-21 18:05:04 -04:00
|
|
|
rescue SystemExit => e
|
2004-10-11 00:51:21 -04:00
|
|
|
# exit IP
|
2009-07-12 19:08:32 -04:00
|
|
|
warn("Warning: " + e.inspect + " on " + self.inspect) if $DEBUG
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
self._eval_without_enc('exit')
|
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
self.delete
|
2005-03-02 02:06:52 -05:00
|
|
|
rescue StandardError => e
|
2004-10-11 00:51:21 -04:00
|
|
|
if $DEBUG
|
2009-03-05 22:56:38 -05:00
|
|
|
warn("Warning: " + e.class.inspect +
|
|
|
|
((e.message.length > 0)? ' "' + e.message + '"': '') +
|
|
|
|
" on " + self.inspect)
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
return e
|
2005-07-21 18:05:04 -04:00
|
|
|
rescue Exception => e
|
|
|
|
return e
|
2004-10-11 00:51:21 -04:00
|
|
|
ensure
|
2005-07-21 18:05:04 -04:00
|
|
|
@wait_on_mainloop[1] -= 1
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
2004-09-17 02:05:33 -04:00
|
|
|
end
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2003-07-31 03:59:18 -04:00
|
|
|
unless restart_on_dead
|
2005-07-21 18:05:04 -04:00
|
|
|
@wait_on_mainloop[1] += 1
|
2005-03-02 02:06:52 -05:00
|
|
|
=begin
|
|
|
|
begin
|
|
|
|
@interp.mainloop(check_root)
|
|
|
|
rescue StandardError => e
|
|
|
|
if $DEBUG
|
2009-03-05 22:56:38 -05:00
|
|
|
warn("Warning: " + e.class.inspect +
|
|
|
|
((e.message.length > 0)? ' "' + e.message + '"': '') +
|
|
|
|
" on " + self.inspect)
|
2005-03-02 02:06:52 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
=end
|
2005-07-21 18:05:04 -04:00
|
|
|
begin
|
|
|
|
@interp.mainloop(check_root)
|
|
|
|
ensure
|
|
|
|
@wait_on_mainloop[1] -= 1
|
|
|
|
end
|
2003-07-31 03:59:18 -04:00
|
|
|
else
|
2005-03-02 02:06:52 -05:00
|
|
|
loop do
|
|
|
|
break unless self.alive?
|
|
|
|
if check_root
|
|
|
|
begin
|
|
|
|
break if TclTkLib.num_of_mainwindows == 0
|
|
|
|
rescue StandardError
|
|
|
|
break
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
break if @interp.deleted?
|
|
|
|
begin
|
2005-07-21 18:05:04 -04:00
|
|
|
@wait_on_mainloop[1] += 1
|
2005-03-02 02:06:52 -05:00
|
|
|
@interp.mainloop(check_root)
|
|
|
|
rescue StandardError => e
|
|
|
|
if TclTkLib.mainloop_abort_on_exception != nil
|
2009-03-05 22:56:38 -05:00
|
|
|
#STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect,
|
2005-03-02 02:06:52 -05:00
|
|
|
# " exception (ignore) : ", $!.message, "\n");
|
|
|
|
if $DEBUG
|
|
|
|
warn("Warning: Tk mainloop receives " << e.class.inspect <<
|
|
|
|
" exception (ignore) : " << e.message);
|
|
|
|
end
|
|
|
|
end
|
|
|
|
#raise e
|
|
|
|
rescue Exception => e
|
|
|
|
=begin
|
|
|
|
if TclTkLib.mainloop_abort_on_exception != nil
|
2009-03-05 22:56:38 -05:00
|
|
|
#STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect,
|
2005-03-02 02:06:52 -05:00
|
|
|
# " exception (ignore) : ", $!.message, "\n");
|
|
|
|
if $DEBUG
|
|
|
|
warn("Warning: Tk mainloop receives " << e.class.inspect <<
|
|
|
|
" exception (ignore) : " << e.message);
|
|
|
|
end
|
|
|
|
end
|
|
|
|
=end
|
|
|
|
raise e
|
|
|
|
ensure
|
2005-07-21 18:05:04 -04:00
|
|
|
@wait_on_mainloop[1] -= 1
|
2005-03-02 02:06:52 -05:00
|
|
|
Thread.pass # avoid eventloop conflict
|
2004-10-11 00:51:21 -04:00
|
|
|
end
|
2003-07-31 03:59:18 -04:00
|
|
|
end
|
|
|
|
end
|
2003-08-29 04:34:14 -04:00
|
|
|
self
|
2003-07-31 03:59:18 -04:00
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
def make_safe
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-27 15:35:06 -04:00
|
|
|
@interp.make_safe
|
|
|
|
end
|
|
|
|
|
|
|
|
def safe?
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-27 15:35:06 -04:00
|
|
|
@interp.safe?
|
|
|
|
end
|
|
|
|
|
2004-09-08 02:23:41 -04:00
|
|
|
def safe_base?
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-09-08 02:23:41 -04:00
|
|
|
@safe_base
|
|
|
|
end
|
|
|
|
|
2004-09-11 13:45:53 -04:00
|
|
|
def allow_ruby_exit?
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-09-11 13:45:53 -04:00
|
|
|
@interp.allow_ruby_exit?
|
|
|
|
end
|
|
|
|
|
|
|
|
def allow_ruby_exit= (mode)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-09-11 13:45:53 -04:00
|
|
|
@interp.allow_ruby_exit = mode
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
def delete
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-09-17 03:09:28 -04:00
|
|
|
@slave_ip_tbl.each{|name, subip|
|
2004-09-11 13:45:53 -04:00
|
|
|
_destroy_slaves_of_slaveIP(subip)
|
|
|
|
=begin
|
|
|
|
begin
|
2004-10-11 00:51:21 -04:00
|
|
|
subip._invoke('destroy', '.') unless subip.deleted?
|
2004-09-11 13:45:53 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
|
|
|
=end
|
|
|
|
begin
|
2004-12-27 06:04:21 -05:00
|
|
|
# subip._eval_without_enc("foreach i [after info] {after cancel $i}")
|
2005-07-25 01:11:19 -04:00
|
|
|
unless subip.deleted?
|
|
|
|
after_ids = subip._eval_without_enc("after info")
|
|
|
|
subip._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
|
|
|
|
end
|
2004-09-11 13:45:53 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
2004-09-17 03:09:28 -04:00
|
|
|
|
|
|
|
# safe_base?
|
|
|
|
if @interp._eval_without_enc("catch {::safe::interpConfigure #{name}}") == '0'
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
@interp._eval_without_enc("::safe::interpDelete #{name}")
|
|
|
|
rescue Exception
|
|
|
|
else
|
|
|
|
next if subip.deleted?
|
|
|
|
end
|
2004-09-17 03:09:28 -04:00
|
|
|
end
|
2009-03-05 22:56:38 -05:00
|
|
|
if subip.respond_to?(:safe_base?) && subip.safe_base? &&
|
2004-10-11 00:51:21 -04:00
|
|
|
!subip.deleted?
|
|
|
|
# do 'exit' to call the delete_hook procedure
|
|
|
|
begin
|
2009-03-05 22:56:38 -05:00
|
|
|
subip._eval_without_enc('exit')
|
2004-10-11 00:51:21 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
2004-09-17 03:09:28 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
begin
|
|
|
|
subip.delete unless subip.deleted?
|
|
|
|
rescue Exception
|
|
|
|
end
|
2004-09-02 13:17:20 -04:00
|
|
|
end
|
|
|
|
}
|
2004-09-11 13:45:53 -04:00
|
|
|
|
|
|
|
begin
|
2004-12-27 06:04:21 -05:00
|
|
|
# @interp._eval_without_enc("foreach i [after info] {after cancel $i}")
|
|
|
|
after_ids = @interp._eval_without_enc("after info")
|
|
|
|
@interp._eval_without_enc("foreach i {#{after_ids}} {after cancel $i}")
|
2004-09-11 13:45:53 -04:00
|
|
|
rescue Exception
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
|
2004-09-11 13:45:53 -04:00
|
|
|
begin
|
|
|
|
@interp._invoke('destroy', '.') unless @interp.deleted?
|
|
|
|
rescue Exception
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
|
2004-09-11 13:45:53 -04:00
|
|
|
if @safe_base && !@interp.deleted?
|
2004-05-01 12:09:54 -04:00
|
|
|
# do 'exit' to call the delete_hook procedure
|
|
|
|
@interp._eval_without_enc('exit')
|
|
|
|
end
|
2005-03-02 02:06:52 -05:00
|
|
|
@interp.delete
|
2004-09-11 13:45:53 -04:00
|
|
|
self
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def deleted?
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-27 15:35:06 -04:00
|
|
|
@interp.deleted?
|
|
|
|
end
|
|
|
|
|
2005-07-21 18:05:04 -04:00
|
|
|
def has_mainwindow?
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2005-07-21 18:05:04 -04:00
|
|
|
@interp.has_mainwindow?
|
|
|
|
end
|
|
|
|
|
2005-01-30 23:14:50 -05:00
|
|
|
def invalid_namespace?
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2005-01-30 23:14:50 -05:00
|
|
|
@interp.invalid_namespace?
|
2005-01-25 00:09:22 -05:00
|
|
|
end
|
|
|
|
|
2004-09-29 11:54:32 -04:00
|
|
|
def abort(msg = nil)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
if master? && !safe? && allow_ruby_exit?
|
2004-09-29 11:54:32 -04:00
|
|
|
if msg
|
2004-10-11 00:51:21 -04:00
|
|
|
Kernel.abort(msg)
|
2004-09-29 11:54:32 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
Kernel.abort
|
2004-09-29 11:54:32 -04:00
|
|
|
end
|
|
|
|
else
|
|
|
|
# ignore msg
|
|
|
|
delete
|
|
|
|
1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def exit(st = true)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
if master? && !safe? && allow_ruby_exit?
|
2004-09-02 13:17:20 -04:00
|
|
|
Kernel.exit(st)
|
|
|
|
else
|
|
|
|
delete
|
|
|
|
st
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2004-09-29 11:54:32 -04:00
|
|
|
def exit!(st = false)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-09-29 11:54:32 -04:00
|
|
|
if master? && !safe? && allow_ruby_exit?
|
|
|
|
Kernel.exit!(st)
|
|
|
|
else
|
|
|
|
delete
|
|
|
|
st
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2004-08-30 09:42:19 -04:00
|
|
|
def restart(app_name = nil, keys = {})
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2004-08-30 09:42:19 -04:00
|
|
|
_init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)
|
|
|
|
|
|
|
|
@interp._invoke('set', 'argv0', app_name) if app_name
|
|
|
|
if keys.kind_of?(Hash)
|
|
|
|
@interp._invoke('set', 'argv', _keys2opts(keys))
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
@interp.restart
|
|
|
|
end
|
|
|
|
|
2004-05-21 16:45:27 -04:00
|
|
|
def __eval(str)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-21 16:45:27 -04:00
|
|
|
@interp.__eval(str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def __invoke(*args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-21 16:45:27 -04:00
|
|
|
@interp.__invoke(*args)
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
def _eval(str)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-27 15:35:06 -04:00
|
|
|
@interp._eval(str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _invoke(*args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-27 15:35:06 -04:00
|
|
|
@interp._invoke(*args)
|
|
|
|
end
|
|
|
|
|
2004-05-01 12:09:54 -04:00
|
|
|
def _eval_without_enc(str)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._eval_without_enc(str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _invoke_without_enc(*args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._invoke_without_enc(*args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _eval_with_enc(str)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._eval_with_enc(str)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _invoke_with_enc(*args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._invoke_with_enc(*args)
|
|
|
|
end
|
|
|
|
|
2005-07-05 01:56:31 -04:00
|
|
|
def _toUTF8(str, encoding=nil)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-27 15:35:06 -04:00
|
|
|
@interp._toUTF8(str, encoding)
|
|
|
|
end
|
|
|
|
|
2005-07-05 01:56:31 -04:00
|
|
|
def _fromUTF8(str, encoding=nil)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-27 15:35:06 -04:00
|
|
|
@interp._fromUTF8(str, encoding)
|
|
|
|
end
|
|
|
|
|
2003-10-14 11:25:45 -04:00
|
|
|
def _thread_vwait(var)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-10-14 11:25:45 -04:00
|
|
|
@interp._thread_vwait(var)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _thread_tkwait(mode, target)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-10-14 11:25:45 -04:00
|
|
|
@interp._thread_tkwait(mode, target)
|
|
|
|
end
|
|
|
|
|
2003-07-27 15:35:06 -04:00
|
|
|
def _return_value
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-27 15:35:06 -04:00
|
|
|
@interp._return_value
|
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
|
|
|
|
def _get_variable(var, flag)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._get_variable(var, flag)
|
|
|
|
end
|
|
|
|
def _get_variable2(var, idx, flag)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._get_variable2(var, idx, flag)
|
|
|
|
end
|
|
|
|
def _set_variable(var, value, flag)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._set_variable(var, value, flag)
|
|
|
|
end
|
|
|
|
def _set_variable2(var, idx, value, flag)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._set_variable2(var, idx, value, flag)
|
|
|
|
end
|
|
|
|
def _unset_variable(var, flag)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._unset_variable(var, flag)
|
|
|
|
end
|
|
|
|
def _unset_variable2(var, idx, flag)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._unset_variable2(var, idx, flag)
|
|
|
|
end
|
|
|
|
|
|
|
|
def _get_global_var(var)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._get_global_var(var)
|
|
|
|
end
|
|
|
|
def _get_global_var2(var, idx)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._get_global_var2(var, idx)
|
|
|
|
end
|
|
|
|
def _set_global_var(var, value)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._set_global_var(var, value)
|
|
|
|
end
|
|
|
|
def _set_global_var2(var, idx, value)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._set_global_var2(var, idx, value)
|
|
|
|
end
|
|
|
|
def _unset_global_var(var)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._unset_global_var(var)
|
|
|
|
end
|
|
|
|
def _unset_global_var2(var, idx)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._unset_global_var2(var, idx)
|
|
|
|
end
|
|
|
|
|
2006-07-03 06:08:11 -04:00
|
|
|
def _make_menu_embeddable(menu_path)
|
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
@interp._make_menu_embeddable(menu_path)
|
|
|
|
end
|
|
|
|
|
2004-05-01 12:09:54 -04:00
|
|
|
def _split_tklist(str)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._split_tklist(str)
|
|
|
|
end
|
|
|
|
def _merge_tklist(*args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._merge_tklist(*args)
|
|
|
|
end
|
|
|
|
def _conv_listelement(arg)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp._conv_listelement(arg)
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2003-07-28 02:10:13 -04:00
|
|
|
# interp command support
|
|
|
|
class MultiTkIp
|
|
|
|
def _lst2ary(str)
|
|
|
|
return [] if str == ""
|
|
|
|
idx = str.index('{')
|
|
|
|
while idx and idx > 0 and str[idx-1] == ?\\
|
|
|
|
idx = str.index('{', idx+1)
|
|
|
|
end
|
|
|
|
return str.split unless idx
|
|
|
|
|
|
|
|
list = str[0,idx].split
|
|
|
|
str = str[idx+1..-1]
|
|
|
|
i = -1
|
|
|
|
brace = 1
|
|
|
|
str.each_byte {|c|
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
c = c.chr
|
2003-07-28 02:10:13 -04:00
|
|
|
i += 1
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
brace += 1 if c == '{'
|
|
|
|
brace -= 1 if c == '}'
|
2003-07-28 02:10:13 -04:00
|
|
|
break if brace == 0
|
|
|
|
}
|
|
|
|
if i == 0
|
|
|
|
list.push ''
|
|
|
|
elsif str[0, i] == ' '
|
|
|
|
list.push ' '
|
|
|
|
else
|
|
|
|
list.push str[0..i-1]
|
|
|
|
end
|
2004-06-12 11:25:49 -04:00
|
|
|
#list += _lst2ary(str[i+1..-1])
|
|
|
|
list.concat(_lst2ary(str[i+1..-1]))
|
2003-07-28 02:10:13 -04:00
|
|
|
list
|
|
|
|
end
|
|
|
|
private :_lst2ary
|
|
|
|
|
|
|
|
def _slavearg(slave)
|
|
|
|
if slave.kind_of?(MultiTkIp)
|
|
|
|
slave.path
|
|
|
|
elsif slave.kind_of?(String)
|
|
|
|
slave
|
|
|
|
else
|
2004-12-20 00:10:59 -05:00
|
|
|
slave.to_s
|
2003-07-28 02:10:13 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
private :_slavearg
|
|
|
|
|
|
|
|
def alias_info(slave, cmd_name)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
_lst2ary(@interp._invoke('interp', 'alias', _slavearg(slave), cmd_name))
|
|
|
|
end
|
|
|
|
def self.alias_info(slave, cmd_name)
|
|
|
|
__getip.alias_info(slave, cmd_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
def alias_delete(slave, cmd_name)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'alias', _slavearg(slave), cmd_name, '')
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.alias_delete(slave, cmd_name)
|
|
|
|
__getip.alias_delete(slave, cmd_name)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def def_alias(slave, new_cmd, org_cmd, *args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2009-03-05 22:56:38 -05:00
|
|
|
ret = @interp._invoke('interp', 'alias', _slavearg(slave), new_cmd,
|
2004-10-11 00:51:21 -04:00
|
|
|
'', org_cmd, *args)
|
2003-07-28 02:10:13 -04:00
|
|
|
(ret == new_cmd)? self: nil
|
|
|
|
end
|
|
|
|
def self.def_alias(slave, new_cmd, org_cmd, *args)
|
|
|
|
ret = __getip.def_alias(slave, new_cmd, org_cmd, *args)
|
|
|
|
(ret == new_cmd)? self: nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def aliases(slave = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
_lst2ary(@interp._invoke('interp', 'aliases', _slavearg(slave)))
|
|
|
|
end
|
|
|
|
def self.aliases(slave = '')
|
|
|
|
__getip.aliases(slave)
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete_slaves(*args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
slaves = args.collect{|s| _slavearg(s)}
|
|
|
|
@interp._invoke('interp', 'delete', *slaves) if slaves.size > 0
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.delete_slaves(*args)
|
|
|
|
__getip.delete_slaves(*args)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def exist?(slave = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
ret = @interp._invoke('interp', 'exists', _slavearg(slave))
|
|
|
|
(ret == '1')? true: false
|
|
|
|
end
|
|
|
|
def self.exist?(slave = '')
|
|
|
|
__getip.exist?(slave)
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete_cmd(slave, cmd)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
slave_invoke = @interp._invoke('list', 'rename', cmd, '')
|
|
|
|
@interp._invoke('interp', 'eval', _slavearg(slave), slave_invoke)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.delete_cmd(slave, cmd)
|
|
|
|
__getip.delete_cmd(slave, cmd)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def expose_cmd(slave, cmd, aliasname = nil)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
if aliasname
|
|
|
|
@interp._invoke('interp', 'expose', _slavearg(slave), cmd, aliasname)
|
|
|
|
else
|
|
|
|
@interp._invoke('interp', 'expose', _slavearg(slave), cmd)
|
|
|
|
end
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.expose_cmd(slave, cmd, aliasname = nil)
|
|
|
|
__getip.expose_cmd(slave, cmd, aliasname)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def hide_cmd(slave, cmd, aliasname = nil)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
if aliasname
|
|
|
|
@interp._invoke('interp', 'hide', _slavearg(slave), cmd, aliasname)
|
|
|
|
else
|
|
|
|
@interp._invoke('interp', 'hide', _slavearg(slave), cmd)
|
|
|
|
end
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.hide_cmd(slave, cmd, aliasname = nil)
|
|
|
|
__getip.hide_cmd(slave, cmd, aliasname)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def hidden_cmds(slave = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
_lst2ary(@interp._invoke('interp', 'hidden', _slavearg(slave)))
|
|
|
|
end
|
|
|
|
def self.hidden_cmds(slave = '')
|
|
|
|
__getip.hidden_cmds(slave)
|
|
|
|
end
|
|
|
|
|
|
|
|
def invoke_hidden(slave, cmd, *args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-12-20 00:10:59 -05:00
|
|
|
if args[-1].kind_of?(Hash)
|
|
|
|
keys = _symbolkey2str(args.pop)
|
|
|
|
else
|
|
|
|
keys = []
|
|
|
|
end
|
2005-09-01 01:15:19 -04:00
|
|
|
keys << _slavearg(slave)
|
2004-12-20 00:10:59 -05:00
|
|
|
if Tk::TCL_MAJOR_VERSION > 8 ||
|
2009-03-05 22:56:38 -05:00
|
|
|
(Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
|
2004-12-20 00:10:59 -05:00
|
|
|
keys << '--'
|
|
|
|
end
|
2005-09-01 01:15:19 -04:00
|
|
|
keys << cmd
|
2004-12-20 00:10:59 -05:00
|
|
|
keys.concat(args)
|
|
|
|
@interp._invoke('interp', 'invokehidden', *keys)
|
2003-07-28 02:10:13 -04:00
|
|
|
end
|
|
|
|
def self.invoke_hidden(slave, cmd, *args)
|
|
|
|
__getip.invoke_hidden(slave, cmd, *args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def invoke_hidden_on_global(slave, cmd, *args)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-12-20 00:10:59 -05:00
|
|
|
if args[-1].kind_of?(Hash)
|
|
|
|
keys = _symbolkey2str(args.pop)
|
|
|
|
else
|
|
|
|
keys = []
|
|
|
|
end
|
2005-09-01 01:15:19 -04:00
|
|
|
keys << _slavearg(slave)
|
2004-12-20 00:10:59 -05:00
|
|
|
keys << '-global'
|
|
|
|
if Tk::TCL_MAJOR_VERSION > 8 ||
|
2009-03-05 22:56:38 -05:00
|
|
|
(Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
|
2004-12-20 00:10:59 -05:00
|
|
|
keys << '--'
|
|
|
|
end
|
2005-09-01 01:15:19 -04:00
|
|
|
keys << cmd
|
2004-12-20 00:10:59 -05:00
|
|
|
keys.concat(args)
|
|
|
|
@interp._invoke('interp', 'invokehidden', *keys)
|
2003-07-28 02:10:13 -04:00
|
|
|
end
|
|
|
|
def self.invoke_hidden_on_global(slave, cmd, *args)
|
|
|
|
__getip.invoke_hidden_on_global(slave, cmd, *args)
|
|
|
|
end
|
|
|
|
|
2005-09-01 01:15:19 -04:00
|
|
|
def invoke_hidden_on_namespace(slave, ns, cmd, *args)
|
|
|
|
# for Tcl8.5 or later
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2005-09-01 01:15:19 -04:00
|
|
|
if args[-1].kind_of?(Hash)
|
|
|
|
keys = _symbolkey2str(args.pop)
|
|
|
|
else
|
|
|
|
keys = []
|
|
|
|
end
|
|
|
|
keys << _slavearg(slave)
|
|
|
|
keys << '-namespace' << TkComm._get_eval_string(ns)
|
|
|
|
keys << '--' << cmd
|
|
|
|
keys.concat(args)
|
|
|
|
@interp._invoke('interp', 'invokehidden', *keys)
|
|
|
|
end
|
|
|
|
def self.invoke_hidden_on_namespace(slave, ns, cmd, *args)
|
|
|
|
__getip.invoke_hidden_on_namespace(slave, ns, cmd, *args)
|
|
|
|
end
|
|
|
|
|
2003-07-28 02:10:13 -04:00
|
|
|
def mark_trusted(slave = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'marktrusted', _slavearg(slave))
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.mark_trusted(slave = '')
|
|
|
|
__getip.mark_trusted(slave)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
2004-12-20 00:10:59 -05:00
|
|
|
def set_bgerror_handler(cmd = Proc.new, slave = nil, &b)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2004-12-20 00:10:59 -05:00
|
|
|
unless TkComm._callback_entry?(cmd)
|
2005-01-25 00:09:22 -05:00
|
|
|
if !slave && b
|
2004-12-20 00:10:59 -05:00
|
|
|
slave = cmd
|
|
|
|
cmd = Proc.new(&b)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
slave = '' unless slave
|
|
|
|
|
|
|
|
@interp._invoke('interp', 'bgerror', _slavearg(slave), cmd)
|
|
|
|
end
|
|
|
|
def self.bgerror(cmd = Proc.new, slave = nil, &b)
|
|
|
|
__getip.bgerror(cmd, slave, &b)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_bgerror_handler(slave = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-12-20 00:10:59 -05:00
|
|
|
procedure(@interp._invoke('interp', 'bgerror', _slavearg(slave)))
|
|
|
|
end
|
|
|
|
def self.bgerror(slave = '')
|
|
|
|
__getip.bgerror(slave)
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_limit(limit_type, slave = '', opts = {})
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-12-20 00:10:59 -05:00
|
|
|
@interp._invoke('interp', 'limit', _slavearg(slave), limit_type, opts)
|
|
|
|
end
|
|
|
|
def self.set_limit(limit_type, slave = '', opts = {})
|
|
|
|
__getip.set_limit(limit_type, slave, opts)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_limit(limit_type, slave = '', slot = nil)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
|
2004-12-20 00:10:59 -05:00
|
|
|
if slot
|
2009-03-05 22:56:38 -05:00
|
|
|
num_or_str(@interp._invoke('interp', 'limit', _slavearg(slave),
|
2004-12-20 00:10:59 -05:00
|
|
|
limit_type, slot))
|
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
l = @interp._split_tklist(@interp._invoke_without_enc('interp', 'limit',
|
|
|
|
_slavearg(slave),
|
2005-05-25 07:09:59 -04:00
|
|
|
limit_type))
|
|
|
|
l.map!{|s| _fromUTF8(s)}
|
2004-12-20 00:10:59 -05:00
|
|
|
r = {}
|
|
|
|
until l.empty?
|
|
|
|
key = l.shift[1..-1]
|
|
|
|
val = l.shift
|
|
|
|
val = num_or_str(val) if val
|
|
|
|
r[key] = val
|
|
|
|
end
|
|
|
|
r
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def self.get_limit(limit_type, slave = '', slot = nil)
|
|
|
|
__getip.get_limit(limit_type, slave, slot)
|
|
|
|
end
|
|
|
|
|
2004-05-01 12:09:54 -04:00
|
|
|
def recursion_limit(slave = '', limit = None)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2009-03-05 22:56:38 -05:00
|
|
|
number(@interp._invoke('interp', 'recursionlimit',
|
2004-10-11 00:51:21 -04:00
|
|
|
_slavearg(slave), limit))
|
2004-05-01 12:09:54 -04:00
|
|
|
end
|
|
|
|
def self.recursion_limit(slave = '', limit = None)
|
|
|
|
__getip.recursion_limit(slave)
|
|
|
|
end
|
|
|
|
|
2003-07-28 02:10:13 -04:00
|
|
|
def alias_target(aliascmd, slave = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'target', _slavearg(slave), aliascmd)
|
|
|
|
end
|
|
|
|
def self.alias_target(aliascmd, slave = '')
|
|
|
|
__getip.alias_target(aliascmd, slave)
|
|
|
|
end
|
|
|
|
|
|
|
|
def share_stdin(dist, src = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'share', src, 'stdin', dist)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.share_stdin(dist, src = '')
|
|
|
|
__getip.share_stdin(dist, src)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def share_stdout(dist, src = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'share', src, 'stdout', dist)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.share_stdout(dist, src = '')
|
|
|
|
__getip.share_stdout(dist, src)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def share_stderr(dist, src = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'share', src, 'stderr', dist)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.share_stderr(dist, src = '')
|
|
|
|
__getip.share_stderr(dist, src)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def transfer_stdin(dist, src = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'transfer', src, 'stdin', dist)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.transfer_stdin(dist, src = '')
|
|
|
|
__getip.transfer_stdin(dist, src)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def transfer_stdout(dist, src = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'transfer', src, 'stdout', dist)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.transfer_stdout(dist, src = '')
|
|
|
|
__getip.transfer_stdout(dist, src)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def transfer_stderr(dist, src = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'transfer', src, 'stderr', dist)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.transfer_stderr(dist, src = '')
|
|
|
|
__getip.transfer_stderr(dist, src)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def share_stdio(dist, src = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'share', src, 'stdin', dist)
|
|
|
|
@interp._invoke('interp', 'share', src, 'stdout', dist)
|
|
|
|
@interp._invoke('interp', 'share', src, 'stderr', dist)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.share_stdio(dist, src = '')
|
|
|
|
__getip.share_stdio(dist, src)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def transfer_stdio(dist, src = '')
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2003-07-28 02:10:13 -04:00
|
|
|
@interp._invoke('interp', 'transfer', src, 'stdin', dist)
|
|
|
|
@interp._invoke('interp', 'transfer', src, 'stdout', dist)
|
|
|
|
@interp._invoke('interp', 'transfer', src, 'stderr', dist)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
def self.transfer_stdio(dist, src = '')
|
|
|
|
__getip.transfer_stdio(dist, src)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2003-07-31 16:52:40 -04:00
|
|
|
|
2004-05-01 12:09:54 -04:00
|
|
|
# Safe Base :: manipulating safe interpreter
|
2003-07-31 16:52:40 -04:00
|
|
|
class MultiTkIp
|
2004-09-17 02:05:33 -04:00
|
|
|
def safeip_configure(slot, value=None)
|
2004-05-01 12:09:54 -04:00
|
|
|
# use for '-noStatics' option ==> {statics=>false}
|
|
|
|
# for '-nestedLoadOk' option ==> {nested=>true}
|
|
|
|
if slot.kind_of?(Hash)
|
|
|
|
ip = MultiTkIp.__getip
|
2004-08-30 09:42:19 -04:00
|
|
|
ip._eval('::safe::interpConfigure ' + @ip_name + ' ' + _keys2opts(slot))
|
2004-05-01 12:09:54 -04:00
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
ip._eval('::safe::interpConfigure ' + @ip_name + ' ' +
|
2004-10-11 00:51:21 -04:00
|
|
|
"-#{slot} #{_get_eval_string(value)}")
|
2004-05-01 12:09:54 -04:00
|
|
|
end
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def safeip_configinfo(slot = nil)
|
|
|
|
ip = MultiTkIp.__getip
|
|
|
|
ret = {}
|
|
|
|
if slot
|
2009-03-05 22:56:38 -05:00
|
|
|
conf = _lst2ary(ip._eval("::safe::interpConfigure " +
|
2004-10-11 00:51:21 -04:00
|
|
|
@ip_name + " -#{slot}"))
|
2004-05-01 12:09:54 -04:00
|
|
|
if conf[0] == '-deleteHook'
|
2005-11-18 03:39:29 -05:00
|
|
|
=begin
|
2004-10-11 00:51:21 -04:00
|
|
|
if conf[1] =~ /^rb_out\S* (c(_\d+_)?\d+)/
|
|
|
|
ret[conf[0][1..-1]] = MultiTkIp._tk_cmd_tbl[$1]
|
2005-11-18 03:39:29 -05:00
|
|
|
=end
|
|
|
|
if conf[1] =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
|
|
|
|
ret[conf[0][1..-1]] = MultiTkIp._tk_cmd_tbl[$4]
|
2004-10-11 00:51:21 -04:00
|
|
|
else
|
|
|
|
ret[conf[0][1..-1]] = conf[1]
|
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
else
|
2004-10-11 00:51:21 -04:00
|
|
|
ret[conf[0][1..-1]] = conf[1]
|
2004-05-01 12:09:54 -04:00
|
|
|
end
|
|
|
|
else
|
2009-03-05 22:56:38 -05:00
|
|
|
Hash[*_lst2ary(ip._eval("::safe::interpConfigure " +
|
2004-10-11 00:51:21 -04:00
|
|
|
@ip_name))].each{|k, v|
|
|
|
|
if k == '-deleteHook'
|
2005-11-18 03:39:29 -05:00
|
|
|
=begin
|
2004-10-11 00:51:21 -04:00
|
|
|
if v =~ /^rb_out\S* (c(_\d+_)?\d+)/
|
|
|
|
ret[k[1..-1]] = MultiTkIp._tk_cmd_tbl[$1]
|
2005-11-18 03:39:29 -05:00
|
|
|
=end
|
|
|
|
if v =~ /rb_out\S*(?:\s+(::\S*|[{](::.*)[}]|["](::.*)["]))? (c(_\d+_)?(\d+))/
|
|
|
|
ret[k[1..-1]] = MultiTkIp._tk_cmd_tbl[$4]
|
2004-10-11 00:51:21 -04:00
|
|
|
else
|
|
|
|
ret[k[1..-1]] = v
|
|
|
|
end
|
|
|
|
else
|
|
|
|
ret[k[1..-1]] = v
|
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
}
|
|
|
|
end
|
|
|
|
ret
|
|
|
|
end
|
2003-07-31 16:52:40 -04:00
|
|
|
|
2004-09-17 02:05:33 -04:00
|
|
|
def safeip_delete
|
2004-05-01 12:09:54 -04:00
|
|
|
ip = MultiTkIp.__getip
|
|
|
|
ip._eval("::safe::interpDelete " + @ip_name)
|
|
|
|
end
|
|
|
|
|
2004-09-17 02:05:33 -04:00
|
|
|
def safeip_add_to_access_path(dir)
|
2004-05-01 12:09:54 -04:00
|
|
|
ip = MultiTkIp.__getip
|
|
|
|
ip._eval("::safe::interpAddToAccessPath #{@ip_name} #{dir}")
|
|
|
|
end
|
|
|
|
|
2004-09-17 02:05:33 -04:00
|
|
|
def safeip_find_in_access_path(dir)
|
2004-05-01 12:09:54 -04:00
|
|
|
ip = MultiTkIp.__getip
|
|
|
|
ip._eval("::safe::interpFindInAccessPath #{@ip_name} #{dir}")
|
|
|
|
end
|
|
|
|
|
2004-09-17 02:05:33 -04:00
|
|
|
def safeip_set_log_cmd(cmd = Proc.new)
|
2004-05-01 12:09:54 -04:00
|
|
|
ip = MultiTkIp.__getip
|
|
|
|
ip._eval("::safe::setLogCmd #{@ip_name} #{_get_eval_string(cmd)}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# encoding convert
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
class << MultiTkIp
|
|
|
|
def encoding_table
|
|
|
|
__getip.encoding_table
|
|
|
|
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 force_default_encoding=(mode)
|
|
|
|
__getip.force_default_encoding=(mode)
|
|
|
|
end
|
|
|
|
|
|
|
|
def force_default_encoding?
|
|
|
|
__getip.force_default_encoding?
|
|
|
|
end
|
|
|
|
|
|
|
|
def default_encoding=(enc)
|
|
|
|
__getip.default_encoding=(enc)
|
|
|
|
end
|
|
|
|
|
|
|
|
def encoding=(enc)
|
|
|
|
__getip.encoding=(enc)
|
|
|
|
end
|
|
|
|
|
|
|
|
def encoding_name
|
|
|
|
__getip.encoding_name
|
|
|
|
end
|
|
|
|
|
|
|
|
def encoding_obj
|
|
|
|
__getip.encoding_obj
|
|
|
|
end
|
|
|
|
alias encoding encoding_name
|
|
|
|
alias default_encoding encoding_name
|
|
|
|
|
|
|
|
def encoding_convertfrom(str, enc=None)
|
|
|
|
__getip.encoding_convertfrom(str, enc)
|
|
|
|
end
|
|
|
|
alias encoding_convert_from encoding_convertfrom
|
|
|
|
|
|
|
|
def encoding_convertto(str, enc=None)
|
|
|
|
__getip.encoding_convertto(str, enc)
|
|
|
|
end
|
|
|
|
alias encoding_convert_to encoding_convertto
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
class MultiTkIp
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
def encoding_table
|
|
|
|
@interp.encoding_table
|
|
|
|
end
|
|
|
|
|
|
|
|
def force_default_encoding=(mode)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
@interp.force_default_encoding = mode
|
2003-07-31 16:52:40 -04:00
|
|
|
end
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
def force_default_encoding?
|
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
@interp.force_default_encoding?
|
|
|
|
end
|
|
|
|
|
|
|
|
def default_encoding=(enc)
|
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
@interp.default_encoding = enc
|
|
|
|
end
|
|
|
|
|
2003-07-31 16:52:40 -04:00
|
|
|
def encoding=(enc)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp.encoding = enc
|
2003-07-31 16:52:40 -04:00
|
|
|
end
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
def encoding_name
|
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
@interp.encoding_name
|
|
|
|
end
|
|
|
|
def encoding_obj
|
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
|
|
|
@interp.encoding_obj
|
|
|
|
end
|
|
|
|
alias encoding encoding_name
|
|
|
|
alias default_encoding encoding_name
|
2004-05-01 12:09:54 -04:00
|
|
|
|
|
|
|
def encoding_convertfrom(str, enc=None)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp.encoding_convertfrom(str, enc)
|
2003-07-31 16:52:40 -04:00
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
alias encoding_convert_from encoding_convertfrom
|
2003-07-31 16:52:40 -04:00
|
|
|
|
2004-05-01 12:09:54 -04:00
|
|
|
def encoding_convertto(str, enc=None)
|
2005-11-18 03:39:29 -05:00
|
|
|
raise SecurityError, "no permission to manipulate" unless self.manipulable?
|
2004-05-01 12:09:54 -04:00
|
|
|
@interp.encoding_convertto(str, enc)
|
2003-07-31 16:52:40 -04:00
|
|
|
end
|
2004-05-01 12:09:54 -04:00
|
|
|
alias encoding_convert_to encoding_convertto
|
2003-07-31 16:52:40 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2003-08-29 04:34:14 -04:00
|
|
|
# remove methods for security
|
* 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
|
|
|
=begin
|
2003-08-29 04:34:14 -04:00
|
|
|
class MultiTkIp
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
INTERP_THREAD = @@DEFAULT_MASTER.instance_variable_get('@interp_thread')
|
|
|
|
INTERP_MUTEX = INTERP_THREAD[:mutex]
|
|
|
|
INTERP_ROOT_CHECK = INTERP_THREAD[:root_check]
|
|
|
|
|
2004-09-08 02:23:41 -04:00
|
|
|
# undef_method :instance_eval
|
2003-08-29 04:34:14 -04:00
|
|
|
undef_method :instance_variable_get
|
|
|
|
undef_method :instance_variable_set
|
|
|
|
end
|
2003-07-27 15:35:06 -04:00
|
|
|
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
module TkCore
|
2009-03-05 22:56:38 -05:00
|
|
|
if MultiTkIp::WITH_RUBY_VM &&
|
* ext/tk/*: full update Ruby/Tk to support Ruby(1.9|1.8) and Tc/Tk8.5.
* ext/tk/lib/tkextlib/tile.rb: [incompatible] remove TileWidgets'
instate/state/identify method to avoid the conflict with standard
widget options. Those methods are renamed to ttk_instate/ttk_state/
ttk_identify (tile_instate/tile_state/tile_identify are available
too). Although I don't recommend, if you realy need old methods,
please define "Tk::USE_OBSOLETE_TILE_STATE_METHOD = true" before
"require 'tkextlib/tile'".
* ext/tk/lib/tkextlib/tile.rb: "Tk::Tile::__Import_Tile_Widgets__!"
is obsolete. It outputs warning. To control default widget set,
use "Tk.default_widget_set = :Ttk".
* ext/tk/lib/tk.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__ method and
__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method are defind
as module methods of TkConfigMethod. It may help users to wrap old
Ruby/Tk scripts (use standard widgets) to force to use Ttk widgets.
Ttk widgets don't have some options of standard widgets which are
control the view of widgets. When set ignore-mode true, configure
method tries to ignoure such unknown options with no exception.
Of course, it may raise other troubles on the GUI design.
So, those are a little danger methods.
* ext/tk/lib/tk/itemconfig.rb: __IGNORE_UNKNOWN_CONFIGURE_OPTION__
method and __set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) method
are defind as module methods of TkItemConfigMethod as the same
purpose as TkConfigMethod's ones.
* ext/tk/sample/ttk_wrapper.rb: A new example. This is a tool for
wrapping old Ruby/Tk scripts (which use standard widgets) to use
Ttk (Tile) widgets as default.
* ext/tk/sample/tkextlib/tile/demo.rb: use ttk_instate/ttk_state
method instead of instate/state method.
* ext/tk/lib/tk/root, ext/tk/lib/tk/namespace.rb,
ext/tk/lib/tk/text.rb, ext/tk/lib/tkextlib/*: some 'instance_eval's
are replaced to "instance_exec(self)".
* ext/tk/lib/tk/event.rb: bug fix on KEY_TBL and PROC_TBL (?x is not
a character code on Ruby1.9).
* ext/tk/lib/tk/variable.rb: support new style of operation argument
on Tcl/Tk's 'trace' command for variables.
* ext/tk/sample/demos-jp/widget, ext/tk/sample/demos-en/widget: bug fix
* ext/tk/sammple/demos-jp/textpeer.rb,
ext/tk/sammple/demos-en/textpeer.rb: new widget demo.
* ext/tk/tcltklib.c: decrase SEGV troubles (probably)
* ext/tk/lib/tk.rb: remove Thread.critical access if Ruby1.9
* ext/tk/lib/tk/multi-tk.rb: support Ruby1.9 (probably)
* ext/tk/lib/tkextlib/tile.rb: add method to define Tcl/Tk command
to make Tcl/Tk theme sources (based on different version of Tile
extension) available.
(Tk::Tile::__define_LoadImages_proc_for_comaptibility__)
* ext/tk/lib/tk.rb, ext/tk/lib/tk/wm.rb: support dockable frames
(Tcl/Tk8.5 feature). 'wm' command can treat many kinds of widgets
as toplevel widgets.
* ext/tk/lib/tkextlib/tile/style.rb: ditto.
(Tk::Tile::Style.__define_wrapper_proc_for_compatibility__)
* ext/tk/lib/tk/font.rb: add actual_hash and metrics_hash to get
properties as a hash. metrics_hash method returns a boolean value
for 'fixed' option. But metrics method returns numeric value
(0 or 1) for 'fixed' option, because of backward compatibility.
* ext/tk/lib/tk/timer.rb: somtimes fail to set callback procedure.
* ext/tk/lib/tk.rb: add Tk.sleep and Tk.wakeup method. Tk.sleep
doesn't block the eventloop. It will be better to use the method
in event callbacks.
* ext/tk/sample/tksleep_sample.rb: sample script about Tk.sleep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-29 01:25:12 -04:00
|
|
|
! MultiTkIp::RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
|
|
|
|
INTERP_THREAD = MultiTkIp::INTERP_THREAD
|
|
|
|
INTERP_MUTEX = MultiTkIp::INTERP_MUTEX
|
|
|
|
INTERP_ROOT_CHECK = MultiTkIp::INTERP_ROOT_CHECK
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class MultiTkIp
|
|
|
|
remove_const(:INTERP_THREAD)
|
|
|
|
remove_const(:INTERP_MUTEX)
|
|
|
|
remove_const(:INTERP_ROOT_CHECK)
|
|
|
|
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
|
|
|
=end
|
2009-03-05 22:56:38 -05:00
|
|
|
if MultiTkIp::WITH_RUBY_VM &&
|
* 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
|
|
|
! MultiTkIp::RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!!
|
|
|
|
class MultiTkIp
|
|
|
|
INTERP_THREAD = @@DEFAULT_MASTER.instance_variable_get('@interp_thread')
|
|
|
|
INTERP_THREAD_STATUS = INTERP_THREAD[:status]
|
|
|
|
INTERP_MUTEX = INTERP_THREAD[:mutex]
|
|
|
|
INTERP_ROOT_CHECK = INTERP_THREAD[:root_check]
|
|
|
|
end
|
|
|
|
module TkCore
|
|
|
|
INTERP_THREAD = MultiTkIp::INTERP_THREAD
|
|
|
|
INTERP_THREAD_STATUS = MultiTkIp::INTERP_THREAD_STATUS
|
|
|
|
INTERP_MUTEX = MultiTkIp::INTERP_MUTEX
|
|
|
|
INTERP_ROOT_CHECK = MultiTkIp::INTERP_ROOT_CHECK
|
|
|
|
end
|
|
|
|
class MultiTkIp
|
|
|
|
remove_const(:INTERP_THREAD)
|
|
|
|
remove_const(:INTERP_THREAD_STATUS)
|
|
|
|
remove_const(:INTERP_MUTEX)
|
|
|
|
remove_const(:INTERP_ROOT_CHECK)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class MultiTkIp
|
|
|
|
# undef_method :instance_eval
|
|
|
|
undef_method :instance_variable_get
|
|
|
|
undef_method :instance_variable_set
|
|
|
|
end
|
2003-08-29 04:34:14 -04:00
|
|
|
# end of MultiTkIp definition
|
|
|
|
|
|
|
|
# defend against modification
|
2003-11-12 16:11:40 -05:00
|
|
|
#MultiTkIp.freeze
|
|
|
|
#TclTkLib.freeze
|
2003-07-27 15:35:06 -04:00
|
|
|
|
|
|
|
########################################
|
|
|
|
# start Tk which depends on MultiTkIp
|
|
|
|
module TkCore
|
|
|
|
INTERP = MultiTkIp
|
|
|
|
end
|
|
|
|
require 'tk'
|