mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/tk/lib/tcltklib : bug fix
* ext/tk/lib/tk : bug fix and add Tcl/Tk extension support libraries git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									ad0add9f08
								
							
						
					
					
						commit
						b7a7c70c32
					
				
					 32 changed files with 2317 additions and 677 deletions
				
			
		| 
						 | 
					@ -1,3 +1,9 @@
 | 
				
			||||||
 | 
					Thu Jul  1 18:36:08 2004  Hidetoshi NAGAI  <nagai@ai.kyutech.ac.jp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* ext/tk/lib/tcltklib : bug fix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						* ext/tk/lib/tk : bug fix and add Tcl/Tk extension support libraries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Thu Jul  1 11:59:45 2004  GOTOU Yuuzou  <gotoyuzo@notwork.org>
 | 
					Thu Jul  1 11:59:45 2004  GOTOU Yuuzou  <gotoyuzo@notwork.org>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	* ext/openssl/extconf.rb: check for EVP_CIPHER_CTX_copy, ENGINE_add,
 | 
						* ext/openssl/extconf.rb: check for EVP_CIPHER_CTX_copy, ENGINE_add,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
MANIFEST
 | 
					MANIFEST
 | 
				
			||||||
README.1st
 | 
					README.1st
 | 
				
			||||||
 | 
					README.ActiveTcl
 | 
				
			||||||
README.euc
 | 
					README.euc
 | 
				
			||||||
MANUAL.euc
 | 
					MANUAL.euc
 | 
				
			||||||
MANUAL.eng
 | 
					MANUAL.eng
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,12 @@ require 'mkmf'
 | 
				
			||||||
is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
 | 
					is_win32 = (/mswin32|mingw|cygwin|bccwin32/ =~ RUBY_PLATFORM)
 | 
				
			||||||
is_macosx = (/darwin/ =~ RUBY_PLATFORM)
 | 
					is_macosx = (/darwin/ =~ RUBY_PLATFORM)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mac_need_framework = 
 | 
				
			||||||
 | 
					  is_macosx &&
 | 
				
			||||||
 | 
					  enable_config("mac-tcltk-framework", false) &&
 | 
				
			||||||
 | 
					  FileTest.directory?("/Library/Frameworks/Tcl.framework/") &&
 | 
				
			||||||
 | 
					  FileTest.directory?("/Library/Frameworks/Tk.framework/")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unless is_win32
 | 
					unless is_win32
 | 
				
			||||||
  have_library("nsl", "t_open")
 | 
					  have_library("nsl", "t_open")
 | 
				
			||||||
  have_library("socket", "socket")
 | 
					  have_library("socket", "socket")
 | 
				
			||||||
| 
						 | 
					@ -210,7 +216,7 @@ EOF
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if is_macosx || 
 | 
					if mac_need_framework || 
 | 
				
			||||||
   (have_header("tcl.h") && have_header("tk.h") &&
 | 
					   (have_header("tcl.h") && have_header("tk.h") &&
 | 
				
			||||||
    (is_win32 || find_library("X11", "XOpenDisplay",
 | 
					    (is_win32 || find_library("X11", "XOpenDisplay",
 | 
				
			||||||
      "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
 | 
					      "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib")) &&
 | 
				
			||||||
| 
						 | 
					@ -219,7 +225,7 @@ if is_macosx ||
 | 
				
			||||||
  $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs
 | 
					  $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs
 | 
				
			||||||
  $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM
 | 
					  $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if is_macosx
 | 
					  if mac_need_framework
 | 
				
			||||||
    $CPPFLAGS += ' -I/Library/Frameworks/Tcl.framework/headers -I/Library/Frameworks/Tk.framework/Headers'
 | 
					    $CPPFLAGS += ' -I/Library/Frameworks/Tcl.framework/headers -I/Library/Frameworks/Tk.framework/Headers'
 | 
				
			||||||
    $LDFLAGS += ' -framework Tk -framework Tcl'
 | 
					    $LDFLAGS += ' -framework Tk -framework Tcl'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1201,12 +1201,15 @@ ip_ruby_eval(clientData, interp, argc, argv)
 | 
				
			||||||
	rb_thread_critical = thr_crit_bup;
 | 
						rb_thread_critical = thr_crit_bup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (eclass == eTkCallbackReturn) {
 | 
						if (eclass == eTkCallbackReturn) {
 | 
				
			||||||
 | 
						    ip_set_exc_message(interp, res);
 | 
				
			||||||
	    return TCL_RETURN;
 | 
						    return TCL_RETURN;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else if (eclass == eTkCallbackBreak) {
 | 
						} else if (eclass == eTkCallbackBreak) {
 | 
				
			||||||
 | 
						    ip_set_exc_message(interp, res);
 | 
				
			||||||
	    return TCL_BREAK;
 | 
						    return TCL_BREAK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else if (eclass == eTkCallbackContinue) {
 | 
						} else if (eclass == eTkCallbackContinue) {
 | 
				
			||||||
 | 
						    ip_set_exc_message(interp, res);
 | 
				
			||||||
	    return TCL_CONTINUE;
 | 
						    return TCL_CONTINUE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else if (eclass == rb_eSystemExit) {
 | 
						} else if (eclass == rb_eSystemExit) {
 | 
				
			||||||
| 
						 | 
					@ -1239,12 +1242,15 @@ ip_ruby_eval(clientData, interp, argc, argv)
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    if (SYM2ID(reason) == ID_return) {
 | 
						    if (SYM2ID(reason) == ID_return) {
 | 
				
			||||||
 | 
							ip_set_exc_message(interp, res);
 | 
				
			||||||
		return TCL_RETURN;
 | 
							return TCL_RETURN;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    } else if (SYM2ID(reason) == ID_break) {
 | 
						    } else if (SYM2ID(reason) == ID_break) {
 | 
				
			||||||
 | 
							ip_set_exc_message(interp, res);
 | 
				
			||||||
		return TCL_BREAK;
 | 
							return TCL_BREAK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    } else if (SYM2ID(reason) == ID_next) {
 | 
						    } else if (SYM2ID(reason) == ID_next) {
 | 
				
			||||||
 | 
							ip_set_exc_message(interp, res);
 | 
				
			||||||
		return TCL_CONTINUE;
 | 
							return TCL_CONTINUE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    } else {
 | 
						    } else {
 | 
				
			||||||
| 
						 | 
					@ -1572,12 +1578,15 @@ ip_ruby_cmd(clientData, interp, argc, argv)
 | 
				
			||||||
	rb_thread_critical = thr_crit_bup;
 | 
						rb_thread_critical = thr_crit_bup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (eclass == eTkCallbackReturn) {
 | 
						if (eclass == eTkCallbackReturn) {
 | 
				
			||||||
 | 
						    ip_set_exc_message(interp, res);
 | 
				
			||||||
	    return TCL_RETURN;
 | 
						    return TCL_RETURN;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else if (eclass == eTkCallbackBreak) {
 | 
						} else if (eclass == eTkCallbackBreak) {
 | 
				
			||||||
 | 
						    ip_set_exc_message(interp, res);
 | 
				
			||||||
	    return TCL_BREAK;
 | 
						    return TCL_BREAK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else if (eclass == eTkCallbackContinue) {
 | 
						} else if (eclass == eTkCallbackContinue) {
 | 
				
			||||||
 | 
						    ip_set_exc_message(interp, res);
 | 
				
			||||||
	    return TCL_CONTINUE;
 | 
						    return TCL_CONTINUE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	} else if (eclass == rb_eSystemExit) {
 | 
						} else if (eclass == rb_eSystemExit) {
 | 
				
			||||||
| 
						 | 
					@ -1609,12 +1618,15 @@ ip_ruby_cmd(clientData, interp, argc, argv)
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    if (SYM2ID(reason) == ID_return) {
 | 
						    if (SYM2ID(reason) == ID_return) {
 | 
				
			||||||
 | 
							ip_set_exc_message(interp, res);
 | 
				
			||||||
		return TCL_RETURN;
 | 
							return TCL_RETURN;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    } else if (SYM2ID(reason) == ID_break) {
 | 
						    } else if (SYM2ID(reason) == ID_break) {
 | 
				
			||||||
 | 
							ip_set_exc_message(interp, res);
 | 
				
			||||||
		return TCL_BREAK;
 | 
							return TCL_BREAK;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    } else if (SYM2ID(reason) == ID_next) {
 | 
						    } else if (SYM2ID(reason) == ID_next) {
 | 
				
			||||||
 | 
							ip_set_exc_message(interp, res);
 | 
				
			||||||
		return TCL_CONTINUE;
 | 
							return TCL_CONTINUE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    } else {
 | 
						    } else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										170
									
								
								ext/tk/MANIFEST
									
										
									
									
									
								
							
							
						
						
									
										170
									
								
								ext/tk/MANIFEST
									
										
									
									
									
								
							| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
MANIFEST
 | 
					MANIFEST
 | 
				
			||||||
README.1st
 | 
					README.1st
 | 
				
			||||||
README.fork
 | 
					README.fork
 | 
				
			||||||
 | 
					ChangeLog.tkextlib
 | 
				
			||||||
extconf.rb
 | 
					extconf.rb
 | 
				
			||||||
depend
 | 
					depend
 | 
				
			||||||
tkutil.c
 | 
					tkutil.c
 | 
				
			||||||
| 
						 | 
					@ -44,6 +45,7 @@ lib/tk/font.rb
 | 
				
			||||||
lib/tk/frame.rb
 | 
					lib/tk/frame.rb
 | 
				
			||||||
lib/tk/grid.rb
 | 
					lib/tk/grid.rb
 | 
				
			||||||
lib/tk/image.rb
 | 
					lib/tk/image.rb
 | 
				
			||||||
 | 
					lib/tk/itemconfig.rb
 | 
				
			||||||
lib/tk/itemfont.rb
 | 
					lib/tk/itemfont.rb
 | 
				
			||||||
lib/tk/kinput.rb
 | 
					lib/tk/kinput.rb
 | 
				
			||||||
lib/tk/label.rb
 | 
					lib/tk/label.rb
 | 
				
			||||||
| 
						 | 
					@ -58,6 +60,7 @@ lib/tk/mngfocus.rb
 | 
				
			||||||
lib/tk/msgcat.rb
 | 
					lib/tk/msgcat.rb
 | 
				
			||||||
lib/tk/namespace.rb
 | 
					lib/tk/namespace.rb
 | 
				
			||||||
lib/tk/optiondb.rb
 | 
					lib/tk/optiondb.rb
 | 
				
			||||||
 | 
					lib/tk/optionobj.rb
 | 
				
			||||||
lib/tk/pack.rb
 | 
					lib/tk/pack.rb
 | 
				
			||||||
lib/tk/package.rb
 | 
					lib/tk/package.rb
 | 
				
			||||||
lib/tk/palette.rb
 | 
					lib/tk/palette.rb
 | 
				
			||||||
| 
						 | 
					@ -87,6 +90,71 @@ lib/tk/winfo.rb
 | 
				
			||||||
lib/tk/winpkg.rb
 | 
					lib/tk/winpkg.rb
 | 
				
			||||||
lib/tk/wm.rb
 | 
					lib/tk/wm.rb
 | 
				
			||||||
lib/tk/xim.rb
 | 
					lib/tk/xim.rb
 | 
				
			||||||
 | 
					lib/tkextlib/SUPPORT_STATUS
 | 
				
			||||||
 | 
					lib/tkextlib/pkg_checker.rb
 | 
				
			||||||
 | 
					lib/tkextlib/setup.rb
 | 
				
			||||||
 | 
					lib/tkextlib/ICONS.rb
 | 
				
			||||||
 | 
					lib/tkextlib/ICONS/icons.rb
 | 
				
			||||||
 | 
					lib/tkextlib/ICONS/setup.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib/README
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib/autoscroll.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib/ctext.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib/cursor.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib/datefield.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib/ip_entry.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib/plotchart.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib/setup.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib/style.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tcllib/tkpiechart.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tile.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tile/setup.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tile/style.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tile/tbutton.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tile/tcheckbutton.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tile/tlabel.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tile/tmenubutton.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tile/tnotebook.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tile/tradiobutton.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkDND.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkDND/setup.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkDND/shape.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkDND/tkdnd.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkHTML.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkHTML/htmlwidget.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkHTML/setup.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/README
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/bmp.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/gif.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/ico.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/jpeg.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/pcx.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/pixmap.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/png.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/ppm.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/ps.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/setup.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/sgi.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/sun.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/tga.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/tiff.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/window.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/xbm.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tkimg/xpm.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tktrans.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tktrans/setup.rb
 | 
				
			||||||
 | 
					lib/tkextlib/tktrans/tktrans.rb
 | 
				
			||||||
 | 
					lib/tkextlib/treectrl.rb
 | 
				
			||||||
 | 
					lib/tkextlib/treectrl/setup.rb
 | 
				
			||||||
 | 
					lib/tkextlib/treectrl/tktreectrl.rb
 | 
				
			||||||
 | 
					lib/tkextlib/vu.rb
 | 
				
			||||||
 | 
					lib/tkextlib/vu/bargraph.rb
 | 
				
			||||||
 | 
					lib/tkextlib/vu/charts.rb
 | 
				
			||||||
 | 
					lib/tkextlib/vu/dial.rb
 | 
				
			||||||
 | 
					lib/tkextlib/vu/pie.rb
 | 
				
			||||||
 | 
					lib/tkextlib/vu/setup.rb
 | 
				
			||||||
 | 
					lib/tkextlib/vu/spinbox.rb
 | 
				
			||||||
sample/binding_sample.rb
 | 
					sample/binding_sample.rb
 | 
				
			||||||
sample/bindtag_sample.rb
 | 
					sample/bindtag_sample.rb
 | 
				
			||||||
sample/binstr_usage.rb
 | 
					sample/binstr_usage.rb
 | 
				
			||||||
| 
						 | 
					@ -95,12 +163,13 @@ sample/encstr_usage.rb
 | 
				
			||||||
sample/iso2022-kr.txt
 | 
					sample/iso2022-kr.txt
 | 
				
			||||||
sample/menubar1.rb
 | 
					sample/menubar1.rb
 | 
				
			||||||
sample/menubar2.rb
 | 
					sample/menubar2.rb
 | 
				
			||||||
 | 
					sample/optobj_sample.rb
 | 
				
			||||||
sample/propagate.rb
 | 
					sample/propagate.rb
 | 
				
			||||||
 | 
					sample/remote-ip_sample.rb
 | 
				
			||||||
 | 
					sample/remote-ip_sample2.rb
 | 
				
			||||||
sample/resource.en
 | 
					sample/resource.en
 | 
				
			||||||
sample/resource.ja
 | 
					sample/resource.ja
 | 
				
			||||||
sample/safe-tk.rb
 | 
					sample/safe-tk.rb
 | 
				
			||||||
sample/remote-ip_sample.rb
 | 
					 | 
				
			||||||
sample/remote-ip_sample2.rb
 | 
					 | 
				
			||||||
sample/tkalignbox.rb
 | 
					sample/tkalignbox.rb
 | 
				
			||||||
sample/tkballoonhelp.rb
 | 
					sample/tkballoonhelp.rb
 | 
				
			||||||
sample/tkbiff.rb
 | 
					sample/tkbiff.rb
 | 
				
			||||||
| 
						 | 
					@ -313,3 +382,100 @@ sample/msgs_tk/ja.msg
 | 
				
			||||||
sample/msgs_tk/nl.msg
 | 
					sample/msgs_tk/nl.msg
 | 
				
			||||||
sample/msgs_tk/pl.msg
 | 
					sample/msgs_tk/pl.msg
 | 
				
			||||||
sample/msgs_tk/ru.msg
 | 
					sample/msgs_tk/ru.msg
 | 
				
			||||||
 | 
					sample/tkextlib/tcllib/datefield.rb
 | 
				
			||||||
 | 
					sample/tkextlib/tcllib/plotdemos1.rb
 | 
				
			||||||
 | 
					sample/tkextlib/tcllib/plotdemos2.rb
 | 
				
			||||||
 | 
					sample/tkextlib/tcllib/plotdemos3.rb
 | 
				
			||||||
 | 
					sample/tkextlib/tcllib/xyplot.rb
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/README
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/hv.rb
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/ss.rb
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image1
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image10
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image11
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image12
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image13
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image14
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image2
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image3
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image4
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image5
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image6
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image7
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image8
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/image9
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page1/index.html
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image1
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image10
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image11
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image12
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image13
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image14
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image15
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image16
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image17
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image18
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image19
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image2
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image20
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image21
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image22
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image23
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image24
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image25
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image26
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image27
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image28
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image29
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image3
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image30
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image31
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image32
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image33
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image34
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image35
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image36
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image37
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image38
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image39
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image4
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image5
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image6
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image7
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image8
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/image9
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page2/index.html
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image1
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image10
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image11
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image12
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image13
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image14
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image2
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image3
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image4
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image5
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image6
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image7
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image8
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/image9
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page3/index.html
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page4/image1
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page4/image2
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page4/image3
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page4/image4
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page4/image5
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page4/image6
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page4/image7
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page4/image8
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page4/image9
 | 
				
			||||||
 | 
					sample/tkextlib/tkHTML/page4/index.html
 | 
				
			||||||
 | 
					sample/tkextlib/vu/README.txt
 | 
				
			||||||
 | 
					sample/tkextlib/vu/canvItems.rb
 | 
				
			||||||
 | 
					sample/tkextlib/vu/canvSticker.rb
 | 
				
			||||||
 | 
					sample/tkextlib/vu/canvSticker2.rb
 | 
				
			||||||
 | 
					sample/tkextlib/vu/dial.rb
 | 
				
			||||||
 | 
					sample/tkextlib/vu/m128_000.xbm
 | 
				
			||||||
 | 
					sample/tkextlib/vu/oscilloscope.rb
 | 
				
			||||||
 | 
					sample/tkextlib/vu/pie.rb
 | 
				
			||||||
 | 
					sample/tkextlib/vu/vu.rb
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,7 @@
 | 
				
			||||||
If you want to use Ruby/Tk (tk.rb and so on), you must have
 | 
					If you want to use Ruby/Tk (tk.rb and so on), you must have
 | 
				
			||||||
tcltklib.so which is working collectry. If you fail to call 
 | 
					tcltklib.so which is working collectry. If you fail to call 
 | 
				
			||||||
'require "tcltklib"', you may not have tcltklib.so. 
 | 
					'require "tcltklib"', you may not have tcltklib.so. 
 | 
				
			||||||
 | 
					( see also README files of tcltklib )
 | 
				
			||||||
Even if there is a tcltklib.so on your Ruby library directry, 
 | 
					Even if there is a tcltklib.so on your Ruby library directry, 
 | 
				
			||||||
it will not work without Tcl/Tk libraries (e.g. libtcl8.4.so) 
 | 
					it will not work without Tcl/Tk libraries (e.g. libtcl8.4.so) 
 | 
				
			||||||
on your environment. You must also check that your Tcl/Tk is 
 | 
					on your environment. You must also check that your Tcl/Tk is 
 | 
				
			||||||
| 
						 | 
					@ -12,6 +13,7 @@ installed properly.
 | 
				
			||||||
Ruby/Tk (tk.rb など) を使いたい場合には,tcltklib.so が正しく
 | 
					Ruby/Tk (tk.rb など) を使いたい場合には,tcltklib.so が正しく
 | 
				
			||||||
動いていなければなりません.もし require "tcltklib" に失敗する
 | 
					動いていなければなりません.もし require "tcltklib" に失敗する
 | 
				
			||||||
ようなら,tcltklib.so が存在していないのかもしれません.
 | 
					ようなら,tcltklib.so が存在していないのかもしれません.
 | 
				
			||||||
 | 
					( tcltklib の README ファイルも見てください )
 | 
				
			||||||
たとえ Ruby のライブラリディレクトリに tcltklib.so が存在して
 | 
					たとえ Ruby のライブラリディレクトリに tcltklib.so が存在して
 | 
				
			||||||
いたとしても,実行環境に Tcl/Tk ライブラリ (libtcl8.4.so など) 
 | 
					いたとしても,実行環境に Tcl/Tk ライブラリ (libtcl8.4.so など) 
 | 
				
			||||||
がなければ機能しません.Tcl/Tk が正しくインストールされているか
 | 
					がなければ機能しません.Tcl/Tk が正しくインストールされているか
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,17 @@
 | 
				
			||||||
README		this file
 | 
					README		this file
 | 
				
			||||||
multi-tk.rb	multiple Tk interpreter (included safe-Tk) support
 | 
					multi-tk.rb	multiple Tk interpreter (included safe-Tk) support
 | 
				
			||||||
 | 
					remotei-tk.rb	control remote Tk interpreter on the other process support
 | 
				
			||||||
tk.rb		Tk interface
 | 
					tk.rb		Tk interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tk/             library files construct Ruby/Tk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tkextlib/       non-standard Tcl/Tk extension support libraries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					*********************************************************************
 | 
				
			||||||
 | 
					***  The followings exists for backward compatibility only.
 | 
				
			||||||
 | 
					***  The only thing which they work is that requires current 
 | 
				
			||||||
 | 
					***  library files ( tk/*.rb ). 
 | 
				
			||||||
 | 
					*********************************************************************
 | 
				
			||||||
tkafter.rb	handles Tcl after
 | 
					tkafter.rb	handles Tcl after
 | 
				
			||||||
tkbgerror.rb	Tk error module
 | 
					tkbgerror.rb	Tk error module
 | 
				
			||||||
tkcanvas.rb	Tk canvas interface
 | 
					tkcanvas.rb	Tk canvas interface
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										1478
									
								
								ext/tk/lib/tk.rb
									
										
									
									
									
								
							
							
						
						
									
										1478
									
								
								ext/tk/lib/tk.rb
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -63,6 +63,8 @@ autoload :TkImage,            'tk/image'
 | 
				
			||||||
autoload :TkBitmapImage,      'tk/image'
 | 
					autoload :TkBitmapImage,      'tk/image'
 | 
				
			||||||
autoload :TkPhotoImage,       'tk/image'
 | 
					autoload :TkPhotoImage,       'tk/image'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					autoload :TkItemConfigMethod, 'tk/itemconfig'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
autoload :TkTreatItemFont,    'tk/itemfont'
 | 
					autoload :TkTreatItemFont,    'tk/itemfont'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
autoload :TkKinput,           'tk/kinput'
 | 
					autoload :TkKinput,           'tk/kinput'
 | 
				
			||||||
| 
						 | 
					@ -150,6 +152,7 @@ autoload :TkToplevel,         'tk/toplevel'
 | 
				
			||||||
autoload :TkTextWin,          'tk/txtwin_abst'
 | 
					autoload :TkTextWin,          'tk/txtwin_abst'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
autoload :TkValidation,       'tk/validation'
 | 
					autoload :TkValidation,       'tk/validation'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
autoload :TkVariable,         'tk/variable'
 | 
					autoload :TkVariable,         'tk/variable'
 | 
				
			||||||
autoload :TkVarAccess,        'tk/variable'
 | 
					autoload :TkVarAccess,        'tk/variable'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -167,9 +170,13 @@ autoload :TkXIM,              'tk/xim'
 | 
				
			||||||
# sub-module of Tk
 | 
					# sub-module of Tk
 | 
				
			||||||
module Tk
 | 
					module Tk
 | 
				
			||||||
  autoload :Clock,            'tk/clock'
 | 
					  autoload :Clock,            'tk/clock'
 | 
				
			||||||
 | 
					  autoload :OptionObj,        'tk/optionobj'
 | 
				
			||||||
  autoload :Scrollable,       'tk/scrollable'
 | 
					  autoload :Scrollable,       'tk/scrollable'
 | 
				
			||||||
  autoload :Wm,               'tk/wm'
 | 
					  autoload :Wm,               'tk/wm'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  autoload :ValidateConfigure,     'tk/validation'
 | 
				
			||||||
 | 
					  autoload :ItemValidateConfigure, 'tk/validation'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  autoload :EncodedString,    'tk/encodedstr'
 | 
					  autoload :EncodedString,    'tk/encodedstr'
 | 
				
			||||||
  def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end
 | 
					  def Tk.EncodedString(str, enc = nil); Tk::EncodedString.new(str, enc); end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,16 +7,16 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
require 'tk'
 | 
					require 'tk'
 | 
				
			||||||
require 'tk/canvastag'
 | 
					require 'tk/canvastag'
 | 
				
			||||||
require 'tk/itemfont'
 | 
					require 'tk/itemconfig'
 | 
				
			||||||
require 'tk/scrollable'
 | 
					require 'tk/scrollable'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module TkTreatCItemFont
 | 
					module TkCanvasItemConfig
 | 
				
			||||||
  include TkTreatItemFont
 | 
					  include TkItemConfigMethod
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ItemCMD = ['itemconfigure'.freeze, TkComm::None].freeze
 | 
					  def __item_methodcall_optkeys(id)
 | 
				
			||||||
  def __conf_cmd(idx)
 | 
					    {'coords'=>'coords'}
 | 
				
			||||||
    ItemCMD[idx]
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					  private :__item_methodcall_optkeys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def __item_pathname(tagOrId)
 | 
					  def __item_pathname(tagOrId)
 | 
				
			||||||
    if tagOrId.kind_of?(TkcItem) || tagOrId.kind_of?(TkcTag)
 | 
					    if tagOrId.kind_of?(TkcItem) || tagOrId.kind_of?(TkcTag)
 | 
				
			||||||
| 
						 | 
					@ -25,12 +25,11 @@ module TkTreatCItemFont
 | 
				
			||||||
      self.path + ';' + tagOrId.to_s
 | 
					      self.path + ';' + tagOrId.to_s
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					  private :__item_pathname
 | 
				
			||||||
  private :__conf_cmd, :__item_pathname
 | 
					 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TkCanvas<TkWindow
 | 
					class TkCanvas<TkWindow
 | 
				
			||||||
  include TkTreatCItemFont
 | 
					  include TkCanvasItemConfig
 | 
				
			||||||
  include Scrollable
 | 
					  include Scrollable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TkCommandNames = ['canvas'.freeze].freeze
 | 
					  TkCommandNames = ['canvas'.freeze].freeze
 | 
				
			||||||
| 
						 | 
					@ -130,6 +129,7 @@ class TkCanvas<TkWindow
 | 
				
			||||||
      tk_split_list(tk_send_without_enc('coords', tagid(tag)))
 | 
					      tk_split_list(tk_send_without_enc('coords', tagid(tag)))
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      tk_send_without_enc('coords', tagid(tag), *(args.flatten))
 | 
					      tk_send_without_enc('coords', tagid(tag), *(args.flatten))
 | 
				
			||||||
 | 
					      self
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -217,6 +217,7 @@ class TkCanvas<TkWindow
 | 
				
			||||||
    self
 | 
					    self
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=begin
 | 
				
			||||||
  def itemcget(tagOrId, option)
 | 
					  def itemcget(tagOrId, option)
 | 
				
			||||||
    case option.to_s
 | 
					    case option.to_s
 | 
				
			||||||
    when 'dash', 'activedash', 'disableddash'
 | 
					    when 'dash', 'activedash', 'disableddash'
 | 
				
			||||||
| 
						 | 
					@ -453,6 +454,7 @@ class TkCanvas<TkWindow
 | 
				
			||||||
      ret
 | 
					      ret
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					=end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def lower(tag, below=nil)
 | 
					  def lower(tag, below=nil)
 | 
				
			||||||
    if below
 | 
					    if below
 | 
				
			||||||
| 
						 | 
					@ -523,6 +525,8 @@ end
 | 
				
			||||||
class TkcItem<TkObject
 | 
					class TkcItem<TkObject
 | 
				
			||||||
  extend Tk
 | 
					  extend Tk
 | 
				
			||||||
  include TkcTagAccess
 | 
					  include TkcTagAccess
 | 
				
			||||||
 | 
					  extend TkItemFontOptkeys
 | 
				
			||||||
 | 
					  extend TkItemConfigOptkeys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  CItemTypeName = nil
 | 
					  CItemTypeName = nil
 | 
				
			||||||
  CItemTypeToClass = {}
 | 
					  CItemTypeToClass = {}
 | 
				
			||||||
| 
						 | 
					@ -543,6 +547,7 @@ class TkcItem<TkObject
 | 
				
			||||||
  ########################################
 | 
					  ########################################
 | 
				
			||||||
  def self._parse_create_args(args)
 | 
					  def self._parse_create_args(args)
 | 
				
			||||||
    fontkeys = {}
 | 
					    fontkeys = {}
 | 
				
			||||||
 | 
					    methodkeys = {}
 | 
				
			||||||
    if args[-1].kind_of? Hash
 | 
					    if args[-1].kind_of? Hash
 | 
				
			||||||
      keys = _symbolkey2str(args.pop)
 | 
					      keys = _symbolkey2str(args.pop)
 | 
				
			||||||
      if args.size == 0
 | 
					      if args.size == 0
 | 
				
			||||||
| 
						 | 
					@ -552,11 +557,30 @@ class TkcItem<TkObject
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
 | 
					      #['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
 | 
				
			||||||
	fontkeys[key] = keys.delete(key) if keys.key?(key)
 | 
					      #  fontkeys[key] = keys.delete(key) if keys.key?(key)
 | 
				
			||||||
 | 
					      #}
 | 
				
			||||||
 | 
					      __item_font_optkeys(nil).each{|key|
 | 
				
			||||||
 | 
						fkey = key.to_s
 | 
				
			||||||
 | 
						fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fkey = "kanji#{key}"
 | 
				
			||||||
 | 
						fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fkey = "latin#{key}"
 | 
				
			||||||
 | 
						fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fkey = "ascii#{key}"
 | 
				
			||||||
 | 
						fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      args = args.flatten.concat(hash_kv(keys))
 | 
					      __item_methodcall_optkeys(nil).each{|key|
 | 
				
			||||||
 | 
						key = key.to_s
 | 
				
			||||||
 | 
						methodkeys[key] = keys.delete(key) if keys.key?(key)
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      #args = args.flatten.concat(hash_kv(keys))
 | 
				
			||||||
 | 
					      args = args.flatten.concat(itemconfig_hash_kv(nil, keys))
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      args = args.flatten
 | 
					      args = args.flatten
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					@ -597,6 +621,14 @@ class TkcItem<TkObject
 | 
				
			||||||
    @id
 | 
					    @id
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def exist?
 | 
				
			||||||
 | 
					    if @c.find_withtag(@id)
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      false
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def delete
 | 
					  def delete
 | 
				
			||||||
    @c.delete @id
 | 
					    @c.delete @id
 | 
				
			||||||
    CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path]
 | 
					    CItemID_TBL[@path].delete(@id) if CItemID_TBL[@path]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -204,6 +204,14 @@ class TkcTag<TkObject
 | 
				
			||||||
    @id
 | 
					    @id
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def exist?
 | 
				
			||||||
 | 
					    if @c.find_withtag(@id)
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      false
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def delete
 | 
					  def delete
 | 
				
			||||||
    @c.delete @id
 | 
					    @c.delete @id
 | 
				
			||||||
    CTagID_TBL[@cpath].delete(@id) if CTagID_TBL[@cpath]
 | 
					    CTagID_TBL[@cpath].delete(@id) if CTagID_TBL[@cpath]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,17 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#  tk/event.rb - module for event
 | 
					#  tk/event.rb - module for event
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
require 'tk'
 | 
					
 | 
				
			||||||
 | 
					unless $LOADED_FEATURES.member?('tk.rb')
 | 
				
			||||||
 | 
					  # change loading order
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  $LOADED_FEATURES.delete('tk/event.rb')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  require 'tkutil'
 | 
				
			||||||
 | 
					  require 'tk'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module TkEvent
 | 
					module TkEvent
 | 
				
			||||||
  class Event < TkUtil::CallbackSubst
 | 
					  class Event < TkUtil::CallbackSubst
 | 
				
			||||||
| 
						 | 
					@ -42,7 +52,7 @@ module TkEvent
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>]
 | 
					    # [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>]
 | 
				
			||||||
    key_tbl = [
 | 
					    KEY_TBL = [
 | 
				
			||||||
      [ ?#, ?n, :serial ], 
 | 
					      [ ?#, ?n, :serial ], 
 | 
				
			||||||
      [ ?a, ?s, :above ], 
 | 
					      [ ?a, ?s, :above ], 
 | 
				
			||||||
      [ ?b, ?n, :num ], 
 | 
					      [ ?b, ?n, :num ], 
 | 
				
			||||||
| 
						 | 
					@ -76,7 +86,7 @@ module TkEvent
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>]
 | 
					    # [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>]
 | 
				
			||||||
    proc_tbl = [
 | 
					    PROC_TBL = [
 | 
				
			||||||
      [ ?n, TkComm.method(:num_or_str) ], 
 | 
					      [ ?n, TkComm.method(:num_or_str) ], 
 | 
				
			||||||
      [ ?s, TkComm.method(:string) ], 
 | 
					      [ ?s, TkComm.method(:string) ], 
 | 
				
			||||||
      [ ?b, TkComm.method(:bool) ], 
 | 
					      [ ?b, TkComm.method(:bool) ], 
 | 
				
			||||||
| 
						 | 
					@ -106,13 +116,13 @@ module TkEvent
 | 
				
			||||||
    #     ( which are Tcl strings ) to ruby objects based on the key string 
 | 
					    #     ( which are Tcl strings ) to ruby objects based on the key string 
 | 
				
			||||||
    #     that is generated by _get_subst_key() or _get_all_subst_keys(). 
 | 
					    #     that is generated by _get_subst_key() or _get_all_subst_keys(). 
 | 
				
			||||||
    #
 | 
					    #
 | 
				
			||||||
    _setup_subst_table(key_tbl, proc_tbl);
 | 
					    _setup_subst_table(KEY_TBL, PROC_TBL);
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def install_bind(cmd, *args)
 | 
					  def install_bind_for_event_class(klass, cmd, *args)
 | 
				
			||||||
    if args.compact.size > 0
 | 
					    if args.compact.size > 0
 | 
				
			||||||
      args = args.join(' ')
 | 
					      args = args.join(' ')
 | 
				
			||||||
      keys = Event._get_subst_key(args)
 | 
					      keys = klass._get_subst_key(args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if cmd.kind_of?(String)
 | 
					      if cmd.kind_of?(String)
 | 
				
			||||||
	id = cmd
 | 
						id = cmd
 | 
				
			||||||
| 
						 | 
					@ -120,12 +130,12 @@ module TkEvent
 | 
				
			||||||
	id = install_cmd(cmd)
 | 
						id = install_cmd(cmd)
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
	id = install_cmd(proc{|*arg|
 | 
						id = install_cmd(proc{|*arg|
 | 
				
			||||||
	  TkUtil.eval_cmd(cmd, *Event.scan_args(keys, arg))
 | 
						  TkUtil.eval_cmd(cmd, *klass.scan_args(keys, arg))
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
      id + ' ' + args
 | 
					      id + ' ' + args
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      keys, args = Event._get_all_subst_keys
 | 
					      keys, args = klass._get_all_subst_keys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if cmd.kind_of?(String)
 | 
					      if cmd.kind_of?(String)
 | 
				
			||||||
	id = cmd
 | 
						id = cmd
 | 
				
			||||||
| 
						 | 
					@ -133,10 +143,17 @@ module TkEvent
 | 
				
			||||||
	id = install_cmd(cmd)
 | 
						id = install_cmd(cmd)
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        id = install_cmd(proc{|*arg|
 | 
					        id = install_cmd(proc{|*arg|
 | 
				
			||||||
	  TkUtil.eval_cmd(cmd, Event.new(*Event.scan_args(keys, arg)))
 | 
						  TkUtil.eval_cmd(cmd, klass.new(*klass.scan_args(keys, arg)))
 | 
				
			||||||
        })
 | 
					        })
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
      id + ' ' + args
 | 
					      id + ' ' + args
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def install_bind(cmd, *args)
 | 
				
			||||||
 | 
					    install_bind_for_event_class(Event, cmd, *args)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					################################################
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,25 +73,18 @@ class TkFont
 | 
				
			||||||
	when 'unix'
 | 
						when 'unix'
 | 
				
			||||||
	  ltn = {'family'=>'Helvetica'.freeze, 
 | 
						  ltn = {'family'=>'Helvetica'.freeze, 
 | 
				
			||||||
	         'size'=>-12, 'weight'=>'bold'.freeze}
 | 
						         'size'=>-12, 'weight'=>'bold'.freeze}
 | 
				
			||||||
	  #knj = 'k14'
 | 
					 | 
				
			||||||
	  #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
 | 
					 | 
				
			||||||
	  knj = '-*-fixed-bold-r-normal--12-*-*-*-c-*-jisx0208.1983-0'
 | 
					 | 
				
			||||||
	when 'windows'
 | 
						when 'windows'
 | 
				
			||||||
	  ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
 | 
						  ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
 | 
				
			||||||
	  knj = 'mincho'
 | 
					 | 
				
			||||||
	when 'macintosh'
 | 
						when 'macintosh'
 | 
				
			||||||
	  ltn = 'system'
 | 
						  ltn = 'system'
 | 
				
			||||||
	  knj = 'mincho'
 | 
					 | 
				
			||||||
	else # unknown
 | 
						else # unknown
 | 
				
			||||||
	  ltn = 'Helvetica'
 | 
						  ltn = 'Helvetica'
 | 
				
			||||||
	  knj = 'mincho'
 | 
					 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
      rescue
 | 
					      rescue
 | 
				
			||||||
	ltn = 'Helvetica'
 | 
						ltn = 'Helvetica'
 | 
				
			||||||
	knj = 'mincho'
 | 
					 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      knj = ltn
 | 
					      knj = ltn.dup
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    DEFAULT_LATIN_FONT_NAME = ltn.freeze
 | 
					    DEFAULT_LATIN_FONT_NAME = ltn.freeze
 | 
				
			||||||
| 
						 | 
					@ -202,54 +195,74 @@ class TkFont
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def TkFont.init_widget_font(path, *args)
 | 
					  def TkFont.init_widget_font(pathname, *args)
 | 
				
			||||||
 | 
					    win, tag, key = pathname.split(';')
 | 
				
			||||||
 | 
					    key = 'font' unless key
 | 
				
			||||||
 | 
					    path = [win, tag, key].join(';')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case (Tk::TK_VERSION)
 | 
					    case (Tk::TK_VERSION)
 | 
				
			||||||
    when /^4\.*/
 | 
					    when /^4\.*/
 | 
				
			||||||
      conf = tk_split_simplelist(tk_call(*args)).
 | 
					      regexp = /^-(|kanji)#{key} /
 | 
				
			||||||
	find_all{|prop| prop[0..5]=='-font ' || prop[0..10]=='-kanjifont '}.
 | 
					
 | 
				
			||||||
 | 
					      conf_list = tk_split_simplelist(tk_call(*args)).
 | 
				
			||||||
 | 
						find_all{|prop| prop =~ regexp}.
 | 
				
			||||||
	collect{|prop| tk_split_simplelist(prop)}
 | 
						collect{|prop| tk_split_simplelist(prop)}
 | 
				
			||||||
      if font_inf = conf.assoc('-font')
 | 
					
 | 
				
			||||||
	ltn = font_inf[4]
 | 
					      if conf_list.size == 0
 | 
				
			||||||
	ltn = nil if ltn == []
 | 
						raise RuntimeError, "the widget may not support 'font' option"
 | 
				
			||||||
      else 
 | 
					 | 
				
			||||||
	#ltn = nil
 | 
					 | 
				
			||||||
	raise RuntimeError, "unknown option '-font'"
 | 
					 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
      if font_inf = conf.assoc('-kanjifont')
 | 
					
 | 
				
			||||||
	knj = font_inf[4]
 | 
					      args << {}
 | 
				
			||||||
	knj = nil if knj == []
 | 
					
 | 
				
			||||||
      else
 | 
					      ltn_key = "-#{key}"
 | 
				
			||||||
	knj = nil
 | 
					      knj_key = "-kanji#{key}"
 | 
				
			||||||
      end
 | 
					
 | 
				
			||||||
      TkFont.new(ltn, knj).call_font_configure(path, *(args + [{}]))
 | 
					      ltn_info = conf_list.find{|conf| conf[0] == ltn_key}
 | 
				
			||||||
 | 
					      ltn = ltn_info[-1]
 | 
				
			||||||
 | 
					      ltn = nil if ltn == [] || ltn == ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      knj_info = conf_list.find{|conf| conf[0] == knj_key}
 | 
				
			||||||
 | 
					      knj = knj_info[-1]
 | 
				
			||||||
 | 
					      knj = nil if knj == [] || knj == ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      TkFont.new(ltn, knj).call_font_configure([path, key], *args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    when /^8\.*/
 | 
					    when /^8\.*/
 | 
				
			||||||
      font_prop = tk_split_simplelist(tk_call(*args)).find{|prop| 
 | 
					      regexp = /^-#{key} /
 | 
				
			||||||
	prop[0..5] == '-font '
 | 
					
 | 
				
			||||||
      }
 | 
					      conf_list = tk_split_simplelist(tk_call(*args)).
 | 
				
			||||||
      unless font_prop
 | 
						find_all{|prop| prop =~ regexp}.
 | 
				
			||||||
	raise RuntimeError, "unknown option '-font'"
 | 
						collect{|prop| tk_split_simplelist(prop)}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if conf_list.size == 0
 | 
				
			||||||
 | 
						raise RuntimeError, "the widget may not support 'font' option"
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
      fnt = tk_split_simplelist(font_prop)[4]
 | 
					
 | 
				
			||||||
      if fnt == ""
 | 
					      args << {}
 | 
				
			||||||
	TkFont.new(nil, nil).call_font_configure(path, *(args + [{}]))
 | 
					
 | 
				
			||||||
 | 
					      optkey = "-#{key}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      info = conf_list.find{|conf| conf[0] == optkey}
 | 
				
			||||||
 | 
					      fnt = info[-1]
 | 
				
			||||||
 | 
					      fnt = nil if fnt == [] || fnt == ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      unless fnt
 | 
				
			||||||
 | 
						TkFont.new(nil, nil).call_font_configure([path, key], *args)
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
	begin
 | 
						begin
 | 
				
			||||||
	  compound = tk_split_simplelist(
 | 
						  compound = tk_split_simplelist(
 | 
				
			||||||
            Hash[*tk_split_simplelist(tk_call('font', 'configure', 
 | 
					              Hash[*tk_split_simplelist(tk_call('font', 'configure', 
 | 
				
			||||||
					       fnt))].collect{|key,value|
 | 
											fnt))].collect{|key,value|
 | 
				
			||||||
              [key[1..-1], value]
 | 
					                [key[1..-1], value]
 | 
				
			||||||
            }.assoc('compound')[1])
 | 
					              }.assoc('compound')[1])
 | 
				
			||||||
	rescue
 | 
						rescue
 | 
				
			||||||
	  compound = []
 | 
						  compound = []
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
	if compound == []
 | 
						if compound == []
 | 
				
			||||||
	  #TkFont.new(fnt, DEFAULT_KANJI_FONT_NAME) \
 | 
						  TkFont.new(fnt).call_font_configure([path, key], *args)
 | 
				
			||||||
	  #.call_font_configure(path, *(args + [{}]))
 | 
					 | 
				
			||||||
	  TkFont.new(fnt).call_font_configure(path, *(args + [{}]))
 | 
					 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	  TkFont.new(compound[0], compound[1]) \
 | 
						  TkFont.new(compound[0], 
 | 
				
			||||||
	  .call_font_configure(path, *(args + [{}]))
 | 
							     compound[1]).call_font_configure([path, key], *args)
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					@ -854,15 +867,16 @@ class TkFont
 | 
				
			||||||
      if self == fobj
 | 
					      if self == fobj
 | 
				
			||||||
	begin
 | 
						begin
 | 
				
			||||||
	  if w.include?(';')
 | 
						  if w.include?(';')
 | 
				
			||||||
	    win, tag = w.split(';')
 | 
						    win, tag, optkey = w.split(';')
 | 
				
			||||||
 | 
						    optkey = 'font' unless optkey
 | 
				
			||||||
	    winobj = tk_tcl2ruby(win)
 | 
						    winobj = tk_tcl2ruby(win)
 | 
				
			||||||
#	    winobj.tagfont_configure(tag, {'font'=>@latinfont})
 | 
					#	    winobj.tagfont_configure(tag, {'font'=>@latinfont})
 | 
				
			||||||
	    if winobj.kind_of? TkText
 | 
						    if winobj.kind_of? TkText
 | 
				
			||||||
	      tk_call(win, 'tag', 'configure', tag, '-font', @latinfont)
 | 
						      tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @latinfont)
 | 
				
			||||||
	    elsif winobj.kind_of? TkCanvas
 | 
						    elsif winobj.kind_of? TkCanvas
 | 
				
			||||||
	      tk_call(win, 'itemconfigure', tag, '-font', @latinfont)
 | 
						      tk_call(win, 'itemconfigure', tag, "-#{optkey}", @latinfont)
 | 
				
			||||||
	    elsif winobj.kind_of? TkMenu
 | 
						    elsif winobj.kind_of? TkMenu
 | 
				
			||||||
	      tk_call(win, 'entryconfigure', tag, '-font', @latinfont)
 | 
						      tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
 | 
				
			||||||
	    else
 | 
						    else
 | 
				
			||||||
	      raise RuntimeError, "unknown widget type"
 | 
						      raise RuntimeError, "unknown widget type"
 | 
				
			||||||
	    end
 | 
						    end
 | 
				
			||||||
| 
						 | 
					@ -888,15 +902,16 @@ class TkFont
 | 
				
			||||||
      if self == fobj
 | 
					      if self == fobj
 | 
				
			||||||
	begin
 | 
						begin
 | 
				
			||||||
	  if w.include?(';')
 | 
						  if w.include?(';')
 | 
				
			||||||
	    win, tag = w.split(';')
 | 
						    win, tag, optkey = w.split(';')
 | 
				
			||||||
 | 
						    optkey = 'kanjifont' unless optkey
 | 
				
			||||||
	    winobj = tk_tcl2ruby(win)
 | 
						    winobj = tk_tcl2ruby(win)
 | 
				
			||||||
#	    winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
 | 
					#	    winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
 | 
				
			||||||
	    if winobj.kind_of? TkText
 | 
						    if winobj.kind_of? TkText
 | 
				
			||||||
	      tk_call(win, 'tag', 'configure', tag, '-kanjifont', @kanjifont)
 | 
						      tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @kanjifont)
 | 
				
			||||||
	    elsif winobj.kind_of? TkCanvas
 | 
						    elsif winobj.kind_of? TkCanvas
 | 
				
			||||||
	      tk_call(win, 'itemconfigure', tag, '-kanjifont', @kanjifont)
 | 
						      tk_call(win, 'itemconfigure', tag, "-#{optkey}", @kanjifont)
 | 
				
			||||||
	    elsif winobj.kind_of? TkMenu
 | 
						    elsif winobj.kind_of? TkMenu
 | 
				
			||||||
	      tk_call(win, 'entryconfigure', tag, '-kanjifont', @latinfont)
 | 
						      tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
 | 
				
			||||||
	    else
 | 
						    else
 | 
				
			||||||
	      raise RuntimeError, "unknown widget type"
 | 
						      raise RuntimeError, "unknown widget type"
 | 
				
			||||||
	    end
 | 
						    end
 | 
				
			||||||
| 
						 | 
					@ -1128,36 +1143,77 @@ class TkFont
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def call_font_configure(path, *args)
 | 
					  def call_font_configure(path, *args)
 | 
				
			||||||
    keys = args.pop.update(@fontslot)
 | 
					    if path.kind_of?(Array)
 | 
				
			||||||
 | 
					      # [path, optkey]
 | 
				
			||||||
 | 
					      win, tag = path[0].split(';')
 | 
				
			||||||
 | 
					      optkey = path[1].to_s
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      win, tag, optkey = path.split(';')
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fontslot = _symbolkey2str(@fontslot)
 | 
				
			||||||
 | 
					    if optkey && optkey != ""
 | 
				
			||||||
 | 
					      ltn = fontslot.delete('font')
 | 
				
			||||||
 | 
					      knj = fontslot.delete('kanjifont')
 | 
				
			||||||
 | 
					      fontslot[optkey] = ltn if ltn
 | 
				
			||||||
 | 
					      fontslot["kanji#{optkey}"] = knj if knj
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    keys = _symbolkey2str(args.pop).update(fontslot)
 | 
				
			||||||
    args.concat(hash_kv(keys))
 | 
					    args.concat(hash_kv(keys))
 | 
				
			||||||
    tk_call(*args)
 | 
					    tk_call(*args)
 | 
				
			||||||
    Tk_FontUseTBL[path] = self
 | 
					    Tk_FontUseTBL[[win, tag, optkey].join(';')] = self
 | 
				
			||||||
    self
 | 
					    self
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def used
 | 
					  def used
 | 
				
			||||||
    ret = []
 | 
					    ret = []
 | 
				
			||||||
    Tk_FontUseTBL.each{|key,value|
 | 
					    Tk_FontUseTBL.each{|key,value|
 | 
				
			||||||
 | 
					      next unless self == value
 | 
				
			||||||
      if key.include?(';')
 | 
					      if key.include?(';')
 | 
				
			||||||
	win, tag = key.split(';')
 | 
						win, tag, optkey = key.split(';')
 | 
				
			||||||
	winobj = tk_tcl2ruby(win)
 | 
						winobj = tk_tcl2ruby(win)
 | 
				
			||||||
	if winobj.kind_of? TkText
 | 
						if winobj.kind_of? TkText
 | 
				
			||||||
	  ret.push([winobj, winobj.tagid2obj(tag)])
 | 
						  if optkey
 | 
				
			||||||
 | 
						    ret.push([winobj, winobj.tagid2obj(tag), optkey])
 | 
				
			||||||
 | 
						  else
 | 
				
			||||||
 | 
						    ret.push([winobj, winobj.tagid2obj(tag)])
 | 
				
			||||||
 | 
						  end
 | 
				
			||||||
	elsif winobj.kind_of? TkCanvas
 | 
						elsif winobj.kind_of? TkCanvas
 | 
				
			||||||
	  if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
 | 
						  if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
 | 
				
			||||||
	    ret.push([winobj, tagobj])
 | 
						    if optkey
 | 
				
			||||||
	  elsif (tagobj = TkcItem.id2obj(tag)).kind_of? TkcItem
 | 
						      ret.push([winobj, tagobj, optkey])
 | 
				
			||||||
	    ret.push([winobj, tagobj])
 | 
						    else
 | 
				
			||||||
 | 
						      ret.push([winobj, tagobj])
 | 
				
			||||||
 | 
						    end
 | 
				
			||||||
 | 
						  elsif (tagobj = TkcItem.id2obj(winobj, tag)).kind_of? TkcItem
 | 
				
			||||||
 | 
						    if optkey
 | 
				
			||||||
 | 
						      ret.push([winobj, tagobj, optkey])
 | 
				
			||||||
 | 
						    else
 | 
				
			||||||
 | 
						      ret.push([winobj, tagobj])
 | 
				
			||||||
 | 
						    end
 | 
				
			||||||
 | 
						  else
 | 
				
			||||||
 | 
						    if optkey
 | 
				
			||||||
 | 
						      ret.push([winobj, tag, optkey])
 | 
				
			||||||
 | 
						    else
 | 
				
			||||||
 | 
						      ret.push([winobj, tag])
 | 
				
			||||||
 | 
						    end
 | 
				
			||||||
 | 
						  end
 | 
				
			||||||
 | 
						elsif winobj.kind_of? TkMenu
 | 
				
			||||||
 | 
						  if optkey
 | 
				
			||||||
 | 
						    ret.push([winobj, tag, optkey])
 | 
				
			||||||
	  else
 | 
						  else
 | 
				
			||||||
	    ret.push([winobj, tag])
 | 
						    ret.push([winobj, tag])
 | 
				
			||||||
	  end
 | 
						  end
 | 
				
			||||||
	elsif winobj.kind_of? TkMenu
 | 
					 | 
				
			||||||
	  ret.push([winobj, tag])
 | 
					 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	  ret.push([win, tag])
 | 
						  if optkey
 | 
				
			||||||
 | 
						    ret.push([win, tag, optkey])
 | 
				
			||||||
 | 
						  else
 | 
				
			||||||
 | 
						    ret.push([win, tag])
 | 
				
			||||||
 | 
						  end
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
	ret.push(tk_tcl2ruby(key)) if value == self
 | 
						ret.push(tk_tcl2ruby(key))
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ret
 | 
					    ret
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,182 +3,294 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
require 'tk'
 | 
					require 'tk'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module TkTreatItemFont
 | 
					module TkItemFontOptkeys
 | 
				
			||||||
  def __conf_cmd(idx)
 | 
					  def __item_font_optkeys(id)
 | 
				
			||||||
    raise NotImplementedError, "need to define `__conf_cmd'"
 | 
					    # maybe need to override
 | 
				
			||||||
 | 
					    ['font']
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  def __item_pathname(tagOrId)
 | 
					  private :__item_font_optkeys
 | 
				
			||||||
    raise NotImplementedError, "need to define `__item_pathname'"
 | 
					end
 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
  private :__conf_cmd, :__item_pathname
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def tagfont_configinfo(tagOrId, name = nil)
 | 
					module TkTreatItemFont
 | 
				
			||||||
    pathname = __item_pathname(tagOrId)
 | 
					  include TkItemFontOptkeys
 | 
				
			||||||
    ret = TkFont.used_on(pathname)
 | 
					
 | 
				
			||||||
    if ret == nil
 | 
					  def __item_pathname(id)
 | 
				
			||||||
=begin
 | 
					    # maybe need to override
 | 
				
			||||||
      if name
 | 
					    [self.path, id].join(';')
 | 
				
			||||||
	ret = name
 | 
					  end
 | 
				
			||||||
      else
 | 
					  private :__item_pathname
 | 
				
			||||||
	ret = TkFont.init_widget_font(pathname, self.path, 
 | 
					
 | 
				
			||||||
				      __conf_cmd(0), __conf_cmd(1), tagOrId)
 | 
					  ################################################
 | 
				
			||||||
      end
 | 
					
 | 
				
			||||||
=end
 | 
					  def tagfont_configinfo(tagOrId, key = nil)
 | 
				
			||||||
      ret = TkFont.init_widget_font(pathname, self.path, 
 | 
					    optkeys = __item_font_optkeys(tagid(tagOrId))
 | 
				
			||||||
				    __conf_cmd(0), __conf_cmd(1), tagOrId)
 | 
					    if key && !optkeys.find{|opt| opt.to_s == key.to_s}
 | 
				
			||||||
 | 
					      fail ArgumentError, "unknown font option name `#{key}'"
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    win, tag = __item_pathname(tagid(tagOrId)).split(':')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if key
 | 
				
			||||||
 | 
					      pathname = [win, tag, key].join(';')
 | 
				
			||||||
 | 
					      TkFont.used_on(pathname) || 
 | 
				
			||||||
 | 
						TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
 | 
				
			||||||
 | 
					    elsif optkeys.size == 1
 | 
				
			||||||
 | 
					      pathname = [win, tag, optkeys[0]].join(';')
 | 
				
			||||||
 | 
					      TkFont.used_on(pathname) || 
 | 
				
			||||||
 | 
						TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      fonts = {}
 | 
				
			||||||
 | 
					      optkeys.each{|key|
 | 
				
			||||||
 | 
						key = key.to_s
 | 
				
			||||||
 | 
						pathname = [win, tag, key].join(';')
 | 
				
			||||||
 | 
						fonts[key] = 
 | 
				
			||||||
 | 
						  TkFont.used_on(pathname) || 
 | 
				
			||||||
 | 
						  TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      fonts
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    ret
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  alias tagfontobj tagfont_configinfo
 | 
					  alias tagfontobj tagfont_configinfo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def tagfont_configure(tagOrId, slot)
 | 
					  def tagfont_configure(tagOrId, slot)
 | 
				
			||||||
    pathname = __item_pathname(tagOrId)
 | 
					    pathname = __item_pathname(tagid(tagOrId))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    slot = _symbolkey2str(slot)
 | 
					    slot = _symbolkey2str(slot)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if slot.key?('font')
 | 
					    __item_font_optkeys(tagid(tagOrId)).each{|optkey|
 | 
				
			||||||
      fnt = slot.delete('font')
 | 
					      optkey = optkey.to_s
 | 
				
			||||||
      if fnt.kind_of? TkFont
 | 
					      l_optkey = 'latin' << optkey
 | 
				
			||||||
	return fnt.call_font_configure(pathname, self.path,
 | 
					      a_optkey = 'ascii' << optkey
 | 
				
			||||||
				       __conf_cmd(0), __conf_cmd(1), 
 | 
					      k_optkey = 'kanji' << optkey
 | 
				
			||||||
				       tagOrId, slot)
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
	if fnt 
 | 
					 | 
				
			||||||
	  if (slot.key?('kanjifont') || 
 | 
					 | 
				
			||||||
	      slot.key?('latinfont') || 
 | 
					 | 
				
			||||||
	      slot.key?('asciifont'))
 | 
					 | 
				
			||||||
	    fnt = TkFont.new(fnt)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    lfnt = slot.delete('latinfont')
 | 
					      if slot.key?(optkey)
 | 
				
			||||||
	    lfnt = slot.delete('asciifont') if slot.key?('asciifont')
 | 
						fnt = slot.delete(optkey)
 | 
				
			||||||
	    kfnt = slot.delete('kanjifont')
 | 
						if fnt.kind_of?(TkFont)
 | 
				
			||||||
 | 
						  slot.delete(l_optkey)
 | 
				
			||||||
 | 
						  slot.delete(a_optkey)
 | 
				
			||||||
 | 
						  slot.delete(k_optkey)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	    fnt.latin_replace(lfnt) if lfnt
 | 
						  fnt.call_font_configure([pathname, optkey], 
 | 
				
			||||||
	    fnt.kanji_replace(kfnt) if kfnt
 | 
									  *(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
 | 
						  next
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						  if fnt
 | 
				
			||||||
 | 
						    if (slot.key?(l_optkey) || 
 | 
				
			||||||
 | 
							slot.key?(a_optkey) || 
 | 
				
			||||||
 | 
							slot.key?(k_optkey))
 | 
				
			||||||
 | 
						      fnt = TkFont.new(fnt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						      lfnt = slot.delete(l_optkey)
 | 
				
			||||||
 | 
						      lfnt = slot.delete(a_optkey) if slot.key?(a_optkey)
 | 
				
			||||||
 | 
						      kfnt = slot.delete(k_optkey)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						      fnt.latin_replace(lfnt) if lfnt
 | 
				
			||||||
 | 
						      fnt.kanji_replace(kfnt) if kfnt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						      fnt.call_font_configure([pathname, optkey], 
 | 
				
			||||||
 | 
									      *(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
 | 
						      next
 | 
				
			||||||
 | 
						    else
 | 
				
			||||||
 | 
						      tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
 | 
				
			||||||
 | 
						    end
 | 
				
			||||||
	  end
 | 
						  end
 | 
				
			||||||
 | 
						  next
 | 
				
			||||||
	  slot['font'] = fnt
 | 
					 | 
				
			||||||
	  tk_call(self.path, __conf_cmd(0), __conf_cmd(1), 
 | 
					 | 
				
			||||||
		  tagOrId, *hash_kv(slot))
 | 
					 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
	return self
 | 
					 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    lfnt = slot.delete('latinfont')
 | 
					      lfnt = slot.delete(l_optkey)
 | 
				
			||||||
    lfnt = slot.delete('asciifont') if slot.key?('asciifont')
 | 
					      lfnt = slot.delete(a_optkey) if slot.key?(a_optkey)
 | 
				
			||||||
    kfnt = slot.delete('kanjifont')
 | 
					      kfnt = slot.delete(k_optkey)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if lfnt && kfnt
 | 
					      if lfnt && kfnt
 | 
				
			||||||
      return TkFont.new(lfnt, kfnt).call_font_configure(pathname, self.path,
 | 
						TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], 
 | 
				
			||||||
							__conf_cmd(0), 
 | 
											   *(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
							__conf_cmd(1), 
 | 
					      elsif lfnt
 | 
				
			||||||
							tagOrId, slot)
 | 
						latintagfont_configure([lfnt, optkey])
 | 
				
			||||||
    end
 | 
					      elsif kfnt
 | 
				
			||||||
 | 
						kanjitagfont_configure([kfnt, optkey])
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    latintagfont_configure(tagOrId, lfnt) if lfnt
 | 
					    # configure other (without font) options
 | 
				
			||||||
    kanjitagfont_configure(tagOrId, kfnt) if kfnt
 | 
					    tk_call(*(__item_config_cmd(tagid(tagOrId)).concat(hash_kv(slot)))) if slot != {}
 | 
				
			||||||
      
 | 
					 | 
				
			||||||
    tk_call(self.path, __conf_cmd(0), __conf_cmd(1), 
 | 
					 | 
				
			||||||
	    tagOrId, *hash_kv(slot)) if slot != {}
 | 
					 | 
				
			||||||
    self
 | 
					    self
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def latintagfont_configure(tagOrId, ltn, keys=nil)
 | 
					  def latintagfont_configure(tagOrId, ltn, keys=nil)
 | 
				
			||||||
    pathname = __item_pathname(tagOrId)
 | 
					    if ltn.kind_of?(Array)
 | 
				
			||||||
    if (fobj = TkFont.used_on(pathname))
 | 
					      key = ltn[1]
 | 
				
			||||||
      fobj = TkFont.new(fobj)    # create a new TkFont object
 | 
					      ltn = ltn[0]
 | 
				
			||||||
    elsif Tk::JAPANIZED_TK
 | 
					 | 
				
			||||||
      fobj = tagfontobj(tagOrId) # create a new TkFont object
 | 
					 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      tk_call(self.path, __conf_cmd(0), __conf_cmd(1), tagOrId, '-font', ltn)
 | 
					      key = nil
 | 
				
			||||||
      return self
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if fobj.kind_of?(TkFont)
 | 
					    optkeys = __item_font_optkeys(tagid(tagOrId))
 | 
				
			||||||
      if ltn.kind_of? TkFont
 | 
					    if key && !optkeys.find{|opt| opt.to_s == key.to_s}
 | 
				
			||||||
	conf = {}
 | 
					      fail ArgumentError, "unknown font option name `#{key}'"
 | 
				
			||||||
	ltn.latin_configinfo.each{|key,val| conf[key] = val}
 | 
					    end
 | 
				
			||||||
	if keys
 | 
					
 | 
				
			||||||
	  fobj.latin_configure(conf.update(keys))
 | 
					    win, tag = __item_pathname(tagid(tagOrId)).split(':')
 | 
				
			||||||
	else
 | 
					
 | 
				
			||||||
	  fobj.latin_configure(conf)
 | 
					    optkeys = [key] if key
 | 
				
			||||||
	end
 | 
					
 | 
				
			||||||
 | 
					    optkeys.each{|optkey|
 | 
				
			||||||
 | 
					      optkey = optkey.to_s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      pathname = [win, tag, optkey].join(';')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (fobj = TkFont.used_on(pathname))
 | 
				
			||||||
 | 
						fobj = TkFont.new(fobj) # create a new TkFont object
 | 
				
			||||||
 | 
					      elsif Tk::JAPANIZED_TK
 | 
				
			||||||
 | 
						fobj = fontobj          # create a new TkFont object
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
	fobj.latin_replace(ltn)
 | 
						tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
 | 
				
			||||||
 | 
						next
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return fobj.call_font_configure(pathname, self.path,
 | 
					      if fobj.kind_of?(TkFont)
 | 
				
			||||||
				    __conf_cmd(0), __conf_cmd(1), tagOrId, {})
 | 
						if ltn.kind_of?(TkFont)
 | 
				
			||||||
 | 
						  conf = {}
 | 
				
			||||||
 | 
						  ltn.latin_configinfo.each{|key,val| conf[key] = val}
 | 
				
			||||||
 | 
						  if keys
 | 
				
			||||||
 | 
						    fobj.latin_configure(conf.update(keys))
 | 
				
			||||||
 | 
						  else
 | 
				
			||||||
 | 
						    fobj.latin_configure(conf)
 | 
				
			||||||
 | 
						  end
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						  fobj.latin_replace(ltn)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      fobj.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    self
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  alias asciitagfont_configure latintagfont_configure
 | 
					  alias asciitagfont_configure latintagfont_configure
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def kanjitagfont_configure(tagOrId, knj, keys=nil)
 | 
					  def kanjitagfont_configure(tagOrId, knj, keys=nil)
 | 
				
			||||||
    pathname = __item_pathname(tagOrId)
 | 
					    if knj.kind_of?(Array)
 | 
				
			||||||
    if (fobj = TkFont.used_on(pathname))
 | 
					      key = knj[1]
 | 
				
			||||||
      fobj = TkFont.new(fobj)    # create a new TkFont object
 | 
					      knj = knj[0]
 | 
				
			||||||
    elsif Tk::JAPANIZED_TK
 | 
					 | 
				
			||||||
      fobj = tagfontobj(tagOrId) # create a new TkFont object
 | 
					 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      tk_call(self.path, __conf_cmd(0), __conf_cmd(1), tagOrId, '-font', knj)
 | 
					      key = nil
 | 
				
			||||||
      return self
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if fobj.kind_of?(TkFont)
 | 
					    optkeys = __item_font_optkeys(tagid(tagOrId))
 | 
				
			||||||
      if knj.kind_of? TkFont
 | 
					    if key && !optkeys.find{|opt| opt.to_s == key.to_s}
 | 
				
			||||||
	conf = {}
 | 
					      fail ArgumentError, "unknown font option name `#{key}'"
 | 
				
			||||||
	knj.kanji_configinfo.each{|key,val| conf[key] = val}
 | 
					    end
 | 
				
			||||||
	if keys
 | 
					
 | 
				
			||||||
	  fobj.kanji_configure(conf.update(keys))
 | 
					    win, tag = __item_pathname(tagid(tagOrId)).split(':')
 | 
				
			||||||
	else
 | 
					
 | 
				
			||||||
	  fobj.kanji_configure(conf)
 | 
					    optkeys = [key] if key
 | 
				
			||||||
	end
 | 
					
 | 
				
			||||||
 | 
					    optkeys.each{|optkey|
 | 
				
			||||||
 | 
					      optkey = optkey.to_s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      pathname = [win, tag, optkey].join(';')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (fobj = TkFont.used_on(pathname))
 | 
				
			||||||
 | 
						fobj = TkFont.new(fobj) # create a new TkFont object
 | 
				
			||||||
 | 
					      elsif Tk::JAPANIZED_TK
 | 
				
			||||||
 | 
						fobj = fontobj          # create a new TkFont object
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
	fobj.kanji_replace(knj)
 | 
						tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
 | 
				
			||||||
 | 
						next
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if fobj.kind_of?(TkFont)
 | 
				
			||||||
 | 
						if knj.kind_of?(TkFont)
 | 
				
			||||||
 | 
						  conf = {}
 | 
				
			||||||
 | 
						  knj.kanji_configinfo.each{|key,val| conf[key] = val}
 | 
				
			||||||
 | 
						  if keys
 | 
				
			||||||
 | 
						    fobj.kanji_configure(conf.update(keys))
 | 
				
			||||||
 | 
						  else
 | 
				
			||||||
 | 
						    fobj.kanji_configure(conf)
 | 
				
			||||||
 | 
						  end
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						  fobj.kanji_replace(knj)
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      fobj.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    self
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def tagfont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
 | 
				
			||||||
 | 
					    if wintag
 | 
				
			||||||
 | 
					      if winkey
 | 
				
			||||||
 | 
						fnt = window.tagfontobj(wintag, winkey).dup
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						fnt = window.tagfontobj(wintag).dup
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      if winkey
 | 
				
			||||||
 | 
						fnt = window.fontobj(winkey).dup
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						fnt = window.fontobj.dup
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return fobj.call_font_configure(pathname, self.path,
 | 
					    if targetkey
 | 
				
			||||||
				    __conf_cmd(0), __conf_cmd(1), tagOrId, {})
 | 
					      fnt.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], 
 | 
				
			||||||
  end
 | 
								      *(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
 | 
					 | 
				
			||||||
  def tagfont_copy(tagOrId, window, wintag=nil)
 | 
					 | 
				
			||||||
    pathname = __item_pathname(tagOrId)
 | 
					 | 
				
			||||||
    if wintag
 | 
					 | 
				
			||||||
      fnt = window.tagfontobj(wintag).dup
 | 
					 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      fnt = window.fontobj.dup
 | 
					      fnt.call_font_configure(__item_pathname(tagid(tagOrId)), 
 | 
				
			||||||
 | 
								      *(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    fnt.call_font_configure(pathname, self.path, 
 | 
					    self
 | 
				
			||||||
			    __conf_cmd(0), __conf_cmd(1), tagOrId, {})
 | 
					 | 
				
			||||||
    return self
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def latintagfont_copy(tagOrId, window, wintag=nil)
 | 
					
 | 
				
			||||||
    pathname = __item_pathname(tagOrId)
 | 
					  def latintagfont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
 | 
				
			||||||
    tagfontobj(tagOrId).dup.call_font_configure(pathname, self.path, 
 | 
					    if targetkey
 | 
				
			||||||
						__conf_cmd(0), __conf_cmd(1), 
 | 
					      fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], 
 | 
				
			||||||
						tagOrId, {})
 | 
											 *(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
    if wintag
 | 
					 | 
				
			||||||
      tagfontobj(tagOrId).
 | 
					 | 
				
			||||||
	latin_replace(window.tagfontobj(wintag).latin_font_id)
 | 
					 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      tagfontobj(tagOrId).latin_replace(window.fontobj.latin_font_id)
 | 
					      fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), 
 | 
				
			||||||
 | 
									      *(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if wintag
 | 
				
			||||||
 | 
					      if winkey
 | 
				
			||||||
 | 
						fontobj.latin_replace(window.tagfontobj(wintag, winkey).latin_font_id)
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						fontobj.latin_replace(window.tagfontobj(wintag).latin_font_id)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      if winkey
 | 
				
			||||||
 | 
						fontobj.latin_replace(window.fontobj(winkey).latin_font_id)
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						fontobj.latin_replace(window.fontobj.latin_font_id)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    self
 | 
					    self
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  alias asciitagfont_copy latintagfont_copy
 | 
					  alias asciitagfont_copy latintagfont_copy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def kanjitagfont_copy(tagOrId, window, wintag=nil)
 | 
					  def kanjifont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
 | 
				
			||||||
    pathname = __item_pathname(tagOrId)
 | 
					    if targetkey
 | 
				
			||||||
    tagfontobj(tagOrId).dup.call_font_configure(pathname, self.path, 
 | 
					      fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], 
 | 
				
			||||||
						__conf_cmd(0), __conf_cmd(1), 
 | 
											 *(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
						tagOrId, {})
 | 
					 | 
				
			||||||
    if wintag
 | 
					 | 
				
			||||||
      tagfontobj(tagOrId).
 | 
					 | 
				
			||||||
	kanji_replace(window.tagfontobj(wintag).kanji_font_id)
 | 
					 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      tagfontobj(tagOrId).kanji_replace(window.fontobj.kanji_font_id)
 | 
						fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), 
 | 
				
			||||||
 | 
										*(__item_config_cmd(tagid(tagOrId)) << {}))
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if wintag
 | 
				
			||||||
 | 
					      if winkey
 | 
				
			||||||
 | 
						fontobj.kanji_replace(window.tagfontobj(wintag, winkey).kanji_font_id)
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						fontobj.kanji_replace(window.tagfontobj(wintag).kanji_font_id)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      if winkey
 | 
				
			||||||
 | 
						fontobj.kanji_replace(window.fontobj(winkey).kanji_font_id)
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						fontobj.kanji_replace(window.fontobj.kanji_font_id)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    self
 | 
					    self
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,27 +2,21 @@
 | 
				
			||||||
# tk/listbox.rb : treat listbox widget
 | 
					# tk/listbox.rb : treat listbox widget
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
require 'tk'
 | 
					require 'tk'
 | 
				
			||||||
 | 
					require 'tk/itemconfig'
 | 
				
			||||||
require 'tk/scrollable'
 | 
					require 'tk/scrollable'
 | 
				
			||||||
require 'tk/txtwin_abst'
 | 
					require 'tk/txtwin_abst'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module TkTreatListItemFont
 | 
					module TkListItemConfig
 | 
				
			||||||
  include TkTreatItemFont
 | 
					  include TkItemConfigMethod
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ItemCMD = ['itemconfigure'.freeze, TkComm::None].freeze
 | 
					  def __item_listval_optkeys(id)
 | 
				
			||||||
  def __conf_cmd(idx)
 | 
					    []
 | 
				
			||||||
    ItemCMD[idx]
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					  private :__item_listval_optkeys
 | 
				
			||||||
  def __item_pathname(tagOrId)
 | 
					 | 
				
			||||||
    self.path + ';' + tagOrId.to_s
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  private :__conf_cmd, :__item_pathname
 | 
					 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
class TkListbox<TkTextWin
 | 
					class TkListbox<TkTextWin
 | 
				
			||||||
  include TkTreatListItemFont
 | 
					  include TkListItemConfig
 | 
				
			||||||
  include Scrollable
 | 
					  include Scrollable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TkCommandNames = ['listbox'.freeze].freeze
 | 
					  TkCommandNames = ['listbox'.freeze].freeze
 | 
				
			||||||
| 
						 | 
					@ -38,6 +32,10 @@ class TkListbox<TkTextWin
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  private :create_self
 | 
					  private :create_self
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def tagid(id)
 | 
				
			||||||
 | 
					    id.to_s
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def activate(y)
 | 
					  def activate(y)
 | 
				
			||||||
    tk_send_without_enc('activate', y)
 | 
					    tk_send_without_enc('activate', y)
 | 
				
			||||||
    self
 | 
					    self
 | 
				
			||||||
| 
						 | 
					@ -78,6 +76,7 @@ class TkListbox<TkTextWin
 | 
				
			||||||
    tk_send_without_enc('index', index).to_i
 | 
					    tk_send_without_enc('index', index).to_i
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=begin
 | 
				
			||||||
  def itemcget(index, key)
 | 
					  def itemcget(index, key)
 | 
				
			||||||
    case key.to_s
 | 
					    case key.to_s
 | 
				
			||||||
    when 'text', 'label', 'show'
 | 
					    when 'text', 'label', 'show'
 | 
				
			||||||
| 
						 | 
					@ -249,4 +248,5 @@ class TkListbox<TkTextWin
 | 
				
			||||||
      ret
 | 
					      ret
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					=end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,24 +2,37 @@
 | 
				
			||||||
# tk/menu.rb : treat menu and menubutton
 | 
					# tk/menu.rb : treat menu and menubutton
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
require 'tk'
 | 
					require 'tk'
 | 
				
			||||||
 | 
					require 'tk/itemconfig'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module TkTreatMenuEntryFont
 | 
					module TkMenuEntryConfig
 | 
				
			||||||
  include TkTreatItemFont
 | 
					  include TkItemConfigMethod
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ItemCMD = ['entryconfigure'.freeze, TkComm::None].freeze
 | 
					  def __item_cget_cmd(id)
 | 
				
			||||||
  def __conf_cmd(idx)
 | 
					    [self.path, 'entrycget', id]
 | 
				
			||||||
    ItemCMD[idx]
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  def __item_pathname(tagOrId)
 | 
					 | 
				
			||||||
    self.path + ';' + tagOrId.to_s
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					  private :__item_cget_cmd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private :__conf_cmd, :__item_pathname
 | 
					  def __item_config_cmd(id)
 | 
				
			||||||
 | 
					    [self.path, 'entryconfigure', id]
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  private :__item_config_cmd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def __item_listval_optkeys(id)
 | 
				
			||||||
 | 
					    []
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  private :__item_listval_optkeys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  alias entrycget itemcget
 | 
				
			||||||
 | 
					  alias entryconfigure itemconfigure
 | 
				
			||||||
 | 
					  alias entryconfiginfo itemconfiginfo
 | 
				
			||||||
 | 
					  alias current_entryconfiginfo current_itemconfiginfo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  private :itemcget, :itemconfigure
 | 
				
			||||||
 | 
					  private :itemconfiginfo, :current_itemconfiginfo
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TkMenu<TkWindow
 | 
					class TkMenu<TkWindow
 | 
				
			||||||
  include TkTreatMenuEntryFont
 | 
					  include TkMenuEntryConfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TkCommandNames = ['menu'.freeze].freeze
 | 
					  TkCommandNames = ['menu'.freeze].freeze
 | 
				
			||||||
  WidgetClassName = 'Menu'.freeze
 | 
					  WidgetClassName = 'Menu'.freeze
 | 
				
			||||||
| 
						 | 
					@ -34,6 +47,10 @@ class TkMenu<TkWindow
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  private :create_self
 | 
					  private :create_self
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def tagid(id)
 | 
				
			||||||
 | 
					    id.to_s
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def activate(index)
 | 
					  def activate(index)
 | 
				
			||||||
    tk_send_without_enc('activate', _get_eval_enc_str(index))
 | 
					    tk_send_without_enc('activate', _get_eval_enc_str(index))
 | 
				
			||||||
    self
 | 
					    self
 | 
				
			||||||
| 
						 | 
					@ -116,6 +133,8 @@ class TkMenu<TkWindow
 | 
				
			||||||
  def yposition(index)
 | 
					  def yposition(index)
 | 
				
			||||||
    number(tk_send_without_enc('yposition', _get_eval_enc_str(index)))
 | 
					    number(tk_send_without_enc('yposition', _get_eval_enc_str(index)))
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=begin
 | 
				
			||||||
  def entrycget(index, key)
 | 
					  def entrycget(index, key)
 | 
				
			||||||
    case key.to_s
 | 
					    case key.to_s
 | 
				
			||||||
    when 'text', 'label', 'show'
 | 
					    when 'text', 'label', 'show'
 | 
				
			||||||
| 
						 | 
					@ -287,6 +306,7 @@ class TkMenu<TkWindow
 | 
				
			||||||
      ret
 | 
					      ret
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					=end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,36 @@ module TkPackage
 | 
				
			||||||
    nil
 | 
					    nil
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def if_needed(pkg, ver, *arg, &b)
 | 
				
			||||||
 | 
					    size = arg.size
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if size==0 && !b
 | 
				
			||||||
 | 
					      # proc info
 | 
				
			||||||
 | 
					      procedure(tk_call('package', 'ifneeded', pkg, ver))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    elsif size==0 && b
 | 
				
			||||||
 | 
					      # set proc
 | 
				
			||||||
 | 
					      cmd = proc(&b)
 | 
				
			||||||
 | 
					      tk_call('package', 'ifneeded', pkg, ver, cmd)
 | 
				
			||||||
 | 
					      cmd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    elsif size==1 && !b
 | 
				
			||||||
 | 
					      # set proc
 | 
				
			||||||
 | 
					      cmd = arg[0]
 | 
				
			||||||
 | 
					      if cmd
 | 
				
			||||||
 | 
						tk_call('package', 'ifneeded', pkg, ver, cmd)
 | 
				
			||||||
 | 
						cmd
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						# remove proc
 | 
				
			||||||
 | 
						tk_call('package', 'ifneeded', pkg, ver, '')
 | 
				
			||||||
 | 
						nil
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      fail ArgumentError, 'too many arguments'
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def names
 | 
					  def names
 | 
				
			||||||
    tk_split_simplelist(tk_call('package', 'names'))
 | 
					    tk_split_simplelist(tk_call('package', 'names'))
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					@ -25,26 +55,74 @@ module TkPackage
 | 
				
			||||||
  def provide(package, version=nil)
 | 
					  def provide(package, version=nil)
 | 
				
			||||||
    if version
 | 
					    if version
 | 
				
			||||||
      tk_call('package', 'provide', package, version)
 | 
					      tk_call('package', 'provide', package, version)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    if (ret = tk_call('package', 'provide', package)) == ''
 | 
				
			||||||
      nil
 | 
					      nil
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      tk_call('package', 'provide', package)
 | 
					      ret
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def present(package, version=None)
 | 
					  def present(package, version=None)
 | 
				
			||||||
    tk_call('package', 'present', package, version)
 | 
					    begin
 | 
				
			||||||
 | 
					      tk_call('package', 'present', package, version)
 | 
				
			||||||
 | 
					    rescue => e
 | 
				
			||||||
 | 
					      fail e.class, 'TkPackage ' << e.message
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def present_exact(package, version)
 | 
					  def present_exact(package, version)
 | 
				
			||||||
    tk_call('package', 'present', '-exact', package, version)
 | 
					    begin
 | 
				
			||||||
 | 
					      tk_call('package', 'present', '-exact', package, version)
 | 
				
			||||||
 | 
					    rescue => e
 | 
				
			||||||
 | 
					      fail e.class, 'TkPackage ' << e.message
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def require(package, version=None)
 | 
					  def require(package, version=None)
 | 
				
			||||||
    tk_call('package', 'require', package, version)
 | 
					    begin
 | 
				
			||||||
 | 
					      tk_call('package', 'require', package, version)
 | 
				
			||||||
 | 
					    rescue => e
 | 
				
			||||||
 | 
					      fail e.class, 'TkPackage ' << e.message
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def require_exact(package, version)
 | 
					  def require_exact(package, version)
 | 
				
			||||||
    tk_call('package', 'require', '-exact', package, version)
 | 
					    begin
 | 
				
			||||||
 | 
					      tk_call('package', 'require', '-exact', package, version)
 | 
				
			||||||
 | 
					    rescue => e
 | 
				
			||||||
 | 
					      fail e.class, 'TkPackage ' << e.message
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def unknown_proc(*arg, &b)
 | 
				
			||||||
 | 
					    size = arg.size
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if size==0 && !b
 | 
				
			||||||
 | 
					      # proc info
 | 
				
			||||||
 | 
					      procedure(tk_call('package', 'unknown'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    elsif size==0 && b
 | 
				
			||||||
 | 
					      # set proc
 | 
				
			||||||
 | 
					      cmd = proc(&b)
 | 
				
			||||||
 | 
					      tk_call('package', 'unknown', cmd)
 | 
				
			||||||
 | 
					      cmd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    elsif size==1 && !b
 | 
				
			||||||
 | 
					      # set proc
 | 
				
			||||||
 | 
					      cmd = arg[0]
 | 
				
			||||||
 | 
					      if cmd
 | 
				
			||||||
 | 
						tk_call('package', 'unknown', cmd)
 | 
				
			||||||
 | 
						cmd
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						# remove proc
 | 
				
			||||||
 | 
						tk_call('package', 'unknown', '')
 | 
				
			||||||
 | 
						nil
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      fail ArgumentError, 'too many arguments'
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def versions(package)
 | 
					  def versions(package)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,10 +7,15 @@ module Tk
 | 
				
			||||||
  module Scrollable
 | 
					  module Scrollable
 | 
				
			||||||
    def xscrollcommand(cmd=Proc.new)
 | 
					    def xscrollcommand(cmd=Proc.new)
 | 
				
			||||||
      configure_cmd 'xscrollcommand', cmd
 | 
					      configure_cmd 'xscrollcommand', cmd
 | 
				
			||||||
 | 
					      # Tk.update  # avoid scrollbar trouble
 | 
				
			||||||
 | 
					      self
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    def yscrollcommand(cmd=Proc.new)
 | 
					    def yscrollcommand(cmd=Proc.new)
 | 
				
			||||||
      configure_cmd 'yscrollcommand', cmd
 | 
					      configure_cmd 'yscrollcommand', cmd
 | 
				
			||||||
 | 
					      # Tk.update  # avoid scrollbar trouble
 | 
				
			||||||
 | 
					      self
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def xview(*index)
 | 
					    def xview(*index)
 | 
				
			||||||
      if index.size == 0
 | 
					      if index.size == 0
 | 
				
			||||||
	list(tk_send_without_enc('xview'))
 | 
						list(tk_send_without_enc('xview'))
 | 
				
			||||||
| 
						 | 
					@ -19,6 +24,13 @@ module Tk
 | 
				
			||||||
	self
 | 
						self
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					    def xview_moveto(*index)
 | 
				
			||||||
 | 
					      xview('moveto', *index)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    def xview_scroll(*index)
 | 
				
			||||||
 | 
					      xview('scroll', *index)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def yview(*index)
 | 
					    def yview(*index)
 | 
				
			||||||
      if index.size == 0
 | 
					      if index.size == 0
 | 
				
			||||||
	list(tk_send_without_enc('yview'))
 | 
						list(tk_send_without_enc('yview'))
 | 
				
			||||||
| 
						 | 
					@ -27,6 +39,13 @@ module Tk
 | 
				
			||||||
	self
 | 
						self
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					    def yview_moveto(*index)
 | 
				
			||||||
 | 
					      yview('moveto', *index)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    def yview_scroll(*index)
 | 
				
			||||||
 | 
					      yview('scroll', *index)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def xscrollbar(bar=nil)
 | 
					    def xscrollbar(bar=nil)
 | 
				
			||||||
      if bar
 | 
					      if bar
 | 
				
			||||||
	@xscrollbar = bar
 | 
						@xscrollbar = bar
 | 
				
			||||||
| 
						 | 
					@ -34,6 +53,7 @@ module Tk
 | 
				
			||||||
	self.xscrollcommand {|*arg| @xscrollbar.set(*arg)}
 | 
						self.xscrollcommand {|*arg| @xscrollbar.set(*arg)}
 | 
				
			||||||
	@xscrollbar.command {|*arg| self.xview(*arg)}
 | 
						@xscrollbar.command {|*arg| self.xview(*arg)}
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					      Tk.update  # avoid scrollbar trouble
 | 
				
			||||||
      @xscrollbar
 | 
					      @xscrollbar
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    def yscrollbar(bar=nil)
 | 
					    def yscrollbar(bar=nil)
 | 
				
			||||||
| 
						 | 
					@ -43,6 +63,7 @@ module Tk
 | 
				
			||||||
	self.yscrollcommand {|*arg| @yscrollbar.set(*arg)}
 | 
						self.yscrollcommand {|*arg| @yscrollbar.set(*arg)}
 | 
				
			||||||
	@yscrollbar.command {|*arg| self.yview(*arg)}
 | 
						@yscrollbar.command {|*arg| self.yview(*arg)}
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					      Tk.update  # avoid scrollbar trouble
 | 
				
			||||||
      @yscrollbar
 | 
					      @yscrollbar
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,6 +41,7 @@ class TkScrollbar<TkWindow
 | 
				
			||||||
	w.yscrollcommand proc{|first, last| self.set(first, last)}
 | 
						w.yscrollcommand proc{|first, last| self.set(first, last)}
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    Tk.update  # avoid scrollbar trouble
 | 
				
			||||||
    self
 | 
					    self
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,6 +53,12 @@ class TkScrollbar<TkWindow
 | 
				
			||||||
    fail RuntimeError, "not depend on the assigned_list"
 | 
					    fail RuntimeError, "not depend on the assigned_list"
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def configure(*args)
 | 
				
			||||||
 | 
					    ret = super(*args)
 | 
				
			||||||
 | 
					    # Tk.update  # avoid scrollbar trouble
 | 
				
			||||||
 | 
					    ret
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #def delta(deltax=None, deltay=None)
 | 
					  #def delta(deltax=None, deltay=None)
 | 
				
			||||||
  def delta(deltax, deltay)
 | 
					  def delta(deltax, deltay)
 | 
				
			||||||
    number(tk_send_without_enc('delta', deltax, deltay))
 | 
					    number(tk_send_without_enc('delta', deltax, deltay))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,10 +14,15 @@ class TkScrollbox<TkListbox
 | 
				
			||||||
    scroll = TkScrollbar.new(@frame)
 | 
					    scroll = TkScrollbar.new(@frame)
 | 
				
			||||||
    @path = list.path
 | 
					    @path = list.path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=begin
 | 
				
			||||||
    list.configure 'yscroll', scroll.path+" set"
 | 
					    list.configure 'yscroll', scroll.path+" set"
 | 
				
			||||||
    list.pack 'side'=>'left','fill'=>'both','expand'=>'yes'
 | 
					    list.pack 'side'=>'left','fill'=>'both','expand'=>'yes'
 | 
				
			||||||
    scroll.configure 'command', list.path+" yview"
 | 
					    scroll.configure 'command', list.path+" yview"
 | 
				
			||||||
    scroll.pack 'side'=>'right','fill'=>'y'
 | 
					    scroll.pack 'side'=>'right','fill'=>'y'
 | 
				
			||||||
 | 
					=end
 | 
				
			||||||
 | 
					    list.yscrollbar(scroll)
 | 
				
			||||||
 | 
					    list.pack('side'=>'left','fill'=>'both','expand'=>'yes')
 | 
				
			||||||
 | 
					    scroll.pack('side'=>'right','fill'=>'y')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    delegate('DEFAULT', list)
 | 
					    delegate('DEFAULT', list)
 | 
				
			||||||
    delegate('foreground', list)
 | 
					    delegate('foreground', list)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,32 +4,66 @@
 | 
				
			||||||
#			by Yukihiro Matsumoto <matz@caelum.co.jp>
 | 
					#			by Yukihiro Matsumoto <matz@caelum.co.jp>
 | 
				
			||||||
require 'tk'
 | 
					require 'tk'
 | 
				
			||||||
require 'tk/itemfont'
 | 
					require 'tk/itemfont'
 | 
				
			||||||
 | 
					require 'tk/itemconfig'
 | 
				
			||||||
require 'tk/scrollable'
 | 
					require 'tk/scrollable'
 | 
				
			||||||
require 'tk/txtwin_abst'
 | 
					require 'tk/txtwin_abst'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module TkTreatTextTagFont
 | 
					module TkTextTagConfig
 | 
				
			||||||
  include TkTreatItemFont
 | 
					  include TkTreatItemFont
 | 
				
			||||||
 | 
					  include TkItemConfigMethod
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ItemCMD = ['tag'.freeze, 'configure'.freeze].freeze
 | 
					  def __item_cget_cmd(id)  # id := [ type, tagOrId ]
 | 
				
			||||||
  def __conf_cmd(idx)
 | 
					    [self.path, id[0], 'cget', id[1]]
 | 
				
			||||||
    ItemCMD[idx]
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					  private :__item_cget_cmd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def __item_pathname(tagOrId)
 | 
					  def __item_config_cmd(id)  # id := [ type, tagOrId ]
 | 
				
			||||||
    if tagOrId.kind_of?(TkTextTag)
 | 
					    [self.path, id[0], 'configure', id[1]]
 | 
				
			||||||
      self.path + ';' + tagOrId.id
 | 
					  end
 | 
				
			||||||
    else
 | 
					  private :__item_config_cmd
 | 
				
			||||||
      self.path + ';' + tagOrId
 | 
					
 | 
				
			||||||
 | 
					  def __item_pathname(id)
 | 
				
			||||||
 | 
					    if id.kind_of?(Array)
 | 
				
			||||||
 | 
					      id = tagid(id[1])
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					    [self.path, id].join(';')
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  private :__item_pathname
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def tag_cget(tagOrId, option)
 | 
				
			||||||
 | 
					    itemcget(['tag', tagOrId], option)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  def tag_configure(tagOrId, slot, value=None)
 | 
				
			||||||
 | 
					    itemconfigure(['tag', tagOrId], slot, value)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  def tag_configinfo(tagOrId, slot=nil)
 | 
				
			||||||
 | 
					    itemconfigure(['tag', tagOrId], slot)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  def current_tag_configinfo(tagOrId, slot=nil)
 | 
				
			||||||
 | 
					    itemconfigure(['tag', tagOrId], slot)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private :__conf_cmd, :__item_pathname
 | 
					  def window_cget(tagOrId, option)
 | 
				
			||||||
end
 | 
					    itemcget(['window', tagOrId], option)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  def window_configure(tagOrId, slot, value=None)
 | 
				
			||||||
 | 
					    itemconfigure(['window', tagOrId], slot, value)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  def window_configinfo(tagOrId, slot=nil)
 | 
				
			||||||
 | 
					    itemconfigure(['window', tagOrId], slot)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  def current_window_configinfo(tagOrId, slot=nil)
 | 
				
			||||||
 | 
					    itemconfigure(['window', tagOrId], slot)
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  private :itemcget, :itemconfigure
 | 
				
			||||||
 | 
					  private :itemconfiginfo, :current_itemconfiginfo
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TkText<TkTextWin
 | 
					class TkText<TkTextWin
 | 
				
			||||||
  ItemConfCMD = ['tag'.freeze, 'configure'.freeze].freeze
 | 
					  ItemConfCMD = ['tag'.freeze, 'configure'.freeze].freeze
 | 
				
			||||||
  include TkTreatTextTagFont
 | 
					  #include TkTreatTextTagFont
 | 
				
			||||||
 | 
					  include TkTextTagConfig
 | 
				
			||||||
  include Scrollable
 | 
					  include Scrollable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TkCommandNames = ['text'.freeze].freeze
 | 
					  TkCommandNames = ['text'.freeze].freeze
 | 
				
			||||||
| 
						 | 
					@ -90,6 +124,18 @@ class TkText<TkTextWin
 | 
				
			||||||
    @tags[name] = obj
 | 
					    @tags[name] = obj
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def tagid(tag)
 | 
				
			||||||
 | 
					    if tag.kind_of?(TkTextTag) \
 | 
				
			||||||
 | 
					      || tag.kind_of?(TkTextMark) \
 | 
				
			||||||
 | 
					      || tag.kind_of?(TkTextImage) \
 | 
				
			||||||
 | 
					      || tag.kind_of?(TkTextWindow)
 | 
				
			||||||
 | 
					      tag.id
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      tag
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					  private :tagid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def tagid2obj(tagid)
 | 
					  def tagid2obj(tagid)
 | 
				
			||||||
    if @tags[tagid]
 | 
					    if @tags[tagid]
 | 
				
			||||||
      @tags[tagid]
 | 
					      @tags[tagid]
 | 
				
			||||||
| 
						 | 
					@ -482,6 +528,7 @@ class TkText<TkTextWin
 | 
				
			||||||
    _bindinfo([@path, 'tag', 'bind', tag], context)
 | 
					    _bindinfo([@path, 'tag', 'bind', tag], context)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=begin
 | 
				
			||||||
  def tag_cget(tag, key)
 | 
					  def tag_cget(tag, key)
 | 
				
			||||||
    case key.to_s
 | 
					    case key.to_s
 | 
				
			||||||
    when 'text', 'label', 'show', 'data', 'file'
 | 
					    when 'text', 'label', 'show', 'data', 'file'
 | 
				
			||||||
| 
						 | 
					@ -655,6 +702,7 @@ class TkText<TkTextWin
 | 
				
			||||||
      ret
 | 
					      ret
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					=end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def tag_raise(tag, above=None)
 | 
					  def tag_raise(tag, above=None)
 | 
				
			||||||
    tk_send_without_enc('tag', 'raise', _get_eval_enc_str(tag), 
 | 
					    tk_send_without_enc('tag', 'raise', _get_eval_enc_str(tag), 
 | 
				
			||||||
| 
						 | 
					@ -698,6 +746,7 @@ class TkText<TkTextWin
 | 
				
			||||||
				      _get_eval_enc_str(last)))
 | 
									      _get_eval_enc_str(last)))
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=begin
 | 
				
			||||||
  def window_cget(index, slot)
 | 
					  def window_cget(index, slot)
 | 
				
			||||||
    case slot.to_s
 | 
					    case slot.to_s
 | 
				
			||||||
    when 'text', 'label', 'show', 'data', 'file'
 | 
					    when 'text', 'label', 'show', 'data', 'file'
 | 
				
			||||||
| 
						 | 
					@ -732,7 +781,7 @@ class TkText<TkTextWin
 | 
				
			||||||
	if slot['create']
 | 
						if slot['create']
 | 
				
			||||||
	  p_create = slot['create']
 | 
						  p_create = slot['create']
 | 
				
			||||||
	  if p_create.kind_of? Proc
 | 
						  if p_create.kind_of? Proc
 | 
				
			||||||
=begin
 | 
					#=begin
 | 
				
			||||||
	    slot['create'] = install_cmd(proc{
 | 
						    slot['create'] = install_cmd(proc{
 | 
				
			||||||
					   id = p_create.call
 | 
										   id = p_create.call
 | 
				
			||||||
					   if id.kind_of?(TkWindow)
 | 
										   if id.kind_of?(TkWindow)
 | 
				
			||||||
| 
						 | 
					@ -741,7 +790,7 @@ class TkText<TkTextWin
 | 
				
			||||||
					     id
 | 
										     id
 | 
				
			||||||
					   end
 | 
										   end
 | 
				
			||||||
					 })
 | 
										 })
 | 
				
			||||||
=end
 | 
					#=end
 | 
				
			||||||
	    slot['create'] = install_cmd(proc{_epath(p_create.call)})
 | 
						    slot['create'] = install_cmd(proc{_epath(p_create.call)})
 | 
				
			||||||
	  end
 | 
						  end
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
| 
						 | 
					@ -757,7 +806,7 @@ class TkText<TkTextWin
 | 
				
			||||||
	if slot == 'create' || slot == :create
 | 
						if slot == 'create' || slot == :create
 | 
				
			||||||
	  p_create = value
 | 
						  p_create = value
 | 
				
			||||||
	  if p_create.kind_of? Proc
 | 
						  if p_create.kind_of? Proc
 | 
				
			||||||
=begin
 | 
					#=begin
 | 
				
			||||||
	    value = install_cmd(proc{
 | 
						    value = install_cmd(proc{
 | 
				
			||||||
				  id = p_create.call
 | 
									  id = p_create.call
 | 
				
			||||||
				  if id.kind_of?(TkWindow)
 | 
									  if id.kind_of?(TkWindow)
 | 
				
			||||||
| 
						 | 
					@ -766,7 +815,7 @@ class TkText<TkTextWin
 | 
				
			||||||
				    id
 | 
									    id
 | 
				
			||||||
				  end
 | 
									  end
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
=end
 | 
					#=end
 | 
				
			||||||
	    value = install_cmd(proc{_epath(p_create.call)})
 | 
						    value = install_cmd(proc{_epath(p_create.call)})
 | 
				
			||||||
	  end
 | 
						  end
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
| 
						 | 
					@ -879,6 +928,7 @@ class TkText<TkTextWin
 | 
				
			||||||
      ret
 | 
					      ret
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					=end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def window_names
 | 
					  def window_names
 | 
				
			||||||
    tk_split_simplelist(_fromUTF8(tk_send_without_enc('window', 'names'))).collect{|elt|
 | 
					    tk_split_simplelist(_fromUTF8(tk_send_without_enc('window', 'names'))).collect{|elt|
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +37,14 @@ class TkTextMark<TkObject
 | 
				
			||||||
    @id
 | 
					    @id
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def exist?
 | 
				
			||||||
 | 
					    if ( tk_split_simplelist(_fromUTF8(tk_call_without_enc(@t.path, 'mark', 'names'))).find{|id| id == @id } )
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      false
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def +(mod)
 | 
					  def +(mod)
 | 
				
			||||||
    @id + ' + ' + mod
 | 
					    @id + ' + ' + mod
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,6 +49,14 @@ class TkTextTag<TkObject
 | 
				
			||||||
    @id
 | 
					    @id
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def exist?
 | 
				
			||||||
 | 
					    if ( tk_split_simplelist(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'names'))).find{|id| id == @id } )
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      false
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def first
 | 
					  def first
 | 
				
			||||||
    @id + '.first'
 | 
					    @id + '.first'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					@ -99,6 +107,10 @@ class TkTextTag<TkObject
 | 
				
			||||||
    val
 | 
					    val
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def cget(key)
 | 
				
			||||||
 | 
					    @t.tag_cget @id, key
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					=begin
 | 
				
			||||||
  def cget(key)
 | 
					  def cget(key)
 | 
				
			||||||
    case key.to_s
 | 
					    case key.to_s
 | 
				
			||||||
    when 'text', 'label', 'show', 'data', 'file'
 | 
					    when 'text', 'label', 'show', 'data', 'file'
 | 
				
			||||||
| 
						 | 
					@ -121,6 +133,7 @@ class TkTextTag<TkObject
 | 
				
			||||||
						@id, "-#{key}")))
 | 
											@id, "-#{key}")))
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					=end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def configure(key, val=None)
 | 
					  def configure(key, val=None)
 | 
				
			||||||
    @t.tag_configure @id, key, val
 | 
					    @t.tag_configure @id, key, val
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,106 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
require 'tk'
 | 
					require 'tk'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module Tk
 | 
				
			||||||
 | 
					  module ValidateConfigure
 | 
				
			||||||
 | 
					    def __validation_class_list
 | 
				
			||||||
 | 
					      # maybe need to override
 | 
				
			||||||
 | 
					      []
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def __get_validate_key2class
 | 
				
			||||||
 | 
					      k2c = {}
 | 
				
			||||||
 | 
					      __validation_class_list.each{|klass|
 | 
				
			||||||
 | 
						klass._config_keys.each{|key|
 | 
				
			||||||
 | 
						  k2c[key.to_s] = klass
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      k2c
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def configure(slot, value=TkComm::None)
 | 
				
			||||||
 | 
					      key2class = __get_validate_key2class
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if slot.kind_of?(Hash)
 | 
				
			||||||
 | 
						slot = _symbolkey2str(slot)
 | 
				
			||||||
 | 
						key2class.each{|key, klass|
 | 
				
			||||||
 | 
						  if slot[key].kind_of?(Array)
 | 
				
			||||||
 | 
						    cmd, *args = slot[key]
 | 
				
			||||||
 | 
						    slot[key] = klass.new(cmd, args.join(' '))
 | 
				
			||||||
 | 
						  elsif slot[key].kind_of? Proc
 | 
				
			||||||
 | 
						    slot[key] = klass.new(slot[key])
 | 
				
			||||||
 | 
						  end
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						super(slot)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						slot = slot.to_s
 | 
				
			||||||
 | 
						if (klass = key2class[slot])
 | 
				
			||||||
 | 
						  if value.kind_of? Array
 | 
				
			||||||
 | 
						    cmd, *args = value
 | 
				
			||||||
 | 
						    value = klass.new(cmd, args.join(' '))
 | 
				
			||||||
 | 
						  elsif value.kind_of? Proc
 | 
				
			||||||
 | 
						    value = klass.new(value)
 | 
				
			||||||
 | 
						  end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						super(slot, value)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      self
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  module ItemValidateConfigure
 | 
				
			||||||
 | 
					    def __item_validation_class_list(id)
 | 
				
			||||||
 | 
					      # maybe need to override
 | 
				
			||||||
 | 
					      []
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def __get_item_validate_key2class(id)
 | 
				
			||||||
 | 
					      k2c = {}
 | 
				
			||||||
 | 
					      __item_validation_class_list(id).each{|klass|
 | 
				
			||||||
 | 
						klass._config_keys.each{|key|
 | 
				
			||||||
 | 
						  k2c[key.to_s] = klass
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def itemconfigure(tagOrId, slot, value=TkComm::None)
 | 
				
			||||||
 | 
					      key2class = __get_item_validate_key2class(tagid(tagOrId))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if slot.kind_of?(Hash)
 | 
				
			||||||
 | 
						slot = _symbolkey2str(slot)
 | 
				
			||||||
 | 
						key2class.each{|key, klass|
 | 
				
			||||||
 | 
						  if slot[key].kind_of?(Array)
 | 
				
			||||||
 | 
						    cmd, *args = slot[key]
 | 
				
			||||||
 | 
						    slot[key] = klass.new(cmd, args.join(' '))
 | 
				
			||||||
 | 
						  elsif slot[key].kind_of? Proc
 | 
				
			||||||
 | 
						    slot[key] = klass.new(slot[key])
 | 
				
			||||||
 | 
						  end
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						super(slot)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						slot = slot.to_s
 | 
				
			||||||
 | 
						if (klass = key2class[slot])
 | 
				
			||||||
 | 
						  if value.kind_of? Array
 | 
				
			||||||
 | 
						    cmd, *args = value
 | 
				
			||||||
 | 
						    value = klass.new(cmd, args.join(' '))
 | 
				
			||||||
 | 
						  elsif value.kind_of? Proc
 | 
				
			||||||
 | 
						    value = klass.new(value)
 | 
				
			||||||
 | 
						  end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
						super(slot, value)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      self
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module TkValidation
 | 
					module TkValidation
 | 
				
			||||||
 | 
					  include Tk::ValidateConfigure
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  class ValidateCmd
 | 
					  class ValidateCmd
 | 
				
			||||||
    include TkComm
 | 
					    include TkComm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +117,7 @@ module TkValidation
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class ValidateArgs < TkUtil::CallbackSubst
 | 
					    class ValidateArgs < TkUtil::CallbackSubst
 | 
				
			||||||
      key_tbl = [
 | 
					      KEY_TBL = [
 | 
				
			||||||
	[ ?d, ?n, :action ], 
 | 
						[ ?d, ?n, :action ], 
 | 
				
			||||||
	[ ?i, ?x, :index ], 
 | 
						[ ?i, ?x, :index ], 
 | 
				
			||||||
	[ ?s, ?e, :current ], 
 | 
						[ ?s, ?e, :current ], 
 | 
				
			||||||
| 
						 | 
					@ -30,7 +129,7 @@ module TkValidation
 | 
				
			||||||
	nil
 | 
						nil
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      proc_tbl = [
 | 
					      PROC_TBL = [
 | 
				
			||||||
	[ ?n, TkComm.method(:number) ], 
 | 
						[ ?n, TkComm.method(:number) ], 
 | 
				
			||||||
	[ ?s, TkComm.method(:string) ], 
 | 
						[ ?s, TkComm.method(:string) ], 
 | 
				
			||||||
	[ ?w, TkComm.method(:window) ], 
 | 
						[ ?w, TkComm.method(:window) ], 
 | 
				
			||||||
| 
						 | 
					@ -58,24 +157,31 @@ module TkValidation
 | 
				
			||||||
	nil
 | 
						nil
 | 
				
			||||||
      ]
 | 
					      ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      _setup_subst_table(key_tbl, proc_tbl);
 | 
					      _setup_subst_table(KEY_TBL, PROC_TBL);
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def initialize(cmd = Proc.new, *args)
 | 
					    ##############################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def self._config_keys
 | 
				
			||||||
 | 
					      # array of config-option key (string or symbol)
 | 
				
			||||||
 | 
					      ['vcmd', 'validatecommand', 'invcmd', 'invalidcommand']
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def _initialize_for_cb_class(klass, cmd = Proc.new, *args)
 | 
				
			||||||
      if args.compact.size > 0
 | 
					      if args.compact.size > 0
 | 
				
			||||||
	args = args.join(' ')
 | 
						args = args.join(' ')
 | 
				
			||||||
	keys = ValidateArgs._get_subst_key(args)
 | 
						keys = klass._get_subst_key(args)
 | 
				
			||||||
	if cmd.kind_of?(String)
 | 
						if cmd.kind_of?(String)
 | 
				
			||||||
	  id = cmd
 | 
						  id = cmd
 | 
				
			||||||
	elsif cmd.kind_of?(TkCallbackEntry)
 | 
						elsif cmd.kind_of?(TkCallbackEntry)
 | 
				
			||||||
	  @id = install_cmd(cmd)
 | 
						  @id = install_cmd(cmd)
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	  @id = install_cmd(proc{|*arg|
 | 
						  @id = install_cmd(proc{|*arg|
 | 
				
			||||||
	     (cmd.call(*ValidateArgs.scan_args(keys, arg)))? '1':'0'
 | 
						     (cmd.call(*klass.scan_args(keys, arg)))? '1':'0'
 | 
				
			||||||
	  }) + ' ' + args
 | 
						  }) + ' ' + args
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
	keys, args = ValidateArgs._get_all_subst_keys
 | 
						keys, args = klass._get_all_subst_keys
 | 
				
			||||||
	if cmd.kind_of?(String)
 | 
						if cmd.kind_of?(String)
 | 
				
			||||||
	  id = cmd
 | 
						  id = cmd
 | 
				
			||||||
	elsif cmd.kind_of?(TkCallbackEntry)
 | 
						elsif cmd.kind_of?(TkCallbackEntry)
 | 
				
			||||||
| 
						 | 
					@ -83,13 +189,17 @@ module TkValidation
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	  @id = install_cmd(proc{|*arg|
 | 
						  @id = install_cmd(proc{|*arg|
 | 
				
			||||||
	     (cmd.call(
 | 
						     (cmd.call(
 | 
				
			||||||
                ValidateArgs.new(*ValidateArgs.scan_args(keys,arg)))
 | 
					                klass.new(*klass.scan_args(keys,arg)))
 | 
				
			||||||
             )? '1': '0'
 | 
					             )? '1': '0'
 | 
				
			||||||
	  }) + ' ' + args
 | 
						  }) + ' ' + args
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def initialize(cmd = Proc.new, *args)
 | 
				
			||||||
 | 
					      _initialize_for_cb_class(ValidateArgs, cmd, *args)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def to_eval
 | 
					    def to_eval
 | 
				
			||||||
      @id
 | 
					      @id
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					@ -97,49 +207,8 @@ module TkValidation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  #####################################
 | 
					  #####################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def configure(slot, value=TkComm::None)
 | 
					  def __validation_class_list
 | 
				
			||||||
    if slot.kind_of? Hash
 | 
					    super << ValidateCmd
 | 
				
			||||||
      slot = _symbolkey2str(slot)
 | 
					 | 
				
			||||||
      if slot['vcmd'].kind_of? Array
 | 
					 | 
				
			||||||
	cmd, *args = slot['vcmd']
 | 
					 | 
				
			||||||
	slot['vcmd'] = ValidateCmd.new(cmd, args.join(' '))
 | 
					 | 
				
			||||||
      elsif slot['vcmd'].kind_of? Proc
 | 
					 | 
				
			||||||
	slot['vcmd'] = ValidateCmd.new(slot['vcmd'])
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
      if slot['validatecommand'].kind_of? Array
 | 
					 | 
				
			||||||
	cmd, *args = slot['validatecommand']
 | 
					 | 
				
			||||||
	slot['validatecommand'] = ValidateCmd.new(cmd, args.join(' '))
 | 
					 | 
				
			||||||
      elsif slot['validatecommand'].kind_of? Proc
 | 
					 | 
				
			||||||
	slot['validatecommand'] = ValidateCmd.new(slot['validatecommand'])
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
      if slot['invcmd'].kind_of? Array
 | 
					 | 
				
			||||||
	cmd, *args = slot['invcmd']
 | 
					 | 
				
			||||||
	slot['invcmd'] = ValidateCmd.new(cmd, args.join(' '))
 | 
					 | 
				
			||||||
      elsif slot['invcmd'].kind_of? Proc
 | 
					 | 
				
			||||||
	slot['invcmd'] = ValidateCmd.new(slot['invcmd'])
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
      if slot['invalidcommand'].kind_of? Array
 | 
					 | 
				
			||||||
	cmd, *args = slot['invalidcommand']
 | 
					 | 
				
			||||||
	slot['invalidcommand'] = ValidateCmd.new(cmd, args.join(' '))
 | 
					 | 
				
			||||||
      elsif slot['invalidcommand'].kind_of? Proc
 | 
					 | 
				
			||||||
	slot['invalidcommand'] = ValidateCmd.new(slot['invalidcommand'])
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
      super(slot)
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      if (slot == 'vcmd' || slot == :vcmd || 
 | 
					 | 
				
			||||||
          slot == 'validatecommand' || slot == :validatecommand || 
 | 
					 | 
				
			||||||
	  slot == 'invcmd' || slot == :invcmd || 
 | 
					 | 
				
			||||||
          slot == 'invalidcommand' || slot == :invalidcommand)
 | 
					 | 
				
			||||||
	if value.kind_of? Array
 | 
					 | 
				
			||||||
	  cmd, *args = value
 | 
					 | 
				
			||||||
	  value = ValidateCmd.new(cmd, args.join(' '))
 | 
					 | 
				
			||||||
	elsif value.kind_of? Proc
 | 
					 | 
				
			||||||
	  value = ValidateCmd.new(value)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
      super(slot, value)
 | 
					 | 
				
			||||||
    end
 | 
					 | 
				
			||||||
    self
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def validatecommand(cmd = Proc.new, args = nil)
 | 
					  def validatecommand(cmd = Proc.new, args = nil)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -84,6 +84,14 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def self.new_hash(val = {})
 | 
				
			||||||
 | 
					    if val.kind_of?(Hash)
 | 
				
			||||||
 | 
					      self.new(val)
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      fail ArgumentError, 'Hash is expected'
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def initialize(val="")
 | 
					  def initialize(val="")
 | 
				
			||||||
    # @id = Tk_VARIABLE_ID.join('')
 | 
					    # @id = Tk_VARIABLE_ID.join('')
 | 
				
			||||||
    @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_)
 | 
					    @id = Tk_VARIABLE_ID.join(TkCore::INTERP._ip_id_)
 | 
				
			||||||
| 
						 | 
					@ -103,6 +111,12 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
 | 
				
			||||||
    INTERP._invoke_without_enc('global', @id)
 | 
					    INTERP._invoke_without_enc('global', @id)
 | 
				
			||||||
    #INTERP._invoke('global', @id)
 | 
					    #INTERP._invoke('global', @id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # create and init
 | 
				
			||||||
 | 
					    if val.kind_of?(Hash)
 | 
				
			||||||
 | 
					      # assoc-array variable
 | 
				
			||||||
 | 
					      self[''] = 0
 | 
				
			||||||
 | 
					      self.clear
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
    self.value = val
 | 
					    self.value = val
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=begin
 | 
					=begin
 | 
				
			||||||
| 
						 | 
					@ -185,7 +199,7 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def is_hash?
 | 
					  def is_hash?
 | 
				
			||||||
    #ITNERP._eval("global #{@id}; array exist #{@id}") == '1'
 | 
					    #ITNERP._eval("global #{@id}; array exist #{@id}") == '1'
 | 
				
			||||||
    ITNERP._invoke_without_enc('array', 'exist', @id) == '1'
 | 
					    INTERP._invoke_without_enc('array', 'exist', @id) == '1'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def is_scalar?
 | 
					  def is_scalar?
 | 
				
			||||||
| 
						 | 
					@ -197,7 +211,23 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
 | 
				
			||||||
      fail RuntimeError, 'cannot get keys from a scalar variable'
 | 
					      fail RuntimeError, 'cannot get keys from a scalar variable'
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    #tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))
 | 
					    #tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}"))
 | 
				
			||||||
    tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'get', @id)))
 | 
					    tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'names', @id)))
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def clear
 | 
				
			||||||
 | 
					    if (is_scalar?)
 | 
				
			||||||
 | 
					      fail RuntimeError, 'cannot clear a scalar variable'
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    keys.each{|k| unset(k)}
 | 
				
			||||||
 | 
					    self
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def update(hash)
 | 
				
			||||||
 | 
					    if (is_scalar?)
 | 
				
			||||||
 | 
					      fail RuntimeError, 'cannot update a scalar variable'
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    hash.each{|k,v| self[k] = v}
 | 
				
			||||||
 | 
					    self
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -222,10 +252,11 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def value=(val)
 | 
					  def value=(val)
 | 
				
			||||||
    if val.kind_of?(Hash)
 | 
					    if val.kind_of?(Hash)
 | 
				
			||||||
 | 
					      self.clear
 | 
				
			||||||
      val.each{|k, v|
 | 
					      val.each{|k, v|
 | 
				
			||||||
	#INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)), 
 | 
						#INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)), 
 | 
				
			||||||
	#			_toUTF8(_get_eval_string(v)))
 | 
						#			_toUTF8(_get_eval_string(v)))
 | 
				
			||||||
	INTERP._set_global_var2(@id, __get_eval_string(k, true), 
 | 
						INTERP._set_global_var2(@id, _get_eval_string(k, true), 
 | 
				
			||||||
				_get_eval_string(v, true))
 | 
									_get_eval_string(v, true))
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      self.value
 | 
					      self.value
 | 
				
			||||||
| 
						 | 
					@ -260,7 +291,7 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def unset(elem=nil)
 | 
					  def unset(elem=nil)
 | 
				
			||||||
    if elem
 | 
					    if elem
 | 
				
			||||||
      INTERP._unset_global_var2(@id, tk_tcl2ruby(elem))
 | 
					      INTERP._unset_global_var2(@id, _get_eval_string(elem, true))
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      INTERP._unset_global_var(@id)
 | 
					      INTERP._unset_global_var(@id)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					@ -359,7 +390,7 @@ else
 | 
				
			||||||
  def unset(elem=nil)
 | 
					  def unset(elem=nil)
 | 
				
			||||||
    if elem
 | 
					    if elem
 | 
				
			||||||
      INTERP._eval(Kernel.format('global %s; unset %s(%s)', 
 | 
					      INTERP._eval(Kernel.format('global %s; unset %s(%s)', 
 | 
				
			||||||
                                 @id, @id, tk_tcl2ruby(elem)))
 | 
					                                 @id, @id, _get_eval_string(elem)))
 | 
				
			||||||
      #INTERP._eval(Kernel.format('unset %s(%s)', @id, tk_tcl2ruby(elem)))
 | 
					      #INTERP._eval(Kernel.format('unset %s(%s)', @id, tk_tcl2ruby(elem)))
 | 
				
			||||||
      #INTERP._eval('unset ' + @id + '(' + _get_eval_string(elem) + ')')
 | 
					      #INTERP._eval('unset ' + @id + '(' + _get_eval_string(elem) + ')')
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
| 
						 | 
					@ -387,6 +418,29 @@ end
 | 
				
			||||||
    val
 | 
					    val
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def bool
 | 
				
			||||||
 | 
					    # see Tcl_GetBoolean man-page
 | 
				
			||||||
 | 
					    case value.downcase
 | 
				
			||||||
 | 
					    when '0', 'false', 'no', 'off'
 | 
				
			||||||
 | 
					      false
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      true
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def bool=(val)
 | 
				
			||||||
 | 
					    if ! val
 | 
				
			||||||
 | 
					      self.value = '0'
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      case val.to_s.downcase
 | 
				
			||||||
 | 
					      when 'false', '0', 'no', 'off'
 | 
				
			||||||
 | 
						self.value = '0'
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
						self.value = '1'
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def to_i
 | 
					  def to_i
 | 
				
			||||||
    number(value).to_i
 | 
					    number(value).to_i
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					@ -570,7 +624,8 @@ end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def trace(opts, cmd = Proc.new)
 | 
					  def trace(opts, cmd = Proc.new)
 | 
				
			||||||
    @trace_var = [] if @trace_var == nil
 | 
					    @trace_var = [] if @trace_var == nil
 | 
				
			||||||
    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
 | 
					    #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
 | 
				
			||||||
 | 
					    opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
 | 
				
			||||||
    @trace_var.unshift([opts,cmd])
 | 
					    @trace_var.unshift([opts,cmd])
 | 
				
			||||||
    if @trace_opts == nil
 | 
					    if @trace_opts == nil
 | 
				
			||||||
      TkVar_CB_TBL[@id] = self
 | 
					      TkVar_CB_TBL[@id] = self
 | 
				
			||||||
| 
						 | 
					@ -619,7 +674,8 @@ end
 | 
				
			||||||
  def trace_element(elem, opts, cmd = Proc.new)
 | 
					  def trace_element(elem, opts, cmd = Proc.new)
 | 
				
			||||||
    @trace_elem = {} if @trace_elem == nil
 | 
					    @trace_elem = {} if @trace_elem == nil
 | 
				
			||||||
    @trace_elem[elem] = [] if @trace_elem[elem] == nil
 | 
					    @trace_elem[elem] = [] if @trace_elem[elem] == nil
 | 
				
			||||||
    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
 | 
					    #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
 | 
				
			||||||
 | 
					    opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
 | 
				
			||||||
    @trace_elem[elem].unshift([opts,cmd])
 | 
					    @trace_elem[elem].unshift([opts,cmd])
 | 
				
			||||||
    if @trace_opts == nil
 | 
					    if @trace_opts == nil
 | 
				
			||||||
      TkVar_CB_TBL[@id] = self
 | 
					      TkVar_CB_TBL[@id] = self
 | 
				
			||||||
| 
						 | 
					@ -678,7 +734,8 @@ end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def trace_vdelete(opts,cmd)
 | 
					  def trace_vdelete(opts,cmd)
 | 
				
			||||||
    return self unless @trace_var.kind_of? Array
 | 
					    return self unless @trace_var.kind_of? Array
 | 
				
			||||||
    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
 | 
					    #opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
 | 
				
			||||||
 | 
					    opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
 | 
				
			||||||
    idx = -1
 | 
					    idx = -1
 | 
				
			||||||
    newopts = ''
 | 
					    newopts = ''
 | 
				
			||||||
    @trace_var.each_with_index{|e,i| 
 | 
					    @trace_var.each_with_index{|e,i| 
 | 
				
			||||||
| 
						 | 
					@ -702,7 +759,8 @@ end
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
 | 
					    #newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
 | 
				
			||||||
 | 
					    newopts = ['r','w','u'].find_all{|c| newopts.to_s.index(c)}.join('')
 | 
				
			||||||
    if newopts != @trace_opts
 | 
					    if newopts != @trace_opts
 | 
				
			||||||
      Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
 | 
					      Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
 | 
				
			||||||
=begin
 | 
					=begin
 | 
				
			||||||
| 
						 | 
					@ -739,7 +797,8 @@ end
 | 
				
			||||||
  def trace_vdelete_for_element(elem,opts,cmd)
 | 
					  def trace_vdelete_for_element(elem,opts,cmd)
 | 
				
			||||||
    return self unless @trace_elem.kind_of? Hash
 | 
					    return self unless @trace_elem.kind_of? Hash
 | 
				
			||||||
    return self unless @trace_elem[elem].kind_of? Array
 | 
					    return self unless @trace_elem[elem].kind_of? Array
 | 
				
			||||||
    opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
 | 
					    # opts = ['r','w','u'].find_all{|c| opts.index(c)}.join('')
 | 
				
			||||||
 | 
					    opts = ['r','w','u'].find_all{|c| opts.to_s.index(c)}.join('')
 | 
				
			||||||
    idx = -1
 | 
					    idx = -1
 | 
				
			||||||
    @trace_elem[elem].each_with_index{|e,i| 
 | 
					    @trace_elem[elem].each_with_index{|e,i| 
 | 
				
			||||||
      if idx < 0 && e[0] == opts && e[1] == cmd
 | 
					      if idx < 0 && e[0] == opts && e[1] == cmd
 | 
				
			||||||
| 
						 | 
					@ -765,7 +824,8 @@ end
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
 | 
					    #newopts = ['r','w','u'].find_all{|c| newopts.index(c)}.join('')
 | 
				
			||||||
 | 
					    newopts = ['r','w','u'].find_all{|c| newopts.to_s.index(c)}.join('')
 | 
				
			||||||
    if newopts != @trace_opts
 | 
					    if newopts != @trace_opts
 | 
				
			||||||
      Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
 | 
					      Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
 | 
				
			||||||
=begin
 | 
					=begin
 | 
				
			||||||
| 
						 | 
					@ -807,6 +867,15 @@ class TkVarAccess<TkVariable
 | 
				
			||||||
    super(name, *args)
 | 
					    super(name, *args)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def self.new_hash(name, *args)
 | 
				
			||||||
 | 
					    return TkVar_ID_TBL[name] if TkVar_ID_TBL[name]
 | 
				
			||||||
 | 
					    if args.empty? && INTERP._invoke_without_enc('array', 'exist', name) == '0'
 | 
				
			||||||
 | 
					      self.new(name, {})  # force creating
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      self.new(name, *args)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def initialize(varname, val=nil)
 | 
					  def initialize(varname, val=nil)
 | 
				
			||||||
    @id = varname
 | 
					    @id = varname
 | 
				
			||||||
    TkVar_ID_TBL[@id] = self
 | 
					    TkVar_ID_TBL[@id] = self
 | 
				
			||||||
| 
						 | 
					@ -815,6 +884,11 @@ class TkVarAccess<TkVariable
 | 
				
			||||||
    INTERP._invoke_without_enc('global', @id)
 | 
					    INTERP._invoke_without_enc('global', @id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if val
 | 
					    if val
 | 
				
			||||||
 | 
					      if val.kind_of?(Hash)
 | 
				
			||||||
 | 
						# assoc-array variable
 | 
				
			||||||
 | 
						self[''] = 0
 | 
				
			||||||
 | 
						self.clear
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
      #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' #"
 | 
					      #s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' #"
 | 
				
			||||||
      #s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' #"
 | 
					      #s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' #"
 | 
				
			||||||
      #INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
 | 
					      #INTERP._eval(Kernel.format('global %s; set %s %s', @id, @id, s))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +75,7 @@ TkPanedwindow.new($paned2_demo, :orient=>:vertical){|f|
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
      }, 
 | 
					      }, 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      TkFrame.new(f) {|paned2_bottom|
 | 
					      TkFrame.new(f, :height=>120) {|paned2_bottom|
 | 
				
			||||||
	# The bottom window is a text widget with scrollbar
 | 
						# The bottom window is a text widget with scrollbar
 | 
				
			||||||
	paned2_xscr = TkScrollbar.new(paned2_bottom)
 | 
						paned2_xscr = TkScrollbar.new(paned2_bottom)
 | 
				
			||||||
	paned2_yscr = TkScrollbar.new(paned2_bottom)
 | 
						paned2_yscr = TkScrollbar.new(paned2_bottom)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,7 +64,7 @@ TkFrame.new($entry3_demo){|f|
 | 
				
			||||||
# count -	Counter to control the number of times flashed
 | 
					# count -	Counter to control the number of times flashed
 | 
				
			||||||
def focusAndFlash(widget, fg, bg, count=5)
 | 
					def focusAndFlash(widget, fg, bg, count=5)
 | 
				
			||||||
  return if count <= 0
 | 
					  return if count <= 0
 | 
				
			||||||
  TkTimer.new(200, count, 
 | 
					  TkTimer.new(100, count, 
 | 
				
			||||||
	      proc{widget.configure(:foreground=>bg, :background=>fg)}, 
 | 
						      proc{widget.configure(:foreground=>bg, :background=>fg)}, 
 | 
				
			||||||
	      proc{widget.configure(:foreground=>fg, :background=>bg)}
 | 
						      proc{widget.configure(:foreground=>fg, :background=>bg)}
 | 
				
			||||||
	      ).start
 | 
						      ).start
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -173,7 +173,8 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m|
 | 
				
			||||||
  TkMenu.new(m, 'tearoff'=>false) {|icon_menu|
 | 
					  TkMenu.new(m, 'tearoff'=>false) {|icon_menu|
 | 
				
			||||||
    m.add('cascade', 'label'=>'Icons', 'menu'=>icon_menu, 'underline'=>0)
 | 
					    m.add('cascade', 'label'=>'Icons', 'menu'=>icon_menu, 'underline'=>0)
 | 
				
			||||||
    add('command', 
 | 
					    add('command', 
 | 
				
			||||||
	'bitmap'=>'@'+[$demo_dir,'images','pattern.bmp'].join(File::Separator),
 | 
						'bitmap'=>'@'+[$demo_dir,'..',
 | 
				
			||||||
 | 
						                'images','pattern.xbm'].join(File::Separator),
 | 
				
			||||||
	'hidemargin'=>1, 
 | 
						'hidemargin'=>1, 
 | 
				
			||||||
	'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 
 | 
						'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 
 | 
				
			||||||
				     'text'=>'今あなたが選択したメニューの項目はテキストではなくビットマップを表示していました。それ以外の点では他のメニュー項目と変わりません。',
 | 
									     'text'=>'今あなたが選択したメニューの項目はテキストではなくビットマップを表示していました。それ以外の点では他のメニュー項目と変わりません。',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@ TkPanedwindow.new($paned2_demo, :orient=>:vertical){|f|
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
      }, 
 | 
					      }, 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      TkFrame.new(f) {|paned2_bottom|
 | 
					      TkFrame.new(f, :height=>120) {|paned2_bottom|
 | 
				
			||||||
	# The bottom window is a text widget with scrollbar
 | 
						# The bottom window is a text widget with scrollbar
 | 
				
			||||||
	paned2_xscr = TkScrollbar.new(paned2_bottom)
 | 
						paned2_xscr = TkScrollbar.new(paned2_bottom)
 | 
				
			||||||
	paned2_yscr = TkScrollbar.new(paned2_bottom)
 | 
						paned2_yscr = TkScrollbar.new(paned2_bottom)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,6 +62,9 @@ EOD
 | 
				
			||||||
    delegate('relief', @frame)
 | 
					    delegate('relief', @frame)
 | 
				
			||||||
    delegate('borderwidth', @frame)
 | 
					    delegate('borderwidth', @frame)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    delegate_alias('arrowrelief', 'relief', @up_arrow, @down_arrow)
 | 
				
			||||||
 | 
					    delegate_alias('arrowborderwidth', 'borderwidth', @up_arrow, @down_arrow)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    scrollbar(keys.delete('scrollbar')){false}
 | 
					    scrollbar(keys.delete('scrollbar')){false}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    configure keys unless keys.empty?
 | 
					    configure keys unless keys.empty?
 | 
				
			||||||
| 
						 | 
					@ -324,6 +327,9 @@ EOD
 | 
				
			||||||
    delegate('relief', @frame)
 | 
					    delegate('relief', @frame)
 | 
				
			||||||
    delegate('borderwidth', @frame)
 | 
					    delegate('borderwidth', @frame)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    delegate('arrowrelief', @lst)
 | 
				
			||||||
 | 
					    delegate('arrowborderwidth', @lst)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if mode = keys.delete('scrollbar')
 | 
					    if mode = keys.delete('scrollbar')
 | 
				
			||||||
      scrollbar(mode)
 | 
					      scrollbar(mode)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					@ -391,6 +397,7 @@ end
 | 
				
			||||||
if __FILE__ == $0
 | 
					if __FILE__ == $0
 | 
				
			||||||
  v = TkVariable.new
 | 
					  v = TkVariable.new
 | 
				
			||||||
  e = TkCombobox.new(:height=>7, :scrollbar=>true, :textvariable=>v, 
 | 
					  e = TkCombobox.new(:height=>7, :scrollbar=>true, :textvariable=>v, 
 | 
				
			||||||
 | 
							     :arrowrelief=>:flat, :arrowborderwidth=>0, 
 | 
				
			||||||
		     :startwait=>400, :interval=>200).pack
 | 
							     :startwait=>400, :interval=>200).pack
 | 
				
			||||||
  e.values(%w(aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu))
 | 
					  e.values(%w(aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu))
 | 
				
			||||||
  #e.see(e.list_index('end') - 2)
 | 
					  #e.see(e.list_index('end') - 2)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -109,9 +109,7 @@ class TkMultiListbox < TkListbox
 | 
				
			||||||
	@v_scroll.set first, last
 | 
						@v_scroll.set first, last
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#    @v_scroll.command proc{|*args| @lbox_list.each{|lbox| lbox.yview *args} }
 | 
					    @v_scroll.command proc{|*args| @lbox_list.each{|lbox| lbox.yview *args} }
 | 
				
			||||||
    @v_scroll.command proc{|*args| p "";p [@lbox_list, args]; @lbox_list.each{|lbox| lbox.yview *args} }
 | 
					 | 
				
			||||||
#    @v_scroll.command proc{|*args| p "";p [@lbox_list, args]; @lbox_list.each{|lbox| lbox.yview *args}; p [@lbox_list, args] }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # binding for listboxes
 | 
					    # binding for listboxes
 | 
				
			||||||
    @mode = {}
 | 
					    @mode = {}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,6 +30,7 @@ static ID ID_path;
 | 
				
			||||||
static ID ID_at_path;
 | 
					static ID ID_at_path;
 | 
				
			||||||
static ID ID_to_eval;
 | 
					static ID ID_to_eval;
 | 
				
			||||||
static ID ID_to_s;
 | 
					static ID ID_to_s;
 | 
				
			||||||
 | 
					static ID ID_downcase;
 | 
				
			||||||
static ID ID_install_cmd;
 | 
					static ID ID_install_cmd;
 | 
				
			||||||
static ID ID_merge_tklist;
 | 
					static ID ID_merge_tklist;
 | 
				
			||||||
static ID ID_call;
 | 
					static ID ID_call;
 | 
				
			||||||
| 
						 | 
					@ -219,12 +220,77 @@ tk_symbolkey2str(self, keys)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static VALUE get_eval_string_core _((VALUE, VALUE, VALUE));
 | 
					static VALUE get_eval_string_core _((VALUE, VALUE, VALUE));
 | 
				
			||||||
static VALUE ary2list _((VALUE, VALUE));
 | 
					static VALUE ary2list _((VALUE, VALUE));
 | 
				
			||||||
 | 
					static VALUE ary2list2 _((VALUE, VALUE));
 | 
				
			||||||
static VALUE hash2list _((VALUE, VALUE));
 | 
					static VALUE hash2list _((VALUE, VALUE));
 | 
				
			||||||
 | 
					static VALUE hash2kv _((VALUE, VALUE, VALUE));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static VALUE
 | 
					static VALUE
 | 
				
			||||||
ary2list(ary, self)
 | 
					ary2list(ary, self)
 | 
				
			||||||
    VALUE ary;
 | 
					    VALUE ary;
 | 
				
			||||||
    VALUE self;
 | 
					    VALUE self;
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    int idx, idx2, size, size2;
 | 
				
			||||||
 | 
					    volatile VALUE val, val2;
 | 
				
			||||||
 | 
					    volatile VALUE dst;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* size = RARRAY(ary)->len; */
 | 
				
			||||||
 | 
					    size = 0;
 | 
				
			||||||
 | 
					    for(idx = 0; idx < RARRAY(ary)->len; idx++) {
 | 
				
			||||||
 | 
						if (TYPE(RARRAY(ary)->ptr[idx]) == T_HASH) {
 | 
				
			||||||
 | 
						    size += 2 * RHASH(RARRAY(ary)->ptr[idx])->tbl->num_entries;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
						    size++;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dst = rb_ary_new2(size);
 | 
				
			||||||
 | 
					    RARRAY(dst)->len = 0;
 | 
				
			||||||
 | 
					    for(idx = 0; idx < RARRAY(ary)->len; idx++) {
 | 
				
			||||||
 | 
						val = RARRAY(ary)->ptr[idx];
 | 
				
			||||||
 | 
						switch(TYPE(val)) {
 | 
				
			||||||
 | 
						case T_ARRAY:
 | 
				
			||||||
 | 
						    RARRAY(dst)->ptr[RARRAY(dst)->len++] = ary2list(val, self);
 | 
				
			||||||
 | 
						    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case T_HASH:
 | 
				
			||||||
 | 
						    /* RARRAY(dst)->ptr[RARRAY(dst)->len++] = hash2list(val, self); */
 | 
				
			||||||
 | 
						    val = hash2kv(val, Qnil, self);
 | 
				
			||||||
 | 
						    size2 = RARRAY(val)->len;
 | 
				
			||||||
 | 
						    for(idx2 = 0; idx2 < size2; idx2++) {
 | 
				
			||||||
 | 
							val2 = RARRAY(val)->ptr[idx2];
 | 
				
			||||||
 | 
							switch(TYPE(val2)) {
 | 
				
			||||||
 | 
							case T_ARRAY:
 | 
				
			||||||
 | 
							    RARRAY(dst)->ptr[RARRAY(dst)->len++] 
 | 
				
			||||||
 | 
								= ary2list(val2, self);
 | 
				
			||||||
 | 
							    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							case T_HASH:
 | 
				
			||||||
 | 
							    RARRAY(dst)->ptr[RARRAY(dst)->len++] 
 | 
				
			||||||
 | 
								= hash2list(val2, self);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
							    if (val2 != TK_None) {
 | 
				
			||||||
 | 
								RARRAY(dst)->ptr[RARRAY(dst)->len++] 
 | 
				
			||||||
 | 
								    = get_eval_string_core(val2, Qnil, self);
 | 
				
			||||||
 | 
							    }
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						    }
 | 
				
			||||||
 | 
						    break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						default:
 | 
				
			||||||
 | 
						    if (val != TK_None) {
 | 
				
			||||||
 | 
							RARRAY(dst)->ptr[RARRAY(dst)->len++] 
 | 
				
			||||||
 | 
							    = get_eval_string_core(val, Qnil, self);
 | 
				
			||||||
 | 
						    }
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return rb_apply(cTclTkLib, ID_merge_tklist, dst);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static VALUE
 | 
				
			||||||
 | 
					ary2list2(ary, self)
 | 
				
			||||||
 | 
					    VALUE ary;
 | 
				
			||||||
 | 
					    VALUE self;
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    int idx, size;
 | 
					    int idx, size;
 | 
				
			||||||
    volatile VALUE val;
 | 
					    volatile VALUE val;
 | 
				
			||||||
| 
						 | 
					@ -233,7 +299,7 @@ ary2list(ary, self)
 | 
				
			||||||
    size = RARRAY(ary)->len;
 | 
					    size = RARRAY(ary)->len;
 | 
				
			||||||
    dst = rb_ary_new2(size);
 | 
					    dst = rb_ary_new2(size);
 | 
				
			||||||
    RARRAY(dst)->len = 0;
 | 
					    RARRAY(dst)->len = 0;
 | 
				
			||||||
    for(idx = 0; idx < size; idx++) {
 | 
					    for(idx = 0; idx < RARRAY(ary)->len; idx++) {
 | 
				
			||||||
	val = RARRAY(ary)->ptr[idx];
 | 
						val = RARRAY(ary)->ptr[idx];
 | 
				
			||||||
	switch(TYPE(val)) {
 | 
						switch(TYPE(val)) {
 | 
				
			||||||
	case T_ARRAY:
 | 
						case T_ARRAY:
 | 
				
			||||||
| 
						 | 
					@ -377,6 +443,7 @@ push_kv(key, val, ary)
 | 
				
			||||||
    if (val != TK_None) rb_ary_push(ary, val);
 | 
					    if (val != TK_None) rb_ary_push(ary, val);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    RARRAY(ary)->ptr[RARRAY(ary)->len++] = key2keyname(key);
 | 
					    RARRAY(ary)->ptr[RARRAY(ary)->len++] = key2keyname(key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (val != TK_None) RARRAY(ary)->ptr[RARRAY(ary)->len++] = val;
 | 
					    if (val != TK_None) RARRAY(ary)->ptr[RARRAY(ary)->len++] = val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return ST_CONTINUE;
 | 
					    return ST_CONTINUE;
 | 
				
			||||||
| 
						 | 
					@ -455,7 +522,7 @@ hash2list(hash, self)
 | 
				
			||||||
    VALUE hash;
 | 
					    VALUE hash;
 | 
				
			||||||
    VALUE self;
 | 
					    VALUE self;
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return ary2list(hash2kv(hash, Qnil, self), self);
 | 
					    return ary2list2(hash2kv(hash, Qnil, self), self);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -464,7 +531,7 @@ hash2list_enc(hash, self)
 | 
				
			||||||
    VALUE hash;
 | 
					    VALUE hash;
 | 
				
			||||||
    VALUE self;
 | 
					    VALUE self;
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return ary2list(hash2kv_enc(hash, Qnil, self), self);
 | 
					    return ary2list2(hash2kv_enc(hash, Qnil, self), self);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static VALUE
 | 
					static VALUE
 | 
				
			||||||
| 
						 | 
					@ -691,9 +758,12 @@ tcl2rb_bool(self, value)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rb_check_type(value, T_STRING);
 | 
					    rb_check_type(value, T_STRING);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    value = rb_funcall(value, ID_downcase, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (RSTRING(value)->ptr[0] == '\0'
 | 
					    if (RSTRING(value)->ptr[0] == '\0'
 | 
				
			||||||
	|| strcmp(RSTRING(value)->ptr, "0") == 0
 | 
						|| strcmp(RSTRING(value)->ptr, "0") == 0
 | 
				
			||||||
	|| strcmp(RSTRING(value)->ptr, "no") == 0
 | 
						|| strcmp(RSTRING(value)->ptr, "no") == 0
 | 
				
			||||||
 | 
						|| strcmp(RSTRING(value)->ptr, "off") == 0
 | 
				
			||||||
	|| strcmp(RSTRING(value)->ptr, "false") == 0) {
 | 
						|| strcmp(RSTRING(value)->ptr, "false") == 0) {
 | 
				
			||||||
	return Qfalse;
 | 
						return Qfalse;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
| 
						 | 
					@ -1095,6 +1165,7 @@ Init_tkutil()
 | 
				
			||||||
    ID_at_path = rb_intern("@path");
 | 
					    ID_at_path = rb_intern("@path");
 | 
				
			||||||
    ID_to_eval = rb_intern("to_eval");
 | 
					    ID_to_eval = rb_intern("to_eval");
 | 
				
			||||||
    ID_to_s = rb_intern("to_s");
 | 
					    ID_to_s = rb_intern("to_s");
 | 
				
			||||||
 | 
					    ID_downcase = rb_intern("downcase");
 | 
				
			||||||
    ID_install_cmd = rb_intern("install_cmd");
 | 
					    ID_install_cmd = rb_intern("install_cmd");
 | 
				
			||||||
    ID_merge_tklist = rb_intern("_merge_tklist");
 | 
					    ID_merge_tklist = rb_intern("_merge_tklist");
 | 
				
			||||||
    ID_call = rb_intern("call");
 | 
					    ID_call = rb_intern("call");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue