tk 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1060) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +6 -0
  4. data/BSDL +22 -0
  5. data/ChangeLog.tkextlib +949 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +56 -0
  8. data/MANUAL_tcltklib.eng +467 -0
  9. data/MANUAL_tcltklib.ja +578 -0
  10. data/README.1st +19 -0
  11. data/README.ActiveTcl +62 -0
  12. data/README.fork +34 -0
  13. data/README.macosx-aqua +67 -0
  14. data/README.md +33 -0
  15. data/README.tcltklib +152 -0
  16. data/Rakefile +16 -0
  17. data/bin/console +14 -0
  18. data/bin/setup +8 -0
  19. data/ext/tk/config_list.in +41 -0
  20. data/ext/tk/extconf.rb +2098 -0
  21. data/ext/tk/old-extconf.rb +441 -0
  22. data/ext/tk/stubs.c +592 -0
  23. data/ext/tk/stubs.h +33 -0
  24. data/ext/tk/tcltklib.c +11066 -0
  25. data/ext/tk/tkutil/extconf.rb +14 -0
  26. data/ext/tk/tkutil/tkutil.c +1900 -0
  27. data/lib/README +30 -0
  28. data/lib/multi-tk.rb +3743 -0
  29. data/lib/remote-tk.rb +527 -0
  30. data/lib/tcltk.rb +369 -0
  31. data/lib/tk.rb +5758 -0
  32. data/lib/tk/after.rb +7 -0
  33. data/lib/tk/autoload.rb +763 -0
  34. data/lib/tk/bgerror.rb +30 -0
  35. data/lib/tk/bindtag.rb +139 -0
  36. data/lib/tk/busy.rb +119 -0
  37. data/lib/tk/button.rb +32 -0
  38. data/lib/tk/canvas.rb +847 -0
  39. data/lib/tk/canvastag.rb +460 -0
  40. data/lib/tk/checkbutton.rb +33 -0
  41. data/lib/tk/clipboard.rb +76 -0
  42. data/lib/tk/clock.rb +72 -0
  43. data/lib/tk/composite.rb +485 -0
  44. data/lib/tk/console.rb +53 -0
  45. data/lib/tk/dialog.rb +327 -0
  46. data/lib/tk/encodedstr.rb +188 -0
  47. data/lib/tk/entry.rb +121 -0
  48. data/lib/tk/event.rb +563 -0
  49. data/lib/tk/font.rb +2352 -0
  50. data/lib/tk/fontchooser.rb +181 -0
  51. data/lib/tk/frame.rb +133 -0
  52. data/lib/tk/grid.rb +280 -0
  53. data/lib/tk/image.rb +396 -0
  54. data/lib/tk/itemconfig.rb +1222 -0
  55. data/lib/tk/itemfont.rb +328 -0
  56. data/lib/tk/kinput.rb +72 -0
  57. data/lib/tk/label.rb +23 -0
  58. data/lib/tk/labelframe.rb +32 -0
  59. data/lib/tk/listbox.rb +285 -0
  60. data/lib/tk/macpkg.rb +81 -0
  61. data/lib/tk/menu.rb +719 -0
  62. data/lib/tk/menubar.rb +138 -0
  63. data/lib/tk/menuspec.rb +457 -0
  64. data/lib/tk/message.rb +25 -0
  65. data/lib/tk/mngfocus.rb +34 -0
  66. data/lib/tk/msgcat.rb +300 -0
  67. data/lib/tk/namespace.rb +547 -0
  68. data/lib/tk/optiondb.rb +372 -0
  69. data/lib/tk/optionobj.rb +213 -0
  70. data/lib/tk/pack.rb +108 -0
  71. data/lib/tk/package.rb +144 -0
  72. data/lib/tk/palette.rb +56 -0
  73. data/lib/tk/panedwindow.rb +261 -0
  74. data/lib/tk/place.rb +129 -0
  75. data/lib/tk/radiobutton.rb +74 -0
  76. data/lib/tk/root.rb +96 -0
  77. data/lib/tk/scale.rb +113 -0
  78. data/lib/tk/scrollable.rb +83 -0
  79. data/lib/tk/scrollbar.rb +184 -0
  80. data/lib/tk/scrollbox.rb +40 -0
  81. data/lib/tk/selection.rb +87 -0
  82. data/lib/tk/spinbox.rb +145 -0
  83. data/lib/tk/tagfont.rb +44 -0
  84. data/lib/tk/text.rb +1605 -0
  85. data/lib/tk/textimage.rb +89 -0
  86. data/lib/tk/textmark.rb +205 -0
  87. data/lib/tk/texttag.rb +322 -0
  88. data/lib/tk/textwindow.rb +155 -0
  89. data/lib/tk/timer.rb +666 -0
  90. data/lib/tk/tk_mac.rb +159 -0
  91. data/lib/tk/toplevel.rb +265 -0
  92. data/lib/tk/ttk_selector.rb +99 -0
  93. data/lib/tk/txtwin_abst.rb +40 -0
  94. data/lib/tk/validation.rb +398 -0
  95. data/lib/tk/variable.rb +1797 -0
  96. data/lib/tk/virtevent.rb +140 -0
  97. data/lib/tk/winfo.rb +393 -0
  98. data/lib/tk/winpkg.rb +157 -0
  99. data/lib/tk/wm.rb +553 -0
  100. data/lib/tk/xim.rb +123 -0
  101. data/lib/tkafter.rb +5 -0
  102. data/lib/tkbgerror.rb +5 -0
  103. data/lib/tkcanvas.rb +5 -0
  104. data/lib/tkclass.rb +48 -0
  105. data/lib/tkconsole.rb +5 -0
  106. data/lib/tkdialog.rb +5 -0
  107. data/lib/tkentry.rb +5 -0
  108. data/lib/tkextlib/ICONS.rb +14 -0
  109. data/lib/tkextlib/ICONS/icons.rb +130 -0
  110. data/lib/tkextlib/ICONS/setup.rb +9 -0
  111. data/lib/tkextlib/SUPPORT_STATUS +193 -0
  112. data/lib/tkextlib/blt.rb +190 -0
  113. data/lib/tkextlib/blt/barchart.rb +80 -0
  114. data/lib/tkextlib/blt/bitmap.rb +113 -0
  115. data/lib/tkextlib/blt/busy.rb +84 -0
  116. data/lib/tkextlib/blt/component.rb +2219 -0
  117. data/lib/tkextlib/blt/container.rb +29 -0
  118. data/lib/tkextlib/blt/cutbuffer.rb +24 -0
  119. data/lib/tkextlib/blt/dragdrop.rb +270 -0
  120. data/lib/tkextlib/blt/eps.rb +33 -0
  121. data/lib/tkextlib/blt/graph.rb +68 -0
  122. data/lib/tkextlib/blt/htext.rb +113 -0
  123. data/lib/tkextlib/blt/setup.rb +9 -0
  124. data/lib/tkextlib/blt/spline.rb +24 -0
  125. data/lib/tkextlib/blt/stripchart.rb +75 -0
  126. data/lib/tkextlib/blt/table.rb +413 -0
  127. data/lib/tkextlib/blt/tabnotebook.rb +111 -0
  128. data/lib/tkextlib/blt/tabset.rb +505 -0
  129. data/lib/tkextlib/blt/ted.rb +69 -0
  130. data/lib/tkextlib/blt/tile.rb +26 -0
  131. data/lib/tkextlib/blt/tile/button.rb +17 -0
  132. data/lib/tkextlib/blt/tile/checkbutton.rb +18 -0
  133. data/lib/tkextlib/blt/tile/frame.rb +17 -0
  134. data/lib/tkextlib/blt/tile/label.rb +17 -0
  135. data/lib/tkextlib/blt/tile/radiobutton.rb +18 -0
  136. data/lib/tkextlib/blt/tile/scrollbar.rb +17 -0
  137. data/lib/tkextlib/blt/tile/toplevel.rb +17 -0
  138. data/lib/tkextlib/blt/tree.rb +1059 -0
  139. data/lib/tkextlib/blt/treeview.rb +1288 -0
  140. data/lib/tkextlib/blt/unix_dnd.rb +142 -0
  141. data/lib/tkextlib/blt/vector.rb +257 -0
  142. data/lib/tkextlib/blt/watch.rb +176 -0
  143. data/lib/tkextlib/blt/win_printer.rb +62 -0
  144. data/lib/tkextlib/blt/winop.rb +108 -0
  145. data/lib/tkextlib/bwidget.rb +154 -0
  146. data/lib/tkextlib/bwidget/arrowbutton.rb +22 -0
  147. data/lib/tkextlib/bwidget/bitmap.rb +22 -0
  148. data/lib/tkextlib/bwidget/button.rb +32 -0
  149. data/lib/tkextlib/bwidget/buttonbox.rb +91 -0
  150. data/lib/tkextlib/bwidget/combobox.rb +63 -0
  151. data/lib/tkextlib/bwidget/dialog.rb +195 -0
  152. data/lib/tkextlib/bwidget/dragsite.rb +32 -0
  153. data/lib/tkextlib/bwidget/dropsite.rb +40 -0
  154. data/lib/tkextlib/bwidget/dynamichelp.rb +64 -0
  155. data/lib/tkextlib/bwidget/entry.rb +44 -0
  156. data/lib/tkextlib/bwidget/label.rb +42 -0
  157. data/lib/tkextlib/bwidget/labelentry.rb +81 -0
  158. data/lib/tkextlib/bwidget/labelframe.rb +53 -0
  159. data/lib/tkextlib/bwidget/listbox.rb +362 -0
  160. data/lib/tkextlib/bwidget/mainframe.rb +133 -0
  161. data/lib/tkextlib/bwidget/messagedlg.rb +193 -0
  162. data/lib/tkextlib/bwidget/notebook.rb +167 -0
  163. data/lib/tkextlib/bwidget/pagesmanager.rb +74 -0
  164. data/lib/tkextlib/bwidget/panedwindow.rb +43 -0
  165. data/lib/tkextlib/bwidget/panelframe.rb +68 -0
  166. data/lib/tkextlib/bwidget/passwddlg.rb +45 -0
  167. data/lib/tkextlib/bwidget/progressbar.rb +21 -0
  168. data/lib/tkextlib/bwidget/progressdlg.rb +59 -0
  169. data/lib/tkextlib/bwidget/scrollableframe.rb +41 -0
  170. data/lib/tkextlib/bwidget/scrolledwindow.rb +49 -0
  171. data/lib/tkextlib/bwidget/scrollview.rb +26 -0
  172. data/lib/tkextlib/bwidget/selectcolor.rb +74 -0
  173. data/lib/tkextlib/bwidget/selectfont.rb +92 -0
  174. data/lib/tkextlib/bwidget/separator.rb +21 -0
  175. data/lib/tkextlib/bwidget/setup.rb +9 -0
  176. data/lib/tkextlib/bwidget/spinbox.rb +99 -0
  177. data/lib/tkextlib/bwidget/statusbar.rb +63 -0
  178. data/lib/tkextlib/bwidget/titleframe.rb +34 -0
  179. data/lib/tkextlib/bwidget/tree.rb +501 -0
  180. data/lib/tkextlib/bwidget/widget.rb +130 -0
  181. data/lib/tkextlib/itcl.rb +14 -0
  182. data/lib/tkextlib/itcl/incr_tcl.rb +179 -0
  183. data/lib/tkextlib/itcl/setup.rb +14 -0
  184. data/lib/tkextlib/itk.rb +14 -0
  185. data/lib/tkextlib/itk/incr_tk.rb +447 -0
  186. data/lib/tkextlib/itk/setup.rb +14 -0
  187. data/lib/tkextlib/iwidgets.rb +95 -0
  188. data/lib/tkextlib/iwidgets/buttonbox.rb +122 -0
  189. data/lib/tkextlib/iwidgets/calendar.rb +126 -0
  190. data/lib/tkextlib/iwidgets/canvasprintbox.rb +54 -0
  191. data/lib/tkextlib/iwidgets/canvasprintdialog.rb +39 -0
  192. data/lib/tkextlib/iwidgets/checkbox.rb +131 -0
  193. data/lib/tkextlib/iwidgets/combobox.rb +105 -0
  194. data/lib/tkextlib/iwidgets/dateentry.rb +21 -0
  195. data/lib/tkextlib/iwidgets/datefield.rb +59 -0
  196. data/lib/tkextlib/iwidgets/dialog.rb +21 -0
  197. data/lib/tkextlib/iwidgets/dialogshell.rb +122 -0
  198. data/lib/tkextlib/iwidgets/disjointlistbox.rb +51 -0
  199. data/lib/tkextlib/iwidgets/entryfield.rb +186 -0
  200. data/lib/tkextlib/iwidgets/extbutton.rb +41 -0
  201. data/lib/tkextlib/iwidgets/extfileselectionbox.rb +47 -0
  202. data/lib/tkextlib/iwidgets/extfileselectiondialog.rb +34 -0
  203. data/lib/tkextlib/iwidgets/feedback.rb +36 -0
  204. data/lib/tkextlib/iwidgets/fileselectionbox.rb +47 -0
  205. data/lib/tkextlib/iwidgets/fileselectiondialog.rb +34 -0
  206. data/lib/tkextlib/iwidgets/finddialog.rb +43 -0
  207. data/lib/tkextlib/iwidgets/hierarchy.rb +366 -0
  208. data/lib/tkextlib/iwidgets/hyperhelp.rb +51 -0
  209. data/lib/tkextlib/iwidgets/labeledframe.rb +40 -0
  210. data/lib/tkextlib/iwidgets/labeledwidget.rb +46 -0
  211. data/lib/tkextlib/iwidgets/mainwindow.rb +68 -0
  212. data/lib/tkextlib/iwidgets/menubar.rb +213 -0
  213. data/lib/tkextlib/iwidgets/messagebox.rb +94 -0
  214. data/lib/tkextlib/iwidgets/messagedialog.rb +21 -0
  215. data/lib/tkextlib/iwidgets/notebook.rb +176 -0
  216. data/lib/tkextlib/iwidgets/optionmenu.rb +93 -0
  217. data/lib/tkextlib/iwidgets/panedwindow.rb +135 -0
  218. data/lib/tkextlib/iwidgets/promptdialog.rb +132 -0
  219. data/lib/tkextlib/iwidgets/pushbutton.rb +36 -0
  220. data/lib/tkextlib/iwidgets/radiobox.rb +122 -0
  221. data/lib/tkextlib/iwidgets/scopedobject.rb +25 -0
  222. data/lib/tkextlib/iwidgets/scrolledcanvas.rb +354 -0
  223. data/lib/tkextlib/iwidgets/scrolledframe.rb +60 -0
  224. data/lib/tkextlib/iwidgets/scrolledhtml.rb +59 -0
  225. data/lib/tkextlib/iwidgets/scrolledlistbox.rb +208 -0
  226. data/lib/tkextlib/iwidgets/scrolledtext.rb +569 -0
  227. data/lib/tkextlib/iwidgets/scrolledwidget.rb +21 -0
  228. data/lib/tkextlib/iwidgets/selectionbox.rb +103 -0
  229. data/lib/tkextlib/iwidgets/selectiondialog.rb +93 -0
  230. data/lib/tkextlib/iwidgets/setup.rb +9 -0
  231. data/lib/tkextlib/iwidgets/shell.rb +39 -0
  232. data/lib/tkextlib/iwidgets/spindate.rb +49 -0
  233. data/lib/tkextlib/iwidgets/spinint.rb +31 -0
  234. data/lib/tkextlib/iwidgets/spinner.rb +170 -0
  235. data/lib/tkextlib/iwidgets/spintime.rb +49 -0
  236. data/lib/tkextlib/iwidgets/tabnotebook.rb +182 -0
  237. data/lib/tkextlib/iwidgets/tabset.rb +146 -0
  238. data/lib/tkextlib/iwidgets/timeentry.rb +26 -0
  239. data/lib/tkextlib/iwidgets/timefield.rb +59 -0
  240. data/lib/tkextlib/iwidgets/toolbar.rb +113 -0
  241. data/lib/tkextlib/iwidgets/watch.rb +57 -0
  242. data/lib/tkextlib/pkg_checker.rb +185 -0
  243. data/lib/tkextlib/setup.rb +9 -0
  244. data/lib/tkextlib/tcllib.rb +106 -0
  245. data/lib/tkextlib/tcllib/README +135 -0
  246. data/lib/tkextlib/tcllib/autoscroll.rb +159 -0
  247. data/lib/tkextlib/tcllib/calendar.rb +56 -0
  248. data/lib/tkextlib/tcllib/canvas_sqmap.rb +37 -0
  249. data/lib/tkextlib/tcllib/canvas_zoom.rb +22 -0
  250. data/lib/tkextlib/tcllib/chatwidget.rb +152 -0
  251. data/lib/tkextlib/tcllib/crosshair.rb +118 -0
  252. data/lib/tkextlib/tcllib/ctext.rb +161 -0
  253. data/lib/tkextlib/tcllib/cursor.rb +98 -0
  254. data/lib/tkextlib/tcllib/dateentry.rb +63 -0
  255. data/lib/tkextlib/tcllib/datefield.rb +58 -0
  256. data/lib/tkextlib/tcllib/diagrams.rb +225 -0
  257. data/lib/tkextlib/tcllib/dialog.rb +85 -0
  258. data/lib/tkextlib/tcllib/getstring.rb +135 -0
  259. data/lib/tkextlib/tcllib/history.rb +74 -0
  260. data/lib/tkextlib/tcllib/ico.rb +147 -0
  261. data/lib/tkextlib/tcllib/ip_entry.rb +76 -0
  262. data/lib/tkextlib/tcllib/khim.rb +69 -0
  263. data/lib/tkextlib/tcllib/menuentry.rb +48 -0
  264. data/lib/tkextlib/tcllib/ntext.rb +147 -0
  265. data/lib/tkextlib/tcllib/panelframe.rb +79 -0
  266. data/lib/tkextlib/tcllib/plotchart.rb +1405 -0
  267. data/lib/tkextlib/tcllib/ruler.rb +66 -0
  268. data/lib/tkextlib/tcllib/screenruler.rb +69 -0
  269. data/lib/tkextlib/tcllib/scrolledwindow.rb +58 -0
  270. data/lib/tkextlib/tcllib/scrollwin.rb +62 -0
  271. data/lib/tkextlib/tcllib/setup.rb +9 -0
  272. data/lib/tkextlib/tcllib/statusbar.rb +80 -0
  273. data/lib/tkextlib/tcllib/style.rb +62 -0
  274. data/lib/tkextlib/tcllib/superframe.rb +52 -0
  275. data/lib/tkextlib/tcllib/swaplist.rb +151 -0
  276. data/lib/tkextlib/tcllib/tablelist.rb +29 -0
  277. data/lib/tkextlib/tcllib/tablelist_core.rb +1073 -0
  278. data/lib/tkextlib/tcllib/tablelist_tile.rb +44 -0
  279. data/lib/tkextlib/tcllib/tkpiechart.rb +315 -0
  280. data/lib/tkextlib/tcllib/toolbar.rb +176 -0
  281. data/lib/tkextlib/tcllib/tooltip.rb +105 -0
  282. data/lib/tkextlib/tcllib/validator.rb +66 -0
  283. data/lib/tkextlib/tcllib/widget.rb +83 -0
  284. data/lib/tkextlib/tclx.rb +14 -0
  285. data/lib/tkextlib/tclx/setup.rb +9 -0
  286. data/lib/tkextlib/tclx/tclx.rb +75 -0
  287. data/lib/tkextlib/tile.rb +450 -0
  288. data/lib/tkextlib/tile/dialog.rb +103 -0
  289. data/lib/tkextlib/tile/setup.rb +9 -0
  290. data/lib/tkextlib/tile/sizegrip.rb +33 -0
  291. data/lib/tkextlib/tile/style.rb +337 -0
  292. data/lib/tkextlib/tile/tbutton.rb +35 -0
  293. data/lib/tkextlib/tile/tcheckbutton.rb +39 -0
  294. data/lib/tkextlib/tile/tcombobox.rb +56 -0
  295. data/lib/tkextlib/tile/tentry.rb +50 -0
  296. data/lib/tkextlib/tile/tframe.rb +35 -0
  297. data/lib/tkextlib/tile/tlabel.rb +35 -0
  298. data/lib/tkextlib/tile/tlabelframe.rb +39 -0
  299. data/lib/tkextlib/tile/tmenubutton.rb +39 -0
  300. data/lib/tkextlib/tile/tnotebook.rb +148 -0
  301. data/lib/tkextlib/tile/tpaned.rb +246 -0
  302. data/lib/tkextlib/tile/tprogressbar.rb +58 -0
  303. data/lib/tkextlib/tile/tradiobutton.rb +39 -0
  304. data/lib/tkextlib/tile/treeview.rb +1337 -0
  305. data/lib/tkextlib/tile/tscale.rb +57 -0
  306. data/lib/tkextlib/tile/tscrollbar.rb +64 -0
  307. data/lib/tkextlib/tile/tseparator.rb +35 -0
  308. data/lib/tkextlib/tile/tspinbox.rb +108 -0
  309. data/lib/tkextlib/tile/tsquare.rb +31 -0
  310. data/lib/tkextlib/tkDND.rb +19 -0
  311. data/lib/tkextlib/tkDND/setup.rb +9 -0
  312. data/lib/tkextlib/tkDND/shape.rb +126 -0
  313. data/lib/tkextlib/tkDND/tkdnd.rb +183 -0
  314. data/lib/tkextlib/tkHTML.rb +14 -0
  315. data/lib/tkextlib/tkHTML/htmlwidget.rb +454 -0
  316. data/lib/tkextlib/tkHTML/setup.rb +9 -0
  317. data/lib/tkextlib/tkimg.rb +37 -0
  318. data/lib/tkextlib/tkimg/README +26 -0
  319. data/lib/tkextlib/tkimg/bmp.rb +34 -0
  320. data/lib/tkextlib/tkimg/dted.rb +34 -0
  321. data/lib/tkextlib/tkimg/gif.rb +34 -0
  322. data/lib/tkextlib/tkimg/ico.rb +34 -0
  323. data/lib/tkextlib/tkimg/jpeg.rb +34 -0
  324. data/lib/tkextlib/tkimg/pcx.rb +34 -0
  325. data/lib/tkextlib/tkimg/pixmap.rb +45 -0
  326. data/lib/tkextlib/tkimg/png.rb +34 -0
  327. data/lib/tkextlib/tkimg/ppm.rb +34 -0
  328. data/lib/tkextlib/tkimg/ps.rb +34 -0
  329. data/lib/tkextlib/tkimg/raw.rb +34 -0
  330. data/lib/tkextlib/tkimg/setup.rb +9 -0
  331. data/lib/tkextlib/tkimg/sgi.rb +34 -0
  332. data/lib/tkextlib/tkimg/sun.rb +34 -0
  333. data/lib/tkextlib/tkimg/tga.rb +34 -0
  334. data/lib/tkextlib/tkimg/tiff.rb +34 -0
  335. data/lib/tkextlib/tkimg/window.rb +34 -0
  336. data/lib/tkextlib/tkimg/xbm.rb +34 -0
  337. data/lib/tkextlib/tkimg/xpm.rb +34 -0
  338. data/lib/tkextlib/tktable.rb +15 -0
  339. data/lib/tkextlib/tktable/setup.rb +9 -0
  340. data/lib/tkextlib/tktable/tktable.rb +967 -0
  341. data/lib/tkextlib/tktrans.rb +15 -0
  342. data/lib/tkextlib/tktrans/setup.rb +9 -0
  343. data/lib/tkextlib/tktrans/tktrans.rb +65 -0
  344. data/lib/tkextlib/treectrl.rb +14 -0
  345. data/lib/tkextlib/treectrl/setup.rb +9 -0
  346. data/lib/tkextlib/treectrl/tktreectrl.rb +2523 -0
  347. data/lib/tkextlib/trofs.rb +14 -0
  348. data/lib/tkextlib/trofs/setup.rb +9 -0
  349. data/lib/tkextlib/trofs/trofs.rb +52 -0
  350. data/lib/tkextlib/version.rb +7 -0
  351. data/lib/tkextlib/vu.rb +49 -0
  352. data/lib/tkextlib/vu/bargraph.rb +62 -0
  353. data/lib/tkextlib/vu/charts.rb +54 -0
  354. data/lib/tkextlib/vu/dial.rb +103 -0
  355. data/lib/tkextlib/vu/pie.rb +287 -0
  356. data/lib/tkextlib/vu/setup.rb +9 -0
  357. data/lib/tkextlib/vu/spinbox.rb +23 -0
  358. data/lib/tkextlib/winico.rb +15 -0
  359. data/lib/tkextlib/winico/setup.rb +9 -0
  360. data/lib/tkextlib/winico/winico.rb +225 -0
  361. data/lib/tkfont.rb +5 -0
  362. data/lib/tkmacpkg.rb +5 -0
  363. data/lib/tkmenubar.rb +5 -0
  364. data/lib/tkmngfocus.rb +5 -0
  365. data/lib/tkpalette.rb +5 -0
  366. data/lib/tkscrollbox.rb +5 -0
  367. data/lib/tktext.rb +5 -0
  368. data/lib/tkvirtevent.rb +5 -0
  369. data/lib/tkwinpkg.rb +5 -0
  370. data/old-README.tcltklib.ja +159 -0
  371. data/sample/24hr_clock.rb +287 -0
  372. data/sample/binding_sample.rb +88 -0
  373. data/sample/bindtag_sample.rb +128 -0
  374. data/sample/binstr_usage.rb +46 -0
  375. data/sample/btn_with_frame.rb +21 -0
  376. data/sample/cd_timer.rb +82 -0
  377. data/sample/cmd_res_test.rb +18 -0
  378. data/sample/cmd_resource +5 -0
  379. data/sample/demos-en/ChangeLog +64 -0
  380. data/sample/demos-en/ChangeLog.prev +9 -0
  381. data/sample/demos-en/README +138 -0
  382. data/sample/demos-en/README.1st +18 -0
  383. data/sample/demos-en/README.tkencoding +29 -0
  384. data/sample/demos-en/anilabel.rb +175 -0
  385. data/sample/demos-en/aniwave.rb +119 -0
  386. data/sample/demos-en/arrow.rb +250 -0
  387. data/sample/demos-en/bind.rb +128 -0
  388. data/sample/demos-en/bitmap.rb +76 -0
  389. data/sample/demos-en/browse1 +63 -0
  390. data/sample/demos-en/browse2 +82 -0
  391. data/sample/demos-en/button.rb +85 -0
  392. data/sample/demos-en/check.rb +73 -0
  393. data/sample/demos-en/check2.rb +110 -0
  394. data/sample/demos-en/clrpick.rb +88 -0
  395. data/sample/demos-en/colors.rb +159 -0
  396. data/sample/demos-en/combo.rb +97 -0
  397. data/sample/demos-en/cscroll.rb +137 -0
  398. data/sample/demos-en/ctext.rb +208 -0
  399. data/sample/demos-en/dialog1.rb +39 -0
  400. data/sample/demos-en/dialog2.rb +42 -0
  401. data/sample/demos-en/doc.org/README +7 -0
  402. data/sample/demos-en/doc.org/README.JP +14 -0
  403. data/sample/demos-en/doc.org/README.tk80 +46 -0
  404. data/sample/demos-en/doc.org/license.terms +39 -0
  405. data/sample/demos-en/doc.org/license.terms.tk80 +39 -0
  406. data/sample/demos-en/entry1.rb +59 -0
  407. data/sample/demos-en/entry2.rb +94 -0
  408. data/sample/demos-en/entry3.rb +221 -0
  409. data/sample/demos-en/filebox.rb +103 -0
  410. data/sample/demos-en/floor.rb +1724 -0
  411. data/sample/demos-en/floor2.rb +1723 -0
  412. data/sample/demos-en/form.rb +65 -0
  413. data/sample/demos-en/goldberg.rb +2007 -0
  414. data/sample/demos-en/hello +14 -0
  415. data/sample/demos-en/hscale.rb +76 -0
  416. data/sample/demos-en/icon.rb +106 -0
  417. data/sample/demos-en/image1.rb +66 -0
  418. data/sample/demos-en/image2.rb +108 -0
  419. data/sample/demos-en/image3.rb +126 -0
  420. data/sample/demos-en/items.rb +382 -0
  421. data/sample/demos-en/ixset +333 -0
  422. data/sample/demos-en/ixset2 +367 -0
  423. data/sample/demos-en/knightstour.rb +272 -0
  424. data/sample/demos-en/label.rb +73 -0
  425. data/sample/demos-en/labelframe.rb +96 -0
  426. data/sample/demos-en/mclist.rb +118 -0
  427. data/sample/demos-en/menu.rb +197 -0
  428. data/sample/demos-en/menu84.rb +216 -0
  429. data/sample/demos-en/menubu.rb +238 -0
  430. data/sample/demos-en/msgbox.rb +91 -0
  431. data/sample/demos-en/msgbox2.rb +92 -0
  432. data/sample/demos-en/paned1.rb +48 -0
  433. data/sample/demos-en/paned2.rb +95 -0
  434. data/sample/demos-en/pendulum.rb +241 -0
  435. data/sample/demos-en/plot.rb +125 -0
  436. data/sample/demos-en/puzzle.rb +135 -0
  437. data/sample/demos-en/radio.rb +87 -0
  438. data/sample/demos-en/radio2.rb +110 -0
  439. data/sample/demos-en/radio3.rb +118 -0
  440. data/sample/demos-en/rmt +268 -0
  441. data/sample/demos-en/rolodex +320 -0
  442. data/sample/demos-en/ruler.rb +206 -0
  443. data/sample/demos-en/sayings.rb +107 -0
  444. data/sample/demos-en/search.rb +188 -0
  445. data/sample/demos-en/spin.rb +66 -0
  446. data/sample/demos-en/square +81 -0
  447. data/sample/demos-en/states.rb +81 -0
  448. data/sample/demos-en/style.rb +232 -0
  449. data/sample/demos-en/tcolor +526 -0
  450. data/sample/demos-en/text.rb +129 -0
  451. data/sample/demos-en/textpeer.rb +77 -0
  452. data/sample/demos-en/timer +136 -0
  453. data/sample/demos-en/tkencoding.rb +43 -0
  454. data/sample/demos-en/toolbar.rb +131 -0
  455. data/sample/demos-en/tree.rb +120 -0
  456. data/sample/demos-en/ttkbut.rb +140 -0
  457. data/sample/demos-en/ttkmenu.rb +86 -0
  458. data/sample/demos-en/ttknote.rb +90 -0
  459. data/sample/demos-en/ttkpane.rb +214 -0
  460. data/sample/demos-en/ttkprogress.rb +67 -0
  461. data/sample/demos-en/twind.rb +292 -0
  462. data/sample/demos-en/twind2.rb +385 -0
  463. data/sample/demos-en/unicodeout.rb +115 -0
  464. data/sample/demos-en/vscale.rb +80 -0
  465. data/sample/demos-en/widget +1087 -0
  466. data/sample/demos-jp/README +54 -0
  467. data/sample/demos-jp/README.1st +20 -0
  468. data/sample/demos-jp/anilabel.rb +178 -0
  469. data/sample/demos-jp/aniwave.rb +121 -0
  470. data/sample/demos-jp/arrow.rb +248 -0
  471. data/sample/demos-jp/bind.rb +126 -0
  472. data/sample/demos-jp/bitmap.rb +75 -0
  473. data/sample/demos-jp/browse1 +63 -0
  474. data/sample/demos-jp/browse2 +82 -0
  475. data/sample/demos-jp/button.rb +84 -0
  476. data/sample/demos-jp/check.rb +71 -0
  477. data/sample/demos-jp/check2.rb +111 -0
  478. data/sample/demos-jp/clrpick.rb +85 -0
  479. data/sample/demos-jp/colors.rb +156 -0
  480. data/sample/demos-jp/combo.rb +99 -0
  481. data/sample/demos-jp/cscroll.rb +135 -0
  482. data/sample/demos-jp/ctext.rb +205 -0
  483. data/sample/demos-jp/dialog1.rb +40 -0
  484. data/sample/demos-jp/dialog2.rb +44 -0
  485. data/sample/demos-jp/doc.org/README +7 -0
  486. data/sample/demos-jp/doc.org/README.JP +14 -0
  487. data/sample/demos-jp/doc.org/README.tk80 +46 -0
  488. data/sample/demos-jp/doc.org/license.terms +39 -0
  489. data/sample/demos-jp/doc.org/license.terms.tk80 +39 -0
  490. data/sample/demos-jp/entry1.rb +61 -0
  491. data/sample/demos-jp/entry2.rb +92 -0
  492. data/sample/demos-jp/entry3.rb +226 -0
  493. data/sample/demos-jp/filebox.rb +103 -0
  494. data/sample/demos-jp/floor.rb +1722 -0
  495. data/sample/demos-jp/floor2.rb +1720 -0
  496. data/sample/demos-jp/form.rb +67 -0
  497. data/sample/demos-jp/goldberg.rb +2012 -0
  498. data/sample/demos-jp/hello +10 -0
  499. data/sample/demos-jp/hscale.rb +79 -0
  500. data/sample/demos-jp/icon.rb +104 -0
  501. data/sample/demos-jp/image1.rb +65 -0
  502. data/sample/demos-jp/image2.rb +107 -0
  503. data/sample/demos-jp/image3.rb +128 -0
  504. data/sample/demos-jp/items.rb +380 -0
  505. data/sample/demos-jp/ixset +333 -0
  506. data/sample/demos-jp/ixset2 +369 -0
  507. data/sample/demos-jp/knightstour.rb +274 -0
  508. data/sample/demos-jp/label.rb +70 -0
  509. data/sample/demos-jp/labelframe.rb +103 -0
  510. data/sample/demos-jp/mclist.rb +122 -0
  511. data/sample/demos-jp/menu.rb +202 -0
  512. data/sample/demos-jp/menu84.rb +214 -0
  513. data/sample/demos-jp/menu8x.rb +234 -0
  514. data/sample/demos-jp/menubu.rb +239 -0
  515. data/sample/demos-jp/msgbox.rb +90 -0
  516. data/sample/demos-jp/msgbox2.rb +91 -0
  517. data/sample/demos-jp/paned1.rb +53 -0
  518. data/sample/demos-jp/paned2.rb +101 -0
  519. data/sample/demos-jp/pendulum.rb +243 -0
  520. data/sample/demos-jp/plot.rb +127 -0
  521. data/sample/demos-jp/puzzle.rb +132 -0
  522. data/sample/demos-jp/radio.rb +85 -0
  523. data/sample/demos-jp/radio2.rb +113 -0
  524. data/sample/demos-jp/radio3.rb +120 -0
  525. data/sample/demos-jp/rmt +268 -0
  526. data/sample/demos-jp/rolodex +320 -0
  527. data/sample/demos-jp/rolodex-j +300 -0
  528. data/sample/demos-jp/ruler.rb +204 -0
  529. data/sample/demos-jp/sayings.rb +104 -0
  530. data/sample/demos-jp/search.rb +185 -0
  531. data/sample/demos-jp/spin.rb +72 -0
  532. data/sample/demos-jp/square +81 -0
  533. data/sample/demos-jp/states.rb +75 -0
  534. data/sample/demos-jp/style.rb +271 -0
  535. data/sample/demos-jp/tcolor +534 -0
  536. data/sample/demos-jp/text.rb +121 -0
  537. data/sample/demos-jp/textpeer.rb +83 -0
  538. data/sample/demos-jp/timer +136 -0
  539. data/sample/demos-jp/toolbar.rb +137 -0
  540. data/sample/demos-jp/tree.rb +121 -0
  541. data/sample/demos-jp/ttkbut.rb +146 -0
  542. data/sample/demos-jp/ttkmenu.rb +92 -0
  543. data/sample/demos-jp/ttknote.rb +98 -0
  544. data/sample/demos-jp/ttkpane.rb +217 -0
  545. data/sample/demos-jp/ttkprogress.rb +72 -0
  546. data/sample/demos-jp/twind.rb +293 -0
  547. data/sample/demos-jp/twind2.rb +385 -0
  548. data/sample/demos-jp/unicodeout.rb +120 -0
  549. data/sample/demos-jp/vscale.rb +81 -0
  550. data/sample/demos-jp/widget +1122 -0
  551. data/sample/editable_listbox.rb +149 -0
  552. data/sample/encstr_usage.rb +31 -0
  553. data/sample/figmemo_sample.rb +457 -0
  554. data/sample/images/earth.gif +0 -0
  555. data/sample/images/earthris.gif +0 -0
  556. data/sample/images/face.xbm +173 -0
  557. data/sample/images/flagdown.xbm +27 -0
  558. data/sample/images/flagup.xbm +27 -0
  559. data/sample/images/gray25.xbm +6 -0
  560. data/sample/images/grey.25 +6 -0
  561. data/sample/images/grey.5 +6 -0
  562. data/sample/images/letters.xbm +27 -0
  563. data/sample/images/noletter.xbm +27 -0
  564. data/sample/images/pattern.xbm +6 -0
  565. data/sample/images/tcllogo.gif +0 -0
  566. data/sample/images/teapot.ppm +31 -0
  567. data/sample/irbtk.rb +31 -0
  568. data/sample/irbtkw.rbw +156 -0
  569. data/sample/iso2022-kr.txt +2 -0
  570. data/sample/menubar1.rb +52 -0
  571. data/sample/menubar2.rb +57 -0
  572. data/sample/menubar3.rb +73 -0
  573. data/sample/msgs_rb/README +3 -0
  574. data/sample/msgs_rb/cs.msg +84 -0
  575. data/sample/msgs_rb/de.msg +88 -0
  576. data/sample/msgs_rb/el.msg +98 -0
  577. data/sample/msgs_rb/en.msg +83 -0
  578. data/sample/msgs_rb/en_gb.msg +7 -0
  579. data/sample/msgs_rb/eo.msg +87 -0
  580. data/sample/msgs_rb/es.msg +84 -0
  581. data/sample/msgs_rb/fr.msg +84 -0
  582. data/sample/msgs_rb/it.msg +84 -0
  583. data/sample/msgs_rb/ja.msg +13 -0
  584. data/sample/msgs_rb/nl.msg +123 -0
  585. data/sample/msgs_rb/pl.msg +87 -0
  586. data/sample/msgs_rb/ru.msg +87 -0
  587. data/sample/msgs_rb2/README +5 -0
  588. data/sample/msgs_rb2/de.msg +88 -0
  589. data/sample/msgs_rb2/ja.msg +85 -0
  590. data/sample/msgs_tk/README +4 -0
  591. data/sample/msgs_tk/cs.msg +84 -0
  592. data/sample/msgs_tk/de.msg +88 -0
  593. data/sample/msgs_tk/el.msg +103 -0
  594. data/sample/msgs_tk/en.msg +83 -0
  595. data/sample/msgs_tk/en_gb.msg +7 -0
  596. data/sample/msgs_tk/eo.msg +87 -0
  597. data/sample/msgs_tk/es.msg +84 -0
  598. data/sample/msgs_tk/fr.msg +84 -0
  599. data/sample/msgs_tk/it.msg +84 -0
  600. data/sample/msgs_tk/ja.msg +13 -0
  601. data/sample/msgs_tk/license.terms +39 -0
  602. data/sample/msgs_tk/nl.msg +123 -0
  603. data/sample/msgs_tk/pl.msg +87 -0
  604. data/sample/msgs_tk/ru.msg +87 -0
  605. data/sample/multi-ip_sample.rb +104 -0
  606. data/sample/multi-ip_sample2.rb +30 -0
  607. data/sample/optobj_sample.rb +68 -0
  608. data/sample/propagate.rb +31 -0
  609. data/sample/remote-ip_sample.rb +34 -0
  610. data/sample/remote-ip_sample2.rb +57 -0
  611. data/sample/resource.en +13 -0
  612. data/sample/resource.ja +13 -0
  613. data/sample/safe-tk.rb +132 -0
  614. data/sample/scrollframe.rb +250 -0
  615. data/sample/tcltklib/batsu.gif +0 -0
  616. data/sample/tcltklib/lines0.tcl +42 -0
  617. data/sample/tcltklib/lines1.rb +51 -0
  618. data/sample/tcltklib/lines2.rb +55 -0
  619. data/sample/tcltklib/lines3.rb +55 -0
  620. data/sample/tcltklib/lines4.rb +55 -0
  621. data/sample/tcltklib/maru.gif +0 -0
  622. data/sample/tcltklib/safeTk.rb +23 -0
  623. data/sample/tcltklib/sample0.rb +40 -0
  624. data/sample/tcltklib/sample1.rb +635 -0
  625. data/sample/tcltklib/sample2.rb +452 -0
  626. data/sample/tkalignbox.rb +236 -0
  627. data/sample/tkballoonhelp.rb +221 -0
  628. data/sample/tkbiff.rb +156 -0
  629. data/sample/tkbrowse.rb +80 -0
  630. data/sample/tkcombobox.rb +498 -0
  631. data/sample/tkdialog.rb +62 -0
  632. data/sample/tkextlib/ICONS/Orig_LICENSE.txt +61 -0
  633. data/sample/tkextlib/ICONS/tkIcons +195 -0
  634. data/sample/tkextlib/ICONS/tkIcons-sample.kde +658 -0
  635. data/sample/tkextlib/ICONS/tkIcons.kde +195 -0
  636. data/sample/tkextlib/ICONS/viewIcons.rb +330 -0
  637. data/sample/tkextlib/blt/barchart5.rb +102 -0
  638. data/sample/tkextlib/blt/calendar.rb +118 -0
  639. data/sample/tkextlib/blt/graph6.rb +2223 -0
  640. data/sample/tkextlib/blt/graph7.rb +41 -0
  641. data/sample/tkextlib/blt/graph7a.rb +64 -0
  642. data/sample/tkextlib/blt/graph7b.rb +42 -0
  643. data/sample/tkextlib/blt/graph7c.rb +46 -0
  644. data/sample/tkextlib/blt/images/buckskin.gif +0 -0
  645. data/sample/tkextlib/blt/images/chalk.gif +0 -0
  646. data/sample/tkextlib/blt/images/qv100.t.gif +0 -0
  647. data/sample/tkextlib/blt/images/rain.gif +0 -0
  648. data/sample/tkextlib/blt/images/sample.gif +0 -0
  649. data/sample/tkextlib/blt/pareto.rb +91 -0
  650. data/sample/tkextlib/blt/plot1.rb +10 -0
  651. data/sample/tkextlib/blt/plot1b.rb +11 -0
  652. data/sample/tkextlib/blt/readme.txt +2 -0
  653. data/sample/tkextlib/blt/scripts/stipples.rb +157 -0
  654. data/sample/tkextlib/blt/winop1.rb +41 -0
  655. data/sample/tkextlib/blt/winop2.rb +29 -0
  656. data/sample/tkextlib/bwidget/Orig_LICENSE.txt +53 -0
  657. data/sample/tkextlib/bwidget/basic.rb +199 -0
  658. data/sample/tkextlib/bwidget/bwidget.xbm +46 -0
  659. data/sample/tkextlib/bwidget/demo.rb +244 -0
  660. data/sample/tkextlib/bwidget/dnd.rb +47 -0
  661. data/sample/tkextlib/bwidget/manager.rb +151 -0
  662. data/sample/tkextlib/bwidget/select.rb +83 -0
  663. data/sample/tkextlib/bwidget/tmpldlg.rb +222 -0
  664. data/sample/tkextlib/bwidget/tree.rb +290 -0
  665. data/sample/tkextlib/bwidget/x1.xbm +2258 -0
  666. data/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt +42 -0
  667. data/sample/tkextlib/iwidgets/catalog_demo/images/box.xbm +14 -0
  668. data/sample/tkextlib/iwidgets/catalog_demo/images/clear.gif +0 -0
  669. data/sample/tkextlib/iwidgets/catalog_demo/images/close.gif +0 -0
  670. data/sample/tkextlib/iwidgets/catalog_demo/images/copy.gif +0 -0
  671. data/sample/tkextlib/iwidgets/catalog_demo/images/cut.gif +0 -0
  672. data/sample/tkextlib/iwidgets/catalog_demo/images/exit.gif +0 -0
  673. data/sample/tkextlib/iwidgets/catalog_demo/images/find.gif +0 -0
  674. data/sample/tkextlib/iwidgets/catalog_demo/images/help.gif +0 -0
  675. data/sample/tkextlib/iwidgets/catalog_demo/images/line.xbm +14 -0
  676. data/sample/tkextlib/iwidgets/catalog_demo/images/mag.gif +0 -0
  677. data/sample/tkextlib/iwidgets/catalog_demo/images/new.gif +0 -0
  678. data/sample/tkextlib/iwidgets/catalog_demo/images/open.gif +0 -0
  679. data/sample/tkextlib/iwidgets/catalog_demo/images/oval.xbm +14 -0
  680. data/sample/tkextlib/iwidgets/catalog_demo/images/paste.gif +0 -0
  681. data/sample/tkextlib/iwidgets/catalog_demo/images/points.xbm +14 -0
  682. data/sample/tkextlib/iwidgets/catalog_demo/images/poly.gif +0 -0
  683. data/sample/tkextlib/iwidgets/catalog_demo/images/print.gif +0 -0
  684. data/sample/tkextlib/iwidgets/catalog_demo/images/ruler.gif +0 -0
  685. data/sample/tkextlib/iwidgets/catalog_demo/images/save.gif +0 -0
  686. data/sample/tkextlib/iwidgets/catalog_demo/images/select.gif +0 -0
  687. data/sample/tkextlib/iwidgets/catalog_demo/images/text.xbm +14 -0
  688. data/sample/tkextlib/iwidgets/sample/buttonbox.rb +23 -0
  689. data/sample/tkextlib/iwidgets/sample/calendar.rb +11 -0
  690. data/sample/tkextlib/iwidgets/sample/canvasprintbox.rb +9 -0
  691. data/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb +9 -0
  692. data/sample/tkextlib/iwidgets/sample/checkbox.rb +13 -0
  693. data/sample/tkextlib/iwidgets/sample/combobox.rb +33 -0
  694. data/sample/tkextlib/iwidgets/sample/dateentry.rb +8 -0
  695. data/sample/tkextlib/iwidgets/sample/datefield.rb +9 -0
  696. data/sample/tkextlib/iwidgets/sample/dialog.rb +21 -0
  697. data/sample/tkextlib/iwidgets/sample/dialogshell.rb +15 -0
  698. data/sample/tkextlib/iwidgets/sample/disjointlistbox.rb +17 -0
  699. data/sample/tkextlib/iwidgets/sample/entryfield-1.rb +40 -0
  700. data/sample/tkextlib/iwidgets/sample/entryfield-2.rb +45 -0
  701. data/sample/tkextlib/iwidgets/sample/entryfield-3.rb +41 -0
  702. data/sample/tkextlib/iwidgets/sample/extbutton.rb +21 -0
  703. data/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb +9 -0
  704. data/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb +30 -0
  705. data/sample/tkextlib/iwidgets/sample/feedback.rb +11 -0
  706. data/sample/tkextlib/iwidgets/sample/fileselectionbox.rb +9 -0
  707. data/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb +29 -0
  708. data/sample/tkextlib/iwidgets/sample/finddialog.rb +16 -0
  709. data/sample/tkextlib/iwidgets/sample/hierarchy.rb +26 -0
  710. data/sample/tkextlib/iwidgets/sample/hyperhelp.rb +15 -0
  711. data/sample/tkextlib/iwidgets/sample/labeledframe.rb +15 -0
  712. data/sample/tkextlib/iwidgets/sample/labeledwidget.rb +14 -0
  713. data/sample/tkextlib/iwidgets/sample/mainwindow.rb +65 -0
  714. data/sample/tkextlib/iwidgets/sample/menubar.rb +125 -0
  715. data/sample/tkextlib/iwidgets/sample/menubar2.rb +45 -0
  716. data/sample/tkextlib/iwidgets/sample/messagebox1.rb +20 -0
  717. data/sample/tkextlib/iwidgets/sample/messagebox2.rb +20 -0
  718. data/sample/tkextlib/iwidgets/sample/messagedialog.rb +45 -0
  719. data/sample/tkextlib/iwidgets/sample/notebook.rb +31 -0
  720. data/sample/tkextlib/iwidgets/sample/notebook2.rb +31 -0
  721. data/sample/tkextlib/iwidgets/sample/optionmenu.rb +15 -0
  722. data/sample/tkextlib/iwidgets/sample/panedwindow.rb +23 -0
  723. data/sample/tkextlib/iwidgets/sample/panedwindow2.rb +23 -0
  724. data/sample/tkextlib/iwidgets/sample/promptdialog.rb +18 -0
  725. data/sample/tkextlib/iwidgets/sample/pushbutton.rb +10 -0
  726. data/sample/tkextlib/iwidgets/sample/radiobox.rb +14 -0
  727. data/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb +14 -0
  728. data/sample/tkextlib/iwidgets/sample/scrolledframe.rb +19 -0
  729. data/sample/tkextlib/iwidgets/sample/scrolledhtml.rb +16 -0
  730. data/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb +23 -0
  731. data/sample/tkextlib/iwidgets/sample/scrolledtext.rb +12 -0
  732. data/sample/tkextlib/iwidgets/sample/selectionbox.rb +20 -0
  733. data/sample/tkextlib/iwidgets/sample/selectiondialog.rb +13 -0
  734. data/sample/tkextlib/iwidgets/sample/shell.rb +18 -0
  735. data/sample/tkextlib/iwidgets/sample/spindate.rb +8 -0
  736. data/sample/tkextlib/iwidgets/sample/spinint.rb +11 -0
  737. data/sample/tkextlib/iwidgets/sample/spinner.rb +34 -0
  738. data/sample/tkextlib/iwidgets/sample/spintime.rb +8 -0
  739. data/sample/tkextlib/iwidgets/sample/tabnotebook.rb +27 -0
  740. data/sample/tkextlib/iwidgets/sample/tabnotebook2.rb +31 -0
  741. data/sample/tkextlib/iwidgets/sample/tabset.rb +35 -0
  742. data/sample/tkextlib/iwidgets/sample/timeentry.rb +8 -0
  743. data/sample/tkextlib/iwidgets/sample/timefield.rb +9 -0
  744. data/sample/tkextlib/iwidgets/sample/toolbar.rb +153 -0
  745. data/sample/tkextlib/iwidgets/sample/watch.rb +19 -0
  746. data/sample/tkextlib/tcllib/Orig_LICENSE.txt +46 -0
  747. data/sample/tkextlib/tcllib/datefield.rb +30 -0
  748. data/sample/tkextlib/tcllib/plotdemos1.rb +159 -0
  749. data/sample/tkextlib/tcllib/plotdemos2.rb +72 -0
  750. data/sample/tkextlib/tcllib/plotdemos3.rb +84 -0
  751. data/sample/tkextlib/tcllib/xyplot.rb +18 -0
  752. data/sample/tkextlib/tile/Orig_LICENSE.txt +30 -0
  753. data/sample/tkextlib/tile/demo.rb +984 -0
  754. data/sample/tkextlib/tile/iconlib.tcl +110 -0
  755. data/sample/tkextlib/tile/readme.txt +2 -0
  756. data/sample/tkextlib/tile/repeater.tcl +117 -0
  757. data/sample/tkextlib/tile/themes/blue/blue.tcl +149 -0
  758. data/sample/tkextlib/tile/themes/blue/blue/arrowdown-h.gif +0 -0
  759. data/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gif +0 -0
  760. data/sample/tkextlib/tile/themes/blue/blue/arrowdown.gif +0 -0
  761. data/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gif +0 -0
  762. data/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gif +0 -0
  763. data/sample/tkextlib/tile/themes/blue/blue/arrowleft.gif +0 -0
  764. data/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gif +0 -0
  765. data/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gif +0 -0
  766. data/sample/tkextlib/tile/themes/blue/blue/arrowright.gif +0 -0
  767. data/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gif +0 -0
  768. data/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gif +0 -0
  769. data/sample/tkextlib/tile/themes/blue/blue/arrowup.gif +0 -0
  770. data/sample/tkextlib/tile/themes/blue/blue/button-h.gif +0 -0
  771. data/sample/tkextlib/tile/themes/blue/blue/button-n.gif +0 -0
  772. data/sample/tkextlib/tile/themes/blue/blue/button-n.xcf +0 -0
  773. data/sample/tkextlib/tile/themes/blue/blue/button-p.gif +0 -0
  774. data/sample/tkextlib/tile/themes/blue/blue/check-hc.gif +0 -0
  775. data/sample/tkextlib/tile/themes/blue/blue/check-hu.gif +0 -0
  776. data/sample/tkextlib/tile/themes/blue/blue/check-nc.gif +0 -0
  777. data/sample/tkextlib/tile/themes/blue/blue/check-nu.gif +0 -0
  778. data/sample/tkextlib/tile/themes/blue/blue/radio-hc.gif +0 -0
  779. data/sample/tkextlib/tile/themes/blue/blue/radio-hu.gif +0 -0
  780. data/sample/tkextlib/tile/themes/blue/blue/radio-nc.gif +0 -0
  781. data/sample/tkextlib/tile/themes/blue/blue/radio-nu.gif +0 -0
  782. data/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gif +0 -0
  783. data/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gif +0 -0
  784. data/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gif +0 -0
  785. data/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gif +0 -0
  786. data/sample/tkextlib/tile/themes/blue/blue/slider-p.gif +0 -0
  787. data/sample/tkextlib/tile/themes/blue/blue/slider.gif +0 -0
  788. data/sample/tkextlib/tile/themes/blue/blue/vslider-p.gif +0 -0
  789. data/sample/tkextlib/tile/themes/blue/blue/vslider.gif +0 -0
  790. data/sample/tkextlib/tile/themes/blue/pkgIndex.tcl +6 -0
  791. data/sample/tkextlib/tile/themes/keramik/keramik.tcl +194 -0
  792. data/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-n.gif +0 -0
  793. data/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gif +0 -0
  794. data/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gif +0 -0
  795. data/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gif +0 -0
  796. data/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gif +0 -0
  797. data/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gif +0 -0
  798. data/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gif +0 -0
  799. data/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gif +0 -0
  800. data/sample/tkextlib/tile/themes/keramik/keramik/button-d.gif +0 -0
  801. data/sample/tkextlib/tile/themes/keramik/keramik/button-h.gif +0 -0
  802. data/sample/tkextlib/tile/themes/keramik/keramik/button-n.gif +0 -0
  803. data/sample/tkextlib/tile/themes/keramik/keramik/button-p.gif +0 -0
  804. data/sample/tkextlib/tile/themes/keramik/keramik/button-s.gif +0 -0
  805. data/sample/tkextlib/tile/themes/keramik/keramik/check-c.gif +0 -0
  806. data/sample/tkextlib/tile/themes/keramik/keramik/check-u.gif +0 -0
  807. data/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gif +0 -0
  808. data/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gif +0 -0
  809. data/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gif +0 -0
  810. data/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gif +0 -0
  811. data/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gif +0 -0
  812. data/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gif +0 -0
  813. data/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gif +0 -0
  814. data/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gif +0 -0
  815. data/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gif +0 -0
  816. data/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gif +0 -0
  817. data/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gif +0 -0
  818. data/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gif +0 -0
  819. data/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gif +0 -0
  820. data/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gif +0 -0
  821. data/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gif +0 -0
  822. data/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gif +0 -0
  823. data/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gif +0 -0
  824. data/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl +15 -0
  825. data/sample/tkextlib/tile/themes/kroc.rb +227 -0
  826. data/sample/tkextlib/tile/themes/kroc/kroc.tcl +163 -0
  827. data/sample/tkextlib/tile/themes/kroc/kroc/button-h.gif +0 -0
  828. data/sample/tkextlib/tile/themes/kroc/kroc/button-n.gif +0 -0
  829. data/sample/tkextlib/tile/themes/kroc/kroc/button-p.gif +0 -0
  830. data/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gif +0 -0
  831. data/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gif +0 -0
  832. data/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gif +0 -0
  833. data/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gif +0 -0
  834. data/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gif +0 -0
  835. data/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gif +0 -0
  836. data/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gif +0 -0
  837. data/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gif +0 -0
  838. data/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl +15 -0
  839. data/sample/tkextlib/tile/themes/plastik/pkgIndex.tcl +16 -0
  840. data/sample/tkextlib/tile/themes/plastik/plastik.tcl +125 -0
  841. data/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-n.gif +0 -0
  842. data/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gif +0 -0
  843. data/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gif +0 -0
  844. data/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gif +0 -0
  845. data/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gif +0 -0
  846. data/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gif +0 -0
  847. data/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gif +0 -0
  848. data/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gif +0 -0
  849. data/sample/tkextlib/tile/themes/plastik/plastik/button-h.gif +0 -0
  850. data/sample/tkextlib/tile/themes/plastik/plastik/button-n.gif +0 -0
  851. data/sample/tkextlib/tile/themes/plastik/plastik/button-p.gif +0 -0
  852. data/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gif +0 -0
  853. data/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gif +0 -0
  854. data/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gif +0 -0
  855. data/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gif +0 -0
  856. data/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gif +0 -0
  857. data/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gif +0 -0
  858. data/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gif +0 -0
  859. data/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gif +0 -0
  860. data/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gif +0 -0
  861. data/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gif +0 -0
  862. data/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gif +0 -0
  863. data/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gif +0 -0
  864. data/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gif +0 -0
  865. data/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gif +0 -0
  866. data/sample/tkextlib/tile/toolbutton.tcl +152 -0
  867. data/sample/tkextlib/tkHTML/Orig_COPYRIGHT.txt +12 -0
  868. data/sample/tkextlib/tkHTML/README +12 -0
  869. data/sample/tkextlib/tkHTML/hv.rb +314 -0
  870. data/sample/tkextlib/tkHTML/page1/image1 +0 -0
  871. data/sample/tkextlib/tkHTML/page1/image10 +0 -0
  872. data/sample/tkextlib/tkHTML/page1/image11 +0 -0
  873. data/sample/tkextlib/tkHTML/page1/image12 +0 -0
  874. data/sample/tkextlib/tkHTML/page1/image13 +0 -0
  875. data/sample/tkextlib/tkHTML/page1/image14 +0 -0
  876. data/sample/tkextlib/tkHTML/page1/image2 +0 -0
  877. data/sample/tkextlib/tkHTML/page1/image3 +0 -0
  878. data/sample/tkextlib/tkHTML/page1/image4 +0 -0
  879. data/sample/tkextlib/tkHTML/page1/image5 +0 -0
  880. data/sample/tkextlib/tkHTML/page1/image6 +0 -0
  881. data/sample/tkextlib/tkHTML/page1/image7 +0 -0
  882. data/sample/tkextlib/tkHTML/page1/image8 +0 -0
  883. data/sample/tkextlib/tkHTML/page1/image9 +0 -0
  884. data/sample/tkextlib/tkHTML/page1/index.html +115 -0
  885. data/sample/tkextlib/tkHTML/page2/image1 +0 -0
  886. data/sample/tkextlib/tkHTML/page2/image10 +0 -0
  887. data/sample/tkextlib/tkHTML/page2/image11 +0 -0
  888. data/sample/tkextlib/tkHTML/page2/image12 +0 -0
  889. data/sample/tkextlib/tkHTML/page2/image13 +0 -0
  890. data/sample/tkextlib/tkHTML/page2/image14 +0 -0
  891. data/sample/tkextlib/tkHTML/page2/image15 +0 -0
  892. data/sample/tkextlib/tkHTML/page2/image16 +0 -0
  893. data/sample/tkextlib/tkHTML/page2/image17 +0 -0
  894. data/sample/tkextlib/tkHTML/page2/image18 +0 -0
  895. data/sample/tkextlib/tkHTML/page2/image19 +0 -0
  896. data/sample/tkextlib/tkHTML/page2/image2 +0 -0
  897. data/sample/tkextlib/tkHTML/page2/image20 +0 -0
  898. data/sample/tkextlib/tkHTML/page2/image21 +0 -0
  899. data/sample/tkextlib/tkHTML/page2/image22 +0 -0
  900. data/sample/tkextlib/tkHTML/page2/image23 +0 -0
  901. data/sample/tkextlib/tkHTML/page2/image24 +0 -0
  902. data/sample/tkextlib/tkHTML/page2/image25 +0 -0
  903. data/sample/tkextlib/tkHTML/page2/image26 +0 -0
  904. data/sample/tkextlib/tkHTML/page2/image27 +0 -0
  905. data/sample/tkextlib/tkHTML/page2/image28 +0 -0
  906. data/sample/tkextlib/tkHTML/page2/image29 +0 -0
  907. data/sample/tkextlib/tkHTML/page2/image3 +0 -0
  908. data/sample/tkextlib/tkHTML/page2/image30 +0 -0
  909. data/sample/tkextlib/tkHTML/page2/image31 +0 -0
  910. data/sample/tkextlib/tkHTML/page2/image32 +0 -0
  911. data/sample/tkextlib/tkHTML/page2/image33 +0 -0
  912. data/sample/tkextlib/tkHTML/page2/image34 +0 -0
  913. data/sample/tkextlib/tkHTML/page2/image35 +0 -0
  914. data/sample/tkextlib/tkHTML/page2/image36 +0 -0
  915. data/sample/tkextlib/tkHTML/page2/image37 +0 -0
  916. data/sample/tkextlib/tkHTML/page2/image38 +0 -0
  917. data/sample/tkextlib/tkHTML/page2/image39 +0 -0
  918. data/sample/tkextlib/tkHTML/page2/image4 +0 -0
  919. data/sample/tkextlib/tkHTML/page2/image5 +0 -0
  920. data/sample/tkextlib/tkHTML/page2/image6 +0 -0
  921. data/sample/tkextlib/tkHTML/page2/image7 +0 -0
  922. data/sample/tkextlib/tkHTML/page2/image8 +0 -0
  923. data/sample/tkextlib/tkHTML/page2/image9 +0 -0
  924. data/sample/tkextlib/tkHTML/page2/index.html +433 -0
  925. data/sample/tkextlib/tkHTML/page3/image1 +0 -0
  926. data/sample/tkextlib/tkHTML/page3/image10 +0 -0
  927. data/sample/tkextlib/tkHTML/page3/image11 +0 -0
  928. data/sample/tkextlib/tkHTML/page3/image12 +0 -0
  929. data/sample/tkextlib/tkHTML/page3/image13 +0 -0
  930. data/sample/tkextlib/tkHTML/page3/image14 +0 -0
  931. data/sample/tkextlib/tkHTML/page3/image2 +0 -0
  932. data/sample/tkextlib/tkHTML/page3/image3 +0 -0
  933. data/sample/tkextlib/tkHTML/page3/image4 +0 -0
  934. data/sample/tkextlib/tkHTML/page3/image5 +0 -0
  935. data/sample/tkextlib/tkHTML/page3/image6 +0 -0
  936. data/sample/tkextlib/tkHTML/page3/image7 +0 -0
  937. data/sample/tkextlib/tkHTML/page3/image8 +0 -0
  938. data/sample/tkextlib/tkHTML/page3/image9 +0 -0
  939. data/sample/tkextlib/tkHTML/page3/index.html +2787 -0
  940. data/sample/tkextlib/tkHTML/page4/image1 +0 -0
  941. data/sample/tkextlib/tkHTML/page4/image2 +0 -0
  942. data/sample/tkextlib/tkHTML/page4/image3 +0 -0
  943. data/sample/tkextlib/tkHTML/page4/image4 +0 -0
  944. data/sample/tkextlib/tkHTML/page4/image5 +0 -0
  945. data/sample/tkextlib/tkHTML/page4/image6 +0 -0
  946. data/sample/tkextlib/tkHTML/page4/image7 +0 -0
  947. data/sample/tkextlib/tkHTML/page4/image8 +0 -0
  948. data/sample/tkextlib/tkHTML/page4/image9 +0 -0
  949. data/sample/tkextlib/tkHTML/page4/index.html +768 -0
  950. data/sample/tkextlib/tkHTML/ss.rb +437 -0
  951. data/sample/tkextlib/tkimg/demo.rb +1479 -0
  952. data/sample/tkextlib/tkimg/license_terms_of_Img_extension +41 -0
  953. data/sample/tkextlib/tkimg/readme.txt +3 -0
  954. data/sample/tkextlib/tktable/Orig_LICENSE.txt +52 -0
  955. data/sample/tkextlib/tktable/basic.rb +61 -0
  956. data/sample/tkextlib/tktable/buttons.rb +77 -0
  957. data/sample/tkextlib/tktable/command.rb +90 -0
  958. data/sample/tkextlib/tktable/debug.rb +102 -0
  959. data/sample/tkextlib/tktable/dynarows.rb +100 -0
  960. data/sample/tkextlib/tktable/maxsize.rb +68 -0
  961. data/sample/tkextlib/tktable/spreadsheet.rb +138 -0
  962. data/sample/tkextlib/tktable/tcllogo.gif +0 -0
  963. data/sample/tkextlib/tktable/valid.rb +89 -0
  964. data/sample/tkextlib/treectrl/bitmaps.rb +77 -0
  965. data/sample/tkextlib/treectrl/demo.rb +1306 -0
  966. data/sample/tkextlib/treectrl/explorer.rb +431 -0
  967. data/sample/tkextlib/treectrl/help.rb +405 -0
  968. data/sample/tkextlib/treectrl/imovie.rb +131 -0
  969. data/sample/tkextlib/treectrl/layout.rb +160 -0
  970. data/sample/tkextlib/treectrl/mailwasher.rb +270 -0
  971. data/sample/tkextlib/treectrl/outlook-folders.rb +125 -0
  972. data/sample/tkextlib/treectrl/outlook-newgroup.rb +449 -0
  973. data/sample/tkextlib/treectrl/pics/big-dll.gif +0 -0
  974. data/sample/tkextlib/treectrl/pics/big-exe.gif +0 -0
  975. data/sample/tkextlib/treectrl/pics/big-file.gif +0 -0
  976. data/sample/tkextlib/treectrl/pics/big-folder.gif +0 -0
  977. data/sample/tkextlib/treectrl/pics/big-txt.gif +0 -0
  978. data/sample/tkextlib/treectrl/pics/checked.gif +0 -0
  979. data/sample/tkextlib/treectrl/pics/file.gif +0 -0
  980. data/sample/tkextlib/treectrl/pics/folder-closed.gif +0 -0
  981. data/sample/tkextlib/treectrl/pics/folder-open.gif +0 -0
  982. data/sample/tkextlib/treectrl/pics/help-book-closed.gif +0 -0
  983. data/sample/tkextlib/treectrl/pics/help-book-open.gif +0 -0
  984. data/sample/tkextlib/treectrl/pics/help-page.gif +0 -0
  985. data/sample/tkextlib/treectrl/pics/imovie-01.gif +0 -0
  986. data/sample/tkextlib/treectrl/pics/imovie-02.gif +0 -0
  987. data/sample/tkextlib/treectrl/pics/imovie-03.gif +0 -0
  988. data/sample/tkextlib/treectrl/pics/imovie-04.gif +0 -0
  989. data/sample/tkextlib/treectrl/pics/imovie-05.gif +0 -0
  990. data/sample/tkextlib/treectrl/pics/imovie-06.gif +0 -0
  991. data/sample/tkextlib/treectrl/pics/imovie-07.gif +0 -0
  992. data/sample/tkextlib/treectrl/pics/internet-check-off.gif +0 -0
  993. data/sample/tkextlib/treectrl/pics/internet-check-on.gif +0 -0
  994. data/sample/tkextlib/treectrl/pics/internet-print.gif +0 -0
  995. data/sample/tkextlib/treectrl/pics/internet-radio-off.gif +0 -0
  996. data/sample/tkextlib/treectrl/pics/internet-radio-on.gif +0 -0
  997. data/sample/tkextlib/treectrl/pics/internet-search.gif +0 -0
  998. data/sample/tkextlib/treectrl/pics/internet-security.gif +0 -0
  999. data/sample/tkextlib/treectrl/pics/mac-collapse.gif +0 -0
  1000. data/sample/tkextlib/treectrl/pics/mac-expand.gif +0 -0
  1001. data/sample/tkextlib/treectrl/pics/outlook-arrow.gif +0 -0
  1002. data/sample/tkextlib/treectrl/pics/outlook-clip.gif +0 -0
  1003. data/sample/tkextlib/treectrl/pics/outlook-deleted.gif +0 -0
  1004. data/sample/tkextlib/treectrl/pics/outlook-draft.gif +0 -0
  1005. data/sample/tkextlib/treectrl/pics/outlook-folder.gif +0 -0
  1006. data/sample/tkextlib/treectrl/pics/outlook-group.gif +0 -0
  1007. data/sample/tkextlib/treectrl/pics/outlook-inbox.gif +0 -0
  1008. data/sample/tkextlib/treectrl/pics/outlook-local.gif +0 -0
  1009. data/sample/tkextlib/treectrl/pics/outlook-main.gif +0 -0
  1010. data/sample/tkextlib/treectrl/pics/outlook-outbox.gif +0 -0
  1011. data/sample/tkextlib/treectrl/pics/outlook-read-2.gif +0 -0
  1012. data/sample/tkextlib/treectrl/pics/outlook-read.gif +0 -0
  1013. data/sample/tkextlib/treectrl/pics/outlook-sent.gif +0 -0
  1014. data/sample/tkextlib/treectrl/pics/outlook-server.gif +0 -0
  1015. data/sample/tkextlib/treectrl/pics/outlook-unread.gif +0 -0
  1016. data/sample/tkextlib/treectrl/pics/outlook-watch.gif +0 -0
  1017. data/sample/tkextlib/treectrl/pics/sky.gif +0 -0
  1018. data/sample/tkextlib/treectrl/pics/small-dll.gif +0 -0
  1019. data/sample/tkextlib/treectrl/pics/small-exe.gif +0 -0
  1020. data/sample/tkextlib/treectrl/pics/small-file.gif +0 -0
  1021. data/sample/tkextlib/treectrl/pics/small-folder.gif +0 -0
  1022. data/sample/tkextlib/treectrl/pics/small-txt.gif +0 -0
  1023. data/sample/tkextlib/treectrl/pics/unchecked.gif +0 -0
  1024. data/sample/tkextlib/treectrl/random.rb +509 -0
  1025. data/sample/tkextlib/treectrl/readme.txt +2 -0
  1026. data/sample/tkextlib/treectrl/www-options.rb +304 -0
  1027. data/sample/tkextlib/vu/Orig_LICENSE.txt +51 -0
  1028. data/sample/tkextlib/vu/README.txt +50 -0
  1029. data/sample/tkextlib/vu/canvItems.rb +91 -0
  1030. data/sample/tkextlib/vu/canvSticker.rb +83 -0
  1031. data/sample/tkextlib/vu/canvSticker2.rb +102 -0
  1032. data/sample/tkextlib/vu/dial_demo.rb +114 -0
  1033. data/sample/tkextlib/vu/m128_000.xbm +174 -0
  1034. data/sample/tkextlib/vu/oscilloscope.rb +69 -0
  1035. data/sample/tkextlib/vu/pie.rb +57 -0
  1036. data/sample/tkextlib/vu/vu_demo.rb +68 -0
  1037. data/sample/tkfrom.rb +133 -0
  1038. data/sample/tkhello.rb +11 -0
  1039. data/sample/tkline.rb +48 -0
  1040. data/sample/tkmenubutton.rb +136 -0
  1041. data/sample/tkmsgcat-load_rb.rb +103 -0
  1042. data/sample/tkmsgcat-load_rb2.rb +103 -0
  1043. data/sample/tkmsgcat-load_tk.rb +119 -0
  1044. data/sample/tkmulticolumnlist.rb +744 -0
  1045. data/sample/tkmultilistbox.rb +655 -0
  1046. data/sample/tkmultilistframe.rb +941 -0
  1047. data/sample/tkoptdb-safeTk.rb +74 -0
  1048. data/sample/tkoptdb.rb +107 -0
  1049. data/sample/tkrttimer.rb +78 -0
  1050. data/sample/tksleep_sample.rb +30 -0
  1051. data/sample/tktextframe.rb +282 -0
  1052. data/sample/tktextio.rb +1061 -0
  1053. data/sample/tktimer.rb +51 -0
  1054. data/sample/tktimer2.rb +48 -0
  1055. data/sample/tktimer3.rb +60 -0
  1056. data/sample/tktree.rb +104 -0
  1057. data/sample/tktree.tcl +305 -0
  1058. data/sample/ttk_wrapper.rb +155 -0
  1059. data/tk.gemspec +24 -0
  1060. metadata +1144 -0
@@ -0,0 +1,2352 @@
1
+ # frozen_string_literal: false
2
+ #
3
+ # tk/font.rb - the class to treat fonts on Ruby/Tk
4
+ #
5
+ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
6
+ #
7
+ require 'tk'
8
+
9
+ class TkFont
10
+ include Tk
11
+ extend TkCore
12
+
13
+ TkCommandNames = ['font'.freeze].freeze
14
+
15
+ (Tk_FontID = ["@font".freeze, TkUtil.untrust("00000")]).instance_eval{
16
+ @mutex = Mutex.new
17
+ def mutex; @mutex; end
18
+ freeze
19
+ }
20
+
21
+ Tk_FontNameTBL = TkCore::INTERP.create_table
22
+ Tk_FontUseTBL = TkCore::INTERP.create_table
23
+
24
+ TkCore::INTERP.init_ip_env{
25
+ Tk_FontNameTBL.mutex.synchronize{ Tk_FontNameTBL.clear }
26
+ Tk_FontUseTBL.mutex.synchronize{ Tk_FontUseTBL.clear }
27
+ }
28
+
29
+ # option_type : default => string
30
+ OptionType = Hash.new(?s)
31
+ OptionType['size'] = ?n
32
+ OptionType['pointadjust'] = ?n
33
+ OptionType['underline'] = ?b
34
+ OptionType['overstrike'] = ?b
35
+
36
+ # metric_type : default => num_or_str
37
+ MetricType = Hash.new(?n)
38
+ MetricType['fixed'] = ?b
39
+
40
+ # system font names
41
+ SYSTEM_FONT_NAMES = []
42
+ def SYSTEM_FONT_NAMES.add(font_names)
43
+ (@mutex ||= Mutex.new).synchronize{
44
+ self.replace(self | font_names.map{|name| name.to_s})
45
+ }
46
+ end
47
+ def SYSTEM_FONT_NAMES.include?(name)
48
+ (@mutex ||= Mutex.new).synchronize{
49
+ super(name.to_s)
50
+ }
51
+ end
52
+
53
+ # set default font
54
+ case Tk::TK_VERSION
55
+ when /^4\..*/
56
+ DEFAULT_LATIN_FONT_NAME = 'a14'.freeze
57
+ DEFAULT_KANJI_FONT_NAME = 'k14'.freeze
58
+
59
+ when /^8\.[0-4]/
60
+ if JAPANIZED_TK
61
+ begin
62
+ fontnames = tk_call('font', 'names')
63
+ case fontnames
64
+ when /defaultgui/
65
+ # Tcl/Tk-JP for Windows
66
+ ltn = 'defaultgui'
67
+ knj = 'defaultgui'
68
+ when /Mincho:Helvetica-Bold-12/
69
+ # Tcl/Tk-JP for UNIX/X
70
+ ltn, knj = tk_split_simplelist(tk_call('font', 'configure',
71
+ 'Mincho:Helvetica-Bold-12',
72
+ '-compound'))
73
+ else
74
+ # unknown Tcl/Tk-JP
75
+ #platform = tk_call('set', 'tcl_platform(platform)')
76
+ platform = Tk::PLATFORM['platform']
77
+ case platform
78
+ when 'unix'
79
+ ltn = {'family'=>'Helvetica'.freeze,
80
+ 'size'=>-12, 'weight'=>'bold'.freeze}
81
+ #knj = 'k14'
82
+ #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
83
+ knj = '-*-fixed-bold-r-normal--12-*-*-*-c-*-jisx0208.1983-0'
84
+ when 'windows'
85
+ ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
86
+ knj = 'mincho'
87
+ when 'macintosh'
88
+ ltn = 'system'
89
+ knj = 'mincho'
90
+ else # unknown
91
+ ltn = 'Helvetica'
92
+ knj = 'mincho'
93
+ end
94
+ end
95
+ rescue
96
+ ltn = 'Helvetica'
97
+ knj = 'mincho'
98
+ end
99
+
100
+ else # not JAPANIZED_TK
101
+ begin
102
+ #platform = tk_call('set', 'tcl_platform(platform)')
103
+ platform = Tk::PLATFORM['platform']
104
+ case platform
105
+ when 'unix'
106
+ ltn = {'family'=>'Helvetica'.freeze,
107
+ 'size'=>-12, 'weight'=>'bold'.freeze}
108
+ when 'windows'
109
+ ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
110
+ when 'macintosh'
111
+ ltn = 'system'
112
+ else # unknown
113
+ ltn = 'Helvetica'
114
+ end
115
+ rescue
116
+ ltn = 'Helvetica'
117
+ end
118
+
119
+ knj = ltn.dup
120
+ end
121
+
122
+ DEFAULT_LATIN_FONT_NAME = ltn.freeze
123
+ DEFAULT_KANJI_FONT_NAME = knj.freeze
124
+
125
+ when /^8\.[5-9]/, /^9\..*/
126
+ if tk_call('font', 'names') =~ /\bTkDefaultFont\b/
127
+ DEFAULT_LATIN_FONT_NAME = 'TkDefaultFont'.freeze
128
+ DEFAULT_KANJI_FONT_NAME = 'TkDefaultFont'.freeze
129
+ else
130
+ DEFAULT_LATIN_FONT_NAME = 'Helvetica'.freeze
131
+ DEFAULT_KANJI_FONT_NAME = 'mincho'.freeze
132
+ end
133
+
134
+ else # unknown version
135
+ DEFAULT_LATIN_FONT_NAME = 'Helvetica'.freeze
136
+ DEFAULT_KANJI_FONT_NAME = 'mincho'.freeze
137
+
138
+ end
139
+
140
+ if $DEBUG
141
+ print "default latin font = "; p DEFAULT_LATIN_FONT_NAME
142
+ print "default kanji font = "; p DEFAULT_KANJI_FONT_NAME
143
+ end
144
+
145
+
146
+ ###################################
147
+ class DescendantFont
148
+ def initialize(compound, type)
149
+ unless compound.kind_of?(TkFont)
150
+ fail ArgumentError, "a TkFont object is expected for the 1st argument"
151
+ end
152
+
153
+ @compound = compound
154
+ case type
155
+ when 'kanji', 'latin', 'ascii'
156
+ @type = type
157
+ when :kanji, :latin, :ascii
158
+ @type = type.to_s
159
+ else
160
+ fail ArgumentError, "unknown type '#{type}'"
161
+ end
162
+ end
163
+
164
+ def dup
165
+ fail RuntimeError, "cannot duplicate a descendant font"
166
+ end
167
+ def clone
168
+ fail RuntimeError, "cannot clone a descendant font"
169
+ end
170
+
171
+ def to_eval
172
+ @compound.__send__(@type + '_font_id')
173
+ end
174
+ def font
175
+ @compound.__send__(@type + '_font_id')
176
+ end
177
+ alias font_id font
178
+ alias name font
179
+ alias to_s font
180
+
181
+ def [](slot)
182
+ @compound.__send__(@type + '_configinfo', slot)
183
+ end
184
+ def []=(slot, value)
185
+ @compound.__send__(@type + '_configure', slot, value)
186
+ value
187
+ end
188
+
189
+ def method_missing(id, *args)
190
+ @compound.__send__(@type + '_' + id.id2name, *args)
191
+ end
192
+ end
193
+
194
+
195
+ ###################################
196
+ # class methods
197
+ ###################################
198
+ def TkFont.is_system_font?(fnt)
199
+ # true --> system font which is available on the current system
200
+ # false --> not system font (or unknown system font)
201
+ # nil --> system font name, but not available on the current system
202
+ fnt = fnt.to_s
203
+ SYSTEM_FONT_NAMES.include?(fnt) && self.names.index(fnt) && true
204
+ end
205
+
206
+ def TkFont.actual(fnt, option=nil)
207
+ fnt = '{}' if fnt == ''
208
+ if fnt.kind_of?(TkFont)
209
+ fnt.actual(option)
210
+ else
211
+ actual_core(fnt, nil, option)
212
+ end
213
+ end
214
+ def TkFont.actual_hash(fnt, option=nil)
215
+ Hash[TkFont.actual(fnt, option)]
216
+ end
217
+
218
+ def TkFont.actual_displayof(fnt, win, option=nil)
219
+ fnt = '{}' if fnt == ''
220
+ if fnt.kind_of?(TkFont)
221
+ fnt.actual_displayof(win, option)
222
+ else
223
+ win = '.' unless win
224
+ actual_core(fnt, win, option)
225
+ end
226
+ end
227
+ def TkFont.actual_hash_displayof(fnt, option=nil)
228
+ Hash[TkFont.actual_displayof(fnt, option)]
229
+ end
230
+
231
+ def TkFont.configure(fnt, slot, value=None)
232
+ if fnt.kind_of?(TkFont)
233
+ fnt.configure(fnt, slot, value)
234
+ else
235
+ configure_core(fnt, slot, value)
236
+ end
237
+ fnt
238
+ end
239
+
240
+ def TkFont.configinfo(fnt, slot=nil)
241
+ if fnt.kind_of?(TkFont)
242
+ fnt.configinfo(fnt, slot)
243
+ else
244
+ configinfo_core(fnt, slot)
245
+ end
246
+ end
247
+
248
+ def TkFont.current_configinfo(fnt, slot=nil)
249
+ if fnt.kind_of?(TkFont)
250
+ fnt.current_configinfo(fnt, slot)
251
+ else
252
+ current_configinfo_core(fnt, slot)
253
+ end
254
+ end
255
+
256
+ def TkFont.measure(fnt, text)
257
+ fnt = '{}' if fnt == ''
258
+ if fnt.kind_of?(TkFont)
259
+ fnt.measure(text)
260
+ else
261
+ measure_core(fnt, nil, text)
262
+ end
263
+ end
264
+
265
+ def TkFont.measure_displayof(fnt, win, text)
266
+ fnt = '{}' if fnt == ''
267
+ if fnt.kind_of?(TkFont)
268
+ fnt.measure_displayof(win, text)
269
+ else
270
+ win = '.' unless win
271
+ measure_core(fnt, win, text)
272
+ end
273
+ end
274
+
275
+ def TkFont.metrics(fnt, option=nil)
276
+ fnt = '{}' if fnt == ''
277
+ if fnt.kind_of?(TkFont)
278
+ fnt.metrics(option)
279
+ else
280
+ metrics_core(fnt, nil, option)
281
+ end
282
+ end
283
+ def TkFont.metrics_hash(fnt, option=nil)
284
+ if option
285
+ val = TkFont.metrics(fnt, option)
286
+ case TkFont::MetricsType[option.to_s]
287
+ when ?n
288
+ val = TkComm::num_or_str(val)
289
+ when ?b
290
+ val = TkComm::bool(val)
291
+ else
292
+ # do nothing
293
+ end
294
+ return val
295
+ end
296
+
297
+ h = Hash[TkFont.metrics(fnt)]
298
+ h.keys.each{|k|
299
+ case TkFont::MetricsType[k.to_s]
300
+ when ?n
301
+ h[k] = TkComm::num_or_str(h[k])
302
+ when ?b
303
+ h[k] = TkComm::bool(h[k])
304
+ else
305
+ # do nothing
306
+ end
307
+ }
308
+ h
309
+ end
310
+
311
+ def TkFont.metrics_displayof(fnt, win, option=nil)
312
+ fnt = '{}' if fnt == ''
313
+ if fnt.kind_of?(TkFont)
314
+ font.metrics_displayof(win, option=nil)
315
+ else
316
+ win = '.' unless win
317
+ metrics_core(fnt, win, option)
318
+ end
319
+ end
320
+ def TkFont.metrics_hash_displayof(fnt, win, option=nil)
321
+ if option
322
+ val = TkFont.metrics_displayof(fnt, win, option)
323
+ case TkFont::MetricsType[option.to_s]
324
+ when ?n
325
+ val = TkComm::num_or_str(val)
326
+ when ?b
327
+ val = TkComm::bool(val)
328
+ else
329
+ # do nothing
330
+ end
331
+ return val
332
+ end
333
+
334
+ h = Hash[TkFont.metrics_displayof(fnt, win, option)]
335
+ h.keys.each{|k|
336
+ case TkFont::MetricsType[k.to_s]
337
+ when ?n
338
+ h[k] = TkComm::num_or_str(h[k])
339
+ when ?b
340
+ h[k] = TkComm::bool(h[k])
341
+ else
342
+ # do nothing
343
+ end
344
+ }
345
+ h
346
+ end
347
+
348
+ def TkFont.families(win=nil)
349
+ case (Tk::TK_VERSION)
350
+ when /^4\..*/
351
+ ['fixed']
352
+
353
+ when /^8\..*/
354
+ if win
355
+ tk_split_simplelist(tk_call('font', 'families', '-displayof', win))
356
+ else
357
+ tk_split_simplelist(tk_call('font', 'families'))
358
+ end
359
+ end
360
+ end
361
+
362
+ def TkFont.names
363
+ case (Tk::TK_VERSION)
364
+ when /^4\..*/
365
+ r = ['fixed']
366
+ r += ['a14', 'k14'] if JAPANIZED_TK
367
+ Tk_FontNameTBL.mutex.synchronize{
368
+ Tk_FontNameTBL.each_value{|obj| r.push(obj)}
369
+ }
370
+ #r | []
371
+ r.uniq
372
+
373
+ when /^8\..*/
374
+ tk_split_simplelist(tk_call('font', 'names'))
375
+
376
+ end
377
+ end
378
+
379
+ def TkFont.create_copy(font)
380
+ fail 'source-font must be a TkFont object' unless font.kind_of? TkFont
381
+ if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
382
+ keys = {}
383
+ font.configinfo.each{|key,value| keys[key] = value }
384
+ TkFont.new(font.latin_font_id, font.kanji_font_id, keys)
385
+ else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
386
+ TkFont.new(font.latin_font_id, font.kanji_font_id, font.configinfo)
387
+ end
388
+ end
389
+
390
+ def TkFont.get_obj(name)
391
+ name = name.to_s
392
+ if name =~ /^(@font[0-9]+)(|c|l|k)$/
393
+ Tk_FontNameTBL.mutex.synchronize{
394
+ Tk_FontNameTBL[$1]
395
+ }
396
+ else
397
+ Tk_FontNameTBL.mutex.synchronize{
398
+ Tk_FontNameTBL[name]
399
+ }
400
+ end
401
+ end
402
+
403
+ def TkFont.init_widget_font(pathname, *args)
404
+ win, tag, key = pathname.split(';')
405
+ key = 'font' if key == nil || key == ''
406
+ path = [win, tag, key].join(';')
407
+
408
+ case (Tk::TK_VERSION)
409
+ when /^4\..*/
410
+ regexp = /^-(|kanji)#{key} /
411
+
412
+ conf_list = tk_split_simplelist(tk_call(*args)).
413
+ find_all{|prop| prop =~ regexp}.
414
+ collect{|prop| tk_split_simplelist(prop)}
415
+
416
+ if conf_list.size == 0
417
+ raise RuntimeError, "the widget may not support 'font' option"
418
+ end
419
+
420
+ args << {}
421
+
422
+ ltn_key = "-#{key}"
423
+ knj_key = "-kanji#{key}"
424
+
425
+ ltn_info = conf_list.find{|conf| conf[0] == ltn_key}
426
+ ltn = ltn_info[-1]
427
+ ltn = nil if ltn == [] || ltn == ""
428
+
429
+ knj_info = conf_list.find{|conf| conf[0] == knj_key}
430
+ knj = knj_info[-1]
431
+ knj = nil if knj == [] || knj == ""
432
+
433
+ TkFont.new(ltn, knj).call_font_configure([path, key], *args)
434
+
435
+ when /^8\.[0-4]/
436
+ regexp = /^-#{key} /
437
+
438
+ conf_list = tk_split_simplelist(tk_call(*args)).
439
+ find_all{|prop| prop =~ regexp}.
440
+ collect{|prop| tk_split_simplelist(prop)}
441
+
442
+ if conf_list.size == 0
443
+ raise RuntimeError, "the widget may not support 'font' option"
444
+ end
445
+
446
+ args << {}
447
+
448
+ optkey = "-#{key}"
449
+
450
+ info = conf_list.find{|conf| conf[0] == optkey}
451
+ fnt = info[-1]
452
+ fnt = nil if fnt == [] || fnt == ""
453
+
454
+ unless fnt
455
+ # create dummy
456
+ # TkFont.new(nil, nil).call_font_configure([path, key], *args)
457
+ dummy_fnt = TkFont.allocate
458
+ dummy_fnt.instance_eval{ init_dummy_fontobj() }
459
+ dummy_fnt
460
+ else
461
+ begin
462
+ compound = tk_split_simplelist(
463
+ Hash[*tk_split_simplelist(tk_call('font', 'configure',
464
+ fnt))].collect{|k,v|
465
+ [k[1..-1], v]
466
+ }.assoc('compound')[1])
467
+ rescue
468
+ compound = []
469
+ end
470
+ if compound == []
471
+ if TkFont.is_system_font?(fnt)
472
+ TkNamedFont.new(fnt).call_font_configure([path, key], *args)
473
+ else
474
+ TkFont.new(fnt).call_font_configure([path, key], *args)
475
+ end
476
+ else
477
+ TkFont.new(compound[0],
478
+ compound[1]).call_font_configure([path, key], *args)
479
+ end
480
+ end
481
+
482
+ when /^8\.[5-9]/, /^9\..*/
483
+ regexp = /^-#{key} /
484
+
485
+ conf_list = tk_split_simplelist(tk_call(*args)).
486
+ find_all{|prop| prop =~ regexp}.
487
+ collect{|prop| tk_split_simplelist(prop)}
488
+
489
+ if conf_list.size == 0
490
+ raise RuntimeError, "the widget may not support 'font' option"
491
+ end
492
+
493
+ args << {}
494
+
495
+ optkey = "-#{key}"
496
+
497
+ info = conf_list.find{|conf| conf[0] == optkey}
498
+ fnt = info[-1]
499
+ fnt = nil if fnt == [] || fnt == ""
500
+
501
+ unless fnt
502
+ # create dummy
503
+ # TkFont.new(nil, nil).call_font_configure([path, key], *args)
504
+ dummy_fnt = TkFont.allocate
505
+ dummy_fnt.instance_eval{ init_dummy_fontobj() }
506
+ dummy_fnt
507
+ else
508
+ if TkFont.is_system_font?(fnt)
509
+ TkNamedFont.new(fnt).call_font_configure([path, key], *args)
510
+ else
511
+ TkFont.new(fnt).call_font_configure([path, key], *args)
512
+ end
513
+ end
514
+ end
515
+ end
516
+
517
+ def TkFont.used_on(path=nil)
518
+ Tk_FontUseTBL.mutex.synchronize{
519
+ if path
520
+ Tk_FontUseTBL[path]
521
+ else
522
+ # Tk_FontUseTBL.values | []
523
+ Tk_FontUseTBL.values.uniq
524
+ end
525
+ }
526
+ end
527
+
528
+ def TkFont.failsafe(font)
529
+ begin
530
+ if /^8\..*/ === Tk::TK_VERSION && JAPANIZED_TK
531
+ tk_call('font', 'failsafe', font)
532
+ end
533
+ rescue
534
+ end
535
+ end
536
+
537
+ ###################################
538
+ # instance methods
539
+ ###################################
540
+ private
541
+ ###################################
542
+ def init_dummy_fontobj
543
+ Tk_FontID.mutex.synchronize{
544
+ @id = Tk_FontID.join(TkCore::INTERP._ip_id_)
545
+ Tk_FontID[1].succ!
546
+ }
547
+ Tk_FontNameTBL.mutex.synchronize{
548
+ Tk_FontNameTBL[@id] = self
549
+ }
550
+
551
+ # @latin_desscendant = nil
552
+ # @kanji_desscendant = nil
553
+ @descendant = [nil, nil] # [latin, kanji]
554
+
555
+ case (Tk::TK_VERSION)
556
+ when /^4\..*/
557
+ @latinfont = ""
558
+ @kanjifont = ""
559
+ if JAPANIZED_TK
560
+ @compoundfont = [[@latinfont], [@kanjifont]]
561
+ @fontslot = {'font'=>@latinfont, 'kanjifont'=>@kanjifont}
562
+ else
563
+ @compoundfont = @latinfont
564
+ @fontslot = {'font'=>@latinfont}
565
+ end
566
+ else
567
+ @latinfont = @id + 'l'
568
+ @kanjifont = @id + 'k'
569
+ @compoundfont = @id + 'c'
570
+
571
+ if JAPANIZED_TK
572
+ tk_call('font', 'create', @latinfont, '-charset', 'iso8859')
573
+ tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983')
574
+ tk_call('font', 'create', @compoundfont,
575
+ '-compound', [@latinfont, @kanjifont])
576
+ else
577
+ tk_call('font', 'create', @latinfont)
578
+ tk_call('font', 'create', @kanjifont)
579
+ tk_call('font', 'create', @compoundfont)
580
+ end
581
+
582
+ @fontslot = {'font'=>@compoundfont}
583
+ end
584
+
585
+ self
586
+ end
587
+
588
+ def initialize(ltn=nil, knj=nil, keys=nil)
589
+ ltn = '{}' if ltn == ''
590
+ knj = '{}' if knj == ''
591
+
592
+ Tk_FontID.mutex.synchronize{
593
+ # @id = Tk_FontID.join('')
594
+ @id = Tk_FontID.join(TkCore::INTERP._ip_id_)
595
+ Tk_FontID[1].succ!
596
+ }
597
+ Tk_FontNameTBL.mutex.synchronize{
598
+ Tk_FontNameTBL[@id] = self
599
+ }
600
+
601
+ # @latin_desscendant = nil
602
+ # @kanji_desscendant = nil
603
+ @descendant = [nil, nil] # [latin, kanji]
604
+
605
+ # @latinfont = @id + 'l'
606
+ # @kanjifont = @id + 'k'
607
+ # @compoundfont = @id + 'c'
608
+ # @fontslot = {}
609
+
610
+ if knj.kind_of?(Hash) && !keys
611
+ keys = knj
612
+ knj = nil
613
+ end
614
+
615
+ # compound font check
616
+ if Tk::TK_VERSION == '8.0' && JAPANIZED_TK
617
+ begin
618
+ compound = tk_split_simplelist(tk_call('font', 'configure',
619
+ ltn, '-compound'))
620
+ if knj == nil
621
+ if compound != []
622
+ ltn, knj = compound
623
+ end
624
+ else
625
+ if compound != []
626
+ ltn = compound[0]
627
+ end
628
+ compound = tk_split_simplelist(tk_call('font', 'configure',
629
+ knj, '-compound'))
630
+ if compound != []
631
+ knj = compound[1]
632
+ end
633
+ end
634
+ rescue
635
+ end
636
+ end
637
+
638
+ if ltn
639
+ if JAPANIZED_TK && !knj
640
+ if Tk::TK_VERSION =~ /^4..*/
641
+ knj = DEFAULT_KANJI_FONT_NAME
642
+ else
643
+ knj = ltn
644
+ end
645
+ end
646
+ else
647
+ ltn = DEFAULT_LATIN_FONT_NAME
648
+ knj = DEFAULT_KANJI_FONT_NAME if JAPANIZED_TK && !knj
649
+ end
650
+
651
+ create_compoundfont(ltn, knj, keys)
652
+ end
653
+
654
+ def initialize_copy(font)
655
+ unless font.kind_of?(TkFont)
656
+ fail TypeError, '"initialize_copy should take same class object'
657
+ end
658
+ if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
659
+ keys = {}
660
+ font.configinfo.each{|key,value| keys[key] = value }
661
+ initialize(font.latin_font_id, font.kanji_font_id, keys)
662
+ else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
663
+ initialize(font.latin_font_id, font.kanji_font_id, font.configinfo)
664
+ end
665
+ end
666
+
667
+ def _get_font_info_from_hash(font)
668
+ font = _symbolkey2str(font)
669
+ foundry = (info = font['foundry'] .to_s)? info: '*'
670
+ family = (info = font['family'] .to_s)? info: '*'
671
+ weight = (info = font['weight'] .to_s)? info: '*'
672
+ slant = (info = font['slant'] .to_s)? info: '*'
673
+ swidth = (info = font['swidth'] .to_s)? info: '*'
674
+ adstyle = (info = font['adstyle'] .to_s)? info: '*'
675
+ pixels = (info = font['pixels'] .to_s)? info: '*'
676
+ points = (info = font['points'] .to_s)? info: '*'
677
+ resx = (info = font['resx'] .to_s)? info: '*'
678
+ resy = (info = font['resy'] .to_s)? info: '*'
679
+ space = (info = font['space'] .to_s)? info: '*'
680
+ avgWidth = (info = font['avgWidth'].to_s)? info: '*'
681
+ charset = (info = font['charset'] .to_s)? info: '*'
682
+ encoding = (info = font['encoding'].to_s)? info: '*'
683
+
684
+ [foundry, family, weight, slant, swidth, adstyle,
685
+ pixels, points, resx, resy, space, avgWidth, charset, encoding]
686
+ end
687
+
688
+ def create_latinfont_tk4x(font)
689
+ if font.kind_of? Hash
690
+ @latinfont = '-' + _get_font_info_from_hash(font).join('-') + '-'
691
+
692
+ elsif font.kind_of? Array
693
+ finfo = {}
694
+ finfo['family'] = font[0].to_s
695
+ if font[1]
696
+ fsize = font[1].to_s
697
+ if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
698
+ if $1 == '-'
699
+ finfo['pixels'] = $2
700
+ else
701
+ finfo['points'] = $2
702
+ end
703
+ else
704
+ finfo['points'] = '13'
705
+ end
706
+ end
707
+ font[2..-1].each{|style|
708
+ case (style)
709
+ when 'normal'
710
+ finfo['weight'] = style
711
+ when 'bold'
712
+ finfo['weight'] = style
713
+ when 'roman'
714
+ finfo['slant'] = 'r'
715
+ when 'italic'
716
+ finfo['slant'] = 'i'
717
+ end
718
+ }
719
+
720
+ @latinfont = '-' + _get_font_info_from_hash(finfo).join('-') + '-'
721
+
722
+ elsif font.kind_of? TkFont
723
+ @latinfont = font.latin_font
724
+
725
+ else
726
+ if font
727
+ @latinfont = font
728
+ else
729
+ @latinfont = DEFAULT_LATIN_FONT_NAME
730
+ end
731
+
732
+ end
733
+ end
734
+
735
+ def create_kanjifont_tk4x(font)
736
+ unless JAPANIZED_TK
737
+ @kanjifont = ""
738
+ return
739
+ end
740
+
741
+ if font.kind_of? Hash
742
+ @kanjifont = '-' + _get_font_info_from_hash(font).join('-') + '-'
743
+
744
+ elsif font.kind_of? Array
745
+ finfo = {}
746
+ finfo['family'] = font[0].to_s
747
+ if font[1]
748
+ fsize = font[1].to_s
749
+ if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
750
+ if $1 == '-'
751
+ finfo['pixels'] = $2
752
+ else
753
+ finfo['points'] = $2
754
+ end
755
+ else
756
+ finfo['points'] = '13'
757
+ end
758
+ end
759
+ font[2..-1].each{|style|
760
+ case (style)
761
+ when 'normal'
762
+ finfo['weight'] = style
763
+ when 'bold'
764
+ finfo['weight'] = style
765
+ when 'roman'
766
+ finfo['slant'] = 'r'
767
+ when 'italic'
768
+ finfo['slant'] = 'i'
769
+ end
770
+ }
771
+
772
+ @kanjifont = '-' + _get_font_info_from_hash(finfo).join('-') + '-'
773
+ elsif font.kind_of? TkFont
774
+ @kanjifont = font.kanji_font_id
775
+ else
776
+ if font
777
+ @kanjifont = font
778
+ else
779
+ @kanjifont = DEFAULT_KANJI_FONT_NAME
780
+ end
781
+ end
782
+ end
783
+
784
+ def create_compoundfont_tk4x(ltn, knj, keys)
785
+ create_latinfont(ltn)
786
+ create_kanjifont(knj)
787
+
788
+ if JAPANIZED_TK
789
+ @compoundfont = [[@latinfont], [@kanjifont]]
790
+ @fontslot = {'font'=>@latinfont, 'kanjifont'=>@kanjifont}
791
+ # @fontslot.clear
792
+ # @fontslot['font'] = @latinfont
793
+ # @fontslot['kanjifont'] = @kanjifont
794
+ else
795
+ @compoundfont = @latinfont
796
+ @fontslot = {'font'=>@latinfont}
797
+ # @fontslot.clear
798
+ # @fontslot['font'] = @latinfont
799
+ end
800
+ end
801
+
802
+ def create_latinfont_tk8x(font)
803
+ @latinfont = @id + 'l'
804
+
805
+ if JAPANIZED_TK
806
+ if font.kind_of? Hash
807
+ if font[:charset] || font['charset']
808
+ tk_call('font', 'create', @latinfont, *hash_kv(font))
809
+ else
810
+ tk_call('font', 'create', @latinfont,
811
+ '-charset', 'iso8859', *hash_kv(font))
812
+ end
813
+ elsif font.kind_of? Array
814
+ tk_call('font', 'create', @latinfont, '-copy', array2tk_list(font))
815
+ tk_call('font', 'configure', @latinfont, '-charset', 'iso8859')
816
+ elsif font.kind_of? TkFont
817
+ tk_call('font', 'create', @latinfont, '-copy', font.latin_font)
818
+ elsif font
819
+ tk_call('font', 'create', @latinfont, '-copy', font,
820
+ '-charset', 'iso8859')
821
+ else
822
+ tk_call('font', 'create', @latinfont, '-charset', 'iso8859')
823
+ end
824
+ else
825
+ if font.kind_of? Hash
826
+ tk_call('font', 'create', @latinfont, *hash_kv(font))
827
+ else
828
+ keys = {}
829
+ if font.kind_of? Array
830
+ actual_core(array2tk_list(font)).each{|key,val| keys[key] = val}
831
+ elsif font.kind_of? TkFont
832
+ actual_core(font.latin_font).each{|key,val| keys[key] = val}
833
+ elsif font
834
+ actual_core(font).each{|key,val| keys[key] = val}
835
+ end
836
+ tk_call('font', 'create', @latinfont, *hash_kv(keys))
837
+ end
838
+
839
+ if font && @compoundfont
840
+ keys = {}
841
+ actual_core(@latinfont).each{|key,val| keys[key] = val}
842
+ tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
843
+ end
844
+ end
845
+ end
846
+
847
+ def create_kanjifont_tk8x(font)
848
+ @kanjifont = @id + 'k'
849
+
850
+ if JAPANIZED_TK
851
+ if font.kind_of? Hash
852
+ if font[:charset] || font['charset']
853
+ tk_call('font', 'create', @kanjifont, *hash_kv(font))
854
+ else
855
+ tk_call('font', 'create', @kanjifont,
856
+ '-charset', 'jisx0208.1983', *hash_kv(font))
857
+ end
858
+ elsif font.kind_of? Array
859
+ tk_call('font', 'create', @kanjifont, '-copy', array2tk_list(font))
860
+ tk_call('font', 'configure', @kanjifont, '-charset', 'jisx0208.1983')
861
+ elsif font.kind_of? TkFont
862
+ tk_call('font', 'create', @kanjifont, '-copy', font.kanji_font_id)
863
+ elsif font
864
+ tk_call('font', 'create', @kanjifont, '-copy', font,
865
+ '-charset', 'jisx0208.1983')
866
+ else
867
+ tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983')
868
+ end
869
+ # end of JAPANIZED_TK
870
+
871
+ else
872
+ if font.kind_of? Hash
873
+ tk_call('font', 'create', @kanjifont, *hash_kv(font))
874
+ else
875
+ keys = {}
876
+ if font.kind_of? Array
877
+ actual_core(array2tk_list(font)).each{|key,val| keys[key] = val}
878
+ elsif font.kind_of? TkFont
879
+ actual_core(font.kanji_font_id).each{|key,val| keys[key] = val}
880
+ elsif font
881
+ actual_core(font).each{|key,val| keys[key] = val}
882
+ end
883
+ tk_call('font', 'create', @kanjifont, *hash_kv(keys))
884
+ end
885
+
886
+ if font && @compoundfont
887
+ keys = {}
888
+ actual_core(@kanjifont).each{|key,val| keys[key] = val}
889
+ tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
890
+ end
891
+ end
892
+ end
893
+
894
+ def create_compoundfont_tk8x(ltn, knj, keys)
895
+ if knj
896
+ create_latinfont(ltn)
897
+ create_kanjifont(knj)
898
+ else
899
+ cfnt = ltn
900
+ create_kanjifont(cfnt)
901
+ create_latinfont(cfnt)
902
+ end
903
+
904
+ @compoundfont = @id + 'c'
905
+
906
+ if JAPANIZED_TK
907
+ unless keys
908
+ keys = {}
909
+ else
910
+ keys = keys.dup
911
+ end
912
+ if (tk_call('font', 'configure', @latinfont, '-underline') == '1' &&
913
+ tk_call('font', 'configure', @kanjifont, '-underline') == '1' &&
914
+ !keys.key?('underline'))
915
+ keys['underline'] = true
916
+ end
917
+ if (tk_call('font', 'configure', @latinfont, '-overstrike') == '1' &&
918
+ tk_call('font', 'configure', @kanjifont, '-overstrike') == '1' &&
919
+ !keys.key?('overstrike'))
920
+ keys['overstrike'] = true
921
+ end
922
+
923
+ @fontslot = {'font'=>@compoundfont}
924
+ # @fontslot['font'] = @compoundfont
925
+ begin
926
+ tk_call('font', 'create', @compoundfont,
927
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
928
+ rescue RuntimeError => e
929
+ if ltn == knj
930
+ if e.message =~ /kanji font .* specified/
931
+ tk_call('font', 'delete', @latinfont)
932
+ create_latinfont(DEFAULT_LATIN_FONT_NAME)
933
+ opts = []
934
+ Hash[*(tk_split_simplelist(tk_call('font', 'configure',
935
+ @kanjifont)))].each{|k,v|
936
+ case k
937
+ when '-size', '-weight', '-slant', '-underline', '-overstrike'
938
+ opts << k << v
939
+ end
940
+ }
941
+ tk_call('font', 'configure', @latinfont, *opts)
942
+ tk_call('font', 'create', @compoundfont,
943
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
944
+
945
+ elsif e.message =~ /ascii font .* specified/
946
+ tk_call('font', 'delete', @kanjifont)
947
+ create_kanjifont(DEFAULT_KANJI_FONT_NAME)
948
+ opts = []
949
+ Hash[*(tk_split_simplelist(tk_call('font', 'configure',
950
+ @latinfont)))].each{|k,v|
951
+ case k
952
+ when '-size', '-weight', '-slant', '-underline', '-overstrike'
953
+ opts << k << v
954
+ end
955
+ }
956
+ tk_call('font', 'configure', @kanjifont, *opts)
957
+ tk_call('font', 'create', @compoundfont,
958
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
959
+
960
+ else
961
+ raise e
962
+ end
963
+ else
964
+ raise e
965
+ end
966
+ end
967
+ else
968
+ tk_call('font', 'create', @compoundfont)
969
+
970
+ latinkeys = {}
971
+ begin
972
+ actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
973
+ rescue
974
+ latinkeys = {}
975
+ end
976
+ if latinkeys != {}
977
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
978
+ end
979
+
980
+ if knj
981
+ compoundkeys = nil
982
+ kanjikeys = {}
983
+ begin
984
+ actual_core(@kanjifont).each{|key,val| kanjikeys[key] = val}
985
+ rescue
986
+ kanjikeys = {}
987
+ end
988
+ if kanjikeys != {}
989
+ tk_call('font', 'configure', @compoundfont, *hash_kv(kanjikeys))
990
+ end
991
+ end
992
+
993
+ if cfnt
994
+ if cfnt.kind_of?(Hash)
995
+ compoundkeys = cfnt.dup
996
+ else
997
+ compoundkeys = {}
998
+ actual_core(cfnt).each{|key,val| compoundkeys[key] = val}
999
+ end
1000
+ compoundkeys.update(_symbolkey2str(keys))
1001
+ keys = compoundkeys
1002
+ end
1003
+
1004
+ @fontslot = {'font'=>@compoundfont}
1005
+ # @fontslot['font'] = @compoundfont
1006
+ tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
1007
+ end
1008
+ end
1009
+
1010
+ ###################################
1011
+ public
1012
+ ###################################
1013
+ def inspect
1014
+ sprintf("#<%s:%0x:%s>", self.class.inspect, self.__id__, @compoundfont)
1015
+ end
1016
+
1017
+ def method_missing(id, *args)
1018
+ name = id.id2name
1019
+ case args.length
1020
+ when 1
1021
+ if name[-1] == ?=
1022
+ configure name[0..-2], args[0]
1023
+ args[0]
1024
+ else
1025
+ configure name, args[0]
1026
+ self
1027
+ end
1028
+ when 0
1029
+ begin
1030
+ configinfo name
1031
+ rescue
1032
+ super(id, *args)
1033
+ # fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at
1034
+ end
1035
+ else
1036
+ super(id, *args)
1037
+ # fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
1038
+ end
1039
+ end
1040
+
1041
+ def call_font_configure(path, *args)
1042
+ if path.kind_of?(Array)
1043
+ # [path, optkey]
1044
+ win, tag = path[0].split(';')
1045
+ optkey = path[1].to_s
1046
+ else
1047
+ win, tag, optkey = path.split(';')
1048
+ end
1049
+
1050
+ fontslot = _symbolkey2str(@fontslot)
1051
+ if optkey && optkey != ""
1052
+ ltn = fontslot.delete('font')
1053
+ knj = fontslot.delete('kanjifont')
1054
+ fontslot[optkey] = ltn if ltn
1055
+ fontslot["kanji#{optkey}"] = knj if knj
1056
+ end
1057
+
1058
+ keys = _symbolkey2str(args.pop).update(fontslot)
1059
+ args.concat(hash_kv(keys))
1060
+ begin
1061
+ tk_call(*args)
1062
+ rescue => e
1063
+ unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
1064
+ fail e
1065
+ end
1066
+ end
1067
+ Tk_FontUseTBL.mutex.synchronize{
1068
+ Tk_FontUseTBL[[win, tag, optkey].join(';')] = self
1069
+ }
1070
+ self
1071
+ end
1072
+
1073
+ def used
1074
+ ret = []
1075
+ table = nil
1076
+ Tk_FontUseTBL.mutex.synchronize{
1077
+ table = Tk_FontUseTBL.clone # to avoid deadlock
1078
+ }
1079
+ table.each{|key,value|
1080
+ next unless self == value
1081
+ if key.include?(';')
1082
+ win, tag, optkey = key.split(';')
1083
+ winobj = tk_tcl2ruby(win)
1084
+ #if winobj.kind_of? TkText
1085
+ if winobj.kind_of?(TkText) || winobj.kind_of?(Tk::Text)
1086
+ if optkey
1087
+ ret.push([winobj, winobj.tagid2obj(tag), optkey])
1088
+ else
1089
+ ret.push([winobj, winobj.tagid2obj(tag)])
1090
+ end
1091
+ #elsif winobj.kind_of? TkCanvas
1092
+ elsif winobj.kind_of?(TkCanvas) || winobj.kind_of?(Tk::Canvas)
1093
+ if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
1094
+ if optkey
1095
+ ret.push([winobj, tagobj, optkey])
1096
+ else
1097
+ ret.push([winobj, tagobj])
1098
+ end
1099
+ elsif (tagobj = TkcItem.id2obj(winobj, tag)).kind_of? TkcItem
1100
+ if optkey
1101
+ ret.push([winobj, tagobj, optkey])
1102
+ else
1103
+ ret.push([winobj, tagobj])
1104
+ end
1105
+ else
1106
+ if optkey
1107
+ ret.push([winobj, tag, optkey])
1108
+ else
1109
+ ret.push([winobj, tag])
1110
+ end
1111
+ end
1112
+ #elsif winobj.kind_of? TkMenu
1113
+ elsif winobj.kind_of?(TkMenu) || winobj.kind_of?(Tk::Menu)
1114
+ if optkey
1115
+ ret.push([winobj, tag, optkey])
1116
+ else
1117
+ ret.push([winobj, tag])
1118
+ end
1119
+ else
1120
+ if optkey
1121
+ ret.push([win, tag, optkey])
1122
+ else
1123
+ ret.push([win, tag])
1124
+ end
1125
+ end
1126
+ else
1127
+ ret.push(tk_tcl2ruby(key))
1128
+ end
1129
+ }
1130
+ ret
1131
+ end
1132
+
1133
+ def id
1134
+ @id
1135
+ end
1136
+
1137
+ def to_eval
1138
+ font
1139
+ end
1140
+
1141
+ def font
1142
+ @compoundfont
1143
+ end
1144
+ alias font_id font
1145
+ alias name font
1146
+ alias to_s font
1147
+
1148
+ def latin_font_id
1149
+ @latinfont
1150
+ end
1151
+
1152
+ def latin_font
1153
+ # @latinfont
1154
+ if @descendant[0] # [0] -> latin
1155
+ @descendant[0]
1156
+ else
1157
+ @descendant[0] = DescendantFont.new(self, 'latin')
1158
+ end
1159
+ =begin
1160
+ if @latin_descendant
1161
+ @latin_descendant
1162
+ else
1163
+ @latin_descendant = DescendantFont.new(self, 'latin')
1164
+ end
1165
+ =end
1166
+ end
1167
+ alias latinfont latin_font
1168
+
1169
+ def kanji_font_id
1170
+ @kanjifont
1171
+ end
1172
+
1173
+ def kanji_font
1174
+ # @kanjifont
1175
+ if @descendant[1] # [1] -> kanji
1176
+ @descendant[1]
1177
+ else
1178
+ @descendant[1] = DescendantFont.new(self, 'kanji')
1179
+ end
1180
+ =begin
1181
+ if @kanji_descendant
1182
+ @kanji_descendant
1183
+ else
1184
+ @kanji_descendant = DescendantFont.new(self, 'kanji')
1185
+ end
1186
+ =end
1187
+ end
1188
+ alias kanjifont kanji_font
1189
+
1190
+ def actual(option=nil)
1191
+ actual_core(@compoundfont, nil, option)
1192
+ end
1193
+ def actual_hash(option=nil)
1194
+ Hash[actual(option)]
1195
+ end
1196
+
1197
+ def actual_displayof(win, option=nil)
1198
+ win = '.' unless win
1199
+ actual_core(@compoundfont, win, option)
1200
+ end
1201
+ def actual_hash_displayof(win, option=nil)
1202
+ Hash[actual_displayof(win, option)]
1203
+ end
1204
+
1205
+ def latin_actual(option=nil)
1206
+ if @latinfont == nil
1207
+ actual_core(@compoundfont, nil, option) # use @compoundfont
1208
+ else
1209
+ actual_core(@latinfont, nil, option)
1210
+ end
1211
+ end
1212
+ def latin_actual_hash(option=nil)
1213
+ Hash[latin_actual(option)]
1214
+ end
1215
+
1216
+ def latin_actual_displayof(win, option=nil)
1217
+ win = '.' unless win
1218
+ if @latinfont == nil
1219
+ actual_core(@compoundfont, win, option) # use @compoundfont
1220
+ else
1221
+ actual_core(@latinfont, win, option)
1222
+ end
1223
+ end
1224
+ def latin_actual_hash_displayof(win, option=nil)
1225
+ Hash[latin_actual_displayof(win, option)]
1226
+ end
1227
+
1228
+ def kanji_actual(option=nil)
1229
+ #if JAPANIZED_TK
1230
+ if @kanjifont == nil
1231
+ actual_core(@compoundfont, nil, option) # use @compoundfont
1232
+ elsif @kanjifont != ""
1233
+ actual_core(@kanjifont, nil, option)
1234
+ else
1235
+ actual_core_tk4x(nil, nil, option)
1236
+ end
1237
+ end
1238
+ def kanji_actual_hash(option=nil)
1239
+ Hash[kanji_actual(option)]
1240
+ end
1241
+
1242
+ def kanji_actual_displayof(win, option=nil)
1243
+ #if JAPANIZED_TK
1244
+ if @kanjifont == nil
1245
+ actual_core(@compoundfont, nil, option) # use @compoundfont
1246
+ elsif @kanjifont != ""
1247
+ win = '.' unless win
1248
+ actual_core(@kanjifont, win, option)
1249
+ else
1250
+ actual_core_tk4x(nil, win, option)
1251
+ end
1252
+ end
1253
+ def kanji_actual_hash_displayof(win, option=nil)
1254
+ Hash[kanji_actual_displayof(win, option)]
1255
+ end
1256
+
1257
+ def [](slot)
1258
+ configinfo slot
1259
+ end
1260
+
1261
+ def []=(slot, val)
1262
+ configure slot, val
1263
+ val
1264
+ end
1265
+
1266
+ def configure(slot, value=None)
1267
+ configure_core(@compoundfont, slot, value)
1268
+ self
1269
+ end
1270
+
1271
+ def configinfo(slot=nil)
1272
+ configinfo_core(@compoundfont, slot)
1273
+ end
1274
+
1275
+ def current_configinfo(slot=nil)
1276
+ current_configinfo_core(@compoundfont, slot)
1277
+ end
1278
+
1279
+ def delete
1280
+ delete_core
1281
+ end
1282
+
1283
+ def latin_configure(slot, value=None)
1284
+ if JAPANIZED_TK
1285
+ configure_core(@latinfont, slot, value)
1286
+ else
1287
+ configure(slot, value)
1288
+ end
1289
+ self
1290
+ end
1291
+
1292
+ def latin_configinfo(slot=nil)
1293
+ if JAPANIZED_TK
1294
+ configinfo_core(@latinfont, slot)
1295
+ else
1296
+ configinfo(slot)
1297
+ end
1298
+ end
1299
+ def latin_current_configinfo(slot=nil)
1300
+ Hash[latin_configinfo(slot)]
1301
+ end
1302
+
1303
+ def kanji_configure(slot, value=None)
1304
+ #if JAPANIZED_TK
1305
+ if @kanjifont == nil
1306
+ configure_core(@compoundfont, slot, value) # use @compoundfont
1307
+ elsif @kanjifont != ""
1308
+ configure_core(@kanjifont, slot, value)
1309
+ configure('size'=>configinfo('size')) # to reflect new configuration
1310
+ else
1311
+ #""
1312
+ configure(slot, value)
1313
+ end
1314
+ self
1315
+ end
1316
+
1317
+ def kanji_configinfo(slot=nil)
1318
+ #if JAPANIZED_TK
1319
+ if @kanjifont == nil
1320
+ configure_core(@compoundfont, slot) # use @compoundfont
1321
+ elsif @kanjifont != ""
1322
+ configinfo_core(@kanjifont, slot)
1323
+ else
1324
+ #[]
1325
+ configinfo(slot)
1326
+ end
1327
+ end
1328
+ def kanji_current_configinfo(slot=nil)
1329
+ Hash[kanji_configinfo(slot)]
1330
+ end
1331
+
1332
+ def replace(ltn, knj=None)
1333
+ knj = ltn if knj == None
1334
+ latin_replace(ltn)
1335
+ kanji_replace(knj)
1336
+ self
1337
+ end
1338
+
1339
+ def latin_replace(ltn)
1340
+ if @latinfont
1341
+ latin_replace_core(ltn)
1342
+ reset_pointadjust
1343
+ else
1344
+ # not compound font -> copy properties of ltn
1345
+ latinkeys = {}
1346
+ begin
1347
+ actual_core(ltn).each{|key,val| latinkeys[key] = val}
1348
+ rescue
1349
+ latinkeys = {}
1350
+ end
1351
+ begin
1352
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
1353
+ rescue
1354
+ # not exist? (deleted?) -> create font
1355
+ tk_call('font', 'create', @compoundfont, *hash_kv(latinkeys))
1356
+ end
1357
+ end
1358
+
1359
+ self
1360
+ end
1361
+
1362
+ def kanji_replace(knj)
1363
+ return self unless @kanjifont # ignore
1364
+ kanji_replace_core(knj)
1365
+ reset_pointadjust
1366
+ self
1367
+ end
1368
+
1369
+ def measure(text)
1370
+ measure_core(@compoundfont, nil, text)
1371
+ end
1372
+
1373
+ def measure_displayof(win, text)
1374
+ win = '.' unless win
1375
+ measure_core(@compoundfont, win, text)
1376
+ end
1377
+
1378
+ def metrics(option=nil)
1379
+ metrics_core(@compoundfont, nil, option)
1380
+ end
1381
+ def metrics_hash(option=nil)
1382
+ if option
1383
+ val = metrics(option)
1384
+ case TkFont::MetricsType[option.to_s]
1385
+ when ?n
1386
+ val = TkComm::num_or_str(val)
1387
+ when ?b
1388
+ val = TkComm::bool(val)
1389
+ else
1390
+ # do nothing
1391
+ end
1392
+ return val
1393
+ end
1394
+
1395
+ h = Hash[metrics(option)]
1396
+ h.keys.each{|k|
1397
+ case TkFont::MetricsType[k.to_s]
1398
+ when ?n
1399
+ h[k] = TkComm::num_or_str(h[k])
1400
+ when ?b
1401
+ h[k] = TkComm::bool(h[k])
1402
+ else
1403
+ # do nothing
1404
+ end
1405
+ }
1406
+ h
1407
+ end
1408
+
1409
+ def metrics_displayof(win, option=nil)
1410
+ win = '.' unless win
1411
+ metrics_core(@compoundfont, win, option)
1412
+ end
1413
+ def metrics_hash_displayof(win, option=nil)
1414
+ if option
1415
+ val = metrics_displayof(win, option)
1416
+ case TkFont::MetricsType[option.to_s]
1417
+ when ?n
1418
+ val = TkComm::num_or_str(val)
1419
+ when ?b
1420
+ val = TkComm::bool(val)
1421
+ else
1422
+ # do nothing
1423
+ end
1424
+ return val
1425
+ end
1426
+
1427
+ h = Hash[metrics_displayof(win, option)]
1428
+ h.keys.each{|k|
1429
+ case TkFont::MetricsType[k.to_s]
1430
+ when ?n
1431
+ h[k] = TkComm::num_or_str(h[k])
1432
+ when ?b
1433
+ h[k] = TkComm::bool(h[k])
1434
+ else
1435
+ # do nothing
1436
+ end
1437
+ }
1438
+ h
1439
+ end
1440
+
1441
+ def latin_metrics(option=nil)
1442
+ if @latinfont == nil
1443
+ metrics_core(@compoundfont, nil, option) # use @compoundfont
1444
+ else
1445
+ metrics_core(@latinfont, nil, option)
1446
+ end
1447
+ end
1448
+ def latin_metrics_hash(option=nil)
1449
+ if option
1450
+ val = latin_metrics(option)
1451
+ case TkFont::MetricsType[option.to_s]
1452
+ when ?n
1453
+ val = TkComm::num_or_str(val)
1454
+ when ?b
1455
+ val = TkComm::bool(val)
1456
+ else
1457
+ # do nothing
1458
+ end
1459
+ return val
1460
+ end
1461
+
1462
+ h = Hash[latin_metrics(option)]
1463
+ h.keys.each{|k|
1464
+ case TkFont::MetricsType[k.to_s]
1465
+ when ?n
1466
+ h[k] = TkComm::num_or_str(h[k])
1467
+ when ?b
1468
+ h[k] = TkComm::bool(h[k])
1469
+ else
1470
+ # do nothing
1471
+ end
1472
+ }
1473
+ h
1474
+ end
1475
+
1476
+ def latin_metrics_displayof(win, option=nil)
1477
+ win = '.' unless win
1478
+ if @latinfont == nil
1479
+ metrics_core(@compoundfont, win, option) # use @compoundfont
1480
+ else
1481
+ metrics_core(@latinfont, win, option)
1482
+ end
1483
+ end
1484
+ def latin_metrics_hash_displayof(win, option=nil)
1485
+ if option
1486
+ val = latin_metrics_displayof(win, option)
1487
+ case TkFont::MetricsType[option.to_s]
1488
+ when ?n
1489
+ val = TkComm::num_or_str(val)
1490
+ when ?b
1491
+ val = TkComm::bool(val)
1492
+ else
1493
+ # do nothing
1494
+ end
1495
+ return val
1496
+ end
1497
+
1498
+ h = Hash[latin_metrics_displayof(win, option)]
1499
+ h.keys.each{|k|
1500
+ case TkFont::MetricsType[k.to_s]
1501
+ when ?n
1502
+ h[k] = TkComm::num_or_str(h[k])
1503
+ when ?b
1504
+ h[k] = TkComm::bool(h[k])
1505
+ else
1506
+ # do nothing
1507
+ end
1508
+ }
1509
+ h
1510
+ end
1511
+
1512
+ def kanji_metrics(option=nil)
1513
+ if @latinfont == nil
1514
+ metrics_core(@compoundfont, nil, option) # use @compoundfont
1515
+ elsif JAPANIZED_TK
1516
+ metrics_core(@kanjifont, nil, option)
1517
+ else
1518
+ metrics_core_tk4x(nil, nil, option)
1519
+ end
1520
+ end
1521
+ def kanji_metrics_hash(option=nil)
1522
+ if option
1523
+ val = kanji_metrics(option)
1524
+ case TkFont::MetricsType[option.to_s]
1525
+ when ?n
1526
+ val = TkComm::num_or_str(val)
1527
+ when ?b
1528
+ val = TkComm::bool(val)
1529
+ else
1530
+ # do nothing
1531
+ end
1532
+ return val
1533
+ end
1534
+
1535
+ h = Hash[kanji_metrics(option)]
1536
+ h.keys.each{|k|
1537
+ case TkFont::MetricsType[k.to_s]
1538
+ when ?n
1539
+ h[k] = TkComm::num_or_str(h[k])
1540
+ when ?b
1541
+ h[k] = TkComm::bool(h[k])
1542
+ else
1543
+ # do nothing
1544
+ end
1545
+ }
1546
+ h
1547
+ end
1548
+
1549
+ def kanji_metrics_displayof(win, option=nil)
1550
+ win = '.' unless win
1551
+ if @latinfont == nil
1552
+ metrics_core(@compoundfont, win, option) # use @compoundfont
1553
+ elsif JAPANIZED_TK
1554
+ metrics_core(@kanjifont, win, option)
1555
+ else
1556
+ metrics_core_tk4x(nil, win, option)
1557
+ end
1558
+ end
1559
+ def kanji_metrics_hash_displayof(win, option=nil)
1560
+ if option
1561
+ val = kanji_metrics_displayof(win, option)
1562
+ case TkFont::MetricsType[option.to_s]
1563
+ when ?n
1564
+ val = TkComm::num_or_str(val)
1565
+ when ?b
1566
+ val = TkComm::bool(val)
1567
+ else
1568
+ # do nothing
1569
+ end
1570
+ return val
1571
+ end
1572
+
1573
+ h = Hash[kanji_metrics_displayof(win, option)]
1574
+ h.keys.each{|k|
1575
+ case TkFont::MetricsType[k.to_s]
1576
+ when ?n
1577
+ h[k] = TkComm::num_or_str(h[k])
1578
+ when ?b
1579
+ h[k] = TkComm::bool(h[k])
1580
+ else
1581
+ # do nothing
1582
+ end
1583
+ }
1584
+ h
1585
+ end
1586
+
1587
+ def reset_pointadjust
1588
+ begin
1589
+ if /^8\..*/ === Tk::TK_VERSION && JAPANIZED_TK
1590
+ configure('pointadjust' => latin_actual.assoc('size')[1].to_f /
1591
+ kanji_actual.assoc('size')[1].to_f )
1592
+ end
1593
+ rescue
1594
+ end
1595
+ self
1596
+ end
1597
+
1598
+ ###################################
1599
+ # private alias
1600
+ ###################################
1601
+ case (Tk::TK_VERSION)
1602
+ when /^4\..*/
1603
+ alias create_latinfont create_latinfont_tk4x
1604
+ alias create_kanjifont create_kanjifont_tk4x
1605
+ alias create_compoundfont create_compoundfont_tk4x
1606
+
1607
+ when /^8\.[0-5]/
1608
+ alias create_latinfont create_latinfont_tk8x
1609
+ alias create_kanjifont create_kanjifont_tk8x
1610
+ alias create_compoundfont create_compoundfont_tk8x
1611
+
1612
+ else
1613
+ alias create_latinfont create_latinfont_tk8x
1614
+ alias create_kanjifont create_kanjifont_tk8x
1615
+ alias create_compoundfont create_compoundfont_tk8x
1616
+
1617
+ end
1618
+
1619
+ ###################################
1620
+ # public alias
1621
+ ###################################
1622
+ alias ascii_font latin_font
1623
+ alias asciifont latinfont
1624
+ alias create_asciifont create_latinfont
1625
+ alias ascii_actual latin_actual
1626
+ alias ascii_actual_displayof latin_actual_displayof
1627
+ alias ascii_configure latin_configure
1628
+ alias ascii_configinfo latin_configinfo
1629
+ alias ascii_replace latin_replace
1630
+ alias ascii_metrics latin_metrics
1631
+
1632
+ ###################################
1633
+ =begin
1634
+ def dup
1635
+ TkFont.new(self)
1636
+ end
1637
+ def clone
1638
+ TkFont.new(self)
1639
+ end
1640
+ =end
1641
+ end
1642
+
1643
+ module TkFont::CoreMethods
1644
+ include Tk
1645
+ extend TkCore
1646
+
1647
+ private
1648
+
1649
+ def actual_core_tk4x(font, win=nil, option=nil)
1650
+ # dummy
1651
+ if option == 'pointadjust' || option == :pointadjust
1652
+ 1.0
1653
+ elsif option
1654
+ case TkFont::OptionType[option.to_s]
1655
+ when ?n
1656
+ 0
1657
+ when ?b
1658
+ false
1659
+ else
1660
+ ''
1661
+ end
1662
+ else
1663
+ [['family',''], ['size',0], ['weight',''], ['slant',''],
1664
+ ['underline',false], ['overstrike',false], ['charset',''],
1665
+ ['pointadjust',0]]
1666
+ end
1667
+ end
1668
+
1669
+ def actual_core_tk8x(font, win=nil, option=nil)
1670
+ font = '{}' if font == ''
1671
+
1672
+ if option == 'compound' || option == :compound
1673
+ ""
1674
+ elsif option
1675
+ if win
1676
+ val = tk_call('font', 'actual', font,
1677
+ "-displayof", win, "-#{option}")
1678
+ else
1679
+ val = tk_call('font', 'actual', font, "-#{option}")
1680
+ end
1681
+ case TkFont::OptionType[option.to_s]
1682
+ when ?n
1683
+ num_or_str(val)
1684
+ when ?b
1685
+ bool(val)
1686
+ else
1687
+ val
1688
+ end
1689
+ else
1690
+ l = tk_split_simplelist(if win
1691
+ tk_call('font', 'actual', font,
1692
+ "-displayof", win)
1693
+ else
1694
+ tk_call('font', 'actual', font)
1695
+ end)
1696
+ r = []
1697
+ while key=l.shift
1698
+ if key == '-compound'
1699
+ l.shift
1700
+ else
1701
+ key = key[1..-1]
1702
+ val = l.shift
1703
+ case TkFont::OptionType[key]
1704
+ when ?n
1705
+ r.push [key, num_or_str(val)]
1706
+ when ?b
1707
+ r.push [key, bool(val)]
1708
+ else
1709
+ r.push [key, val]
1710
+ end
1711
+ end
1712
+ end
1713
+ r
1714
+ end
1715
+ end
1716
+
1717
+ def configure_core_tk4x(font, slot, value=None)
1718
+ #""
1719
+ self
1720
+ end
1721
+
1722
+ def configinfo_core_tk4x(font, option=nil)
1723
+ # dummy
1724
+ if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
1725
+ if option == 'pointadjust' || option == :pointadjust
1726
+ 1.0
1727
+ elsif option
1728
+ case TkFont::OptionType[option.to_s]
1729
+ when ?n
1730
+ 0
1731
+ when ?b
1732
+ false
1733
+ else
1734
+ ''
1735
+ end
1736
+ else
1737
+ [['family',''], ['size',0], ['weight',''], ['slant',''],
1738
+ ['underline',false], ['overstrike',false], ['charset',''],
1739
+ ['pointadjust',1.0]]
1740
+ end
1741
+ else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
1742
+ current_configinfo_core_tk4x(font, option)
1743
+ end
1744
+ end
1745
+
1746
+ def current_configinfo_core_tk4x(font, option=nil)
1747
+ if option
1748
+ case TkFont::OptionType[option.to_s]
1749
+ when ?n
1750
+ 0
1751
+ when ?b
1752
+ false
1753
+ else
1754
+ ''
1755
+ end
1756
+ else
1757
+ {'family'=>'', 'size'=>0, 'weight'=>'', 'slant'=>'',
1758
+ 'underline'=>false, 'overstrike'=>false,
1759
+ 'charset'=>false, 'pointadjust'=>1.0}
1760
+ end
1761
+ end
1762
+
1763
+ def configure_core_tk8x(font, slot, value=None)
1764
+ if JAPANIZED_TK
1765
+ begin
1766
+ padjust = tk_call('font', 'configure', font, '-pointadjust')
1767
+ rescue
1768
+ padjust = nil
1769
+ end
1770
+ else
1771
+ padjust = nil
1772
+ end
1773
+ if slot.kind_of? Hash
1774
+ if JAPANIZED_TK && (slot.key?('family') || slot.key?(:family))
1775
+ slot = _symbolkey2str(slot)
1776
+ configure_core_tk8x(font, 'family', slot.delete('family'))
1777
+ end
1778
+
1779
+ if ((slot.key?('size') || slot.key?(:size)) &&
1780
+ padjust && !slot.key?('pointadjust') && !slot.key?(:pointadjust))
1781
+ tk_call('font', 'configure', font,
1782
+ '-pointadjust', padjust, *hash_kv(slot))
1783
+ else
1784
+ tk_call('font', 'configure', font, *hash_kv(slot))
1785
+ end
1786
+ elsif (slot == 'size' || slot == :size) && padjust != nil
1787
+ tk_call('font', 'configure', font,
1788
+ "-#{slot}", value, '-pointadjust', padjust)
1789
+ elsif JAPANIZED_TK && (slot == 'family' || slot == :family)
1790
+ # compound font?
1791
+ begin
1792
+ compound = tk_split_simplelist(tk_call('font', 'configure',
1793
+ font, '-compound'))
1794
+ rescue
1795
+ tk_call('font', 'configure', font, '-family', value)
1796
+ return self
1797
+ end
1798
+ if compound == []
1799
+ tk_call('font', 'configure', font, '-family', value)
1800
+ return self
1801
+ end
1802
+ ltn, knj = compound
1803
+
1804
+ lfnt = tk_call('font', 'create', '-copy', ltn)
1805
+ begin
1806
+ tk_call('font', 'configure', lfnt, '-family', value)
1807
+ latin_replace_core_tk8x(lfnt)
1808
+ rescue RuntimeError => e
1809
+ fail e if $DEBUG
1810
+ ensure
1811
+ tk_call('font', 'delete', lfnt) if lfnt != ''
1812
+ end
1813
+
1814
+ kfnt = tk_call('font', 'create', '-copy', knj)
1815
+ begin
1816
+ tk_call('font', 'configure', kfnt, '-family', value)
1817
+ kanji_replace_core_tk8x(lfnt)
1818
+ rescue RuntimeError => e
1819
+ fail e if $DEBUG
1820
+ ensure
1821
+ tk_call('font', 'delete', kfnt) if kfnt != ''
1822
+ end
1823
+
1824
+ else
1825
+ tk_call('font', 'configure', font, "-#{slot}", value)
1826
+ end
1827
+ self
1828
+ end
1829
+
1830
+ def configinfo_core_tk8x(font, option=nil)
1831
+ if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
1832
+ if option == 'compound' || option == :compound
1833
+ ""
1834
+ elsif option
1835
+ val = tk_call('font', 'configure', font, "-#{option}")
1836
+ case TkFont::OptionType[option.to_s]
1837
+ when ?n
1838
+ num_or_str(val)
1839
+ when ?b
1840
+ bool(val)
1841
+ else
1842
+ val
1843
+ end
1844
+ else
1845
+ l = tk_split_simplelist(tk_call('font', 'configure', font))
1846
+ r = []
1847
+ while key=l.shift
1848
+ if key == '-compound'
1849
+ l.shift
1850
+ else
1851
+ key = key[1..-1]
1852
+ val = l.shift
1853
+ case TkFont::OptionType[key]
1854
+ when ?n
1855
+ r.push [key, num_or_str(val)]
1856
+ when ?b
1857
+ r.push [key, bool(val)]
1858
+ else
1859
+ r.push [key, val]
1860
+ end
1861
+ end
1862
+ end
1863
+ r
1864
+ end
1865
+ else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
1866
+ current_configinfo_core_tk8x(font, option)
1867
+ end
1868
+ end
1869
+
1870
+ def current_configinfo_core_tk8x(font, option=nil)
1871
+ if option == 'compound'
1872
+ ""
1873
+ elsif option
1874
+ val = tk_call('font', 'configure', font, "-#{option}")
1875
+ case TkFont::OptionType[option.to_s]
1876
+ when ?n
1877
+ num_or_str(val)
1878
+ when ?b
1879
+ bool(val)
1880
+ else
1881
+ val
1882
+ end
1883
+ else
1884
+ l = tk_split_simplelist(tk_call('font', 'configure', font))
1885
+ h = {}
1886
+ while key=l.shift
1887
+ if key == '-compound'
1888
+ l.shift
1889
+ else
1890
+ key = key[1..-1]
1891
+ val = l.shift
1892
+ case TkFont::OptionType[key]
1893
+ when ?n
1894
+ h[key] = num_or_str(val)
1895
+ when ?b
1896
+ h[key] = bool(val)
1897
+ else
1898
+ h[key] = val
1899
+ end
1900
+ end
1901
+ end
1902
+ h
1903
+ end
1904
+ end
1905
+
1906
+ def delete_core_tk4x
1907
+ TkFont::Tk_FontNameTBL.mutex.synchronize{
1908
+ TkFont::Tk_FontNameTBL.delete(@id)
1909
+ }
1910
+ TkFont::Tk_FontUseTBL.mutex.synchronize{
1911
+ TkFont::Tk_FontUseTBL.delete_if{|key,value| value == self}
1912
+ }
1913
+ end
1914
+
1915
+ def delete_core_tk8x
1916
+ begin
1917
+ tk_call('font', 'delete', @latinfont) if @latinfont
1918
+ rescue
1919
+ end
1920
+ begin
1921
+ tk_call('font', 'delete', @kanjifont) if @kanjifont
1922
+ rescue
1923
+ end
1924
+ begin
1925
+ tk_call('font', 'delete', @compoundfont) if @compoundfont
1926
+ rescue
1927
+ end
1928
+ TkFont::Tk_FontNameTBL.mutex.synchronize{
1929
+ TkFont::Tk_FontNameTBL.delete(@id)
1930
+ }
1931
+ TkFont::Tk_FontUseTBL.mutex.synchronize{
1932
+ TkFont::Tk_FontUseTBL.delete_if{|key,value| value == self}
1933
+ }
1934
+ end
1935
+
1936
+ def latin_replace_core_tk4x(ltn)
1937
+ create_latinfont_tk4x(ltn)
1938
+ @compoundfont[0] = [@latinfont] if JAPANIZED_TK
1939
+ @fontslot['font'] = @latinfont
1940
+ table = nil
1941
+ TkFont::Tk_FontUseTBL.mutex.synchronize{
1942
+ table = TkFont::Tk_FontUseTBL.clone
1943
+ }
1944
+ table.each{|w, fobj|
1945
+ if self == fobj
1946
+ begin
1947
+ if w.include?(';')
1948
+ win, tag, optkey = w.split(';')
1949
+ optkey = 'font' if optkey == nil || optkey == ''
1950
+ winobj = tk_tcl2ruby(win)
1951
+ # winobj.tagfont_configure(tag, {'font'=>@latinfont})
1952
+ #if winobj.kind_of? TkText
1953
+ if winobj.kind_of?(TkText) || winobj.kind_of?(Tk::Text)
1954
+ tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @latinfont)
1955
+ #elsif winobj.kind_of? TkCanvas
1956
+ elsif winobj.kind_of?(TkCanvas) || winobj.kind_of?(Tk::Canvas)
1957
+ tk_call(win, 'itemconfigure', tag, "-#{optkey}", @latinfont)
1958
+ #elsif winobj.kind_of? TkMenu
1959
+ elsif winobj.kind_of?(TkMenu) || winobj.kind_of?(Tk::Menu)
1960
+ tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
1961
+ else
1962
+ raise RuntimeError, "unknown widget type"
1963
+ end
1964
+ else
1965
+ # tk_tcl2ruby(w).font_configure('font'=>@latinfont)
1966
+ tk_call(w, 'configure', '-font', @latinfont)
1967
+ end
1968
+ rescue
1969
+ TkFont::Tk_FontUseTBL.mutex.synchronize{
1970
+ TkFont::Tk_FontUseTBL.delete(w)
1971
+ }
1972
+ end
1973
+ end
1974
+ }
1975
+ self
1976
+ end
1977
+
1978
+ def kanji_replace_core_tk4x(knj)
1979
+ return self unless JAPANIZED_TK
1980
+
1981
+ create_kanjifont_tk4x(knj)
1982
+ @compoundfont[1] = [@kanjifont]
1983
+ @fontslot['kanjifont'] = @kanjifont
1984
+ table = nil
1985
+ TkFont::Tk_FontUseTBL.mutex.synchronize{
1986
+ table = TkFont::Tk_FontUseTBL.clone
1987
+ }
1988
+ table.dup.each{|w, fobj|
1989
+ if self == fobj
1990
+ begin
1991
+ if w.include?(';')
1992
+ win, tag, optkey = w.split(';')
1993
+ optkey = 'kanjifont' unless optkey
1994
+ winobj = tk_tcl2ruby(win)
1995
+ # winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
1996
+ #if winobj.kind_of? TkText
1997
+ if winobj.kind_of?(TkText) || winobj.kind_of?(Tk::Text)
1998
+ tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @kanjifont)
1999
+ #elsif winobj.kind_of? TkCanvas
2000
+ elsif winobj.kind_of?(TkCanvas) || winobj.kind_of?(Tk::Canvas)
2001
+ tk_call(win, 'itemconfigure', tag, "-#{optkey}", @kanjifont)
2002
+ #elsif winobj.kind_of? TkMenu
2003
+ elsif winobj.kind_of?(TkMenu) || winobj.kind_of?(Tk::Menu)
2004
+ tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
2005
+ else
2006
+ raise RuntimeError, "unknown widget type"
2007
+ end
2008
+ else
2009
+ # tk_tcl2ruby(w).font_configure('kanjifont'=>@kanjifont)
2010
+ tk_call(w, 'configure', '-kanjifont', @kanjifont)
2011
+ end
2012
+ rescue
2013
+ Tk_FontUseTBL.mutex.synchronize{
2014
+ TkFont::Tk_FontUseTBL.delete(w)
2015
+ }
2016
+ end
2017
+ end
2018
+ }
2019
+ self
2020
+ end
2021
+
2022
+ def latin_replace_core_tk8x(ltn)
2023
+ ltn = '{}' if ltn == ''
2024
+
2025
+ if JAPANIZED_TK
2026
+ begin
2027
+ tk_call('font', 'delete', '@font_tmp')
2028
+ rescue
2029
+ end
2030
+ begin
2031
+ fnt_bup = tk_call('font', 'create', '@font_tmp', '-copy', @latinfont)
2032
+ rescue
2033
+ #fnt_bup = ''
2034
+ fnt_bup = TkFont::DEFAULT_LATIN_FONT_NAME
2035
+ end
2036
+ end
2037
+
2038
+ begin
2039
+ tk_call('font', 'delete', @latinfont)
2040
+ rescue
2041
+ end
2042
+ create_latinfont(ltn)
2043
+
2044
+ if JAPANIZED_TK
2045
+ keys = self.configinfo
2046
+ tk_call('font', 'delete', @compoundfont)
2047
+ begin
2048
+ tk_call('font', 'create', @compoundfont,
2049
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
2050
+ =begin
2051
+ latinkeys = {}
2052
+ begin
2053
+ actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
2054
+ rescue
2055
+ latinkeys = {}
2056
+ end
2057
+ if latinkeys != {}
2058
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
2059
+ end
2060
+ =end
2061
+ rescue RuntimeError => e
2062
+ tk_call('font', 'delete', @latinfont)
2063
+ if fnt_bup && fnt_bup != ''
2064
+ tk_call('font', 'create', @latinfont, '-copy', fnt_bup)
2065
+ tk_call('font', 'create', @compoundfont,
2066
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
2067
+ tk_call('font', 'delete', fnt_bup)
2068
+ else
2069
+ fail e
2070
+ end
2071
+ end
2072
+
2073
+ else
2074
+ latinkeys = {}
2075
+ begin
2076
+ actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
2077
+ rescue
2078
+ latinkeys = {}
2079
+ end
2080
+ begin
2081
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
2082
+ rescue
2083
+ # not exist? (deleted?) -> create font
2084
+ tk_call('font', 'create', @compoundfont, *hash_kv(latinkeys))
2085
+ end
2086
+ end
2087
+ self
2088
+ end
2089
+
2090
+ def kanji_replace_core_tk8x(knj)
2091
+ knj = '{}' if knj == ''
2092
+
2093
+ if JAPANIZED_TK
2094
+ begin
2095
+ tk_call('font', 'delete', '@font_tmp')
2096
+ rescue
2097
+ end
2098
+ begin
2099
+ fnt_bup = tk_call('font', 'create', '@font_tmp', '-copy', @kanjifont)
2100
+ rescue
2101
+ #fnt_bup = ''
2102
+ fnt_bup = TkFont::DEFAULT_KANJI_FONT_NAME
2103
+ end
2104
+ end
2105
+
2106
+ begin
2107
+ tk_call('font', 'delete', @kanjifont)
2108
+ rescue
2109
+ end
2110
+ create_kanjifont(knj)
2111
+
2112
+ if JAPANIZED_TK
2113
+ keys = self.configinfo
2114
+ tk_call('font', 'delete', @compoundfont)
2115
+ begin
2116
+ tk_call('font', 'create', @compoundfont,
2117
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
2118
+ rescue RuntimeError => e
2119
+ tk_call('font', 'delete', @kanjifont)
2120
+ if fnt_bup && fnt_bup != ''
2121
+ tk_call('font', 'create', @kanjifont, '-copy', fnt_bup)
2122
+ tk_call('font', 'create', @compoundfont,
2123
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
2124
+ tk_call('font', 'delete', fnt_bup)
2125
+ else
2126
+ fail e
2127
+ end
2128
+ end
2129
+ end
2130
+ self
2131
+ end
2132
+
2133
+ def measure_core_tk4x(font, win, text)
2134
+ 0
2135
+ end
2136
+
2137
+ def measure_core_tk8x(font, win, text)
2138
+ font = '{}' if font == ''
2139
+
2140
+ if win
2141
+ number(tk_call('font', 'measure', font,
2142
+ '-displayof', win, text))
2143
+ else
2144
+ number(tk_call('font', 'measure', font, text))
2145
+ end
2146
+ end
2147
+
2148
+ def metrics_core_tk4x(font, win, option=nil)
2149
+ # dummy
2150
+ if option
2151
+ ""
2152
+ else
2153
+ [['ascent',[]], ['descent',[]], ['linespace',[]], ['fixed',[]]]
2154
+ end
2155
+ end
2156
+
2157
+ def metrics_core_tk8x(font, win, option=nil)
2158
+ font = '{}' if font == ''
2159
+
2160
+ if option
2161
+ if win
2162
+ number(tk_call('font', 'metrics', font,
2163
+ "-displayof", win, "-#{option}"))
2164
+ else
2165
+ number(tk_call('font', 'metrics', font, "-#{option}"))
2166
+ end
2167
+ else
2168
+ l = tk_split_list(if win
2169
+ tk_call('font','metrics',font,"-displayof",win)
2170
+ else
2171
+ tk_call('font','metrics',font)
2172
+ end)
2173
+ r = []
2174
+ while key=l.shift
2175
+ r.push [key[1..-1], l.shift.to_i]
2176
+ =begin
2177
+ if key == '-fixed' # boolean value
2178
+ r.push [key[1..-1], bool(l.shift)]
2179
+ else
2180
+ r.push [key[1..-1], l.shift.to_i]
2181
+ end
2182
+ =end
2183
+ end
2184
+ r
2185
+ end
2186
+ end
2187
+
2188
+ ###################################
2189
+ # private alias
2190
+ ###################################
2191
+ case (Tk::TK_VERSION)
2192
+ when /^4\..*/
2193
+ alias actual_core actual_core_tk4x
2194
+ alias configure_core configure_core_tk4x
2195
+ alias configinfo_core configinfo_core_tk4x
2196
+ alias current_configinfo_core current_configinfo_core_tk4x
2197
+ alias delete_core delete_core_tk4x
2198
+ alias latin_replace_core latin_replace_core_tk4x
2199
+ alias kanji_replace_core kanji_replace_core_tk4x
2200
+ alias measure_core measure_core_tk4x
2201
+ alias metrics_core metrics_core_tk4x
2202
+
2203
+ when /^8\.[0-9]/
2204
+ alias actual_core actual_core_tk8x
2205
+ alias configure_core configure_core_tk8x
2206
+ alias configinfo_core configinfo_core_tk8x
2207
+ alias current_configinfo_core current_configinfo_core_tk8x
2208
+ alias delete_core delete_core_tk8x
2209
+ alias latin_replace_core latin_replace_core_tk8x
2210
+ alias kanji_replace_core kanji_replace_core_tk8x
2211
+ alias measure_core measure_core_tk8x
2212
+ alias metrics_core metrics_core_tk8x
2213
+
2214
+ else
2215
+ alias actual_core actual_core_tk8x
2216
+ alias configure_core configure_core_tk8x
2217
+ alias configinfo_core configinfo_core_tk8x
2218
+ alias current_configinfo_core current_configinfo_core_tk8x
2219
+ alias delete_core delete_core_tk8x
2220
+ alias latin_replace_core latin_replace_core_tk8x
2221
+ alias kanji_replace_core kanji_replace_core_tk8x
2222
+ alias measure_core measure_core_tk8x
2223
+ alias metrics_core metrics_core_tk8x
2224
+
2225
+ end
2226
+ end
2227
+
2228
+ class TkFont
2229
+ include TkFont::CoreMethods
2230
+ extend TkFont::CoreMethods
2231
+ end
2232
+
2233
+ class TkNamedFont < TkFont
2234
+ # for built-in named fonts
2235
+ def TkNamedFont.find(name)
2236
+ name = name.to_s
2237
+ unless (obj = Tk_FontNameTBL[name])
2238
+ obj = self.new(name) if TkFont.is_system_font?(name)
2239
+ end
2240
+ obj
2241
+ end
2242
+
2243
+ def TkNamedFont.new(name, keys=nil)
2244
+ name = name.to_s
2245
+ obj = nil
2246
+ Tk_FontNameTBL.mutex.synchronize{
2247
+ unless (obj = Tk_FontNameTBL[name])
2248
+ (obj = self.allocate).instance_eval{
2249
+ @id = @compoundfont = name.to_s
2250
+ @latinfont = nil
2251
+ @kanjifont = nil
2252
+ @descendant = [self, self] # [latin, kanji] : dummy
2253
+ Tk_FontNameTBL[@id] = self
2254
+ }
2255
+ end
2256
+ }
2257
+ obj.instance_eval{ initialize(name, keys) }
2258
+ obj
2259
+ end
2260
+
2261
+ ###########################
2262
+ private
2263
+ ###########################
2264
+ def initialize(name, keys=nil)
2265
+ @id = @compoundfont = name.to_s
2266
+
2267
+ # if not exist named font, create it.
2268
+ begin
2269
+ if keys
2270
+ tk_call('font', 'configure', @compoundfont, keys)
2271
+ else
2272
+ tk_call('font', 'configure', @compoundfont)
2273
+ end
2274
+ rescue
2275
+ # the named font doesn't exist -> create
2276
+ if keys
2277
+ tk_call('font', 'create', @compoundfont, keys)
2278
+ else
2279
+ tk_call('font', 'create', @compoundfont)
2280
+ end
2281
+ end
2282
+ end
2283
+
2284
+ def create_latinfont(fnt)
2285
+ # ignore
2286
+ end
2287
+ def create_kanjifont(fnt)
2288
+ # ignore
2289
+ end
2290
+ def create_compoundfont(ltn, knj, keys)
2291
+ # ignore
2292
+ end
2293
+
2294
+ ###########################
2295
+ public
2296
+ ###########################
2297
+ def latin_font_id
2298
+ @compoundfont
2299
+ end
2300
+ def kanji_font_id
2301
+ @compoundfont
2302
+ end
2303
+ end
2304
+
2305
+ #######################################
2306
+ # define system font names
2307
+ #######################################
2308
+ if Tk::TCL_MAJOR_VERSION > 8 ||
2309
+ (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
2310
+ # add standard fonts of Tcl/Tk 8.5+
2311
+ TkFont::SYSTEM_FONT_NAMES.add [
2312
+ 'TkDefaultFont', 'TkTextFont', 'TkFixedFont', 'TkMenuFont',
2313
+ 'TkHeadingFont', 'TkCaptionFont', 'TkSmallCaptionFont',
2314
+ 'TkIconFont', 'TkTooltipFont'
2315
+ ]
2316
+ end
2317
+
2318
+ # platform-specific fonts
2319
+ # -- windows
2320
+ TkFont::SYSTEM_FONT_NAMES.add [
2321
+ 'ansifixed', 'ansi', 'device', 'oemfixed', 'systemfixed', 'system'
2322
+ ]
2323
+
2324
+ # -- macintosh, macosx
2325
+ TkFont::SYSTEM_FONT_NAMES.add ['system', 'application']
2326
+
2327
+ if Tk::TCL_MAJOR_VERSION > 8 ||
2328
+ (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
2329
+ TkFont::SYSTEM_FONT_NAMES.add ['menu']
2330
+ end
2331
+
2332
+ # -- macosx (Aqua theme)
2333
+ if Tk::TCL_MAJOR_VERSION > 8 ||
2334
+ (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5)
2335
+ TkFont::SYSTEM_FONT_NAMES.add [
2336
+ 'systemSystemFont', 'systemEmphasizedSystemFont',
2337
+ 'systemSmallSystemFont', 'systemSmallEmphasizedSystemFont',
2338
+ 'systemApplicationFont', 'systemLabelFont', 'systemViewsFont',
2339
+ 'systemMenuTitleFont', 'systemMenuItemFont', 'systemMenuItemMarkFont',
2340
+ 'systemMenuItemCmdKeyFont', 'systemWindowTitleFont',
2341
+ 'systemPushButtonFont', 'systemUtilityWindowTitleFont',
2342
+ 'systemAlertHeaderFont', 'systemToolbarFont', 'systemMiniSystemFont',
2343
+ 'systemDetailSystemFont', 'systemDetailEmphasizedSystemFont'
2344
+ ]
2345
+ end
2346
+
2347
+ #######################################
2348
+ # autoload
2349
+ #######################################
2350
+ class TkFont
2351
+ autoload :Chooser, 'tk/fontchooser'
2352
+ end