From 5cd1282f21ad79859230978ac4eaf73f0853b0b4 Mon Sep 17 00:00:00 2001 From: nagai Date: Mon, 20 Dec 2004 05:10:59 +0000 Subject: [PATCH] * 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 --- ChangeLog | 32 ++++++++++----- 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 ++++++++++++ 5 files changed, 154 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ef3540fd7..4bed5789cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Mon Dec 20 14:07:02 2004 Hidetoshi NAGAI + + * 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 + Mon Dec 20 10:51:58 2004 Nobuyoshi Nakada * parse.y (special_local_set): prevent the parser object from GC. @@ -51,34 +61,34 @@ Fri Dec 17 16:28:12 2004 Hidetoshi NAGAI * ext/tk/lib/tk/event.rb: fix error on require process - * ext/tk/lib/font.rb: fix abnormal termination error on Windows + * ext/tk/lib/tk/font.rb: fix abnormal termination error on Windows * ext/tk/lib/tk/virtevent.rb: TkVirtualEvent::PreDefVirtEvent.new() accepts event-sequence arguments - * ext/tk/lib/text.rb: fail to dump embedded images + * ext/tk/lib/tk/text.rb: fail to dump embedded images - * ext/tk/lib/text.rb: tag_nextrange and tag_prevrange returns wrong + * ext/tk/lib/tk/text.rb: tag_nextrange and tag_prevrange returns wrong types of values - * ext/tk/lib/texttag.rb: nextrange and prevrange returns wrong + * ext/tk/lib/tk/texttag.rb: nextrange and prevrange returns wrong types of values - * ext/tk/lib/text.rb: add TkText::IndexModMethods module and + * ext/tk/lib/tk/text.rb: add TkText::IndexModMethods module and TkText::IndexString class to treat text index modifiers - * ext/tk/lib/texttag.rb: use TkText::IndexModMethods module + * ext/tk/lib/tk/texttag.rb: use TkText::IndexModMethods module - * ext/tk/lib/textmark.rb: ditto + * ext/tk/lib/tk/textmark.rb: ditto - * ext/tk/lib/textimage.rb: ditto + * ext/tk/lib/tk/textimage.rb: ditto - * ext/tk/lib/textwindow.rb: ditto + * ext/tk/lib/tk/textwindow.rb: ditto - * ext/tk/lib/textimage.rb: wrong gravity of text mark for embedded + * ext/tk/lib/tk/textimage.rb: wrong gravity of text mark for embedded image - * ext/tk/lib/textwindow.rb: wrong gravity of text mark for + * ext/tk/lib/tk/textwindow.rb: wrong gravity of text mark for embedded window Fri Dec 17 13:33:58 2004 Nobuyoshi Nakada 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