summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog32
-rw-r--r--ext/tk/lib/multi-tk.rb80
-rw-r--r--ext/tk/lib/tk/clock.rb10
-rw-r--r--ext/tk/lib/tk/panedwindow.rb24
-rw-r--r--ext/tk/lib/tk/text.rb27
5 files changed, 154 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index b02693f000..110d631c9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Mon Dec 20 14:07:02 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * 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 12:47:13 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/lib/net/https.rb,protocols.rb,telnets.rb: delete
@@ -96,34 +106,34 @@ Fri Dec 17 16:28:12 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* 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:50:00 2004 Akiyoshi, Masamichi (akiyoshi@hp.com)
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<TkWindow
conf = tk_split_list(tk_send_without_enc('paneconfigure',
win, "-#{key}"))
conf[0] = conf[0][1..-1]
+ if conf[0] == 'hide'
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ conf[4] = bool(conf[4]) unless conf[4].empty?
+ end
conf
else
tk_split_simplelist(tk_send_without_enc('paneconfigure',
@@ -117,14 +121,18 @@ class TkPanedWindow<TkWindow
conf = tk_split_simplelist(conflist)
conf[0] = conf[0][1..-1]
if conf[3]
- if conf[3].index('{')
+ if conf[0] == 'hide'
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ elsif conf[3].index('{')
conf[3] = tk_split_list(conf[3])
else
conf[3] = tk_tcl2ruby(conf[3])
end
end
if conf[4]
- if conf[4].index('{')
+ if conf[0] == 'hide'
+ conf[4] = bool(conf[4]) unless conf[4].empty?
+ elsif conf[4].index('{')
conf[4] = tk_split_list(conf[4])
else
conf[4] = tk_tcl2ruby(conf[4])
@@ -141,6 +149,10 @@ class TkPanedWindow<TkWindow
conf = tk_split_list(tk_send_without_enc('paneconfigure',
win, "-#{key}"))
key = conf.shift[1..-1]
+ if key == 'hide'
+ conf[2] = bool(conf[2]) unless conf[2].empty?
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ end
{ key => conf }
else
ret = {}
@@ -149,14 +161,18 @@ class TkPanedWindow<TkWindow
conf = tk_split_simplelist(conflist)
key = conf.shift[1..-1]
if key
- if conf[2].index('{')
+ if key == 'hide'
+ conf[2] = bool(conf[2]) unless conf[2].empty?
+ elsif conf[2].index('{')
conf[2] = tk_split_list(conf[2])
else
conf[2] = tk_tcl2ruby(conf[2])
end
end
if conf[3]
- if conf[3].index('{')
+ if key == 'hide'
+ conf[3] = bool(conf[3]) unless conf[3].empty?
+ elsif conf[3].index('{')
conf[3] = tk_split_list(conf[3])
else
conf[3] = tk_tcl2ruby(conf[3])
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index f99337b3e9..8069adc57a 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -477,6 +477,11 @@ class TkText<TkTextWin
info
end
+ def peer_names()
+ # Tk8.5 feature
+ list(tk_send_without_enc('peer', 'names'))
+ end
+
def replace(idx1, idx2, *opts)
tk_send('replace', idx1, idx2, *opts)
self
@@ -1373,3 +1378,25 @@ class TkText<TkTextWin
dump(['image'], *index, &block)
end
end
+
+#######################################
+
+class TkText::Peer < TkText
+ # Tk8.5 feature
+ def initialize(text, parent=nil, keys={})
+ unless text.kind_of?(TkText)
+ fail ArgumentError, "TkText is expected for 1st argument"
+ end
+ @src_text = text
+ super(parent, keys)
+ end
+
+ def create_self(keys)
+ if keys and keys != None
+ tk_call_without_enc(@src_text.path, 'peer', 'create', @path)
+ else
+ tk_call_without_enc(@src_text.path, 'peer', 'create', @path)
+ end
+ end
+ private :create_self
+end