From 5cd1282f21ad79859230978ac4eaf73f0853b0b4 Mon Sep 17 00:00:00 2001 From: nagai Date: Mon, 20 Dec 2004 05:10:59 +0000 Subject: * ext/tk/lib/multi-tk.rb: supports new features of Tcl/Tk8.5a2 * ext/tk/lib/tk/clock.rb: ditto * ext/tk/lib/tk/text.rb: ditto * ext/tk/lib/tk/panedwindow.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/tk/lib/multi-tk.rb | 80 +++++++++++++++++++++++++++++++++++++++++--- ext/tk/lib/tk/clock.rb | 10 ++++++ ext/tk/lib/tk/panedwindow.rb | 24 ++++++++++--- ext/tk/lib/tk/text.rb | 27 +++++++++++++++ 4 files changed, 133 insertions(+), 8 deletions(-) (limited to 'ext') diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb index 49bb49da9d..f44f576626 100644 --- a/ext/tk/lib/multi-tk.rb +++ b/ext/tk/lib/multi-tk.rb @@ -2056,7 +2056,7 @@ class MultiTkIp elsif slave.kind_of?(String) slave else - cmd_name.to_s + slave.to_s end end private :_slavearg @@ -2156,15 +2156,37 @@ class MultiTkIp end def invoke_hidden(slave, cmd, *args) - @interp._invoke('interp', 'invokehidden', _slavearg(slave), cmd, *args) + if args[-1].kind_of?(Hash) + keys = _symbolkey2str(args.pop) + else + keys = [] + end + if Tk::TCL_MAJOR_VERSION > 8 || + (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) + keys << '--' + end + keys << _slavearg(slave) << cmd + keys.concat(args) + @interp._invoke('interp', 'invokehidden', *keys) end def self.invoke_hidden(slave, cmd, *args) __getip.invoke_hidden(slave, cmd, *args) end def invoke_hidden_on_global(slave, cmd, *args) - @interp._invoke('interp', 'invokehidden', _slavearg(slave), - '-global', cmd, *args) + if args[-1].kind_of?(Hash) + keys = _symbolkey2str(args.pop) + else + keys = [] + end + keys << '-global' + if Tk::TCL_MAJOR_VERSION > 8 || + (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) + keys << '--' + end + keys << _slavearg(slave) << cmd + keys.concat(args) + @interp._invoke('interp', 'invokehidden', *keys) end def self.invoke_hidden_on_global(slave, cmd, *args) __getip.invoke_hidden_on_global(slave, cmd, *args) @@ -2179,6 +2201,56 @@ class MultiTkIp self end + def set_bgerror_handler(cmd = Proc.new, slave = nil, &b) + unless TkComm._callback_entry?(cmd) + unless slave + 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 = '') + procedure(@interp._invoke('interp', 'bgerror', _slavearg(slave))) + end + def self.bgerror(slave = '') + __getip.bgerror(slave) + end + + def set_limit(limit_type, slave = '', opts = {}) + @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) + if slot + num_or_str(@interp._invoke('interp', 'limit', _slavearg(slave), + limit_type, slot)) + else + l = @interp._split_tklist(@interp._invoke('interp', 'limit', + _slavearg(slave), limit_type)) + 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 + def recursion_limit(slave = '', limit = None) number(@interp._invoke('interp', 'recursionlimit', _slavearg(slave), limit)) diff --git a/ext/tk/lib/tk/clock.rb b/ext/tk/lib/tk/clock.rb index 823b8a6341..3581152c8b 100644 --- a/ext/tk/lib/tk/clock.rb +++ b/ext/tk/lib/tk/clock.rb @@ -5,6 +5,10 @@ require 'tk' module Tk module Clock + def self.add(clk, *args) + tk_call_without_enc('clock','add', clk, *args).to_i + end + def self.clicks(ms=nil) case ms when nil @@ -53,5 +57,11 @@ module Tk def self.seconds tk_call_without_enc('clock','seconds').to_i end + def self.milliseconds + tk_call_without_enc('clock','milliseconds').to_i + end + def self.microseconds + tk_call_without_enc('clock','microseconds').to_i + end end end diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb index 37be77508f..4932478ba0 100644 --- a/ext/tk/lib/tk/panedwindow.rb +++ b/ext/tk/lib/tk/panedwindow.rb @@ -110,6 +110,10 @@ class TkPanedWindow conf } else ret = {} @@ -149,14 +161,18 @@ class TkPanedWindow