Skip to content
Browse files

Merge from ruby_1_8. Add files that have not been added yet.

git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@16554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 4c3ee18 commit 08df734c4aeb22311a55e3c6e8d96d9b0a3b747a @knu knu committed
Showing with 4,788 additions and 712 deletions.
  1. +27 −0 ChangeLog
  2. +3 −0 Makefile.in
  3. +3 −4 class.c
  4. +3 −0 common.mk
  5. +6 −0 configure.in
  6. +10 −6 ext/extmk.rb
  7. +1 −1 ext/tk/lib/multi-tk.rb
  8. +100 −23 ext/tk/lib/tk.rb
  9. +9 −0 ext/tk/lib/tk/canvas.rb
  10. +3 −0 ext/tk/lib/tk/canvastag.rb
  11. +52 −0 ext/tk/lib/tk/composite.rb
  12. +18 −1 ext/tk/lib/tk/image.rb
  13. +52 −5 ext/tk/lib/tk/itemconfig.rb
  14. +21 −12 ext/tk/lib/tk/itemfont.rb
  15. +10 −3 ext/tk/lib/tk/menu.rb
  16. +14 −0 ext/tk/lib/tk/namespace.rb
  17. +22 −1 ext/tk/lib/tk/panedwindow.rb
  18. +31 −3 ext/tk/lib/tk/text.rb
  19. +4 −0 ext/tk/lib/tk/textimage.rb
  20. +3 −0 ext/tk/lib/tk/texttag.rb
  21. +3 −0 ext/tk/lib/tk/textwindow.rb
  22. +98 −3 ext/tk/lib/tkextlib/blt/component.rb
  23. +1 −0 ext/tk/lib/tkextlib/blt/htext.rb
  24. +15 −2 ext/tk/lib/tkextlib/blt/table.rb
  25. +4 −0 ext/tk/lib/tkextlib/blt/tabset.rb
  26. +5 −2 ext/tk/lib/tkextlib/blt/ted.rb
  27. +22 −2 ext/tk/lib/tkextlib/blt/treeview.rb
  28. +8 −2 ext/tk/lib/tkextlib/blt/unix_dnd.rb
  29. +18 −1 ext/tk/lib/tkextlib/blt/watch.rb
  30. +7 −0 ext/tk/lib/tkextlib/bwidget/dialog.rb
  31. +7 −0 ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
  32. +3 −0 ext/tk/lib/tkextlib/bwidget/listbox.rb
  33. +11 −0 ext/tk/lib/tkextlib/bwidget/messagedlg.rb
  34. +3 −0 ext/tk/lib/tkextlib/bwidget/tree.rb
  35. +11 −1 ext/tk/lib/tkextlib/bwidget/widget.rb
  36. +3 −2 ext/tk/lib/tkextlib/iwidgets/buttonbox.rb
  37. +3 −2 ext/tk/lib/tkextlib/iwidgets/checkbox.rb
  38. +3 −2 ext/tk/lib/tkextlib/iwidgets/dialogshell.rb
  39. +3 −2 ext/tk/lib/tkextlib/iwidgets/menubar.rb
  40. +3 −2 ext/tk/lib/tkextlib/iwidgets/messagebox.rb
  41. +3 −2 ext/tk/lib/tkextlib/iwidgets/notebook.rb
  42. +3 −2 ext/tk/lib/tkextlib/iwidgets/panedwindow.rb
  43. +3 −2 ext/tk/lib/tkextlib/iwidgets/radiobox.rb
  44. +22 −1 ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
  45. +3 −2 ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb
  46. +3 −2 ext/tk/lib/tkextlib/iwidgets/tabset.rb
  47. +4 −1 ext/tk/lib/tkextlib/tcllib/getstring.rb
  48. +4 −1 ext/tk/lib/tkextlib/tcllib/swaplist.rb
  49. +14 −2 ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
  50. +13 −1 ext/tk/lib/tkextlib/tile/dialog.rb
  51. +5 −0 ext/tk/lib/tkextlib/tile/tentry.rb
  52. +23 −1 ext/tk/lib/tkextlib/tile/tnotebook.rb
  53. +24 −1 ext/tk/lib/tkextlib/tile/tpaned.rb
  54. +56 −4 ext/tk/lib/tkextlib/tile/treeview.rb
  55. +11 −2 ext/tk/lib/tkextlib/tktable/tktable.rb
  56. +55 −2 ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
  57. +1 −1 ext/tk/lib/tkextlib/version.rb
  58. +4 −0 ext/tk/lib/tkextlib/vu/pie.rb
  59. +6 −4 ext/tk/sample/demos-en/anilabel.rb
  60. +5 −3 ext/tk/sample/demos-en/aniwave.rb
  61. +5 −3 ext/tk/sample/demos-en/arrow.rb
  62. +12 −10 ext/tk/sample/demos-en/bind.rb
  63. +6 −4 ext/tk/sample/demos-en/bitmap.rb
  64. +1 −1 ext/tk/sample/demos-en/button.rb
  65. +8 −6 ext/tk/sample/demos-en/check.rb
  66. +8 −6 ext/tk/sample/demos-en/check2.rb
  67. +16 −6 ext/tk/sample/demos-en/clrpick.rb
  68. +14 −4 ext/tk/sample/demos-en/colors.rb
  69. +96 −0 ext/tk/sample/demos-en/combo.rb
  70. +8 −6 ext/tk/sample/demos-en/cscroll.rb
  71. +5 −3 ext/tk/sample/demos-en/ctext.rb
  72. +7 −5 ext/tk/sample/demos-en/entry1.rb
  73. +5 −3 ext/tk/sample/demos-en/entry2.rb
  74. +34 −14 ext/tk/sample/demos-en/entry3.rb
  75. +11 −6 ext/tk/sample/demos-en/filebox.rb
  76. +8 −6 ext/tk/sample/demos-en/floor.rb
  77. +8 −6 ext/tk/sample/demos-en/floor2.rb
  78. +5 −3 ext/tk/sample/demos-en/form.rb
  79. +15 −8 ext/tk/sample/demos-en/goldberg.rb
  80. +15 −14 ext/tk/sample/demos-en/hscale.rb
  81. +13 −7 ext/tk/sample/demos-en/icon.rb
  82. +9 −4 ext/tk/sample/demos-en/image1.rb
  83. +12 −10 ext/tk/sample/demos-en/image2.rb
  84. +16 −13 ext/tk/sample/demos-en/image3.rb
  85. +5 −3 ext/tk/sample/demos-en/items.rb
  86. +271 −0 ext/tk/sample/demos-en/knightstour.rb
  87. +8 −5 ext/tk/sample/demos-en/label.rb
  88. +5 −3 ext/tk/sample/demos-en/labelframe.rb
  89. +117 −0 ext/tk/sample/demos-en/mclist.rb
  90. +7 −5 ext/tk/sample/demos-en/menu.rb
  91. +5 −3 ext/tk/sample/demos-en/menu84.rb
  92. +6 −4 ext/tk/sample/demos-en/menubu.rb
  93. +6 −4 ext/tk/sample/demos-en/msgbox.rb
  94. +91 −0 ext/tk/sample/demos-en/msgbox2.rb
  95. +8 −6 ext/tk/sample/demos-en/paned1.rb
  96. +5 −3 ext/tk/sample/demos-en/paned2.rb
  97. +6 −4 ext/tk/sample/demos-en/pendulum.rb
  98. +5 −3 ext/tk/sample/demos-en/plot.rb
  99. +23 −9 ext/tk/sample/demos-en/puzzle.rb
  100. +7 −5 ext/tk/sample/demos-en/radio.rb
  101. +10 −7 ext/tk/sample/demos-en/radio2.rb
  102. +11 −8 ext/tk/sample/demos-en/radio3.rb
  103. +5 −3 ext/tk/sample/demos-en/ruler.rb
  104. +5 −3 ext/tk/sample/demos-en/sayings.rb
  105. +7 −5 ext/tk/sample/demos-en/search.rb
  106. +7 −5 ext/tk/sample/demos-en/spin.rb
  107. +5 −3 ext/tk/sample/demos-en/states.rb
  108. +5 −3 ext/tk/sample/demos-en/style.rb
  109. +5 −3 ext/tk/sample/demos-en/text.rb
  110. +9 −5 ext/tk/sample/demos-en/textpeer.rb
  111. +128 −0 ext/tk/sample/demos-en/toolbar.rb
  112. +119 −0 ext/tk/sample/demos-en/tree.rb
  113. +139 −0 ext/tk/sample/demos-en/ttkbut.rb
  114. +85 −0 ext/tk/sample/demos-en/ttkmenu.rb
  115. +89 −0 ext/tk/sample/demos-en/ttknote.rb
  116. +213 −0 ext/tk/sample/demos-en/ttkpane.rb
  117. +66 −0 ext/tk/sample/demos-en/ttkprogress.rb
  118. +5 −3 ext/tk/sample/demos-en/twind.rb
  119. +4 −2 ext/tk/sample/demos-en/twind2.rb
  120. +8 −6 ext/tk/sample/demos-en/unicodeout.rb
  121. +15 −13 ext/tk/sample/demos-en/vscale.rb
  122. +141 −40 ext/tk/sample/demos-en/widget
  123. +6 −4 ext/tk/sample/demos-jp/anilabel.rb
  124. +5 −3 ext/tk/sample/demos-jp/aniwave.rb
  125. +5 −3 ext/tk/sample/demos-jp/arrow.rb
  126. +12 −10 ext/tk/sample/demos-jp/bind.rb
  127. +6 −4 ext/tk/sample/demos-jp/bitmap.rb
  128. +2 −1 ext/tk/sample/demos-jp/button.rb
  129. +8 −6 ext/tk/sample/demos-jp/check.rb
  130. +8 −6 ext/tk/sample/demos-jp/check2.rb
  131. +14 −6 ext/tk/sample/demos-jp/clrpick.rb
  132. +14 −4 ext/tk/sample/demos-jp/colors.rb
  133. +98 −0 ext/tk/sample/demos-jp/combo.rb
  134. +8 −6 ext/tk/sample/demos-jp/cscroll.rb
  135. +5 −3 ext/tk/sample/demos-jp/ctext.rb
  136. +7 −5 ext/tk/sample/demos-jp/entry1.rb
  137. +5 −3 ext/tk/sample/demos-jp/entry2.rb
  138. +34 −14 ext/tk/sample/demos-jp/entry3.rb
  139. +11 −6 ext/tk/sample/demos-jp/filebox.rb
  140. +8 −6 ext/tk/sample/demos-jp/floor.rb
  141. +8 −6 ext/tk/sample/demos-jp/floor2.rb
  142. +5 −3 ext/tk/sample/demos-jp/form.rb
  143. +15 −8 ext/tk/sample/demos-jp/goldberg.rb
  144. +14 −13 ext/tk/sample/demos-jp/hscale.rb
  145. +13 −7 ext/tk/sample/demos-jp/icon.rb
  146. +9 −4 ext/tk/sample/demos-jp/image1.rb
  147. +13 −10 ext/tk/sample/demos-jp/image2.rb
  148. +10 −7 ext/tk/sample/demos-jp/image3.rb
  149. +5 −3 ext/tk/sample/demos-jp/items.rb
  150. +273 −0 ext/tk/sample/demos-jp/knightstour.rb
  151. +8 −5 ext/tk/sample/demos-jp/label.rb
  152. +5 −3 ext/tk/sample/demos-jp/labelframe.rb
  153. +121 −0 ext/tk/sample/demos-jp/mclist.rb
  154. +9 −5 ext/tk/sample/demos-jp/menu.rb
  155. +5 −3 ext/tk/sample/demos-jp/menu84.rb
  156. +7 −5 ext/tk/sample/demos-jp/menu8x.rb
  157. +6 −4 ext/tk/sample/demos-jp/menubu.rb
  158. +8 −6 ext/tk/sample/demos-jp/msgbox.rb
  159. +90 −0 ext/tk/sample/demos-jp/msgbox2.rb
  160. +8 −6 ext/tk/sample/demos-jp/paned1.rb
  161. +5 −3 ext/tk/sample/demos-jp/paned2.rb
  162. +6 −4 ext/tk/sample/demos-jp/pendulum.rb
  163. +5 −3 ext/tk/sample/demos-jp/plot.rb
  164. +23 −9 ext/tk/sample/demos-jp/puzzle.rb
  165. +7 −5 ext/tk/sample/demos-jp/radio.rb
  166. +10 −7 ext/tk/sample/demos-jp/radio2.rb
  167. +11 −8 ext/tk/sample/demos-jp/radio3.rb
  168. +5 −3 ext/tk/sample/demos-jp/ruler.rb
  169. +5 −3 ext/tk/sample/demos-jp/sayings.rb
  170. +7 −5 ext/tk/sample/demos-jp/search.rb
  171. +8 −6 ext/tk/sample/demos-jp/spin.rb
  172. +5 −3 ext/tk/sample/demos-jp/states.rb
  173. +4 −3 ext/tk/sample/demos-jp/style.rb
  174. +5 −3 ext/tk/sample/demos-jp/text.rb
  175. +9 −5 ext/tk/sample/demos-jp/textpeer.rb
  176. +136 −0 ext/tk/sample/demos-jp/toolbar.rb
  177. +120 −0 ext/tk/sample/demos-jp/tree.rb
  178. +145 −0 ext/tk/sample/demos-jp/ttkbut.rb
  179. +91 −0 ext/tk/sample/demos-jp/ttkmenu.rb
  180. +97 −0 ext/tk/sample/demos-jp/ttknote.rb
  181. +216 −0 ext/tk/sample/demos-jp/ttkpane.rb
  182. +71 −0 ext/tk/sample/demos-jp/ttkprogress.rb
  183. +4 −2 ext/tk/sample/demos-jp/twind.rb
  184. +4 −2 ext/tk/sample/demos-jp/twind2.rb
  185. +8 −6 ext/tk/sample/demos-jp/unicodeout.rb
  186. +15 −14 ext/tk/sample/demos-jp/vscale.rb
Sorry, we could not display the entire diff because it was too big.
View
27 ChangeLog
@@ -1,3 +1,30 @@
+Fri May 23 13:46:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (cflags): commit miss.
+
+Fri May 23 09:52:21 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (MINIRUBY), common.mk (RUBYOPT): add purelib.rb.
+ [ruby-core:16642]
+
+ * ext/extmk.rb: load purelib.rb only when not cross compiling.
+
+Fri May 23 04:22:19 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
+
+ * ext/tk/tcltklib.c, ext/tk/tkutil/tkutil.c: fix memory leak.
+
+ * ext/tk/lib/tk.rb: avoid trouble when finalize TclTkIp.
+
+ * ext/tk/lib/tk.rb, ext/tk/lib/tk/*: help to fix troubles when
+ use Ttk widgets on old Tk scripts.
+
+ * ext/tk/sample/*: update and add demo stcipts. some of them are
+ introduction about new features of Tcl/Tk8.5.
+
+Fri May 23 03:48:10 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * class.c (clone_method): Just use ruby_cref as cref.
+
Fri May 23 01:03:23 2008 Akinori MUSHA <knu@iDaemons.org>
* class.c (rb_singleton_class_clone): Pass Qnil, not 0.
View
3 Makefile.in
@@ -35,6 +35,9 @@ RIDATADIR = $(DESTDIR)$(datadir)/ri/$(MAJOR).$(MINOR)/system
empty =
OUTFLAG = @OUTFLAG@$(empty)
CFLAGS = @CFLAGS@ @XCFLAGS@ @ARCH_FLAG@
+cflags = @cflags@
+optflags = @optflags@
+debugflags = @debugflags@
CPPFLAGS = -I. -I$(srcdir) @CPPFLAGS@
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
EXTLDFLAGS =
View
7 class.c
@@ -57,19 +57,18 @@ clone_method(mid, body, nklass)
NODE *fbody = body->nd_body;
if (fbody) {
- NODE *cref = NEW_NODE(NODE_CREF, nklass, 0, 0);
VALUE nbody;
switch (nd_type(fbody)) {
case NODE_SCOPE:
- fbody = rb_copy_node_scope(fbody, cref);
+ fbody = rb_copy_node_scope(fbody, ruby_cref);
break;
case NODE_BMETHOD:
- nbody = rb_block_dup(fbody->nd_cval, nklass, (VALUE)cref);
+ nbody = rb_block_dup(fbody->nd_cval, nklass, (VALUE)ruby_cref);
fbody = NEW_BMETHOD(nbody);
break;
case NODE_DMETHOD:
- nbody = rb_method_dup(fbody->nd_cval, nklass, (VALUE)cref);
+ nbody = rb_method_dup(fbody->nd_cval, nklass, (VALUE)ruby_cref);
fbody = NEW_DMETHOD(nbody);
break;
}
View
3 common.mk
@@ -113,6 +113,9 @@ install-local: pre-install-local do-install-local post-install-local
pre-install-local:: pre-install-bin pre-install-lib pre-install-man
do-install-local:
$(MINIRUBY) $(srcdir)/instruby.rb --make="$(MAKE)" $(INSTRUBY_ARGS) --install=local --mantype="$(MANTYPE)"
+loadpath: $(PREP)
+ $(MINIRUBY) -e 'p $$:'
+
post-install-local:: post-install-bin post-install-lib post-install-man
install-ext: pre-install-ext do-install-ext post-install-ext
View
6 configure.in
@@ -1635,6 +1635,12 @@ case "$build_os" in
esac
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
+test -z "$CFLAGS" || CFLAGS="$CFLAGS "; CFLAGS="$CFLAGS"'${cflags}'
+test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
+AC_SUBST(cppflags, [])dnl
+AC_SUBST(cflags, ['${optflags} ${debugflags}'])dnl
+AC_SUBST(optflags)dnl
+AC_SUBST(debugflags)dnl
AC_SUBST(XCFLAGS)dnl
AC_SUBST(XLDFLAGS)dnl
AC_SUBST(LIBRUBY_LDSHARED)
View
16 ext/extmk.rb
@@ -298,7 +298,7 @@ def parse_args()
$mflags.unshift(*rest) unless rest.empty?
def $mflags.set?(flag)
- grep(/\A-(?!-).*#{'%c' % flag}/i) { return true }
+ grep(/\A-(?!-).*#{flag.chr}/i) { return true }
false
end
def $mflags.defined?(var)
@@ -354,12 +354,16 @@ def $mflags.defined?(var)
else
$ruby = '$(topdir)/miniruby' + EXEEXT
end
-$ruby << " -I'$(topdir)' -I'$(top_srcdir)/lib'"
-$ruby << " -I'$(extout)/$(arch)' -I'$(extout)/common'" if $extout
-$ruby << " -I'$(top_srcdir)/ext' -rpurelib.rb"
+$ruby << " -I'$(topdir)'"
+unless CROSS_COMPILING
+ $ruby << " -I'$(top_srcdir)/lib'"
+ $ruby << " -I'$(extout)/$(arch)' -I'$(extout)/common'" if $extout
+ $ruby << " -I./- -I'$(top_srcdir)/ext' -rpurelib.rb"
+ ENV["RUBYLIB"] = "-"
+ ENV["RUBYOPT"] = "-rpurelib.rb"
+end
$config_h = '$(topdir)/config.h'
-ENV["RUBYLIB"] = "-"
-ENV["RUBYOPT"] = "-rpurelib.rb"
+$mflags << "ruby=#$ruby"
MTIMES = [__FILE__, 'rbconfig.rb', srcdir+'/lib/mkmf.rb'].collect {|f| File.mtime(f)}
View
2 ext/tk/lib/multi-tk.rb
@@ -2431,7 +2431,7 @@ class MultiTkIp
def mainloop(check_root = true, restart_on_dead = true)
raise SecurityError, "no permission to manipulate" unless self.manipulable?
- unless WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
+ if WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!!
return @interp_thread.value if @interp_thread
end
View
123 ext/tk/lib/tk.rb
@@ -1298,7 +1298,7 @@ def INTERP.init_ip_internal
}) << ' %W')
INTERP.add_tk_procs(TclTkLib::FINALIZE_PROC_NAME, '',
- "bind all <#{WIDGET_DESTROY_HOOK}> {}")
+ "catch { bind all <#{WIDGET_DESTROY_HOOK}> {} }")
INTERP.add_tk_procs('rb_out', 'ns args', <<-'EOL')
if [regexp {^::} $ns] {
@@ -3245,11 +3245,13 @@ def font_configure(slot)
next
else
fnt = hash_kv(fnt) if fnt.kind_of?(Hash)
- begin
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
tk_call(*(__config_cmd << "-#{optkey}" << fnt))
- rescue => e
- unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
- fail e
+ else
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << fnt))
+ rescue
+ # ignore
end
end
end
@@ -3305,11 +3307,13 @@ def latinfont_configure(ltn, keys=nil)
fobj = fontobj # create a new TkFont object
else
ltn = hash_kv(ltn) if ltn.kind_of?(Hash)
- begin
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
tk_call(*(__config_cmd << "-#{optkey}" << ltn))
- rescue => e
- unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
- fail e
+ else
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << ltn))
+ rescue => e
+ # ignore
end
end
next
@@ -3363,11 +3367,13 @@ def kanjifont_configure(knj, keys=nil)
fobj = fontobj # create a new TkFont object
else
knj = hash_kv(knj) if knj.kind_of?(Hash)
- begin
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
tk_call(*(__config_cmd << "-#{optkey}" << knj))
- rescue => e
- unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
- fail e
+ else
+ begin
+ tk_call(*(__config_cmd << "-#{optkey}" << knj))
+ rescue => e
+ # ignore
end
end
next
@@ -3499,6 +3505,11 @@ def __configinfo_struct
end
private :__configinfo_struct
+ def __optkey_aliases
+ {}
+ end
+ private :__optkey_aliases
+
def __numval_optkeys
[]
end
@@ -3613,6 +3624,11 @@ def __cget_core(slot)
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
if ( method = _symbolkey2str(__val2ruby_optkeys())[slot] )
optval = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
begin
@@ -3687,14 +3703,35 @@ def cget(slot)
unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
__cget_core(slot)
else
- __cget_core(slot) rescue nil
+ begin
+ __cget_core(slot)
+ rescue => e
+ if current_configinfo.has_key?(slot.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
end
end
+ def cget_strict(slot)
+ # never use TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ __cget_core(slot)
+ end
def __configure_core(slot, value=None)
if slot.kind_of? Hash
slot = _symbolkey2str(slot)
+ __optkey_aliases.each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if slot.has_key?(alias_name)
+ slot[real_name.to_s] = slot.delete(alias_name)
+ end
+ }
+
__methodcall_optkeys.each{|key, method|
value = slot.delete(key.to_s)
self.__send__(method, value) if value
@@ -3731,6 +3768,11 @@ def __configure_core(slot, value=None)
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
if ( conf = __keyonly_optkeys.find{|k, v| k.to_s == slot} )
defkey, undefkey = conf
if value
@@ -3782,7 +3824,17 @@ def configure(slot, value=None)
__configure_core(slot) unless slot.empty?
end
else
- __configure_core(slot, value) rescue nil
+ begin
+ __configure_core(slot, value)
+ rescue => e
+ if current_configinfo.has_key?(slot.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
end
end
self
@@ -3818,6 +3870,12 @@ def __configinfo_core(slot = nil)
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
method = _symbolkey2str(__val2ruby_optkeys())[slot]
@@ -4191,6 +4249,12 @@ def __configinfo_core(slot = nil)
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
method = _symbolkey2str(__val2ruby_optkeys())[slot]
@@ -4786,6 +4850,13 @@ def initialize(parent=nil, keys=nil)
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
+ __optkey_aliases.each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if keys.has_key?(alias_name)
+ keys[real_name.to_s] = keys.delete(alias_name)
+ end
+ }
+
__methodcall_optkeys.each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
@@ -4823,18 +4894,24 @@ def create_self(keys)
else
begin
tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
- rescue
+ rescue => e
tk_call_without_enc(cmd, @path)
keys = __check_available_configure_options(keys)
unless keys.empty?
begin
- tk_call_without_enc('destroy', @path)
- rescue
- # cannot destroy
+ # try to configure
configure(keys)
- else
- # re-create widget
- tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
+ rescue
+ # fail => includes options adaptable when creattion only?
+ begin
+ tk_call_without_enc('destroy', @path)
+ rescue
+ # cannot rescue options error
+ fail e
+ else
+ # re-create widget
+ tk_call_without_enc(cmd, @path, *hash_kv(keys, true))
+ end
end
end
end
@@ -5389,7 +5466,7 @@ def bindtags_unshift(tag)
#Tk.freeze
module Tk
- RELEASE_DATE = '2008-05-16'.freeze
+ RELEASE_DATE = '2008-05-23'.freeze
autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable'
View
9 ext/tk/lib/tk/canvas.rb
@@ -168,6 +168,8 @@ def canvasy(screen_y, *args)
#tk_tcl2ruby(tk_send_without_enc('canvasy', screen_y, *args))
number(tk_send_without_enc('canvasy', screen_y, *args))
end
+ alias canvas_x canvasx
+ alias canvas_y canvasy
def coords(tag, *args)
if args == []
@@ -642,6 +644,13 @@ def self._parse_create_args(args)
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
+ __item_optkey_aliases(nil).each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if keys.has_key?(alias_name)
+ keys[real_name.to_s] = keys.delete(alias_name)
+ end
+ }
+
__item_methodcall_optkeys(nil).each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
View
3 ext/tk/lib/tk/canvastag.rb
@@ -63,6 +63,9 @@ def bindinfo(seq=nil)
def cget(option)
@c.itemcget(@id, option)
end
+ def cget_strict(option)
+ @c.itemcget_strict(@id, option)
+ end
def configure(key, value=None)
@c.itemconfigure(@id, key, value)
View
52 ext/tk/lib/tk/composite.rb
@@ -181,6 +181,57 @@ def delegate(option, *wins)
delegate_alias(option, option, *wins)
end
+ def __cget_delegates(slot)
+ slot = slot.to_s
+
+ if @option_methods.include?(slot)
+ if @option_methods[slot][:cget]
+ return self.__send__(@option_methods[slot][:cget])
+ else
+ if @option_setting[slot]
+ return @option_setting[slot]
+ else
+ return ''
+ end
+ end
+ end
+
+ tbl = @delegates[slot]
+ tbl = @delegates['DEFAULT'] unless tbl
+
+ begin
+ if tbl
+ opt, wins = tbl[-1]
+ opt = slot if opt == 'DEFAULT'
+ if wins && wins[-1]
+ # return wins[-1].cget(opt)
+ return wins[-1].cget_strict(opt)
+ end
+ end
+ rescue
+ end
+
+ return None
+ end
+ private :__cget_delegates
+
+ def cget(slot)
+ if (ret = __cget_delegates(slot)) == None
+ super(slot)
+ else
+ ret
+ end
+ end
+
+ def cget_strict(slot)
+ if (ret = __cget_delegates(slot)) == None
+ super(slot)
+ else
+ ret
+ end
+ end
+
+=begin
def cget(slot)
slot = slot.to_s
@@ -212,6 +263,7 @@ def cget(slot)
super(slot)
end
+=end
def configure(slot, value=None)
if slot.kind_of? Hash
View
19 ext/tk/lib/tk/image.rb
@@ -156,7 +156,7 @@ def blank
self
end
- def cget(option)
+ def cget_strict(option)
case option.to_s
when 'data', 'file'
tk_send 'cget', '-' << option.to_s
@@ -164,6 +164,23 @@ def cget(option)
tk_tcl2ruby(tk_send('cget', '-' << option.to_s))
end
end
+ def cget(option)
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ cget_strict(option)
+ else
+ begin
+ cget_strict(option)
+ rescue => e
+ if current_configinfo.has_key?(option.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
+ end
+ end
def copy(src, *opts)
if opts.size == 0
View
57 ext/tk/lib/tk/itemconfig.rb
@@ -8,6 +8,11 @@
module TkItemConfigOptkeys
include TkUtil
+ def __item_optkey_aliases(id)
+ {}
+ end
+ private :__item_optkey_aliases
+
def __item_numval_optkeys(id)
[]
end
@@ -165,6 +170,11 @@ def __itemcget_core(tagOrId, option)
fail ArgumentError, "Invalid option `#{orig_opt.inspect}'"
end
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == option}
+ if real_name
+ option = real_name.to_s
+ end
+
if ( method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[option] )
optval = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
begin
@@ -242,20 +252,35 @@ def itemcget(tagOrId, option)
__itemcget_core(tagOrId, option)
rescue => e
begin
- __itemcget_core(tagOrId)
- # not tag error -> option is unknown
- nil
+ if __current_itemconfiginfo(tagOrId).has_key?(option.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
rescue
fail e # tag error
end
end
end
end
+ def itemcget_strict(tagOrId, option)
+ # never use TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ __itemcget_core(tagOrId, option)
+ end
def __itemconfigure_core(tagOrId, slot, value=None)
if slot.kind_of? Hash
slot = _symbolkey2str(slot)
+ __item_optkey_aliases(tagid(tagOrId)).each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if slot.has_key?(alias_name)
+ slot[real_name.to_s] = slot.delete(alias_name)
+ end
+ }
+
__item_methodcall_optkeys(tagid(tagOrId)).each{|key, method|
value = slot.delete(key.to_s)
self.__send__(method, tagOrId, value) if value
@@ -292,6 +317,11 @@ def __itemconfigure_core(tagOrId, slot, value=None)
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
end
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
if ( conf = __item_keyonly_optkeys(tagid(tagOrId)).find{|k, v| k.to_s == slot } )
defkey, undefkey = conf
if value
@@ -350,8 +380,13 @@ def itemconfigure(tagOrId, slot, value=None)
__itemconfigure_core(tagOrId, slot, value)
rescue => e
begin
- __itemconfiginfo_core(tagOrId)
- # not tag error -> option is unknown
+ if __current_itemconfiginfo(tagOrId).has_key?(slot.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
rescue
fail e # tag error
end
@@ -386,6 +421,12 @@ def __itemconfiginfo_core(tagOrId, slot = nil)
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
@@ -757,6 +798,12 @@ def __itemconfiginfo_core(tagOrId, slot = nil)
else
if slot
slot = slot.to_s
+
+ alias_name, real_name = __item_optkey_aliases(tagid(tagOrId)).find{|k, v| k.to_s == slot}
+ if real_name
+ slot = real_name.to_s
+ end
+
case slot
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
View
33 ext/tk/lib/tk/itemfont.rb
@@ -94,11 +94,14 @@ def tagfont_configure(tagOrId, slot)
*(__item_config_cmd(tagid(tagOrId)) << {}))
next
else
- begin
+ fnt = hash_kv(fnt) if fnt.kind_of?(Hash)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
- rescue => e
- unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
- fail e
+ else
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ rescue => e
+ # ignore
end
end
end
@@ -153,11 +156,14 @@ def latintagfont_configure(tagOrId, ltn, keys=nil)
elsif Tk::JAPANIZED_TK
fobj = fontobj # create a new TkFont object
else
- begin
+ ltn = hash_kv(ltn) if ltn.kind_of?(Hash)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
- rescue => e
- unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
- fail e
+ else
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ rescue => e
+ # ignore
end
end
next
@@ -210,11 +216,14 @@ def kanjitagfont_configure(tagOrId, knj, keys=nil)
elsif Tk::JAPANIZED_TK
fobj = fontobj # create a new TkFont object
else
- begin
+ knj = hash_kv(knj) if knj.kind_of?(Hash)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
- rescue => e
- unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
- fail e
+ else
+ begin
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ rescue => e
+ # ignore
end
end
next
View
13 ext/tk/lib/tk/menu.rb
@@ -34,12 +34,13 @@ def __item_val2ruby_optkeys(id) # { key=>proc, ... }
private :__item_val2ruby_optkeys
alias entrycget itemcget
+ alias entrycget_strict itemcget_strict
alias entryconfigure itemconfigure
alias entryconfiginfo itemconfiginfo
alias current_entryconfiginfo current_itemconfiginfo
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
class Tk::Menu<TkWindow
@@ -518,7 +519,7 @@ def create_self(keys)
tk_call_without_enc(self.class::TkCommandNames[0], @path)
keys = __check_available_configure_options(keys)
unless keys.empty?
- tk_call_without_enc('destroy', @path)
+ tk_call_without_enc('destroy', @path) rescue nil
tk_call_without_enc(self.class::TkCommandNames[0], @path,
*hash_kv(keys, true))
end
@@ -642,6 +643,9 @@ def menu
def menucget(key)
@menu.cget(key)
end
+ def menucget_strict(key)
+ @menu.cget_strict(key)
+ end
def menuconfigure(key, val=None)
@menu.configure(key, val)
self
@@ -655,6 +659,9 @@ def current_menuconfiginfo(key=nil)
def entrycget(index, key)
@menu.entrycget(index, key)
end
+ def entrycget_strict(index, key)
+ @menu.entrycget_strict(index, key)
+ end
def entryconfigure(index, key, val=None)
@menu.entryconfigure(index, key, val)
self
View
14 ext/tk/lib/tk/namespace.rb
@@ -83,6 +83,20 @@ def cget(slot)
super(slot)
end
end
+ def cget_strict(slot)
+ if slot == :namespace || slot == 'namespace'
+ ns = super(slot)
+ Tk_Namespace_ID_TBL.mutex.synchronize{
+ if TkNamespace::Tk_Namespace_ID_TBL.key?(ns)
+ TkNamespace::Tk_Namespace_ID_TBL[ns]
+ else
+ ns
+ end
+ }
+ else
+ super(slot)
+ end
+ end
def configinfo(slot = nil)
if slot
View
23 ext/tk/lib/tk/panedwindow.rb
@@ -76,11 +76,32 @@ def sash_place(index, x, y)
self
end
- def panecget(win, key)
+ def panecget_strict(win, key)
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
tk_tcl2ruby(tk_send_without_enc('panecget', win, "-#{key}"))
end
+ def panecget(win, key)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ panecget_strict(win, key)
+ else
+ begin
+ panecget_strict(win, key)
+ rescue => e
+ begin
+ if current_paneconfiginfo(win).has_key?(option.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
def paneconfigure(win, key, value=nil)
# win = win.epath if win.kind_of?(TkObject)
View
34 ext/tk/lib/tk/text.rb
@@ -32,6 +32,9 @@ def __item_pathname(id)
def tag_cget(tagOrId, option)
itemcget(['tag', tagOrId], option)
end
+ def tag_cget_strict(tagOrId, option)
+ itemcget_strict(['tag', tagOrId], option)
+ end
def tag_configure(tagOrId, slot, value=None)
itemconfigure(['tag', tagOrId], slot, value)
end
@@ -45,6 +48,9 @@ def current_tag_configinfo(tagOrId, slot=nil)
def window_cget(tagOrId, option)
itemcget(['window', tagOrId], option)
end
+ def window_cget_strict(tagOrId, option)
+ itemcget_strict(['window', tagOrId], option)
+ end
def window_configure(tagOrId, slot, value=None)
itemconfigure(['window', tagOrId], slot, value)
end
@@ -55,8 +61,8 @@ def current_window_configinfo(tagOrId, slot=nil)
current_itemconfiginfo(['window', tagOrId], slot)
end
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
class Tk::Text<TkTextWin
@@ -403,7 +409,7 @@ def mark_previous(index)
end
alias previous_mark mark_previous
- def image_cget(index, slot)
+ def image_cget_strict(index, slot)
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
_fromUTF8(tk_send_without_enc('image', 'cget',
@@ -415,6 +421,28 @@ def image_cget(index, slot)
end
end
+ def image_cget(index, slot)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ image_cget_strict(index, slot)
+ else
+ begin
+ image_cget_strict(index, slot)
+ rescue => e
+ begin
+ if current_image_configinfo(index).has_key?(slot.to_s)
+ # not tag error & option is known -> error on known option
+ fail e
+ else
+ # not tag error & option is unknown
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
+
def image_configure(index, slot, value=None)
if slot.kind_of?(Hash)
_fromUTF8(tk_send_without_enc('image', 'configure',
View
4 ext/tk/lib/tk/textimage.rb
@@ -52,6 +52,10 @@ def cget(slot)
@t.image_cget(@index, slot)
end
+ def cget_strict(slot)
+ @t.image_cget_strict(@index, slot)
+ end
+
def configure(slot, value=None)
@t.image_configure(@index, slot, value)
self
View
3 ext/tk/lib/tk/texttag.rb
@@ -132,6 +132,9 @@ def []=(key,val)
def cget(key)
@t.tag_cget @id, key
end
+ def cget_strict(key)
+ @t.tag_cget_strict @id, key
+ end
=begin
def cget(key)
case key.to_s
View
3 ext/tk/lib/tk/textwindow.rb
@@ -72,6 +72,9 @@ def []=(slot, value)
def cget(slot)
@t.window_cget(@index, slot)
end
+ def cget_strict(slot)
+ @t.window_cget_strict(@index, slot)
+ end
def configure(slot, value=None)
if slot.kind_of?(Hash)
View
101 ext/tk/lib/tkextlib/blt/component.rb
@@ -85,6 +85,9 @@ def __item_pathname(id)
def axis_cget(id, option)
ret = itemcget(['axis', tagid(id)], option)
end
+ def axis_cget_strict(id, option)
+ ret = itemcget_strict(['axis', tagid(id)], option)
+ end
def axis_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -118,6 +121,9 @@ def current_axis_configinfo(id, slot=nil)
def crosshairs_cget(option)
itemcget('crosshairs', option)
end
+ def crosshairs_cget_strict(option)
+ itemcget_strict('crosshairs', option)
+ end
def crosshairs_configure(slot, value=None)
itemconfigure('crosshairs', slot, value)
end
@@ -131,6 +137,9 @@ def current_crosshairs_configinfo(slot=nil)
def element_cget(id, option)
itemcget(['element', tagid(id)], option)
end
+ def element_cget_strict(id, option)
+ itemcget_strict(['element', tagid(id)], option)
+ end
def element_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -152,6 +161,9 @@ def current_element_configinfo(id, slot=nil)
def bar_cget(id, option)
itemcget(['bar', tagid(id)], option)
end
+ def bar_cget_strict(id, option)
+ itemcget_strict(['bar', tagid(id)], option)
+ end
def bar_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -173,6 +185,9 @@ def current_bar_configinfo(id, slot=nil)
def line_cget(id, option)
itemcget(['line', tagid(id)], option)
end
+ def line_cget_strict(id, option)
+ itemcget_strict(['line', tagid(id)], option)
+ end
def line_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -194,6 +209,9 @@ def current_line_configinfo(id, slot=nil)
def gridline_cget(option)
itemcget('grid', option)
end
+ def gridline_cget_strict(option)
+ itemcget_strict('grid', option)
+ end
def gridline_configure(slot, value=None)
itemconfigure('grid', slot, value)
end
@@ -207,6 +225,9 @@ def current_gridline_configinfo(slot=nil)
def legend_cget(option)
itemcget('legend', option)
end
+ def legend_cget_strict(option)
+ itemcget_strict('legend', option)
+ end
def legend_configure(slot, value=None)
itemconfigure('legend', slot, value)
end
@@ -220,6 +241,9 @@ def current_legend_configinfo(slot=nil)
def pen_cget(id, option)
itemcget(['pen', tagid(id)], option)
end
+ def pen_cget_strict(id, option)
+ itemcget_strict(['pen', tagid(id)], option)
+ end
def pen_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -241,6 +265,9 @@ def current_pen_configinfo(id, slot=nil)
def postscript_cget(option)
itemcget('postscript', option)
end
+ def postscript_cget_strict(option)
+ itemcget_strict('postscript', option)
+ end
def postscript_configure(slot, value=None)
itemconfigure('postscript', slot, value)
end
@@ -254,6 +281,9 @@ def current_postscript_configinfo(slot=nil)
def marker_cget(id, option)
itemcget(['marker', tagid(id)], option)
end
+ def marker_cget_strict(id, option)
+ itemcget_strict(['marker', tagid(id)], option)
+ end
def marker_configure(*args)
slot = args.pop
if slot.kind_of?(Hash)
@@ -273,11 +303,12 @@ def current_marker_configinfo(id, slot=nil)
end
alias __itemcget itemcget
+ alias __itemcget_strict itemcget_strict
alias __itemconfiginfo itemconfiginfo
alias __current_itemconfiginfo current_itemconfiginfo
private :__itemcget, :__itemconfiginfo, :__current_itemconfiginfo
- def itemcget(tagOrId, option)
+ def itemcget_strict(tagOrId, option)
ret = __itemcget(tagid(tagOrId), option)
if option == 'bindtags' || option == :bindtags
ret.collect{|tag| TkBindTag.id2obj(tag)}
@@ -285,6 +316,27 @@ def itemcget(tagOrId, option)
ret
end
end
+ def itemcget(tagOrId, option)
+ unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ itemcget_strict(tagOrId, option)
+ else
+ begin
+ itemcget_strict(tagOrId, option)
+ rescue => e
+ begin
+ if current_itemconfiginfo(tagOrId).has_key?(option.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ rescue
+ fail e # tag error
+ end
+ end
+ end
+ end
def itemconfiginfo(tagOrId, slot = nil)
ret = __itemconfiginfo(tagid(tagOrId), slot)
@@ -321,8 +373,8 @@ def current_itemconfiginfo(tagOrId, slot = nil)
ret
end
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
#################
@@ -428,6 +480,9 @@ def to_eval
def cget(option)
@chart.axis_cget(@id, option)
end
+ def cget_strict(option)
+ @chart.axis_cget_strict(@id, option)
+ end
def configure(key, value=None)
@chart.axis_configure(@id, key, value)
self
@@ -530,6 +585,9 @@ def to_eval
def cget(option)
@chart.crosshair_cget(option)
end
+ def cget_strict(option)
+ @chart.crosshair_cget_strict(option)
+ end
def configure(key, value=None)
@chart.crosshair_configure(key, value)
self
@@ -675,6 +733,9 @@ def cget(option)
# @chart.element_cget(@id, option)
@chart.__send__(@typename + '_cget', @id, option)
end
+ def cget_strict(option)
+ @chart.__send__(@typename + '_cget_strict', @id, option)
+ end
def configure(key, value=None)
# @chart.element_configure(@id, key, value)
@chart.__send__(@typename + '_configure', @id, key, value)
@@ -775,6 +836,9 @@ def to_eval
def cget(option)
@chart.gridline_cget(option)
end
+ def cget_strict(option)
+ @chart.gridline_cget_strict(option)
+ end
def configure(key, value=None)
@chart.gridline_configure(key, value)
self
@@ -846,6 +910,9 @@ def to_eval
def cget(option)
@chart.legend_cget(option)
end
+ def cget_strict(option)
+ @chart.legend_cget_strict(option)
+ end
def configure(key, value=None)
@chart.legend_configure(key, value)
self
@@ -972,6 +1039,9 @@ def to_eval
def cget(option)
@chart.pen_cget(@id, option)
end
+ def cget_strict(option)
+ @chart.pen_cget_strict(@id, option)
+ end
def configure(key, value=None)
@chart.pen_configure(@id, key, value)
self
@@ -1039,6 +1109,9 @@ def to_eval
def cget(option)
@chart.postscript_cget(option)
end
+ def cget_strict(option)
+ @chart.postscript_cget_strict(option)
+ end
def configure(key, value=None)
@chart.postscript_configure(key, value)
self
@@ -1117,6 +1190,13 @@ def self._parse_create_args(keys)
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
+ __item_optkey_aliases(nil).each{|alias_name, real_name|
+ alias_name = alias_name.to_s
+ if keys.has_key?(alias_name)
+ keys[real_name.to_s] = keys.delete(alias_name)
+ end
+ }
+
__item_methodcall_optkeys(nil).each{|key|
key = key.to_s
methodkeys[key] = keys.delete(key) if keys.key?(key)
@@ -1192,6 +1272,9 @@ def to_eval
def cget(option)
@chart.marker_cget(@id, option)
end
+ def cget_strict(option)
+ @chart.marker_cget_strict(@id, option)
+ end
def configure(key, value=None)
@chart.marker_configure(@id, key, value)
self
@@ -1774,6 +1857,9 @@ def marker_type(id)
def xaxis_cget(option)
itemcget('xaxis', option)
end
+ def xaxis_cget_strict(option)
+ itemcget_strict('xaxis', option)
+ end
def xaxis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
@@ -1843,6 +1929,9 @@ def xaxis_use(target=nil)
def x2axis_cget(option)
itemcget('x2axis', option)
end
+ def x2axis_cget_strict(option)
+ itemcget_strict('x2axis', option)
+ end
def x2axis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
@@ -1912,6 +2001,9 @@ def x2axis_use(target=nil)
def yaxis_cget(option)
itemcget('yaxis', option)
end
+ def yaxis_cget_strict(option)
+ itemcget_strict('yaxis', option)
+ end
def yaxis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
@@ -1981,6 +2073,9 @@ def yaxis_use(target=nil)
def y2axis_cget(option)
itemcget('y2axis', option)
end
+ def y2axis_cget_strict(option)
+ itemcget_strict('y2axis', option)
+ end
def y2axis_configure(slot, value=None)
if slot.kind_of?(Hash)
slot = _symbolkey2str(slot)
View
1 ext/tk/lib/tkextlib/blt/htext.rb
@@ -22,6 +22,7 @@ class Htext<TkWindow
WidgetClassNames[WidgetClassName] = self
alias window_cget itemcget
+ alias window_cget_strict itemcget_strict
alias window_configure itemconfigure
alias window_configuinfo itemconfiginfo
alias current_window_configuinfo current_itemconfiginfo
View
17 ext/tk/lib/tkextlib/blt/table.rb
@@ -29,6 +29,9 @@ def blt_table_arrange()
def blt_table_cget(*args)
Tk::BLT::Table.cget(self, *args)
end
+ def blt_table_cget_strict(*args)
+ Tk::BLT::Table.cget_strict(self, *args)
+ end
def blt_table_configure(*args)
Tk::BLT::Table.configure(self, *args)
@@ -92,6 +95,9 @@ def blt_table_split(*args)
def blt_table_itemcget(*args)
Tk::BLT::Table.itemcget(self, *args)
end
+ def blt_table_itemcget_strict(*args)
+ Tk::BLT::Table.itemcget_strict(self, *args)
+ end
def blt_table_itemconfigure(*args)
Tk::BLT::Table.itemconfigure(self, *args)
@@ -136,12 +142,13 @@ def __item_pathname(id)
private :__item_pathname
alias __itemcget itemcget
+ alias __itemcget_strict itemcget_strict
alias __itemconfigure itemconfigure
alias __itemconfiginfo itemconfiginfo
alias __current_itemconfiginfo current_itemconfiginfo
- private :__itemcget, :__itemconfigure
- private :__itemconfiginfo, :__current_itemconfiginfo
+ private :__itemcget, :__itemcget_strict
+ private :__itemconfigure, :__itemconfiginfo, :__current_itemconfiginfo
def __boolval_optkeys
super() << 'propagate'
@@ -176,6 +183,9 @@ def tagid2obj(tagid)
def cget(container, option)
__itemcget([container], option)
end
+ def cget_strict(container, option)
+ __itemcget_strict([container], option)
+ end
def configure(container, *args)
__itemconfigure([container], *args)
@@ -192,6 +202,9 @@ def current_configinfo(container, *args)
def itemcget(container, item, option)
__itemcget([container, tagid(item)], option)
end
+ def itemcget_strict(container, item, option)
+ __itemcget_strict([container, tagid(item)], option)
+ end
def itemconfigure(container, *args)
if args[-1].kind_of?(Hash)
View
4 ext/tk/lib/tkextlib/blt/tabset.rb
@@ -128,6 +128,9 @@ def bindinfo(context=nil)
def cget(*args)
@t.tab_cget(@id, *args)
end
+ def cget_strict(*args)
+ @t.tab_cget_strict(@id, *args)
+ end
def configure(*args)
@t.tab_configure(@id, *args)
end
@@ -240,6 +243,7 @@ def __item_pathname(tagOrId)
private :__item_pathname
alias tab_cget itemcget
+ alias tab_cget_strict itemcget_strict
alias tab_configure itemconfigure
alias tab_configinfo itemconfiginfo
alias current_tab_configinfo current_itemconfiginfo
View
7 ext/tk/lib/tkextlib/blt/ted.rb
@@ -30,12 +30,15 @@ def __item_config_cmd(id)
end
private :__item_config_cmd
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
def cget(master, option)
itemcget(master, option)
end
+ def cget_strict(master, option)
+ itemcget_strict(master, option)
+ end
def configure(master, slot, value=None)
itemconfigure(master, slot, value)
end
View
24 ext/tk/lib/tkextlib/blt/treeview.rb
@@ -98,6 +98,9 @@ def __item_pathname(id)
def column_cget(name, option)
itemcget(['column', name], option)
end
+ def column_cget_strict(name, option)
+ itemcget_strict(['column', name], option)
+ end
def column_configure(name, slot, value=None)
itemconfigure(['column', name], slot, value)
end
@@ -111,6 +114,9 @@ def current_column_configinfo(name, slot=nil)
def button_cget(option)
itemcget('button', option)
end
+ def button_cget_strict(option)
+ itemcget_strict('button', option)
+ end
def button_configure(slot, value=None)
itemconfigure('button', slot, value)
end
@@ -129,6 +135,14 @@ def entry_cget(option)
ret
end
end
+ def entry_cget_strict(option)
+ ret = itemcget_strict('entry', option)
+ if option == 'bindtags' || option == :bindtags
+ ret.collect{|tag| TkBindTag.id2obj(tag)}
+ else
+ ret
+ end
+ end
def entry_configure(slot, value=None)
itemconfigure('entry', slot, value)
end
@@ -170,6 +184,9 @@ def current_entry_configinfo(slot=nil)
def sort_cget(option)
itemcget('sort', option)
end
+ def sort_cget_strict(option)
+ itemcget_strict('sort', option)
+ end
def sort_configure(slot, value=None)
itemconfigure('sort', slot, value)
end
@@ -183,6 +200,9 @@ def current_sort_configinfo(slot=nil)
def text_cget(option)
itemcget('text', option)
end
+ def text_cget_strict(option)
+ itemcget_strict('text', option)
+ end
def text_configure(slot, value=None)
itemconfigure('text', slot, value)
end
@@ -193,8 +213,8 @@ def current_text_configinfo(slot=nil)
current_itemconfiginfo('text', slot)
end
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
end
class Tk::BLT::Treeview
View
10 ext/tk/lib/tkextlib/blt/unix_dnd.rb
@@ -30,12 +30,15 @@ def __item_config_cmd(id)
end
private :__item_config_cmd
- private :itemcget, :itemconfigure
- private :itemconfiginfo, :current_itemconfiginfo
+ private :itemcget, :itemcget_strict
+ private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
def cget(win, option)
itemcget(['cget', win], option)
end
+ def cget_strict(win, option)
+ itemcget_strict(['cget', win], option)
+ end
def configure(win, slot, value=None)
itemconfigure(['configure', win], slot, value)
end
@@ -49,6 +52,9 @@ def current_configinfo(win, slot=nil)
def token_cget(win, option)
itemcget(['token', 'cget', win], option)
end
+ def token_cget_strict(win, option)
+ itemcget_strict(['token', 'cget', win], option)
+ end
def token_configure(win, slot, value=None)
itemconfigure(['token', 'configure', win], slot, value)
end
View
19 ext/tk/lib/tkextlib/blt/watch.rb
@@ -146,7 +146,7 @@ def configinfo(slot = nil)
end
end
end
- def cget(key)
+ def cget_strict(key)
key = key.to_s
begin
info.assoc(key)[1]
@@ -154,5 +154,22 @@ def cget(key)
fail ArgumentError, "unknown option '#{key}'"
end
end
+ def cget(key)
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
+ cget_strict(key)
+ else
+ begin
+ cget_strict(key)
+ rescue => e
+ if current_configinfo.has_key?(key.to_s)
+ # error on known option
+ fail e
+ else
+ # unknown option
+ nil
+ end
+ end
+ end
+ end
end
end
View
7 ext/tk/lib/tkextlib/bwidget/dialog.rb
@@ -59,6 +59,13 @@ def create_self(keys)
end
end
+ def cget_strict(slot)
+ if slot.to_s == 'relative'
+ super('parent')
+ else
+ super(slot)
+ end
+ end
def cget(slot)
if slot.to_s == 'relative'
super('parent')
View
7 ext/tk/lib/tkextlib/bwidget/dynamichelp.rb
@@ -34,6 +34,13 @@ def self.__config_cmd
['DynamicHelp::configure']
end
+ def self.cget_strict(slot)
+ slot = slot.to_s
+ info = {}
+ self.current_configinfo.each{|k,v| info[k.to_s] = v if k.to_s == slot}
+ fail RuntimeError, "unknown option \"-#{slot}\"" if info.empty?
+ info.values[0]
+ end
def self.cget(slot)
self.current_configinfo(slot).values[0]
end
View
3 ext/tk/lib/tkextlib/bwidget/listbox.rb
@@ -297,6 +297,9 @@ def []=(key, val)
def cget(key)
@listbox.itemcget(@id, key)
end
+ def cget_strict(key)
+ @listbox.itemcget_strict(@id, key)
+ end
def configure(key, val=None)
@listbox.itemconfigure(@id, key, val)
View
11 ext/tk/lib/tkextlib/bwidget/messagedlg.rb
@@ -65,6 +65,17 @@ def cget(slot)
end
@keys[slot]
end
+ def cget_strict(slot)
+ slot = slot.to_s
+ if slot == 'relative'
+ slot = 'parent'
+ end
+ if winfo_exist?
+ val = super(slot)
+ @keys[slot] = val
+ end
+ @keys[slot]
+ end
def configure(slot, value=None)
if winfo_exist?
View
3 ext/tk/lib/tkextlib/bwidget/tree.rb
@@ -358,6 +358,9 @@ def []=(key, val)
def cget(key)
@tree.itemcget(@id, key)
end
+ def cget_strict(key)
+ @tree.itemcget_strict(@id, key)
+ end
def configure(key, val=None)
@tree.itemconfigure(@id, key, val)
View
12 ext/tk/lib/tkextlib/bwidget/widget.rb
@@ -29,6 +29,13 @@ def self.__config_cmd
['Widget::configure']
end
+ def self.cget_strict(slot)
+ slot = slot.to_s
+ info = {}
+ self.current_configinfo.each{|k,v| info[k.to_s] = v if k.to_s == slot}
+ fail RuntimeError, "unknown option \"-#{slot}\"" if info.empty?
+ info.values[0]
+ end
def self.cget(slot)
self.current_configinfo(slot).values[0]
end
@@ -105,9 +112,12 @@ def self.set_option(win, option, value)
tk_call('Widget::setoption', win, option, value)
end
- def self.sub_cget(win, subwidget)
+ def self.sub_cget_strict(win, subwidget)
tk_call('Widget::subcget', win, subwidget)
end
+ def self.sub_cget(win, subwidget)
+ self.sub_cget_strict(win, subwidget)
+ end
def self.sync_options(klass, subclass, subpath, options)
tk_call('Widget::syncoptions', klass, subclass, subpath, options)
View
5 ext/tk/lib/tkextlib/iwidgets/buttonbox.rb