ruby-changes:4527
From: ko1@a...
Date: Tue, 15 Apr 2008 00:18:22 +0900 (JST)
Subject: [ruby-changes:4527] nagai - Ruby:r16020 (ruby_1_8): * ext/tk/lib/tk/text.rb: typo. call a wrong method.
nagai 2008-04-15 00:17:52 +0900 (Tue, 15 Apr 2008)
New Revision: 16020
Modified files:
branches/ruby_1_8/ChangeLog
branches/ruby_1_8/ext/tk/lib/tk/font.rb
branches/ruby_1_8/ext/tk/lib/tk/itemconfig.rb
branches/ruby_1_8/ext/tk/lib/tk/itemfont.rb
branches/ruby_1_8/ext/tk/lib/tk/text.rb
branches/ruby_1_8/ext/tk/lib/tk/timer.rb
branches/ruby_1_8/ext/tk/lib/tk/toplevel.rb
branches/ruby_1_8/ext/tk/lib/tk.rb
branches/ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
branches/ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
branches/ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
branches/ruby_1_8/ext/tk/lib/tkextlib/tile/tpaned.rb
branches/ruby_1_8/ext/tk/lib/tkextlib/version.rb
branches/ruby_1_8/ext/tk/sample/tktextio.rb
branches/ruby_1_8/ext/tk/sample/ttk_wrapper.rb
Log:
* ext/tk/lib/tk/text.rb: typo. call a wrong method.
* ext/tk/lib/tk/itemconfig.rb: ditto.
* ext/tk/sample/ttk_wrapper.rb: bug fix.
* ext/tk/sample/tktextio.rb: add binding for 'Ctrl-u' at console mode.
* 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/tkextlib/iwidgets/scrolledcanvas.rb,
ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb,
ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb: bug fix.
* ext/tk/lib/tkextlib/tile/tpaned.rb: improve TPaned#add.
* ext/tk/lib/tk/timer.rb: add TkTimer#at_end(proc) to register the
procedure which called at end of the timer.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk/toplevel.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk/font.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk/timer.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk/itemfont.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/sample/tktextio.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tkextlib/tile/tpaned.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tkextlib/version.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk/text.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk/itemconfig.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/sample/ttk_wrapper.rb?r1=16020&r2=16019&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb?r1=16020&r2=16019&diff_format=u
Index: ruby_1_8/ext/tk/sample/ttk_wrapper.rb
===================================================================
--- ruby_1_8/ext/tk/sample/ttk_wrapper.rb (revision 16019)
+++ ruby_1_8/ext/tk/sample/ttk_wrapper.rb (revision 16020)
@@ -52,6 +52,15 @@
##########################################################################
+# define Tcl/Tk procedures for compatibility.
+# those are required when want to use themes included
+# in "sample/tkextlib/tile/demo.rb".
+##########################################################################
+Tk::Tile.__define_LoadImages_proc_for_compatibility__!
+Tk::Tile::Style.__define_wrapper_proc_for_compatibility__!
+
+
+##########################################################################
# use themes defined on the demo of Ttk (Tile) extension
##########################################################################
demodir = File.dirname(__FILE__)
@@ -92,15 +101,6 @@
##########################################################################
-# define Tcl/Tk procedures for compatibility.
-# those are required when want to use themes included
-# in "sample/tkextlib/tile/demo.rb".
-##########################################################################
-Tk::Tile.__define_LoadImages_proc_for_compatibility__!
-Tk::Tile::Style.__define_wrapper_proc_for_compatibility__!
-
-
-##########################################################################
# ignore unsupported options of Ttk widgets
##########################################################################
TkConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__! true
Index: ruby_1_8/ext/tk/sample/tktextio.rb
===================================================================
--- ruby_1_8/ext/tk/sample/tktextio.rb (revision 16019)
+++ ruby_1_8/ext/tk/sample/tktextio.rb (revision 16020)
@@ -254,7 +254,15 @@
Tk.callback_break
end
end
- private :_cb_up, :_cb_down, :_cb_left, :_cb_backspace, :_cb_ctrl_a
+ def _cb_ctrl_u
+ if @console_mode
+ mark_set('insert', @ins_head)
+ delete('insert', 'insert lineend')
+ Tk.callback_break
+ end
+ end
+ private :_cb_up, :_cb_down, :_cb_left, :_cb_backspace,
+ :_cb_ctrl_a, :_cb_ctrl_u
def _setup_console_bindings
@bindtag = TkBindTag.new
@@ -328,6 +336,8 @@
@bindtag.bind('Home'){ _cb_ctrl_a }
@bindtag.bind('Control-a'){ _cb_ctrl_a }
+
+ @bindtag.bind('Control-u'){ _cb_ctrl_u }
end
private :_setup_console_bindings
Index: ruby_1_8/ext/tk/lib/tk.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tk.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tk.rb (revision 16020)
@@ -3217,7 +3217,13 @@
next
else
fnt = hash_kv(fnt) if fnt.kind_of?(Hash)
- tk_call(*(__config_cmd << "-#{optkey}" << fnt))
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << fnt))
+ rescue => e
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ fail e
+ end
+ end
end
end
next
@@ -3271,7 +3277,13 @@
fobj = fontobj # create a new TkFont object
else
ltn = hash_kv(ltn) if ltn.kind_of?(Hash)
- tk_call(*(__config_cmd << "-#{optkey}" << ltn))
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << ltn))
+ rescue => e
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ fail e
+ end
+ end
next
end
@@ -3323,7 +3335,13 @@
fobj = fontobj # create a new TkFont object
else
knj = hash_kv(knj) if knj.kind_of?(Hash)
- tk_call(*(__config_cmd << "-#{optkey}" << knj))
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << knj))
+ rescue => e
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ fail e
+ end
+ end
next
end
@@ -5323,7 +5341,7 @@
#Tk.freeze
module Tk
- RELEASE_DATE = '2008-04-02'.freeze
+ RELEASE_DATE = '2008-04-13'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
Index: ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb (revision 16020)
@@ -37,7 +37,7 @@
end
def method_missing(id, *args)
- if @canvas.methods.include?(id.id2name)
+ if @canvas.respond_to?(id)
@canvas.__send__(id, *args)
else
super(id, *args)
Index: ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb (revision 16020)
@@ -42,7 +42,7 @@
end
def method_missing(id, *args)
- if @listbox.methods.include?(id.id2name)
+ if @listbox.respond_to?(id)
@listbox.__send__(id, *args)
else
super(id, *args)
Index: ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb (revision 16020)
@@ -37,7 +37,7 @@
end
def method_missing(id, *args)
- if @text.methods.include?(id.id2name)
+ if @text.respond_to?(id)
@text.__send__(id, *args)
else
super(id, *args)
Index: ruby_1_8/ext/tk/lib/tkextlib/version.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tkextlib/version.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tkextlib/version.rb (revision 16020)
@@ -2,5 +2,5 @@
# release date of tkextlib
#
module Tk
- Tkextlib_RELEASE_DATE = '2008-03-29'.freeze
+ Tkextlib_RELEASE_DATE = '2008-04-14'.freeze
end
Index: ruby_1_8/ext/tk/lib/tkextlib/tile/tpaned.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tkextlib/tile/tpaned.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tkextlib/tile/tpaned.rb (revision 16020)
@@ -36,9 +36,21 @@
[self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.')
end
- def add(win, keys)
- win = _epath(win)
- tk_send_without_enc('add', win, *hash_kv(keys))
+ def add(*args)
+ keys = args.pop
+ fail ArgumentError, "no window in arguments" unless keys
+
+ if keys && keys.kind_of?(Hash)
+ fail ArgumentError, "no window in arguments" if args == []
+ opts = hash_kv(keys)
+ else
+ args.push(keys) if keys
+ opts = []
+ end
+
+ args.each{|win|
+ tk_send_without_enc('add', _epath(win), *opts)
+ }
self
end
Index: ruby_1_8/ext/tk/lib/tk/timer.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tk/timer.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tk/timer.rb (revision 16020)
@@ -111,7 +111,8 @@
if @running == false || @proc_max == 0 || @do_loop == 0
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
if @current_pos >= @proc_max
@@ -120,7 +121,8 @@
else
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
end
@@ -151,6 +153,8 @@
@wait_var = TkVariable.new(0)
+ @at_end_proc = nil
+
@cb_cmd = TkCore::INTERP.get_cb_entry(self.method(:do_callback))
@set_next = true
@@ -210,6 +214,12 @@
attr_accessor :loop_exec
+ def __at_end__
+ @at_end_proc.call(self) if @at_end_proc
+ @wait_var.value = 0 # for wait
+ end
+ private :__at_end__
+
def cb_call
@cb_cmd.call
end
@@ -427,7 +437,8 @@
def cancel
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
tk_call 'after', 'cancel', @after_id if @after_id
@after_id = nil
@@ -471,6 +482,21 @@
end
end
+ def at_end(*arg, &b)
+ if arg.empty?
+ if b
+ @at_end_proc = b
+ else
+ # no proc
+ return @at_end_proc
+ end
+ else
+ fail ArgumentError, "wrong number of arguments" if arg.length != 1 || b
+ @at_end_proc = arg[0]
+ end
+ self
+ end
+
def wait(on_thread = true, check_root = false)
if $SAFE >= 4
fail SecurityError, "can't wait timer at $SAFE >= 4"
@@ -569,7 +595,8 @@
if @running == false || @proc_max == 0 || @do_loop == 0
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
if @current_pos >= @proc_max
@@ -578,7 +605,8 @@
else
Tk_CBTBL.delete(@id) ;# for GC
@running = false
- @wait_var.value = 0
+ # @wait_var.value = 0
+ __at_end__
return
end
end
Index: ruby_1_8/ext/tk/lib/tk/toplevel.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tk/toplevel.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tk/toplevel.rb (revision 16020)
@@ -72,7 +72,7 @@
conf_methods = _symbolkey2str(__methodcall_optkeys())
- keys.each{|k,v|
+ keys.each{|k,v| # k is a String
if conf_methods.key?(k)
wm_cmds[conf_methods[k]] = v
elsif Wm.method_defined?(k)
Index: ruby_1_8/ext/tk/lib/tk/text.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tk/text.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tk/text.rb (revision 16020)
@@ -36,10 +36,10 @@
itemconfigure(['tag', tagOrId], slot, value)
end
def tag_configinfo(tagOrId, slot=nil)
- itemconfigure(['tag', tagOrId], slot)
+ itemconfiginfo(['tag', tagOrId], slot)
end
def current_tag_configinfo(tagOrId, slot=nil)
- itemconfigure(['tag', tagOrId], slot)
+ current_itemconfiginfo(['tag', tagOrId], slot)
end
def window_cget(tagOrId, option)
@@ -49,10 +49,10 @@
itemconfigure(['window', tagOrId], slot, value)
end
def window_configinfo(tagOrId, slot=nil)
- itemconfigure(['window', tagOrId], slot)
+ itemconfiginfo(['window', tagOrId], slot)
end
def current_window_configinfo(tagOrId, slot=nil)
- itemconfigure(['window', tagOrId], slot)
+ current_itemconfiginfo(['window', tagOrId], slot)
end
private :itemcget, :itemconfigure
Index: ruby_1_8/ext/tk/lib/tk/itemfont.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tk/itemfont.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tk/itemfont.rb (revision 16020)
@@ -94,7 +94,13 @@
*(__item_config_cmd(tagid(tagOrId)) << {}))
next
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ rescue => e
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ fail e
+ end
+ end
end
end
next
@@ -147,7 +153,13 @@
elsif Tk::JAPANIZED_TK
fobj = fontobj # create a new TkFont object
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ rescue => e
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ fail e
+ end
+ end
next
end
@@ -198,7 +210,13 @@
elsif Tk::JAPANIZED_TK
fobj = fontobj # create a new TkFont object
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ rescue => e
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ fail e
+ end
+ end
next
end
Index: ruby_1_8/ext/tk/lib/tk/itemconfig.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tk/itemconfig.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tk/itemconfig.rb (revision 16020)
@@ -242,7 +242,7 @@
__itemcget_core(tagOrId, option)
rescue => e
begin
- __itemconfiginfo_core(tagOrId)
+ __itemcget_core(tagOrId)
# not tag error -> option is unknown
nil
rescue
@@ -319,8 +319,9 @@
def __check_available_itemconfigure_options(tagOrId, keys)
id = tagid(tagOrId)
- availables = self.current_itemconfiginfo(id).keys
+ availables = self.__current_itemconfiginfo(id).keys
+
# add non-standard keys
availables |= __font_optkeys.map{|k|
[k.to_s, "latin#{k}", "ascii#{k}", "kanji#{k}"]
@@ -329,6 +330,7 @@
availables |= __item_keyonly_optkeys(id).keys.map{|k| k.to_s}
keys = _symbolkey2str(keys)
+
keys.delete_if{|k, v| !(availables.include?(k))}
end
@@ -340,7 +342,7 @@
begin
__itemconfigure_core(tagOrId, slot)
rescue
- slot = __check_available_configure_options(tagOrId, slot)
+ slot = __check_available_itemconfigure_options(tagOrId, slot)
__itemconfigure_core(tagOrId, slot) unless slot.empty?
end
else
@@ -349,6 +351,7 @@
rescue => e
begin
__itemconfiginfo_core(tagOrId)
+ # not tag error -> option is unknown
rescue
fail e # tag error
end
@@ -1125,7 +1128,7 @@
end
end
- def current_itemconfiginfo(tagOrId, slot = nil)
+ def __current_itemconfiginfo(tagOrId, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
org_slot = slot
@@ -1147,6 +1150,7 @@
ret[conf[0]] = conf[-1]
end
}
+
ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
@@ -1157,4 +1161,8 @@
ret
end
end
+
+ def current_itemconfiginfo(tagOrId, slot = nil)
+ __current_itemconfiginfo(tagOrId, slot)
+ end
end
Index: ruby_1_8/ext/tk/lib/tk/font.rb
===================================================================
--- ruby_1_8/ext/tk/lib/tk/font.rb (revision 16019)
+++ ruby_1_8/ext/tk/lib/tk/font.rb (revision 16020)
@@ -1056,7 +1056,13 @@
keys = _symbolkey2str(args.pop).update(fontslot)
args.concat(hash_kv(keys))
- tk_call(*args)
+ begin
+ tk_call(*args)
+ rescue => e
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ fail e
+ end
+ end
Tk_FontUseTBL.mutex.synchronize{
Tk_FontUseTBL[[win, tag, optkey].join(';')] = self
}
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog (revision 16019)
+++ ruby_1_8/ChangeLog (revision 16020)
@@ -1,3 +1,25 @@
+Tue Apr 15 00:15:29 2008 Hidetoshi NAGAI <nagai@a...>
+
+ * ext/tk/lib/tk/text.rb: typo. call a wrong method.
+
+ * ext/tk/lib/tk/itemconfig.rb: ditto.
+
+ * ext/tk/sample/ttk_wrapper.rb: bug fix.
+
+ * ext/tk/sample/tktextio.rb: add binding for 'Ctrl-u' at console mode.
+
+ * 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/tkextlib/iwidgets/scrolledcanvas.rb,
+ ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb,
+ ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb: bug fix.
+
+ * ext/tk/lib/tkextlib/tile/tpaned.rb: improve TPaned#add.
+
+ * ext/tk/lib/tk/timer.rb: add TkTimer#at_end(proc) to register the
+ procedure which called at end of the timer.
+
Mon Apr 14 19:54:21 2008 Akinori MUSHA <knu@i...>
* array.c (rb_ary_flatten, rb_ary_flatten_bang): Take an optional
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/