From 41b74c6e208e54d453036619c2be7f731550a308 Mon Sep 17 00:00:00 2001 From: nagai Date: Sun, 12 Jul 2009 23:09:52 +0000 Subject: [PATCH] * ext/tk/extconf.rb: New strategy for searching Tcl/Tk libraries. * ext/tk/*: Support new features of Tcl/Tk8.6b1 and minor bug fixes. ( [KNOWN BUG] Ruby/Tk on Ruby 1.9 will not work on Cygwin. ) * ext/tk/*: Unify sources between Ruby 1.8 & 1.9. Improve default_widget_set handling. * ext/tk/*: Multi-TkInterpreter (multi-tk.rb) works on Ruby 1.8 & 1.9. ( [KNOWN BUG] On Ruby 1.8, join to a long term Thread on Tk callbacks may freeze. On Ruby 1.9, cannot create a second master interpreter (creating slaves are OK); supported master interpreter is the default master interpreter only. ) * ext/tk/lib/tkextlib/*: Update supported versions of Tk extensions. Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5 BWidgets 1.7 ==> BWidgets 1.8 TkTable 2.9 ==> TkTable 2.10 TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9 Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1 IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15 TclX 2005-02-07 ==> TclX 2008-12-15 Trofs 0.4.3 ==> Trofs 0.4.4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 26 + ext/tk/ChangeLog.tkextlib | 14 + ext/tk/MANUAL_tcltklib.eng | 8 +- ext/tk/MANUAL_tcltklib.eucj | 9 +- ext/tk/README.ActiveTcl | 13 + ext/tk/README.tcltklib | 43 +- ext/tk/config_list.in | 35 + ext/tk/extconf.rb | 1132 ++++- ext/tk/lib/multi-tk.rb | 645 ++- ext/tk/lib/remote-tk.rb | 34 +- ext/tk/lib/tcltk.rb | 18 +- ext/tk/lib/tk.rb | 654 ++- ext/tk/lib/tk/autoload.rb | 494 +- ext/tk/lib/tk/bindtag.rb | 2 +- ext/tk/lib/tk/busy.rb | 118 + ext/tk/lib/tk/button.rb | 5 +- ext/tk/lib/tk/canvas.rb | 75 +- ext/tk/lib/tk/canvastag.rb | 33 +- ext/tk/lib/tk/checkbutton.rb | 8 +- ext/tk/lib/tk/composite.rb | 48 +- ext/tk/lib/tk/console.rb | 6 +- ext/tk/lib/tk/dialog.rb | 30 +- ext/tk/lib/tk/encodedstr.rb | 6 +- ext/tk/lib/tk/entry.rb | 5 +- ext/tk/lib/tk/event.rb | 222 +- ext/tk/lib/tk/font.rb | 139 +- ext/tk/lib/tk/fontchooser.rb | 166 + ext/tk/lib/tk/frame.rb | 5 +- ext/tk/lib/tk/grid.rb | 14 +- ext/tk/lib/tk/image.rb | 6 +- ext/tk/lib/tk/itemconfig.rb | 151 +- ext/tk/lib/tk/itemfont.rb | 36 +- ext/tk/lib/tk/kinput.rb | 6 +- ext/tk/lib/tk/label.rb | 5 +- ext/tk/lib/tk/labelframe.rb | 6 +- ext/tk/lib/tk/listbox.rb | 38 +- ext/tk/lib/tk/macpkg.rb | 4 +- ext/tk/lib/tk/menu.rb | 113 +- ext/tk/lib/tk/menubar.rb | 44 +- ext/tk/lib/tk/menuspec.rb | 237 +- ext/tk/lib/tk/message.rb | 6 +- ext/tk/lib/tk/mngfocus.rb | 4 +- ext/tk/lib/tk/msgcat.rb | 58 +- ext/tk/lib/tk/namespace.rb | 28 +- ext/tk/lib/tk/optiondb.rb | 48 +- ext/tk/lib/tk/optionobj.rb | 18 +- ext/tk/lib/tk/palette.rb | 4 +- ext/tk/lib/tk/panedwindow.rb | 44 +- ext/tk/lib/tk/place.rb | 12 +- ext/tk/lib/tk/radiobutton.rb | 8 +- ext/tk/lib/tk/root.rb | 10 +- ext/tk/lib/tk/scale.rb | 13 +- ext/tk/lib/tk/scrollbar.rb | 22 +- ext/tk/lib/tk/selection.rb | 6 +- ext/tk/lib/tk/spinbox.rb | 45 +- ext/tk/lib/tk/text.rb | 168 +- ext/tk/lib/tk/textimage.rb | 10 +- ext/tk/lib/tk/textmark.rb | 12 +- ext/tk/lib/tk/texttag.rb | 27 +- ext/tk/lib/tk/textwindow.rb | 20 +- ext/tk/lib/tk/timer.rb | 40 +- ext/tk/lib/tk/toplevel.rb | 22 +- ext/tk/lib/tk/ttk_selector.rb | 94 +- ext/tk/lib/tk/validation.rb | 28 +- ext/tk/lib/tk/variable.rb | 140 +- ext/tk/lib/tk/virtevent.rb | 10 +- ext/tk/lib/tk/winfo.rb | 10 +- ext/tk/lib/tk/winpkg.rb | 11 +- ext/tk/lib/tk/wm.rb | 10 +- ext/tk/lib/tk/xim.rb | 4 +- ext/tk/lib/tkextlib/ICONS/icons.rb | 8 +- ext/tk/lib/tkextlib/ICONS/setup.rb | 4 +- ext/tk/lib/tkextlib/SUPPORT_STATUS | 24 +- ext/tk/lib/tkextlib/blt.rb | 2 + ext/tk/lib/tkextlib/blt/barchart.rb | 6 +- ext/tk/lib/tkextlib/blt/bitmap.rb | 2 +- ext/tk/lib/tkextlib/blt/busy.rb | 1 + ext/tk/lib/tkextlib/blt/component.rb | 173 +- ext/tk/lib/tkextlib/blt/container.rb | 2 +- ext/tk/lib/tkextlib/blt/dragdrop.rb | 23 +- ext/tk/lib/tkextlib/blt/graph.rb | 4 +- ext/tk/lib/tkextlib/blt/htext.rb | 3 +- ext/tk/lib/tkextlib/blt/setup.rb | 4 +- ext/tk/lib/tkextlib/blt/stripchart.rb | 6 +- ext/tk/lib/tkextlib/blt/table.rb | 15 +- ext/tk/lib/tkextlib/blt/tabnotebook.rb | 4 +- ext/tk/lib/tkextlib/blt/tabset.rb | 8 +- ext/tk/lib/tkextlib/blt/ted.rb | 5 +- ext/tk/lib/tkextlib/blt/tile.rb | 4 + ext/tk/lib/tkextlib/blt/tree.rb | 56 +- ext/tk/lib/tkextlib/blt/treeview.rb | 61 +- ext/tk/lib/tkextlib/blt/unix_dnd.rb | 8 +- ext/tk/lib/tkextlib/blt/vector.rb | 4 +- ext/tk/lib/tkextlib/blt/watch.rb | 2 +- ext/tk/lib/tkextlib/blt/winop.rb | 12 +- ext/tk/lib/tkextlib/bwidget.rb | 2 + ext/tk/lib/tkextlib/bwidget/arrowbutton.rb | 2 +- ext/tk/lib/tkextlib/bwidget/button.rb | 2 +- ext/tk/lib/tkextlib/bwidget/buttonbox.rb | 2 +- ext/tk/lib/tkextlib/bwidget/combobox.rb | 13 +- ext/tk/lib/tkextlib/bwidget/dialog.rb | 18 +- ext/tk/lib/tkextlib/bwidget/entry.rb | 2 +- ext/tk/lib/tkextlib/bwidget/label.rb | 2 +- ext/tk/lib/tkextlib/bwidget/labelentry.rb | 2 +- ext/tk/lib/tkextlib/bwidget/labelframe.rb | 2 +- ext/tk/lib/tkextlib/bwidget/listbox.rb | 27 +- ext/tk/lib/tkextlib/bwidget/mainframe.rb | 6 +- ext/tk/lib/tkextlib/bwidget/messagedlg.rb | 4 +- ext/tk/lib/tkextlib/bwidget/notebook.rb | 8 +- ext/tk/lib/tkextlib/bwidget/pagesmanager.rb | 2 +- ext/tk/lib/tkextlib/bwidget/panedwindow.rb | 7 +- ext/tk/lib/tkextlib/bwidget/panelframe.rb | 14 +- ext/tk/lib/tkextlib/bwidget/passwddlg.rb | 8 +- ext/tk/lib/tkextlib/bwidget/progressbar.rb | 2 +- ext/tk/lib/tkextlib/bwidget/progressdlg.rb | 2 +- .../lib/tkextlib/bwidget/scrollableframe.rb | 2 +- ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb | 12 +- ext/tk/lib/tkextlib/bwidget/scrollview.rb | 2 +- ext/tk/lib/tkextlib/bwidget/selectcolor.rb | 6 +- ext/tk/lib/tkextlib/bwidget/selectfont.rb | 9 +- ext/tk/lib/tkextlib/bwidget/separator.rb | 2 +- ext/tk/lib/tkextlib/bwidget/setup.rb | 4 +- ext/tk/lib/tkextlib/bwidget/spinbox.rb | 2 +- ext/tk/lib/tkextlib/bwidget/statusbar.rb | 18 +- ext/tk/lib/tkextlib/bwidget/titleframe.rb | 2 +- ext/tk/lib/tkextlib/bwidget/tree.rb | 81 +- ext/tk/lib/tkextlib/itcl/incr_tcl.rb | 4 +- ext/tk/lib/tkextlib/itcl/setup.rb | 4 +- ext/tk/lib/tkextlib/itk/incr_tk.rb | 10 +- ext/tk/lib/tkextlib/itk/setup.rb | 4 +- ext/tk/lib/tkextlib/iwidgets/buttonbox.rb | 5 +- ext/tk/lib/tkextlib/iwidgets/calendar.rb | 4 +- .../lib/tkextlib/iwidgets/canvasprintbox.rb | 2 +- .../tkextlib/iwidgets/canvasprintdialog.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/checkbox.rb | 5 +- ext/tk/lib/tkextlib/iwidgets/combobox.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/dateentry.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/datefield.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/dialog.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/dialogshell.rb | 5 +- .../lib/tkextlib/iwidgets/disjointlistbox.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/entryfield.rb | 18 +- ext/tk/lib/tkextlib/iwidgets/extbutton.rb | 2 +- .../tkextlib/iwidgets/extfileselectionbox.rb | 4 +- .../iwidgets/extfileselectiondialog.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/feedback.rb | 2 +- .../lib/tkextlib/iwidgets/fileselectionbox.rb | 4 +- .../tkextlib/iwidgets/fileselectiondialog.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/finddialog.rb | 4 +- ext/tk/lib/tkextlib/iwidgets/hierarchy.rb | 22 +- ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/labeledframe.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/mainwindow.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/menubar.rb | 5 +- ext/tk/lib/tkextlib/iwidgets/messagebox.rb | 5 +- ext/tk/lib/tkextlib/iwidgets/messagedialog.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/notebook.rb | 5 +- ext/tk/lib/tkextlib/iwidgets/optionmenu.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/panedwindow.rb | 5 +- ext/tk/lib/tkextlib/iwidgets/promptdialog.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/pushbutton.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/radiobox.rb | 5 +- ext/tk/lib/tkextlib/iwidgets/scopedobject.rb | 2 +- .../lib/tkextlib/iwidgets/scrolledcanvas.rb | 12 +- ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb | 2 +- .../lib/tkextlib/iwidgets/scrolledlistbox.rb | 4 +- ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb | 64 +- .../lib/tkextlib/iwidgets/scrolledwidget.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/selectionbox.rb | 2 +- .../lib/tkextlib/iwidgets/selectiondialog.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/setup.rb | 4 +- ext/tk/lib/tkextlib/iwidgets/shell.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/spindate.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/spinint.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/spinner.rb | 18 +- ext/tk/lib/tkextlib/iwidgets/spintime.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb | 5 +- ext/tk/lib/tkextlib/iwidgets/tabset.rb | 17 +- ext/tk/lib/tkextlib/iwidgets/timeentry.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/timefield.rb | 2 +- ext/tk/lib/tkextlib/iwidgets/toolbar.rb | 4 +- ext/tk/lib/tkextlib/iwidgets/watch.rb | 4 +- ext/tk/lib/tkextlib/pkg_checker.rb | 4 +- ext/tk/lib/tkextlib/setup.rb | 8 +- ext/tk/lib/tkextlib/tcllib.rb | 29 +- ext/tk/lib/tkextlib/tcllib/autoscroll.rb | 24 +- ext/tk/lib/tkextlib/tcllib/calendar.rb | 55 + ext/tk/lib/tkextlib/tcllib/canvas_sqmap.rb | 36 + ext/tk/lib/tkextlib/tcllib/canvas_zoom.rb | 21 + ext/tk/lib/tkextlib/tcllib/chatwidget.rb | 151 + ext/tk/lib/tkextlib/tcllib/crosshair.rb | 117 + ext/tk/lib/tkextlib/tcllib/ctext.rb | 12 +- ext/tk/lib/tkextlib/tcllib/cursor.rb | 14 +- ext/tk/lib/tkextlib/tcllib/dateentry.rb | 62 + ext/tk/lib/tkextlib/tcllib/datefield.rb | 12 +- ext/tk/lib/tkextlib/tcllib/diagrams.rb | 224 + ext/tk/lib/tkextlib/tcllib/dialog.rb | 2 +- ext/tk/lib/tkextlib/tcllib/getstring.rb | 4 +- ext/tk/lib/tkextlib/tcllib/ico.rb | 46 +- ext/tk/lib/tkextlib/tcllib/ip_entry.rb | 15 +- ext/tk/lib/tkextlib/tcllib/khim.rb | 68 + ext/tk/lib/tkextlib/tcllib/menuentry.rb | 47 + ext/tk/lib/tkextlib/tcllib/ntext.rb | 146 + ext/tk/lib/tkextlib/tcllib/panelframe.rb | 10 +- ext/tk/lib/tkextlib/tcllib/plotchart.rb | 708 ++- ext/tk/lib/tkextlib/tcllib/ruler.rb | 2 +- ext/tk/lib/tkextlib/tcllib/screenruler.rb | 2 +- ext/tk/lib/tkextlib/tcllib/scrolledwindow.rb | 57 + ext/tk/lib/tkextlib/tcllib/scrollwin.rb | 2 +- ext/tk/lib/tkextlib/tcllib/setup.rb | 4 +- ext/tk/lib/tkextlib/tcllib/statusbar.rb | 79 + ext/tk/lib/tkextlib/tcllib/superframe.rb | 2 +- ext/tk/lib/tkextlib/tcllib/swaplist.rb | 10 +- ext/tk/lib/tkextlib/tcllib/tablelist.rb | 7 +- ext/tk/lib/tkextlib/tcllib/tablelist_core.rb | 328 +- ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb | 20 +- ext/tk/lib/tkextlib/tcllib/tkpiechart.rb | 22 +- ext/tk/lib/tkextlib/tcllib/toolbar.rb | 175 + ext/tk/lib/tkextlib/tcllib/tooltip.rb | 13 +- ext/tk/lib/tkextlib/tcllib/widget.rb | 34 + ext/tk/lib/tkextlib/tclx/setup.rb | 4 +- ext/tk/lib/tkextlib/tile.rb | 76 +- ext/tk/lib/tkextlib/tile/dialog.rb | 6 + ext/tk/lib/tkextlib/tile/setup.rb | 4 +- ext/tk/lib/tkextlib/tile/sizegrip.rb | 11 +- ext/tk/lib/tkextlib/tile/style.rb | 46 +- ext/tk/lib/tkextlib/tile/tbutton.rb | 9 +- ext/tk/lib/tkextlib/tile/tcheckbutton.rb | 12 +- ext/tk/lib/tkextlib/tile/tcombobox.rb | 9 +- ext/tk/lib/tkextlib/tile/tentry.rb | 9 +- ext/tk/lib/tkextlib/tile/tframe.rb | 9 +- ext/tk/lib/tkextlib/tile/tlabel.rb | 9 +- ext/tk/lib/tkextlib/tile/tlabelframe.rb | 12 +- ext/tk/lib/tkextlib/tile/tmenubutton.rb | 12 +- ext/tk/lib/tkextlib/tile/tnotebook.rb | 22 +- ext/tk/lib/tkextlib/tile/tpaned.rb | 46 +- ext/tk/lib/tkextlib/tile/tprogressbar.rb | 9 +- ext/tk/lib/tkextlib/tile/tradiobutton.rb | 12 +- ext/tk/lib/tkextlib/tile/treeview.rb | 91 +- ext/tk/lib/tkextlib/tile/tscale.rb | 13 +- ext/tk/lib/tkextlib/tile/tscrollbar.rb | 21 +- ext/tk/lib/tkextlib/tile/tseparator.rb | 9 +- ext/tk/lib/tkextlib/tile/tspinbox.rb | 107 + ext/tk/lib/tkextlib/tile/tsquare.rb | 2 +- ext/tk/lib/tkextlib/tkDND/setup.rb | 4 +- ext/tk/lib/tkextlib/tkDND/tkdnd.rb | 52 +- ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb | 8 +- ext/tk/lib/tkextlib/tkHTML/setup.rb | 4 +- ext/tk/lib/tkextlib/tkimg/setup.rb | 4 +- ext/tk/lib/tkextlib/tktable/setup.rb | 4 +- ext/tk/lib/tkextlib/tktable/tktable.rb | 125 +- ext/tk/lib/tkextlib/tktrans/setup.rb | 4 +- ext/tk/lib/tkextlib/treectrl/setup.rb | 4 +- ext/tk/lib/tkextlib/treectrl/tktreectrl.rb | 241 +- ext/tk/lib/tkextlib/trofs/setup.rb | 4 +- ext/tk/lib/tkextlib/version.rb | 2 +- ext/tk/lib/tkextlib/vu/bargraph.rb | 10 +- ext/tk/lib/tkextlib/vu/charts.rb | 2 +- ext/tk/lib/tkextlib/vu/dial.rb | 2 +- ext/tk/lib/tkextlib/vu/pie.rb | 8 +- ext/tk/lib/tkextlib/vu/setup.rb | 4 +- ext/tk/lib/tkextlib/vu/spinbox.rb | 2 +- ext/tk/lib/tkextlib/winico/setup.rb | 4 +- ext/tk/lib/tkextlib/winico/winico.rb | 32 +- ext/tk/old-extconf.rb | 440 ++ ext/tk/sample/24hr_clock.rb | 130 +- ext/tk/sample/binding_sample.rb | 8 +- ext/tk/sample/bindtag_sample.rb | 38 +- ext/tk/sample/binstr_usage.rb | 2 +- ext/tk/sample/cd_timer.rb | 16 +- ext/tk/sample/cmd_res_test.rb | 2 +- ext/tk/sample/demos-en/anilabel.rb | 14 +- ext/tk/sample/demos-en/aniwave.rb | 10 +- ext/tk/sample/demos-en/arrow.rb | 66 +- ext/tk/sample/demos-en/bind.rb | 34 +- ext/tk/sample/demos-en/bitmap.rb | 8 +- ext/tk/sample/demos-en/button.rb | 10 +- ext/tk/sample/demos-en/check.rb | 10 +- ext/tk/sample/demos-en/check2.rb | 34 +- ext/tk/sample/demos-en/clrpick.rb | 8 +- ext/tk/sample/demos-en/colors.rb | 2 +- ext/tk/sample/demos-en/combo.rb | 40 +- ext/tk/sample/demos-en/cscroll.rb | 26 +- ext/tk/sample/demos-en/ctext.rb | 44 +- ext/tk/sample/demos-en/entry1.rb | 6 +- ext/tk/sample/demos-en/entry2.rb | 4 +- ext/tk/sample/demos-en/entry3.rb | 28 +- ext/tk/sample/demos-en/filebox.rb | 32 +- ext/tk/sample/demos-en/floor.rb | 550 +-- ext/tk/sample/demos-en/floor2.rb | 550 +-- ext/tk/sample/demos-en/form.rb | 6 +- ext/tk/sample/demos-en/goldberg.rb | 402 +- ext/tk/sample/demos-en/icon.rb | 4 +- ext/tk/sample/demos-en/image1.rb | 2 +- ext/tk/sample/demos-en/image2.rb | 6 +- ext/tk/sample/demos-en/image3.rb | 16 +- ext/tk/sample/demos-en/items.rb | 86 +- ext/tk/sample/demos-en/knightstour.rb | 32 +- ext/tk/sample/demos-en/label.rb | 16 +- ext/tk/sample/demos-en/labelframe.rb | 14 +- ext/tk/sample/demos-en/mclist.rb | 56 +- ext/tk/sample/demos-en/menu.rb | 48 +- ext/tk/sample/demos-en/menu84.rb | 60 +- ext/tk/sample/demos-en/menubu.rb | 4 +- ext/tk/sample/demos-en/msgbox.rb | 24 +- ext/tk/sample/demos-en/msgbox2.rb | 24 +- ext/tk/sample/demos-en/paned1.rb | 8 +- ext/tk/sample/demos-en/paned2.rb | 46 +- ext/tk/sample/demos-en/pendulum.rb | 32 +- ext/tk/sample/demos-en/plot.rb | 30 +- ext/tk/sample/demos-en/puzzle.rb | 6 +- ext/tk/sample/demos-en/radio.rb | 12 +- ext/tk/sample/demos-en/radio2.rb | 28 +- ext/tk/sample/demos-en/radio3.rb | 50 +- ext/tk/sample/demos-en/ruler.rb | 36 +- ext/tk/sample/demos-en/sayings.rb | 8 +- ext/tk/sample/demos-en/search.rb | 32 +- ext/tk/sample/demos-en/spin.rb | 16 +- ext/tk/sample/demos-en/states.rb | 22 +- ext/tk/sample/demos-en/style.rb | 38 +- ext/tk/sample/demos-en/text.rb | 6 +- ext/tk/sample/demos-en/textpeer.rb | 8 +- ext/tk/sample/demos-en/toolbar.rb | 32 +- ext/tk/sample/demos-en/tree.rb | 26 +- ext/tk/sample/demos-en/ttkbut.rb | 48 +- ext/tk/sample/demos-en/ttkmenu.rb | 18 +- ext/tk/sample/demos-en/ttknote.rb | 22 +- ext/tk/sample/demos-en/ttkpane.rb | 46 +- ext/tk/sample/demos-en/ttkprogress.rb | 22 +- ext/tk/sample/demos-en/twind.rb | 60 +- ext/tk/sample/demos-en/twind2.rb | 130 +- ext/tk/sample/demos-en/unicodeout.rb | 40 +- ext/tk/sample/demos-en/widget | 7 +- ext/tk/sample/demos-jp/anilabel.rb | 14 +- ext/tk/sample/demos-jp/aniwave.rb | 10 +- ext/tk/sample/demos-jp/arrow.rb | 62 +- ext/tk/sample/demos-jp/bind.rb | 26 +- ext/tk/sample/demos-jp/bitmap.rb | 6 +- ext/tk/sample/demos-jp/button.rb | 2 +- ext/tk/sample/demos-jp/check.rb | 4 +- ext/tk/sample/demos-jp/check2.rb | 34 +- ext/tk/sample/demos-jp/clrpick.rb | 6 +- ext/tk/sample/demos-jp/colors.rb | 2 +- ext/tk/sample/demos-jp/combo.rb | 40 +- ext/tk/sample/demos-jp/cscroll.rb | 24 +- ext/tk/sample/demos-jp/ctext.rb | 38 +- ext/tk/sample/demos-jp/entry1.rb | 2 +- ext/tk/sample/demos-jp/entry2.rb | 2 +- ext/tk/sample/demos-jp/entry3.rb | 36 +- ext/tk/sample/demos-jp/filebox.rb | 32 +- ext/tk/sample/demos-jp/floor.rb | 546 +-- ext/tk/sample/demos-jp/floor2.rb | 546 +-- ext/tk/sample/demos-jp/form.rb | 2 +- ext/tk/sample/demos-jp/goldberg.rb | 408 +- ext/tk/sample/demos-jp/icon.rb | 2 +- ext/tk/sample/demos-jp/image1.rb | 2 +- ext/tk/sample/demos-jp/image2.rb | 2 +- ext/tk/sample/demos-jp/image3.rb | 16 +- ext/tk/sample/demos-jp/items.rb | 80 +- ext/tk/sample/demos-jp/knightstour.rb | 32 +- ext/tk/sample/demos-jp/label.rb | 6 +- ext/tk/sample/demos-jp/labelframe.rb | 22 +- ext/tk/sample/demos-jp/mclist.rb | 56 +- ext/tk/sample/demos-jp/menu.rb | 48 +- ext/tk/sample/demos-jp/menu84.rb | 58 +- ext/tk/sample/demos-jp/menu8x.rb | 56 +- ext/tk/sample/demos-jp/menubu.rb | 4 +- ext/tk/sample/demos-jp/msgbox.rb | 24 +- ext/tk/sample/demos-jp/msgbox2.rb | 26 +- ext/tk/sample/demos-jp/paned1.rb | 8 +- ext/tk/sample/demos-jp/paned2.rb | 48 +- ext/tk/sample/demos-jp/pendulum.rb | 32 +- ext/tk/sample/demos-jp/plot.rb | 24 +- ext/tk/sample/demos-jp/puzzle.rb | 8 +- ext/tk/sample/demos-jp/radio.rb | 2 +- ext/tk/sample/demos-jp/radio2.rb | 28 +- ext/tk/sample/demos-jp/radio3.rb | 50 +- ext/tk/sample/demos-jp/ruler.rb | 32 +- ext/tk/sample/demos-jp/sayings.rb | 8 +- ext/tk/sample/demos-jp/search.rb | 34 +- ext/tk/sample/demos-jp/spin.rb | 18 +- ext/tk/sample/demos-jp/states.rb | 2 +- ext/tk/sample/demos-jp/style.rb | 38 +- ext/tk/sample/demos-jp/text.rb | 2 +- ext/tk/sample/demos-jp/textpeer.rb | 12 +- ext/tk/sample/demos-jp/toolbar.rb | 30 +- ext/tk/sample/demos-jp/tree.rb | 26 +- ext/tk/sample/demos-jp/ttkbut.rb | 48 +- ext/tk/sample/demos-jp/ttkmenu.rb | 18 +- ext/tk/sample/demos-jp/ttknote.rb | 22 +- ext/tk/sample/demos-jp/ttkpane.rb | 48 +- ext/tk/sample/demos-jp/ttkprogress.rb | 22 +- ext/tk/sample/demos-jp/twind.rb | 58 +- ext/tk/sample/demos-jp/twind2.rb | 108 +- ext/tk/sample/demos-jp/unicodeout.rb | 38 +- ext/tk/sample/demos-jp/widget | 31 +- ext/tk/sample/editable_listbox.rb | 135 +- ext/tk/sample/encstr_usage.rb | 4 +- ext/tk/sample/figmemo_sample.rb | 96 +- ext/tk/sample/irbtk.rb | 4 +- ext/tk/sample/menubar1.rb | 20 +- ext/tk/sample/menubar2.rb | 24 +- ext/tk/sample/menubar3.rb | 72 + ext/tk/sample/multi-ip_sample.rb | 7 +- ext/tk/sample/multi-ip_sample2.rb | 2 +- ext/tk/sample/optobj_sample.rb | 30 +- ext/tk/sample/propagate.rb | 2 +- ext/tk/sample/remote-ip_sample.rb | 10 +- ext/tk/sample/remote-ip_sample2.rb | 20 +- ext/tk/sample/safe-tk.rb | 57 +- ext/tk/sample/scrollframe.rb | 28 +- ext/tk/sample/tcltklib/sample1.rb | 2 +- ext/tk/sample/tcltklib/sample2.rb | 104 +- ext/tk/sample/tkalignbox.rb | 102 +- ext/tk/sample/tkballoonhelp.rb | 104 +- ext/tk/sample/tkbiff.rb | 6 +- ext/tk/sample/tkbrowse.rb | 2 +- ext/tk/sample/tkcombobox.rb | 143 +- ext/tk/sample/tkdialog.rb | 2 +- ext/tk/sample/tkextlib/ICONS/viewIcons.rb | 38 +- ext/tk/sample/tkextlib/blt/barchart5.rb | 22 +- ext/tk/sample/tkextlib/blt/calendar.rb | 54 +- ext/tk/sample/tkextlib/blt/graph6.rb | 4044 ++++++++--------- ext/tk/sample/tkextlib/blt/graph7.rb | 8 +- ext/tk/sample/tkextlib/blt/graph7a.rb | 10 +- ext/tk/sample/tkextlib/blt/graph7b.rb | 8 +- ext/tk/sample/tkextlib/blt/graph7c.rb | 8 +- ext/tk/sample/tkextlib/blt/pareto.rb | 34 +- ext/tk/sample/tkextlib/blt/plot1b.rb | 2 +- ext/tk/sample/tkextlib/blt/winop1.rb | 8 +- ext/tk/sample/tkextlib/blt/winop2.rb | 2 +- ext/tk/sample/tkextlib/bwidget/basic.rb | 96 +- ext/tk/sample/tkextlib/bwidget/demo.rb | 84 +- ext/tk/sample/tkextlib/bwidget/dnd.rb | 16 +- ext/tk/sample/tkextlib/bwidget/manager.rb | 28 +- ext/tk/sample/tkextlib/bwidget/select.rb | 56 +- ext/tk/sample/tkextlib/bwidget/tmpldlg.rb | 162 +- ext/tk/sample/tkextlib/bwidget/tree.rb | 96 +- .../tkextlib/iwidgets/sample/calendar.rb | 8 +- .../tkextlib/iwidgets/sample/combobox.rb | 8 +- .../tkextlib/iwidgets/sample/dialogshell.rb | 2 +- .../iwidgets/sample/disjointlistbox.rb | 2 +- .../tkextlib/iwidgets/sample/entryfield-1.rb | 12 +- .../tkextlib/iwidgets/sample/entryfield-2.rb | 16 +- .../tkextlib/iwidgets/sample/entryfield-3.rb | 10 +- .../tkextlib/iwidgets/sample/extbutton.rb | 12 +- .../iwidgets/sample/extfileselectionbox.rb | 2 +- .../iwidgets/sample/fileselectionbox.rb | 2 +- .../tkextlib/iwidgets/sample/hierarchy.rb | 16 +- .../tkextlib/iwidgets/sample/labeledwidget.rb | 4 +- .../tkextlib/iwidgets/sample/mainwindow.rb | 36 +- .../tkextlib/iwidgets/sample/menubar.rb | 66 +- .../tkextlib/iwidgets/sample/menubar2.rb | 12 +- .../tkextlib/iwidgets/sample/messagebox1.rb | 6 +- .../tkextlib/iwidgets/sample/messagebox2.rb | 6 +- .../tkextlib/iwidgets/sample/messagedialog.rb | 8 +- .../tkextlib/iwidgets/sample/notebook.rb | 2 +- .../tkextlib/iwidgets/sample/notebook2.rb | 2 +- .../tkextlib/iwidgets/sample/optionmenu.rb | 2 +- .../tkextlib/iwidgets/sample/panedwindow.rb | 2 +- .../tkextlib/iwidgets/sample/panedwindow2.rb | 2 +- .../tkextlib/iwidgets/sample/promptdialog.rb | 2 +- .../tkextlib/iwidgets/sample/pushbutton.rb | 4 +- .../tkextlib/iwidgets/sample/scrolledframe.rb | 2 +- .../tkextlib/iwidgets/sample/scrolledhtml.rb | 2 +- .../iwidgets/sample/scrolledlistbox.rb | 6 +- .../tkextlib/iwidgets/sample/scrolledtext.rb | 2 +- .../tkextlib/iwidgets/sample/selectionbox.rb | 4 +- .../iwidgets/sample/selectiondialog.rb | 2 +- .../sample/tkextlib/iwidgets/sample/shell.rb | 8 +- .../tkextlib/iwidgets/sample/spinint.rb | 2 +- .../tkextlib/iwidgets/sample/spinner.rb | 8 +- .../tkextlib/iwidgets/sample/tabnotebook.rb | 2 +- .../tkextlib/iwidgets/sample/tabnotebook2.rb | 2 +- .../tkextlib/iwidgets/sample/toolbar.rb | 32 +- .../sample/tkextlib/iwidgets/sample/watch.rb | 2 +- ext/tk/sample/tkextlib/tcllib/datefield.rb | 4 +- ext/tk/sample/tkextlib/tcllib/plotdemos1.rb | 22 +- ext/tk/sample/tkextlib/tcllib/plotdemos2.rb | 8 +- ext/tk/sample/tkextlib/tcllib/plotdemos3.rb | 20 +- ext/tk/sample/tkextlib/tcllib/xyplot.rb | 2 +- ext/tk/sample/tkextlib/tile/demo.rb | 174 +- ext/tk/sample/tkextlib/tile/themes/kroc.rb | 108 +- ext/tk/sample/tkextlib/tkHTML/hv.rb | 48 +- ext/tk/sample/tkextlib/tkHTML/ss.rb | 82 +- ext/tk/sample/tkextlib/tkimg/demo.rb | 10 +- ext/tk/sample/tkextlib/tktable/basic.rb | 14 +- ext/tk/sample/tkextlib/tktable/buttons.rb | 12 +- ext/tk/sample/tkextlib/tktable/command.rb | 22 +- ext/tk/sample/tkextlib/tktable/debug.rb | 16 +- ext/tk/sample/tkextlib/tktable/dynarows.rb | 14 +- ext/tk/sample/tkextlib/tktable/maxsize.rb | 14 +- ext/tk/sample/tkextlib/tktable/spreadsheet.rb | 16 +- ext/tk/sample/tkextlib/tktable/valid.rb | 12 +- ext/tk/sample/tkextlib/treectrl/bitmaps.rb | 32 +- ext/tk/sample/tkextlib/treectrl/demo.rb | 342 +- ext/tk/sample/tkextlib/treectrl/explorer.rb | 126 +- ext/tk/sample/tkextlib/treectrl/help.rb | 106 +- ext/tk/sample/tkextlib/treectrl/imovie.rb | 30 +- ext/tk/sample/tkextlib/treectrl/layout.rb | 26 +- ext/tk/sample/tkextlib/treectrl/mailwasher.rb | 100 +- .../tkextlib/treectrl/outlook-folders.rb | 52 +- .../tkextlib/treectrl/outlook-newgroup.rb | 102 +- ext/tk/sample/tkextlib/treectrl/random.rb | 68 +- .../sample/tkextlib/treectrl/www-options.rb | 72 +- ext/tk/sample/tkextlib/vu/canvItems.rb | 68 +- ext/tk/sample/tkextlib/vu/canvSticker.rb | 4 +- ext/tk/sample/tkextlib/vu/canvSticker2.rb | 4 +- ext/tk/sample/tkextlib/vu/dial_demo.rb | 62 +- ext/tk/sample/tkextlib/vu/oscilloscope.rb | 16 +- ext/tk/sample/tkextlib/vu/pie.rb | 10 +- ext/tk/sample/tkextlib/vu/vu_demo.rb | 14 +- ext/tk/sample/tkfrom.rb | 2 +- ext/tk/sample/tkhello.rb | 2 +- ext/tk/sample/tkmenubutton.rb | 56 +- ext/tk/sample/tkmsgcat-load_rb.rb | 16 +- ext/tk/sample/tkmsgcat-load_rb2.rb | 16 +- ext/tk/sample/tkmsgcat-load_tk.rb | 22 +- ext/tk/sample/tkmulticolumnlist.rb | 114 +- ext/tk/sample/tkmultilistbox.rb | 96 +- ext/tk/sample/tkmultilistframe.rb | 168 +- ext/tk/sample/tkoptdb-safeTk.rb | 28 +- ext/tk/sample/tkoptdb.rb | 32 +- ext/tk/sample/tkrttimer.rb | 12 +- ext/tk/sample/tktextframe.rb | 269 +- ext/tk/sample/tktextio.rb | 56 +- ext/tk/sample/tktimer2.rb | 8 +- ext/tk/sample/tktimer3.rb | 8 +- ext/tk/sample/tktree.rb | 26 +- ext/tk/sample/ttk_wrapper.rb | 12 +- ext/tk/tcltklib.c | 598 ++- ext/tk/tkutil/extconf.rb | 4 + ext/tk/tkutil/tkutil.c | 50 +- 535 files changed, 16499 insertions(+), 10067 deletions(-) create mode 100644 ext/tk/config_list.in create mode 100644 ext/tk/lib/tk/busy.rb create mode 100644 ext/tk/lib/tk/fontchooser.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/calendar.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/canvas_sqmap.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/canvas_zoom.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/chatwidget.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/crosshair.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/dateentry.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/diagrams.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/khim.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/menuentry.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/ntext.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/scrolledwindow.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/statusbar.rb create mode 100644 ext/tk/lib/tkextlib/tcllib/toolbar.rb create mode 100644 ext/tk/lib/tkextlib/tile/tspinbox.rb create mode 100644 ext/tk/old-extconf.rb create mode 100644 ext/tk/sample/menubar3.rb diff --git a/ChangeLog b/ChangeLog index 011bf4fc9d..c1a9c73d5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +Mon Jul 13 08:01:00 2009 Hidetoshi NAGAI + + * ext/tk/extconf.rb: New strategy for searching Tcl/Tk libraries. + + * ext/tk/*: Support new features of Tcl/Tk8.6b1 and minor bug fixes. + ( [KNOWN BUG] Ruby/Tk on Ruby 1.9 will not work on Cygwin. ) + + * ext/tk/*: Unify sources between Ruby 1.8 & 1.9. + Improve default_widget_set handling. + + * ext/tk/*: Multi-TkInterpreter (multi-tk.rb) works on Ruby 1.8 & 1.9. + ( [KNOWN BUG] On Ruby 1.8, join to a long term Thread on Tk + callbacks may freeze. On Ruby 1.9, cannot create a second + master interpreter (creating slaves are OK); supported master + interpreter is the default master interpreter only. ) + + * ext/tk/lib/tkextlib/*: Update supported versions of Tk extensions. + Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5 + BWidgets 1.7 ==> BWidgets 1.8 + TkTable 2.9 ==> TkTable 2.10 + TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9 + Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1 + IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15 + TclX 2005-02-07 ==> TclX 2008-12-15 + Trofs 0.4.3 ==> Trofs 0.4.4 + Mon Jul 13 01:18:46 2009 Nobuyoshi Nakada * time.c (time_timeval): rounds subsecond toward zero. diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib index fc919a5eb5..4aa9cb61d6 100644 --- a/ext/tk/ChangeLog.tkextlib +++ b/ext/tk/ChangeLog.tkextlib @@ -1,3 +1,17 @@ +2009-07-12 Hidetoshi NAGAI + + * ext/tk/lib/tkextlib/*: update release. + Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5 + BWidgets 1.7 ==> BWidgets 1.8 + TkTable 2.9 ==> TkTable 2.10 + TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9 + Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1 + IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15 + TclX 2005-02-07 ==> TclX 2008-12-15 + Trofs 0.4.3 ==> Trofs 0.4.4 + +--------------< ... some bug fixes ... >------------------ + Tue Nov 25 03:37:42 2008 Hidetoshi NAGAI * ext/tk/lib/tkextlib/blt/tabset.rb, diff --git a/ext/tk/MANUAL_tcltklib.eng b/ext/tk/MANUAL_tcltklib.eng index 6fa775b7de..c139947da4 100644 --- a/ext/tk/MANUAL_tcltklib.eng +++ b/ext/tk/MANUAL_tcltklib.eng @@ -140,8 +140,7 @@ module TclTklib [module methods] get_version() : return an array of major, minor, release-type number, - : number, release-type name, and patchlevel of current - : Tcl/Tk library. + : and patchlevel of current Tcl/Tk library. mainloop(check_root = true) : Starts the eventloop. If 'check_root' is true, this method @@ -354,6 +353,11 @@ class TclTkIp : to _eval and regist the command once, after that, the : command can be called by _invoke. + _cancel_eval(str) + _cancel_eval_unwind(str) + : (Tcl/Tk8.6 or later) + : Call Tcl_CancelEval() function, and cancel evaluation. + _toUTF8(str, encoding=nil) _fromUTF8(str, encoding=nil) : Call the function (which is internal function of Tcl/Tk) to diff --git a/ext/tk/MANUAL_tcltklib.eucj b/ext/tk/MANUAL_tcltklib.eucj index 7df42997b4..26b39f7943 100644 --- a/ext/tk/MANUAL_tcltklib.eucj +++ b/ext/tk/MANUAL_tcltklib.eucj @@ -235,8 +235,8 @@ require "tcltklib" ¥â¥¸¥å¡¼¥ë¥á¥½¥Ã¥É get_version() - : Tcl/Tk ¤Î major, minor, release-type ÈÖ¹æ, release-type ̾, - : patchlevel ¤òÇÛÎó¤Ë¤·¤ÆÊÖ¤¹¡¥ + : Tcl/Tk ¤Î major, minor, release-type ÈÖ¹æ, patchlevel ¤ò + : ÇÛÎó¤Ë¤·¤ÆÊÖ¤¹¡¥ mainloop(check_root = true) : ¥¤¥Ù¥ó¥È¥ë¡¼¥×¤òµ¯Æ°¤¹¤ë¡¥check_root ¤¬ true ¤Ç¤¢¤ì¤Ð¡¤ @@ -464,6 +464,11 @@ require "tcltklib" : ¤·¤ÆÅÐÏ¿¤ËÀ®¸ù¤·¤µ¤¨¤¹¤ì¤Ð¡¤°Ê¹ß¤Ï _invoke ¤Ç¤âÍøÍÑ¤Ç : ¤­¤ë¤è¤¦¤Ë¤Ê¤ë¡¥ + _cancel_eval(str) + _cancel_eval_unwind(str) + : (Tcl/Tk8.6 or later) + : Tcl_CancelEval() ´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¡¤eval ¤Î¼Â¹Ô¤òÂǤÁÀڤ롥 + _toUTF8(str, encoding=nil) _fromUTF8(str, encoding=nil) : Tcl/Tk ¤¬Æâ¢¤·¤Æ¤¤¤ë UTF8 ÊÑ´¹½èÍý¤ò¸Æ¤Ó½Ð¤¹¡¥ diff --git a/ext/tk/README.ActiveTcl b/ext/tk/README.ActiveTcl index 3afb3f4cf6..c0f9ef8fe4 100644 --- a/ext/tk/README.ActiveTcl +++ b/ext/tk/README.ActiveTcl @@ -3,9 +3,22 @@ ActiveTcl is ActiveState's quality-assured distribution of Tcl. # see # +First of all, please try to configure without any options. +"extconf.rb" searches ActiveTcl as default action. +If you have ActiveTcl and standard (or your own) Tcl/Tk on your +environment and don't want to use ActiveTcl on your Ruby/Tk, please +use --without-ActiveTcl option. + +When "extconf.rb" fails to find your ActiveTcl libraries, please try +the followings. + If you want to use ActiveTcl binary package as the Tcl/Tk libraries, please use the following configure options. + --with-ActiveTcl= + ( When without argument; no ; only '--with-ActiveTcl', + it same to '--with-ActiveTcl=/opt/ActiveTcl*/lib' ) + --with-tcl-dir= --with-tk-dir= diff --git a/ext/tk/README.tcltklib b/ext/tk/README.tcltklib index 8c6dd5178f..0db2758f26 100644 --- a/ext/tk/README.tcltklib +++ b/ext/tk/README.tcltklib @@ -1,18 +1,53 @@ To compile 'tcltklib', you must have Tcl/Tk libraries on your environment. -Although 'extconf.rb' script searches Tcl/Tk libraries and header files, +Although 'extconf.rb' script searches Tcl/Tk libraries and header files +(as default, searches tclConfig.sh/tkConfig.sh and use the defintions on +those; ActiveTcl has high priority on searching unless --without-ActiveTcl), sometimes fails to find them. And then, 'tcltklib' cannot be compiled. If Tcl/Tk libraries or header files are installed but are not found, you can give the information by arguments of the 'configure' script. Please give some or all of the following options. + --with-tk-old-extconf use old "extconf.rb" (default: false). + If current extconf.rb doesn't work properly + (or your install process is based on old + documant about Ruby/Tk install), please try + this option. + + --with-ActiveTcl / --without-ActiveTcl + --with-ActiveTcl= search ActiveTcl libraries (default: true). + When true, try to find installed ActiveTcl. + When is given, use it as the ActiveTcl's + top directory (use /lib, and so on). + Old "extconf.rb" doesn't support this option. + + --with-tk-shlib-search-path= + teach the paths for loading shared-libraries + to linker. + is a path list with the same format + as PATH environment variable. + This option may be experimental. + Old "extconf.rb" doesn't support this option. + --with-tcltkversion= force version of Tcl/Tk libaray (e.g. libtcl8.4g.so ==> --with-tcltkversion=8.4g) + --without-tcl-config / --without-tk-config + --with-tclConfig-dir= + --with-tkConfig-dir= the directory contains 'tclConfig.sh' and + 'tkConfig.sh'. + Current "extconf.rb" uses the information + on tclConfig.sh/tkConfig.rb, if possible. + Old "extconf.rb" doesn't support this option. + --with-tcllib= (e.g. libtcl8.4.so ==> --with-tcllib=tcl8.4) --with-tklib= (e.g. libtk8.4.so ==> --with-tklib=tk8.4) --enable-tcltk-stubs (if you force to enable stubs) + On old "extconf.rb", default is false. + On current "extconf.rb", default is true when + tclConfig.sh/tkConfig.sh have TCL_STUB_LIB_SPEC + /TK_STUB_LIB_SPEC, else default is false. --with-tcl-dir= equal to "--with-tcl-include=/include --with-tcl-lib=/lib" @@ -36,6 +71,12 @@ some or all of the following options. When this option is given, it is assumed that --enable-tcltk-framework option is given also. + --with-tcl-framework-dir= + Tcl framework directory (e.g. "/Library/Frameworks/Tcl.framework") + + --with-tk-framework-dir= + Tk framework directory (e.g. "/Library/Frameworks/Tk.framework") + --with-tcl-framework-header= Tcl framework headers directory (e.g. "/Library/Frameworks/Tcl.framework/Headers") diff --git a/ext/tk/config_list.in b/ext/tk/config_list.in new file mode 100644 index 0000000000..ba0a963bb0 --- /dev/null +++ b/ext/tk/config_list.in @@ -0,0 +1,35 @@ +############################################## +# configure options for Ruby/Tk +# release date: 2009-07-12 +############################################## +with tk-old-extconf +with ActiveTcl +with tk-shlib-search-path +with tcltkversion +with tcl-config +with tk-config +with tclConfig-dir +with tkConfig-dir +with tcllib +with tklib +enable tcltk-stubs +with tcl-dir +with tk-dir +with tcl-include +with tcl-lib +with tcl-lib +with tk-lib +enable mac-tcltk-framework +enable tcltk-framework +with tcltk-framework +with tcl-framework-dir +with tk-framework-dir +with tcl-framework-header +with tk-framework-header +with X11 +with X11-dir +with X11-include +with X11-lib +enable pthread +enable tcl-thread +with tclConfig-file diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb index c3eadd85d7..7d2853a37b 100644 --- a/ext/tk/extconf.rb +++ b/ext/tk/extconf.rb @@ -1,81 +1,126 @@ +############################################################## # extconf.rb for tcltklib - +# release date: 2009-07-12 +############################################################## require 'mkmf' -is_win32 = (/mswin|mingw|cygwin|bccwin|wince/ =~ RUBY_PLATFORM) -#is_macosx = (/darwin/ =~ RUBY_PLATFORM) +TkLib_Config = {} +TkLib_Config['search_versions'] = + %w[8.9 8.8 8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 4.2] -have_func("ruby_native_thread_p", "ruby.h") -have_func("rb_errinfo", "ruby.h") -have_func("rb_safe_level", "ruby.h") -have_struct_member("struct RArray", "ptr", "ruby.h") -have_struct_member("struct RArray", "len", "ruby.h") -def find_framework(tcl_hdr, tk_hdr) - if framework_dir = with_config("tcltk-framework") - paths = [framework_dir] - else - unless tcl_hdr || tk_hdr || - enable_config("tcltk-framework", false) || - enable_config("mac-tcltk-framework", false) - return false - end - paths = ["/Library/Frameworks", "/System/Library/Frameworks"] +############################################################## +# use old extconf.rb ? +############################################################## +if with_config('tk-old-extconf') + require File.join(File.dirname(__FILE__), 'old-extconf.rb') + exit +end + + +############################################################## +# check configs +############################################################## +$cleanfiles << 'config_list' +config_list_file = File.join(File.dirname(__FILE__),'config_list') +config_list_file_source = config_list_file + '.in' +if !File.exist?(config_list_file) || + File.ctime(config_list_file_source) > File.ctime(config_list_file) + old_config_list_file = config_list_file_source +else + old_config_list_file = config_list_file +end + +current_configs = {'with'=>{}, 'enable'=>{}} + +# setup keys by config_list.in +IO.foreach(config_list_file_source){|line| + line.chomp! + line.lstrip! + next if line.empty? || line =~ /^\#/ # + mode, key, value = line.split(/\s+/, 3) + value ||= "" + current_configs[mode][key] = value rescue nil +} + +# define current value of keys +IO.foreach(old_config_list_file){|line| + line.chomp! + line.lstrip! + next if line.empty? || line =~ /^\#/ # + mode, key, value = line.split(/\s+/, 3) + value ||= "" + if current_configs[mode] && current_configs[mode].has_key?(key) + current_configs[mode][key] = value end +} - checking_for('Tcl/Tk Framework') { - paths.find{|dir| - dir.strip! - dir.chomp!('/') - (tcl_hdr || FileTest.directory?(dir + "/Tcl.framework/") ) && - (tk_hdr || FileTest.directory?(dir + "/Tk.framework/") ) +update_flag = false +current_configs['with'].each_key{|key| + if (value = with_config(key).to_s) != current_configs['with'][key] + update_flag = true + current_configs['with'][key] = value + end +} +current_configs['enable'].each_key{|key| + if (value = enable_config(key).to_s) != current_configs['enable'][key] + update_flag = true + current_configs['enable'][key] = value + end +} + +# update current_configs +if update_flag || !File.exist?(config_list_file) + open(config_list_file, 'w'){|fobj| + fobj.print("# values of current configure options (generated by extconf.rb)\n"); + ['with', 'enable'].each{|mode| + current_configs[mode].each_key{|key| + fobj.print("#{mode} #{key} #{current_configs[mode][key]}\n") + } } } end -tcl_framework_header = with_config("tcl-framework-header") -tk_framework_header = with_config("tk-framework-header") +if update_flag + puts "Configure options for Ruby/Tk may be updated." + puts "So, delete files which depend on old configs." + File.delete(*(Dir.glob(File.join(File.dirname(__FILE__), + "*.#{CONFIG['DLEXT']}")))) + File.delete(*(Dir.glob(File.join(File.dirname(__FILE__), "*.#{$OBJEXT}")))) + File.delete(File.join(File.dirname(__FILE__), 'Makefile')) rescue nil -tcltk_framework = find_framework(tcl_framework_header, tk_framework_header) - -unless is_win32 - have_library("nsl", "t_open") - have_library("socket", "socket") - have_library("dl", "dlopen") - have_library("m", "log") +else + makefile = File.join(File.dirname(__FILE__),'Makefile') + if File.exist?(makefile) && + File.ctime(config_list_file) > File.ctime(makefile) + # no need to update Makefile + exit + end end -tk_idir, tk_ldir = dir_config("tk") -tcl_idir, tcl_ldir = dir_config("tcl") -x11_idir, x11_ldir = dir_config("X11") +############################################################## +# fuctions +############################################################## +def is_win32? + /mswin|mingw|cygwin|bccwin/ =~ RUBY_PLATFORM +end -tk_ldir2 = with_config("tk-lib") -tcl_ldir2 = with_config("tcl-lib") -x11_ldir2 = with_config("X11-lib") - -tk_ldir_list = [tk_ldir2, tk_ldir] -tcl_ldir_list = [tcl_ldir2, tcl_ldir] - -tklib = with_config("tklib") -tcllib = with_config("tcllib") -stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs") - -tcltk_version = with_config("tcltkversion") - -use_X = with_config("X11", (! is_win32)) +def is_macosx? + /darwin/ =~ RUBY_PLATFORM +end def check_tcltk_version(version) - return [nil, nil] unless version + return [nil, nil] unless version.kind_of? String version = version.strip tclver = version.dup tkver = version.dup - major = dot = minor = dot = plvl = ext = nil + dot = major = minor_dot = minor = plvl_dot = plvl = ext = nil if version =~ /^(\d)(\.?)(\d)(\.?)(\d*)(.*)$/ - major = $1; minor_dot = $2; minor = $3; plvl_dot = $4; plvl = $5; ext = $6 + major = $1; minor_dot = $2; minor = $3; plvl_dot = $4; plvl = $5; ext = $6 dot = ! minor_dot.empty? if plvl_dot.empty? && ! plvl.empty? minor << plvl @@ -99,12 +144,536 @@ def check_tcltk_version(version) [tclver, tkver] end +def get_shlib_versions(major = 8, minor_max = 9, minor_min = 0, ext = "") + if tclcfg = TkLib_Config["tclConfig_info"] + major = tclcfg['TCL_MAJOR_VERSION'].to_i + minor_min = tclcfg['TCL_MINOR_VERSION'].to_i + + elsif TkLib_Config["tcltkversion"] + tclver, tkver = TkLib_Config["tcltkversion"] + if tclver =~ /8\.?(\d)(.*)/ + minor_min = $1.to_i + ext = $2 + else + # unsupported version + return [""] + end + end + + # if disable-stubs, version is fixed. + minor_max = minor_min unless TkLib_Config["tcltk-stubs"] + + vers = [] + minor_max.downto(minor_min){|minor| + vers << "#{major}.#{minor}#{ext}" unless ext.empty? + vers << "#{major}.#{minor}" + } + + vers << "" +end + +def get_shlib_path_head + path_head = [] + path_dirs = [] + + if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path + path_dirs.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse + end + + if is_win32? + if TkLib_Config["ActiveTcl"] + path_head.concat ["c:/ActiveTcl", "c:/Program Files/ActiveTcl"] + end + path_head.concat [ + "c:/Tcl", "c:/Program Files/Tcl", + "/Tcl", "/Program Files/Tcl" + ] + path_head.each{|dir| path_dirs << "#{dir}"} + + else + [ + '/opt', '/pkg', '/share', + '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local', + '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr' + ].each{|dir| + next unless File.directory?(dir) + + path_dirs << "#{dir}/lib" + path_dirs << "#{dir}" unless Dir.glob("#{dir}/lib*.*").empty? + + dirnames = [] + if TkLib_Config["ActiveTcl"] + dirnames.concat ["ActiveTcl","activeTcl","Activetcl","activetcl"] + end + dirnames.concat ["TclTk","Tcl_Tk","Tcl-Tk","tcltk","tcl_tk","tcl-tk"] + + dirnames.each{|name| + path_dirs << "#{dir}/#{name}" if File.directory?("#{dir}/#{name}") + path_head << "#{dir}/#{name}" unless Dir.glob("#{dir}/#{name}[-89_]*").empty? + } + } + end + + [path_head, path_dirs] +end + +def find_macosx_framework + use_framework = is_macosx? && TkLib_Config["ActiveTcl"] + + use_framework ||= (tcl_hdr = with_config("tcl-framework-header")) + use_framework ||= (tk_hdr = with_config("tk-framework-header")) + tcl_hdr = nil unless tcl_hdr.kind_of? String + tk_hdr = nil unless tk_hdr.kind_of? String + TkLib_Config["tcl-framework-header"] = tcl_hdr + TkLib_Config["tk-framework-header"] = tk_hdr + + use_framework ||= (tcl_dir = with_config("tcl-framework-dir")) + tcl_dir = nil unless tcl_dir.kind_of? String + if !tcl_dir && tcl_hdr + # e.g. /Library/Frameworks/Tcl.framework/Headers + # ==> /Library/Frameworks/Tcl.framework + tcl_dir = File.dirname(tcl_hdr.strip.chomp('/')) + end + TkLib_Config["tcl-framework-dir"] = tcl_dir + + use_framework ||= (tk_dir = with_config("tk-framework-dir")) + tk_dir = nil unless tk_dir.kind_of? String + if !tk_dir && tk_hdr + # e.g. /Library/Frameworks/Tk.framework/Headers + # ==> /Library/Frameworks/Tk.framework + tk_dir = File.dirname(tk_hdr.strip.chomp('/')) + end + TkLib_Config["tk-framework-dir"] = tk_dir + + if tcl_dir && !tk_dir + tk_dir = File.join(File.dirname(tcl_dir), 'Tk.framework') + TkLib_Config["tk-framework-dir"] = tk_dir + elsif !tcl_dir && tk_dir + tcl_dir = File.join(File.dirname(tk_dir), 'Tcl.framework') + TkLib_Config["tcl-framework-dir"] = tcl_dir + end + if tcl_dir && tk_dir + TkLib_Config["tcltk-framework"] = File.dirname(tcl_dir) unless TkLib_Config["tcltk-framework"] + return [tcl_dir, tk_dir] + end + + # framework is disabled? + if with_config("tcltk-framework") == false || + enable_config("tcltk-framework") == false + return false + end + + use_framework ||= (framework_dir = with_config("tcltk-framework")) + if framework_dir.kind_of? String + TkLib_Config["tcltk-framework"] = framework_dir.strip.chomp('/') + return [File.join(TkLib_Config["tcltk-framework"], 'Tcl.framework'), + File.join(TkLib_Config["tcltk-framework"], 'Tk.framework')] + end + + unless enable_config("tcltk-framework", use_framework) || + enable_config("mac-tcltk-framework", use_framework) + TkLib_Config["tcltk-framework"] = false + return false + end + + paths = [ + #"~/Library/Frameworks", + "/Library/Frameworks", + "/Network/Library/Frameworks", "/System/Library/Frameworks" + ] + + paths.map{|dir| dir.strip.chomp('/')}.each{|dir| + next unless File.directory?(tcldir = File.join(dir, "Tcl.framework")) + next unless File.directory?(tkdir = File.join(dir, "Tk.framework")) + TkLib_Config["tcltk-framework"] = dir + return [tcldir, tkdir] + } + + nil +end + +def collect_tcltk_defs(tcl_defs_str, tk_defs_str) + conflicts = [ + 'PACKAGE_NAME', 'PACKAGE_TARNAME', 'PACKAGE_VERSION', + 'PACKAGE_STRING', 'PACKAGE_BUGREPORT' + ] + + begin + # Ruby 1.9.x or later + arch_config_h = RbConfig.expand($arch_hdrdir + "/ruby/config.h") + if File.exist?(arch_config_h) + keys = [] + IO.foreach(arch_config_h){|line| + if line =~ /^#define +([^ ]+)/ + keys << $1 + end + } + conflicts = keys + end + rescue + # ignore, use default + end + + if tcl_defs_str + tcl_defs = tcl_defs_str.split(/ ?-D/).map{|s| + s =~ /^([^=]+)(.*)$/ + [$1, $2] + } + else + tcl_defs = [] + end + + if tk_defs_str + tk_defs = tk_defs_str.split(/ ?-D/).map{|s| + s =~ /^([^=]+)(.*)$/ + [$1, $2] + } + else + tk_defs = [] + end + + defs = tcl_defs | tk_defs + + defs.delete_if{|name,value| + conflicts.include?(name) || + ( (vtcl = tcl_defs.assoc(name)) && (vtk = tk_defs.assoc(name)) && + vtcl != vtk ) + } + + defs.map{|ary| s = ary.join(''); (s.strip.empty?)? "": "-D" << s}.join(' ') +end + +def parse_tclConfig(file) + # check tclConfig.sh/tkConfig.sh + tbl = Hash.new{|h,k| h[k] = ""} + return tbl unless file + IO.foreach(file){|line| + line.strip! + next if line !~ /^([^\#=][^=]*)=(['"]|)(.*)\2$/ + key, val = $1, $3 + tbl[key] = val.gsub(/\$\{([^}]+)\}/){|s| + subst = $1 + (tbl[subst])? tbl[subst]: s + } rescue nil + } + tbl +end + +def get_libpath(lib_flag, lib_spec) + # get libpath fro {TCL,Tk}_LIB_FLAG and {TCL,Tk}_LIB_SPEC + libpath = lib_spec.gsub(/(#{lib_flag}|-L)/, "").strip +end + +def search_tclConfig(*paths) # list of lib-dir or [tcl-libdir, tk-libdir] + TkLib_Config["tclConfig_paths"] = [] + config_dir = [] + + paths.compact! + + fixed_tclConfig = ! paths.empty? + + paths.each{|path| + if path.kind_of?(Array) + config_dir << path + else + dirs = Dir.glob(path) + config_dir.concat(dirs.zip(dirs)) + end + } + + if is_win32? + if TkLib_Config["ActiveTcl"] + dirs = [] + if TkLib_Config["ActiveTcl"].kind_of?(String) + dirs << TkLib_Config["ActiveTcl"] + end + dirs.concat [ + "c:/ActiveTcl*/lib", "c:/Activetcl*/lib", + "c:/activeTcl*/lib", "c:/activetcl*/lib", + "c:/Tcl*/lib", "c:/tcl*/lib", + "c:/Program Files/ActiveTcl*/lib", "c:/Program Files/Activetcl*/lib", + "c:/Program Files/activeTcl*/lib", "c:/Program Files/activetcl*/lib", + "c:/Program Files/Tcl*/lib", "c:/Program Files/tcl*/lib", + "/ActiveTcl*/lib", "/Activetcl*/lib", + "/activeTcl*/lib", "/activetcl*/lib", + "/Tcl*/lib", "/tcl*/lib", + "/Program Files/ActiveTcl*/lib", "/Program Files/Activetcl*/lib", + "/Program Files/activeTcl*/lib", "/Program Files/activetcl*/lib", + "/Program Files/Tcl*/lib", "/Program Files/tcl*/lib" + ] + else + dirs = [ + "c:/Tcl*/lib", "c:/tcl*/lib", + "c:/Program Files/Tcl*/lib", "c:/Program Files/tcl*/lib", + "/Tcl*/lib", "/tcl*/lib", + "/Program Files/Tcl*/lib", "/Program Files/tcl*/lib" + ] + end + dirs.collect{|d| Dir.glob(d)}.flatten! + dirs |= dirs + + ENV['PATH'].split(';').each{|dir| + dirs << File.expand_path(File.join(dir, '..', 'lib')) + dirs << dir + dirs << File.expand_path(File.join(dir, '..')) + } + + config_dir.concat(dirs.zip(dirs)) + + elsif framework = find_macosx_framework() + config_dir.unshift(framework) + + else + if activeTcl = TkLib_Config['ActiveTcl'] + # check latest version at first + config_dir.concat(Dir.glob(activeTcl).sort.reverse) + end + + config_dir.concat [ + RbConfig::CONFIG['libdir'], + File.join(RbConfig::CONFIG['exec_prefix'], 'lib'), + File.join(RbConfig::CONFIG['prefix'], 'lib'), + "/usr/local/opt/lib", "/usr/local/pkg/lib", "/usr/local/share/lib", + "/usr/local/lib", "/usr/opt/lib", "/usr/pkg/lib", + "/usr/share/lib", "/usr/contrib/lib", "/usr/lib" + ] + + config_dir.concat [ + '/opt', '/pkg', '/share', + '/usr/local/opt', '/usr/local/pkg', '/usr/local/share', '/usr/local', + '/usr/opt', '/usr/pkg', '/usr/share', '/usr/contrib', '/usr' + ].map{|dir| + Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}[87]*/lib') + Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}[87]*') + Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}/lib') + Dir.glob(dir + '/{TclTk,tcltk,Tcl,tcl,Tk,tk}') + }.flatten! + + ENV['PATH'].split(':').each{|dir| + config_dir << File.expand_path(File.join(dir, '..', 'lib')) + } + + # for MacOS X + #config_dir << "~/Library/Tcl" + #config_dir.concat(Dir.glob("~/Library/Tcl/*").sort.reverse) + config_dir << "/Library/Tcl" + config_dir.concat(Dir.glob("/Library/Tcl/*").sort.reverse) + config_dir << "/Network/Library/Tcl" + config_dir.concat(Dir.glob("/Network/Library/Tcl/*").sort.reverse) + config_dir << "/System/Library/Tcl" + config_dir.concat(Dir.glob("/System/Library/Tcl/*").sort.reverse) + [ + #"~/Library/Frameworks", + "/Library/Frameworks", + "/Network/Library/Frameworks", "/System/Library/Frameworks" + ].each{|framework| + config_dir << [File.expand_path(File.join(framework, 'Tcl.framework')), + File.expand_path(File.join(framework, 'Tk.framework'))] + } + end + + tclver, tkver = TkLib_Config['tcltkversion'] + conf = nil + + config_dir.map{|dir| + if dir.kind_of? Array + [dir[0].strip.chomp('/'), dir[1].strip.chomp('/')] + else + dir.strip.chomp('/') + end + }.each{|dir| + # print("check #{dir} ==>"); + if dir.kind_of? Array + tcldir, tkdir = dir + else + tcldir = tkdir = dir + end + + ['Config-shared.sh','config-shared.sh','Config.sh','config.sh'].each{|f| + tclpath = File.join(tcldir, 'tcl' << f) + tkpath = File.join(tkdir, 'tk' << f) + next if !File.exist?(tclpath) || !File.exist?(tkpath) + + # parse tclConfig.sh/tkConfig.sh + tclconf = parse_tclConfig(tclpath) + next if tclver && tclver !~ /^#{tclconf['TCL_MAJOR_VERSION']}(\.?)#{tclconf['TCL_MINOR_VERSION']}/ + tkconf = parse_tclConfig(tkpath) + next if tkver && tkver !~ /^#{tkconf['TK_MAJOR_VERSION']}(\.?)#{tkconf['TK_MINOR_VERSION']}/ + + # find tclConfig.sh & tkConfig.sh + conf = [tclconf, tkconf] unless conf + + # nativethread check + unless TkLib_Config["ruby_with_thread"] + tclconf['TCL_THREADS'] == '1' + puts "WARNIG: find #{tclpath.inspect}, but it WITH nativethread-support under ruby WITHOUT nativethread-support. So, ignore it." + TkLib_Config["tcltk-NG-path"] << File.dirname(tclpath) + next + end + + #return [tclpath, tkpath] + # print(" #{[tclpath, tkpath]}"); + TkLib_Config["tclConfig_paths"] << [tclpath, tkpath] + } + + # print("\n"); + } + + if TkLib_Config["tclConfig_paths"].empty? + [nil, nil] + else + # find tclConfig.sh and tkConfig.sh + TkLib_Config["tclConfig_info"], TkLib_Config["tkConfig_info"] = conf + TkLib_Config["tclConfig_paths"][0] + end +end + +def get_tclConfig(tclConfig_file, tclConfig_dir, tkConfig_dir) + use_tclConfig = (tclConfig_file != false) && + (tclConfig_dir != false) && (tkConfig_dir != false) + + tclConfig_file = nil unless tclConfig_file.kind_of? String + tclConfig_dir = nil unless tclConfig_dir.kind_of? String + tkConfig_dir = nil unless tkConfig_dir.kind_of? String + + unless tclConfig_dir + if tclConfig_file + tclConfig_dir = File.dirname(tclConfig_file) + elsif tkConfig_dir + tclConfig_dir = tkConfig_dir + end + end + tkConfig_dir ||= tclConfig_dir + + TkLib_Config["tclConfig-file"] = tclConfig_file + TkLib_Config["tclConfig-dir"] = tclConfig_dir + TkLib_Config["tkConfig-dir"] = tkConfig_dir + + unless use_tclConfig + puts("Don't use [tclConfig.sh, tkConfig.sh]") + else + puts("Search tclConfig.sh and tkConfig.sh.") + if tclConfig_dir + tclConfig, tkConfig = search_tclConfig([tclConfig_dir, tkConfig_dir]) + else + tclConfig, tkConfig = search_tclConfig() + end + # TclConfig_Info = TkLib_Config["tclConfig_info"] + # TkConfig_Info = TkLib_Config["tkConfig_info"] + + if tclConfig && tkConfig + puts("Use [tclConfig.sh,tkConfig.sh] == ['#{tclConfig}','#{tkConfig}']") + $LIBPATH |= [File.dirname(tclConfig)] + $LIBPATH |= [File.dirname(tkConfig)] + #TkLib_Config["tclConfig_paths"].each{|tclcfg, tkcfg| + # $LIBPATH |= [File.dirname(tclcfg)] | [File.dirname(tkcfg)] + #} + else + puts("Fail to find [tclConfig.sh, tkConfig.sh]") + end + end + + [tclConfig, tkConfig] +end + +def check_NG_path(path_list) + path_list.find_all{|path| not TkLib_Config["tcltk-NG-path"].include?(path) } +end + +def check_shlib_search_path(paths) + if !paths || paths.empty? + path_list = [] + + #if TkLib_Config["ActiveTcl"] + # path_list.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse + #end + if TkLib_Config["ActiveTcl"].kind_of?(String) # glob path + path_list.concat Dir.glob(TkLib_Config["ActiveTcl"]).sort.reverse + end + + vers = get_shlib_versions + path_head, path_dirs = get_shlib_path_head + + path_list.concat vers.map{|ver| + path_head.map{|head| + if ver.empty? + head + "/lib" + else + dirs = [] + + if !Dir.glob(head + "-*").empty? + dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*").empty? + dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*").empty? + end + + if !Dir.glob(head + "[_-]*").empty? + dirs << head + "_#{ver}/lib" if !Dir.glob(head + "_[89].*").empty? + dirs << head + "-#{ver}/lib" if !Dir.glob(head + "-[89].*").empty? + dirs << head + "_#{ver.delete('.')}/lib" if !Dir.glob(head + "_[89][0-9]*").empty? + dirs << head + "-#{ver.delete('.')}/lib" if !Dir.glob(head + "-[89][0-9]*").empty? + end + + dirs + end + } + }.flatten! + + path_list.concat path_dirs + + else + # paths is a string with PATH environment style + path_list = paths.split((is_win32?)? ';': ':') + end + + path_list = check_NG_path(path_list) + + path_list.each{|path| $LIBPATH |= [path.strip] } +end + def find_tcl(tcllib, stubs, version, *opt_paths) - default_paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"] - default_paths << "/Tcl/lib" # default for ActiveTcl + puts "Search Tcl library" + default_paths = [] + + default_paths.concat [ + RbConfig::CONFIG['libdir'], + File.join(RbConfig::CONFIG['exec_prefix'], 'lib'), + File.join(RbConfig::CONFIG['prefix'], 'lib'), + "/usr/local/lib", "/usr/pkg/lib", "/usr/contrib/lib", "/usr/lib" + ].find_all{|dir| File.directory?(dir)} + + default_paths.concat [ + "c:/Tcl/lib", "c:/Program Files/Tcl/lib", + "/Tcl/lib", "/Program Files/Tcl/lib" + ].find_all{|dir| File.directory?(dir)} if (paths = opt_paths.compact).empty? - paths = default_paths + if TclConfig_Info['config_file_path'] + # use definisions on tclConfig.sh + TclConfig_Info['TCL_LIB_SPEC'].sub(TclConfig_Info['TCL_LIB_FLAG'],"").strip.sub("-L","") =~ /("|'|)([^"']+)\1/ + $LIBPATH |= [$2] unless $2.empty? + + unless stubs + #*** Probably, TCL_LIBS is a subset of TK_LIBS. *** + # $LDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] + # $DLDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] + $LDFLAGS << ' ' << TclConfig_Info['TCL_LIB_SPEC'] + return true + end + + if TclConfig_Info['TCL_SUPPORTS_STUBS'] == '0' || + TclConfig_Info['TCL_STUB_LIB_SPEC'].strip.empty? + puts "#{TclConfig_Info['config_file_path']} tells us that your Tcl/Tk library doesn't support stub." + return false + else + #*** Probably, TCL_LIBS is a subset of TK_LIBS. *** + # $LDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] + # $DLDFLAGS << ' ' << TclConfig_Info['TCL_LIBS'] + $LDFLAGS << ' ' << TclConfig_Info['TCL_STUB_LIB_SPEC'] + return true + end + end + + paths = check_NG_path(default_paths) end if stubs @@ -118,7 +687,7 @@ def find_tcl(tcllib, stubs, version, *opt_paths) if version && ! version.empty? versions = [version] else - versions = %w[8.6 8.5 8.4 8.3 8.2 8.1 8.0 7.6] + versions = TkLib_Config['search_versions'] end if tcllib @@ -142,12 +711,62 @@ def find_tcl(tcllib, stubs, version, *opt_paths) st end +def parse_TK_LIBS(tklibs) + sfx = "lib|shlib|dll|so" + re = /(("|')[^"']+\.(#{sfx})\2|[^"' ]+\.(#{sfx})|-l("|')[^"']+\5|-l[^" ]+)/#' + + tklibs.scan(re).map{|lib,| + if lib =~ /^("|')([^"]+)\.(#{sfx})\1/ + "\"-l#{$2}\"" + elsif lib =~ /([^" ]+)\.(#{sfx})/ + "-l#{$1}" + else + lib + end + }.join(' ') +end + def find_tk(tklib, stubs, version, *opt_paths) - default_paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"] - default_paths << "/Tcl/lib" # default for ActiveTcl + puts "Search Tk library" + default_paths = [] + + default_paths.concat [ + RbConfig::CONFIG['libdir'], + File.join(RbConfig::CONFIG['exec_prefix'], 'lib'), + File.join(RbConfig::CONFIG['prefix'], 'lib'), + "/usr/local/lib", "/usr/pkg/lib", "/usr/contrib/lib", "/usr/lib" + ].find_all{|dir| File.directory?(dir)} + + default_paths.concat [ + "c:/Tcl/lib", "c:/Program Files/Tcl/lib", + "/Tcl/lib", "/Program Files/Tcl/lib" + ].find_all{|dir| File.directory?(dir)} if (paths = opt_paths.compact).empty? - paths = default_paths + if TkConfig_Info['config_file_path'] + # use definisions on tkConfig.sh + TkConfig_Info['TK_LIB_SPEC'].sub(TkConfig_Info['TK_LIB_FLAG'],"").strip.sub("-L","") =~ /("|'|)([^"']+)\1/ + $LIBPATH |= [$2] unless $2.empty? + + unless stubs + $LDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) + # $DLDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) + $LDFLAGS << ' ' << TkConfig_Info['TK_LIB_SPEC'] + return true + end + + if TkConfig_Info['TK_STUB_LIB_SPEC'].strip.empty? + puts "#{TkConfig_Info['config_file_path']} tells us that your Tcl/Tk library doesn't support stub." + return false + else + $LDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) + # $DLDFLAGS << ' ' << parse_TK_LIBS(TkConfig_Info['TK_LIBS']) + $LDFLAGS << ' ' << TkConfig_Info['TK_STUB_LIB_SPEC'] + return true + end + end + + paths = check_NG_path(default_paths) end if stubs @@ -161,7 +780,7 @@ def find_tk(tklib, stubs, version, *opt_paths) if version && ! version.empty? versions = [version] else - versions = %w[8.6 8.5 8.4 8.3 8.2 8.1 8.0 4.2] + versions = TkLib_Config['search_versions'] end if tklib @@ -173,7 +792,7 @@ def find_tk(tklib, stubs, version, *opt_paths) find_library("#{lib}#{ver}g", func, *paths) or find_library("#{lib}#{ver.delete('.')}g", func, *paths) or find_library("tk#{ver}", func, *paths) or - find_library("tk#{ver.delete('.')}", func, *paths) or + find_library("tk#{ver.delete('.')}", func, *paths) or find_library("tk#{ver}g", func, *paths) or find_library("tk#{ver.delete('.')}g", func, *paths) } || (!version && find_library(lib, func, *paths)) @@ -185,16 +804,125 @@ def find_tk(tklib, stubs, version, *opt_paths) st end +def find_tcltk_header(tclver, tkver) + base_dir = [] + + base_dir.concat [ + File.join(RbConfig::CONFIG['prefix'], 'include'), + "/usr/local/include", "/usr/pkg/include", "/usr/contrib/include", + "/usr/include" + ].find_all{|dir| File.directory?(dir)} + + base_dir.concat [ + "c:/Tcl/include", "c:/Program Files/Tcl/include", + "/Tcl/include", "/Program Files/Tcl/include" + ].find_all{|dir| File.directory?(dir)} + + if TclConfig_Info['TCL_INCLUDE_SPEC'] && + have_tcl_h = try_cpp('tcl.h', TclConfig_Info['TCL_INCLUDE_SPEC']) + $INCFLAGS << " " << TclConfig_Info['TCL_INCLUDE_SPEC'] + elsif have_tcl_h = have_header('tcl.h') + # find + else + if tclver && ! tclver.empty? + versions = [tclver] + else + versions = TkLib_Config['search_versions'] + end + paths = base_dir.dup + versions.each{|ver| + paths.concat(base_dir.map{|dir| + [dir + '/tcl' + ver, dir + '/tcl' + ver.delete('.')] + }.flatten) + } + have_tcl_h = find_header('tcl.h', *paths) + end + + if TkConfig_Info['TK_INCLUDE_SPEC'] && + have_tk_h = try_cpp('tk.h', TclConfig_Info['TK_INCLUDE_SPEC']) + $INCFLAGS << " " << TkConfig_Info['TK_INCLUDE_SPEC'] + elsif have_tk_h = have_header('tk.h') + # find + else + if tkver && ! tkver.empty? + versions = [tkver] + else + versions = TkLib_Config['search_versions'] + end + paths = base_dir.dup + versions.each{|ver| + paths.concat(base_dir.map{|dir| + [dir + '/tk' + ver, dir + '/tk' + ver.delete('.')] + }.flatten) + } + have_tk_h = find_header('tk.h', *paths) + end + + have_tcl_h && have_tk_h +end + +def setup_for_macosx_framework + # search directory of header files + if File.exist?(dir = File.join(TkLib_Config["tcltk-framework"], + 'Tcl.framework', 'Headers')) + TclConfig_Info['TCL_INCLUDE_SPEC'] = "-I#{dir} " + TclConfig_Info['TK_INCLUDE_SPEC'] = "-I#{File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', 'Headers')} " + else + dir = Dir.glob(File.join(TkLib_Config["tcltk-framework"], + 'Tcl.framework', '*', 'Headers')) + TclConfig_Info['TCL_INCLUDE_SPEC'] = "-I#{dir[0]} " unless dir.empty? + TclConfig_Info['TK_INCLUDE_SPEC'] = "-I#{Dir.glob(File.join(TkLib_Config['tcltk-framework'], 'Tk.framework', '*', 'Headers'))[0]} " + end + + $LDFLAGS << ' -framework Tk -framework Tcl' + + if TkLib_Config["tcl-framework-header"] + TclConfig_Info['TCL_INCLUDE_SPEC'] = + "-I#{TkLib_Config["tcl-framework-header"]} " + end + if TkLib_Config["tk-framework-header"] + TkConfig_Info['TK_INCLUDE_SPEC'] = + "-I#{TkLib_Config["tk-framework-header"]} " + end +end + def find_X11(*opt_paths) - default_paths = - [ "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib" ] - paths = opt_paths.compact.concat(default_paths) + defaults = + [ "/usr/X11*/lib", "/usr/lib/X11*", "/usr/local/X11*", "/usr/openwin/lib" ] + paths = [] + opt_paths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/')))} + defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/')))} st = find_library("X11", "XOpenDisplay", *paths) unless st puts("Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.") end st -end +end + +def search_X_libraries + if TkConfig_Info['config_file_path'] + # use definitions on tkConfig.sh + if TkConfig_Info['TK_XINCLUDES'] && TkConfig_Info['TK_XLIBSW'] && + !TkConfig_Info['TK_XINCLUDES'].strip.empty? && + !TkConfig_Info['TK_XLIBSW'].strip.empty? + use_X = true && with_config("X11", (! is_win32?)) + else + use_X = false || with_config("X11", false) + end + else + # depend on configure options + use_X = with_config("X11", (! is_win32?)) + end + + if use_X + puts("Use X11 libraries.") + x11_idir, x11_ldir = dir_config("X11") + x11_ldir2 = with_config("X11-lib") + exit unless find_X11(x11_ldir2, x11_ldir) + end + + use_X +end def pthread_check() tcl_major_ver = nil @@ -210,60 +938,36 @@ def pthread_check() tcl_enable_thread = nil end - if (tclConfig = with_config("tclConfig-file")) + if TclConfig_Info['config_file_path'] if tcl_enable_thread == true - puts("Warning: --with-tclConfig-file option is ignored, because --enable-tcl-thread option is given.") + puts("Warning: definiton of tclConfig.sh is ignored, because --enable-tcl-thread option is given.") elsif tcl_enable_thread == false - puts("Warning: --with-tclConfig-file option is ignored, because --disable-tcl-thread option is given.") + puts("Warning: definition of tclConfig.sh is ignored, because --disable-tcl-thread option is given.") else # tcl-thread is unknown and tclConfig.sh is given - begin - open(tclConfig, "r") do |cfg| - while line = cfg.gets() - if line =~ /^\s*TCL_THREADS=(0|1)/ - tcl_enable_thread = ($1 == "1") - break - end - - if line =~ /^\s*TCL_MAJOR_VERSION=("|')(\d+)\1/ - tcl_major_ver = $2 - if tcl_major_ver =~ /^[1-7]$/ - tcl_enable_thread = false - break - end - if tcl_major_ver == "8" && tcl_minor_ver == "0" - tcl_enable_thread = false - break - end - end - - if line =~ /^\s*TCL_MINOR_VERSION=("|')(\d+)\1/ - tcl_minor_ver = $2 - if tcl_major_ver == "8" && tcl_minor_ver == "0" - tcl_enable_thread = false - break - end - end - end + if TclConfig_Info['TCL_THREADS'] + tcl_enable_thread = (TclConfig_Info['TCL_THREADS'] == "1") + else + tcl_major_ver = TclConfig_Info['TCL_MAJOR_VERSION'].to_i + tcl_minor_ver = TclConfig_Info['TCL_MINOR_VERSION'].to_i + if tcl_major_ver < 8 || (tcl_major_ver == 8 && tcl_minor_ver == 0) + tcl_enable_thread = false end + end - if tcl_enable_thread == nil - # not find definition - if tcl_major_ver - puts("Warning: '#{tclConfig}' doesn't include TCL_THREADS definition.") - else - puts("Warning: '#{tclConfig}' may not be a tclConfig file.") - end - tclConfig = false + if tcl_enable_thread == nil + # cannot find definition + if tcl_major_ver + puts("Warning: '#{TclConfig_Info['config_file_path']}' doesn't include TCL_THREADS definition.") + else + puts("Warning: '#{TclConfig_Info['config_file_path']}' may not be a tclConfig file.") end - rescue Exception - puts("Warning: fail to read '#{tclConfig}'!! --> ignore the file") tclConfig = false end end end - if tcl_enable_thread == nil && !tclConfig + if tcl_enable_thread == nil && !TclConfig_Info['config_file_path'] # tcl-thread is unknown and tclConfig is unavailable begin try_run_available = try_run("int main() { exit(0); }") @@ -272,12 +976,12 @@ def pthread_check() puts(%Q'\ ***************************************************************************** ** -** PTHREAD SUPPORT CHECK WARNING: +** NATIVETHREAD SUPPORT CHECK WARNING: ** -** We cannot check the consistency of pthread support between Ruby -** and the Tcl/Tk library in your environment (are you perhaps -** cross-compiling?). If pthread support for these 2 packages is -** inconsistent you may find you get errors when running Ruby/Tk +** We cannot check the consistency of nativethread support between +** Ruby and the Tcl/Tk library in your environment (are you perhaps +** cross-compiling?). If nativethread support for these 2 packages +** is inconsistent you may find you get errors when running Ruby/Tk ** (e.g. hangs or segmentation faults). We strongly recommend ** you to check the consistency manually. ** @@ -291,7 +995,7 @@ def pthread_check() # tcl-thread is unknown if try_run(< -int main() { +int main() { Tcl_Interp *ip; ip = Tcl_CreateInterp(); exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1); @@ -310,26 +1014,27 @@ EOF end # check pthread mode - if (macro_defined?('HAVE_NATIVETHREAD', '#include "ruby.h"')) + if (TkLib_Config["ruby_with_thread"]) # ruby -> enable unless tcl_enable_thread # ruby -> enable && tcl -> disable puts(%Q'\ ***************************************************************************** ** -** PTHREAD SUPPORT MODE WARNING: +** NATIVETHREAD SUPPORT MODE WARNING: ** -** Ruby is compiled with --enable-pthread, but your Tcl/Tk library -** seems to be compiled without pthread support. Although you can -** create the tcltklib library, this combination may cause errors -** (e.g. hangs or segmentation faults). If you have no reason to -** keep the current pthread support status, we recommend you reconfigure -** and recompile the libraries so that both or neither support pthreads. +** Ruby is compiled with --enable-pthread, but your Tcl/Tk library +** seems to be compiled without nativethread support. Although you can +** create the tcltklib library, this combination may cause errors (e.g. +** hangs or segmentation faults). If you have no reason to keep the +** current nativethread support status, we recommend you reconfigure and +** recompile the libraries so that both or neither support nativethreads. ** -** If you want change the status of pthread support, please recompile -** Ruby without "--enable-pthread" configure option or recompile Tcl/Tk -** with "--enable-threads" configure option (if your Tcl/Tk is later -** than or equal to Tcl/Tk 8.1). +** If you want change the status of nativethread support, please recompile +** Ruby without "--enable-pthread" configure option (If you use Ruby 1.9.x +** or later, you cannot remove this option, because it requires native- +** thread support.) or recompile Tcl/Tk with "--enable-threads" configure +** option (if your Tcl/Tk is later than or equal to Tcl/Tk 8.1). ** ***************************************************************************** ') @@ -351,13 +1056,13 @@ EOF puts(%Q'\ ***************************************************************************** ** -** PTHREAD SUPPORT MODE ERROR: +** NATIVETHREAD SUPPORT MODE ERROR: ** -** Ruby is not compiled with --enable-pthread, but your Tcl/Tk -** library seems to be compiled with pthread support. This +** Ruby is not compiled with --enable-pthread, but your Tcl/Tk +** library seems to be compiled with nativethread support. This ** combination may cause frequent hang or segmentation fault ** errors when Ruby/Tk is working. We recommend that you NEVER -** create the library with such a combination of pthread support. +** create the library with such a combination of nativethread support. ** ** Please recompile Ruby with the "--enable-pthread" configure option ** or recompile Tcl/Tk with the "--disable-threads" configure option. @@ -374,44 +1079,135 @@ EOF end end -tclver, tkver = check_tcltk_version(tcltk_version) +############################################################## +# main +############################################################## +# check header files +have_func("ruby_native_thread_p", "ruby.h") +have_func("rb_errinfo", "ruby.h") +have_func("rb_safe_level", "ruby.h") +have_func("rb_hash_lookup", "ruby.h") +have_func("rb_proc_new", "ruby.h") +have_func("rb_obj_untrust", "ruby.h") +have_func("rb_obj_taint", "ruby.h") +have_func("rb_set_safe_level_force", "ruby.h") -if ( tcltk_framework || - ( have_header("tcl.h") && have_header("tk.h") && - ( !use_X || find_X11(x11_ldir2, x11_ldir) ) && - find_tcl(tcllib, stubs, tclver, *tcl_ldir_list) && - find_tk(tklib, stubs, tkver, *tk_ldir_list) ) ) - $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs - $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM +have_struct_member("struct RArray", "ptr", "ruby.h") +have_struct_member("struct RArray", "len", "ruby.h") - if tcltk_framework - if tcl_framework_header - $CPPFLAGS += " -I#{tcl_framework_header}" - else - $CPPFLAGS += " -I#{tcltk_framework}/Tcl.framework/Headers" - end - - if tk_framework_header - $CPPFLAGS += " -I#{tk_framework_header}" - else - $CPPFLAGS += " -I#{tcltk_framework}/Tk.framework/Headers" - end - - $LDFLAGS += ' -framework Tk -framework Tcl' - end - - if stubs or pthread_check - # create Makefile - - # for SUPPORT_STATUS - $INSTALLFILES ||= [] - $INSTALLFILES << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"] - - have_func("rb_hash_lookup", "ruby.h") - - # create - $defs << %[-DRUBY_VERSION=\\"#{RUBY_VERSION}\\"] - $defs << %[-DRUBY_RELEASE_DATE=\\"#{RUBY_RELEASE_DATE}\\"] - create_makefile("tcltklib") - end +# check libraries +unless is_win32? + have_library("nsl", "t_open") + have_library("socket", "socket") + have_library("dl", "dlopen") + have_library("m", "log") +end +$CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM + +# Does ruby have nativethread ? +TkLib_Config["ruby_with_thread"] = + macro_defined?('HAVE_NATIVETHREAD', '#include "ruby.h"') + +#--------------------------------------------------- +# check requirement of Tcl/tk version +tcltk_version = with_config("tcltkversion") +tclver, tkver = + TkLib_Config["tcltkversion"] = check_tcltk_version(tcltk_version) +puts("Specified Tcl/Tk version is #{[tclver, tkver]}") if tclver && tkver + +# use ActiveTcl ? +#if activeTcl = with_config("ActiveTcl") +if activeTcl = with_config("ActiveTcl", true) + puts("Use ActiveTcl libraries (if available).") + activeTcl = '/opt/ActiveTcl*/lib' unless activeTcl.kind_of? String +end +TkLib_Config["ActiveTcl"] = activeTcl + +# enable Tcl/Tk stubs? +=begin +if TclConfig_Info['TCL_STUB_LIB_SPEC'] && TkConfig_Info['TK_STUB_LIB_SPEC'] && + !TclConfig_Info['TCL_STUB_LIB_SPEC'].strip.empty? && + !TkConfig_Info['TK_STUB_LIB_SPEC'].strip.empty? + stubs = true + unless (st = enable_config("tcltk-stubs")).nil? + stubs &&= st + end + unless (st = with_config("tcltk-stubs")).nil? + stubs &&= st + end +else + stubs = enable_config("tcltk-stubs") || with_config("tcltk-stubs") +end +=end +stubs = enable_config("tcltk-stubs") || with_config("tcltk-stubs") +if (TkLib_Config["tcltk-stubs"] = stubs) + puts("Compile with Tcl/Tk stubs.") + $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' +end + +# get tclConfig.sh/tkConfig.sh +TkLib_Config["tcltk-NG-path"] = [] +tclcfg, tkcfg = get_tclConfig(with_config("tclConfig-file", true), + with_config("tclConfig-dir", true), + with_config("tkConfig-dir", true)) +TclConfig_Info = TkLib_Config["tclConfig_info"] || {} +TkConfig_Info = TkLib_Config["tkConfig_info"] || {} +TclConfig_Info['config_file_path'] = tclcfg +TkConfig_Info['config_file_path'] = tkcfg + +# check tk_shlib_search_path +check_shlib_search_path(with_config('tk-shlib-search-path')) + +# search X libraries +use_X = search_X_libraries + +# set TCL_DEFS and TK_DEFS +# $CPPFLAGS += " #{TclConfig_Info['TCL_DEFS']}" +# $CPPFLAGS += " #{TkConfig_Info['TK_DEFS']}" +$CPPFLAGS += collect_tcltk_defs(TclConfig_Info['TCL_DEFS'], TkConfig_Info['TK_DEFS']) + +# MacOS X Frameworks? +if TkLib_Config["tcltk-framework"] + puts("Use MacOS X Frameworks.") + setup_for_macosx_framework +end + +# search Tcl/Tk libraries +tk_idir, tk_ldir = dir_config("tk") if with_config('tk') +tcl_idir, tcl_ldir = dir_config("tcl") if with_config('tcl') + +tk_ldir2 = with_config("tk-lib") +tcl_ldir2 = with_config("tcl-lib") + +tk_ldir_list = [tk_ldir2, tk_ldir] +tcl_ldir_list = [tcl_ldir2, tcl_ldir] + +tklib = with_config("tklib") +tcllib = with_config("tcllib") + +TclConfig_Info['TCL_INCLUDE_SPEC'] = "-I#{tcl_idir.quote}" if tcl_idir +TkConfig_Info['TK_INCLUDE_SPEC'] = "-I#{tk_idir.quote}" if tk_idir + +#--------------------------------------------------- + +if (TkLib_Config["tcltk-framework"] || + ( find_tcltk_header(tclver, tkver) && + find_tcl(tcllib, stubs, tclver, *tcl_ldir_list) && + find_tk(tklib, stubs, tkver, *tk_ldir_list) ) ) && + (stubs || pthread_check()) + # create Makefile + + # for SUPPORT_STATUS + $INSTALLFILES ||= [] + $INSTALLFILES << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"] + + # create + $defs << %[-DRUBY_VERSION=\\"#{RUBY_VERSION}\\"] + $defs << %[-DRUBY_RELEASE_DATE=\\"#{RUBY_RELEASE_DATE}\\"] + + create_makefile("tcltklib") + + puts "Find Tcl/Tk libraries. Make tcltklib.so which is required by Ruby/Tk." +else + puts "Can't find proper Tcl/Tk libraries. So, can't make tcltklib.so which is required by Ruby/Tk." end diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb index ec718678f0..c10c349d05 100644 --- a/ext/tk/lib/multi-tk.rb +++ b/ext/tk/lib/multi-tk.rb @@ -28,14 +28,20 @@ class << TclTkIp if Thread.current.group != ThreadGroup::Default raise SecurityError, 'only ThreadGroup::Default can call TclTkIp.new' end - __new__(*args) + obj = __new__(*args) + obj.instance_eval{ + @force_default_encoding ||= TkUtil.untrust([false]) + @encoding ||= TkUtil.untrust([nil]) + def @encoding.to_s; self.join(nil); end + } + obj end end ################################################ # use pseudo-toplevel feature of MultiTkIp ? -if (!defined?(Use_PseudoToplevel_Feature_of_MultiTkIp) || +if (!defined?(Use_PseudoToplevel_Feature_of_MultiTkIp) || Use_PseudoToplevel_Feature_of_MultiTkIp) module MultiTkIp_PseudoToplevel_Evaluable #def pseudo_toplevel_eval(body = Proc.new) @@ -67,9 +73,9 @@ if (!defined?(Use_PseudoToplevel_Feature_of_MultiTkIp) || def method_missing(id, *args) begin - has_top = (top = MultiTkIp.__getip.__pseudo_toplevel) && - top.respond_to?(:pseudo_toplevel_evaluable?) && - top.pseudo_toplevel_evaluable? && + has_top = (top = MultiTkIp.__getip.__pseudo_toplevel) && + top.respond_to?(:pseudo_toplevel_evaluable?) && + top.pseudo_toplevel_evaluable? && top.respond_to?(id) rescue Exception => e has_top = false @@ -114,34 +120,35 @@ MultiTkIp_OK.freeze class MultiTkIp BASE_DIR = File.dirname(__FILE__) - WITH_RUBY_VM = Object.const_defined?(:VM) && ::VM.class == Class - WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class + WITH_RUBY_VM = Object.const_defined?(:RubyVM) && ::RubyVM.class == Class + WITH_ENCODING = defined?(::Encoding.default_external) + #WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class - (@@SLAVE_IP_ID = ['slave'.freeze, '0'.taint]).instance_eval{ + (@@SLAVE_IP_ID = ['slave'.freeze, TkUtil.untrust('0')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze } - @@IP_TABLE = {}.taint unless defined?(@@IP_TABLE) + @@IP_TABLE = TkUtil.untrust({}) unless defined?(@@IP_TABLE) - @@INIT_IP_ENV = [].taint unless defined?(@@INIT_IP_ENV) # table of Procs - @@ADD_TK_PROCS = [].taint unless defined?(@@ADD_TK_PROCS) # table of [name, args, body] + @@INIT_IP_ENV = TkUtil.untrust([]) unless defined?(@@INIT_IP_ENV) # table of Procs + @@ADD_TK_PROCS = TkUtil.untrust([]) unless defined?(@@ADD_TK_PROCS) # table of [name, args, body] - @@TK_TABLE_LIST = [].taint unless defined?(@@TK_TABLE_LIST) + @@TK_TABLE_LIST = TkUtil.untrust([]) unless defined?(@@TK_TABLE_LIST) unless defined?(@@TK_CMD_TBL) - @@TK_CMD_TBL = Object.new.taint + @@TK_CMD_TBL = TkUtil.untrust(Object.new) # @@TK_CMD_TBL.instance_variable_set('@tbl', {}.taint) - @@TK_CMD_TBL.instance_variable_set('@tbl', Hash.new{|hash,key| - fail IndexError, - "unknown command ID '#{key}'" - }.taint) + tbl_obj = TkUtil.untrust(Hash.new{|hash,key| + fail IndexError, "unknown command ID '#{key}'" + }) + @@TK_CMD_TBL.instance_variable_set('@tbl', tbl_obj) class << @@TK_CMD_TBL allow = [ - '__send__', '__id__', 'freeze', 'inspect', 'kind_of?', 'object_id', + '__send__', '__id__', 'freeze', 'inspect', 'kind_of?', 'object_id', '[]', '[]=', 'delete', 'each', 'has_key?' ] instance_methods.each{|m| undef_method(m) unless allow.index(m.to_s)} @@ -180,7 +187,7 @@ class MultiTkIp def delete(idx, &blk) # if gets an entry, is permited to delete if self[idx] - @tbl.delete(idx) + @tbl.delete(idx) elsif blk blk.call(idx) else @@ -216,7 +223,10 @@ class MultiTkIp @@CB_ENTRY_CLASS = Class.new(TkCallbackEntry){ def initialize(ip, cmd) @ip = ip - @cmd = cmd + @safe = safe = $SAFE + # @cmd = cmd + cmd = MultiTkIp._proc_on_safelevel(&cmd) + @cmd = proc{|*args| cmd.call(safe, *args)} self.freeze end attr_reader :ip, :cmd @@ -226,8 +236,8 @@ class MultiTkIp def call(*args) unless @ip.deleted? current = Thread.current - backup_ip = current['callback_ip'] - current['callback_ip'] = @ip + backup_ip = current[:callback_ip] + current[:callback_ip] = @ip begin ret = @ip.cb_eval(@cmd, *args) fail ret if ret.kind_of?(Exception) @@ -260,7 +270,7 @@ class MultiTkIp fail e end ensure - current['callback_ip'] = backup_ip + current[:callback_ip] = backup_ip end end end @@ -436,7 +446,7 @@ class MultiTkIp rescue SystemExit => e # delete IP unless @interp.deleted? - @slave_ip_tbl.each{|name, subip| + @slave_ip_tbl.each{|name, subip| _destroy_slaves_of_slaveIP(subip) begin # subip._eval_without_enc("foreach i [after info] {after cancel $i}") @@ -459,11 +469,11 @@ class MultiTkIp next if subip.deleted? end end - if subip.respond_to?(:safe_base?) && subip.safe_base? && + if subip.respond_to?(:safe_base?) && subip.safe_base? && !subip.deleted? # do 'exit' to call the delete_hook procedure begin - subip._eval_without_enc('exit') + subip._eval_without_enc('exit') rescue Exception end else @@ -538,11 +548,11 @@ class MultiTkIp next if subip.deleted? end end - if subip.respond_to?(:safe_base?) && subip.safe_base? && + if subip.respond_to?(:safe_base?) && subip.safe_base? && !subip.deleted? # do 'exit' to call the delete_hook procedure begin - subip._eval_without_enc('exit') + subip._eval_without_enc('exit') rescue Exception end else @@ -657,12 +667,12 @@ class MultiTkIp case cmd when 'set_safe_level' begin - safe_level = args[0] if safe_level < args[0] + safe_level = args[0] if safe_level < args[0] rescue Exception end when 'call_mainloop' thread = args.shift - _check_and_return(thread, + _check_and_return(thread, MultiTkIp_OK.new(_receiver_mainloop(*args))) else # ignore @@ -670,8 +680,8 @@ class MultiTkIp else # procedure - last_thread[thread] = _receiver_eval_proc(last_thread[thread], - safe_level, thread, + last_thread[thread] = _receiver_eval_proc(last_thread[thread], + safe_level, thread, cmd, *args) end end @@ -696,7 +706,7 @@ class MultiTkIp if @interp.deleted? thread.raise RuntimeError, 'the interpreter is already deleted' else - thread.raise RuntimeError, + thread.raise RuntimeError, 'the interpreter no longer receives command procedures' end end @@ -729,15 +739,15 @@ class MultiTkIp @@DEFAULT_MASTER = self.allocate @@DEFAULT_MASTER.instance_eval{ - @tk_windows = {}.taint + @tk_windows = TkUtil.untrust({}) - @tk_table_list = [].taint + @tk_table_list = TkUtil.untrust([]) - @slave_ip_tbl = {}.taint + @slave_ip_tbl = TkUtil.untrust({}) - @slave_ip_top = {}.taint + @slave_ip_top = TkUtil.untrust({}) - @evloop_thread = [].taint + @evloop_thread = TkUtil.untrust([]) unless keys.kind_of? Hash fail ArgumentError, "expecting a Hash object for the 2nd argument" @@ -748,19 +758,49 @@ class MultiTkIp else ### Ruby 1.9 !!!!!!!!!!! @interp_thread = Thread.new{ current = Thread.current - current[:interp] = interp = TclTkIp.new(name, _keys2opts(keys)) + begin + current[:interp] = interp = TclTkIp.new(name, _keys2opts(keys)) + rescue e + current[:interp] = e + raise e + end #sleep current[:mutex] = mutex = Mutex.new current[:root_check] = cond_var = ConditionVariable.new - begin - current[:status] = interp.mainloop(true) - rescue Exception=>e - current[:status] = e - ensure - mutex.synchronize{ cond_var.broadcast } + status = [nil] + def status.value + self[0] + end + def status.value=(val) + self[0] = val + end + current[:status] = status + + begin + begin + #TclTkLib.mainloop_abort_on_exception = false + #Thread.current[:status].value = TclTkLib.mainloop(true) + interp.mainloop_abort_on_exception = true + current[:status].value = interp.mainloop(true) + rescue SystemExit=>e + current[:status].value = e + rescue Exception=>e + current[:status].value = e + retry if interp.has_mainwindow? + ensure + mutex.synchronize{ cond_var.broadcast } + end + + #Thread.current[:status].value = TclTkLib.mainloop(false) + current[:status].value = interp.mainloop(false) + + ensure + # interp must be deleted before the thread for interp is dead. + # If not, raise Tcl_Panic on Tcl_AsyncDelete because async handler + # deleted by the wrong thread. + interp.delete end - current[:status] = interp.mainloop(false) } until @interp_thread[:interp] Thread.pass @@ -778,13 +818,19 @@ class MultiTkIp end end + @interp.instance_eval{ + @force_default_encoding ||= TkUtil.untrust([false]) + @encoding ||= TkUtil.untrust([nil]) + def @encoding.to_s; self.join(nil); end + } + @ip_name = nil - @callback_status = [].taint + @callback_status = TkUtil.untrust([]) @system = Object.new - @wait_on_mainloop = [true, 0].taint + @wait_on_mainloop = TkUtil.untrust([true, 0]) @threadgroup = Thread.current.group @@ -809,13 +855,13 @@ class MultiTkIp @pseudo_toplevel = [false, nil] def self.__pseudo_toplevel - Thread.current.group == ThreadGroup::Default && + Thread.current.group == ThreadGroup::Default && MultiTkIp.__getip == @@DEFAULT_MASTER && self.__pseudo_toplevel_evaluable? && @pseudo_toplevel[1] end def self.__pseudo_toplevel=(m) - unless (Thread.current.group == ThreadGroup::Default && + unless (Thread.current.group == ThreadGroup::Default && MultiTkIp.__getip == @@DEFAULT_MASTER) fail SecurityError, "no permission to manipulate" end @@ -839,7 +885,7 @@ class MultiTkIp end def self.__pseudo_toplevel_evaluable=(mode) - unless (Thread.current.group == ThreadGroup::Default && + unless (Thread.current.group == ThreadGroup::Default && MultiTkIp.__getip == @@DEFAULT_MASTER) fail SecurityError, "no permission to manipulate" end @@ -866,7 +912,7 @@ class MultiTkIp rescue @assign_request=>req begin req.ret[0] = req.target.instance_eval{ - @cmd_receiver, @receiver_watchdog = + @cmd_receiver, @receiver_watchdog = _create_receiver_and_watchdog(@safe_level[0]) @threadgroup.add @cmd_receiver @threadgroup.add @receiver_watchdog @@ -951,8 +997,9 @@ class MultiTkIp begin class << subclass self.methods.each{|m| + name = m.to_s begin - unless m == '__id__' || m == '__send__' || m == 'freeze' + unless name == '__id__' || name == '__send__' || name == 'freeze' undef_method(m) end rescue Exception @@ -962,7 +1009,7 @@ class MultiTkIp end ensure subclass.freeze - fail SecurityError, + fail SecurityError, "cannot create subclass of MultiTkIp on a untrusted ThreadGroup" end end @@ -971,9 +1018,9 @@ class MultiTkIp ###################################### @@SAFE_OPT_LIST = [ - 'accessPath'.freeze, - 'statics'.freeze, - 'nested'.freeze, + 'accessPath'.freeze, + 'statics'.freeze, + 'nested'.freeze, 'deleteHook'.freeze ].freeze @@ -986,7 +1033,7 @@ class MultiTkIp keys.each{|k,v| k_str = k.to_s if k_str == 'name' - name = v + name = v elsif k_str == 'safe' safe = v elsif @@SAFE_OPT_LIST.member?(k_str) @@ -1058,8 +1105,8 @@ class MultiTkIp # match display? if assoc_display != new_keys['display'] if optkeys.key?(:display) || optkeys.key?('display') - fail RuntimeError, - "conflicting 'display'=>#{new_keys['display']} " + + fail RuntimeError, + "conflicting 'display'=>#{new_keys['display']} " + "and display '#{assoc_display}' on 'use'=>#{new_keys['use']}" else new_keys['display'] = assoc_display @@ -1126,14 +1173,14 @@ class MultiTkIp fc.bindtags = fc.bindtags.unshift(tag) TkFrame.new(fc, :bd=>0){|f| - TkButton.new(f, - :text=>'Delete', :bd=>1, :padx=>2, :pady=>0, + TkButton.new(f, + :text=>'Delete', :bd=>1, :padx=>2, :pady=>0, :highlightthickness=>0, :command=>slave_delete_proc ).pack(:side=>:right, :fill=>:both) f.pack(:side=>:right, :fill=>:both, :expand=>true) } - TkLabel.new(fc, :text=>msg, :padx=>2, :pady=>0, + TkLabel.new(fc, :text=>msg, :padx=>2, :pady=>0, :anchor=>:w).pack(:side=>:left, :fill=>:both, :expand=>true) fc.pack(:side=>:bottom, :fill=>:x) @@ -1157,6 +1204,11 @@ class MultiTkIp # safe interpreter ip_name = _create_slave_ip_name slave_ip = @interp.create_slave(ip_name, true) + slave_ip.instance_eval{ + @force_default_encoding ||= TkUtil.untrust([false]) + @encoding ||= TkUtil.untrust([nil]) + def @encoding.to_s; self.join(nil); end + } @slave_ip_tbl[ip_name] = slave_ip def slave_ip.safe_base? true @@ -1171,7 +1223,7 @@ class MultiTkIp if tk_opts.key?('use') @slave_ip_top[ip_name] = '' else - tk_opts, top_path = __create_safetk_frame(slave_ip, ip_name, app_name, + tk_opts, top_path = __create_safetk_frame(slave_ip, ip_name, app_name, tk_opts) @slave_ip_top[ip_name] = top_path end @@ -1181,11 +1233,11 @@ class MultiTkIp end if safe_opts.key?('deleteHook') || safe_opts.key?(:deleteHook) - @interp._eval("::safe::interpConfigure #{ip_name} " + + @interp._eval("::safe::interpConfigure #{ip_name} " + _keys2opts(safe_opts)) else - @interp._eval("::safe::interpConfigure #{ip_name} " + - _keys2opts(safe_opts) + '-deleteHook {' + + @interp._eval("::safe::interpConfigure #{ip_name} " + + _keys2opts(safe_opts) + '-deleteHook {' + TkComm._get_eval_string(proc{|slave| self._default_delete_hook(slave) }) + '}') @@ -1199,6 +1251,11 @@ class MultiTkIp ip_name = _create_slave_ip_name slave_ip = @interp.create_slave(ip_name, false) + slave_ip.instance_eval{ + @force_default_encoding ||= TkUtil.untrust([false]) + @encoding ||= TkUtil.untrust([nil]) + def @encoding.to_s; self.join(nil); end + } slave_ip._invoke('set', 'argv0', name) if name.kind_of?(String) slave_ip._invoke('set', 'argv', _keys2opts(keys)) @interp._invoke('load', '', 'Tk', ip_name) @@ -1249,12 +1306,12 @@ class MultiTkIp @cb_error_proc = [] @evloop_thread = [] - @tk_windows.taint unless @tk_windows.tainted? - @tk_table_list.taint unless @tk_table_list.tainted? - @slave_ip_tbl.taint unless @slave_ip_tbl.tainted? - @slave_ip_top.taint unless @slave_ip_top.tainted? - @cb_error_proc.taint unless @cb_error_proc.tainted? - @evloop_thread.taint unless @evloop_thread.tainted? + TkUtil.untrust(@tk_windows) unless @tk_windows.tainted? + TkUtil.untrust(@tk_table_list) unless @tk_table_list.tainted? + TkUtil.untrust(@slave_ip_tbl) unless @slave_ip_tbl.tainted? + TkUtil.untrust(@slave_ip_top) unless @slave_ip_top.tainted? + TkUtil.untrust(@cb_error_proc) unless @cb_error_proc.tainted? + TkUtil.untrust(@evloop_thread) unless @evloop_thread.tainted? @callback_status = [] @@ -1268,9 +1325,22 @@ class MultiTkIp # create master-ip unless WITH_RUBY_VM @interp = TclTkIp.new(name, _keys2opts(tk_opts)) + @interp.instance_eval{ + @force_default_encoding ||= TkUtil.untrust([false]) + @encoding ||= TkUtil.untrust([nil]) + def @encoding.to_s; self.join(nil); end + } + else ### Ruby 1.9 !!!!!!!!!!! +=begin @interp_thread = Thread.new{ Thread.current[:interp] = interp = TclTkIp.new(name, _keys2opts(tk_opts)) + interp.instance_eval{ + @force_default_encoding ||= TkUtil.untrust([false]) + @encoding ||= TkUtil.untrust([nil]) + def @encoding.to_s; self.join(nil); end + } + #sleep TclTkLib.mainloop(true) } @@ -1279,20 +1349,79 @@ class MultiTkIp end # INTERP_THREAD.run @interp = @interp_thread[:interp] +=end + @interp_thread = Thread.new{ + current = Thread.current + begin + current[:interp] = interp = TclTkIp.new(name, _keys2opts(tk_opts)) + rescue e + current[:interp] = e + raise e + end + #sleep + #TclTkLib.mainloop(true) + current[:mutex] = mutex = Mutex.new + current[:root_check] = cond_ver = ConditionVariable.new + + status = [nil] + def status.value + self[0] + end + def status.value=(val) + self[0] = val + end + current[:status] = status + + begin + current[:status].value = interp.mainloop(true) + rescue SystemExit=>e + current[:status].value = e + rescue Exception=>e + current[:status].value = e + retry if interp.has_mainwindow? + ensure + mutex.synchronize{ cond_var.broadcast } + end + current[:status].value = interp.mainloop(false) + } + until @interp_thread[:interp] + Thread.pass + end + # INTERP_THREAD.run + @interp = @interp_thread[:interp] + + @evloop_thread[0] = @interp_thread + + def self.mainloop(check_root = true) + begin + TclTkLib.set_eventloop_window_mode(true) + @interp_thread.value + ensure + TclTkLib.set_eventloop_window_mode(false) + end + end end + @interp.instance_eval{ + @force_default_encoding ||= TkUtil.untrust([false]) + @encoding ||= TkUtil.untrust([nil]) + def @encoding.to_s; self.join(nil); end + } + @ip_name = nil + if safe safe = $SAFE if safe < $SAFE @safe_level = [safe] else @safe_level = [$SAFE] end + else # create slave-ip if safeip || master.safe? @safe_base = true - @interp, @ip_name = master.__create_safe_slave_obj(safe_opts, + @interp, @ip_name = master.__create_safe_slave_obj(safe_opts, name, tk_opts) # @interp_thread = nil if RUBY_VERSION < '1.9.0' ### !!!!!!!!!!! @interp_thread = nil unless WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!! @@ -1313,15 +1442,15 @@ class MultiTkIp @safe_level = [master.safe_level] end end - @set_alias_proc = proc{|name| + @set_alias_proc = proc{|name| master._invoke('interp', 'alias', @ip_name, name, '', name) }.freeze end @system = Object.new - @wait_on_mainloop = [true, 0].taint - # @wait_on_mainloop = [false, 0].taint + @wait_on_mainloop = TkUtil.untrust([true, 0]) + # @wait_on_mainloop = TkUtil.untrust([false, 0]) @threadgroup = ThreadGroup.new @@ -1340,9 +1469,8 @@ class MultiTkIp @@DEFAULT_MASTER.assign_receiver_and_watchdog(self) @@IP_TABLE[@threadgroup] = self - @@TK_TABLE_LIST.size.times{ - (tbl = {}).tainted? || tbl.taint - @tk_table_list << tbl + @@TK_TABLE_LIST.size.times{ + @tk_table_list << TkUtil.untrust({}) } _init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS) @@ -1390,6 +1518,17 @@ end # get target IP class MultiTkIp + @@CALLBACK_SUBTHREAD = Class.new(Thread){ + def self.new(interp, &blk) + super(interp){|ip| Thread.current[:callback_ip] = ip; blk.call} + end + + @table = TkUtil.untrust(Hash.new{|h,k| h[k] = TkUtil.untrust([])}) + def self.table + @table + end + } + def self._ip_id_ __getip._ip_id_ end @@ -1400,15 +1539,18 @@ class MultiTkIp def self.__getip current = Thread.current - if TclTkLib.mainloop_thread? != false && current['callback_ip'] - return current['callback_ip'] + if current.kind_of?(@@CALLBACK_SUBTHREAD) + return current[:callback_ip] + end + if TclTkLib.mainloop_thread? != false && current[:callback_ip] + return current[:callback_ip] end if current.group == ThreadGroup::Default @@DEFAULT_MASTER else ip = @@IP_TABLE[current.group] unless ip - fail SecurityError, + fail SecurityError, "cannot call Tk methods on #{Thread.current.inspect}" end ip @@ -1422,11 +1564,11 @@ class << MultiTkIp alias __new new private :__new - def new_master(safe=nil, keys={}) + def new_master(safe=nil, keys={}, &blk) if MultiTkIp::WITH_RUBY_VM #### TODO !!!!!! - fail RuntimeError, - 'sorry, still not support multiple master-interpreters on Ruby VM' + fail RuntimeError, + 'sorry, still not support multiple master-interpreters on RubyVM' end if safe.kind_of?(Hash) @@ -1444,15 +1586,17 @@ class << MultiTkIp ip = __new(__getip, nil, keys) #ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given? - if block_given? - Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)} - end + if block_given? + #Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)} + #Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; yield}.call)} + ip._proc_on_safelevel(&blk).call(ip.safe_level) + end ip end alias new new_master - def new_slave(safe=nil, keys={}) + def new_slave(safe=nil, keys={}, &blk) if safe.kind_of?(Hash) keys = safe elsif safe.kind_of?(Integer) @@ -1469,13 +1613,15 @@ class << MultiTkIp ip = __new(__getip, false, keys) # ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given? if block_given? - Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)} + #Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)} + #Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; yield}.call)} + ip._proc_on_safelevel(&blk).call(ip.safe_level) end ip end alias new_trusted_slave new_slave - def new_safe_slave(safe=4, keys={}) + def new_safe_slave(safe=4, keys={}, &blk) if safe.kind_of?(Hash) keys = safe elsif safe.kind_of?(Integer) @@ -1490,7 +1636,9 @@ class << MultiTkIp ip = __new(__getip, true, keys) # ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call) if block_given? if block_given? - Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)} + #Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; Proc.new}.call)} + #Thread.new{ip.eval_proc(proc{$SAFE=ip.safe_level; yield}.call)} + ip._proc_on_safelevel(&blk).call(ip.safe_level) end ip end @@ -1576,7 +1724,7 @@ class MultiTkIp def slaves(all = false) raise SecurityError, "no permission to manipulate" unless self.manipulable? - @interp._invoke('interp','slaves').split.map!{|name| + @interp._invoke('interp','slaves').split.map!{|name| if @slave_ip_tbl.key?(name) @slave_ip_tbl[name] elsif all @@ -1623,9 +1771,8 @@ class MultiTkIp end def _add_new_tables - (@@TK_TABLE_LIST.size - @tk_table_list.size).times{ - (tbl = {}).tainted? || tbl.taint - @tk_table_list << tbl + (@@TK_TABLE_LIST.size - @tk_table_list.size).times{ + @tk_table_list << TkUtil.untrust({}) } end @@ -1660,7 +1807,7 @@ class MultiTkIp def _init_ip_internal(init_ip_env, add_tk_procs) #init_ip_env.each{|script| self.eval_proc{script.call(self)}} init_ip_env.each{|script| self._init_ip_env(script)} - add_tk_procs.each{|name, args, body| + add_tk_procs.each{|name, args, body| if master? @interp._invoke('proc', name, args, body) if args && body else @@ -1683,7 +1830,7 @@ class MultiTkIp __getip._tk_table_list[id] end def self.create_table - if __getip.slave? + if __getip.slave? begin raise SecurityError, "slave-IP has no permission creating a new table" rescue SecurityError => e @@ -1733,7 +1880,7 @@ class MultiTkIp end end - # @@IP_TABLE.each{|tg, ip| + # @@IP_TABLE.each{|tg, ip| # ip._init_ip_env(script) # } @@DEFAULT_MASTER.__init_ip_env__(@@IP_TABLE, script) @@ -1745,7 +1892,7 @@ class MultiTkIp else name = name.to_s @@ADD_TK_PROCS << [name, args, body] - @@IP_TABLE.each{|tg, ip| + @@IP_TABLE.each{|tg, ip| ip._add_tk_procs(name, args, body) } end @@ -1754,11 +1901,11 @@ class MultiTkIp def self.remove_tk_procs(*names) names.each{|name| name = name.to_s - @@ADD_TK_PROCS.delete_if{|elem| + @@ADD_TK_PROCS.delete_if{|elem| elem.kind_of?(Array) && elem[0].to_s == name } } - @@IP_TABLE.each{|tg, ip| + @@IP_TABLE.each{|tg, ip| ip._remove_tk_procs(*names) } end @@ -1768,7 +1915,6 @@ class MultiTkIp end end - # for callback operation class MultiTkIp def self.cb_entry_class @@ -1792,6 +1938,13 @@ class MultiTkIp ret end =end + def cb_eval(cmd, *args) + self.eval_callback(*args, + &_proc_on_safelevel{|*params| + TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params)) + }) + end +=begin def cb_eval(cmd, *args) self.eval_callback(*args){|safe, *params| $SAFE=safe if $SAFE < safe @@ -1799,6 +1952,7 @@ class MultiTkIp TkComm._get_eval_string(TkUtil.eval_cmd(cmd, *params)) } end +=end =begin def cb_eval(cmd, *args) @callback_status[0] ||= TkVariable.new @@ -1858,7 +2012,7 @@ class MultiTkIp end def __pseudo_toplevel=(m) - unless (Thread.current.group == ThreadGroup::Default && + unless (Thread.current.group == ThreadGroup::Default && MultiTkIp.__getip == @@DEFAULT_MASTER) fail SecurityError, "no permission to manipulate" end @@ -1882,7 +2036,7 @@ class MultiTkIp end def __pseudo_toplevel_evaluable=(mode) - unless (Thread.current.group == ThreadGroup::Default && + unless (Thread.current.group == ThreadGroup::Default && MultiTkIp.__getip == @@DEFAULT_MASTER) fail SecurityError, "no permission to manipulate" end @@ -1893,6 +2047,48 @@ end # evaluate a procedure on the proper interpreter class MultiTkIp + # instance & class method + def _proc_on_safelevel(cmd=nil, &blk) # require a block for eval + if cmd + if cmd.kind_of?(Method) + _proc_on_safelevel{|*args| cmd.call(*args)} + else + _proc_on_safelevel(&cmd) + end + else + #Proc.new{|safe, *args| $SAFE=safe if $SAFE < safe; yield(*args)} + Proc.new{|safe, *args| + # avoid security error on Exception objects + untrust_proc = proc{|err| + begin + err.untrust if err.respond_to?(:untrust) + rescue SecurityError + end + err + } + $SAFE=safe if $SAFE < safe; + begin + yield(*args) + rescue Exception => e + fail untrust_proc.call(e) + end + } + end + end + def MultiTkIp._proc_on_safelevel(cmd=nil, &blk) + MultiTkIp.__getip._proc_on_safelevel(cmd, &blk) + end + + def _proc_on_current_safelevel(cmd=nil, &blk) # require a block for eval + safe = $SAFE + cmd = _proc_on_safelevel(cmd, &blk) + Proc.new{|*args| cmd.call(safe, *args)} + end + def MultiTkIp._proc_on_current_safelevel(cmd=nil, &blk) + MultiTkIp.__getip._proc_on_current_safelevel(cmd, &blk) + end + + ###################################### # instance method def eval_proc_core(req_val, cmd, *args) # check @@ -1902,23 +2098,23 @@ class MultiTkIp end # on IP thread - if @cmd_receiver == Thread.current || + if @cmd_receiver == Thread.current || (!req_val && TclTkLib.mainloop_thread? != false) # callback begin ret = cmd.call(safe_level, *args) rescue SystemExit => e # exit IP - warn("Warning: "+ $! + " on " + self.inspect) if $DEBUG + warn("Warning: "+ e.inspect + " on " + self.inspect) if $DEBUG begin self._eval_without_enc('exit') - rescue Exception + rescue Exception => e end self.delete ret = nil rescue Exception => e if $DEBUG - warn("Warning: " + e.class.inspect + - ((e.message.length > 0)? ' "' + e.message + '"': '') + + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + " on " + self.inspect) end =begin @@ -1945,9 +2141,9 @@ class MultiTkIp rescue Exception => e # ignore if $DEBUG - warn("Warning: " + e.class.inspect + - ((e.message.length > 0)? ' "' + e.message + '"': '') + - " on " + self.inspect) + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + + " on " + self.inspect) end return e end @@ -1963,7 +2159,7 @@ class MultiTkIp return ret.value rescue SystemExit => e # exit IP - warn("Warning: " + $! + " on " + self.inspect) if $DEBUG + warn("Warning: " + e.inspect + " on " + self.inspect) if $DEBUG begin self._eval_without_enc('exit') rescue Exception @@ -1976,9 +2172,9 @@ class MultiTkIp end rescue Exception => e if $DEBUG - warn("Warning: " + e.class.inspect + - ((e.message.length > 0)? ' "' + e.message + '"': '') + - " on " + self.inspect) + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + + " on " + self.inspect) end return e end @@ -1986,25 +2182,79 @@ class MultiTkIp end private :eval_proc_core +if WITH_RUBY_VM ### Ruby 1.9 def eval_callback(*args) if block_given? cmd = Proc.new else cmd = args.shift end - current = Thread.current - backup_ip = current['callback_ip'] - current['callback_ip'] = self begin - eval_proc_core(false, cmd, *args) - ensure - current['callback_ip'] = backup_ip + if @@CALLBACK_SUBTHREAD.table[self].index(Thread.current) + last_th = nil + else + last_th = @@CALLBACK_SUBTHREAD.table[self][-1] + end + @@CALLBACK_SUBTHREAD.new(self){ + @@CALLBACK_SUBTHREAD.table[self] << Thread.current + begin + last_th.join if last_th + eval_proc_core(false, cmd, *args) + rescue Exception=>e + e + ensure + @@CALLBACK_SUBTHREAD.table[self].delete(Thread.current) + end + } end end +else ### Ruby 1.8 + def eval_callback(*args) + if block_given? + cmd = Proc.new + else + cmd = args.shift + end + begin + eval_proc_core(false, cmd, *args) + rescue Exception=>e + e + ensure + end + end +end + def eval_proc(*args, &blk) + if block_given? + cmd = _proc_on_safelevel(&blk) + else + unless (cmd = args.shift) + fail ArgumentError, "A Proc or Method object is expected for 1st argument" + end + cmd = _proc_on_safelevel(&cmd) + end + if TclTkLib.mainloop_thread? == true + # call from eventloop + current = Thread.current + backup_ip = current[:callback_ip] + current[:callback_ip] = self + begin + eval_proc_core(false, cmd, *args) + ensure + current[:callback_ip] = backup_ip + end + else + eval_proc_core(true, + proc{|safe, *params| + Thread.new{cmd.call(safe, *params)}.value + }, + *args) + end + end +=begin def eval_proc(*args) - # The scope of the eval-block of 'eval_proc' method is different from - # the external. If you want to pass local values to the eval-block, + # The scope of the eval-block of 'eval_proc' method is different from + # the external. If you want to pass local values to the eval-block, # use arguments of eval_proc method. They are passed to block-arguments. if block_given? cmd = Proc.new @@ -2016,26 +2266,27 @@ class MultiTkIp if TclTkLib.mainloop_thread? == true # call from eventloop current = Thread.current - backup_ip = current['callback_ip'] - current['callback_ip'] = self + backup_ip = current[:callback_ip] + current[:callback_ip] = self begin - eval_proc_core(false, + eval_proc_core(false, proc{|safe, *params| $SAFE=safe if $SAFE < safe cmd.call(*params) }, *args) ensure - current['callback_ip'] = backup_ip + current[:callback_ip] = backup_ip end else - eval_proc_core(true, - proc{|safe, *params| + eval_proc_core(true, + proc{|safe, *params| $SAFE=safe if $SAFE < safe Thread.new(*params, &cmd).value }, *args) end end +=end alias call eval_proc def bg_eval_proc(*args) @@ -2049,8 +2300,8 @@ class MultiTkIp Thread.new{ eval_proc(cmd, *args) =begin - eval_proc_core(false, - proc{|safe, *params| + eval_proc_core(false, + proc{|safe, *params| $SAFE=safe if $SAFE < safe Thread.new(*params, &cmd).value }, @@ -2069,8 +2320,8 @@ class MultiTkIp raise RuntimeError, "A String object is expected for the 'cmd' argument" end - eval_proc_core(true, - proc{|safe| + eval_proc_core(true, + proc{|safe| Kernel.eval("$SAFE=#{safe} if $SAFE < #{safe};" << cmd, *eval_args) }) @@ -2083,8 +2334,8 @@ class MultiTkIp raise RuntimeError, "A String object is expected for the 'cmd' argument" end Thread.new{ - eval_proc_core(true, - proc{|safe| + eval_proc_core(true, + proc{|safe| Kernel.eval("$SAFE=#{safe} if $SAFE < #{safe};" << cmd, *eval_args) }) @@ -2169,6 +2420,11 @@ end # event loop # all master/slave IPs are controled by only one event-loop +class MultiTkIp + def self.default_master? + __getip == @@DEFAULT_MASTER + end +end class << MultiTkIp def mainloop(check_root = true) __getip.mainloop(check_root) @@ -2428,7 +2684,8 @@ end # depend on TclTkIp class MultiTkIp - def mainloop(check_root = true, restart_on_dead = true) +# def mainloop(check_root = true, restart_on_dead = true) + def mainloop(check_root = true, restart_on_dead = false) raise SecurityError, "no permission to manipulate" unless self.manipulable? if WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!! @@ -2444,7 +2701,7 @@ class MultiTkIp if $SAFE >= 4 _receiver_mainloop(check_root).join else - @cmd_queue.enq([@system, 'call_mainloop', + @cmd_queue.enq([@system, 'call_mainloop', Thread.current, check_root]) Thread.stop end @@ -2457,7 +2714,7 @@ class MultiTkIp end rescue SystemExit => e # exit IP - warn("Warning: " + $! + " on " + self.inspect) if $DEBUG + warn("Warning: " + e.inspect + " on " + self.inspect) if $DEBUG begin self._eval_without_enc('exit') rescue Exception @@ -2465,9 +2722,9 @@ class MultiTkIp self.delete rescue StandardError => e if $DEBUG - warn("Warning: " + e.class.inspect + - ((e.message.length > 0)? ' "' + e.message + '"': '') + - " on " + self.inspect) + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + + " on " + self.inspect) end return e rescue Exception => e @@ -2486,9 +2743,9 @@ class MultiTkIp @interp.mainloop(check_root) rescue StandardError => e if $DEBUG - warn("Warning: " + e.class.inspect + - ((e.message.length > 0)? ' "' + e.message + '"': '') + - " on " + self.inspect) + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + + " on " + self.inspect) end end =end @@ -2513,7 +2770,7 @@ class MultiTkIp @interp.mainloop(check_root) rescue StandardError => e if TclTkLib.mainloop_abort_on_exception != nil - #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect, + #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect, # " exception (ignore) : ", $!.message, "\n"); if $DEBUG warn("Warning: Tk mainloop receives " << e.class.inspect << @@ -2524,7 +2781,7 @@ class MultiTkIp rescue Exception => e =begin if TclTkLib.mainloop_abort_on_exception != nil - #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect, + #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect, # " exception (ignore) : ", $!.message, "\n"); if $DEBUG warn("Warning: Tk mainloop receives " << e.class.inspect << @@ -2595,11 +2852,11 @@ class MultiTkIp next if subip.deleted? end end - if subip.respond_to?(:safe_base?) && subip.safe_base? && + if subip.respond_to?(:safe_base?) && subip.safe_base? && !subip.deleted? # do 'exit' to call the delete_hook procedure begin - subip._eval_without_enc('exit') + subip._eval_without_enc('exit') rescue Exception end else @@ -2893,7 +3150,7 @@ class MultiTkIp def def_alias(slave, new_cmd, org_cmd, *args) raise SecurityError, "no permission to manipulate" unless self.manipulable? - ret = @interp._invoke('interp', 'alias', _slavearg(slave), new_cmd, + ret = @interp._invoke('interp', 'alias', _slavearg(slave), new_cmd, '', org_cmd, *args) (ret == new_cmd)? self: nil end @@ -2986,7 +3243,7 @@ class MultiTkIp end keys << _slavearg(slave) if Tk::TCL_MAJOR_VERSION > 8 || - (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) + (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) keys << '--' end keys << cmd @@ -3007,7 +3264,7 @@ class MultiTkIp keys << _slavearg(slave) keys << '-global' if Tk::TCL_MAJOR_VERSION > 8 || - (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) + (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) keys << '--' end keys << cmd @@ -3083,11 +3340,11 @@ class MultiTkIp raise SecurityError, "no permission to manipulate" unless self.manipulable? if slot - num_or_str(@interp._invoke('interp', 'limit', _slavearg(slave), + num_or_str(@interp._invoke('interp', 'limit', _slavearg(slave), limit_type, slot)) else - l = @interp._split_tklist(@interp._invoke_without_enc('interp', 'limit', - _slavearg(slave), + l = @interp._split_tklist(@interp._invoke_without_enc('interp', 'limit', + _slavearg(slave), limit_type)) l.map!{|s| _fromUTF8(s)} r = {} @@ -3106,7 +3363,7 @@ class MultiTkIp def recursion_limit(slave = '', limit = None) raise SecurityError, "no permission to manipulate" unless self.manipulable? - number(@interp._invoke('interp', 'recursionlimit', + number(@interp._invoke('interp', 'recursionlimit', _slavearg(slave), limit)) end def self.recursion_limit(slave = '', limit = None) @@ -3216,7 +3473,7 @@ class MultiTkIp ip = MultiTkIp.__getip ip._eval('::safe::interpConfigure ' + @ip_name + ' ' + _keys2opts(slot)) else - ip._eval('::safe::interpConfigure ' + @ip_name + ' ' + + ip._eval('::safe::interpConfigure ' + @ip_name + ' ' + "-#{slot} #{_get_eval_string(value)}") end self @@ -3226,7 +3483,7 @@ class MultiTkIp ip = MultiTkIp.__getip ret = {} if slot - conf = _lst2ary(ip._eval("::safe::interpConfigure " + + conf = _lst2ary(ip._eval("::safe::interpConfigure " + @ip_name + " -#{slot}")) if conf[0] == '-deleteHook' =begin @@ -3242,7 +3499,7 @@ class MultiTkIp ret[conf[0][1..-1]] = conf[1] end else - Hash[*_lst2ary(ip._eval("::safe::interpConfigure " + + Hash[*_lst2ary(ip._eval("::safe::interpConfigure " + @ip_name))].each{|k, v| if k == '-deleteHook' =begin @@ -3289,6 +3546,42 @@ class << MultiTkIp def encoding_table __getip.encoding_table end + + def force_default_encoding=(mode) + __getip.force_default_encoding=(mode) + end + + def force_default_encoding? + __getip.force_default_encoding? + end + + def default_encoding=(enc) + __getip.default_encoding=(enc) + end + + def encoding=(enc) + __getip.encoding=(enc) + end + + def encoding_name + __getip.encoding_name + end + + def encoding_obj + __getip.encoding_obj + end + alias encoding encoding_name + alias default_encoding encoding_name + + def encoding_convertfrom(str, enc=None) + __getip.encoding_convertfrom(str, enc) + end + alias encoding_convert_from encoding_convertfrom + + def encoding_convertto(str, enc=None) + __getip.encoding_convertto(str, enc) + end + alias encoding_convert_to encoding_convertto end class MultiTkIp def encoding_table @@ -3339,20 +3632,48 @@ end # remove methods for security -if MultiTkIp::WITH_RUBY_VM && +=begin +class MultiTkIp + INTERP_THREAD = @@DEFAULT_MASTER.instance_variable_get('@interp_thread') + INTERP_MUTEX = INTERP_THREAD[:mutex] + INTERP_ROOT_CHECK = INTERP_THREAD[:root_check] + + # undef_method :instance_eval + undef_method :instance_variable_get + undef_method :instance_variable_set +end + +module TkCore + if MultiTkIp::WITH_RUBY_VM && + ! MultiTkIp::RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!! + INTERP_THREAD = MultiTkIp::INTERP_THREAD + INTERP_MUTEX = MultiTkIp::INTERP_MUTEX + INTERP_ROOT_CHECK = MultiTkIp::INTERP_ROOT_CHECK + end +end +class MultiTkIp + remove_const(:INTERP_THREAD) + remove_const(:INTERP_MUTEX) + remove_const(:INTERP_ROOT_CHECK) +end +=end +if MultiTkIp::WITH_RUBY_VM && ! MultiTkIp::RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!! class MultiTkIp INTERP_THREAD = @@DEFAULT_MASTER.instance_variable_get('@interp_thread') + INTERP_THREAD_STATUS = INTERP_THREAD[:status] INTERP_MUTEX = INTERP_THREAD[:mutex] INTERP_ROOT_CHECK = INTERP_THREAD[:root_check] end module TkCore INTERP_THREAD = MultiTkIp::INTERP_THREAD + INTERP_THREAD_STATUS = MultiTkIp::INTERP_THREAD_STATUS INTERP_MUTEX = MultiTkIp::INTERP_MUTEX INTERP_ROOT_CHECK = MultiTkIp::INTERP_ROOT_CHECK end class MultiTkIp remove_const(:INTERP_THREAD) + remove_const(:INTERP_THREAD_STATUS) remove_const(:INTERP_MUTEX) remove_const(:INTERP_ROOT_CHECK) end diff --git a/ext/tk/lib/remote-tk.rb b/ext/tk/lib/remote-tk.rb index 70115a60aa..0fa713359e 100644 --- a/ext/tk/lib/remote-tk.rb +++ b/ext/tk/lib/remote-tk.rb @@ -10,8 +10,8 @@ class MultiTkIp; end class RemoteTkIp < MultiTkIp; end class MultiTkIp - @@IP_TABLE = {}.taint unless defined?(@@IP_TABLE) - @@TK_TABLE_LIST = [].taint unless defined?(@@TK_TABLE_LIST) + @@IP_TABLE = TkUtil.untrust({}) unless defined?(@@IP_TABLE) + @@TK_TABLE_LIST = TkUtil.untrust([]) unless defined?(@@TK_TABLE_LIST) def self._IP_TABLE; @@IP_TABLE; end def self._TK_TABLE_LIST; @@TK_TABLE_LIST; end @@ -88,10 +88,14 @@ class RemoteTkIp @slave_ip_tbl = {} @slave_ip_top = {} - @tk_windows.taint unless @tk_windows.tainted? - @tk_table_list.taint unless @tk_table_list.tainted? - @slave_ip_tbl.taint unless @slave_ip_tbl.tainted? - @slave_ip_top.taint unless @slave_ip_top.tainted? + @force_default_encoding ||= TkUtil.untrust([false]) + @encoding ||= TkUtil.untrust([nil]) + def @encoding.to_s; self.join(nil); end + + TkUtil.untrust(@tk_windows) unless @tk_windows.tainted? + TkUtil.untrust(@tk_table_list) unless @tk_table_list.tainted? + TkUtil.untrust(@slave_ip_tbl) unless @slave_ip_tbl.tainted? + TkUtil.untrust(@slave_ip_top) unless @slave_ip_top.tainted? @system = Object.new @@ -114,8 +118,8 @@ class RemoteTkIp @@DEFAULT_MASTER.assign_receiver_and_watchdog(self) @@IP_TABLE[@threadgroup] = self - @@TK_TABLE_LIST.size.times{ - (tbl = {}).tainted? || tbl.taint + @@TK_TABLE_LIST.size.times{ + (tbl = {}).tainted? || TkUtil.untrust(tbl) @tk_table_list << tbl } @@ -154,13 +158,13 @@ class RemoteTkIp return nil if timeout < 1 @ret_val.value = '' - @interp._invoke('send', '-async', @remote, - 'send', '-async', Tk.appname, + @interp._invoke('send', '-async', @remote, + 'send', '-async', Tk.appname, "set #{@ret_val.id} ready") Tk.update if @ret_val != 'ready' (1..(timeout*5)).each{ - sleep 0.2 + sleep 0.2 Tk.update break if @ret_val == 'ready' } @@ -204,10 +208,10 @@ class RemoteTkIp cmds = @interp._merge_tklist(*TkUtil::_conv_args([], enc_mode, *cmds)) if @displayof if async - @interp.__invoke('send', '-async', '-displayof', @displayof, + @interp.__invoke('send', '-async', '-displayof', @displayof, '--', @remote, *cmds) else - @interp.__invoke('send', '-displayof', @displayof, + @interp.__invoke('send', '-displayof', @displayof, '--', @remote, *cmds) end else @@ -229,7 +233,7 @@ class RemoteTkIp def is_rubytk? return false if _appsend(false, false, 'info', 'command', 'ruby') == "" - [ _appsend(false, false, 'ruby', 'RUBY_VERSION'), + [ _appsend(false, false, 'ruby', 'RUBY_VERSION'), _appsend(false, false, 'set', 'tk_patchLevel') ] end @@ -298,7 +302,7 @@ class RemoteTkIp raise SecurityError, "no permission to manipulate" unless self.manipulable? if @displayof - lst = @interp._invoke_without_enc('winfo', 'interps', + lst = @interp._invoke_without_enc('winfo', 'interps', '-displayof', @displayof) else lst = @interp._invoke_without_enc('winfo', 'interps') diff --git a/ext/tk/lib/tcltk.rb b/ext/tk/lib/tcltk.rb index c875a3503e..2df3b2fd8c 100644 --- a/ext/tk/lib/tcltk.rb +++ b/ext/tk/lib/tcltk.rb @@ -84,7 +84,7 @@ end # class TclTkInterpreter: tcl/tk interpreter class TclTkInterpreter - # initialize(): + # initialize(): def initialize() # generate interpreter object @ip = TclTkIp.new() @@ -181,7 +181,7 @@ end # class TclTkObject: base class of the tcl/tk objects class TclTkObject - # initialize(ip, exp): + # initialize(ip, exp): # ip: interpreter(TclTkIp) # exp: tcl/tk representation def initialize(ip, exp) @@ -211,7 +211,7 @@ end # class TclTkLibCommand: tcl/tk commands in the library class TclTkLibCommand < TclTkCommand - # initialize(ip, name): + # initialize(ip, name): # ip: interpreter(TclTkInterpreter) # name: command name (String) def initialize(ip, name) @@ -222,7 +222,7 @@ end # class TclTkVariable: tcl/tk variable class TclTkVariable < TclTkObject - # initialize(interp, dat): + # initialize(interp, dat): # interp: interpreter(TclTkInterpreter) # dat: the value to set(String) # if nil, not initialize variable @@ -255,7 +255,7 @@ end # class TclTkWidget: tcl/tk widget class TclTkWidget < TclTkCommand - # initialize(*args): + # initialize(*args): # *args: parameters def initialize(*args) if args[0].kind_of?(TclTkIp) @@ -281,7 +281,7 @@ class TclTkWidget < TclTkCommand # interp: interpreter(TclTkInterpreter) # parent: parent widget # command: widget generating tk command(label Åù) - # *args: argument to the command + # *args: argument to the command interp, parent, command, *args = args # generate widget name @@ -303,14 +303,14 @@ end # class TclTkCallback: tcl/tk callbacks class TclTkCallback < TclTkObject - # initialize(interp, pr, arg): + # initialize(interp, pr, arg): # interp: interpreter(TclTkInterpreter) # pr: callback procedure(Proc) # arg: string to pass as block parameters of pr # bind command of tcl/tk uses % replacement for parameters # pr can receive replaced data using block parameter # its format is specified by arg string - # You should not specify arg for the command like + # You should not specify arg for the command like # scrollbar with -command option, which receives parameters # without specifying any replacement def initialize(interp, pr, arg = nil) @@ -347,7 +347,7 @@ end # class TclTkImage: tcl/tk images class TclTkImage < TclTkCommand - # initialize(interp, t, *args): + # initialize(interp, t, *args): # generating image is done by TclTkImage.new() # destrying is done by image delete (inconsistent, sigh) # interp: interpreter(TclTkInterpreter) diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 590cc88923..b071bf5be8 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -15,12 +15,25 @@ require 'thread' class TclTkIp # backup original (without encoding) _eval and _invoke alias _eval_without_enc _eval + alias __eval__ _eval alias _invoke_without_enc _invoke + alias __invoke__ _invoke def _ip_id_ # for RemoteTkIp '' end + + alias __initialize__ initialize + private :__initialize__ + + def initialize(*args) + __initialize__(*args) + + @force_default_encoding ||= TkUtil.untrust([false]) + @encoding ||= TkUtil.untrust([nil]) + def @encoding.to_s; self.join(nil); end + end end # define TkComm module (step 1: basic functions) @@ -28,8 +41,8 @@ module TkComm include TkUtil extend TkUtil - WidgetClassNames = {}.taint - TkExtlibAutoloadModule = [].taint + WidgetClassNames = TkUtil.untrust({}) + TkExtlibAutoloadModule = TkUtil.untrust([]) # None = Object.new ### --> definition is moved to TkUtil module # def None.to_s @@ -39,7 +52,10 @@ module TkComm #Tk_CMDTBL = {} #Tk_WINDOWS = {} - Tk_IDs = ["00000".taint, "00000".taint] # [0]-cmdid, [1]-winid + Tk_IDs = [ + TkUtil.untrust("00000"), # [0]-cmdid + TkUtil.untrust("00000") # [1]-winid + ] Tk_IDs.instance_eval{ @mutex = Mutex.new def mutex; @mutex; end @@ -59,13 +75,13 @@ module TkComm Tk_WINDOWS.freeze self.instance_eval{ - @cmdtbl = [].taint + @cmdtbl = TkUtil.untrust([]) } unless const_defined?(:GET_CONFIGINFO_AS_ARRAY) # GET_CONFIGINFO_AS_ARRAY = false => returns a Hash { opt =>val, ... } # true => returns an Array [[opt,val], ... ] - # val is a list which includes resource info. + # val is a list which includes resource info. GET_CONFIGINFO_AS_ARRAY = true end unless const_defined?(:GET_CONFIGINFOwoRES_AS_ARRAY) @@ -102,15 +118,22 @@ module TkComm gen_class_name = ruby_class_name classname_def = '' else # ruby_class == nil - mods = TkExtlibAutoloadModule.find_all{|m| m.const_defined?(tk_class)} - mods.each{|mod| - begin - mod.const_get(tk_class) # auto_load - break if (ruby_class = WidgetClassNames[tk_class]) - rescue LoadError - # ignore load error - end - } + if Tk.const_defined?(tk_class) + mod.const_get(tk_class) # auto_load + ruby_class = WidgetClassNames[tk_class] + end + + unless ruby_class + mods = TkExtlibAutoloadModule.find_all{|m| m.const_defined?(tk_class)} + mods.each{|mod| + begin + mod.const_get(tk_class) # auto_load + break if (ruby_class = WidgetClassNames[tk_class]) + rescue LoadError + # ignore load error + end + } + end unless ruby_class std_class = 'Tk' << tk_class @@ -120,6 +143,14 @@ module TkComm end end + unless ruby_class + if Tk.const_defined?('TOPLEVEL_ALIASES') && + Tk::TOPLEVEL_ALIASES.const_defined?(std_class) + Tk::TOPLEVEL_ALIASES.const_get(std_class) # auto_load + ruby_class = WidgetClassNames[tk_class] + end + end + if ruby_class # found ruby_class_name = ruby_class.name @@ -166,7 +197,7 @@ module TkComm #{classname_def} end" end - Object.class_eval "#{gen_class_name}.new('widgetname'=>'#{path}', + Object.class_eval "#{gen_class_name}.new('widgetname'=>'#{path}', 'without_creating'=>true)" =end base = Object @@ -181,7 +212,7 @@ module TkComm #{klass}" end } - base.class_eval "#{gen_class_name}.new('widgetname'=>'#{path}', + base.class_eval "#{gen_class_name}.new('widgetname'=>'#{path}', 'without_creating'=>true)" end private :_genobj_for_tkwidget @@ -222,7 +253,7 @@ module TkComm val.to_i when /\A\.\S*\z/ #Tk_WINDOWS[val] ? Tk_WINDOWS[val] : _genobj_for_tkwidget(val) - TkCore::INTERP.tk_windows[val]? + TkCore::INTERP.tk_windows[val]? TkCore::INTERP.tk_windows[val] : _genobj_for_tkwidget(val) when /\Ai(_\d+_)?\d+\z/ TkImage::Tk_IMGTBL.mutex.synchronize{ @@ -427,7 +458,7 @@ else def tk_split_list(str, depth=0, src_enc=true, dst_enc=true) return [] if str == "" - tk_split_escstr(str).collect{|token| + tk_split_escstr(str).collect{|token| tk_split_sublist(token, depth - 1) } end @@ -573,7 +604,7 @@ end def window(val) if val =~ /^\./ #Tk_WINDOWS[val]? Tk_WINDOWS[val] : _genobj_for_tkwidget(val) - TkCore::INTERP.tk_windows[val]? + TkCore::INTERP.tk_windows[val]? TkCore::INTERP.tk_windows[val] : _genobj_for_tkwidget(val) else nil @@ -602,14 +633,38 @@ end val end end - private :bool, :number, :string, :num_or_str - private :list, :simplelist, :window, :procedure - module_function :bool, :number, :num_or_str, :string + private :bool, :number, :num_or_str, :num_or_nil, :string + private :list, :simplelist, :window, :image_obj, :procedure + module_function :bool, :number, :num_or_str, :num_or_nil, :string module_function :list, :simplelist, :window, :image_obj, :procedure + if (RUBY_VERSION.split('.').map{|n| n.to_i} <=> [1,8,7]) < 0 + def slice_ary(ary, size) + sliced = [] + wk_ary = ary.dup + until wk_ary.size.zero? + sub_ary = [] + size.times{ sub_ary << wk_ary.shift } + yield(sub_ary) if block_given? + sliced << sub_ary + end + (block_given?)? ary: sliced + end + else + def slice_ary(ary, size, &b) + if b + ary.each_slice(size, &b) + else + ary.each_slice(size).to_a + end + end + end + private :slice_ary + module_function :slice_ary + def subst(str, *opts) # opts := :nobackslashes | :nocommands | novariables - tk_call('subst', + tk_call('subst', *(opts.collect{|opt| opt = opt.to_s (opt[0] == ?-)? opt: '-' << opt @@ -667,7 +722,7 @@ end else str = str.to_s() || '' unless str.kind_of? String - fail RuntimeError, "fail to convert the object to a string" + fail RuntimeError, "fail to convert the object to a string" end str = _toUTF8(str) if enc_mode end @@ -706,7 +761,7 @@ end begin obj = obj.to_s || '' rescue - fail RuntimeError, "fail to convert object '#{obj}' to string" + fail RuntimeError, "fail to convert object '#{obj}' to string" end (enc_mode)? _toUTF8(obj): obj end @@ -792,7 +847,7 @@ end TkCore::INTERP.tk_cmd_tbl[id] = TkCore::INTERP.get_cb_entry(cmd) end @cmdtbl = [] unless defined? @cmdtbl - @cmdtbl.taint unless @cmdtbl.tainted? + TkUtil.untrust(@cmdtbl) unless @cmdtbl.tainted? @cmdtbl.push id if local_cmdtbl && local_cmdtbl.kind_of?(Array) @@ -925,7 +980,7 @@ module TkComm def _bind_core(mode, what, context, cmd, *args) id = install_bind(cmd, *args) if cmd begin - tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>", + tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>", mode + id])) rescue uninstall_cmd(id) if cmd @@ -984,7 +1039,7 @@ module TkComm def _bind_core_for_event_class(klass, mode, what, context, cmd, *args) id = install_bind_for_event_class(klass, cmd, *args) if cmd begin - tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>", + tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>", mode + id])) rescue uninstall_cmd(id) if cmd @@ -1010,8 +1065,8 @@ module TkComm private :tk_event_sequence private :_bind_core, :_bind, :_bind_append, :_bind_remove, :_bindinfo - private :_bind_core_for_event_class, :_bind_for_event_class, - :_bind_append_for_event_class, :_bind_remove_for_event_class, + private :_bind_core_for_event_class, :_bind_for_event_class, + :_bind_append_for_event_class, :_bind_remove_for_event_class, :_bindinfo_for_event_class #def bind(tagOrClass, context, cmd=Proc.new, *args) @@ -1099,12 +1154,8 @@ module TkCore extend TkComm WITH_RUBY_VM = Object.const_defined?(:RubyVM) && ::RubyVM.class == Class - WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class - - unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD - ### Ruby 1.9 !!!!!!!!!!!!!!!!!!!!!!!!!! - RUN_EVENTLOOP_ON_MAIN_THREAD = false - end + WITH_ENCODING = defined?(::Encoding.default_external) && true + #WITH_ENCODING = Object.const_defined?(:Encoding) && ::Encoding.class == Class unless self.const_defined? :INTERP if self.const_defined? :IP_NAME @@ -1123,8 +1174,48 @@ module TkCore opts = '' end + unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD + if WITH_RUBY_VM ### check Ruby 1.9 !!!!!!! + # *** NEED TO FIX *** + ip = TclTkIp.new(name, opts) + if ip._invoke_without_enc('tk', 'windowingsystem') == 'aqua' && + (TclTkLib.get_version<=>[8,4,TclTkLib::RELEASE_TYPE::FINAL,6]) > 0 + # *** KNOWN BUG *** + # Main event loop thread of TkAqua (> Tk8.4.9) must be the main + # application thread. So, ruby1.9 users must call Tk.mainloop on + # the main application thread. + # + # *** ADD (2009/05/10) *** + # In some cases (I don't know the description of conditions), + # TkAqua 8.4.7 has a same kind of hang-up trouble. + # So, if 8.4.7 or later, set RUN_EVENTLOOP_ON_MAIN_THREAD to true. + # When you want to control this mode, please call the following + # (set true/false as you want) before "require 'tk'". + # ---------------------------------------------------------- + # module TkCore; RUN_EVENTLOOP_ON_MAIN_THREAD = true; end + # ---------------------------------------------------------- + # + RUN_EVENTLOOP_ON_MAIN_THREAD = true + INTERP = ip + else + unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD + RUN_EVENTLOOP_ON_MAIN_THREAD = false + end + if RUN_EVENTLOOP_ON_MAIN_THREAD + INTERP = ip + else + ip.delete + end + end + ip = nil + + else # Ruby 1.8.x + RUN_EVENTLOOP_ON_MAIN_THREAD = false + end + end + if !WITH_RUBY_VM || RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!! - INTERP = TclTkIp.new(name, opts) + INTERP = TclTkIp.new(name, opts) unless self.const_defined? :INTERP else INTERP_MUTEX = Mutex.new INTERP_ROOT_CHECK = ConditionVariable.new @@ -1135,17 +1226,42 @@ module TkCore Thread.current[:interp] = e raise e end - Thread.current[:status] = nil + + status = [nil] + def status.value + self[0] + end + def status.value=(val) + self[0] = val + end + + Thread.current[:status] = status #sleep begin - Thread.current[:status] = TclTkLib.mainloop(true) - rescue Exception=>e - Thread.current[:status] = e + begin + #TclTkLib.mainloop_abort_on_exception = false + #Thread.current[:status].value = TclTkLib.mainloop(true) + interp.mainloop_abort_on_exception = true + Thread.current[:status].value = interp.mainloop(true) + rescue SystemExit=>e + Thread.current[:status].value = e + rescue Exception=>e + Thread.current[:status].value = e + retry if interp.has_mainwindow? + ensure + INTERP_MUTEX.synchronize{ INTERP_ROOT_CHECK.broadcast } + end + + #Thread.current[:status].value = TclTkLib.mainloop(false) + Thread.current[:status].value = interp.mainloop(false) + ensure - INTERP_MUTEX.synchronize{ INTERP_ROOT_CHECK.broadcast } + # interp must be deleted before the thread for interp is dead. + # If not, raise Tcl_Panic on Tcl_AsyncDelete because async handler + # deleted by the wrong thread. + interp.delete end - Thread.current[:status] = TclTkLib.mainloop(false) } until INTERP_THREAD[:interp] @@ -1155,17 +1271,22 @@ module TkCore raise INTERP_THREAD[:interp] if INTERP_THREAD[:interp].kind_of? Exception INTERP = INTERP_THREAD[:interp] + INTERP_THREAD_STATUS = INTERP_THREAD[:status] end def INTERP.__getip self end + def INTERP.default_master? + true + end INTERP.instance_eval{ - # @tk_cmd_tbl = {}.taint - @tk_cmd_tbl = Hash.new{|hash, key| - fail IndexError, "unknown command ID '#{key}'" - }.taint + # @tk_cmd_tbl = TkUtil.untrust({}) + @tk_cmd_tbl = + TkUtil.untrust(Hash.new{|hash, key| + fail IndexError, "unknown command ID '#{key}'" + }) def @tk_cmd_tbl.[]=(idx,val) if self.has_key?(idx) && Thread.current.group != ThreadGroup::Default fail SecurityError,"cannot change the entried command" @@ -1173,12 +1294,16 @@ module TkCore super(idx,val) end - @tk_windows = {}.taint + @tk_windows = TkUtil.untrust({}) - @tk_table_list = [].taint + @tk_table_list = TkUtil.untrust([]) - @init_ip_env = [].taint # table of Procs - @add_tk_procs = [].taint # table of [name, args, body] + @init_ip_env = TkUtil.untrust([]) # table of Procs + @add_tk_procs = TkUtil.untrust([]) # table of [name, args, body] + + @force_default_encoding ||= TkUtil.untrust([false]) + @encoding ||= TkUtil.untrust([nil]) + def @encoding.to_s; self.join(nil); end @cb_entry_class = Class.new(TkCallbackEntry){ class << self @@ -1231,7 +1356,7 @@ module TkCore end def INTERP.create_table id = @tk_table_list.size - (tbl = {}).tainted? || tbl.taint + (tbl = {}).tainted? || TkUtil.untrust(tbl) @tk_table_list << tbl # obj = Object.new # obj.instance_eval <<-EOD @@ -1266,10 +1391,11 @@ module TkCore def INTERP.remove_tk_procs(*names) names.each{|name| name = name.to_s - @add_tk_procs.delete_if{|elem| + @add_tk_procs.delete_if{|elem| elem.kind_of?(Array) && elem[0].to_s == name } - self._invoke('rename', name, '') + #self._invoke('rename', name, '') + self.__invoke__('rename', name, '') } end def INTERP.init_ip_internal @@ -1279,8 +1405,13 @@ module TkCore end end + unless self.const_defined? :RUN_EVENTLOOP_ON_MAIN_THREAD + ### Ruby 1.9 !!!!!!!!!!!!!!!!!!!!!!!!!! + RUN_EVENTLOOP_ON_MAIN_THREAD = false + end + WIDGET_DESTROY_HOOK = '' - INTERP._invoke_without_enc('event', 'add', + INTERP._invoke_without_enc('event', 'add', "<#{WIDGET_DESTROY_HOOK}>", '') INTERP._invoke_without_enc('bind', 'all', "<#{WIDGET_DESTROY_HOOK}>", install_cmd(proc{|path| @@ -1297,7 +1428,7 @@ module TkCore end }) << ' %W') - INTERP.add_tk_procs(TclTkLib::FINALIZE_PROC_NAME, '', + INTERP.add_tk_procs(TclTkLib::FINALIZE_PROC_NAME, '', "catch { bind all <#{WIDGET_DESTROY_HOOK}> {} }") INTERP.add_tk_procs('rb_out', 'ns args', <<-'EOL') @@ -1400,10 +1531,10 @@ module TkCore fail(e) rescue Exception => e begin - msg = _toUTF8(e.class.inspect) + ': ' + - _toUTF8(e.message) + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - _toUTF8(e.backtrace.join("\n")) + + msg = _toUTF8(e.class.inspect) + ': ' + + _toUTF8(e.message) + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + _toUTF8(e.backtrace.join("\n")) + "\n---< backtrace of Tk side >-------" if TkCore::WITH_ENCODING msg.force_encoding('utf-8') @@ -1411,9 +1542,9 @@ module TkCore msg.instance_variable_set(:@encoding, 'utf-8') end rescue Exception - msg = e.class.inspect + ': ' + e.message + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - e.backtrace.join("\n") + + msg = e.class.inspect + ': ' + e.message + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + e.backtrace.join("\n") + "\n---< backtrace of Tk side >-------" end # TkCore::INTERP._set_global_var('errorInfo', msg) @@ -1426,15 +1557,15 @@ module TkCore # arg = tk_split_list(arg_str) arg = tk_split_simplelist(arg_str) #_get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg)) - #_get_eval_string(TkUtil.eval_cmd(TkCore::INTERP.tk_cmd_tbl[arg.shift], + #_get_eval_string(TkUtil.eval_cmd(TkCore::INTERP.tk_cmd_tbl[arg.shift], # *arg)) # TkCore::INTERP.tk_cmd_tbl[arg.shift].call(*arg) begin TkCore::INTERP.tk_cmd_tbl[arg.shift].call(*arg) rescue Exception => e - raise(e, e.class.inspect + ': ' + e.message + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - e.backtrace.join("\n") + + raise(e, e.class.inspect + ': ' + e.message + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + e.backtrace.join("\n") + "\n---< backtrace of Tk side >-------") end #=begin @@ -1452,7 +1583,7 @@ module TkCore # cb_obj.call(*arg) # rescue # trace = $!.backtrace -# raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + +# raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + # "\tfrom #{trace[1..pos].join("\n\tfrom ")}" # end # end @@ -1642,17 +1773,36 @@ module TkCore end def mainloop(check_root = true) - if !TkCore::WITH_RUBY_VM || TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD + if !TkCore::WITH_RUBY_VM TclTkLib.mainloop(check_root) + + elsif TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD + # if TclTkLib::WINDOWING_SYSTEM == 'aqua' && + #if TkCore::INTERP._invoke_without_enc('tk','windowingsystem')=='aqua' && + # Thread.current != Thread.main && + # (TclTkLib.get_version <=> [8,4,TclTkLib::RELEASE_TYPE::FINAL,9]) > 0 + # raise RuntimeError, + # "eventloop on TkAqua ( > Tk8.4.9 ) works on the main thread only" + #end + if Thread.current != Thread.main + raise RuntimeError, "Tk.mainloop is allowed on the main thread only" + end + TclTkLib.mainloop(check_root) + else ### Ruby 1.9 !!!!! + unless TkCore::INTERP.default_master? + # [MultiTkIp] slave interp ? + return TkCore::INTERP._thread_tkwait('window', '.') if check_root + end + begin TclTkLib.set_eventloop_window_mode(true) if check_root INTERP_MUTEX.synchronize{ INTERP_ROOT_CHECK.wait(INTERP_MUTEX) - status = INTERP_THREAD[:status] - if status - INTERP_THREAD[:status] = nil + status = INTERP_THREAD_STATUS.value + if status && TkCore::INTERP.default_master? + INTERP_THREAD_STATUS.value = nil if $SAFE < 4 raise status if status.kind_of?(Exception) end } @@ -1737,11 +1887,11 @@ module TkCore if context.kind_of?(TkEvent::Event) context.generate(win, ((keys)? keys: {})) elsif keys - tk_call_without_enc('event', 'generate', win, - "<#{tk_event_sequence(context)}>", + tk_call_without_enc('event', 'generate', win, + "<#{tk_event_sequence(context)}>", *hash_kv(keys, true)) else - tk_call_without_enc('event', 'generate', win, + tk_call_without_enc('event', 'generate', win, "<#{tk_event_sequence(context)}>") end nil @@ -1838,7 +1988,7 @@ module TkCore puts 'invoke args => ' + args.inspect if $DEBUG ### print "=> ", args.join(" ").inspect, "\n" if $DEBUG begin - # res = INTERP._invoke(*args).taint + # res = TkUtil.untrust(INTERP._invoke(*args)) # res = INTERP._invoke(enc_mode, *args) res = _ip_invoke_core(enc_mode, *args) # >>>>> _invoke returns a TAINTED string <<<<< @@ -1846,9 +1996,9 @@ module TkCore # err = $! begin args.unshift "unknown" - #res = INTERP._invoke(*args).taint - #res = INTERP._invoke(enc_mode, *args) - res = _ip_invoke_core(enc_mode, *args) + #res = TkUtil.untrust(INTERP._invoke(*args)) + #res = INTERP._invoke(enc_mode, *args) + res = _ip_invoke_core(enc_mode, *args) # >>>>> _invoke returns a TAINTED string <<<<< rescue StandardError => err2 fail err2 unless /^invalid command/ =~ err2.message @@ -1930,7 +2080,7 @@ module Tk TK_MAJOR_VERSION = major.to_i TK_MINOR_VERSION = minor.to_i - JAPANIZED_TK = (INTERP._invoke_without_enc("info", "commands", + JAPANIZED_TK = (INTERP._invoke_without_enc("info", "commands", "kanji") != "").freeze def Tk.const_missing(sym) @@ -1959,14 +2109,14 @@ module Tk fail SecurityError, "can't get #{sym} when $SAFE >= 4" end INTERP._invoke_without_enc('global', 'tcl_platform') - Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get', + Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get', 'tcl_platform'))] when :ENV INTERP._invoke_without_enc('global', 'env') Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', 'env'))] - #when :AUTO_PATH #<=== + #when :AUTO_PATH #<=== # tk_split_simplelist(INTERP._invoke('set', 'auto_path')) #when :AUTO_OLDPATH @@ -1984,7 +2134,7 @@ module Tk var_nam = 'tkPriv' end INTERP._invoke_without_enc('global', var_nam) - Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', + Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', var_nam))].each{|k,v| k.freeze case v @@ -2140,7 +2290,7 @@ module Tk end def Tk.exit - tk_call_without_enc('destroy', '.') + TkCore::INTERP.has_mainwindow? && tk_call_without_enc('destroy', '.') end ################################################ @@ -2211,9 +2361,9 @@ module Tk end # NOTE:: - # If no eventloop-thread is running, "thread_update" method is same - # to "update" method. Else, "thread_update" method waits to complete - # idletask operation on the eventloop-thread. + # If no eventloop-thread is running, "thread_update" method is same + # to "update" method. Else, "thread_update" method waits to complete + # idletask operation on the eventloop-thread. def Tk.thread_update(idle=nil) if idle tk_call_without_enc('thread_update', 'idletasks') @@ -2285,7 +2435,7 @@ module Tk def Tk.add_kinsoku(chars, mode='both') begin if /^8\.*/ === TK_VERSION && JAPANIZED_TK - tk_split_simplelist(tk_call('kinsoku', 'add', mode, + tk_split_simplelist(tk_call('kinsoku', 'add', mode, *(chars.split('')))) else [] @@ -2297,7 +2447,7 @@ module Tk def Tk.delete_kinsoku(chars, mode='both') begin if /^8\.*/ === TK_VERSION && JAPANIZED_TK - tk_split_simplelist(tk_call('kinsoku', 'delete', mode, + tk_split_simplelist(tk_call('kinsoku', 'delete', mode, *(chars.split('')))) end rescue @@ -2307,7 +2457,7 @@ module Tk def Tk.toUTF8(str, encoding = nil) _toUTF8(str, encoding) end - + def Tk.fromUTF8(str, encoding = nil) _fromUTF8(str, encoding) end @@ -2355,6 +2505,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) BINARY_NAME = 'binary'.freeze UTF8_NAME = 'utf-8'.freeze DEFAULT_EXTERNAL_NAME = RubyEncoding.default_external.name.freeze + DEFAULT_INTERNAL_NAME = RubyEncoding.default_internal.name.freeze rescue nil BINARY = RubyEncoding.find(BINARY_NAME) UNKNOWN = RubyEncoding.find('ASCII-8BIT') @@ -2363,11 +2514,11 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) ENCODING_TABLE = TkCore::INTERP.encoding_table =begin ENCODING_TABLE = { - 'binary' => BINARY, - # 'UNKNOWN-8BIT' => UNKNOWN, + 'binary' => BINARY, + # 'UNKNOWN-8BIT' => UNKNOWN, } - list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], + list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], ENCNAMES_CMD[1]) TkCore::INTERP._split_tklist(list).each{|name| begin @@ -2415,7 +2566,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) end # Is it new ? - list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], + list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], ENCNAMES_CMD[1]) TkComm.simplelist(list).each{|name| if ((enc == RubyEncoding.find(name)) rescue false) @@ -2432,7 +2583,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) # Is it new ? if (enc_obj = (RubyEncoding.find(name) rescue false)) - list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], + list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], ENCNAMES_CMD[1]) if TkComm.simplelist(list).index(name) # Tk's encoding name ? @@ -2492,8 +2643,9 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) alias default_encoding encoding_name def tk_encoding_names - TkComm.simplelist(TkCore::INTERP._invoke_without_enc(Tk::Encoding::ENCNAMES_CMD[0], Tk::Encoding::ENCNAMES_CMD[1])) - end + #TkComm.simplelist(TkCore::INTERP._invoke_without_enc(Tk::Encoding::ENCNAMES_CMD[0], Tk::Encoding::ENCNAMES_CMD[1])) + TkComm.simplelist(TkCore::INTERP._invoke_without_enc('encoding', 'names')) + end def encoding_names self.tk_encoding_names.find_all{|name| Tk::Encoding::ENCODING_TABLE.get_name(name) rescue false @@ -2585,7 +2737,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) else str.instance_variable_set('@encoding', 'binary') end - ret = TkCore::INTERP._invoke_without_enc('encoding', 'convertfrom', + ret = TkCore::INTERP._invoke_without_enc('encoding', 'convertfrom', enc, str) if TkCore::WITH_ENCODING ret.force_encoding('utf-8') @@ -2599,7 +2751,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) def encoding_convertto(str, enc=nil) # str must be a UTF-8 string enc = encoding_system_name unless enc - ret = TkCore::INTERP._invoke_without_enc('encoding', 'convertto', + ret = TkCore::INTERP._invoke_without_enc('encoding', 'convertto', enc, str) #ret.instance_variable_set('@encoding', 'binary') if TkCore::WITH_ENCODING @@ -2626,16 +2778,16 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) class TclTkIp def force_default_encoding=(mode) - @force_default_encoding = (mode)? true: false + @force_default_encoding[0] = (mode)? true: false end def force_default_encoding? - @force_default_encoding ||= false + @force_default_encoding[0] ||= false end def default_encoding=(name) - name = name.name if name.kind_of?(::Encoding) if Tk::WITH_ENCODING - @encoding = name + name = name.name if Tk::WITH_ENCODING && name.kind_of?(::Encoding) + @encoding[0] = name.to_s.dup end # from tkencoding.rb by ttate@jaist.ac.jp @@ -2646,16 +2798,16 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) end def encoding_name - (@encoding)? @encoding.dup: nil + (@encoding[0])? @encoding[0].dup: nil end alias encoding encoding_name alias default_encoding encoding_name def encoding_obj if Tk::WITH_ENCODING - Tk::Encoding.tcl2rb_encoding(@encoding) + Tk::Encoding.tcl2rb_encoding(@encoding[0]) else - (@encoding)? @encoding.dup: nil + (@encoding[0])? @encoding[0].dup: nil end end @@ -2683,10 +2835,15 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) enc_name ||= str.instance_variable_get(:@encoding) - enc_name ||= + enc_name ||= Tk::Encoding::ENCODING_TABLE.get_name(str.encoding) rescue nil - unless enc_name + if enc_name + # str has its encoding information + encstr = __toUTF8(str, enc_name) + encstr.force_encoding(Tk::Encoding::UTF8_NAME) + return encstr + else # str.encoding isn't supported by Tk -> try to convert on Ruby begin return str.encode(Tk::Encoding::UTF8_NAME) # new string @@ -2695,7 +2852,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) end end - #enc_name ||= + #enc_name ||= # Tk::Encoding::ENCODING_TABLE.get_name(Tk.encoding) rescue nil enc_name ||= Tk::Encoding::ENCODING_TABLE.get_name(nil) @@ -2716,7 +2873,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) def _fromUTF8(str, enc = nil) # str must be UTF-8 or binary. enc_name = str.instance_variable_get(:@encoding) - enc_name ||= + enc_name ||= Tk::Encoding::ENCODING_TABLE.get_name(str.encoding) rescue nil # is 'binary' encoding? @@ -2906,7 +3063,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) end # estimate encoding - unless TkCore::WITH_ENCODING + unless TkCore::WITH_ENCODING case $KCODE when /^e/i # EUC Tk.encoding = 'euc-jp' @@ -2939,14 +3096,16 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) end else ### Ruby 1.9 !!!!!!!!!!!! - loc_enc_obj = ::Encoding.find(::Encoding.locale_charmap) + # loc_enc_obj = (::Encoding.find(::Encoding.locale_charmap) rescue Tk::Encoding::UNKNOWN) + loc_enc_obj = ::Encoding.find("locale") ext_enc_obj = ::Encoding.default_external + int_enc_obj = ::Encoding.default_internal || ext_enc_obj tksys_enc_name = Tk::Encoding::ENCODING_TABLE.get_name(Tk.encoding_system) # p [Tk.encoding, Tk.encoding_system, loc_enc_obj, ext_enc_obj] =begin if ext_enc_obj == Tk::Encoding::UNKNOWN - if defind? DEFAULT_TK_ENCODING + if defined? DEFAULT_TK_ENCODING if DEFAULT_TK_ENCODING.kind_of?(::Encoding) tk_enc_name = DEFAULT_TK_ENCODING.name tksys_enc_name = DEFAULT_TK_ENCODING.name @@ -3012,12 +3171,13 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) enc_name = nil rescue ArgumentError enc_name = nil - fail ArgumentError, + fail ArgumentError, "DEFAULT_TK_ENCODING has an unknown encoding #{default_def}" end unless enc_name - if ext_enc_obj == Tk::Encoding::UNKNOWN + #if ext_enc_obj == Tk::Encoding::UNKNOWN + if int_enc_obj == Tk::Encoding::UNKNOWN if loc_enc_obj == Tk::Encoding::UNKNOWN # use Tk.encoding_system enc_name = tksys_enc_name @@ -3025,7 +3185,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) # use locale_charmap begin loc_enc_name = Tk::Encoding::ENCODING_TABLE.get_name(loc_enc_obj) - if loc_enc_name && loc_enc_name != tksys_enc_name + if loc_enc_name # use locale_charmap enc_name = loc_enc_name else @@ -3039,10 +3199,12 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) end else begin - ext_enc_name = Tk::Encoding::ENCODING_TABLE.get_name(ext_enc_obj) - if ext_enc_name && ext_enc_name != tksys_enc_name - # use default_external - enc_name = ext_enc_name + #ext_enc_name = Tk::Encoding::ENCODING_TABLE.get_name(ext_enc_obj) + #if ext_enc_name && ext_enc_name != tksys_enc_name + int_enc_name = Tk::Encoding::ENCODING_TABLE.get_name(int_enc_obj) + if int_enc_name + # use default_internal + enc_name = int_enc_name else # use Tk.encoding_system enc_name = tksys_enc_name @@ -3186,19 +3348,19 @@ module TkTreatFont if key pathname = [win, tag, key].join(';') - TkFont.used_on(pathname) || + TkFont.used_on(pathname) || TkFont.init_widget_font(pathname, *__confinfo_cmd) elsif optkeys.size == 1 pathname = [win, tag, optkeys[0]].join(';') - TkFont.used_on(pathname) || + TkFont.used_on(pathname) || TkFont.init_widget_font(pathname, *__confinfo_cmd) else fonts = {} - optkeys.each{|key| - key = key.to_s - pathname = [win, tag, key].join(';') - fonts[key] = - TkFont.used_on(pathname) || + optkeys.each{|k| + k = k.to_s + pathname = [win, tag, k].join(';') + fonts[k] = + TkFont.used_on(pathname) || TkFont.init_widget_font(pathname, *__confinfo_cmd) } fonts @@ -3228,8 +3390,8 @@ module TkTreatFont next else if fnt - if (slot.key?(l_optkey) || - slot.key?(a_optkey) || + if (slot.key?(l_optkey) || + slot.key?(a_optkey) || slot.key?(k_optkey)) fnt = TkFont.new(fnt) @@ -3240,7 +3402,7 @@ module TkTreatFont fnt.latin_replace(lfnt) if lfnt fnt.kanji_replace(kfnt) if kfnt - fnt.call_font_configure([pathname, optkey], + fnt.call_font_configure([pathname, optkey], *(__config_cmd << {})) next else @@ -3265,7 +3427,7 @@ module TkTreatFont kfnt = slot.delete(k_optkey) if lfnt && kfnt - TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], + TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], *(__config_cmd << {})) elsif lfnt latinfont_configure([lfnt, optkey]) @@ -3322,7 +3484,7 @@ module TkTreatFont if fobj.kind_of?(TkFont) if ltn.kind_of?(TkFont) conf = {} - ltn.latin_configinfo.each{|key,val| conf[key] = val} + ltn.latin_configinfo.each{|k,val| conf[k] = val} if keys fobj.latin_configure(conf.update(keys)) else @@ -3382,7 +3544,7 @@ module TkTreatFont if fobj.kind_of?(TkFont) if knj.kind_of?(TkFont) conf = {} - knj.kanji_configinfo.each{|key,val| conf[key] = val} + knj.kanji_configinfo.each{|k,val| conf[k] = val} if keys fobj.kanji_configure(conf.update(keys)) else @@ -3423,7 +3585,7 @@ module TkTreatFont def latinfont_copy(win, wintag=nil, winkey=nil, targetkey=nil) if targetkey - fontobj(targetkey).dup.call_font_configure([__pathname, targetkey], + fontobj(targetkey).dup.call_font_configure([__pathname, targetkey], *(__config_cmd << {})) else fontobj.dup.call_font_configure(__pathname, *(__config_cmd << {})) @@ -3448,7 +3610,7 @@ module TkTreatFont def kanjifont_copy(win, wintag=nil, winkey=nil, targetkey=nil) if targetkey - fontobj(targetkey).dup.call_font_configure([__pathname, targetkey], + fontobj(targetkey).dup.call_font_configure([__pathname, targetkey], *(__config_cmd << {})) else fontobj.dup.call_font_configure(__pathname, *(__config_cmd << {})) @@ -3500,7 +3662,7 @@ module TkConfigMethod private :__confinfo_cmd def __configinfo_struct - {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, + {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, :default_value=>3, :current_value=>4} end private :__configinfo_struct @@ -3527,10 +3689,10 @@ module TkConfigMethod def __strval_optkeys [ - 'text', 'label', 'show', 'data', 'file', - 'activebackground', 'activeforeground', 'background', - 'disabledforeground', 'disabledbackground', 'foreground', - 'highlightbackground', 'highlightcolor', 'insertbackground', + 'text', 'label', 'show', 'data', 'file', + 'activebackground', 'activeforeground', 'background', + 'disabledforeground', 'disabledbackground', 'foreground', + 'highlightbackground', 'highlightcolor', 'insertbackground', 'selectbackground', 'selectforeground', 'troughcolor' ] end @@ -3616,11 +3778,17 @@ module TkConfigMethod val end + def cget_tkstring(option) + opt = option.to_s + fail ArgumentError, "Invalid option `#{option.inspect}'" if opt.length == 0 + tk_call_without_enc(*(__cget_cmd << "-#{opt}")) + end + def __cget_core(slot) orig_slot = slot slot = slot.to_s - - if slot.length == 0 + + if slot.length == 0 fail ArgumentError, "Invalid option `#{orig_slot.inspect}'" end @@ -3846,12 +4014,12 @@ module TkConfigMethod def __configinfo_core(slot = nil) if TkComm::GET_CONFIGINFO_AS_ARRAY - if (slot && + if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/) fontkey = $2 # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")))) conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")), false, true) - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] if ( ! __configinfo_struct[:alias] \ || conf.size > __configinfo_struct[:alias] + 1 ) @@ -3863,7 +4031,7 @@ module TkConfigMethod elsif ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 \ && conf[__configinfo_struct[:alias]][0] == ?- ) - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end conf @@ -3913,7 +4081,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]]) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = number(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -3921,7 +4089,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = number(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -3934,11 +4102,11 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]]) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = num_or_str(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = num_or_str(conf[__configinfo_struct[:current_value]]) end @@ -3949,7 +4117,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]]) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = bool(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -3957,7 +4125,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = bool(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -3970,11 +4138,11 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]]) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = simplelist(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = simplelist(conf[__configinfo_struct[:current_value]]) end @@ -3985,12 +4153,12 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] \ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = list(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] \ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = list(conf[__configinfo_struct[:current_value]]) end @@ -4021,15 +4189,16 @@ module TkConfigMethod else # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")))) - conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 0, false, true) + # conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 0, false, true) + conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 1, false, true) end - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] if ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 \ && conf[__configinfo_struct[:alias]][0] == ?- ) - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end @@ -4040,7 +4209,7 @@ module TkConfigMethod # conf = tk_split_simplelist(conflist) ret = tk_split_simplelist(tk_call_without_enc(*__confinfo_cmd), false, false).collect{|conflist| conf = tk_split_simplelist(conflist, false, true) - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] optkey = conf[__configinfo_struct[:key]] @@ -4076,7 +4245,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = number(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4084,7 +4253,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = number(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4094,11 +4263,11 @@ module TkConfigMethod when /^(#{__numstrval_optkeys.join('|')})$/ if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = num_or_str(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = num_or_str(conf[__configinfo_struct[:current_value]]) end @@ -4106,7 +4275,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = bool(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4114,7 +4283,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = bool(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4124,11 +4293,11 @@ module TkConfigMethod when /^(#{__listval_optkeys.join('|')})$/ if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = simplelist(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = simplelist(conf[__configinfo_struct[:current_value]]) end @@ -4136,12 +4305,12 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] \ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = list(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] \ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = list(conf[__configinfo_struct[:current_value]]) end @@ -4168,20 +4337,20 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) if conf[__configinfo_struct[:default_value]].index('{') - conf[__configinfo_struct[:default_value]] = - tk_split_list(conf[__configinfo_struct[:default_value]]) + conf[__configinfo_struct[:default_value]] = + tk_split_list(conf[__configinfo_struct[:default_value]]) else - conf[__configinfo_struct[:default_value]] = - tk_tcl2ruby(conf[__configinfo_struct[:default_value]]) + conf[__configinfo_struct[:default_value]] = + tk_tcl2ruby(conf[__configinfo_struct[:default_value]]) end end if conf[__configinfo_struct[:current_value]] if conf[__configinfo_struct[:current_value]].index('{') - conf[__configinfo_struct[:current_value]] = - tk_split_list(conf[__configinfo_struct[:current_value]]) + conf[__configinfo_struct[:current_value]] = + tk_split_list(conf[__configinfo_struct[:current_value]]) else - conf[__configinfo_struct[:current_value]] = - tk_tcl2ruby(conf[__configinfo_struct[:current_value]]) + conf[__configinfo_struct[:current_value]] = + tk_tcl2ruby(conf[__configinfo_struct[:current_value]]) end end end @@ -4189,7 +4358,7 @@ module TkConfigMethod if ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 \ && conf[__configinfo_struct[:alias]][0] == ?- ) - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end @@ -4211,8 +4380,8 @@ module TkConfigMethod end } - __methodcall_optkeys.each{|optkey, method| - ret << [optkey.to_s, '', '', '', self.__send__(method)] + __methodcall_optkeys.each{|optkey, m| + ret << [optkey.to_s, '', '', '', self.__send__(m)] } ret @@ -4220,12 +4389,12 @@ module TkConfigMethod end else # ! TkComm::GET_CONFIGINFO_AS_ARRAY - if (slot && + if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/) fontkey = $2 # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")))) conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")), false, true) - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] if ( ! __configinfo_struct[:alias] \ @@ -4239,7 +4408,7 @@ module TkConfigMethod elsif ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 ) if conf[__configinfo_struct[:alias]][0] == ?- - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end { conf[0] => conf[1] } @@ -4250,7 +4419,7 @@ module TkConfigMethod if slot slot = slot.to_s - alias_name, real_name = __optkey_aliases.find{|k, v| k.to_s == slot} + alias_name, real_name = __optkey_aliases.find{|k,var| k.to_s == slot} if real_name slot = real_name.to_s end @@ -4292,7 +4461,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = number(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4300,7 +4469,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = number(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4313,11 +4482,11 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = num_or_str(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = num_or_str(conf[__configinfo_struct[:current_value]]) end @@ -4328,7 +4497,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = bool(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4336,7 +4505,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = bool(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4349,11 +4518,11 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = simplelist(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = simplelist(conf[__configinfo_struct[:current_value]]) end @@ -4364,12 +4533,12 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] \ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = list(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] \ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = list(conf[__configinfo_struct[:current_value]]) end @@ -4401,13 +4570,13 @@ module TkConfigMethod # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")))) conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 0, false, true) end - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] if ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 ) if conf[__configinfo_struct[:alias]][0] == ?- - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end { conf[0] => conf[1] } @@ -4421,7 +4590,7 @@ module TkConfigMethod # conf = tk_split_simplelist(conflist) tk_split_simplelist(tk_call_without_enc(*__confinfo_cmd), false, false).each{|conflist| conf = tk_split_simplelist(conflist, false, true) - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] optkey = conf[__configinfo_struct[:key]] @@ -4457,7 +4626,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = number(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4465,7 +4634,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = number(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4475,11 +4644,11 @@ module TkConfigMethod when /^(#{__numstrval_optkeys.join('|')})$/ if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = num_or_str(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = num_or_str(conf[__configinfo_struct[:current_value]]) end @@ -4487,7 +4656,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = bool(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4495,7 +4664,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = bool(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4505,11 +4674,11 @@ module TkConfigMethod when /^(#{__listval_optkeys.join('|')})$/ if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = simplelist(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = simplelist(conf[__configinfo_struct[:current_value]]) end @@ -4517,12 +4686,12 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] \ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = list(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] \ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = list(conf[__configinfo_struct[:current_value]]) end @@ -4549,20 +4718,20 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) if conf[__configinfo_struct[:default_value]].index('{') - conf[__configinfo_struct[:default_value]] = - tk_split_list(conf[__configinfo_struct[:default_value]]) + conf[__configinfo_struct[:default_value]] = + tk_split_list(conf[__configinfo_struct[:default_value]]) else - conf[__configinfo_struct[:default_value]] = - tk_tcl2ruby(conf[__configinfo_struct[:default_value]]) + conf[__configinfo_struct[:default_value]] = + tk_tcl2ruby(conf[__configinfo_struct[:default_value]]) end end if conf[__configinfo_struct[:current_value]] if conf[__configinfo_struct[:current_value]].index('{') - conf[__configinfo_struct[:current_value]] = - tk_split_list(conf[__configinfo_struct[:current_value]]) + conf[__configinfo_struct[:current_value]] = + tk_split_list(conf[__configinfo_struct[:current_value]]) else - conf[__configinfo_struct[:current_value]] = - tk_tcl2ruby(conf[__configinfo_struct[:current_value]]) + conf[__configinfo_struct[:current_value]] = + tk_tcl2ruby(conf[__configinfo_struct[:current_value]]) end end end @@ -4570,7 +4739,7 @@ module TkConfigMethod if ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 ) if conf[__configinfo_struct[:alias]][0] == ?- - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end ret[conf[0]] = conf[1] @@ -4597,8 +4766,8 @@ module TkConfigMethod end } - __methodcall_optkeys.each{|optkey, method| - ret[optkey.to_s] = ['', '', '', self.__send__(method)] + __methodcall_optkeys.each{|optkey, m| + ret[optkey.to_s] = ['', '', '', self.__send__(m)] } ret @@ -4632,22 +4801,22 @@ module TkConfigMethod end slot = conf[__configinfo_struct[:alias]] end while(org_slot != slot) - fail RuntimeError, + fail RuntimeError, "there is a configure alias loop about '#{org_slot}'" else ret = {} - configinfo().each{|conf| + configinfo().each{|cnf| if ( ! __configinfo_struct[:alias] \ - || conf.size > __configinfo_struct[:alias] + 1 ) - ret[conf[0]] = conf[-1] + || cnf.size > __configinfo_struct[:alias] + 1 ) + ret[cnf[0]] = cnf[-1] end } ret end else # ! TkComm::GET_CONFIGINFO_AS_ARRAY ret = {} - configinfo(slot).each{|key, conf| - ret[key] = conf[-1] if conf.kind_of?(Array) + configinfo(slot).each{|key, cnf| + ret[key] = cnf[-1] if cnf.kind_of?(Array) } ret end @@ -4719,13 +4888,13 @@ class TkObject", *hash_kv(keys)) - tk_call_without_enc('event', 'generate', path, - "<#{tk_event_sequence(context)}>", + tk_call_without_enc('event', 'generate', path, + "<#{tk_event_sequence(context)}>", *hash_kv(keys, true)) else #tk_call('event', 'generate', path, "<#{tk_event_sequence(context)}>") - tk_call_without_enc('event', 'generate', path, + tk_call_without_enc('event', 'generate', path, "<#{tk_event_sequence(context)}>") end end @@ -4779,6 +4948,7 @@ class TkWindow If TkCommandNames[0] is a string (not a null string), - ## assume the string is a Tcl/Tk's create command of the widget class. + ## ==> If TkCommandNames[0] is a string (not a null string), + ## assume the string is a Tcl/Tk's create command of the widget class. WidgetClassName = ''.freeze - # WidgetClassNames[WidgetClassName] = self + # WidgetClassNames[WidgetClassName] = self ## ==> If self is a widget class, entry to the WidgetClassNames table. def self.to_eval self::WidgetClassName @@ -4805,8 +4975,8 @@ class TkWindow 'tk/button', + :TkButton => 'tk/button', - :TkCanvas => 'tk/canvas', + :TkCanvas => 'tk/canvas', - :TkCheckButton => 'tk/checkbutton', - :TkCheckbutton => 'tk/checkbutton', + :TkCheckButton => 'tk/checkbutton', + :TkCheckbutton => 'tk/checkbutton', - # :TkDialog => 'tk/dialog', - # :TkDialog2 => 'tk/dialog', - # :TkDialogObj => 'tk/dialog', - # :TkWarning => 'tk/dialog', - # :TkWarning2 => 'tk/dialog', - # :TkWarningObj => 'tk/dialog', + # :TkDialog => 'tk/dialog', + # :TkDialog2 => 'tk/dialog', + # :TkDialogObj => 'tk/dialog', + # :TkWarning => 'tk/dialog', + # :TkWarning2 => 'tk/dialog', + # :TkWarningObj => 'tk/dialog', - :TkEntry => 'tk/entry', + :TkEntry => 'tk/entry', - :TkFrame => 'tk/frame', + :TkFrame => 'tk/frame', - :TkLabel => 'tk/label', + :TkLabel => 'tk/label', - :TkLabelFrame => 'tk/labelframe', - :TkLabelframe => 'tk/labelframe', + :TkLabelFrame => 'tk/labelframe', + :TkLabelframe => 'tk/labelframe', - :TkListbox => 'tk/listbox', + :TkListbox => 'tk/listbox', - :TkMacResource => 'tk/macpkg', + :TkMacResource => 'tk/macpkg', - :TkMenu => 'tk/menu', - :TkMenuClone => 'tk/menu', - :TkCloneMenu => 'tk/menu', - # :TkSystemMenu => 'tk/menu', - :TkSysMenu_Help => 'tk/menu', - :TkSysMenu_System => 'tk/menu', - :TkSysMenu_Apple => 'tk/menu', - :TkMenubutton => 'tk/menu', - :TkMenuButton => 'tk/menu', - :TkOptionMenubutton => 'tk/menu', - :TkOptionMenuButton => 'tk/menu', + :TkMenu => 'tk/menu', + :TkMenuClone => 'tk/menu', + :TkCloneMenu => 'tk/menu', + # :TkSystemMenu => 'tk/menu', + :TkSysMenu_Help => 'tk/menu', + :TkSysMenu_System => 'tk/menu', + :TkSysMenu_Apple => 'tk/menu', + :TkMenubutton => 'tk/menu', + :TkMenuButton => 'tk/menu', + :TkOptionMenubutton => 'tk/menu', + :TkOptionMenuButton => 'tk/menu', - :TkMessage => 'tk/message', + :TkMessage => 'tk/message', - :TkPanedWindow => 'tk/panedwindow', - :TkPanedwindow => 'tk/panedwindow', + :TkPanedWindow => 'tk/panedwindow', + :TkPanedwindow => 'tk/panedwindow', - :TkRadioButton => 'tk/radiobutton', - :TkRadiobutton => 'tk/radiobutton', + :TkRadioButton => 'tk/radiobutton', + :TkRadiobutton => 'tk/radiobutton', - # :TkRoot => 'tk/root', + # :TkRoot => 'tk/root', - :TkScale => 'tk/scale', + :TkScale => 'tk/scale', - :TkScrollbar => 'tk/scrollbar', - :TkXScrollbar => 'tk/scrollbar', - :TkYScrollbar => 'tk/scrollbar', + :TkScrollbar => 'tk/scrollbar', + :TkXScrollbar => 'tk/scrollbar', + :TkYScrollbar => 'tk/scrollbar', - :TkSpinbox => 'tk/spinbox', + :TkSpinbox => 'tk/spinbox', - :TkText => 'tk/text', + :TkText => 'tk/text', - :TkToplevel => 'tk/toplevel', + :TkToplevel => 'tk/toplevel', - :TkWinDDE => 'tk/winpkg', - :TkWinRegistry => 'tk/winpkg', + :TkWinDDE => 'tk/winpkg', + :TkWinRegistry => 'tk/winpkg', } @TOPLEVEL_ALIAS_OWNER = {} @TOPLEVEL_ALIAS_SETUP_PROC = {} + @AUTOLOAD_FILE_SYM_TABLE = Hash.new{|h,k| h[k]={}} # TABLE[file][sym] -> obj + @current_default_widget_set = nil + + module TOPLEVEL_ALIASES; end end +class Object + include Tk::TOPLEVEL_ALIASES +end ############################################ # methods to control default widget set @@ -343,50 +352,387 @@ class << Tk _replace_toplevel_aliases(target) end - def __set_toplevel_aliases__(target, obj, *symbols) + def widget_set_symbols + @TOPLEVEL_ALIAS_TABLE.keys + end + + def toplevel_aliases_on_widget_set(widget_set) + if (tbl = @TOPLEVEL_ALIAS_TABLE[widget_set.to_sym]) + tbl.collect{|k, v| (v.nil?)? nil: k}.compact + else + fail ArgumentError, "unknown widget_set #{widget_set.to_sym.inspect}" + end + end + + def __toplevel_alias_setup_proc__(*target_list, &cmd) + target_list.each{|target| @TOPLEVEL_ALIAS_SETUP_PROC[target.to_sym] = cmd} + end + + def topobj_defined?(sym) #=> alias_filename or object or false + Object.autoload?(sym) || + (Object.const_defined?(sym) && Object.const_get(sym)) + end + def topalias_defined?(sym) #=> alias_filename or object or false + Tk::TOPLEVEL_ALIASES.autoload?(sym) || + (Tk::TOPLEVEL_ALIASES.const_defined?(sym) && + Tk::TOPLEVEL_ALIASES.const_get(sym)) + end + def define_topobj(sym, obj) + if obj.kind_of? String + # obj is an autoload path + Object.autoload(sym, obj) + unless Object.autoload?(sym) + # file is autoloaded? + if @AUTOLOAD_FILE_SYM_TABLE.has_key?(obj) && + (loaded_obj = @AUTOLOAD_FILE_SYM_TABLE[obj][sym]) + Object.const_set(sym, loaded_obj) + else + fail ArgumentError, "cannot define autoload file (already loaded?)" + end + end + else + # object + Object.const_set(sym, obj) + end + end + def define_topalias(sym, obj) + if obj.kind_of? String + # obj is an autoload path + Tk::TOPLEVEL_ALIASES.autoload(sym, obj) + unless Tk::TOPLEVEL_ALIASES.autoload?(sym) + # file is autoloaded? + if @AUTOLOAD_FILE_SYM_TABLE.has_key?(obj) && + (loaded_obj = @AUTOLOAD_FILE_SYM_TABLE[obj][sym]) + Tk::TOPLEVEL_ALIASES.const_set(sym, loaded_obj) + else + fail ArgumentError, "cannot define autoload file (already loaded?)" + end + end + else + # object + Tk::TOPLEVEL_ALIASES.const_set(sym, obj) + end + end + def replace_topobj(sym, obj) #=> old_obj (alias_filename or object) or nil + if old_obj = topobj_defined?(sym) + Object.class_eval{remove_const sym} rescue nil # ignore err + end + define_topobj(sym, obj) + old_obj + end + def replace_topalias(sym, obj) #=> old_obj (alias_filename or object) or nil + if old_obj = topalias_defined?(sym) + Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} rescue nil #ignore err + end + define_topalias(sym, obj) + old_obj + end + private :topobj_defined?, :topalias_defined? + private :define_topobj, :define_topalias + private :replace_topobj, :replace_topalias + + def __regist_toplevel_aliases__(target, obj, *symbols) + # initial regist @TOPLEVEL_ALIAS_TABLE[target = target.to_sym] ||= {} symbols.each{|sym| @TOPLEVEL_ALIAS_TABLE[target][sym = sym.to_sym] = obj - # if @current_default_widget_set == target - if @TOPLEVEL_ALIAS_OWNER[sym] == target - Object.class_eval{remove_const sym} if Object.const_defined?(sym) - Object.const_set(sym, obj) + if !topalias_defined?(sym) || target == @current_default_widget_set + @TOPLEVEL_ALIAS_OWNER[sym] = target + replace_topalias(sym, obj) + replace_topobj(sym, obj) unless obj.kind_of?(String) # NOT autoload end } end - ################################### - private - def _replace_toplevel_aliases(target) - # check already autoloaded - if (table = @TOPLEVEL_ALIAS_TABLE[current = @current_default_widget_set]) - table.each{|sym, file| - if !Object.autoload?(sym) && Object.const_defined?(sym) && - @TOPLEVEL_ALIAS_TABLE[current][sym].kind_of?(String) - # autoload -> class - @TOPLEVEL_ALIAS_TABLE[current][sym] = Object.const_get(sym) + def regist_sym_for_loaded_file(auto, obj, sym) + @AUTOLOAD_FILE_SYM_TABLE[auto][sym] = obj + + reg = /^#{Regexp.quote(auto)}(\.rb|\.so|)$/ + @TOPLEVEL_ALIAS_TABLE.each_key{|set| + if @TOPLEVEL_ALIAS_TABLE[set][sym] =~ reg + @TOPLEVEL_ALIAS_TABLE[set][sym] = obj + if @TOPLEVEL_ALIAS_OWNER[sym].nil? || @TOPLEVEL_ALIAS_OWNER[sym] == set + replace_topalias(sym, obj) + replace_topobj(sym, obj) if set == @current_default_widget_set end - } + end + } + if (f = Object.autoload?(sym)) && f =~ reg + replace_topobj(sym, obj) + end + if (f = Tk::TOPLEVEL_ALIASES.autoload?(sym)) && f =~ reg + replace_topalias(sym, obj) + end + end + private :regist_sym_for_loaded_file + + def set_topalias(target, obj, sym) + # obj is a kind of String : define autoload path + # Class : use the class object + if target == @current_default_widget_set + case @TOPLEVEL_ALIAS_OWNER[sym] + when false + # Object::sym is out of control. --> not change + # Make ALIAS::sym under control, because target widget set is current. + # Keep OWNER[sym] + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + replace_topalias(sym, obj) + + when target + if current_obj = topobj_defined?(sym) + if current_obj == obj + # Make current_obj under control. + # Keep Object::sym. + # Keep OWNER[sym]. + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + replace_topalias(sym, obj) + + else # current_obj != obj + if current_obj == topalias_defined?(sym) + # Change controlled object + # Keep OWNER[sym]. + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + replace_topalias(sym, obj) + replace_topobj(sym, obj) + + else # current_obj != topalias_defined?(sym) + # Maybe current_obj is defined by user. --> OWNER[sym] = faise + # Keep Object::sym. + @TOPLEVEL_ALIAS_OWNER[sym] = false + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + replace_topalias(sym, obj) + end + end + + else # NOT topobj_defined?(sym) + # New definition for sym at target. + # Keep OWNER[sym]. + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + replace_topalias(sym, obj) + define_topobj(sym, obj) + end + + when nil + # New definition for sym at target. + @TOPLEVEL_ALIAS_OWNER[sym] = target + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + replace_topalias(sym, obj) + + else # others + # Maybe planning to make sym under control. + @TOPLEVEL_ALIAS_OWNER[sym] = target + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + replace_topalias(sym, obj) + replace_topobj(sym, obj) + end + + else # target != @current_default_widget_set + case @TOPLEVEL_ALIAS_OWNER[sym] + when false + # Object::sym is out of control. --> not change + if topalias_defined?(sym) + # ALIAS[sym] may be defined by other widget set. + # Keep Object::sym (even if it is not defined) + # Keep ALIAS[sym]. + # Keep OWNER[sym]. + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + + else # NOT topalias_defined?(sym) + # Nobody controls ALIAS[sym]. + # At leaset, current widget set doesn't control ALIAS[sym]. + # Keep Object::sym (even if it is not defined) + # Keep OWNER[sym]. + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + define_topalias(sym, obj) + end + + when target + # Maybe change controlled object, because Object::sym is under control. + # Keep OWNER[sym]. + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + replace_topalias(sym, obj) + replace_topobj(sym, obj) + + when nil + # New definition for sym + @TOPLEVEL_ALIAS_OWNER[sym] = target + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + replace_topalias(sym, obj) + replace_topobj(sym, obj) + + else # others + # An other widget set controls sym. + # Keep Object::sym (even if it is not defined) + # Keep ALIAS[sym]. + # Keep OWNER[sym]. + @TOPLEVEL_ALIAS_TABLE[target][sym] = obj + + end end - # setup autoloads - @TOPLEVEL_ALIAS_TABLE[target].each{|sym, file| - Object.class_eval{remove_const sym} if Object.const_defined?(sym) - if file.kind_of?(String) - # file => autoload target file - Object.autoload(sym, file) - else - # file => loaded class object - Object.const_set(sym, file) + sym + end + private :set_topalias + + def __set_toplevel_aliases__(target, obj, *symbols) + # obj is a kind of String : define autoload path + # Class : use the class object + target = target.to_sym + symbols.each{|sym| set_topalias(target, obj, sym.to_sym)} + end + + def __set_loaded_toplevel_aliases__(autopath, target, obj, *symbols) + # autopath is an autoload file + # Currently, this method doesn't support that autoload loads + # different toplevels between .rb and .so extension. + shortpath = (autopath =~ /^(.*)(.rb|.so)$/)? $1: autopath + target = target.to_sym + symbols.map!{|sym| sym.to_sym} + + symbols.each{|sym| regist_sym_for_loaded_file(shortpath, obj, sym) } + symbols.each{|sym| set_topalias(target, obj, sym)} + end + + def backup_current_topdef(sym) + return if (current = @current_default_widget_set).nil? + + case @TOPLEVEL_ALIAS_OWNER[sym] + when false + # Object::sym is out of control. + if (cur_alias = topalias_defined?(sym)) && ! cur_alias.kind_of?(String) + @TOPLEVEL_ALIAS_TABLE[current][sym] = cur_alias end - @TOPLEVEL_ALIAS_OWNER[sym] = target + + when current + if cur_obj = topobj_defined?(sym) + if ! cur_obj.kind_of?(String) && (cur_alias = topalias_defined?(sym)) + if cur_alias.kind_of?(String) + # Mayby, user replaced Object::sym. + # Make Object::sym out of control. + @TOPLEVEL_ALIAS_OWNER[sym] = false + elsif cur_obj == cur_alias + # Possibley, defined normally. Backup it + @TOPLEVEL_ALIAS_TABLE[current][sym] = cur_alias + else + # Mayby, user replaced Object::sym. + # Make Object::sym out of control. + @TOPLEVEL_ALIAS_OWNER[sym] = false + end + end + else + # Mayby, user replaced Object::sym. + # Make Object::sym out of control. + @TOPLEVEL_ALIAS_OWNER[sym] = false + end + + when nil + # Object::sym is out of control. + if (cur_alias = topalias_defined?(sym)) && ! cur_alias.kind_of?(String) + # Possibley, defined normally. Backup it. + @TOPLEVEL_ALIAS_TABLE[current][sym] = cur_alias + end + else + # No authority to control Object::sym and ALIASES::sym. + # Do nothing. + end + end + private :backup_current_topdef + + def _replace_toplevel_aliases(target) + # backup + @TOPLEVEL_ALIAS_TABLE[target].each_key{|sym| + backup_current_topdef(sym) } - # update current alias + # replace + @TOPLEVEL_ALIAS_TABLE[target].each_key{|sym| + next if (obj = @TOPLEVEL_ALIAS_TABLE[target][sym]).nil? + if @TOPLEVEL_ALIAS_OWNER[sym] == false + # Object::sym is out of control. --> not change + # Keep OWNER[sym]. + replace_topalias(sym, obj) + else + # New definition + @TOPLEVEL_ALIAS_OWNER[sym] = target + replace_topalias(sym, obj) + replace_topobj(sym, obj) + end + } + + # change default_widget_set @current_default_widget_set = target end + private :_replace_toplevel_aliases + + def __import_toplevel_aliases__(target, *symbols) + current = @current_default_widget_set + symbols.each{|sym| + sym = sym.to_sym + if (obj = @TOPLEVEL_ALIAS_TABLE[target][sym]).nil? + # remove + @TOPLEVEL_ALIAS_TABLE[current].delete(sym) + @TOPLEVEL_ALIAS_OWNER.delete(sym) + Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} if topalias_defined?(sym) + Object.class_eval{remove_const sym} if topobj_defined?(sym) + + elsif obj == false + # remove, but OWNER[sym] <- false and not treat Object::sym + @TOPLEVEL_ALIAS_TABLE[current].delete(sym) + @TOPLEVEL_ALIAS_OWNER[sym] = false + Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} if topalias_defined?(sym) + + elsif @TOPLEVEL_ALIAS_OWNER[sym] == false + # Object::sym is out of control. --> not change + # Keep OWNER[sym]. + @TOPLEVEL_ALIAS_TABLE[current][sym] = obj + replace_topalias(sym, obj) + + else + # new definition under control + @TOPLEVEL_ALIAS_OWNER[sym] = current + @TOPLEVEL_ALIAS_TABLE[current][sym] = obj + replace_topalias(sym, obj) + replace_topobj(sym, obj) + end + } + end + + def __remove_toplevel_aliases__(*symbols) + # remove toplevel aliases of current widget set + current = @current_default_widget_set + symbols.each{|sym| + sym = sym.to_sym + @TOPLEVEL_ALIAS_TABLE[current].delete(sym) + @TOPLEVEL_ALIAS_OWNER.delete(sym) + Tk::TOPLEVEL_ALIASES.module_eval{remove_const sym} if topalias_defined?(sym) + Object.class_eval{remove_const sym} if topobj_defined?(sym) + } + end + + def __reset_toplevel_owner__(*symbols) + symbols.each{|sym| @TOPLEVEL_ALIAS_OWNER.delete(sym.to_sym)} + end + + def __disable_toplevel_control__(*symbols) + symbols.each{|sym| @TOPLEVEL_ALIAS_OWNER[sym.to_sym] = false} + end + + def __create_widget_set__(new_set, src_set={}) + new_set = new_set.to_sym + if @TOPLEVEL_ALIAS_TABLE[new_set] + fail RuntimeError, "A widget-set #{new_set.inspect} is already exist." + end + if src_set.kind_of?(Symbol) + # new_set is an alias name of existed widget set. + @TOPLEVEL_ALIAS_TABLE[new_set] = @TOPLEVEL_ALIAS_TABLE[src_set] + else + @TOPLEVEL_ALIAS_TABLE[new_set] = {} + src_set.each{|sym, obj| set_topalias(new_set, obj, sym.to_sym) } + end + end end + ############################################ # setup default widget set => :Tk Tk.default_widget_set = :Tk @@ -394,14 +740,14 @@ Tk.default_widget_set = :Tk ############################################ # depend on the version of Tcl/Tk -# major, minor, type, type_name, patchlevel = TclTkLib.get_version +# major, minor, type, patchlevel = TclTkLib.get_version ############################################ # Ttk (Tile) support =begin -if major > 8 || - (major == 8 && minor > 5) || - (major == 8 && minor == 5 && type >= TclTkLib::RELEASE_TYPE::BETA) +if major > 8 || + (major == 8 && minor > 5) || + (major == 8 && minor == 5 && type >= TclTkLib::RELEASE_TYPE::BETA) # Tcl/Tk 8.5 beta or later Object.autoload :Ttk, 'tkextlib/tile' Tk.autoload :Tile, 'tkextlib/tile' diff --git a/ext/tk/lib/tk/bindtag.rb b/ext/tk/lib/tk/bindtag.rb index 88c8367a88..23b4e0b7c3 100644 --- a/ext/tk/lib/tk/bindtag.rb +++ b/ext/tk/lib/tk/bindtag.rb @@ -9,7 +9,7 @@ class TkBindTag #BTagID_TBL = {} BTagID_TBL = TkCore::INTERP.create_table - (Tk_BINDTAG_ID = ["btag".freeze, "00000".taint]).instance_eval{ + (Tk_BINDTAG_ID = ["btag".freeze, TkUtil.untrust("00000")]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze diff --git a/ext/tk/lib/tk/busy.rb b/ext/tk/lib/tk/busy.rb new file mode 100644 index 0000000000..7f4f89f524 --- /dev/null +++ b/ext/tk/lib/tk/busy.rb @@ -0,0 +1,118 @@ +# +# tk/busy.rb: support 'tk busy' command (Tcl/Tk8.6 or later) +# +require 'tk' + +module Tk::Busy + include TkCore + extend TkCore + extend TkItemConfigMethod +end + +class << Tk::Busy + def __item_cget_cmd(win) + # maybe need to override + ['tk', 'busy', 'cget', win.path] + end + private :__item_cget_cmd + + def __item_config_cmd(win) + # maybe need to override + ['tk', 'busy', 'configure', win.path] + end + private :__item_config_cmd + + def __item_confinfo_cmd(win) + # maybe need to override + __item_config_cmd(win) + end + private :__item_confinfo_cmd + + alias cget_tkstring itemcget_tkstring + alias cget itemcget + alias cget_strict itemcget_strict + alias configure itemconfigure + alias configinfo itemconfiginfo + alias current_configinfo current_itemconfiginfo + + private :itemcget_tkstring, :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo + + def method_missing(id, *args) + name = id.id2name + case args.length + when 1 + if name[-1] == ?= + configure name[0..-2], args[0] + args[0] + else + configure name, args[0] + self + end + when 0 + begin + cget(name) + rescue + super(id, *args) + end + else + super(id, *args) + end + end + + def hold(win, keys={}) + tk_call_without_enc('tk', 'busy', 'hold', win, *hash_kv(keys)) + win + end + + def forget(*wins) + tk_call_without_enc('tk', 'busy', 'forget', *wins) + self + end + + def current(pat=None) + list(tk_call('tk', 'busy', 'current', pat)) + end + + def status(win) + bool(tk_call_without_enc('tk', 'busy', 'status', win)) + end +end + +module Tk::Busy + def busy_configinfo(option=nil) + Tk::Busy.configinfo(self, option) + end + + def busy_current_configinfo(option=nil) + Tk::Busy.current_configinfo(self, option) + end + + def busy_configure(option, value=None) + Tk::Busy.configure(self, option, value) + self + end + + def busy_cget(option) + Tk::Busy.configure(self, option) + end + + def busy(keys={}) + Tk::Busy.hold(self, keys) + self + end + alias busy_hold busy + + def busy_forget + Tk::Busy.forget(self) + self + end + + def busy_current? + ! Tk::Busy.current(self.path).empty? + end + + def busy_status + Tk::Busy.status(self) + end +end diff --git a/ext/tk/lib/tk/button.rb b/ext/tk/lib/tk/button.rb index 770a5785bb..65233c91b6 100644 --- a/ext/tk/lib/tk/button.rb +++ b/ext/tk/lib/tk/button.rb @@ -7,7 +7,7 @@ require 'tk/label' class Tk::Buttonvalue}) end else - _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), + _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}", _get_eval_enc_str(value))) end end @@ -389,16 +395,16 @@ class Tk::Canvas ['', '', '', self.coords(tagOrId)]} when 'dash', 'activedash', 'disableddash' - conf = tk_split_simplelist(tk_send_without_enc('itemconfigure', - tagid(tagOrId), + conf = tk_split_simplelist(tk_send_without_enc('itemconfigure', + tagid(tagOrId), "-#{key}")) if conf[3] && conf[3] =~ /^[0-9]/ conf[3] = list(conf[3]) @@ -457,16 +463,16 @@ class Tk::Canvas' end + def _get_opt_method_list(arg) + m_set, m_cget, m_info = arg + m_set = m_set.to_s + m_cget = m_set if !m_cget && self.method(m_set).arity == -1 + m_cget = m_cget.to_s if m_cget + m_info = m_info.to_s if m_info + [m_set, m_cget, m_info] + end + private :_get_opt_method_list + def option_methods(*opts) - opts.each{|m_set, m_cget, m_info| - m_set = m_set.to_s - m_cget = m_set if !m_cget && self.method(m_set).arity == -1 - m_cget = m_cget.to_s if m_cget - m_info = m_info.to_s if m_info - @option_methods[m_set] = { - :set => m_set, :cget => m_cget, :info => m_info + if opts.size == 1 && opts[0].kind_of?(Hash) + # {name => [m_set, m_cget, m_info], name => method} style + opts[0].each{|name, arg| + m_set, m_cget, m_info = _get_opt_method_list(arg) + @option_methods[name.to_s] = { + :set => m_set, :cget => m_cget, :info => m_info + } } - } + else + # [m_set, m_cget, m_info] or method style + opts.each{|arg| + m_set, m_cget, m_info = _get_opt_method_list(arg) + @option_methods[m_set] = { + :set => m_set, :cget => m_cget, :info => m_info + } + } + end end def delegate_alias(alias_opt, option, *wins) @@ -215,6 +233,14 @@ module TkComposite end private :__cget_delegates + def cget_tkstring(slot) + if (ret = __cget_delegates(slot)) == None + super(slot) + else + _get_eval_string(ret) + end + end + def cget(slot) if (ret = __cget_delegates(slot)) == None super(slot) @@ -358,7 +384,7 @@ module TkComposite opt, wins = tbl[0] next unless wins && wins[-1] if slot == opt - info_list.delete_if{|i| i[0] == slot} << + info_list.delete_if{|i| i[0] == slot} << wins[-1].configinfo(slot) else info = wins[-1].configinfo(opt) @@ -367,7 +393,7 @@ module TkComposite end else opt, wins = tbl[-1] - info_list.delete_if{|i| i[0] == slot} << + info_list.delete_if{|i| i[0] == slot} << [slot, '', '', '', wins[-1].cget(opt)] end } diff --git a/ext/tk/lib/tk/console.rb b/ext/tk/lib/tk/console.rb index 26ce262caa..64e257594c 100644 --- a/ext/tk/lib/tk/console.rb +++ b/ext/tk/lib/tk/console.rb @@ -28,7 +28,7 @@ module TkConsole # supports a Tcl script only # I have no idea to support a Ruby script seamlessly. # - _fromUTF8(tk_call_without_enc('console', 'eval', + _fromUTF8(tk_call_without_enc('console', 'eval', _get_eval_enc_str(tcl_script))) end def self.maininterp_eval(tcl_script) @@ -36,7 +36,7 @@ module TkConsole # supports a Tcl script only # I have no idea to support a Ruby script seamlessly. # - _fromUTF8(tk_call_without_enc('consoleinterp', 'eval', + _fromUTF8(tk_call_without_enc('consoleinterp', 'eval', _get_eval_enc_str(tcl_script))) end @@ -45,7 +45,7 @@ module TkConsole # supports a Tcl script only # I have no idea to support a Ruby script seamlessly. # - _fromUTF8(tk_call_without_enc('consoleinterp', 'record', + _fromUTF8(tk_call_without_enc('consoleinterp', 'record', _get_eval_enc_str(tcl_script))) end diff --git a/ext/tk/lib/tk/dialog.rb b/ext/tk/lib/tk/dialog.rb index 180da101e3..7ef7820699 100644 --- a/ext/tk/lib/tk/dialog.rb +++ b/ext/tk/lib/tk/dialog.rb @@ -18,11 +18,11 @@ class TkDialogObj < TkWindow def _set_button_config(configs) set_config = proc{|c,i| if $VERBOSE && (c.has_key?('command') || c.has_key?(:command)) - STDERR.print("Warning: cannot give a command option " + + STDERR.print("Warning: cannot give a command option " + "to the dialog button#{i}. It was removed.\n") end c.delete('command'); c.delete(:command) - # @config << Kernel.format("%s.button%s configure %s; ", + # @config << Kernel.format("%s.button%s configure %s; ", # @path, i, hash_kv(c).join(' ')) # @config << @path+'.button'+i.to_s+' configure '+hash_kv(c).join(' ')+'; ' @config << @path+'.button'+i.to_s+' configure '+ @@ -103,7 +103,7 @@ class TkDialogObj < TkWindow #end if @buttons.kind_of?(Array) - _set_button_config(@buttons.collect{|cfg| + _set_button_config(@buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[1]: nil}) @buttons = @buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[0]: cfg} end @@ -127,7 +127,7 @@ class TkDialogObj < TkWindow =end if @message_config.kind_of?(Hash) - # @config << Kernel.format("%s.msg configure %s;", + # @config << Kernel.format("%s.msg configure %s;", # @path, hash_kv(@message_config).join(' ')) # @config << @path+'.msg configure '+hash_kv(@message_config).join(' ')+';' @config << @path+'.msg configure '+ @@ -135,7 +135,7 @@ class TkDialogObj < TkWindow end if @msgframe_config.kind_of?(Hash) - # @config << Kernel.format("%s.top configure %s;", + # @config << Kernel.format("%s.top configure %s;", # @path, hash_kv(@msgframe_config).join(' ')) # @config << @path+'.top configure '+hash_kv(@msgframe_config).join(' ')+';' @config << @path+'.top configure '+ @@ -143,7 +143,7 @@ class TkDialogObj < TkWindow end if @btnframe_config.kind_of?(Hash) - # @config << Kernel.format("%s.bot configure %s;", + # @config << Kernel.format("%s.bot configure %s;", # @path, hash_kv(@btnframe_config).join(' ')) # @config << @path+'.bot configure '+hash_kv(@btnframe_config).join(' ')+';' @config << @path+'.bot configure '+ @@ -151,7 +151,7 @@ class TkDialogObj < TkWindow end if @bitmap_config.kind_of?(Hash) - # @config << Kernel.format("%s.bitmap configure %s;", + # @config << Kernel.format("%s.bitmap configure %s;", # @path, hash_kv(@bitmap_config).join(' ')) # @config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';' @config << @path+'.bitmap configure '+ @@ -176,19 +176,19 @@ class TkDialogObj < TkWindow # default_button = '{}' if default_button == nil default_button = '' if default_button == nil #Tk.ip_eval('eval {global '+@var.id+';'+@config+ - # 'set '+@var.id+' [tk_dialog '+ + # 'set '+@var.id+' [tk_dialog '+ # @path+" "+@title+" {#{@message}} "+@bitmap+" "+ # String(default_button)+" "+@buttons.join(' ')+']}') Tk.ip_eval(@config) - # @val = Tk.ip_eval('tk_dialog ' + @path + ' ' + @title + - # ' {' + @message + '} ' + @bitmap + ' ' + + # @val = Tk.ip_eval('tk_dialog ' + @path + ' ' + @title + + # ' {' + @message + '} ' + @bitmap + ' ' + # String(default_button) + ' ' + @buttons.join(' ')).to_i - # @val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' + - # @title + ' {' + @message + '} ' + @bitmap + ' ' + + # @val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' + + # @title + ' {' + @message + '} ' + @bitmap + ' ' + # String(default_button) + ' ' + @buttons.join(' ')).to_i @val = Tk.ip_eval(array2tk_list([ - self.class::TkCommandNames[0], - @path, @title, @message, @bitmap, + self.class::TkCommandNames[0], + @path, @title, @message, @bitmap, String(default_button) ].concat(@buttons))).to_i end @@ -226,7 +226,7 @@ class TkDialogObj < TkWindow return nil end def bitmap - # returns a bitmap name or a bitmap file path + # returns a bitmap name or a bitmap file path # (@ + path ; e.g. '@/usr/share/bitmap/sample.xbm') return "info" end diff --git a/ext/tk/lib/tk/encodedstr.rb b/ext/tk/lib/tk/encodedstr.rb index 02de0b0d85..59fbb1911d 100644 --- a/ext/tk/lib/tk/encodedstr.rb +++ b/ext/tk/lib/tk/encodedstr.rb @@ -67,11 +67,11 @@ module Tk def initialize(str, enc = nil) super(str) - # @encoding = ( enc || - # ((self.class::Encoding)? + # @encoding = ( enc || + # ((self.class::Encoding)? # self.class::Encoding : Tk.encoding_system) ) enc ||= (self.class::Encoding)? - self.class::Encoding : + self.class::Encoding : ((Tk.encoding)? Tk.encoding : Tk.encoding_system) if TkCore::WITH_ENCODING unless encobj = Tk::Encoding::ENCODING_TABLE.get_obj(enc) diff --git a/ext/tk/lib/tk/entry.rb b/ext/tk/lib/tk/entry.rb index 8ce8def1e7..d4aa03f2b6 100644 --- a/ext/tk/lib/tk/entry.rb +++ b/ext/tk/lib/tk/entry.rb @@ -13,7 +13,7 @@ class Tk::Entry flag - 'above' => Grp::CONFIG, + 'above' => Grp::CONFIG, 'borderwidth' => (Grp::CREATE|Grp::CONFIG), - 'button' => Grp::BUTTON, - 'count' => Grp::EXPOSE, - 'data' => (Grp::VIRTUAL|Grp::STRING_DATA), - 'delta' => Grp::MWHEEL, + 'button' => Grp::BUTTON, + 'count' => Grp::EXPOSE, + 'data' => (Grp::VIRTUAL|Grp::STRING_DATA), + 'delta' => Grp::MWHEEL, 'detail' => (Grp::FOCUS|Grp::CROSSING), 'focus' => Grp::CROSSING, 'height' => (Grp::EXPOSE|Grp::CONFIG), @@ -191,23 +191,23 @@ module TkEvent } FIELD_OPERATION = { - 'root' => proc{|val| + 'root' => proc{|val| begin Tk.tk_call_without_enc('winfo', 'pathname', val) val rescue nil end - }, + }, - 'subwindow' => proc{|val| + 'subwindow' => proc{|val| begin Tk.tk_call_without_enc('winfo', 'pathname', val) val rescue nil end - }, + }, 'window' => proc{|val| nil} } @@ -280,7 +280,7 @@ module TkEvent Tk.event_generate(win, type_name, opts) else # If type is KEY event, focus should be set to target widget. - # If not set, original widget will get the same event. + # If not set, original widget will get the same event. # That will make infinite loop. w = Tk.tk_call_without_enc('focus') begin @@ -296,58 +296,58 @@ module TkEvent # [ <'%' subst-key char>, , ] KEY_TBL = [ - [ ?#, ?n, :serial ], - [ ?a, ?s, :above ], - [ ?b, ?n, :num ], - [ ?c, ?n, :count ], - [ ?d, ?s, :detail ], + [ ?#, ?n, :serial ], + [ ?a, ?s, :above ], + [ ?b, ?n, :num ], + [ ?c, ?n, :count ], + [ ?d, ?s, :detail ], # ?e - [ ?f, ?b, :focus ], + [ ?f, ?b, :focus ], # ?g - [ ?h, ?n, :height ], - [ ?i, ?s, :win_hex ], + [ ?h, ?n, :height ], + [ ?i, ?s, :win_hex ], # ?j - [ ?k, ?n, :keycode ], + [ ?k, ?n, :keycode ], # ?l - [ ?m, ?s, :mode ], + [ ?m, ?s, :mode ], # ?n - [ ?o, ?b, :override ], - [ ?p, ?s, :place ], + [ ?o, ?b, :override ], + [ ?p, ?s, :place ], # ?q # ?r - [ ?s, ?x, :state ], - [ ?t, ?n, :time ], + [ ?s, ?x, :state ], + [ ?t, ?n, :time ], # ?u - [ ?v, ?n, :value_mask ], - [ ?w, ?n, :width ], - [ ?x, ?n, :x ], - [ ?y, ?n, :y ], + [ ?v, ?n, :value_mask ], + [ ?w, ?n, :width ], + [ ?x, ?n, :x ], + [ ?y, ?n, :y ], # ?z - [ ?A, ?s, :char ], - [ ?B, ?n, :borderwidth ], + [ ?A, ?s, :char ], + [ ?B, ?n, :borderwidth ], # ?C - [ ?D, ?n, :wheel_delta ], - [ ?E, ?b, :send_event ], + [ ?D, ?n, :wheel_delta ], + [ ?E, ?b, :send_event ], # ?F # ?G # ?H # ?I # ?J - [ ?K, ?s, :keysym ], + [ ?K, ?s, :keysym ], # ?L # ?M - [ ?N, ?n, :keysym_num ], + [ ?N, ?n, :keysym_num ], # ?O - [ ?P, ?s, :property ], + [ ?P, ?s, :property ], # ?Q - [ ?R, ?s, :rootwin_id ], - [ ?S, ?s, :subwindow ], - [ ?T, ?n, :type ], + [ ?R, ?s, :rootwin_id ], + [ ?S, ?s, :subwindow ], + [ ?T, ?n, :type ], # ?U # ?V - [ ?W, ?w, :widget ], - [ ?X, ?n, :x_root ], - [ ?Y, ?n, :y_root ], + [ ?W, ?w, :widget ], + [ ?X, ?n, :x_root ], + [ ?Y, ?n, :y_root ], # ?Z nil ] @@ -356,16 +356,16 @@ module TkEvent # the subst-key string will be converted to a bytecode (128+idx). LONGKEY_TBL = [ # for example, for %CTT and %CST subst-key on tkdnd-2.0 - # ['CTT', ?l, :drop_target_type], - # ['CST', ?l, :drop_source_type], + # ['CTT', ?l, :drop_target_type], + # ['CST', ?l, :drop_source_type], ] # [ , ] PROC_TBL = [ - [ ?n, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?b, TkComm.method(:bool) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?b, TkComm.method(:bool) ], + [ ?w, TkComm.method(:window) ], [ ?x, proc{|val| begin @@ -374,7 +374,7 @@ module TkEvent val end } - ], + ], nil ] @@ -399,25 +399,25 @@ module TkEvent # setup tables to be used by scan_args, _get_subst_key, _get_all_subst_keys # - # _get_subst_key() and _get_all_subst_keys() generates key-string - # which describe how to convert callback arguments to ruby objects. - # When binding parameters are given, use _get_subst_key(). - # But when no parameters are given, use _get_all_subst_keys() to - # create a Event class object as a callback parameter. + # _get_subst_key() and _get_all_subst_keys() generates key-string + # which describe how to convert callback arguments to ruby objects. + # When binding parameters are given, use _get_subst_key(). + # But when no parameters are given, use _get_all_subst_keys() to + # create a Event class object as a callback parameter. # - # scan_args() is used when doing callback. It convert arguments - # ( which are Tcl strings ) to ruby objects based on the key string - # that is generated by _get_subst_key() or _get_all_subst_keys(). + # scan_args() is used when doing callback. It convert arguments + # ( which are Tcl strings ) to ruby objects based on the key string + # that is generated by _get_subst_key() or _get_all_subst_keys(). # _setup_subst_table(KEY_TBL, PROC_TBL) # _setup_subst_table(KEY_TBL, LONGKEY_TBL, PROC_TBL) # if use longname-keys # - # NOTE: The order of parameters which passed to callback procedure is + # NOTE: The order of parameters which passed to callback procedure is # , , ... , , , ... # - # If you need support extra arguments given by Tcl/Tk, + # If you need support extra arguments given by Tcl/Tk, # please override _get_extra_args_tbl # #def self._get_extra_args_tbl @@ -436,15 +436,15 @@ module TkEvent alias sendevent send_event =end ALIAS_TBL = { - :button => :num, - :data => :detail, - :delta => :wheel_delta, - :root => :rootwin_id, - :rootx => :x_root, - :root_x => :x_root, - :rooty => :y_root, - :root_y => :y_root, - :sendevent => :send_event, + :button => :num, + :data => :detail, + :delta => :wheel_delta, + :root => :rootwin_id, + :rootx => :x_root, + :root_x => :x_root, + :rooty => :y_root, + :root_y => :y_root, + :sendevent => :send_event, :window => :widget } @@ -482,6 +482,26 @@ module TkEvent end }) end + elsif cmd.respond_to?(:arity) && cmd.arity == 0 # args.size == 0 + args = '' + if cmd.kind_of?(String) + id = cmd + elsif cmd.kind_of?(TkCallbackEntry) + id = install_cmd(cmd) + else + id = install_cmd(proc{ + begin + TkUtil.eval_cmd(cmd) + rescue Exception=>e + if TkCore::INTERP.kind_of?(TclTkIp) + fail e + else + # MultiTkIp + fail Exception, "#{e.class}: #{e.message.dup}" + end + end + }) + end else keys, args = klass._get_all_subst_keys diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb index 62d628c132..03db850f96 100644 --- a/ext/tk/lib/tk/font.rb +++ b/ext/tk/lib/tk/font.rb @@ -11,7 +11,7 @@ class TkFont TkCommandNames = ['font'.freeze].freeze - (Tk_FontID = ["@font".freeze, "00000".taint]).instance_eval{ + (Tk_FontID = ["@font".freeze, TkUtil.untrust("00000")]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -20,7 +20,7 @@ class TkFont Tk_FontNameTBL = TkCore::INTERP.create_table Tk_FontUseTBL = TkCore::INTERP.create_table - TkCore::INTERP.init_ip_env{ + TkCore::INTERP.init_ip_env{ Tk_FontNameTBL.mutex.synchronize{ Tk_FontNameTBL.clear } Tk_FontUseTBL.mutex.synchronize{ Tk_FontUseTBL.clear } } @@ -66,8 +66,8 @@ class TkFont knj = 'defaultgui' when /Mincho:Helvetica-Bold-12/ # Tcl/Tk-JP for UNIX/X - ltn, knj = tk_split_simplelist(tk_call('font', 'configure', - 'Mincho:Helvetica-Bold-12', + ltn, knj = tk_split_simplelist(tk_call('font', 'configure', + 'Mincho:Helvetica-Bold-12', '-compound')) else # unknown Tcl/Tk-JP @@ -75,7 +75,7 @@ class TkFont platform = Tk::PLATFORM['platform'] case platform when 'unix' - ltn = {'family'=>'Helvetica'.freeze, + ltn = {'family'=>'Helvetica'.freeze, 'size'=>-12, 'weight'=>'bold'.freeze} #knj = 'k14' #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0' @@ -102,7 +102,7 @@ class TkFont platform = Tk::PLATFORM['platform'] case platform when 'unix' - ltn = {'family'=>'Helvetica'.freeze, + ltn = {'family'=>'Helvetica'.freeze, 'size'=>-12, 'weight'=>'bold'.freeze} when 'windows' ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8} @@ -211,7 +211,7 @@ class TkFont end end def TkFont.actual_hash(fnt, option=nil) - Hash[TkFont.actual_hash(fnt, option)] + Hash[TkFont.actual(fnt, option)] end def TkFont.actual_displayof(fnt, win, option=nil) @@ -224,7 +224,7 @@ class TkFont end end def TkFont.actual_hash_displayof(fnt, option=nil) - Hash[TkFont.actual_hash_displayof(fnt, option)] + Hash[TkFont.actual_displayof(fnt, option)] end def TkFont.configure(fnt, slot, value=None) @@ -294,7 +294,7 @@ class TkFont end h = Hash[TkFont.metrics(fnt)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -331,7 +331,7 @@ class TkFont end h = Hash[TkFont.metrics_displayof(fnt, win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -459,7 +459,7 @@ class TkFont else begin compound = tk_split_simplelist( - Hash[*tk_split_simplelist(tk_call('font', 'configure', + Hash[*tk_split_simplelist(tk_call('font', 'configure', fnt))].collect{|k,v| [k[1..-1], v] }.assoc('compound')[1]) @@ -473,7 +473,7 @@ class TkFont TkFont.new(fnt).call_font_configure([path, key], *args) end else - TkFont.new(compound[0], + TkFont.new(compound[0], compound[1]).call_font_configure([path, key], *args) end end @@ -570,7 +570,7 @@ class TkFont if JAPANIZED_TK tk_call('font', 'create', @latinfont, '-charset', 'iso8859') tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983') - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont]) else tk_call('font', 'create', @latinfont) @@ -614,7 +614,7 @@ class TkFont # compound font check if Tk::TK_VERSION == '8.0' && JAPANIZED_TK begin - compound = tk_split_simplelist(tk_call('font', 'configure', + compound = tk_split_simplelist(tk_call('font', 'configure', ltn, '-compound')) if knj == nil if compound != [] @@ -624,7 +624,7 @@ class TkFont if compound != [] ltn = compound[0] end - compound = tk_split_simplelist(tk_call('font', 'configure', + compound = tk_split_simplelist(tk_call('font', 'configure', knj, '-compound')) if compound != [] knj = compound[1] @@ -639,7 +639,7 @@ class TkFont if Tk::TK_VERSION =~ /^4..*/ knj = DEFAULT_KANJI_FONT_NAME else - knj = ltn + knj = ltn end end else @@ -806,7 +806,7 @@ class TkFont if font[:charset] || font['charset'] tk_call('font', 'create', @latinfont, *hash_kv(font)) else - tk_call('font', 'create', @latinfont, + tk_call('font', 'create', @latinfont, '-charset', 'iso8859', *hash_kv(font)) end elsif font.kind_of? Array @@ -815,7 +815,7 @@ class TkFont elsif font.kind_of? TkFont tk_call('font', 'create', @latinfont, '-copy', font.latin_font) elsif font - tk_call('font', 'create', @latinfont, '-copy', font, + tk_call('font', 'create', @latinfont, '-copy', font, '-charset', 'iso8859') else tk_call('font', 'create', @latinfont, '-charset', 'iso8859') @@ -851,7 +851,7 @@ class TkFont if font[:charset] || font['charset'] tk_call('font', 'create', @kanjifont, *hash_kv(font)) else - tk_call('font', 'create', @kanjifont, + tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983', *hash_kv(font)) end elsif font.kind_of? Array @@ -860,7 +860,7 @@ class TkFont elsif font.kind_of? TkFont tk_call('font', 'create', @kanjifont, '-copy', font.kanji_font_id) elsif font - tk_call('font', 'create', @kanjifont, '-copy', font, + tk_call('font', 'create', @kanjifont, '-copy', font, '-charset', 'jisx0208.1983') else tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983') @@ -922,7 +922,7 @@ class TkFont @fontslot = {'font'=>@compoundfont} # @fontslot['font'] = @compoundfont begin - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) rescue RuntimeError => e if ltn == knj @@ -930,7 +930,7 @@ class TkFont tk_call('font', 'delete', @latinfont) create_latinfont(DEFAULT_LATIN_FONT_NAME) opts = [] - Hash[*(tk_split_simplelist(tk_call('font', 'configure', + Hash[*(tk_split_simplelist(tk_call('font', 'configure', @kanjifont)))].each{|k,v| case k when '-size', '-weight', '-slant', '-underline', '-overstrike' @@ -938,14 +938,14 @@ class TkFont end } tk_call('font', 'configure', @latinfont, *opts) - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) elsif e.message =~ /ascii font .* specified/ tk_call('font', 'delete', @kanjifont) create_kanjifont(DEFAULT_KANJI_FONT_NAME) opts = [] - Hash[*(tk_split_simplelist(tk_call('font', 'configure', + Hash[*(tk_split_simplelist(tk_call('font', 'configure', @latinfont)))].each{|k,v| case k when '-size', '-weight', '-slant', '-underline', '-overstrike' @@ -953,7 +953,7 @@ class TkFont end } tk_call('font', 'configure', @kanjifont, *opts) - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) else @@ -1392,7 +1392,7 @@ class TkFont end h = Hash[metrics(option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1424,7 +1424,7 @@ class TkFont end h = Hash[metrics_displayof(win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1459,7 +1459,7 @@ class TkFont end h = Hash[latin_metrics(option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1495,7 +1495,7 @@ class TkFont end h = Hash[latin_metrics_displayof(win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1532,7 +1532,7 @@ class TkFont end h = Hash[kanji_metrics(option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1570,7 +1570,7 @@ class TkFont end h = Hash[kanji_metrics_displayof(win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1586,7 +1586,7 @@ class TkFont def reset_pointadjust begin if /^8\..*/ === Tk::TK_VERSION && JAPANIZED_TK - configure('pointadjust' => latin_actual.assoc('size')[1].to_f / + configure('pointadjust' => latin_actual.assoc('size')[1].to_f / kanji_actual.assoc('size')[1].to_f ) end rescue @@ -1659,8 +1659,8 @@ module TkFont::CoreMethods '' end else - [['family',''], ['size',0], ['weight',''], ['slant',''], - ['underline',false], ['overstrike',false], ['charset',''], + [['family',''], ['size',0], ['weight',''], ['slant',''], + ['underline',false], ['overstrike',false], ['charset',''], ['pointadjust',0]] end end @@ -1672,7 +1672,7 @@ module TkFont::CoreMethods "" elsif option if win - val = tk_call('font', 'actual', font, + val = tk_call('font', 'actual', font, "-displayof", win, "-#{option}") else val = tk_call('font', 'actual', font, "-#{option}") @@ -1687,7 +1687,7 @@ module TkFont::CoreMethods end else l = tk_split_simplelist(if win - tk_call('font', 'actual', font, + tk_call('font', 'actual', font, "-displayof", win) else tk_call('font', 'actual', font) @@ -1733,8 +1733,8 @@ module TkFont::CoreMethods '' end else - [['family',''], ['size',0], ['weight',''], ['slant',''], - ['underline',false], ['overstrike',false], ['charset',''], + [['family',''], ['size',0], ['weight',''], ['slant',''], + ['underline',false], ['overstrike',false], ['charset',''], ['pointadjust',1.0]] end else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY @@ -1753,8 +1753,8 @@ module TkFont::CoreMethods '' end else - {'family'=>'', 'size'=>0, 'weight'=>'', 'slant'=>'', - 'underline'=>false, 'overstrike'=>false, + {'family'=>'', 'size'=>0, 'weight'=>'', 'slant'=>'', + 'underline'=>false, 'overstrike'=>false, 'charset'=>false, 'pointadjust'=>1.0} end end @@ -1775,20 +1775,20 @@ module TkFont::CoreMethods configure_core_tk8x(font, 'family', slot.delete('family')) end - if ((slot.key?('size') || slot.key?(:size)) && + if ((slot.key?('size') || slot.key?(:size)) && padjust && !slot.key?('pointadjust') && !slot.key?(:pointadjust)) - tk_call('font', 'configure', font, + tk_call('font', 'configure', font, '-pointadjust', padjust, *hash_kv(slot)) else tk_call('font', 'configure', font, *hash_kv(slot)) end elsif (slot == 'size' || slot == :size) && padjust != nil - tk_call('font', 'configure', font, + tk_call('font', 'configure', font, "-#{slot}", value, '-pointadjust', padjust) elsif JAPANIZED_TK && (slot == 'family' || slot == :family) # coumpund font? begin - compound = tk_split_simplelist(tk_call('font', 'configure', + compound = tk_split_simplelist(tk_call('font', 'configure', font, '-compound')) rescue tk_call('font', 'configure', font, '-family', value) @@ -1819,7 +1819,7 @@ module TkFont::CoreMethods ensure tk_call('font', 'delete', kfnt) if kfnt != '' end - + else tk_call('font', 'configure', font, "-#{slot}", value) end @@ -2044,7 +2044,7 @@ module TkFont::CoreMethods keys = self.configinfo tk_call('font', 'delete', @compoundfont) begin - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) =begin latinkeys = {} @@ -2061,7 +2061,7 @@ module TkFont::CoreMethods tk_call('font', 'delete', @latinfont) if fnt_bup && fnt_bup != '' tk_call('font', 'create', @latinfont, '-copy', fnt_bup) - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) tk_call('font', 'delete', fnt_bup) else @@ -2082,7 +2082,7 @@ module TkFont::CoreMethods # not exist? (deleted?) -> create font tk_call('font', 'create', @compoundfont, *hash_kv(latinkeys)) end - end + end self end @@ -2112,20 +2112,20 @@ module TkFont::CoreMethods keys = self.configinfo tk_call('font', 'delete', @compoundfont) begin - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) rescue RuntimeError => e tk_call('font', 'delete', @kanjifont) if fnt_bup && fnt_bup != '' tk_call('font', 'create', @kanjifont, '-copy', fnt_bup) - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) tk_call('font', 'delete', fnt_bup) else fail e end end - end + end self end @@ -2137,7 +2137,7 @@ module TkFont::CoreMethods font = '{}' if font == '' if win - number(tk_call('font', 'measure', font, + number(tk_call('font', 'measure', font, '-displayof', win, text)) else number(tk_call('font', 'measure', font, text)) @@ -2158,7 +2158,7 @@ module TkFont::CoreMethods if option if win - number(tk_call('font', 'metrics', font, + number(tk_call('font', 'metrics', font, "-displayof", win, "-#{option}")) else number(tk_call('font', 'metrics', font, "-#{option}")) @@ -2199,7 +2199,7 @@ module TkFont::CoreMethods alias measure_core measure_core_tk4x alias metrics_core metrics_core_tk4x - when /^8\.[0-5]/ + when /^8\.[0-9]/ alias actual_core actual_core_tk8x alias configure_core configure_core_tk8x alias configinfo_core configinfo_core_tk8x @@ -2304,12 +2304,12 @@ end ####################################### # define system font names ####################################### -if Tk::TCL_MAJOR_VERSION > 8 || +if Tk::TCL_MAJOR_VERSION > 8 || (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) # add standard fonts of Tcl/Tk 8.5+ TkFont::SYSTEM_FONT_NAMES.add [ - 'TkDefaultFont', 'TkTextFont', 'TkFixedFont', 'TkMenuFont', - 'TkHeadingFont', 'TkCaptionFont', 'TkSmallCaptionFont', + 'TkDefaultFont', 'TkTextFont', 'TkFixedFont', 'TkMenuFont', + 'TkHeadingFont', 'TkCaptionFont', 'TkSmallCaptionFont', 'TkIconFont', 'TkTooltipFont' ] end @@ -2323,22 +2323,29 @@ TkFont::SYSTEM_FONT_NAMES.add [ # -- macintosh, macosx TkFont::SYSTEM_FONT_NAMES.add ['system', 'application'] -if Tk::TCL_MAJOR_VERSION > 8 || +if Tk::TCL_MAJOR_VERSION > 8 || (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) TkFont::SYSTEM_FONT_NAMES.add ['menu'] end # -- macosx (Aqua theme) -if Tk::TCL_MAJOR_VERSION > 8 || +if Tk::TCL_MAJOR_VERSION > 8 || (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) TkFont::SYSTEM_FONT_NAMES.add [ - 'systemSystemFont', 'systemEmphasizedSystemFont', - 'systemSmallSystemFont', 'systemSmallEmphasizedSystemFont', - 'systemApplicationFont', 'systemLabelFont', 'systemViewsFont', - 'systemMenuTitleFont', 'systemMenuItemFont', 'systemMenuItemMarkFont', - 'systemMenuItemCmdKeyFont', 'systemWindowTitleFont', - 'systemPushButtonFont', 'systemUtilityWindowTitleFont', - 'systemAlertHeaderFont', 'systemToolbarFont', 'systemMiniSystemFont', + 'systemSystemFont', 'systemEmphasizedSystemFont', + 'systemSmallSystemFont', 'systemSmallEmphasizedSystemFont', + 'systemApplicationFont', 'systemLabelFont', 'systemViewsFont', + 'systemMenuTitleFont', 'systemMenuItemFont', 'systemMenuItemMarkFont', + 'systemMenuItemCmdKeyFont', 'systemWindowTitleFont', + 'systemPushButtonFont', 'systemUtilityWindowTitleFont', + 'systemAlertHeaderFont', 'systemToolbarFont', 'systemMiniSystemFont', 'systemDetailSystemFont', 'systemDetailEmphasizedSystemFont' ] end + +####################################### +# autoload +####################################### +class TkFont + autoload :Chooser, 'tk/fontchooser' +end diff --git a/ext/tk/lib/tk/fontchooser.rb b/ext/tk/lib/tk/fontchooser.rb new file mode 100644 index 0000000000..f9f816be59 --- /dev/null +++ b/ext/tk/lib/tk/fontchooser.rb @@ -0,0 +1,166 @@ +# +# tk/fontchooser.rb -- "tk fontchooser" support (Tcl/Tk8.6 or later) +# +require 'tk' +require 'tk/font' + +module TkFont::Chooser + extend TkCore +end + +class << TkFont::Chooser + def method_missing(id, *args) + name = id.id2name + case args.length + when 1 + if name[-1] == ?= + configure name[0..-2], args[0] + args[0] + else + configure name, args[0] + self + end + when 0 + begin + cget(name) + rescue + super(id, *args) + end + else + super(id, *args) + end + end + + def __conviginfo_value(key, val) + case key + when 'parent' + window(val) + when 'title' + val + when 'font' + if (lst = tk_split_simplelist(val)).size == 1 + lst[0] + else + lst.map{|elem| num_or_str(elem)} + end + when 'command' + tk_tcl2ruby(val) + when 'visible' + bool(val) + else # unkown + val + end + end + private :__conviginfo_value + + def configinfo(option=nil) + if !option && TkComm::GET_CONFIGINFOwoRES_AS_ARRAY + lst = tk_split_simplelist(tk_call('tk', 'fontchooser', 'configure')) + ret = [] + TkComm.slice_ary(lst, 2){|k, v| + k = k[1..-1] + ret << [k, __conviginfo_value(k, v)] + } + ret + else + current_configinfo(option) + end + end + + def current_configinfo(option=nil) + if option + opt = option.to_s + fail ArgumentError, "Invalid option `#{option.inspect}'" if opt.empty? + __conviginfo_value(option.to_s, tk_call('tk','fontchooser', + 'configure',"-#{opt}")) + else + lst = tk_split_simplelist(tk_call('tk', 'fontchooser', 'configure')) + ret = {} + TkComm.slice_ary(lst, 2){|k, v| + k = k[1..-1] + ret[k] = __conviginfo_value(k, v) + } + ret + end + end + + def configure(option, value=None) + if option.kind_of? Hash + tk_call('tk', 'fontchooser', 'configure', + *hash_kv(_symbolkey2str(option))) + else + opt = option.to_s + fail ArgumentError, "Invalid option `#{option.inspect}'" if opt.empty? + tk_call('tk', 'fontchooser', 'configure', "-#{opt}", value) + end + self + end + + def configure_cmd(slot, value) + configure(slot, install_cmd(value)) + end + + def command(cmd=nil, &b) + if cmd + configure_cmd('command', cmd) + elsif b + configure_cmd('command', Proc.new(&b)) + else + cget('command') + end + end + + def cget(slot) + configinfo slot + end + + def [](slot) + cget slot + end + + def []=(slot, val) + configure slot, val + val + end + + def show + tk_call('tk', 'fontchooser', 'show') + self + end + + def hide + tk_call('tk', 'fontchooser', 'hide') + self + end + + def toggle + cget(:visible) ? hide: show + self + end + + def set_for(target, title="Font") + if target.kind_of? TkFont + configs = { + :font=>target.actual_hash, + :command=>proc{|fnt, *args| + target.configure(TkFont.actual_hash(fnt)) + } + } + else + configs = { + :font=>target.cget_tkstring(:font), + :command=>proc{|fnt, *args| + target.font = TkFont.actual_hash_displayof(fnt, target) + } + } + end + + configs[:title] = title if title + configure(configs) + target + end + + def unset + configure(:command, nil) + end +end diff --git a/ext/tk/lib/tk/frame.rb b/ext/tk/lib/tk/frame.rb index 263b160f29..5118939732 100644 --- a/ext/tk/lib/tk/frame.rb +++ b/ext/tk/lib/tk/frame.rb @@ -6,7 +6,7 @@ require 'tk' class Tk::Frame0, :alias=>1, :db_name=>1, :db_class=>2, + {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, :default_value=>3, :current_value=>4} end private :__item_configinfo_struct @@ -162,6 +162,13 @@ module TkItemConfigMethod ################################################ + + def itemcget_tkstring(tagOrId, option) + opt = option.to_s + fail ArgumentError, "Invalid option `#{option.inspect}'" if opt.length == 0 + tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{opt}")) + end + def __itemcget_core(tagOrId, option) orig_opt = option option = option.to_s @@ -402,7 +409,7 @@ module TkItemConfigMethod fontkey = $2 # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")))) conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")), false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 ) @@ -414,7 +421,7 @@ module TkItemConfigMethod elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- ) - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end conf @@ -464,7 +471,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -472,7 +479,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -485,11 +492,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -500,7 +507,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -508,7 +515,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -521,11 +528,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -536,12 +543,12 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -574,13 +581,13 @@ module TkItemConfigMethod # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))) conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true) end - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- ) - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end @@ -591,7 +598,7 @@ module TkItemConfigMethod # conf = tk_split_simplelist(conflist) ret = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false).collect{|conflist| conf = tk_split_simplelist(conflist, false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]] @@ -627,7 +634,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -635,7 +642,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -645,11 +652,11 @@ module TkItemConfigMethod when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -657,7 +664,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -665,7 +672,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -675,11 +682,11 @@ module TkItemConfigMethod when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -687,12 +694,12 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -719,20 +726,20 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{') - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = - tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) else - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = - tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end end if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{') - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = - tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) else - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = - tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end end end @@ -740,7 +747,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- ) - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end @@ -774,7 +781,7 @@ module TkItemConfigMethod fontkey = $2 # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")))) conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")), false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \ @@ -788,7 +795,7 @@ module TkItemConfigMethod elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 ) if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end { conf[0] => conf[1] } @@ -841,7 +848,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -849,7 +856,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -862,11 +869,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = num_or_stre(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -877,7 +884,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -885,7 +892,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -898,11 +905,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -913,12 +920,12 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -951,13 +958,13 @@ module TkItemConfigMethod # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))) conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true) end - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 ) if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end { conf[0] => conf[1] } @@ -971,7 +978,7 @@ module TkItemConfigMethod # conf = tk_split_simplelist(conflist) tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false).each{|conflist| conf = tk_split_simplelist(conflist, false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]] @@ -1007,7 +1014,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -1015,7 +1022,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -1025,11 +1032,11 @@ module TkItemConfigMethod when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -1037,7 +1044,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil @@ -1045,7 +1052,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) rescue conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil @@ -1055,11 +1062,11 @@ module TkItemConfigMethod when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -1067,12 +1074,12 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ ) - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -1099,19 +1106,19 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] ) if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{') - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = - tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) else - conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]) end end if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{') - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = - tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) else - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end end @@ -1120,7 +1127,7 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 ) if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- - conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end ret[conf[0]] = conf[1] @@ -1187,7 +1194,7 @@ module TkItemConfigMethod end slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] end while(org_slot != slot) - fail RuntimeError, + fail RuntimeError, "there is a configure alias loop about '#{org_slot}'" else ret = {} diff --git a/ext/tk/lib/tk/itemfont.rb b/ext/tk/lib/tk/itemfont.rb index 4c5c917c57..b5da4fa1ef 100644 --- a/ext/tk/lib/tk/itemfont.rb +++ b/ext/tk/lib/tk/itemfont.rb @@ -32,22 +32,22 @@ module TkTreatItemFont if key pathname = [win, tag, key].join(';') - TkFont.used_on(pathname) || - TkFont.init_widget_font(pathname, + TkFont.used_on(pathname) || + TkFont.init_widget_font(pathname, *(__item_confinfo_cmd(tagid(tagOrId)))) elsif optkeys.size == 1 pathname = [win, tag, optkeys[0]].join(';') - TkFont.used_on(pathname) || - TkFont.init_widget_font(pathname, + TkFont.used_on(pathname) || + TkFont.init_widget_font(pathname, *(__item_confinfo_cmd(tagid(tagOrId)))) else fonts = {} optkeys.each{|key| key = key.to_s pathname = [win, tag, key].join(';') - fonts[key] = - TkFont.used_on(pathname) || - TkFont.init_widget_font(pathname, + fonts[key] = + TkFont.used_on(pathname) || + TkFont.init_widget_font(pathname, *(__item_confinfo_cmd(tagid(tagOrId)))) } fonts @@ -73,13 +73,13 @@ module TkTreatItemFont slot.delete(a_optkey) slot.delete(k_optkey) - fnt.call_font_configure([pathname, optkey], + fnt.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {})) next else if fnt - if (slot.key?(l_optkey) || - slot.key?(a_optkey) || + if (slot.key?(l_optkey) || + slot.key?(a_optkey) || slot.key?(k_optkey)) fnt = TkFont.new(fnt) @@ -90,7 +90,7 @@ module TkTreatItemFont fnt.latin_replace(lfnt) if lfnt fnt.kanji_replace(kfnt) if kfnt - fnt.call_font_configure([pathname, optkey], + fnt.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {})) next else @@ -115,7 +115,7 @@ module TkTreatItemFont kfnt = slot.delete(k_optkey) if lfnt && kfnt - TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], + TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {})) elsif lfnt latintagfont_configure([lfnt, optkey]) @@ -264,10 +264,10 @@ module TkTreatItemFont end if targetkey - fnt.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], + fnt.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], *(__item_config_cmd(tagid(tagOrId)) << {})) else - fnt.call_font_configure(__item_pathname(tagid(tagOrId)), + fnt.call_font_configure(__item_pathname(tagid(tagOrId)), *(__item_config_cmd(tagid(tagOrId)) << {})) end self @@ -276,10 +276,10 @@ module TkTreatItemFont def latintagfont_copy(tagOrId, win, wintag=nil, winkey=nil, targetkey=nil) if targetkey - fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], + fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], *(__item_config_cmd(tagid(tagOrId)) << {})) else - fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), + fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), *(__item_config_cmd(tagid(tagOrId)) << {})) end @@ -302,10 +302,10 @@ module TkTreatItemFont def kanjifont_copy(tagOrId, win, wintag=nil, winkey=nil, targetkey=nil) if targetkey - fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], + fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], *(__item_config_cmd(tagid(tagOrId)) << {})) else - fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), + fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), *(__item_config_cmd(tagid(tagOrId)) << {})) end diff --git a/ext/tk/lib/tk/kinput.rb b/ext/tk/lib/tk/kinput.rb index a29dbcdb72..b63f756def 100644 --- a/ext/tk/lib/tk/kinput.rb +++ b/ext/tk/lib/tk/kinput.rb @@ -8,8 +8,8 @@ module TkKinput extend Tk TkCommandNames = [ - 'kinput_start'.freeze, - 'kinput_send_spot'.freeze, + 'kinput_start'.freeze, + 'kinput_send_spot'.freeze, 'kanjiInput'.freeze ].freeze @@ -47,7 +47,7 @@ module TkKinput def TkKinput.attribute_info(win, slot=nil) if slot - conf = tk_split_list(tk_call('kanjiInput', 'attribute', + conf = tk_split_list(tk_call('kanjiInput', 'attribute', win, "-#{slot}")) conf[0] = conf[0][1..-1] conf diff --git a/ext/tk/lib/tk/label.rb b/ext/tk/lib/tk/label.rb index 80b3d778f1..05e430e49b 100644 --- a/ext/tk/lib/tk/label.rb +++ b/ext/tk/lib/tk/label.rb @@ -6,7 +6,7 @@ require 'tk' class Tk::Label@variable, + @menu.add('radiobutton', 'variable'=>@variable, 'label'=>value, 'value'=>value) self end @@ -623,7 +658,7 @@ class Tk::OptionMenubutton@variable, + @menu.insert(index, 'radiobutton', 'variable'=>@variable, 'label'=>value, 'value'=>value) self end @@ -677,5 +712,7 @@ end Tk::OptionMenuButton = Tk::OptionMenubutton #TkOptionMenubutton = Tk::OptionMenubutton unless Object.const_defined? :TkOptionMenubutton #TkOptionMenuButton = Tk::OptionMenuButton unless Object.const_defined? :TkOptionMenuButton -Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton, - :TkOptionMenubutton, :TkOptionMenuButton) +#Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton, +# :TkOptionMenubutton, :TkOptionMenuButton) +Tk.__set_loaded_toplevel_aliases__('tk/menu.rb', :Tk, Tk::OptionMenubutton, + :TkOptionMenubutton, :TkOptionMenuButton) diff --git a/ext/tk/lib/tk/menubar.rb b/ext/tk/lib/tk/menubar.rb index ef9da809b9..9d5571c470 100644 --- a/ext/tk/lib/tk/menubar.rb +++ b/ext/tk/lib/tk/menubar.rb @@ -2,7 +2,7 @@ # tk/menubar.rb # # Original version: -# Copyright (C) 1998 maeda shugo. All rights reserved. +# Copyright (C) 1998 maeda shugo. All rights reserved. # This file can be distributed under the terms of the Ruby. # Usage: @@ -52,18 +52,18 @@ # {:label=>'Open', :command=>proc{puts('Open clicked')}, :underline=>0}, # '---', # ['Check_A', TkVariable.new(true), 6], -# {:type=>'checkbutton', :label=>'Check_B', +# {:type=>'checkbutton', :label=>'Check_B', # :variable=>TkVariable.new, :underline=>6}, # '---', # ['Radio_X', [radio_var, 'x'], 6], # ['Radio_Y', [radio_var, 'y'], 6], # ['Radio_Z', [radio_var, 'z'], 6], # '---', -# ['cascade', [ -# ['sss', proc{p 'sss'}, 0], -# ['ttt', proc{p 'ttt'}, 0], -# ['uuu', proc{p 'uuu'}, 0], -# ['vvv', proc{p 'vvv'}, 0], +# ['cascade', [ +# ['sss', proc{p 'sss'}, 0], +# ['ttt', proc{p 'ttt'}, 0], +# ['uuu', proc{p 'uuu'}, 0], +# ['vvv', proc{p 'vvv'}, 0], # ], 0], # '---', # ['Quit', proc{exit}, 0]], @@ -92,25 +92,31 @@ require 'tk/menuspec' class TkMenubar'cascade'). When type is 'cascade', an array of menu_info # is acceptable for 'menu' key (then, create sub-menu). # +# If the value of underline is true instead of an integer, +# check whether the text/label string contains a '&' character. +# When includes, the first '&' is removed and its following character is +# converted the corresponding 'underline' option (first '&' is removed). +# Else if the value of underline is a String or a Regexp, +# use the result of label.index(underline) as the index of underline +# (don't remove matched substring). +# # NOTE: (*1) -# If you want to make special menus (*.help for UNIX, *.system for Win, -# and *.apple for Mac), append 'menu_name'=>name (name is 'help' for UNIX, -# 'system' for Win, and 'apple' for Mac) option to the configs hash of +# If you want to make special menus (*.help for UNIX, *.system for Win, +# and *.apple for Mac), append 'menu_name'=>name (name is 'help' for UNIX, +# 'system' for Win, and 'apple' for Mac) option to the configs hash of # menu button/entry information. # # NOTE: (*2) @@ -39,7 +54,11 @@ # to the configs of the cascade entry. module TkMenuSpec - def _create_menu(parent, menu_info, menu_name = nil, + extend TkMenuSpec + + MENUSPEC_OPTKEYS = [ 'layout_proc' ] + + def _create_menu(parent, menu_info, menu_name = nil, tearoff = false, default_opts = nil) if tearoff.kind_of?(Hash) default_opts = tearoff @@ -59,6 +78,7 @@ module TkMenuSpec end tearoff = orig_opts.delete('tearoff') if orig_opts.key?('tearoff') + tearoff = false unless tearoff # nil --> false if menu_name #menu = Tk::Menu.new(parent, :widgetname=>menu_name, :tearoff=>tearoff) @@ -80,10 +100,27 @@ module TkMenuSpec menu_opts.update(_symbolkey2str(options.delete('menu_config') || {})) if item_type == 'cascade' && options['menu'].kind_of?(Array) # create cascade menu - submenu = _create_menu(menu, options['menu'], menu_name, + submenu = _create_menu(menu, options['menu'], menu_name, tearoff, menu_opts) options['menu'] = submenu end + case options['underline'] + when String, Regexp + if options['label'] && + (idx = options['label'].index(options['underline'])) + options['underline'] = idx + else + options['underline'] = -1 + end + when true + if options['label'] && (idx = options['label'].index('&')) + options['label'] = options['label'].dup + options['label'][idx] = '' + options['underline'] = idx + else + options['underline'] = -1 + end + end menu.add(item_type, options) elsif item_info.kind_of?(Array) @@ -117,7 +154,7 @@ module TkMenuSpec menu_config = opts.delete('menu_config') || {} menu_opts.update(_symbolkey2str(menu_config)) end - submenu = _create_menu(menu, item_info[1], menu_name, + submenu = _create_menu(menu, item_info[1], menu_name, tearoff, menu_opts) options['menu'] = submenu end @@ -138,6 +175,25 @@ module TkMenuSpec end options.update(opts) end + + case options['underline'] + when String, Regexp + if options['label'] && + (idx = options['label'].index(options['underline'])) + options['underline'] = idx + else + options['underline'] = -1 + end + when true + if options['label'] && (idx = options['label'].index('&')) + options['label'] = options['label'].dup + options['label'][idx] = '' + options['underline'] = idx + else + options['underline'] = -1 + end + end + menu.add(item_type, options) elsif /^-+$/ =~ item_info @@ -155,7 +211,7 @@ module TkMenuSpec def _use_menubar?(parent) use_menubar = false if parent.kind_of?(Tk::Root) || parent.kind_of?(Tk::Toplevel) - true + true elsif parent.current_configinfo.has_key?('menu') true else @@ -177,7 +233,7 @@ module TkMenuSpec end private :_create_menu_for_menubar - def _create_menubutton(parent, menu_info, tearoff=false, default_opts = nil) + def _create_menubutton(parent, menu_info, tearoff=false, default_opts = {}) btn_info = menu_info[0] if tearoff.kind_of?(Hash) @@ -186,14 +242,49 @@ module TkMenuSpec end if default_opts.kind_of?(Hash) - keys = _symbolkey2str(default_opts) - else - keys = {} + default_opts = _symbolkey2str(default_opts) + + if default_opts.has_key?('layout_proc') + layout_proc = default_opts.delete('layout_proc') + end + + _vertical_mbar_bind_proc = proc{|m, dir| + Tk::Menu::TkInternalFunction.next_menu(m, dir) rescue nil + # ignore error when the internal function doesn't exist + } + + case layout_proc + when :vertical, 'vertical', :vertical_left, 'vertical_left' + layout_proc = proc{|_parent, _mbtn| + _mbtn.direction :right + _mbtn.pack(:side=>:top, :fill=>:x) + + menu = _mbtn.menu + menu.bind('Tab', _vertical_mbar_bind_proc, :widget, 'forward') + menu.bind('Alt-Tab', _vertical_mbar_bind_proc, :widget, 'backward') + } + when :vertical_right, 'vertical_right' + layout_proc = proc{|_parent, _mbtn| + _mbtn.direction :left + _mbtn.pack(:side=>:top, :fill=>:x) + + menu = _mbtn.menu + menu.bind('Tab', _vertical_mbar_bind_proc, :widget, 'forward') + menu.bind('Alt-Tab', _vertical_mbar_bind_proc, :widget, 'backward') + } + when :horizontal, 'horizontal' + layout_proc = proc{|_parent, _mbtn| _mbtn.pack(:side=>:left)} + else + # do nothing + end end - tearoff = keys.delete('tearoff') if keys.key?('tearoff') + keys = default_opts.dup - if _use_menubar?(parent) + tearoff = keys.delete('tearoff') if keys.key?('tearoff') + tearoff = false unless tearoff # nil --> false + + if _use_menubar?(parent) && ! layout_proc # menubar by menu entries mbar = _create_menu_for_menubar(parent) @@ -202,19 +293,57 @@ module TkMenuSpec if btn_info.kind_of?(Hash) keys.update(_symbolkey2str(btn_info)) menu_name = keys.delete('menu_name') - keys['label'] = keys.delete('text') if keys.key?('text') + keys['label'] = keys.delete('text') || '' + + case keys['underline'] + when String, Regexp + if idx = keys['label'].index(keys['underline']) + keys['underline'] = idx + else + keys['underline'] = -1 + end + when true + if idx = keys['label'].index('&') + keys['label'] = keys['label'].dup + keys['label'][idx] = '' + keys['underline'] = idx + else + keys['underline'] = -1 + end + end + elsif btn_info.kind_of?(Array) keys['label'] = btn_info[0] if btn_info[0] - keys['underline'] = btn_info[1] if btn_info[1] + + case btn_info[1] + when Integer + keys['underline'] = btn_info[1] + when String, Regexp + if idx = keys['label'].index(btn_info[1]) + keys['underline'] = idx + else + keys['underline'] = -1 + end + when true + if idx = keys['label'].index('&') + keys['label'] = keys['label'].dup + keys['label'][idx] = '' + keys['underline'] = idx + else + keys['underline'] = -1 + end + end + if btn_info[2]&&btn_info[2].kind_of?(Hash) keys.update(_symbolkey2str(btn_info[2])) menu_name = keys.delete('menu_name') end + else keys = {:label=>btn_info} end - menu = _create_menu(mbar, menu_info[1..-1], menu_name, + menu = _create_menu(mbar, menu_info[1..-1], menu_name, tearoff, default_opts) menu.tearoff(tearoff) @@ -234,9 +363,42 @@ module TkMenuSpec if btn_info.kind_of?(Hash) keys.update(_symbolkey2str(btn_info)) menu_name = keys.delete('menu_name') - keys['text'] = keys.delete('label') if keys.key?('label') + keys['text'] = keys.delete('label') || '' + case keys['underline'] + when String, Regexp + if idx = keys['text'].index(keys['underline']) + keys['underline'] = idx + else + keys['underline'] = -1 + end + when true + if idx = keys['text'].index('&') + keys['text'] = keys['text'].dup + keys['text'][idx] = '' + keys['underline'] = idx + else + keys['underline'] = -1 + end + end mbtn.configure(keys) + elsif btn_info.kind_of?(Array) + case btn_info[1] + when String, Regexp + if btn_info[0] && (idx = btn_info[0].index(btn_info[1])) + btn_info[1] = idx + else + btn_info[1] = -1 + end + when true + if btn_info[0] && (idx = btn_info[0].index('&')) + btn_info[0] = btn_info[0].dup + btn_info[0][idx] = '' + btn_info[1] = idx + else + btn_info[1] = -1 + end + end mbtn.configure('text', btn_info[0]) if btn_info[0] mbtn.configure('underline', btn_info[1]) if btn_info[1] # mbtn.configure('accelerator', btn_info[2]) if btn_info[2] @@ -245,22 +407,41 @@ module TkMenuSpec menu_name = keys.delete('menu_name') mbtn.configure(keys) end + else mbtn.configure('text', btn_info) end - mbtn.pack('side' => 'left') - - menu = _create_menu(mbtn, menu_info[1..-1], menu_name, + menu = _create_menu(mbtn, menu_info[1..-1], menu_name, tearoff, default_opts) - mbtn.menu(menu) + if layout_proc.kind_of?(Proc) || layout_proc.kind_of?(Method) + # e.g. make a vertical menubar + # :layout_proc => proc{|parent, btn| btn.pack(:side=>:top, :fill=>:x)} + layout_proc.call(parent, mbtn) + else + mbtn.pack('side' => 'left') + end + [mbtn, menu] end end private :_create_menubutton + def _create_menubar(parent, menu_spec, tearoff = false, opts = nil) + if tearoff.kind_of?(Hash) + opts = tearoff + tearoff = false + end + tearoff = false unless tearoff # nil --> false + menu_spec.each{|menu_info| + _create_menubutton(parent, menu_info, tearoff, opts) + } + parent + end + private :_create_menubar + def _get_cascade_menus(menu) menus = [] (0..(menu.index('last'))).each{|idx| diff --git a/ext/tk/lib/tk/message.rb b/ext/tk/lib/tk/message.rb index 946b68c704..5f73b3066f 100644 --- a/ext/tk/lib/tk/message.rb +++ b/ext/tk/lib/tk/message.rb @@ -7,7 +7,7 @@ require 'tk/label' class Tk::Message e begin - msg = _toUTF8(e.class.inspect) + ': ' + - _toUTF8(e.message) + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - _toUTF8(e.backtrace.join("\n")) + + msg = _toUTF8(e.class.inspect) + ': ' + + _toUTF8(e.message) + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + _toUTF8(e.backtrace.join("\n")) + "\n---< backtrace of Tk side >-------" if TkCore::WITH_ENCODING msg.force_encoding('utf-8') @@ -80,9 +80,9 @@ class TkMsgCatalog < TkObject msg.instance_variable_set(:@encoding, 'utf-8') end rescue Exception - msg = e.class.inspect + ': ' + e.message + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - e.backtrace.join("\n") + + msg = e.class.inspect + ': ' + e.message + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + e.backtrace.join("\n") + "\n---< backtrace of Tk side >-------" end fail(e, msg) @@ -153,7 +153,7 @@ class TkMsgCatalog < TkObject end def translate(*args) dst = args.collect{|src| - @namespace.eval{tk_call_without_enc('::msgcat::mc', + @namespace.eval{tk_call_without_enc('::msgcat::mc', _get_eval_string(src, true))} } Tk.UTF8_String(sprintf(*dst)) @@ -229,29 +229,29 @@ class TkMsgCatalog < TkObject def self.set_translation(locale, src_str, trans_str=None, enc='utf-8') if trans_str && trans_str != None trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc)) - Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', - locale, - _get_eval_string(src_str, true), + Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', + locale, + _get_eval_string(src_str, true), trans_str)) else - Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', - locale, + Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', + locale, _get_eval_string(src_str, true))) end end def set_translation(locale, src_str, trans_str=None, enc='utf-8') if trans_str && trans_str != None - trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc)) + trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc)) Tk.UTF8_String(@namespace.eval{ - tk_call_without_enc('::msgcat::mcset', - locale, - _get_eval_string(src_str, true), + tk_call_without_enc('::msgcat::mcset', + locale, + _get_eval_string(src_str, true), trans_str) }) else Tk.UTF8_String(@namespace.eval{ - tk_call_without_enc('::msgcat::mcset', - locale, + tk_call_without_enc('::msgcat::mcset', + locale, _get_eval_string(src_str, true))}) end end @@ -261,7 +261,7 @@ class TkMsgCatalog < TkObject list = [] trans_list.each{|src, trans| if trans && trans != None - list << _get_eval_string(src, true) + list << _get_eval_string(src, true) list << Tk.UTF8_Stirng(_toUTF8(trans, enc)) else list << _get_eval_string(src, true) << '' @@ -274,7 +274,7 @@ class TkMsgCatalog < TkObject list = [] trans_list.each{|src, trans| if trans && trans != None - list << _get_eval_string(src, true) + list << _get_eval_string(src, true) list << Tk.UTF8_String(_toUTF8(trans, enc)) else list << _get_eval_string(src, true) << '' diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb index 20a8d65215..4af891995e 100644 --- a/ext/tk/lib/tk/namespace.rb +++ b/ext/tk/lib/tk/namespace.rb @@ -8,12 +8,12 @@ class TkNamespace < TkObject extend Tk TkCommandNames = [ - 'namespace'.freeze, + 'namespace'.freeze, ].freeze Tk_Namespace_ID_TBL = TkCore::INTERP.create_table - (Tk_Namespace_ID = ["ns".freeze, "00000".taint]).instance_eval{ + (Tk_Namespace_ID = ["ns".freeze, TkUtil.untrust("00000")]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -46,7 +46,7 @@ class TkNamespace < TkObject private :__config_cmd def __configinfo_struct - {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, + {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, :default_value=>nil, :current_value=>2} end private :__configinfo_struct @@ -122,8 +122,8 @@ class TkNamespace < TkObject if TkComm::GET_CONFIGINFO_AS_ARRAY Tk_Namespace_ID_TBL.mutex.synchronize{ - info.map!{|inf| - if inf[0] == 'namespace' && + info.map!{|inf| + if inf[0] == 'namespace' && TkNamespace::Tk_Namespace_ID_TBL.key?(inf[-1]) [inf[0], TkNamespace::Tk_Namespace_ID_TBL[inf[-1]]] else @@ -160,19 +160,19 @@ class TkNamespace < TkObject def tk_call(*args) #super('namespace', 'eval', @namespace, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @namespace, + super('namespace', 'eval', @namespace, TkCore::INTERP._merge_tklist(*args)) end def tk_call_without_enc(*args) #super('namespace', 'eval', @namespace, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @namespace, + super('namespace', 'eval', @namespace, TkCore::INTERP._merge_tklist(*args)) end def tk_call_with_enc(*args) #super('namespace', 'eval', @namespace, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @namespace, + super('namespace', 'eval', @namespace, TkCore::INTERP._merge_tklist(*args)) end @@ -223,19 +223,19 @@ class TkNamespace < TkObject def tk_call(*args) #super('namespace', 'eval', @fullname, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @fullname, + super('namespace', 'eval', @fullname, TkCore::INTERP._merge_tklist(*args)) end def tk_call_without_enc(*args) #super('namespace', 'eval', @fullname, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @fullname, + super('namespace', 'eval', @fullname, TkCore::INTERP._merge_tklist(*args)) end def tk_call_with_enc(*args) #super('namespace', 'eval', @fullname, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @fullname, + super('namespace', 'eval', @fullname, TkCore::INTERP._merge_tklist(*args)) end alias ns_tk_call tk_call @@ -318,7 +318,7 @@ class TkNamespace < TkObject else fail ArgumentError, "String or Proc is expected" end - TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', + TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', _get_eval_string(cmd, false))) end =end @@ -350,8 +350,8 @@ class TkNamespace < TkObject else fail ArgumentError, "String or Proc is expected" end - TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', - _get_eval_string(cmd, false)), + TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', + _get_eval_string(cmd, false)), true) end diff --git a/ext/tk/lib/tk/optiondb.rb b/ext/tk/lib/tk/optiondb.rb index 186811d37d..0f3be30ff7 100644 --- a/ext/tk/lib/tk/optiondb.rb +++ b/ext/tk/lib/tk/optiondb.rb @@ -8,7 +8,7 @@ module TkOptionDB extend Tk TkCommandNames = ['option'.freeze].freeze - (CmdClassID = ['CMD_CLASS'.freeze, '00000'.taint]).instance_eval{ + (CmdClassID = ['CMD_CLASS'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -44,7 +44,7 @@ module TkOptionDB def read_entries(file, f_enc=nil) if TkCore::INTERP.safe? - fail SecurityError, + fail SecurityError, "can't call 'TkOptionDB.read_entries' on a safe interpreter" end @@ -86,7 +86,7 @@ module TkOptionDB ent end module_function :read_entries - + def read_with_encoding(file, f_enc=nil, pri=None) # try to read the file as an OptionDB file read_entries(file, f_enc).each{|pat, val| @@ -136,7 +136,7 @@ module TkOptionDB @@resource_proc_class.const_set(:CARRIER, '.'.freeze) - @@resource_proc_class.instance_variable_set('@method_tbl', + @@resource_proc_class.instance_variable_set('@method_tbl', TkCore::INTERP.create_table) @@resource_proc_class.instance_variable_set('@add_method', false) @@resource_proc_class.instance_variable_set('@safe_mode', 4) @@ -144,7 +144,7 @@ module TkOptionDB class << @@resource_proc_class private :new -=begin +=begin CARRIER = '.'.freeze METHOD_TBL = TkCore::INTERP.create_table ADD_METHOD = false @@ -171,7 +171,7 @@ module TkOptionDB def __check_proc_string__(str) # If you want to check the proc_string, do it in this method. - # Please define this in the block given to 'new_proc_class' method. + # Please define this in the block given to 'new_proc_class' method. str end @@ -186,20 +186,20 @@ module TkOptionDB unless TkComm._callback_entry?(res_proc) #if id == :new || !(self::METHOD_TBL.has_key?(id) || self::ADD_METHOD) if id == :new || !(@method_tbl.has_key?(id) || @add_method) - raise NoMethodError, + raise NoMethodError, "not support resource-proc '#{id.id2name}' for #{self.name}" end proc_str = proc_source proc_str = '{' + proc_str + '}' unless /\A\{.*\}\Z/ =~ proc_str #proc_str = __closed_block_check__(proc_str) proc_str = __check_proc_string__(proc_str) - res_proc = proc{ + res_proc = proc{ begin #eval("$SAFE = #{self::SAFE_MODE};\nProc.new" + proc_str) eval("$SAFE = #{@safe_mode};\nProc.new" + proc_str) rescue SyntaxError=>err - raise SyntaxError, - TkCore::INTERP._toUTF8(err.message.gsub(/\(eval\):\d:/, + raise SyntaxError, + TkCore::INTERP._toUTF8(err.message.gsub(/\(eval\):\d:/, "(#{id.id2name}):")) end }.call @@ -291,7 +291,7 @@ module TkOptionDB cmd_klass.instance_variable_set('@method_tbl', TkCore::INTERP.create_table) cmd_klass.instance_variable_set('@add_method', add) cmd_klass.instance_variable_set('@safe_mode', safe) - func.each{|f| + func.each{|f| cmd_klass.instance_variable_get('@method_tbl')[f.to_s.intern] = nil } =begin @@ -310,14 +310,14 @@ module TkOptionDB # for security, make these methods invalid class << klass def __null_method(*args); nil; end - [ :class_eval, :name, :superclass, :clone, :dup, :autoload, :autoload?, - :ancestors, :const_defined?, :const_get, :const_set, :const_missing, - :class_variables, :constants, :included_modules, :instance_methods, - :method_defined?, :module_eval, :private_instance_methods, - :protected_instance_methods, :public_instance_methods, - :singleton_methods, :remove_const, :remove_method, :undef_method, - :to_s, :inspect, :display, :method, :methods, :respond_to?, - :instance_variable_get, :instance_variable_set, :instance_method, + [ :class_eval, :name, :superclass, :clone, :dup, :autoload, :autoload?, + :ancestors, :const_defined?, :const_get, :const_set, :const_missing, + :class_variables, :constants, :included_modules, :instance_methods, + :method_defined?, :module_eval, :private_instance_methods, + :protected_instance_methods, :public_instance_methods, + :singleton_methods, :remove_const, :remove_method, :undef_method, + :to_s, :inspect, :display, :method, :methods, :respond_to?, + :instance_variable_get, :instance_variable_set, :instance_method, :instance_eval, :instance_exec, :instance_variables, :kind_of?, :is_a?, :private_methods, :protected_methods, :public_methods ].each{|m| alias_method(m, :__null_method) @@ -331,7 +331,7 @@ module TkOptionDB RAND_BASE_HEAD = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' RAND_BASE_CHAR = RAND_BASE_HEAD + 'abcdefghijklmnopqrstuvwxyz0123456789_' def __get_random_basename - name = '%s%03d' % [RAND_BASE_HEAD[rand(RAND_BASE_HEAD.size),1], + name = '%s%03d' % [RAND_BASE_HEAD[rand(RAND_BASE_HEAD.size),1], RAND_BASE_CNT[0]] len = RAND_BASE_CHAR.size (6+rand(10)).times{ @@ -344,9 +344,9 @@ module TkOptionDB private_class_method :__get_random_basename # define new proc class : - # If you want to modify the new class or create a new subclass, - # you must do such operation in the block parameter. - # Because the created class is flozen after evaluating the block. + # If you want to modify the new class or create a new subclass, + # you must do such operation in the block parameter. + # Because the created class is flozen after evaluating the block. def new_proc_class(klass, func, safe = 4, add = false, parent = nil, &b) new_klass = __create_new_class(klass, func, safe, add, parent) new_klass.class_eval(&b) if block_given? @@ -357,7 +357,7 @@ module TkOptionDB module_function :new_proc_class def eval_under_random_base(parent = nil, &b) - new_klass = __create_new_class(__get_random_basename(), + new_klass = __create_new_class(__get_random_basename(), [], 4, false, parent) ret = new_klass.class_eval(&b) if block_given? __remove_methods_of_proc_class(new_klass) diff --git a/ext/tk/lib/tk/optionobj.rb b/ext/tk/lib/tk/optionobj.rb index 8fe7e0ee5a..29b06da0eb 100644 --- a/ext/tk/lib/tk/optionobj.rb +++ b/ext/tk/lib/tk/optionobj.rb @@ -1,10 +1,10 @@ # # tk/optionobj.rb : control options for a group of widgets # -# NOTE: If you want to use key-only option (no value), -# use Tk::None for the value of the key-only option. +# NOTE: If you want to use key-only option (no value), +# use Tk::None for the value of the key-only option. # -# e.g. hash_kv({'aaa'=>1, 'bbb'=>Tk::None, 'ccc'=>3}) +# e.g. hash_kv({'aaa'=>1, 'bbb'=>Tk::None, 'ccc'=>3}) # => ["-aaa", 1, "-bbb", "-ccc", 3] # require 'tk' @@ -36,7 +36,7 @@ module Tk def _remove_win(win) if win.kind_of?(Array) widget, method = win - @observ.delete_if{|x| + @observ.delete_if{|x| if x.kind_of?(Array) x[0] == widget else @@ -56,15 +56,15 @@ module Tk private :_remove_win def assign(*wins) - # win := + # win := # widget #==> call widget.configure(hash) # [widget] #==> call widget.configure(hash) # [widget, nil, {src=>target, ... }] - # #==> call widget.configure(hash) + # #==> call widget.configure(hash) # with converting hash-key # [widget, method] #==> call widget.method(hash) # [widget, method, {src=>target, ... }] - # #==> call widget.method(hash) + # #==> call widget.method(hash) # with converting hash-key # [widget [receiver, method, arg, ... ]] # #==> call receiver.method(arg, ... , hash) @@ -74,7 +74,7 @@ module Tk # # src := option_name_on_optobj # - # target := + # target := # nil #==> not use the src # option_name_on_target_widget # [ option_name_on_target_widget, ... ] @@ -123,7 +123,7 @@ module Tk next unless key if key.kind_of?(Array) key.each{|k| hash[k] = val} - else + else hash[key] = val end } diff --git a/ext/tk/lib/tk/palette.rb b/ext/tk/lib/tk/palette.rb index 2d08d50f6a..9462bb0667 100644 --- a/ext/tk/lib/tk/palette.rb +++ b/ext/tk/lib/tk/palette.rb @@ -9,8 +9,8 @@ module TkPalette extend Tk TkCommandNames = [ - 'tk_setPalette'.freeze, - 'tk_bisque'.freeze, + 'tk_setPalette'.freeze, + 'tk_bisque'.freeze, 'tkDarken'.freeze ].freeze diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb index 030144e677..04407802ea 100644 --- a/ext/tk/lib/tk/panedwindow.rb +++ b/ext/tk/lib/tk/panedwindow.rb @@ -6,7 +6,7 @@ require 'tk' class Tk::PanedWindow conf } else ret = {} - #tk_split_simplelist(tk_send_without_enc('paneconfigure', + #tk_split_simplelist(tk_send_without_enc('paneconfigure', # win)).each{|conflist| # conf = tk_split_simplelist(conflist) - tk_split_simplelist(tk_send_without_enc('paneconfigure', win), + tk_split_simplelist(tk_send_without_enc('paneconfigure', win), false, false).each{|conflist| conf = tk_split_simplelist(conflist, false, true) key = conf.shift[1..-1] @@ -197,18 +197,18 @@ class Tk::PanedWindow conf[1] } { conf[0][1..-1] => tk_tcl2ruby(conf[4]) } else ret = {} #tk_split_list(tk_call_without_enc('place','configure',win)).each{|conf| - tk_split_simplelist(tk_call_without_enc('place', 'configure', + tk_split_simplelist(tk_call_without_enc('place', 'configure', win)).each{|conf_list| #ret[conf[0][1..-1]] = conf[1] conf = simplelist(conf_list) diff --git a/ext/tk/lib/tk/radiobutton.rb b/ext/tk/lib/tk/radiobutton.rb index 1f864ec06b..627df6d9cf 100644 --- a/ext/tk/lib/tk/radiobutton.rb +++ b/ext/tk/lib/tk/radiobutton.rb @@ -7,7 +7,7 @@ require 'tk/button' class Tk::RadioButtontrue, :widgetname=>'.'){} end root = TkCore::INTERP.tk_windows['.'] @@ -52,7 +52,7 @@ class Tk::Rootvalue) - elsif slot.kind_of?(Hash) && + elsif slot.kind_of?(Hash) && (slot.key?('command') || slot.key?(:command)) slot = _symbolkey2str(slot) slot['command'] = _wrap_command_arg(slot.delete('command')) @@ -108,4 +108,5 @@ class Tk::Scale e + # old version of element? + begin + tk_send_without_enc('invoke', 'spinup') + rescue + fail e + end + end self end def spindown - tk_send_without_enc('invoke', 'spindown') + begin + tk_send_without_enc('invoke', 'buttondown') + rescue RuntimeError => e + # old version of element? + begin + tk_send_without_enc('invoke', 'spinup') + rescue + fail e + end + end self end @@ -116,4 +139,6 @@ class Tk::Spinboxval}) end else - tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag), "-#{key}", _get_eval_enc_str(val)) end end @@ -878,16 +884,16 @@ class Tk::Text 0 if pat.kind_of?(String) #return [index(start + " + #{pos} chars"), pat.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(match), match] end else @@ -1342,11 +1348,11 @@ class Tk::Text 0 if pat.kind_of?(String) #return [index(start + " + #{pos} chars"), pat.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(match), match] end else @@ -1357,7 +1363,7 @@ class Tk::Text 0 if pat.kind_of?(String) #return [index("1.0 + #{pos} chars"), pat.split('').length] - return [index("1.0 + #{pos} chars"), + return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index("1.0 + #{pos} chars"), $&.split('').length] @@ -1447,7 +1453,7 @@ class Tk::Text 0 - tk_call_without_enc(@t.path, 'window', 'configure', @index, + tk_call_without_enc(@t.path, 'window', 'configure', @index, *hash_kv(slot, true)) end else if slot == 'window' || slot == :window - @id = value + @id = value # value = @id.epath if @id.kind_of?(TkWindow) value = _epath(@id) if @id end if slot == 'create' || slot == :create self.create=value else - tk_call_without_enc(@t.path, 'window', 'configure', @index, + tk_call_without_enc(@t.path, 'window', 'configure', @index, "-#{slot}", _get_eval_enc_str(value)) end end @@ -123,7 +123,7 @@ class TkTextWindow e - if @cancel_on_exception && + if @cancel_on_exception && @cancel_on_exception.find{|exc| e.kind_of?(exc)} cancel @return_value = e @@ -180,12 +180,12 @@ class TkTimer @after_script = nil @cancel_on_exception = DEFAULT_IGNORE_EXCEPTIONS - # Unless @cancel_on_exception, Ruby/Tk shows an error dialog box when - # an excepsion is raised on TkTimer callback procedure. - # If @cancel_on_exception is an array of exception classes and the raised - # exception is included in the array, Ruby/Tk cancels executing TkTimer - # callback procedures silently (TkTimer#cancel is called and no dialog is - # shown). + # Unless @cancel_on_exception, Ruby/Tk shows an error dialog box when + # an excepsion is raised on TkTimer callback procedure. + # If @cancel_on_exception is an array of exception classes and the raised + # exception is included in the array, Ruby/Tk cancels executing TkTimer + # callback procedures silently (TkTimer#cancel is called and no dialog is + # shown). if b case args.size @@ -229,7 +229,7 @@ class TkTimer end def current_status - [@running, @current_sleep, @current_proc, @current_args, + [@running, @current_sleep, @current_proc, @current_args, @do_loop, @cancel_on_exception] end @@ -484,11 +484,11 @@ class TkTimer def at_end(*arg, &b) if arg.empty? - if b + if b @at_end_proc = b - else + else # no proc - return @at_end_proc + return @at_end_proc end else fail ArgumentError, "wrong number of arguments" if arg.length != 1 || b @@ -504,17 +504,17 @@ class TkTimer unless @running if @return_value.kind_of?(Exception) - fail @return_value + fail @return_value else - return @return_value + return @return_value end end @wait_var.wait(on_thread, check_root) if @return_value.kind_of?(Exception) - fail @return_value + fail @return_value else - @return_value + @return_value end end def eventloop_wait(check_root = false) @@ -628,12 +628,12 @@ class TkRTTimer < TkTimer if @est_time @est_time = Time.at(@est_time.to_i, @est_time.usec + sleep*1000) else - @est_time = Time.at(@cb_start_time.to_i, + @est_time = Time.at(@cb_start_time.to_i, @cb_start_time.usec + sleep*1000) end now = Time.now - real_sleep = ((@est_time.to_i - now.to_i + @offset_s)*1000.0 + + real_sleep = ((@est_time.to_i - now.to_i + @offset_s)*1000.0 + (@est_time.usec - now.usec + @offset_u)/1000.0).round if real_sleep <= 0 real_sleep = 0 @@ -653,7 +653,7 @@ class TkRTTimer < TkTimer if @current_sleep == 0 @offset_list.push([ - @offset_s - @cb_start_time.to_i, + @offset_s - @cb_start_time.to_i, @offset_u - @cb_start_time.usec ]) else diff --git a/ext/tk/lib/tk/toplevel.rb b/ext/tk/lib/tk/toplevel.rb index bd6e8307f5..30ef009517 100644 --- a/ext/tk/lib/tk/toplevel.rb +++ b/ext/tk/lib/tk/toplevel.rb @@ -11,7 +11,7 @@ class Tk::Toplevel 'tkextlib/tile/tbutton', + :TkButton => 'tkextlib/tile/tbutton', - :TkCheckbutton => 'tkextlib/tile/tcheckbutton', - :TkCheckButton => 'tkextlib/tile/tcheckbutton', + :TkCheckbutton => 'tkextlib/tile/tcheckbutton', + :TkCheckButton => 'tkextlib/tile/tcheckbutton', - # :TkDialog => 'tkextlib/tile/dialog', + # :TkDialog => 'tkextlib/tile/dialog', - :TkEntry => 'tkextlib/tile/tentry', + :TkEntry => 'tkextlib/tile/tentry', - :TkCombobox => 'tkextlib/tile/tcombobox', + :TkCombobox => 'tkextlib/tile/tcombobox', - :TkFrame => 'tkextlib/tile/tframe', + :TkFrame => 'tkextlib/tile/tframe', - :TkLabel => 'tkextlib/tile/tlabel', + :TkLabel => 'tkextlib/tile/tlabel', - :TkLabelframe => 'tkextlib/tile/tlabelframe', - :TkLabelFrame => 'tkextlib/tile/tlabelframe', + :TkLabelframe => 'tkextlib/tile/tlabelframe', + :TkLabelFrame => 'tkextlib/tile/tlabelframe', - :TkMenubutton => 'tkextlib/tile/tmenubutton', - :TkMenuButton => 'tkextlib/tile/tmenubutton', + :TkMenubutton => 'tkextlib/tile/tmenubutton', + :TkMenuButton => 'tkextlib/tile/tmenubutton', - :TkNotebook => 'tkextlib/tile/tnotebook', + :TkNotebook => 'tkextlib/tile/tnotebook', - # :TkPaned => 'tkextlib/tile/tpaned', - :TkPanedwindow => 'tkextlib/tile/tpaned', - :TkPanedWindow => 'tkextlib/tile/tpaned', + # :TkPaned => 'tkextlib/tile/tpaned', + :TkPanedwindow => 'tkextlib/tile/tpaned', + :TkPanedWindow => 'tkextlib/tile/tpaned', - :TkProgressbar => 'tkextlib/tile/tprogressbar', + :TkProgressbar => 'tkextlib/tile/tprogressbar', - :TkRadiobutton => 'tkextlib/tile/tradiobutton', - :TkRadioButton => 'tkextlib/tile/tradiobutton', + :TkRadiobutton => 'tkextlib/tile/tradiobutton', + :TkRadioButton => 'tkextlib/tile/tradiobutton', - :TkScale => 'tkextlib/tile/tscale', - # :TkProgress => 'tkextlib/tile/tscale', + :TkScale => 'tkextlib/tile/tscale', + # :TkProgress => 'tkextlib/tile/tscale', - :TkScrollbar => 'tkextlib/tile/tscrollbar', - :TkXScrollbar => 'tkextlib/tile/tscrollbar', - :TkYScrollbar => 'tkextlib/tile/tscrollbar', + :TkScrollbar => 'tkextlib/tile/tscrollbar', + :TkXScrollbar => 'tkextlib/tile/tscrollbar', + :TkYScrollbar => 'tkextlib/tile/tscrollbar', - :TkSeparator => 'tkextlib/tile/tseparator', + :TkSeparator => 'tkextlib/tile/tseparator', - :TkSizeGrip => 'tkextlib/tile/sizegrip', - :TkSizegrip => 'tkextlib/tile/sizegrip', + :TkSizeGrip => 'tkextlib/tile/sizegrip', + :TkSizegrip => 'tkextlib/tile/sizegrip', - # :TkSquare => 'tkextlib/tile/tsquare', + # :TkSquare => 'tkextlib/tile/tsquare', - :TkTreeview => 'tkextlib/tile/treeview', + :TkTreeview => 'tkextlib/tile/treeview', } - @TOPLEVEL_ALIAS_TABLE[:Tile] = @TOPLEVEL_ALIAS_TABLE[:Ttk] + + # @TOPLEVEL_ALIAS_TABLE[:Tile] = @TOPLEVEL_ALIAS_TABLE[:Ttk] + Tk.__create_widget_set__(:Tile, :Ttk) + + ############################################ + # depend on the version of Tcl/Tk + major, minor, type, patchlevel = TclTkLib.get_version + + # ttk::spinbox is supported on Tcl/Tk8.6b1 or later + if ([major,minor,type,patchlevel] <=> + [8,6,TclTkLib::RELEASE_TYPE::BETA,1]) >= 0 + @TOPLEVEL_ALIAS_TABLE[:Ttk].update( + :TkSpinbox => 'tkextlib/tile/tspinbox' + ) + end ################################################ # register some Ttk widgets as default # (Ttk is a standard library on Tcl/Tk8.5+) @TOPLEVEL_ALIAS_TABLE[:Ttk].each{|sym, file| - unless Object.autoload?(sym) || Object.const_defined?(sym) - Object.autoload(sym, file) - end + #unless Tk::TOPLEVEL_ALIASES.autoload?(sym) || Tk::TOPLEVEL_ALIASES.const_defined?(sym) + # @TOPLEVEL_ALIAS_OWNER[sym] = :Ttk + # Tk::TOPLEVEL_ALIASES.autoload(sym, file) + #end + Tk.__regist_toplevel_aliases__(:Ttk, file, sym) } ################################################ - @TOPLEVEL_ALIAS_SETUP_PROC[:Tile] = - @TOPLEVEL_ALIAS_SETUP_PROC[:Ttk] = proc{|mod| - unless Tk.autoload?(:Tile) || Tk.const_defined?(:Tile) + # @TOPLEVEL_ALIAS_SETUP_PROC[:Tile] = + # @TOPLEVEL_ALIAS_SETUP_PROC[:Ttk] = proc{|mod| + # unless Tk.autoload?(:Tile) || Tk.const_defined?(:Tile) + # Object.autoload :Ttk, 'tkextlib/tile' + # Tk.autoload :Tile, 'tkextlib/tile' + # end + # } + Tk.__toplevel_alias_setup_proc__(:Ttk, :Tile){|mod| + unless Tk.autoload?(:Tile) || Tk.const_defined?(:Tile) Object.autoload :Ttk, 'tkextlib/tile' Tk.autoload :Tile, 'tkextlib/tile' end diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb index 60bd433cdc..0ebd5c51b7 100644 --- a/ext/tk/lib/tk/validation.rb +++ b/ext/tk/lib/tk/validation.rb @@ -211,21 +211,21 @@ class TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?d, ?n, :action ], - [ ?i, ?x, :index ], - [ ?s, ?e, :current ], - [ ?v, ?s, :type ], - [ ?P, ?e, :value ], - [ ?S, ?e, :string ], - [ ?V, ?s, :triggered ], - [ ?W, ?w, :widget ], + [ ?d, ?n, :action ], + [ ?i, ?x, :index ], + [ ?s, ?e, :current ], + [ ?v, ?s, :type ], + [ ?P, ?e, :value ], + [ ?S, ?e, :string ], + [ ?V, ?s, :triggered ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], [ ?e, proc{|val| #enc = Tk.encoding @@ -236,7 +236,7 @@ class TkValidateCommand TkComm::string(val) end } - ], + ], [ ?x, proc{|val| idx = TkComm::number(val) @@ -246,7 +246,7 @@ class TkValidateCommand idx end } - ], + ], nil ] @@ -272,7 +272,7 @@ class TkValidateCommand _setup_subst_table(KEY_TBL, PROC_TBL); # - # NOTE: The order of parameters which passed to callback procedure is + # NOTE: The order of parameters which passed to callback procedure is # , , ... , , , ... # diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb index f738a96ee7..6fc2ffdf2f 100644 --- a/ext/tk/lib/tk/variable.rb +++ b/ext/tk/lib/tk/variable.rb @@ -16,7 +16,7 @@ class TkVariable #TkVar_ID_TBL = {} TkVar_CB_TBL = TkCore::INTERP.create_table TkVar_ID_TBL = TkCore::INTERP.create_table - (Tk_VARIABLE_ID = ["v".freeze, "00000".taint]).instance_eval{ + (Tk_VARIABLE_ID = ["v".freeze, TkUtil.untrust("00000")]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -26,10 +26,10 @@ class TkVariable TkVar_ID_TBL.mutex.synchronize{ TkVar_ID_TBL.clear } } - major, minor, type, type_name, patchlevel = TclTkLib.get_version + major, minor, type, patchlevel = TclTkLib.get_version USE_OLD_TRACE_OPTION_STYLE = (major < 8) || (major == 8 && minor < 4) - #TkCore::INTERP.add_tk_procs('rb_var', 'args', + #TkCore::INTERP.add_tk_procs('rb_var', 'args', # "ruby [format \"TkVariable.callback %%Q!%s!\" $args]") TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL') if {[set st [catch {eval {ruby_cmd TkVariable callback} $args} ret]] != 0} { @@ -65,10 +65,10 @@ class TkVariable exit!(1) rescue Exception => e begin - msg = _toUTF8(e.class.inspect) + ': ' + - _toUTF8(e.message) + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - _toUTF8(e.backtrace.join("\n")) + + msg = _toUTF8(e.class.inspect) + ': ' + + _toUTF8(e.message) + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + _toUTF8(e.backtrace.join("\n")) + "\n---< backtrace of Tk side >-------" if TkCore::WITH_ENCODING msg.force_encoding('utf-8') @@ -76,9 +76,9 @@ class TkVariable msg.instance_variable_set(:@encoding, 'utf-8') end rescue Exception - msg = e.class.inspect + ': ' + e.message + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - e.backtrace.join("\n") + + msg = e.class.inspect + ': ' + e.message + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + e.backtrace.join("\n") + "\n---< backtrace of Tk side >-------" end fail(e, msg) @@ -94,7 +94,7 @@ class TkVariable _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op)) rescue trace = $!.backtrace - raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + + raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + "\tfrom #{trace[1..pos].join("\n\tfrom ")}" end =end @@ -112,7 +112,7 @@ class TkVariable end # - # default_value is available only when the variable is an assoc array. + # default_value is available only when the variable is an assoc array. # def default_value(val=nil, &b) if b @@ -322,7 +322,7 @@ class TkVariable =begin if val == [] - # INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)', + # INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)', # @id, @id, @id)) elsif val.kind_of?(Array) a = [] @@ -370,7 +370,7 @@ class TkVariable else INTERP._thread_vwait(@id) end - else + else if check_root INTERP._invoke_without_enc('tkwait', 'variable', @id) else @@ -421,7 +421,7 @@ class TkVariable else # array index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',') - TkComm.bool(tk_call('info', 'exist', "#{@id}")) && + TkComm.bool(tk_call('info', 'exist', "#{@id}")) && TkComm.bool(tk_call('info', 'exist', "#{@id}(#{index})")) end end @@ -433,7 +433,7 @@ class TkVariable #tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}")) INTERP._invoke_without_enc('global', @id) #tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'names', @id))) - tk_split_simplelist(INTERP._invoke_without_enc('array', 'names', @id), + tk_split_simplelist(INTERP._invoke_without_enc('array', 'names', @id), false, true) end @@ -484,9 +484,9 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS if val.kind_of?(Hash) self.clear val.each{|k, v| - #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)), + #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)), # _toUTF8(_get_eval_string(v))) - INTERP._set_global_var2(@id, _get_eval_string(k, true), + INTERP._set_global_var2(@id, _get_eval_string(k, true), _get_eval_string(v, true)) } self.value @@ -494,11 +494,11 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS =begin INTERP._set_global_var(@id, '') val.each{|v| - #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)), - INTERP._set_variable(@id, _get_eval_string(v, true), - TclTkLib::VarAccessFlag::GLOBAL_ONLY | + #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)), + INTERP._set_variable(@id, _get_eval_string(v, true), + TclTkLib::VarAccessFlag::GLOBAL_ONLY | TclTkLib::VarAccessFlag::LEAVE_ERR_MSG | - TclTkLib::VarAccessFlag::APPEND_VALUE | + TclTkLib::VarAccessFlag::APPEND_VALUE | TclTkLib::VarAccessFlag::LIST_ELEMENT) } self.value @@ -535,9 +535,9 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS val = val._value if !type && type != :variable && val.kind_of?(TkVariable) index = args.collect{|idx| _get_eval_string(idx, true)}.join(',') _fromUTF8(INTERP._set_global_var2(@id, index, _get_eval_string(val, true))) - #_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)), + #_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)), # _toUTF8(_get_eval_string(val)))) - #_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true), + #_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true), # _get_eval_string(val, true))) end @@ -562,7 +562,7 @@ else #INTERP._eval(Kernel.format('set %s', @id)) #INTERP._invoke_without_enc('set', @id) rescue - if INTERP._eval(Kernel.format('global %s; array exists %s', + if INTERP._eval(Kernel.format('global %s; array exists %s', @id, @id)) != "1" #if INTERP._eval(Kernel.format('array exists %s', @id)) != "1" #if INTERP._invoke_without_enc('array', 'exists', @id) != "1" @@ -583,7 +583,7 @@ else #INTERP._eval(Kernel.format('set %s %s', @id, s)) #_fromUTF8(INTERP._invoke_without_enc('set', @id, _toUTF8(s))) rescue - if INTERP._eval(Kernel.format('global %s; array exists %s', + if INTERP._eval(Kernel.format('global %s; array exists %s', @id, @id)) != "1" #if INTERP._eval(Kernel.format('array exists %s', @id)) != "1" #if INTERP._invoke_without_enc('array', 'exists', @id) != "1" @@ -591,7 +591,7 @@ else else if val == [] INTERP._eval(Kernel.format('global %s; unset %s; set %s(0) 0; unset %s(0)', @id, @id, @id, @id)) - #INTERP._eval(Kernel.format('unset %s; set %s(0) 0; unset %s(0)', + #INTERP._eval(Kernel.format('unset %s; set %s(0) 0; unset %s(0)', # @id, @id, @id)) #INTERP._invoke_without_enc('unset', @id) #INTERP._invoke_without_enc('set', @id+'(0)', 0) @@ -601,9 +601,9 @@ else val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e, true))} #s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + a.join(" ").gsub(/[\[\]$"\\]/, '\\\\\&') + '"' - INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s', + INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s', @id, @id, @id, s)) - #INTERP._eval(Kernel.format('unset %s; array set %s %s', + #INTERP._eval(Kernel.format('unset %s; array set %s %s', # @id, @id, s)) #INTERP._invoke_without_enc('unset', @id) #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s))) @@ -612,9 +612,9 @@ else # .gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + val.to_a.collect{|e| array2tk_list(e, true)}.join(" ")\ .gsub(/[\[\]$\\"]/, '\\\\\&') + '"' - INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s', + INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s', @id, @id, @id, s)) - #INTERP._eval(Kernel.format('unset %s; array set %s %s', + #INTERP._eval(Kernel.format('unset %s; array set %s %s', # @id, @id, s)) #INTERP._invoke_without_enc('unset', @id) #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s))) @@ -640,7 +640,7 @@ else end end #INTERP._eval(Kernel.format('global %s; set %s(%s)', @id, @id, index)) - #INTERP._eval(Kernel.format('global %s; set %s(%s)', + #INTERP._eval(Kernel.format('global %s; set %s(%s)', # @id, @id, _get_eval_string(index))) #INTERP._eval(Kernel.format('set %s(%s)', @id, _get_eval_string(index))) #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ')') @@ -651,13 +651,13 @@ else type = default_element_value_type(args) val = val._value if !type && type != :variable && val.kind_of?(TkVariable) index = args.collect{|idx| _get_eval_string(idx)}.join(',') - INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, + INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, index, _get_eval_string(val))) - #INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, + #INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, # _get_eval_string(index), _get_eval_string(val))) - #INTERP._eval(Kernel.format('set %s(%s) %s', @id, + #INTERP._eval(Kernel.format('set %s(%s) %s', @id, # _get_eval_string(index), _get_eval_string(val))) - #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ') ' + + #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ') ' + # _get_eval_string(val)) end @@ -669,7 +669,7 @@ else else index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',') INTERP._eval(Kernel.format('global %s; unset %s(%s)', @id, @id, index)) - #INTERP._eval(Kernel.format('global %s; unset %s(%s)', + #INTERP._eval(Kernel.format('global %s; unset %s(%s)', # @id, @id, _get_eval_string(elem))) #INTERP._eval(Kernel.format('unset %s(%s)', @id, tk_tcl2ruby(elem))) #INTERP._eval('unset ' + @id + '(' + _get_eval_string(elem) + ')') @@ -1239,6 +1239,14 @@ end end end + def ===(other) + if other.kind_of?(TkVariable) + self.id == other.id + else + super + end + end + def zero? numeric.zero? end @@ -1348,10 +1356,10 @@ end TkVar_CB_TBL[@id] = self @trace_opts = opts if USE_OLD_TRACE_OPTION_STYLE - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) else - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else @@ -1359,19 +1367,19 @@ end if USE_OLD_TRACE_OPTION_STYLE opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} if newopts != @trace_opts - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else newopts |= opts unless (newopts - @trace_opts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1382,7 +1390,7 @@ end def trace_element(elem, opts, cmd = Proc.new) if @elem - fail(RuntimeError, + fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end @@ -1394,10 +1402,10 @@ end TkVar_CB_TBL[@id] = self @trace_opts = opts if USE_OLD_TRACE_OPTION_STYLE - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) else - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else @@ -1405,19 +1413,19 @@ end if USE_OLD_TRACE_OPTION_STYLE opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} if newopts != @trace_opts - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else newopts |= opts unless (newopts - @trace_opts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1434,7 +1442,7 @@ end def trace_info_for_element(elem) if @elem - fail(RuntimeError, + fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end return [] unless @trace_elem @@ -1468,7 +1476,7 @@ end else newopts = [] @trace_var.each_with_index{|e, i| - if idx < 0 && e[1] == cmd && + if idx < 0 && e[1] == cmd && e[0].size == opts.size && (e[0] - opts).empty? # find idx = i @@ -1479,7 +1487,7 @@ end end if idx >= 0 - @trace_var.delete_at(idx) + @trace_var.delete_at(idx) else return self end @@ -1498,21 +1506,21 @@ end diff = false @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))} if diff - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end else unless (@trace_opts - newopts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1525,7 +1533,7 @@ end def trace_remove_for_element(elem,opts,cmd) if @elem - fail(RuntimeError, + fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end return self unless @trace_elem.kind_of? Hash @@ -1550,7 +1558,7 @@ end } else @trace_elem[elem].each_with_index{|e, i| - if idx < 0 && e[1] == cmd && + if idx < 0 && e[1] == cmd && e[0].size == opts.size && (e[0] - opts).empty? # find idx = i @@ -1567,7 +1575,7 @@ end if USE_OLD_TRACE_OPTION_STYLE newopts = '' - @trace_var.each{|e| + @trace_var.each{|e| e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} } @trace_elem.each{|elem| @@ -1591,21 +1599,21 @@ end diff = false @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))} if diff - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end else unless (@trace_opts - newopts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1621,7 +1629,7 @@ class TkVarAccess", - *(seq_ary.collect{|seq| + tk_call_without_enc('event', 'add', "<#{@id}>", + *(seq_ary.collect{|seq| "<#{tk_event_sequence(seq)}>" }) ) end @@ -106,8 +106,8 @@ class TkVirtualEvent", - *(sequences.collect{|seq| + tk_call_without_enc('event', 'delete', "<#{@id}>", + *(sequences.collect{|seq| "<#{tk_event_sequence(seq)}>" }) ) if tk_call_without_enc('event','info',"<#{@id}>").empty? diff --git a/ext/tk/lib/tk/winfo.rb b/ext/tk/lib/tk/winfo.rb index c649b4a0c9..b10cfe6760 100644 --- a/ext/tk/lib/tk/winfo.rb +++ b/ext/tk/lib/tk/winfo.rb @@ -14,7 +14,7 @@ module TkWinfo def TkWinfo.atom(name, win=nil) if win - number(tk_call_without_enc('winfo', 'atom', '-displayof', win, + number(tk_call_without_enc('winfo', 'atom', '-displayof', win, _get_eval_enc_str(name))) else number(tk_call_without_enc('winfo', 'atom', _get_eval_enc_str(name))) @@ -26,7 +26,7 @@ module TkWinfo def TkWinfo.atomname(id, win=nil) if win - _fromUTF8(tk_call_without_enc('winfo', 'atomname', + _fromUTF8(tk_call_without_enc('winfo', 'atomname', '-displayof', win, id)) else _fromUTF8(tk_call_without_enc('winfo', 'atomname', id)) @@ -67,7 +67,7 @@ module TkWinfo def TkWinfo.containing(rootX, rootY, win=nil) if win - window(tk_call_without_enc('winfo', 'containing', + window(tk_call_without_enc('winfo', 'containing', '-displayof', win, rootX, rootY)) else window(tk_call_without_enc('winfo', 'containing', rootX, rootY)) @@ -128,7 +128,7 @@ module TkWinfo false, true) else #tk_split_simplelist(tk_call_without_enc('winfo', 'interps')) - tk_split_simplelist(tk_call_without_enc('winfo', 'interps'), + tk_split_simplelist(tk_call_without_enc('winfo', 'interps'), false, true) end end @@ -303,7 +303,7 @@ module TkWinfo def TkWinfo.visualsavailable(win, includeids=false) if includeids - list(tk_call_without_enc('winfo', 'visualsavailable', + list(tk_call_without_enc('winfo', 'visualsavailable', win, "includeids")) else list(tk_call_without_enc('winfo', 'visualsavailable', win)) diff --git a/ext/tk/lib/tk/winpkg.rb b/ext/tk/lib/tk/winpkg.rb index 89fb391c77..80e0439ace 100644 --- a/ext/tk/lib/tk/winpkg.rb +++ b/ext/tk/lib/tk/winpkg.rb @@ -10,7 +10,8 @@ require 'tk' module Tk::WinDDE end #TkWinDDE = Tk::WinDDE -Tk.__set_toplevel_aliases__(:Tk, Tk::WinDDE, :TkWinDDE) +#Tk.__set_toplevel_aliases__(:Tk, Tk::WinDDE, :TkWinDDE) +Tk.__set_loaded_toplevel_aliases__('tk/winpkg.rb', :Tk, Tk::WinDDE, :TkWinDDE) module Tk::WinDDE extend Tk @@ -45,7 +46,7 @@ module Tk::WinDDE elsif args.size == 0 tk_call('dde', 'servername', force, exact, *hash_kv(keys)) else - tk_call('dde', 'servername', force, exact, + tk_call('dde', 'servername', force, exact, *((hash_kv(keys) << '--') + args)) end else @@ -86,14 +87,16 @@ module Tk::WinDDE tk_call('dde', 'eval', -async, topic, cmd, *args) end - module_function :servername, :execute, :async_execute, + module_function :servername, :execute, :async_execute, :poke, :request, :services, :eval end module Tk::WinRegistry end #TkWinRegistry = Tk::WinRegistry -Tk.__set_toplevel_aliases__(:Tk, Tk::WinRegistry, :TkWinRegistry) +#Tk.__set_toplevel_aliases__(:Tk, Tk::WinRegistry, :TkWinRegistry) +Tk.__set_loaded_toplevel_aliases__('tk/winpkg.rb', :Tk, Tk::WinRegistry, + :TkWinRegistry) module Tk::WinRegistry extend Tk diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb index 0394296189..b1a2ed886a 100644 --- a/ext/tk/lib/tk/wm.rb +++ b/ext/tk/lib/tk/wm.rb @@ -123,7 +123,7 @@ module Tk TOPLEVEL_METHODCALL_OPTKEYS['focusmodel'] = 'focusmodel' def Wm.forget(win) - # Tcl/Tk 8.5+ + # Tcl/Tk 8.5+ # work with dockable frames tk_call_without_enc('wm', 'forget', win.epath) win @@ -200,7 +200,7 @@ module Tk if imgs.empty? win.instance_eval{ @wm_iconphoto = nil unless defined? @wm_iconphoto - return @wm_iconphoto + return @wm_iconphoto } end @@ -308,10 +308,10 @@ module Tk def Wm.manage(win, use_id = nil) # Tcl/Tk 8.5+ feature # -------------------------------------------------------------- - # In the future release, I want to support to embed the 'win' + # In the future release, I want to support to embed the 'win' # into the container which has window-id 'use-id'. - # It may give users frexibility on controlling their GUI. - # However, it may be difficult for current Tcl/Tk (Tcl/Tk8.5.1), + # It may give users frexibility on controlling their GUI. + # However, it may be difficult for current Tcl/Tk (Tcl/Tk8.5.1), # because it seems to require to modify Tcl/Tk's source code. # -------------------------------------------------------------- if use_id diff --git a/ext/tk/lib/tk/xim.rb b/ext/tk/lib/tk/xim.rb index 0ac8559bb9..c0126c5175 100644 --- a/ext/tk/lib/tk/xim.rb +++ b/ext/tk/lib/tk/xim.rb @@ -12,14 +12,14 @@ module TkXIM def TkXIM.useinputmethods(value = None, win = nil) if value == None if win - bool(tk_call_without_enc('tk', 'useinputmethods', + bool(tk_call_without_enc('tk', 'useinputmethods', '-displayof', win)) else bool(tk_call_without_enc('tk', 'useinputmethods')) end else if win - bool(tk_call_without_enc('tk', 'useinputmethods', + bool(tk_call_without_enc('tk', 'useinputmethods', '-displayof', win, value)) else bool(tk_call_without_enc('tk', 'useinputmethods', value)) diff --git a/ext/tk/lib/tkextlib/ICONS/icons.rb b/ext/tk/lib/tkextlib/ICONS/icons.rb index b430bae55d..bd3180aa55 100644 --- a/ext/tk/lib/tkextlib/ICONS/icons.rb +++ b/ext/tk/lib/tkextlib/ICONS/icons.rb @@ -34,10 +34,10 @@ module Tk def self.create(*args) # icon, icon, ..., ?option=>value, ...? if args[-1].kind_of?(Hash) keys = args.pop - icons = simplelist(tk_call('::icons::icons', 'create', + icons = simplelist(tk_call('::icons::icons', 'create', *(hash_kv(keys) << (args.flatten)))) else - icons = simplelist(tk_call('::icons::icons', 'create', + icons = simplelist(tk_call('::icons::icons', 'create', args.flatten)) end @@ -66,7 +66,7 @@ module Tk def self.query(*args) # icon, icon, ..., ?option=>value, ...? if args[-1].kind_of?(Hash) keys = args.pop - simplelist(tk_call('::icons::icons', 'query', + simplelist(tk_call('::icons::icons', 'query', *(hash_kv(keys) << (args.flatten)))) else simplelist(tk_call('::icons::icons', 'query', args.flatten)) @@ -121,7 +121,7 @@ module Tk end def query(keys={}) - list(simplelist(tk_call('::icons::icons', 'query', + list(simplelist(tk_call('::icons::icons', 'query', *(hash_kv(keys) << @name)) )[0]) end diff --git a/ext/tk/lib/tkextlib/ICONS/setup.rb b/ext/tk/lib/tkextlib/ICONS/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/ICONS/setup.rb +++ b/ext/tk/lib/tkextlib/ICONS/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS index cfbe274c86..6b31ababb3 100644 --- a/ext/tk/lib/tkextlib/SUPPORT_STATUS +++ b/ext/tk/lib/tkextlib/SUPPORT_STATUS @@ -55,18 +55,20 @@ script may give you some hints about that. ===< support with some examples (may be beta quality) >======================= -Tcllib 1.8 -Tklib 0.4.1 http://sourceforge.net/projects/tcllib ==> tcllib +Tcllib 1.11.1 +Tklib 0.5 http://sourceforge.net/projects/tcllib ==> tcllib + ( partial support; primary support target is Tklib) IWidgets 4.0.2 http://sourceforge.net/projects/incrtcl ==> iwidgets -BWidgets 1.7 http://sourceforge.net/projects/tcllib ==> bwidget +BWidget 1.8 [ CVS/Hd(2009-07-02) ] + http://sourceforge.net/projects/tcllib ==> bwidget -TkTable 2.9 http://sourceforge.net/projects/tktable ==> tktable +TkTable 2.10 http://sourceforge.net/projects/tktable ==> tktable * see also written by Ferenc Engard (ferenc@engard.hu) -vu 2.3.0 http://sourceforge.net/projects/tktable ==> vu +Vu widgets 2.3.0 http://sourceforge.net/projects/tktable ==> vu TkHTML 2.0 http://www.hwaci.com/sw/tkhtml/ ==> tkHTML @@ -80,25 +82,25 @@ BLT 2.4z http://sourceforge.net/projects/blt (http://raa.ruby-lang.org/) ==> blt -TkTreeCtrl CVS/Hd(2005-12-02) - http://sourceforge.net/projects/tktreectrl ==> treectrl +TkTreeCtrl 2.2.9 + http://tktreectrl.sourceforge.net/ ==> treectrl -Tile 0.8.0/8.5.1 +Tile 0.8.3/8.6b1 http://sourceforge.net/projects/tktable ==> tile ===< support (may be alpha or beta quality) >================================= -IncrTcl CVS/Hd(2005-02-14) +IncrTcl CVS/Hd(2008-12-15) http://sourceforge.net/projects/incrtcl ==> itcl, itk -TclX CVS/Hd(2005-02-07) +TclX CVS/Hd(2008-12-15) http://sourceforge.net/projects/tclx ==> tclx (partial support; infox command and XPG/3 message catalogs only) -Trofs 0.4.3 http://math.nist.gov/~DPorter/tcltk/trofs/ +Trofs 0.4.4 http://math.nist.gov/~DPorter/tcltk/trofs/ diff --git a/ext/tk/lib/tkextlib/blt.rb b/ext/tk/lib/tkextlib/blt.rb index 8d58c1f1bc..8b132e41a7 100644 --- a/ext/tk/lib/tkextlib/blt.rb +++ b/ext/tk/lib/tkextlib/blt.rb @@ -19,6 +19,8 @@ TkPackage.require('BLT') module Tk module BLT TkComm::TkExtlibAutoloadModule.unshift(self) + # Require autoload-symbols which is a same name as widget classname. + # Those are used at TkComm._genobj_for_tkwidget method. extend TkCore diff --git a/ext/tk/lib/tkextlib/blt/barchart.rb b/ext/tk/lib/tkextlib/blt/barchart.rb index cb481c5889..a86b91c959 100644 --- a/ext/tk/lib/tkextlib/blt/barchart.rb +++ b/ext/tk/lib/tkextlib/blt/barchart.rb @@ -11,7 +11,7 @@ module Tk::BLT class Barchart < TkWindow TkCommandNames = ['::blt::barchart'.freeze].freeze WidgetClassName = 'Barchart'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self include PlotComponent include GraphCommand @@ -22,7 +22,7 @@ module Tk::BLT private :__boolval_optkeys def __strval_optkeys - ['text', 'label', 'title', 'file', + ['text', 'label', 'title', 'file', 'background', 'plotbackground'] end private :__strval_optkeys @@ -33,7 +33,7 @@ module Tk::BLT private :__tkvariable_optkeys =begin - BarElement_ID = ['blt_barchart_bar'.freeze, '00000'.taint].freeze + BarElement_ID = ['blt_barchart_bar'.freeze, TkUtil.untrust('00000')].freeze def bar(elem=nil, keys={}) if elem.kind_of?(Hash) diff --git a/ext/tk/lib/tkextlib/blt/bitmap.rb b/ext/tk/lib/tkextlib/blt/bitmap.rb index 23c6d2d064..3254b63116 100644 --- a/ext/tk/lib/tkextlib/blt/bitmap.rb +++ b/ext/tk/lib/tkextlib/blt/bitmap.rb @@ -14,7 +14,7 @@ module Tk::BLT BITMAP_ID_TBL = TkCore::INTERP.create_table - (BITMAP_ID = ['blt_bitmap_id'.freeze, '00000'.taint]).instance_eval{ + (BITMAP_ID = ['blt_bitmap_id'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze diff --git a/ext/tk/lib/tkextlib/blt/busy.rb b/ext/tk/lib/tkextlib/blt/busy.rb index 2f807fcd9c..b5287fb5b7 100644 --- a/ext/tk/lib/tkextlib/blt/busy.rb +++ b/ext/tk/lib/tkextlib/blt/busy.rb @@ -44,6 +44,7 @@ class << Tk::BLT::Busy private :__item_config_cmd undef itemcget + undef itemcget_tkstring alias configure itemconfigure alias configinfo itemconfiginfo alias current_configinfo current_itemconfiginfo diff --git a/ext/tk/lib/tkextlib/blt/component.rb b/ext/tk/lib/tkextlib/blt/component.rb index b2005b2f2b..20db035fdd 100644 --- a/ext/tk/lib/tkextlib/blt/component.rb +++ b/ext/tk/lib/tkextlib/blt/component.rb @@ -22,15 +22,15 @@ module Tk::BLT private :__item_numstrval_optkeys def __item_boolval_optkeys(id) - ['hide', 'under', 'descending', 'logscale', 'loose', 'showticks', - 'titlealternate', 'scalesymbols', 'minor', 'raised', + ['hide', 'under', 'descending', 'logscale', 'loose', 'showticks', + 'titlealternate', 'scalesymbols', 'minor', 'raised', 'center', 'decoration', 'landscape', 'maxpect'] end private :__item_boolval_optkeys def __item_strval_optkeys(id) - ['text', 'label', 'limits', 'title', - 'show', 'file', 'maskdata', 'maskfile', + ['text', 'label', 'limits', 'title', + 'show', 'file', 'maskdata', 'maskfile', 'color', 'titlecolor', 'fill', 'outline', 'offdash'] end private :__item_strval_optkeys @@ -82,6 +82,9 @@ module Tk::BLT end private :__item_pathname + def axis_cget_tkstring(id, option) + ret = itemcget_tkstring(['axis', tagid(id)], option) + end def axis_cget(id, option) ret = itemcget(['axis', tagid(id)], option) end @@ -94,7 +97,7 @@ module Tk::BLT value = None slot = _symbolkey2str(slot) if cmd = slot.delete('command') - slot['command'] = proc{|w, tick| + slot['command'] = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -103,7 +106,7 @@ module Tk::BLT slot = args.pop if slot == :command || slot == 'command' cmd = value - value = proc{|w, tick| + value = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -118,6 +121,9 @@ module Tk::BLT current_itemconfiginfo(['axis', tagid(id)], slot) end + def crosshairs_cget_tkstring(option) + itemcget_tkstring('crosshairs', option) + end def crosshairs_cget(option) itemcget('crosshairs', option) end @@ -134,6 +140,9 @@ module Tk::BLT current_itemconfiginfo('crosshairs', slot) end + def element_cget_tkstring(id, option) + itemcget_tkstring(['element', tagid(id)], option) + end def element_cget(id, option) itemcget(['element', tagid(id)], option) end @@ -158,6 +167,9 @@ module Tk::BLT current_itemconfiginfo(['element', tagid(id)], slot) end + def bar_cget_tkstring(id, option) + itemcget_tkstring(['bar', tagid(id)], option) + end def bar_cget(id, option) itemcget(['bar', tagid(id)], option) end @@ -182,6 +194,9 @@ module Tk::BLT current_itemconfiginfo(['bar', tagid(id)], slot) end + def line_cget_tkstring(id, option) + itemcget_tkstring(['line', tagid(id)], option) + end def line_cget(id, option) itemcget(['line', tagid(id)], option) end @@ -206,6 +221,9 @@ module Tk::BLT current_itemconfiginfo(['line', tagid(id)], slot) end + def gridline_cget_tkstring(option) + itemcget_tkstring('grid', option) + end def gridline_cget(option) itemcget('grid', option) end @@ -222,6 +240,9 @@ module Tk::BLT current_itemconfiginfo('grid', slot) end + def legend_cget_tkstring(option) + itemcget_tkstring('legend', option) + end def legend_cget(option) itemcget('legend', option) end @@ -238,6 +259,9 @@ module Tk::BLT current_itemconfiginfo('legend', slot) end + def pen_cget_tkstring(id, option) + itemcget_tkstring(['pen', tagid(id)], option) + end def pen_cget(id, option) itemcget(['pen', tagid(id)], option) end @@ -262,6 +286,9 @@ module Tk::BLT current_itemconfiginfo(['pen', tagid(id)], slot) end + def postscript_cget_tkstring(option) + itemcget_tkstring('postscript', option) + end def postscript_cget(option) itemcget('postscript', option) end @@ -278,6 +305,9 @@ module Tk::BLT current_itemconfiginfo('postscript', slot) end + def marker_cget_tkstring(id, option) + itemcget_tkstring(['marker', tagid(id)], option) + end def marker_cget(id, option) itemcget(['marker', tagid(id)], option) end @@ -302,12 +332,16 @@ module Tk::BLT current_itemconfiginfo(['marker', tagid(id)], slot) end + alias __itemcget_tkstring itemcget_tkstring alias __itemcget itemcget alias __itemcget_strict itemcget_strict alias __itemconfiginfo itemconfiginfo alias __current_itemconfiginfo current_itemconfiginfo - private :__itemcget, :__itemconfiginfo, :__current_itemconfiginfo + private :__itemcget_tkstring, :__itemcget, :__itemconfiginfo, :__current_itemconfiginfo + def itemcget_tkstring(tagOrId, option) + __itemcget_tkstring(tagid(tagOrId), option) + end def itemcget_strict(tagOrId, option) ret = __itemcget(tagid(tagOrId), option) if option == 'bindtags' || option == :bindtags @@ -373,13 +407,13 @@ module Tk::BLT ret end - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo ################# class Axis < TkObject - (OBJ_ID = ['blt_chart_axis'.freeze, '00000'.taint]).instance_eval{ + (OBJ_ID = ['blt_chart_axis'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -477,6 +511,9 @@ module Tk::BLT @id end + def cget_tkstring(option) + @chart.axis_cget_tkstring(@id, option) + end def cget(option) @chart.axis_cget(@id, option) end @@ -520,7 +557,7 @@ module Tk::BLT def name @axis end - + def transform(val) @chart.axis_transform(@id, val) end @@ -582,6 +619,9 @@ module Tk::BLT @id end + def cget_tkstring(option) + @chart.crosshair_cget_tkstring(option) + end def cget(option) @chart.crosshair_cget(option) end @@ -631,7 +671,7 @@ module Tk::BLT ElementID_TBL.mutex.synchronize{ ElementID_TBL.clear } } - (OBJ_ID = ['blt_chart_element'.freeze, '00000'.taint]).instance_eval{ + (OBJ_ID = ['blt_chart_element'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -729,6 +769,10 @@ module Tk::BLT @id end + def cget_tkstring(option) + # @chart.element_cget(@id, option) + @chart.__send__(@typename + '_cget_tkstring', @id, option) + end def cget(option) # @chart.element_cget(@id, option) @chart.__send__(@typename + '_cget', @id, option) @@ -833,6 +877,9 @@ module Tk::BLT @id end + def cget_tkstring(option) + @chart.gridline_cget_tkstring(option) + end def cget(option) @chart.gridline_cget(option) end @@ -907,6 +954,9 @@ module Tk::BLT @id end + def cget_tkstring(option) + @chart.legend_cget_tkstring(option) + end def cget(option) @chart.legend_cget(option) end @@ -940,7 +990,7 @@ module Tk::BLT ################# class Pen < TkObject - (OBJ_ID = ['blt_chart_pen'.freeze, '00000'.taint]).instance_eval{ + (OBJ_ID = ['blt_chart_pen'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -1036,6 +1086,9 @@ module Tk::BLT @id end + def cget_tkstring(option) + @chart.pen_cget_tkstring(@id, option) + end def cget(option) @chart.pen_cget(@id, option) end @@ -1106,6 +1159,9 @@ module Tk::BLT @id end + def cget_tkstring(option) + @chart.postscript_cget_tkstring(option) + end def cget(option) @chart.postscript_cget(option) end @@ -1221,7 +1277,7 @@ module Tk::BLT fail RuntimeError, "#{self} is an abstract class" end args, fontkeys = _parse_create_args(keys) - idnum = tk_call_without_enc(chart.path, 'marker', 'create', + idnum = tk_call_without_enc(chart.path, 'marker', 'create', self::MarkerTypeName, *args) chart.marker_configure(idnum, fontkeys) unless fontkeys.empty? idnum.to_i # 'item id' is an integer number @@ -1229,7 +1285,7 @@ module Tk::BLT def self.create_type(chart, type, keys={}) args, fontkeys = _parse_create_args(keys) - idnum = tk_call_without_enc(chart.path, 'marker', 'create', + idnum = tk_call_without_enc(chart.path, 'marker', 'create', type, *args) chart.marker_configure(idnum, fontkeys) unless fontkeys.empty? id = idnum.to_i # 'item id' is an integer number @@ -1269,6 +1325,9 @@ module Tk::BLT @id end + def cget_tkstring(option) + @chart.marker_cget_tkstring(@id, option) + end def cget(option) @chart.marker_cget(@id, option) end @@ -1486,7 +1545,7 @@ module Tk::BLT list(tk_send('axis', 'limits', tagid(id))) end def axis_names(*pats) - simplelist(tk_send('axis', 'names', + simplelist(tk_send('axis', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|axis| Tk::BLT::PlotComponent::Axis.id2obj(self, axis) } @@ -1500,11 +1559,11 @@ module Tk::BLT end def axis_use(id, target=nil) if target - Tk::BLT::PlotComponent::Axis.id2obj(self, - tk_send('axis', 'use', + Tk::BLT::PlotComponent::Axis.id2obj(self, + tk_send('axis', 'use', tagid(id), tagid(target))) else - Tk::BLT::PlotComponent::Axis.id2obj(self, + Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('axis', 'use', tagid(id))) end end @@ -1544,10 +1603,10 @@ module Tk::BLT def element_closest(x, y, var, *args) if args[-1].kind_of?(Hash) keys = args.pop - bool(tk_send('element', 'closest', x, y, var, + bool(tk_send('element', 'closest', x, y, var, *(hash_kv(keys).concat(args.collect{|id| tagid(id)})))) else - bool(tk_send('element', 'closest', x, y, var, + bool(tk_send('element', 'closest', x, y, var, *(args.collect{|id| tagid(id)}))) end end @@ -1563,7 +1622,7 @@ module Tk::BLT bool(tk_send('element', 'exists', tagid(id))) end def element_names(*pats) - simplelist(tk_send('element', 'names', + simplelist(tk_send('element', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|elem| Tk::BLT::PlotComponent::Element.id2obj(self, elem) } @@ -1601,10 +1660,10 @@ module Tk::BLT def bar_closest(x, y, var, *args) if args[-1].kind_of?(Hash) keys = args.pop - bool(tk_send('bar', 'closest', x, y, var, + bool(tk_send('bar', 'closest', x, y, var, *(hash_kv(keys).concat(args.collect{|id| tagid(id)})))) else - bool(tk_send('bar', 'closest', x, y, var, + bool(tk_send('bar', 'closest', x, y, var, *(args.collect{|id| tagid(id)}))) end end @@ -1620,7 +1679,7 @@ module Tk::BLT bool(tk_send('bar', 'exists', tagid(id))) end def bar_names(*pats) - simplelist(tk_send('bar', 'names', + simplelist(tk_send('bar', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|elem| Tk::BLT::PlotComponent::Element.id2obj(self, elem) } @@ -1658,10 +1717,10 @@ module Tk::BLT def line_closest(x, y, var, *args) if args[-1].kind_of?(Hash) keys = args.pop - bool(tk_send('line', 'closest', x, y, var, + bool(tk_send('line', 'closest', x, y, var, *(hash_kv(keys).concat(args.collect{|id| tagid(id)})))) else - bool(tk_send('line', 'closest', x, y, var, + bool(tk_send('line', 'closest', x, y, var, *(args.collect{|id| tagid(id)}))) end end @@ -1677,7 +1736,7 @@ module Tk::BLT bool(tk_send('line', 'exists', tagid(id))) end def line_names(*pats) - simplelist(tk_send('line', 'names', + simplelist(tk_send('line', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|elem| Tk::BLT::PlotComponent::Element.id2obj(self, elem) } @@ -1723,7 +1782,7 @@ module Tk::BLT keys.delete('without_creating') end - legend = self.class.new(parent, :without_creating=>true, + legend = self.class.new(parent, :without_creating=>true, :widgetname=>widgetname) class << legend def __destroy_hook__ @@ -1740,24 +1799,24 @@ module Tk::BLT end def legend_activate(*pats) - list(tk_send('legend', 'activate', + list(tk_send('legend', 'activate', *(pats.collect{|pat| tagid(pat)}))).collect{|elem| Tk::BLT::PlotComponent::Element.id2obj(self, elem) } end def legend_deactivate(*pats) - list(tk_send('legend', 'deactivate', + list(tk_send('legend', 'deactivate', *(pats.collect{|pat| tagid(pat)}))).collect{|elem| Tk::BLT::PlotComponent::Element.id2obj(self, elem) } end def legend_get(pos, y=nil) if y - Tk::BLT::PlotComponent::Element.id2obj(self, - tk_send('legend', 'get', + Tk::BLT::PlotComponent::Element.id2obj(self, + tk_send('legend', 'get', _at(pos, y))) else - Tk::BLT::PlotComponent::Element.id2obj(self, + Tk::BLT::PlotComponent::Element.id2obj(self, tk_send('legend', 'get', pos)) end end @@ -1773,7 +1832,7 @@ module Tk::BLT self end def pen_names(*pats) - simplelist(tk_send('pen', 'names', + simplelist(tk_send('pen', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|pen| Tk::BLT::PlotComponent::Pen.id2obj(self, pen) } @@ -1843,7 +1902,7 @@ module Tk::BLT bool(tk_send('marker', 'exists', tagid(id))) end def marker_names(*pats) - simplelist(tk_send('marker', 'names', + simplelist(tk_send('marker', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|id| Tk::BLT::PlotComponent::Marker.id2obj(self, id) } @@ -1854,6 +1913,9 @@ module Tk::BLT ################### + def xaxis_cget_tkstring(option) + itemcget_tkstring('xaxis', option) + end def xaxis_cget(option) itemcget('xaxis', option) end @@ -1864,13 +1926,13 @@ module Tk::BLT if slot.kind_of?(Hash) slot = _symbolkey2str(slot) if cmd = slot.delete('command') - slot['command'] = proc{|w, tick| + slot['command'] = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end elsif slot == :command || slot == 'command' cmd = value - value = proc{|w, tick| + value = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -1918,14 +1980,17 @@ module Tk::BLT end def xaxis_use(target=nil) if target - Tk::BLT::PlotComponent::Axis.id2obj(self, - tk_send('xaxis', 'use', + Tk::BLT::PlotComponent::Axis.id2obj(self, + tk_send('xaxis', 'use', tagid(target))) else Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('xaxis', 'use')) end end + def x2axis_cget_tkstring(option) + itemcget_tkstring('x2axis', option) + end def x2axis_cget(option) itemcget('x2axis', option) end @@ -1936,13 +2001,13 @@ module Tk::BLT if slot.kind_of?(Hash) slot = _symbolkey2str(slot) if cmd = slot.delete('command') - slot['command'] = proc{|w, tick| + slot['command'] = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end elsif slot == :command || slot == 'command' cmd = value - value = proc{|w, tick| + value = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -1990,14 +2055,17 @@ module Tk::BLT end def x2axis_use(target=nil) if target - Tk::BLT::PlotComponent::Axis.id2obj(self, - tk_send('x2axis', 'use', + Tk::BLT::PlotComponent::Axis.id2obj(self, + tk_send('x2axis', 'use', tagid(target))) else Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('x2axis', 'use')) end end + def yaxis_cget_tkstring(option) + itemcget_tkstring('yaxis', option) + end def yaxis_cget(option) itemcget('yaxis', option) end @@ -2008,13 +2076,13 @@ module Tk::BLT if slot.kind_of?(Hash) slot = _symbolkey2str(slot) if cmd = slot.delete('command') - slot['command'] = proc{|w, tick| + slot['command'] = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end elsif slot == :command || slot == 'command' cmd = value - value = proc{|w, tick| + value = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -2062,14 +2130,17 @@ module Tk::BLT end def yaxis_use(target=nil) if target - Tk::BLT::PlotComponent::Axis.id2obj(self, - tk_send('yaxis', 'use', + Tk::BLT::PlotComponent::Axis.id2obj(self, + tk_send('yaxis', 'use', tagid(target))) else Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('yaxis', 'use')) end end + def y2axis_cget_tkstring(option) + itemcget_tkstring('y2axis', option) + end def y2axis_cget(option) itemcget('y2axis', option) end @@ -2080,13 +2151,13 @@ module Tk::BLT if slot.kind_of?(Hash) slot = _symbolkey2str(slot) if cmd = slot.delete('command') - slot['command'] = proc{|w, tick| + slot['command'] = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end elsif slot == :command || slot == 'command' cmd = value - value = proc{|w, tick| + value = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -2134,8 +2205,8 @@ module Tk::BLT end def y2axis_use(target=nil) if target - Tk::BLT::PlotComponent::Axis.id2obj(self, - tk_send('y2axis', 'use', + Tk::BLT::PlotComponent::Axis.id2obj(self, + tk_send('y2axis', 'use', tagid(target))) else Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('y2axis', 'use')) diff --git a/ext/tk/lib/tkextlib/blt/container.rb b/ext/tk/lib/tkextlib/blt/container.rb index cdbec21f25..be05828d95 100644 --- a/ext/tk/lib/tkextlib/blt/container.rb +++ b/ext/tk/lib/tkextlib/blt/container.rb @@ -10,7 +10,7 @@ module Tk::BLT class Container < TkWindow TkCommandNames = ['::blt::container'.freeze].freeze WidgetClassName = 'Container'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'name' diff --git a/ext/tk/lib/tkextlib/blt/dragdrop.rb b/ext/tk/lib/tkextlib/blt/dragdrop.rb index 201548504a..aa5c5654c2 100644 --- a/ext/tk/lib/tkextlib/blt/dragdrop.rb +++ b/ext/tk/lib/tkextlib/blt/dragdrop.rb @@ -15,7 +15,7 @@ module Tk::BLT class Token < TkWindow WidgetClassName = 'DragDropToken'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def initialize(arg) if arg.kind_of?(Hash) # arg is a hash includes the widgetpath of token @@ -55,6 +55,7 @@ module Tk::BLT private :__item_strval_optkeys undef itemcget + undef itemcget_tkstring private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo def source_configure(win, slot, value=None) @@ -77,7 +78,7 @@ module Tk::BLT ] PROC_TBL = [ - [ ?w, TkComm.method(:window) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -120,8 +121,8 @@ module Tk::BLT ] PROC_TBL = [ - [ ?b, TkComm.method(:bool) ], - [ ?w, TkComm.method(:window) ], + [ ?b, TkComm.method(:bool) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -175,9 +176,9 @@ module Tk::BLT ] PROC_TBL = [ - [ ?i, TkComm.method(:string) ], - [ ?v, TkComm.method(:tk_tcl2ruby) ], - [ ?w, TkComm.method(:window) ], + [ ?i, TkComm.method(:string) ], + [ ?v, TkComm.method(:tk_tcl2ruby) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -203,14 +204,14 @@ module Tk::BLT end def self.source_handler(win, datatype, cmd=Proc.new, *args) - _bind_for_event_class(DnD_Handle, - ['::blt::drag&drop', 'source', win, 'handler'], + _bind_for_event_class(DnD_Handle, + ['::blt::drag&drop', 'source', win, 'handler'], cmd, *args) end def self.target_handler(win, datatype, cmd=Proc.new, *args) - _bind_for_event_class(DnD_Handle, - ['::blt::drag&drop', 'target', win, 'handler'], + _bind_for_event_class(DnD_Handle, + ['::blt::drag&drop', 'target', win, 'handler'], cmd, *args) end diff --git a/ext/tk/lib/tkextlib/blt/graph.rb b/ext/tk/lib/tkextlib/blt/graph.rb index 9ae99bff5c..6bd4424065 100644 --- a/ext/tk/lib/tkextlib/blt/graph.rb +++ b/ext/tk/lib/tkextlib/blt/graph.rb @@ -11,7 +11,7 @@ module Tk::BLT class Graph < TkWindow TkCommandNames = ['::blt::graph'.freeze].freeze WidgetClassName = 'Graph'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self include PlotComponent include GraphCommand @@ -27,7 +27,7 @@ module Tk::BLT private :__strval_optkeys =begin - BarElement_ID = ['blt_graph_bar'.freeze, '00000'.taint].freeze + BarElement_ID = ['blt_graph_bar'.freeze, TkUtil.untrust('00000')].freeze def bar(elem=nil, keys={}) if elem.kind_of?(Hash) diff --git a/ext/tk/lib/tkextlib/blt/htext.rb b/ext/tk/lib/tkextlib/blt/htext.rb index 0d9cb30185..878bd9982d 100644 --- a/ext/tk/lib/tkextlib/blt/htext.rb +++ b/ext/tk/lib/tkextlib/blt/htext.rb @@ -19,8 +19,9 @@ module Tk::BLT TkCommandNames = ['::blt::htext'.freeze].freeze WidgetClassName = 'Htext'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self + alias window_cget_tkstring itemcget_tkstring alias window_cget itemcget alias window_cget_strict itemcget_strict alias window_configure itemconfigure diff --git a/ext/tk/lib/tkextlib/blt/setup.rb b/ext/tk/lib/tkextlib/blt/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/blt/setup.rb +++ b/ext/tk/lib/tkextlib/blt/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/blt/stripchart.rb b/ext/tk/lib/tkextlib/blt/stripchart.rb index fe5afbb095..74093f1868 100644 --- a/ext/tk/lib/tkextlib/blt/stripchart.rb +++ b/ext/tk/lib/tkextlib/blt/stripchart.rb @@ -11,7 +11,7 @@ module Tk::BLT class Stripchart < TkWindow TkCommandNames = ['::blt::stripchart'.freeze].freeze WidgetClassName = 'Stripchart'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self include PlotComponent include GraphCommand @@ -22,13 +22,13 @@ module Tk::BLT private :__boolval_optkeys def __strval_optkeys - ['text', 'label', 'title', 'file', + ['text', 'label', 'title', 'file', 'background', 'plotbackground'] end private :__strval_optkeys =begin - BarElement_ID = ['blt_stripchart_bar'.freeze, '00000'.taint].freeze + BarElement_ID = ['blt_stripchart_bar'.freeze, TkUtil.untrust('00000')].freeze def bar(elem=nil, keys={}) if elem.kind_of?(Hash) diff --git a/ext/tk/lib/tkextlib/blt/table.rb b/ext/tk/lib/tkextlib/blt/table.rb index dfa10269ed..205e29e6c5 100644 --- a/ext/tk/lib/tkextlib/blt/table.rb +++ b/ext/tk/lib/tkextlib/blt/table.rb @@ -26,6 +26,9 @@ module Tk::BLT self end + def blt_table_cget_tkstring(*args) + Tk::BLT::Table.cget_tkstring(self, *args) + end def blt_table_cget(*args) Tk::BLT::Table.cget(self, *args) end @@ -92,6 +95,9 @@ module Tk::BLT self end + def blt_table_itemcget_tkstring(*args) + Tk::BLT::Table.itemcget_tkstring(self, *args) + end def blt_table_itemcget(*args) Tk::BLT::Table.itemcget(self, *args) end @@ -141,13 +147,14 @@ class << Tk::BLT::Table end private :__item_pathname + alias __itemcget_tkstring itemcget_tkstring alias __itemcget itemcget alias __itemcget_strict itemcget_strict alias __itemconfigure itemconfigure alias __itemconfiginfo itemconfiginfo alias __current_itemconfiginfo current_itemconfiginfo - private :__itemcget, :__itemcget_strict + private :__itemcget_tkstring, :__itemcget, :__itemcget_strict private :__itemconfigure, :__itemconfiginfo, :__current_itemconfiginfo def __boolval_optkeys @@ -180,6 +187,9 @@ class << Tk::BLT::Table ############################################ + def cget_tkstring(container, option) + __itemcget_tkstring([container], option) + end def cget(container, option) __itemcget([container], option) end @@ -199,6 +209,9 @@ class << Tk::BLT::Table __current_itemconfiginfo([container], *args) end + def itemcget_tkstring(container, item, option) + __itemcget_tkstring([container, tagid(item)], option) + end def itemcget(container, item, option) __itemcget([container, tagid(item)], option) end diff --git a/ext/tk/lib/tkextlib/blt/tabnotebook.rb b/ext/tk/lib/tkextlib/blt/tabnotebook.rb index 510352ba48..82936c67d3 100644 --- a/ext/tk/lib/tkextlib/blt/tabnotebook.rb +++ b/ext/tk/lib/tkextlib/blt/tabnotebook.rb @@ -11,7 +11,7 @@ module Tk::BLT class Tabnotebook < Tabset TkCommandNames = ['::blt::tabnotebook'.freeze].freeze WidgetClassName = 'Tabnotebook'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self class Tab < Tk::BLT::Tabset::Tab def self.new(parent, pos=nil, name=nil, keys={}) @@ -99,7 +99,7 @@ module Tk::BLT pos = nil end pos = 'end' if pos.nil? - Tk::BLT::Tabnotebook::Tab.new(self, nil, + Tk::BLT::Tabnotebook::Tab.new(self, nil, tk_send('insert', tagindex(pos), keys)) end diff --git a/ext/tk/lib/tkextlib/blt/tabset.rb b/ext/tk/lib/tkextlib/blt/tabset.rb index b5e076db3a..c4716c7304 100644 --- a/ext/tk/lib/tkextlib/blt/tabset.rb +++ b/ext/tk/lib/tkextlib/blt/tabset.rb @@ -13,7 +13,7 @@ module Tk::BLT TabID_TBL = TkCore::INTERP.create_table - (TabsetTab_ID = ['blt_tabset_tab'.freeze, '00000'.taint]).instance_eval{ + (TabsetTab_ID = ['blt_tabset_tab'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -132,6 +132,9 @@ module Tk::BLT @t.tab_bindinfo(@id, context) end + def cget_tkstring(*args) + @t.tab_cget_tkstring(@id, *args) + end def cget(*args) @t.tab_cget(@id, *args) end @@ -210,7 +213,7 @@ module Tk::BLT TkCommandNames = ['::blt::tabset'.freeze].freeze WidgetClassName = 'Tabset'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __destroy_hook__ Tk::BLT::Tabset::Tab::TabID_TBL.mutex.synchronize{ @@ -249,6 +252,7 @@ module Tk::BLT end private :__item_pathname + alias tab_cget_tkstring itemcget_tkstring alias tab_cget itemcget alias tab_cget_strict itemcget_strict alias tab_configure itemconfigure diff --git a/ext/tk/lib/tkextlib/blt/ted.rb b/ext/tk/lib/tkextlib/blt/ted.rb index 670265fc78..53ab9acdaa 100644 --- a/ext/tk/lib/tkextlib/blt/ted.rb +++ b/ext/tk/lib/tkextlib/blt/ted.rb @@ -30,9 +30,12 @@ module Tk::BLT end private :__item_config_cmd - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo + def cget_tkstring(master, option) + itemcget_tkstring(master, option) + end def cget(master, option) itemcget(master, option) end diff --git a/ext/tk/lib/tkextlib/blt/tile.rb b/ext/tk/lib/tkextlib/blt/tile.rb index 5f5242f299..c67cafd8d6 100644 --- a/ext/tk/lib/tkextlib/blt/tile.rb +++ b/ext/tk/lib/tkextlib/blt/tile.rb @@ -8,6 +8,10 @@ require 'tkextlib/blt.rb' module Tk::BLT module Tile + TkComm::TkExtlibAutoloadModule.unshift(self) + # Require autoload-symbols which is a same name as widget classname. + # Those are used at TkComm._genobj_for_tkwidget method. + autoload :Button, 'tkextlib/blt/tile/button.rb' autoload :CheckButton, 'tkextlib/blt/tile/checkbutton.rb' autoload :Checkbutton, 'tkextlib/blt/tile/checkbutton.rb' diff --git a/ext/tk/lib/tkextlib/blt/tree.rb b/ext/tk/lib/tkextlib/blt/tree.rb index 77b85f1717..da53a6ed04 100644 --- a/ext/tk/lib/tkextlib/blt/tree.rb +++ b/ext/tk/lib/tkextlib/blt/tree.rb @@ -182,7 +182,7 @@ module Tk::BLT def move(dest, keys={}) @tree.keys(@id, dest, keys) self - end + end def next() @tree.next(@id) @@ -272,7 +272,7 @@ module Tk::BLT TreeTagID_TBL.mutex.synchronize{ TreeTagID_TBL.clear } } - (TreeTag_ID = ['blt_tree_tag'.freeze, '00000'.taint]).instance_eval{ + (TreeTag_ID = ['blt_tree_tag'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -397,10 +397,10 @@ module Tk::BLT NotifyID_TBL.mutex.synchronize{ if tree.kind_of?(Array) # not create - tpath = tree[0].path + tpath = tree[0].path NotifyID_TBL[tpath] ||= {} unless (obj = NotifyID_TBL[tpath][tree[1]]) - (NotifyID_TBL[tpath][tree[1]] = + (NotifyID_TBL[tpath][tree[1]] = obj = self.allocate).instance_eval{ @parent = @tree = tree[0] @tpath = @parent.path @@ -438,7 +438,7 @@ module Tk::BLT args = args.collect{|arg| '-' << arg.to_s} args << proc{|id, type| - cmd.call(Tk::BLT::Tree::Node.id2obj(@tree, id), + cmd.call(Tk::BLT::Tree::Node.id2obj(@tree, id), ((type[0] == ?-)? type[1..-1]: type)) } @@ -509,7 +509,7 @@ module Tk::BLT tpath = tree[0].path TraceID_TBL[tpath] ||= {} unless (obj = TraceID_TBL[tpath][tree[1]]) - (TraceID_TBL[tpath][tree[1]] = + (TraceID_TBL[tpath][tree[1]] = obj = self.allocate).instance_eval{ @parent = @tree = tree @tpath = @parent.path @@ -541,8 +541,8 @@ module Tk::BLT end end - @path = @id = tk_call(@tpath, 'trace', 'create', node, key, opts, - proc{|t, id, k, ops| + @path = @id = tk_call(@tpath, 'trace', 'create', node, key, opts, + proc{|t, id, k, ops| tobj = Tk::BLT::Tree.id2obj(t) if tobj.kind_of?(Tk::BLT::Tree) nobj = Tk::BLT::Tree::Node.id2obj(tobj, id) @@ -578,7 +578,7 @@ module Tk::BLT TreeID_TBL = TkCore::INTERP.create_table - (Tree_ID = ['blt_tree'.freeze, '00000'.taint]).instance_eval{ + (Tree_ID = ['blt_tree'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -599,8 +599,8 @@ module Tk::BLT 'recurse'=>nil, 'tags'=>nil, # sort command - 'ascii'=>nil, 'decreasing'=>nil, 'disctionary'=>nil, - 'integer'=>nil, 'real'=>nil, 'recurse'=>nil, 'reorder'=>nil, + 'ascii'=>nil, 'decreasing'=>nil, 'disctionary'=>nil, + 'integer'=>nil, 'real'=>nil, 'recurse'=>nil, 'reorder'=>nil, } end @@ -624,7 +624,7 @@ module Tk::BLT def self.new(name = nil) TreeID_TBL.mutex.synchronize{ if name && TreeID_TBL[name] - TreeID_TBL[name] + TreeID_TBL[name] else (obj = self.allocate).instance_eval{ initialize(name) @@ -680,7 +680,7 @@ module Tk::BLT end def ancestor(node1, node2) - Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'ancestor', + Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'ancestor', tagid(node1), tagid(node2))) end @@ -701,14 +701,14 @@ module Tk::BLT end def copy(src, parent, keys={}) - id = tk_call('::blt::tree', 'copy', tagid(src), tagid(parent), + id = tk_call('::blt::tree', 'copy', tagid(src), tagid(parent), __conv_keyonly_opts(keys)) Tk::BLT::Tree::Node.new(self, nil, 'node'=>id) end def copy_to(src, dest_tree, parent, keys={}) return copy(src, parent, keys={}) unless dest_tree - id = tk_call('::blt::tree', 'copy', tagid(src), dest_tree, + id = tk_call('::blt::tree', 'copy', tagid(src), dest_tree, tagid(parent), __conv_keyonly_opts(keys)) Tk::BLT::Tree::Node.new(dest_tree, nil, 'node'=>id) end @@ -751,7 +751,7 @@ module Tk::BLT end def find(node, keys={}) - simplelist(tk_call('::blt::tree', 'find', tagid(node), + simplelist(tk_call('::blt::tree', 'find', tagid(node), __conv_keyonly_opts(keys))).collect{|n| Tk::BLT::Tree::Node.id2obj(self, n) } @@ -775,7 +775,7 @@ module Tk::BLT end def index(node) - Tk::BLT::Tree::Node.id2obj(self, + Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'index', tagid(node))) end @@ -785,11 +785,11 @@ module Tk::BLT end def ancestor?(node1, node2) - bool(tk_call('::blt::tree', 'is', 'ancestor', + bool(tk_call('::blt::tree', 'is', 'ancestor', tagid(node1), tagid(node2))) end def before?(node1, node2) - bool(tk_call('::blt::tree', 'is', 'before', + bool(tk_call('::blt::tree', 'is', 'before', tagid(node1), tagid(node2))) end def leaf?(node) @@ -806,7 +806,7 @@ module Tk::BLT if nodes.empty? simplelist(tk_call('blt::tree', 'keys', tagid(node))) else - simplelist(tk_call('blt::tree', 'keys', tagid(node), + simplelist(tk_call('blt::tree', 'keys', tagid(node), *(nodes.collect{|n| tagid(n)}))).collect{|lst| simplelist(lst) } @@ -828,7 +828,7 @@ module Tk::BLT end def link(parent, node, keys={}) - ret = tk_call('::blt::tree', 'link', tagid(parent), tagid(node), + ret = tk_call('::blt::tree', 'link', tagid(parent), tagid(node), __conv_keyonly_opts(keys)) (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret) end @@ -902,7 +902,7 @@ module Tk::BLT end def restore(node, str, keys={}) - tk_call('::blt::tree', 'restore', tagid(node), str, + tk_call('::blt::tree', 'restore', tagid(node), str, __conv_keyonly_opts(keys)) self end @@ -915,7 +915,7 @@ module Tk::BLT end def restore_from_file(node, file, keys={}) - tk_call('::blt::tree', 'restorefile', tagid(node), file, + tk_call('::blt::tree', 'restorefile', tagid(node), file, __conv_keyonly_opts(keys)) self end @@ -923,13 +923,13 @@ module Tk::BLT keys = __conv_keyonly_opts(keys) keys.delete('overwrite') keys.delete(:overwrite) - tk_call('::blt::tree', 'restorefile', tagid(node), file, + tk_call('::blt::tree', 'restorefile', tagid(node), file, '-overwrite', keys) self end def root(node=None) - Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'root', + Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'root', tagid(node))) end @@ -958,7 +958,7 @@ module Tk::BLT end def tag_delete(tag, *nodes) - tk_call(@path, 'tag', 'delete', tagid(tag), + tk_call(@path, 'tag', 'delete', tagid(tag), *(nodes.collect{|n| tagid(n)})) self end @@ -973,7 +973,7 @@ module Tk::BLT end def tag_get(node, *patterns) - simplelist(tk_call(@tpath, 'tag', 'get', tagid(node), + simplelist(tk_call(@tpath, 'tag', 'get', tagid(node), *(patterns.collect{|pat| tagid(pat)}))).collect{|str| Tk::BLT::Tree::Tag.id2obj(self, str) } @@ -997,7 +997,7 @@ module Tk::BLT end def tag_unset(node, *tags) - tk_call(@path, 'tag', 'unset', tagid(node), + tk_call(@path, 'tag', 'unset', tagid(node), *(tags.collect{|t| tagid(t)})) self end diff --git a/ext/tk/lib/tkextlib/blt/treeview.rb b/ext/tk/lib/tkextlib/blt/treeview.rb index c5a5697186..046cf7f837 100644 --- a/ext/tk/lib/tkextlib/blt/treeview.rb +++ b/ext/tk/lib/tkextlib/blt/treeview.rb @@ -95,6 +95,9 @@ module Tk::BLT::Treeview::ConfigMethod end private :__item_pathname + def column_cget_tkstring(name, option) + itemcget_tkstring(['column', name], option) + end def column_cget(name, option) itemcget(['column', name], option) end @@ -111,6 +114,9 @@ module Tk::BLT::Treeview::ConfigMethod current_itemconfiginfo(['column', name], slot) end + def button_cget_tkstring(option) + itemcget_tkstring('button', option) + end def button_cget(option) itemcget('button', option) end @@ -127,6 +133,9 @@ module Tk::BLT::Treeview::ConfigMethod current_itemconfiginfo('button', slot) end + def entry_cget_tkstring(option) + itemcget_tkstring('entry', option) + end def entry_cget(option) ret = itemcget('entry', option) if option == 'bindtags' || option == :bindtags @@ -181,6 +190,9 @@ module Tk::BLT::Treeview::ConfigMethod ret end + def sort_cget_tkstring(option) + itemcget_tkstring('sort', option) + end def sort_cget(option) itemcget('sort', option) end @@ -197,6 +209,9 @@ module Tk::BLT::Treeview::ConfigMethod current_itemconfiginfo('sort', slot) end + def text_cget_tkstring(option) + itemcget_tkstring('text', option) + end def text_cget(option) itemcget('text', option) end @@ -213,14 +228,14 @@ module Tk::BLT::Treeview::ConfigMethod current_itemconfiginfo('text', slot) end - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo end class Tk::BLT::Treeview TkCommandNames = ['::blt::treeview'.freeze].freeze WidgetClassName = 'TreeView'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self include Scrollable include ValidateConfigure @@ -230,7 +245,7 @@ class Tk::BLT::Treeview ######################## def __boolval_optkeys - ['autocreate', 'allowduplicates', 'exportselection', 'flat', 'hideroot', + ['autocreate', 'allowduplicates', 'exportselection', 'flat', 'hideroot', 'newtags', 'showtitles', 'sortselection'] end private :__boolval_optkeys @@ -245,17 +260,17 @@ class Tk::BLT::Treeview class OpenCloseCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?W, ?w, :widget ], - [ ?p, ?s, :name ], - [ ?P, ?s, :fullpath ], - [ ?#, ?x, :node_id ], + [ ?W, ?w, :widget ], + [ ?p, ?s, :name ], + [ ?P, ?s, :fullpath ], + [ ?#, ?x, :node_id ], nil ] PROC_TBL = [ - [ ?x, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?x, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -463,7 +478,7 @@ class Tk::BLT::Treeview self end def entry_children(tag, first=None, last=None) - simplelist(tk_send('entry', 'children', tagid(tag), + simplelist(tk_send('entry', 'children', tagid(tag), first, last)).collect{|id| tagid2obj(id)} end def entry_delete(tag, first=None, last=None) @@ -500,17 +515,17 @@ class Tk::BLT::Treeview class FindExecFlagValue < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?W, ?w, :widget ], - [ ?p, ?s, :name ], - [ ?P, ?s, :fullpath ], - [ ?#, ?x, :node_id ], + [ ?W, ?w, :widget ], + [ ?p, ?s, :name ], + [ ?P, ?s, :fullpath ], + [ ?#, ?x, :node_id ], nil ] PROC_TBL = [ - [ ?x, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?x, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -646,7 +661,7 @@ class Tk::BLT::Treeview } end def range_open(first, last) - simplelist(tk_send('range', '-open', + simplelist(tk_send('range', '-open', tagid(first), tagid(last))).collect{|id| tagid2obj(id) } @@ -1029,7 +1044,7 @@ class Tk::BLT::Treeview::Node < TkObject TreeNodeID_TBL = TkCore::INTERP.create_table - (TreeNode_ID = ['blt_treeview_node'.freeze, '00000'.taint]).instance_eval{ + (TreeNode_ID = ['blt_treeview_node'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -1118,7 +1133,7 @@ class Tk::BLT::Treeview::Node < TkObject at = keys.delete['at'] if parent - if parent.kind_of?(Tk::BLT::Treeview::Node) || + if parent.kind_of?(Tk::BLT::Treeview::Node) || parent.kind_of?(Tk::BLT::Treeview::Tag) path = [get_full(parent.id)[0], name] at = nil # ignore 'at' option @@ -1150,7 +1165,7 @@ class Tk::BLT::Treeview::Tag < TkObject TreeTagID_TBL = TkCore::INTERP.create_table - (TreeTag_ID = ['blt_treeview_tag'.freeze, '00000'.taint]).instance_eval{ + (TreeTag_ID = ['blt_treeview_tag'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -1268,5 +1283,5 @@ end class Tk::BLT::Hiertable TkCommandNames = ['::blt::hiertable'.freeze].freeze WidgetClassName = 'Hiertable'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/blt/unix_dnd.rb b/ext/tk/lib/tkextlib/blt/unix_dnd.rb index 445002d7a5..8996f7c891 100644 --- a/ext/tk/lib/tkextlib/blt/unix_dnd.rb +++ b/ext/tk/lib/tkextlib/blt/unix_dnd.rb @@ -30,9 +30,12 @@ module Tk::BLT end private :__item_config_cmd - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo + def cget_tkstring(win, option) + itemcget_tkstring(['cget', win], option) + end def cget(win, option) itemcget(['cget', win], option) end @@ -49,6 +52,9 @@ module Tk::BLT current_itemconfiginfo(['configure', win], slot) end + def token_cget_tkstring(win, option) + itemcget_tkstring(['token', 'cget', win], option) + end def token_cget(win, option) itemcget(['token', 'cget', win], option) end diff --git a/ext/tk/lib/tkextlib/blt/vector.rb b/ext/tk/lib/tkextlib/blt/vector.rb index 97fb1b96ff..742e901d3e 100644 --- a/ext/tk/lib/tkextlib/blt/vector.rb +++ b/ext/tk/lib/tkextlib/blt/vector.rb @@ -49,10 +49,10 @@ module Tk::BLT size = size.join(':') end if size - @id = TkCore::INTERP._invoke('::blt::vector', 'create', + @id = TkCore::INTERP._invoke('::blt::vector', 'create', "#auto(#{size})", *hash_kv(keys)) else - @id = TkCore::INTERP._invoke('::blt::vector', 'create', + @id = TkCore::INTERP._invoke('::blt::vector', 'create', "#auto", *hash_kv(keys)) end diff --git a/ext/tk/lib/tkextlib/blt/watch.rb b/ext/tk/lib/tkextlib/blt/watch.rb index 219ff78e97..292623ff58 100644 --- a/ext/tk/lib/tkextlib/blt/watch.rb +++ b/ext/tk/lib/tkextlib/blt/watch.rb @@ -14,7 +14,7 @@ module Tk::BLT WATCH_ID_TBL = TkCore::INTERP.create_table - (BLT_WATCH_ID = ['blt_watch_id'.freeze, '00000'.taint]).instance_eval{ + (BLT_WATCH_ID = ['blt_watch_id'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze diff --git a/ext/tk/lib/tkextlib/blt/winop.rb b/ext/tk/lib/tkextlib/blt/winop.rb index e371d28ab7..03bdb60810 100644 --- a/ext/tk/lib/tkextlib/blt/winop.rb +++ b/ext/tk/lib/tkextlib/blt/winop.rb @@ -38,7 +38,7 @@ class << Tk::BLT::Winop tk_call('::blt::winop', 'image', 'readjpeg', file, photo) end def image_resample(src, dest, horiz_filter=None, vert_filter=None) - tk_call('::blt::winop', 'image', 'resample', + tk_call('::blt::winop', 'image', 'resample', src, dest, horiz_filter, vert_filter) end def image_rotate(src, dest, angle) @@ -47,9 +47,9 @@ class << Tk::BLT::Winop def image_snap(win, photo, width=None, height=None) tk_call('::blt::winop', 'image', 'snap', win, photo, width, height) end - def image_subsample(src, dest, x, y, width, height, + def image_subsample(src, dest, x, y, width, height, horiz_filter=None, vert_filter=None) - tk_call('::blt::winop', 'image', 'subsample', + tk_call('::blt::winop', 'image', 'subsample', src, dest, x, y, width, height, horiz_filter, vert_filter) end @@ -66,13 +66,13 @@ class << Tk::BLT::Winop end def resample(src, dest, horiz_filter=None, vert_filter=None) - tk_call('::blt::winop', 'resample', + tk_call('::blt::winop', 'resample', src, dest, horiz_filter, vert_filter) end - def subsample(src, dest, x, y, width, height, + def subsample(src, dest, x, y, width, height, horiz_filter=None, vert_filter=None) - tk_call('::blt::winop', 'subsample', + tk_call('::blt::winop', 'subsample', src, dest, x, y, width, height, horiz_filter, vert_filter) end diff --git a/ext/tk/lib/tkextlib/bwidget.rb b/ext/tk/lib/tkextlib/bwidget.rb index 62631d8b54..7a1eff51d8 100644 --- a/ext/tk/lib/tkextlib/bwidget.rb +++ b/ext/tk/lib/tkextlib/bwidget.rb @@ -18,6 +18,8 @@ TkPackage.require('BWidget') module Tk module BWidget TkComm::TkExtlibAutoloadModule.unshift(self) + # Require autoload-symbols which is a same name as widget classname. + # Those are used at TkComm._genobj_for_tkwidget method. extend TkCore diff --git a/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb b/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb index 770e5e9ef1..13fe9e59bf 100644 --- a/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb +++ b/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb @@ -17,5 +17,5 @@ end class Tk::BWidget::ArrowButton TkCommandNames = ['ArrowButton'.freeze].freeze WidgetClassName = 'ArrowButton'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/bwidget/button.rb b/ext/tk/lib/tkextlib/bwidget/button.rb index 8f3087d098..e139fb6708 100644 --- a/ext/tk/lib/tkextlib/bwidget/button.rb +++ b/ext/tk/lib/tkextlib/bwidget/button.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::Button TkCommandNames = ['Button'.freeze].freeze WidgetClassName = 'Button'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' diff --git a/ext/tk/lib/tkextlib/bwidget/buttonbox.rb b/ext/tk/lib/tkextlib/bwidget/buttonbox.rb index 8d6d212189..a6de33c40c 100644 --- a/ext/tk/lib/tkextlib/bwidget/buttonbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/buttonbox.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::ButtonBox TkCommandNames = ['ButtonBox'.freeze].freeze WidgetClassName = 'ButtonBox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self include TkItemConfigMethod diff --git a/ext/tk/lib/tkextlib/bwidget/combobox.rb b/ext/tk/lib/tkextlib/bwidget/combobox.rb index 1c58a4ccb0..16143dfbc6 100644 --- a/ext/tk/lib/tkextlib/bwidget/combobox.rb +++ b/ext/tk/lib/tkextlib/bwidget/combobox.rb @@ -21,7 +21,12 @@ class Tk::BWidget::ComboBox TkCommandNames = ['ComboBox'.freeze].freeze WidgetClassName = 'ComboBox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self + + def __boolval_optkeys + super() << 'autocomplete' << 'autopost' + end + private :__boolval_optkeys def get_listbox(&b) win = window(tk_send_without_enc('getlistbox')) @@ -35,6 +40,12 @@ class Tk::BWidget::ComboBox win end + def clear_value + tk_send_without_enc('clearvalue') + self + end + alias clearvalue clear_value + def icursor(idx) tk_send_without_enc('icursor', idx) end diff --git a/ext/tk/lib/tkextlib/bwidget/dialog.rb b/ext/tk/lib/tkextlib/bwidget/dialog.rb index 291ca4a962..3b0656f021 100644 --- a/ext/tk/lib/tkextlib/bwidget/dialog.rb +++ b/ext/tk/lib/tkextlib/bwidget/dialog.rb @@ -18,12 +18,17 @@ end class Tk::BWidget::Dialog TkCommandNames = ['Dialog'.freeze].freeze WidgetClassName = 'Dialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self include TkItemConfigMethod + def __numstrval_optkeys + super() << 'buttonwidth' + end + private :__numstrval_optkeys + def __strval_optkeys - super() << 'title' + super() << 'title' << 'geometry' end private :__strval_optkeys @@ -52,13 +57,20 @@ class Tk::BWidget::Dialog def create_self(keys) cmd = self.class::TkCommandNames[0] if keys and keys != None - tk_call_without_enc(cmd, @path, '-parent', @relative, + tk_call_without_enc(cmd, @path, '-parent', @relative, *hash_kv(keys, true)) else tk_call_without_enc(cmd, @path, '-parent', @relative) end end + def cget_tkstring(slot) + if slot.to_s == 'relative' + super('parent') + else + super(slot) + end + end def cget_strict(slot) if slot.to_s == 'relative' super('parent') diff --git a/ext/tk/lib/tkextlib/bwidget/entry.rb b/ext/tk/lib/tkextlib/bwidget/entry.rb index a56890f4e3..8dc4496123 100644 --- a/ext/tk/lib/tkextlib/bwidget/entry.rb +++ b/ext/tk/lib/tkextlib/bwidget/entry.rb @@ -19,7 +19,7 @@ class Tk::BWidget::Entry TkCommandNames = ['Entry'.freeze].freeze WidgetClassName = 'Entry'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' << 'insertbackground' diff --git a/ext/tk/lib/tkextlib/bwidget/label.rb b/ext/tk/lib/tkextlib/bwidget/label.rb index 88a504aa50..e8d9352c62 100644 --- a/ext/tk/lib/tkextlib/bwidget/label.rb +++ b/ext/tk/lib/tkextlib/bwidget/label.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::Label TkCommandNames = ['Label'.freeze].freeze WidgetClassName = 'Label'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' diff --git a/ext/tk/lib/tkextlib/bwidget/labelentry.rb b/ext/tk/lib/tkextlib/bwidget/labelentry.rb index 95b40946a6..16e7b46933 100644 --- a/ext/tk/lib/tkextlib/bwidget/labelentry.rb +++ b/ext/tk/lib/tkextlib/bwidget/labelentry.rb @@ -21,7 +21,7 @@ class Tk::BWidget::LabelEntry TkCommandNames = ['LabelEntry'.freeze].freeze WidgetClassName = 'LabelEntry'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg' diff --git a/ext/tk/lib/tkextlib/bwidget/labelframe.rb b/ext/tk/lib/tkextlib/bwidget/labelframe.rb index dc221806e4..0710f213f0 100644 --- a/ext/tk/lib/tkextlib/bwidget/labelframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/labelframe.rb @@ -18,7 +18,7 @@ end class Tk::BWidget::LabelFrame TkCommandNames = ['LabelFrame'.freeze].freeze WidgetClassName = 'LabelFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' diff --git a/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ext/tk/lib/tkextlib/bwidget/listbox.rb index 093fcb6fb3..930491c869 100644 --- a/ext/tk/lib/tkextlib/bwidget/listbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/listbox.rb @@ -11,7 +11,7 @@ module Tk module BWidget class ListBox < TkWindow # is NOT a subclass of a listbox widget class. - # because it constructed on a canvas widget. + # because it constructed on a canvas widget. class Item < TkObject end @@ -25,11 +25,11 @@ class Tk::BWidget::ListBox TkCommandNames = ['ListBox'.freeze].freeze WidgetClassName = 'ListBox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self class Event_for_Items < TkEvent::Event def self._get_extra_args_tbl - [ + [ TkComm.method(:string) # item idenfier ] end @@ -60,7 +60,7 @@ class Tk::BWidget::ListBox else cmd = Proc.new end - _bind_for_event_class(Event_for_Items, [path, 'bindImage'], + _bind_for_event_class(Event_for_Items, [path, 'bindImage'], context, cmd, *args) self end @@ -76,7 +76,7 @@ class Tk::BWidget::ListBox else cmd = Proc.new end - _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], + _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], context, cmd, *args) self end @@ -101,7 +101,7 @@ class Tk::BWidget::ListBox else cmd = Proc.new end - _bind_for_event_class(Event_for_Items, [path, 'bindText'], + _bind_for_event_class(Event_for_Items, [path, 'bindText'], context, cmd, *args) self end @@ -117,7 +117,7 @@ class Tk::BWidget::ListBox else cmd = Proc.new end - _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], + _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], context, cmd, *args) self end @@ -183,19 +183,19 @@ class Tk::BWidget::ListBox end def selection_set(*args) - tk_send_without_enc('selection', 'set', + tk_send_without_enc('selection', 'set', *(args.collect{|item| tagid(item)})) self end def selection_add(*args) - tk_send_without_enc('selection', 'add', + tk_send_without_enc('selection', 'add', *(args.collect{|item| tagid(item)})) self end def selection_remove(*args) - tk_send_without_enc('selection', 'remove', + tk_send_without_enc('selection', 'remove', *(args.collect{|item| tagid(item)})) self end @@ -212,7 +212,7 @@ class Tk::BWidget::ListBox::Item ListItem_TBL = TkCore::INTERP.create_table - (ListItem_ID = ['bw:item'.freeze, '00000'.taint]).instance_eval{ + (ListItem_ID = ['bw:item'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -237,7 +237,7 @@ class Tk::BWidget::ListBox::Item if lbox.kind_of?(Tk::BWidget::ListBox) @listbox = lbox else - fail RuntimeError, + fail RuntimeError, "expect Tk::BWidget::ListBox or Tk::BWidget::ListBox::Item for 1st argument" end @@ -294,6 +294,9 @@ class Tk::BWidget::ListBox::Item val end + def cget_tkstring(key) + @listbox.itemcget_tkstring(@id, key) + end def cget(key) @listbox.itemcget(@id, key) end diff --git a/ext/tk/lib/tkextlib/bwidget/mainframe.rb b/ext/tk/lib/tkextlib/bwidget/mainframe.rb index de66eaf81e..92253bd8d3 100644 --- a/ext/tk/lib/tkextlib/bwidget/mainframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/mainframe.rb @@ -18,7 +18,7 @@ end class Tk::BWidget::MainFrame TkCommandNames = ['MainFrame'.freeze].freeze WidgetClassName = 'MainFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'progressfg' @@ -111,6 +111,10 @@ class Tk::BWidget::MainFrame win end + def get_menustate(tag) + tk_send('getmenustate', tag) # return state name string + end + def set_menustate(tag, state) tk_send('setmenustate', tag, state) self diff --git a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb index b88461baf7..7b62614737 100644 --- a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::MessageDlg TkCommandNames = ['MessageDlg'.freeze].freeze WidgetClassName = 'MessageDlg'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def initialize(parent=nil, keys=nil) @relative = '' @@ -185,7 +185,7 @@ class Tk::BWidget::MessageDlg def create # return the index of the pressed button, or nil if it is destroyed - ret = num_or_str(tk_call(self.class::TkCommandNames[0], + ret = num_or_str(tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys))) (ret < 0)? nil: ret end diff --git a/ext/tk/lib/tkextlib/bwidget/notebook.rb b/ext/tk/lib/tkextlib/bwidget/notebook.rb index 423943619c..ed28bcd86a 100644 --- a/ext/tk/lib/tkextlib/bwidget/notebook.rb +++ b/ext/tk/lib/tkextlib/bwidget/notebook.rb @@ -19,11 +19,11 @@ class Tk::BWidget::NoteBook TkCommandNames = ['NoteBook'.freeze].freeze WidgetClassName = 'NoteBook'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self class Event_for_Tabs < TkEvent::Event def self._get_extra_args_tbl - [ + [ TkComm.method(:string) # page idenfier ] end @@ -57,7 +57,7 @@ class Tk::BWidget::NoteBook else cmd = Proc.new end - _bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'], + _bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'], context, cmd, *args) self end @@ -73,7 +73,7 @@ class Tk::BWidget::NoteBook else cmd = Proc.new end - _bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'], + _bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'], context, cmd, *args) self end diff --git a/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb b/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb index fbc2c11255..31bbf1fb8b 100644 --- a/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb +++ b/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::PagesManager TkCommandNames = ['PagesManager'.freeze].freeze WidgetClassName = 'PagesManager'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def tagid(id) # id.to_s diff --git a/ext/tk/lib/tkextlib/bwidget/panedwindow.rb b/ext/tk/lib/tkextlib/bwidget/panedwindow.rb index 4d979fd523..54cf06cbde 100644 --- a/ext/tk/lib/tkextlib/bwidget/panedwindow.rb +++ b/ext/tk/lib/tkextlib/bwidget/panedwindow.rb @@ -17,7 +17,12 @@ end class Tk::BWidget::PanedWindow TkCommandNames = ['PanedWindow'.freeze].freeze WidgetClassName = 'PanedWindow'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self + + def __strval_optkeys + super() << 'activator' + end + private :__strval_optkeys def add(keys={}) window(tk_send('add', *hash_kv(keys))) diff --git a/ext/tk/lib/tkextlib/bwidget/panelframe.rb b/ext/tk/lib/tkextlib/bwidget/panelframe.rb index 84bae0768b..1cbf914425 100644 --- a/ext/tk/lib/tkextlib/bwidget/panelframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/panelframe.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::PanelFrame TkCommandNames = ['PanelFrame'.freeze].freeze WidgetClassName = 'PanelFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() + ['panelforeground', 'panelbackground'] @@ -47,11 +47,21 @@ class Tk::BWidget::PanelFrame end def items - list(tk_send('items')) + simplelist(tk_send('items')).map{|w| window(w)} end def remove(*wins) tk_send('remove', *wins) self end + + def remove_with_destroy(*wins) + tk_send('remove', '-destroy', *wins) + self + end + + def delete(*wins) # same to 'remove_with_destroy' + tk_send('delete', *wins) + self + end end diff --git a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb index 0b635d97bb..ea50c87cef 100644 --- a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb @@ -17,10 +17,10 @@ end class Tk::BWidget::PasswdDlg TkCommandNames = ['PasswdDlg'.freeze].freeze WidgetClassName = 'PasswdDlg'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys - super() << 'loginhelptext' << 'loginlabel' << 'logintext' << + super() << 'loginhelptext' << 'loginlabel' << 'logintext' << 'passwdlabel' << 'passwdtext' end private :__strval_optkeys @@ -31,13 +31,13 @@ class Tk::BWidget::PasswdDlg private :__boolval_optkeys def __tkvariable_optkeys - super() << 'loginhelpvar' << 'logintextvariable' << + super() << 'loginhelpvar' << 'logintextvariable' << 'passwdhelpvar' << 'passwdtextvariable' end private :__tkvariable_optkeys def create - login, passwd = simplelist(tk_call(self.class::TkCommandNames[0], + login, passwd = simplelist(tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys))) [login, passwd] end diff --git a/ext/tk/lib/tkextlib/bwidget/progressbar.rb b/ext/tk/lib/tkextlib/bwidget/progressbar.rb index 0253ce2ada..18eb67349b 100644 --- a/ext/tk/lib/tkextlib/bwidget/progressbar.rb +++ b/ext/tk/lib/tkextlib/bwidget/progressbar.rb @@ -16,5 +16,5 @@ end class Tk::BWidget::ProgressBar TkCommandNames = ['ProgressBar'.freeze].freeze WidgetClassName = 'ProgressBar'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/bwidget/progressdlg.rb b/ext/tk/lib/tkextlib/bwidget/progressdlg.rb index 32600255d5..0c0c4540bc 100644 --- a/ext/tk/lib/tkextlib/bwidget/progressdlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/progressdlg.rb @@ -19,7 +19,7 @@ end class Tk::BWidget::ProgressDlg TkCommandNames = ['ProgressDlg'.freeze].freeze WidgetClassName = 'ProgressDlg'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def create_self(keys) # NOT create widget for reusing the object diff --git a/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb b/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb index 010c960ec5..5bd00d6870 100644 --- a/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb @@ -19,7 +19,7 @@ class Tk::BWidget::ScrollableFrame TkCommandNames = ['ScrollableFrame'.freeze].freeze WidgetClassName = 'ScrollableFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def get_frame(&b) win = window(tk_send_without_enc('getframe')) diff --git a/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb b/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb index 3599fd8459..ea5a18cc66 100644 --- a/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb +++ b/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb @@ -17,7 +17,17 @@ end class Tk::BWidget::ScrolledWindow TkCommandNames = ['ScrolledWindow'.freeze].freeze WidgetClassName = 'ScrolledWindow'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self + + def __strval_optkeys + super() << 'sides' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'managed' + end + private :__boolval_optkeys def get_frame(&b) win = window(tk_send_without_enc('getframe')) diff --git a/ext/tk/lib/tkextlib/bwidget/scrollview.rb b/ext/tk/lib/tkextlib/bwidget/scrollview.rb index 0546af2c43..ab27bc91cf 100644 --- a/ext/tk/lib/tkextlib/bwidget/scrollview.rb +++ b/ext/tk/lib/tkextlib/bwidget/scrollview.rb @@ -16,7 +16,7 @@ end class Tk::BWidget::ScrollView TkCommandNames = ['ScrollView'.freeze].freeze WidgetClassName = 'ScrollView'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'fill' diff --git a/ext/tk/lib/tkextlib/bwidget/selectcolor.rb b/ext/tk/lib/tkextlib/bwidget/selectcolor.rb index 0f9014f8de..456175e87e 100644 --- a/ext/tk/lib/tkextlib/bwidget/selectcolor.rb +++ b/ext/tk/lib/tkextlib/bwidget/selectcolor.rb @@ -24,7 +24,7 @@ class Tk::BWidget::SelectColor TkCommandNames = ['SelectColor'.freeze].freeze WidgetClassName = 'SelectColor'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def dialog(keys={}) newkeys = @keys.dup @@ -57,7 +57,7 @@ class Tk::BWidget::SelectColor::Dialog def create @keys['type'] = 'dialog' # 'dialog' type returns color - tk_call(Tk::BWidget::SelectColor::TkCommandNames[0], + tk_call(Tk::BWidget::SelectColor::TkCommandNames[0], @path, *hash_kv(@keys)) end end @@ -67,7 +67,7 @@ class Tk::BWidget::SelectColor::Menubutton keys = {} unless keys keys = _symbolkey2str(keys) keys['type'] = 'menubutton' # 'toolbar' type returns widget path - window(tk_call(Tk::BWidget::SelectColor::TkCommandNames[0], + window(tk_call(Tk::BWidget::SelectColor::TkCommandNames[0], @path, *hash_kv(keys))) end end diff --git a/ext/tk/lib/tkextlib/bwidget/selectfont.rb b/ext/tk/lib/tkextlib/bwidget/selectfont.rb index e53eb3b5bc..23419cb0fa 100644 --- a/ext/tk/lib/tkextlib/bwidget/selectfont.rb +++ b/ext/tk/lib/tkextlib/bwidget/selectfont.rb @@ -23,13 +23,18 @@ class Tk::BWidget::SelectFont TkCommandNames = ['SelectFont'.freeze].freeze WidgetClassName = 'SelectFont'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'sampletext' << 'title' end private :__strval_optkeys + def __boolval_optkeys + super() << 'nosizes' + end + private :__boolval_optkeys + def __font_optkeys [] # without fontobj operation end @@ -80,7 +85,7 @@ class Tk::BWidget::SelectFont::Toolbar keys = {} unless keys keys = _symbolkey2str(keys) keys['type'] = 'toolbar' # 'toolbar' type returns widget path - window(tk_call(Tk::BWidget::SelectFont::TkCommandNames[0], + window(tk_call(Tk::BWidget::SelectFont::TkCommandNames[0], @path, *hash_kv(keys))) end end diff --git a/ext/tk/lib/tkextlib/bwidget/separator.rb b/ext/tk/lib/tkextlib/bwidget/separator.rb index d9c3458e51..6d92321210 100644 --- a/ext/tk/lib/tkextlib/bwidget/separator.rb +++ b/ext/tk/lib/tkextlib/bwidget/separator.rb @@ -16,5 +16,5 @@ end class Tk::BWidget::Separator TkCommandNames = ['Separator'.freeze].freeze WidgetClassName = 'Separator'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/bwidget/setup.rb b/ext/tk/lib/tkextlib/bwidget/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/bwidget/setup.rb +++ b/ext/tk/lib/tkextlib/bwidget/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/bwidget/spinbox.rb b/ext/tk/lib/tkextlib/bwidget/spinbox.rb index 48358baa5c..0a45b045fb 100644 --- a/ext/tk/lib/tkextlib/bwidget/spinbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/spinbox.rb @@ -20,7 +20,7 @@ class Tk::BWidget::SpinBox TkCommandNames = ['SpinBox'.freeze].freeze WidgetClassName = 'SpinBox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg' diff --git a/ext/tk/lib/tkextlib/bwidget/statusbar.rb b/ext/tk/lib/tkextlib/bwidget/statusbar.rb index 39c678d37e..5c5dd43fe4 100644 --- a/ext/tk/lib/tkextlib/bwidget/statusbar.rb +++ b/ext/tk/lib/tkextlib/bwidget/statusbar.rb @@ -17,10 +17,10 @@ end class Tk::BWidget::StatusBar TkCommandNames = ['StatusBar'.freeze].freeze WidgetClassName = 'StatusBar'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys - super() << 'showresize' + super() << 'showresize' << 'showseparator' << 'showresizesep' end private :__boolval_optkeys @@ -29,7 +29,17 @@ class Tk::BWidget::StatusBar self end - def delete(*wins) + def remove(*wins) + tk_send('remove', *wins) + self + end + + def remove_with_destroy(*wins) + tk_send('remove', '-destroy', *wins) + self + end + + def delete(*wins) # same to 'remove_with_destroy' tk_send('delete', *wins) self end @@ -47,6 +57,6 @@ class Tk::BWidget::StatusBar end def items - list(tk_send('items')) + simplelist(tk_send('items')).map{|w| window(w)} end end diff --git a/ext/tk/lib/tkextlib/bwidget/titleframe.rb b/ext/tk/lib/tkextlib/bwidget/titleframe.rb index 68534e66e9..71879111c1 100644 --- a/ext/tk/lib/tkextlib/bwidget/titleframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/titleframe.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::TitleFrame TkCommandNames = ['TitleFrame'.freeze].freeze WidgetClassName = 'TitleFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def get_frame(&b) win = window(tk_send_without_enc('getframe')) diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb index aed4512a73..089c482fe8 100644 --- a/ext/tk/lib/tkextlib/bwidget/tree.rb +++ b/ext/tk/lib/tkextlib/bwidget/tree.rb @@ -22,11 +22,11 @@ class Tk::BWidget::Tree TkCommandNames = ['Tree'.freeze].freeze WidgetClassName = 'Tree'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self class Event_for_Items < TkEvent::Event def self._get_extra_args_tbl - [ + [ TkComm.method(:string) # item idenfier ] end @@ -38,7 +38,7 @@ class Tk::BWidget::Tree private :__strval_optkeys def __boolval_optkeys - super() << 'dragenabled' << 'dropenabled' << + super() << 'dragenabled' << 'dropenabled' << 'redraw' << 'selectfill' << 'showlines' end private :__boolval_optkeys @@ -57,6 +57,37 @@ class Tk::BWidget::Tree end end + def areabind(context, *args) + if TkComm._callback_entry?(args[0]) || !block_given? + cmd = args.shift + else + cmd = Proc.new + end + _bind_for_event_class(Event_for_Items, [path, 'bindArea'], + context, cmd, *args) + self + end + + def areabind_append(context, *args) + if TkComm._callback_entry?(args[0]) || !block_given? + cmd = args.shift + else + cmd = Proc.new + end + _bind_append_for_event_class(Event_for_Items, [path, 'bindArea'], + context, cmd, *args) + self + end + + def areabind_remove(*args) + _bind_remove_for_event_class(Event_for_Items, [path, 'bindArea'], *args) + self + end + + def areabindinfo(*args) + _bindinfo_for_event_class(Event_for_Items, [path, 'bindArea'], *args) + end + #def imagebind(*args) # _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args) # self @@ -68,7 +99,7 @@ class Tk::BWidget::Tree else cmd = Proc.new end - _bind_for_event_class(Event_for_Items, [path, 'bindImage'], + _bind_for_event_class(Event_for_Items, [path, 'bindImage'], context, cmd, *args) self end @@ -84,7 +115,7 @@ class Tk::BWidget::Tree else cmd = Proc.new end - _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], + _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], context, cmd, *args) self end @@ -109,7 +140,7 @@ class Tk::BWidget::Tree else cmd = Proc.new end - _bind_for_event_class(Event_for_Items, [path, 'bindText'], + _bind_for_event_class(Event_for_Items, [path, 'bindText'], context, cmd, *args) self end @@ -125,7 +156,7 @@ class Tk::BWidget::Tree else cmd = Proc.new end - _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], + _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], context, cmd, *args) self end @@ -158,6 +189,16 @@ class Tk::BWidget::Tree bool(tk_send('exists', tagid(node))) end + def find(findinfo, confine=None) + Tk::BWidget::Tree::Node.id2obj(self, tk_send(findinfo, confine)) + end + def find_position(x, y, confine=None) + self.find(_at(x,y), confine) + end + def find_line(linenum) + self.find(linenum) + end + def index(node) num_or_str(tk_send('index', tagid(node))) end @@ -167,6 +208,10 @@ class Tk::BWidget::Tree self end + def line(node) + number(tk_send('line', tagid(node))) + end + def move(parent, node, idx) tk_send('move', tagid(parent), tagid(node), idx) self @@ -183,7 +228,7 @@ class Tk::BWidget::Tree end def open?(node) - bool(@tree.itemcget(tagid(node), 'open')) + bool(self.itemcget(tagid(node), 'open')) end def open_tree(node, recurse=None) @@ -206,7 +251,7 @@ class Tk::BWidget::Tree end def selection_add(*args) - tk_send_without_enc('selection', 'add', + tk_send_without_enc('selection', 'add', *(args.collect{|node| tagid(node)})) self end @@ -221,30 +266,30 @@ class Tk::BWidget::Tree end def selection_include?(*args) - bool(tk_send_without_enc('selection', 'get', + bool(tk_send_without_enc('selection', 'get', *(args.collect{|node| tagid(node)}))) end def selection_range(*args) - tk_send_without_enc('selection', 'range', + tk_send_without_enc('selection', 'range', *(args.collect{|node| tagid(node)})) self end def selection_remove(*args) - tk_send_without_enc('selection', 'remove', + tk_send_without_enc('selection', 'remove', *(args.collect{|node| tagid(node)})) self end def selection_set(*args) - tk_send_without_enc('selection', 'set', + tk_send_without_enc('selection', 'set', *(args.collect{|node| tagid(node)})) self end def selection_toggle(*args) - tk_send_without_enc('selection', 'toggle', + tk_send_without_enc('selection', 'toggle', *(args.collect{|node| tagid(node)})) self end @@ -264,7 +309,7 @@ class Tk::BWidget::Tree::Node TreeNode_TBL = TkCore::INTERP.create_table - (TreeNode_ID = ['bw:node'.freeze, '00000'.taint]).instance_eval{ + (TreeNode_ID = ['bw:node'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -298,7 +343,7 @@ class Tk::BWidget::Tree::Node @tree = tree.tree parent = tree.parent else - fail RuntimeError, + fail RuntimeError, "expect Tk::BWidget::Tree or Tk::BWidget::Tree::Node for 1st argument" end @@ -355,6 +400,9 @@ class Tk::BWidget::Tree::Node val end + def cget_tkstring(key) + @tree.itemcget_tkstring(@id, key) + end def cget(key) @tree.itemcget(@id, key) end @@ -450,4 +498,3 @@ class Tk::BWidget::Tree::Node @tree.visible(@id) end end - diff --git a/ext/tk/lib/tkextlib/itcl/incr_tcl.rb b/ext/tk/lib/tkextlib/itcl/incr_tcl.rb index 2b75d62eb9..8f6bb33abe 100644 --- a/ext/tk/lib/tkextlib/itcl/incr_tcl.rb +++ b/ext/tk/lib/tkextlib/itcl/incr_tcl.rb @@ -40,12 +40,12 @@ module Tk class ItclObject < TkObject ITCL_CLASSNAME = ''.freeze - (ITCL_OBJ_ID = ['itclobj'.freeze, '00000'.taint]).instance_eval{ + (ITCL_OBJ_ID = ['itclobj'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze } - ITCL_OBJ_TBL = {}.taint + ITCL_OBJ_TBL = TkUtil.untrust({}) def initialize(*args) if (@klass = self.class::ITCL_CLASSNAME).empty? diff --git a/ext/tk/lib/tkextlib/itcl/setup.rb b/ext/tk/lib/tkextlib/itcl/setup.rb index 5be0588703..70b38e4916 100644 --- a/ext/tk/lib/tkextlib/itcl/setup.rb +++ b/ext/tk/lib/tkextlib/itcl/setup.rb @@ -2,8 +2,8 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/itk/incr_tk.rb b/ext/tk/lib/tkextlib/itk/incr_tk.rb index e06deb552c..989585e33b 100644 --- a/ext/tk/lib/tkextlib/itk/incr_tk.rb +++ b/ext/tk/lib/tkextlib/itk/incr_tk.rb @@ -99,7 +99,7 @@ module Tk def itk_option_define(name, resource, klass, init, config=None) tk_call('itk_option', 'define', name, resource, klass, init, config) end - + def itk_option_remove(*args) tk_call('itk_option', 'remove', *args) end @@ -111,7 +111,7 @@ module Tk class Toplevel < Archetype TkCommandNames = ['::itk::Toplevel'].freeze WidgetClassName = 'Toplevel'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self include Wm include TkMenuSpec @@ -127,7 +127,7 @@ module Tk class Widget < Archetype TkCommandNames = ['::itk::Widget'].freeze WidgetClassName = 'Widget'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end @@ -146,7 +146,7 @@ module Tk ComponentID_TBL = TkCore::INTERP.create_table - (Itk_Component_ID = ['itk:component'.freeze, '00000'.taint]).instance_eval{ + (Itk_Component_ID = ['itk:component'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -192,7 +192,7 @@ module Tk ComponentID_TBL.mutex.synchronize{ if ComponentID_TBL.key?(master) if ComponentID_TBL[master].key?(component) - return ComponentID_TBL[master][component] + return ComponentID_TBL[master][component] end else ComponentID_TBL[master] = {} diff --git a/ext/tk/lib/tkextlib/itk/setup.rb b/ext/tk/lib/tkextlib/itk/setup.rb index e47b64adae..544926efe0 100644 --- a/ext/tk/lib/tkextlib/itk/setup.rb +++ b/ext/tk/lib/tkextlib/itk/setup.rb @@ -2,8 +2,8 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb index 05d58c386f..91e06d1b52 100644 --- a/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/buttonbox.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Buttonbox TkCommandNames = ['::iwidgets::buttonbox'.freeze].freeze WidgetClassName = 'Buttonbox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -46,13 +46,14 @@ class Tk::Iwidgets::Buttonbox end end + alias buttoncget_tkstring itemcget_tkstring alias buttoncget itemcget alias buttoncget_strict itemcget_strict alias buttonconfigure itemconfigure alias buttonconfiginfo itemconfiginfo alias current_buttonconfiginfo current_itemconfiginfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/calendar.rb b/ext/tk/lib/tkextlib/iwidgets/calendar.rb index 8495f0e29b..a5478c7cc6 100644 --- a/ext/tk/lib/tkextlib/iwidgets/calendar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/calendar.rb @@ -16,11 +16,11 @@ end class Tk::Iwidgets::Calendar TkCommandNames = ['::iwidgets::calendar'.freeze].freeze WidgetClassName = 'Calendar'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() + [ - 'buttonforeground', 'outline', 'selectcolor', + 'buttonforeground', 'outline', 'selectcolor', 'weekdaybackground', 'weekendbackground' ] end diff --git a/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb b/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb index fa5e90ad05..398eec3f1a 100644 --- a/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/canvasprintbox.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Canvasprintbox TkCommandNames = ['::iwidgets::canvasprintbox'.freeze].freeze WidgetClassName = 'Canvasprintbox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'filename' diff --git a/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb b/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb index bbf507677c..e64d8154ca 100644 --- a/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb +++ b/ext/tk/lib/tkextlib/iwidgets/canvasprintdialog.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Canvasprintdialog TkCommandNames = ['::iwidgets::canvasprintdialog'.freeze].freeze WidgetClassName = 'Canvasprintdialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def get_output tk_call(@path, 'getoutput') diff --git a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb index c85d356c55..a7476c824e 100644 --- a/ext/tk/lib/tkextlib/iwidgets/checkbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/checkbox.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Checkbox TkCommandNames = ['::iwidgets::checkbox'.freeze].freeze WidgetClassName = 'Checkbox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -46,13 +46,14 @@ class Tk::Iwidgets::Checkbox end end + alias buttoncget_tkstring itemcget_tkstring alias buttoncget itemcget alias buttoncget_strict itemcget_strict alias buttonconfigure itemconfigure alias buttonconfiginfo itemconfiginfo alias current_buttonconfiginfo current_itemconfiginfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/combobox.rb b/ext/tk/lib/tkextlib/iwidgets/combobox.rb index a6d54d78fa..82dcf25d0b 100644 --- a/ext/tk/lib/tkextlib/iwidgets/combobox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/combobox.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Combobox TkCommandNames = ['::iwidgets::combobox'.freeze].freeze WidgetClassName = 'Combobox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'completion' << 'dropdown' << 'editable' << 'unique' diff --git a/ext/tk/lib/tkextlib/iwidgets/dateentry.rb b/ext/tk/lib/tkextlib/iwidgets/dateentry.rb index 0a8897f50d..98a0051e55 100644 --- a/ext/tk/lib/tkextlib/iwidgets/dateentry.rb +++ b/ext/tk/lib/tkextlib/iwidgets/dateentry.rb @@ -16,5 +16,5 @@ end class Tk::Iwidgets::Dateentry TkCommandNames = ['::iwidgets::dateentry'.freeze].freeze WidgetClassName = 'Dateentry'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/iwidgets/datefield.rb b/ext/tk/lib/tkextlib/iwidgets/datefield.rb index 632f3334dc..50d5405a3b 100644 --- a/ext/tk/lib/tkextlib/iwidgets/datefield.rb +++ b/ext/tk/lib/tkextlib/iwidgets/datefield.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Datefield TkCommandNames = ['::iwidgets::datefield'.freeze].freeze WidgetClassName = 'Datefield'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'gmt' diff --git a/ext/tk/lib/tkextlib/iwidgets/dialog.rb b/ext/tk/lib/tkextlib/iwidgets/dialog.rb index 8540eae1b5..2d554ca7b5 100644 --- a/ext/tk/lib/tkextlib/iwidgets/dialog.rb +++ b/ext/tk/lib/tkextlib/iwidgets/dialog.rb @@ -16,5 +16,5 @@ end class Tk::Iwidgets::Dialog TkCommandNames = ['::iwidgets::dialog'.freeze].freeze WidgetClassName = 'Dialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb index 8d43cc07ab..e880594532 100644 --- a/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb +++ b/ext/tk/lib/tkextlib/iwidgets/dialogshell.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Dialogshell TkCommandNames = ['::iwidgets::dialogshell'.freeze].freeze WidgetClassName = 'Dialogshell'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -46,13 +46,14 @@ class Tk::Iwidgets::Dialogshell end end + alias buttoncget_tkstring itemcget_tkstring alias buttoncget itemcget alias buttoncget_strict itemcget_strict alias buttonconfigure itemconfigure alias buttonconfiginfo itemconfiginfo alias current_buttonconfiginfo current_itemconfiginfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb index 9bc063ba69..07ab025cdf 100644 --- a/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/disjointlistbox.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Disjointlistbox TkCommandNames = ['::iwidgets::disjointlistbox'.freeze].freeze WidgetClassName = 'Disjointlistbox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'lhslabeltext' << 'rhslabeltext' << 'lhsbuttonlabel' << 'rhsbuttonlabel' diff --git a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb index d53df216bf..3e7149a662 100644 --- a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb +++ b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Entryfield TkCommandNames = ['::iwidgets::entryfield'.freeze].freeze WidgetClassName = 'Entryfield'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __font_optkeys super() << 'textfont' @@ -30,16 +30,16 @@ class Tk::Iwidgets::Entryfield class EntryfieldValidate < TkValidateCommand #class CalCmdArgs < TkUtil::CallbackSubst class ValidateArgs < TkUtil::CallbackSubst - KEY_TBL = [ - [ ?c, ?s, :char ], - [ ?P, ?s, :post ], - [ ?S, ?s, :current ], - [ ?W, ?w, :widget ], + KEY_TBL = [ + [ ?c, ?s, :char ], + [ ?P, ?s, :post ], + [ ?S, ?s, :current ], + [ ?W, ?w, :widget ], nil ] - PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + PROC_TBL = [ + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] diff --git a/ext/tk/lib/tkextlib/iwidgets/extbutton.rb b/ext/tk/lib/tkextlib/iwidgets/extbutton.rb index 158d9d474a..e744fba91a 100644 --- a/ext/tk/lib/tkextlib/iwidgets/extbutton.rb +++ b/ext/tk/lib/tkextlib/iwidgets/extbutton.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Extbutton TkCommandNames = ['::iwidgets::extbutton'.freeze].freeze WidgetClassName = 'Extbutton'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'bitmapforeground' << 'ringbackground' diff --git a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb index 501f4c90a0..2ff15bb509 100644 --- a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb @@ -16,11 +16,11 @@ end class Tk::Iwidgets::Extfileselectionbox TkCommandNames = ['::iwidgets::extfileselectionbox'.freeze].freeze WidgetClassName = 'Extfileselectionbox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() + [ - 'dirslabel', 'fileslabel', 'filterlabel', 'mask', 'nomatchstring', + 'dirslabel', 'fileslabel', 'filterlabel', 'mask', 'nomatchstring', 'selectionlabel' ] end diff --git a/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb b/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb index 14388be7c4..509fdcf636 100644 --- a/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb +++ b/ext/tk/lib/tkextlib/iwidgets/extfileselectiondialog.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Extfileselectiondialog TkCommandNames = ['::iwidgets::extfileselectiondialog'.freeze].freeze WidgetClassName = 'Extfileselectiondialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def child_site window(tk_call(@path, 'childsite')) diff --git a/ext/tk/lib/tkextlib/iwidgets/feedback.rb b/ext/tk/lib/tkextlib/iwidgets/feedback.rb index 0a25237a24..29d04c8a5d 100644 --- a/ext/tk/lib/tkextlib/iwidgets/feedback.rb +++ b/ext/tk/lib/tkextlib/iwidgets/feedback.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Feedback TkCommandNames = ['::iwidgets::feedback'.freeze].freeze WidgetClassName = 'Feedback'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'barcolor' diff --git a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb index 7b331d0b40..a425b53b5f 100644 --- a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb @@ -16,11 +16,11 @@ end class Tk::Iwidgets::Fileselectionbox TkCommandNames = ['::iwidgets::fileselectionbox'.freeze].freeze WidgetClassName = 'Fileselectionbox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() + [ - 'directory', 'dirslabel', 'fileslabel', 'filterlabel', 'mask', + 'directory', 'dirslabel', 'fileslabel', 'filterlabel', 'mask', 'nomatchstring', 'selectionlabel' ] end diff --git a/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb b/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb index 50f459e56d..ebcdaf8c0b 100644 --- a/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb +++ b/ext/tk/lib/tkextlib/iwidgets/fileselectiondialog.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Fileselectiondialog TkCommandNames = ['::iwidgets::fileselectiondialog'.freeze].freeze WidgetClassName = 'Fileselectiondialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def child_site window(tk_call(@path, 'childsite')) diff --git a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb index 75e219c37e..3d522e07c8 100644 --- a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb +++ b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb @@ -16,11 +16,11 @@ end class Tk::Iwidgets::Finddialog TkCommandNames = ['::iwidgets::finddialog'.freeze].freeze WidgetClassName = 'Finddialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() + [ - 'patternbackground', 'patternforeground', + 'patternbackground', 'patternforeground', 'searchbackground', 'searchforeground' ] end diff --git a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb index d9220fecbf..cb9301d0c9 100644 --- a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb +++ b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb @@ -20,7 +20,7 @@ class Tk::Iwidgets::Hierarchy TkCommandNames = ['::iwidgets::hierarchy'.freeze].freeze WidgetClassName = 'Hierarchy'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -64,15 +64,15 @@ class Tk::Iwidgets::Hierarchy class IndicatorCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst - KEY_TBL = [ - [ ?n, ?s, :node ], - [ ?s, ?b, :status ], + KEY_TBL = [ + [ ?n, ?s, :node ], + [ ?s, ?b, :status ], nil ] - PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?b, TkComm.method(:bool) ], + PROC_TBL = [ + [ ?s, TkComm.method(:string) ], + [ ?b, TkComm.method(:bool) ], nil ] @@ -109,9 +109,9 @@ class Tk::Iwidgets::Hierarchy class IconCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst - KEY_TBL = [ - [ ?n, ?s, :node ], - [ ?i, ?s, :icon ], + KEY_TBL = [ + [ ?n, ?s, :node ], + [ ?i, ?s, :icon ], nil ] PROC_TBL = [ [ ?s, TkComm.method(:string) ], nil ] @@ -270,7 +270,7 @@ class Tk::Iwidgets::Hierarchy end def compare(idx1, op, idx2) - bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), + bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), op, _get_eval_enc_str(idx2))) end diff --git a/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb b/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb index 77b0e090cd..d4ea1aac65 100644 --- a/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb +++ b/ext/tk/lib/tkextlib/iwidgets/hyperhelp.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Hyperhelp TkCommandNames = ['::iwidgets::hyperhelp'.freeze].freeze WidgetClassName = 'Hyperhelp'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helpdir' diff --git a/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb b/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb index e77e85045d..6595398427 100644 --- a/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb +++ b/ext/tk/lib/tkextlib/iwidgets/labeledframe.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Labeledframe TkCommandNames = ['::iwidgets::labeledframe'.freeze].freeze WidgetClassName = 'Labeledframe'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'labeltext' diff --git a/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb b/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb index 99387710cb..d36d42878d 100644 --- a/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb +++ b/ext/tk/lib/tkextlib/iwidgets/labeledwidget.rb @@ -18,7 +18,7 @@ class Tk::Iwidgets::Labeledwidget TkCommandNames = ['::iwidgets::labeledwidget'.freeze].freeze WidgetClassName = 'Labeledwidget'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'labeltext' diff --git a/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb b/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb index 4b2541b997..ebf48021db 100644 --- a/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb +++ b/ext/tk/lib/tkextlib/iwidgets/mainwindow.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Mainwindow TkCommandNames = ['::iwidgets::mainwindow'.freeze].freeze WidgetClassName = 'Mainwindow'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'helpline' << 'statusline' diff --git a/ext/tk/lib/tkextlib/iwidgets/menubar.rb b/ext/tk/lib/tkextlib/iwidgets/menubar.rb index 5aaefbe50d..f9a17d0b55 100644 --- a/ext/tk/lib/tkextlib/iwidgets/menubar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/menubar.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Menubar TkCommandNames = ['::iwidgets::menubar'.freeze].freeze WidgetClassName = 'Menubar'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'menubuttons' @@ -61,13 +61,14 @@ class Tk::Iwidgets::Menubar end end + alias menucget_tkstring itemcget_tkstring alias menucget itemcget alias menucget_strict itemcget_strict alias menuconfigure itemconfigure alias menuconfiginfo itemconfiginfo alias current_menuconfiginfo current_itemconfiginfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb index 98ac32900c..6adb53d941 100644 --- a/ext/tk/lib/tkextlib/iwidgets/messagebox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/messagebox.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Messagebox TkCommandNames = ['::iwidgets::messagebox'.freeze].freeze WidgetClassName = 'Messagebox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -46,13 +46,14 @@ class Tk::Iwidgets::Messagebox end private :__item_boolval_optkeys + alias typecget_tkstring itemcget_tkstring alias typecget itemcget alias typecget_strict itemcget_strict alias typeconfigure itemconfigure alias typeconfiginfo itemconfiginfo alias current_typeconfiginfo current_itemconfiginfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/messagedialog.rb b/ext/tk/lib/tkextlib/iwidgets/messagedialog.rb index c19b83e517..9aa590056f 100644 --- a/ext/tk/lib/tkextlib/iwidgets/messagedialog.rb +++ b/ext/tk/lib/tkextlib/iwidgets/messagedialog.rb @@ -16,5 +16,5 @@ end class Tk::Iwidgets::Messagedialog TkCommandNames = ['::iwidgets::messagedialog'.freeze].freeze WidgetClassName = 'Messagedialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/iwidgets/notebook.rb b/ext/tk/lib/tkextlib/iwidgets/notebook.rb index 03b50633df..7ed4126a4d 100644 --- a/ext/tk/lib/tkextlib/iwidgets/notebook.rb +++ b/ext/tk/lib/tkextlib/iwidgets/notebook.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Notebook TkCommandNames = ['::iwidgets::notebook'.freeze].freeze WidgetClassName = 'Notebook'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -41,13 +41,14 @@ class Tk::Iwidgets::Notebook end end + alias pagecget_tkstring itemcget_tkstring alias pagecget itemcget alias pagecget_strict itemcget_strict alias pageconfigure itemconfigure alias pageconfiginfo itemconfiginfo alias current_pageconfiginfo current_itemconfiginfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb b/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb index 0c74440be7..57a3cc7d2b 100644 --- a/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb +++ b/ext/tk/lib/tkextlib/iwidgets/optionmenu.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Optionmenu TkCommandNames = ['::iwidgets::optionmenu'.freeze].freeze WidgetClassName = 'Optionmenu'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'cyclicon' diff --git a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb index 3bf73d69fe..65463cc85a 100644 --- a/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb +++ b/ext/tk/lib/tkextlib/iwidgets/panedwindow.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Panedwindow TkCommandNames = ['::iwidgets::panedwindow'.freeze].freeze WidgetClassName = 'Panedwindow'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -41,13 +41,14 @@ class Tk::Iwidgets::Panedwindow end end + alias panecget_tkstring itemcget_tkstring alias panecget itemcget alias panecget_strict itemcget_strict alias paneconfigure itemconfigure alias paneconfiginfo itemconfiginfo alias current_paneconfiginfo current_itemconfiginfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb b/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb index 620b14b5d5..7c7ff7ad62 100644 --- a/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb +++ b/ext/tk/lib/tkextlib/iwidgets/promptdialog.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Promptdialog TkCommandNames = ['::iwidgets::promptdialog'.freeze].freeze WidgetClassName = 'Promptdialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self # index method is not available, because it shows index of the entry field def default(name) diff --git a/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb b/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb index c21007ca6c..ae56788289 100644 --- a/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb +++ b/ext/tk/lib/tkextlib/iwidgets/pushbutton.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Pushbutton TkCommandNames = ['::iwidgets::pushbutton'.freeze].freeze WidgetClassName = 'Pushbutton'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'defaultring' diff --git a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb index e9d9521252..21181777b5 100644 --- a/ext/tk/lib/tkextlib/iwidgets/radiobox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/radiobox.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Radiobox TkCommandNames = ['::iwidgets::radiobox'.freeze].freeze WidgetClassName = 'Radiobox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -46,13 +46,14 @@ class Tk::Iwidgets::Radiobox end end + alias buttoncget_tkstring itemcget_tkstring alias buttoncget itemcget alias buttoncget_strict itemcget_strict alias buttonconfigure itemconfigure alias buttonconfiginfo itemconfiginfo alias current_buttonconfiginfo current_itemconfiginfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/scopedobject.rb b/ext/tk/lib/tkextlib/iwidgets/scopedobject.rb index bddef50841..056cd85322 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scopedobject.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scopedobject.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Scopedobject TkCommandNames = ['::iwidgets::scopedobject'.freeze].freeze WidgetClassName = 'Scopedobject'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def initialize(obj_name, keys={}) @path = tk_call(self.class::TkCommandNames[0], obj_name, *hash_kv(keys)) diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb index 67ad67d07e..935e04bbcc 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb @@ -17,7 +17,7 @@ end class Tk::Iwidgets::Scrolledcanvas TkCommandNames = ['::iwidgets::scrolledcanvas'.freeze].freeze WidgetClassName = 'Scrolledcanvas'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self ################################ @@ -103,7 +103,7 @@ class Tk::Iwidgets::Scrolledcanvas end def bbox(tagOrId, *tags) - list(tk_send_without_enc('bbox', tagid(tagOrId), + list(tk_send_without_enc('bbox', tagid(tagOrId), *tags.collect{|t| tagid(t)})) end @@ -165,7 +165,7 @@ class Tk::Iwidgets::Scrolledcanvas end def dchars(tag, first, last=None) - tk_send_without_enc('dchars', tagid(tag), + tk_send_without_enc('dchars', tagid(tag), _get_eval_enc_str(first), _get_eval_enc_str(last)) self end @@ -176,7 +176,7 @@ class Tk::Iwidgets::Scrolledcanvas tbl = TkcItem::CItemID_TBL[self.path] } if tbl - find('withtag', *args).each{|item| + find('withtag', *args).each{|item| if item.kind_of?(TkcItem) TkcItem::CItemID_TBL.mutex.synchronize{ tbl.delete(item.id) @@ -195,7 +195,7 @@ class Tk::Iwidgets::Scrolledcanvas end def find(mode, *args) - list(tk_send_without_enc('find', mode, *args)).collect!{|id| + list(tk_send_without_enc('find', mode, *args)).collect!{|id| TkcItem.id2obj(self, id) } end @@ -251,7 +251,7 @@ class Tk::Iwidgets::Scrolledcanvas end def insert(tagOrId, index, string) - tk_send_without_enc('insert', tagid(tagOrId), index, + tk_send_without_enc('insert', tagid(tagOrId), index, _get_eval_enc_str(string)) self end diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb index 8b47460357..7b7b95df1c 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledframe.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Scrolledframe TkCommandNames = ['::iwidgets::scrolledframe'.freeze].freeze WidgetClassName = 'Scrolledframe'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def child_site window(tk_call(@path, 'childsite')) diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb index 9b69ef07fe..dc2966bd48 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledhtml.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Scrolledhtml TkCommandNames = ['::iwidgets::scrolledhtml'.freeze].freeze WidgetClassName = 'Scrolledhtml'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'update' diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb index 7543d557e3..20a4cd1d36 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb @@ -17,7 +17,7 @@ end class Tk::Iwidgets::Scrolledlistbox TkCommandNames = ['::iwidgets::scrolledlistbox'.freeze].freeze WidgetClassName = 'Scrolledlistbox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'textbackground' @@ -141,7 +141,7 @@ class Tk::Iwidgets::Scrolledlistbox def get(first, last=nil) if last # tk_split_simplelist(_fromUTF8(tk_send_without_enc('get', first, last))) - tk_split_simplelist(tk_send_without_enc('get', first, last), + tk_split_simplelist(tk_send_without_enc('get', first, last), false, true) else _fromUTF8(tk_send_without_enc('get', first)) diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb index d6436d202a..69b7d314fd 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb @@ -17,7 +17,7 @@ end class Tk::Iwidgets::Scrolledtext TkCommandNames = ['::iwidgets::scrolledtext'.freeze].freeze WidgetClassName = 'Scrolledtext'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'textbackground' @@ -86,7 +86,7 @@ class Tk::Iwidgets::Scrolledtext list(tk_send('bbox', index)) end def compare(idx1, op, idx2) - bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), + bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), op, _get_eval_enc_str(idx2))) end @@ -116,14 +116,18 @@ class Tk::Iwidgets::Scrolledtext get('-displaychars', *index) end + def image_cget_tkstring(index, slot) + _fromUTF8(tk_send_without_enc('image', 'cget', + _get_eval_enc_str(index), "-#{slot.to_s}")) + end def image_cget_strict(index, slot) case slot.to_s when 'text', 'label', 'show', 'data', 'file' - _fromUTF8(tk_send_without_enc('image', 'cget', + _fromUTF8(tk_send_without_enc('image', 'cget', _get_eval_enc_str(index), "-#{slot}")) else - tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget', - _get_eval_enc_str(index), + tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget', + _get_eval_enc_str(index), "-#{slot}"))) end end @@ -151,13 +155,13 @@ class Tk::Iwidgets::Scrolledtext def image_configure(index, slot, value=None) if slot.kind_of? Hash - _fromUTF8(tk_send_without_enc('image', 'configure', - _get_eval_enc_str(index), + _fromUTF8(tk_send_without_enc('image', 'configure', + _get_eval_enc_str(index), *hash_kv(slot, true))) else - _fromUTF8(tk_send_without_enc('image', 'configure', - _get_eval_enc_str(index), - "-#{slot}", + _fromUTF8(tk_send_without_enc('image', 'configure', + _get_eval_enc_str(index), + "-#{slot}", _get_eval_enc_str(value))) end self @@ -187,16 +191,16 @@ class Tk::Iwidgets::Scrolledtext else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -228,16 +232,16 @@ class Tk::Iwidgets::Scrolledtext else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -298,7 +302,7 @@ class Tk::Iwidgets::Scrolledtext def mark_gravity(mark, direction=nil) if direction - tk_send_without_enc('mark', 'gravity', + tk_send_without_enc('mark', 'gravity', _get_eval_enc_str(mark), direction) self else @@ -307,27 +311,27 @@ class Tk::Iwidgets::Scrolledtext end def mark_set(mark, index) - tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark), + tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark), _get_eval_enc_str(index)) self end alias set_mark mark_set def mark_unset(*marks) - tk_send_without_enc('mark', 'unset', + tk_send_without_enc('mark', 'unset', *(marks.collect{|mark| _get_eval_enc_str(mark)})) self end alias unset_mark mark_unset def mark_next(index) - tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'next', + tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'next', _get_eval_enc_str(index)))) end alias next_mark mark_next def mark_previous(index) - tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous', + tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous', _get_eval_enc_str(index)))) end alias previous_mark mark_previous @@ -354,11 +358,11 @@ class Tk::Iwidgets::Scrolledtext # $KCODE == 'NONE' if JAPANIZED_TK - tk_call_without_enc('kstring', 'length', + tk_call_without_enc('kstring', 'length', _get_eval_enc_str(txt)).to_i else begin - tk_call_without_enc('encoding', 'convertto', 'ascii', + tk_call_without_enc('encoding', 'convertto', 'ascii', _get_eval_enc_str(txt)).length rescue StandardError, NameError # sorry, I have no plan @@ -419,11 +423,11 @@ class Tk::Iwidgets::Scrolledtext pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 if pat.kind_of? String #return [index(start + " + #{pos} chars"), pat.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(match), match] end else @@ -437,11 +441,11 @@ class Tk::Iwidgets::Scrolledtext pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 if pat.kind_of? String #return [index(start + " + #{pos} chars"), pat.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(match), match] end else @@ -452,7 +456,7 @@ class Tk::Iwidgets::Scrolledtext pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 if pat.kind_of? String #return [index("1.0 + #{pos} chars"), pat.split('').length] - return [index("1.0 + #{pos} chars"), + return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index("1.0 + #{pos} chars"), $&.split('').length] diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledwidget.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledwidget.rb index eef093d314..5ecd2d72d2 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledwidget.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledwidget.rb @@ -16,5 +16,5 @@ end class Tk::Iwidgets::Scrolledwidget TkCommandNames = ['::iwidgets::scrolledwidget'.freeze].freeze WidgetClassName = 'Scrolledwidget'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb index bf9b5ec30a..eb8fe3ad52 100644 --- a/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/selectionbox.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Selectionbox TkCommandNames = ['::iwidgets::selectionbox'.freeze].freeze WidgetClassName = 'Selectionbox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'itemson' << 'selectionon' diff --git a/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb b/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb index f772ecf8c2..45aecf3266 100644 --- a/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb +++ b/ext/tk/lib/tkextlib/iwidgets/selectiondialog.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Selectiondialog TkCommandNames = ['::iwidgets::selectiondialog'.freeze].freeze WidgetClassName = 'Selectiondialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def child_site window(tk_call(@path, 'childsite')) diff --git a/ext/tk/lib/tkextlib/iwidgets/setup.rb b/ext/tk/lib/tkextlib/iwidgets/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/iwidgets/setup.rb +++ b/ext/tk/lib/tkextlib/iwidgets/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/iwidgets/shell.rb b/ext/tk/lib/tkextlib/iwidgets/shell.rb index dabf2e6f25..c560e3ac29 100644 --- a/ext/tk/lib/tkextlib/iwidgets/shell.rb +++ b/ext/tk/lib/tkextlib/iwidgets/shell.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Shell TkCommandNames = ['::iwidgets::shell'.freeze].freeze WidgetClassName = 'Shell'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def activate tk_call(@path, 'activate') # may return val of deactibate method diff --git a/ext/tk/lib/tkextlib/iwidgets/spindate.rb b/ext/tk/lib/tkextlib/iwidgets/spindate.rb index 2c98eb4629..b3de9ed989 100644 --- a/ext/tk/lib/tkextlib/iwidgets/spindate.rb +++ b/ext/tk/lib/tkextlib/iwidgets/spindate.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Spindate TkCommandNames = ['::iwidgets::spindate'.freeze].freeze WidgetClassName = 'Spindate'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'dayon' << 'monthon' << 'yearon' diff --git a/ext/tk/lib/tkextlib/iwidgets/spinint.rb b/ext/tk/lib/tkextlib/iwidgets/spinint.rb index 5eb944d081..bede3bb1bf 100644 --- a/ext/tk/lib/tkextlib/iwidgets/spinint.rb +++ b/ext/tk/lib/tkextlib/iwidgets/spinint.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Spinint TkCommandNames = ['::iwidgets::spinint'.freeze].freeze WidgetClassName = 'Spinint'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'wrap' diff --git a/ext/tk/lib/tkextlib/iwidgets/spinner.rb b/ext/tk/lib/tkextlib/iwidgets/spinner.rb index aeee5c9038..d960996e22 100644 --- a/ext/tk/lib/tkextlib/iwidgets/spinner.rb +++ b/ext/tk/lib/tkextlib/iwidgets/spinner.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Spinner TkCommandNames = ['::iwidgets::spinner'.freeze].freeze WidgetClassName = 'Spinner'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -25,16 +25,16 @@ class Tk::Iwidgets::Spinner class EntryfieldValidate < TkValidateCommand #class CalCmdArgs < TkUtil::CallbackSubst class ValidateArgs < TkUtil::CallbackSubst - KEY_TBL = [ - [ ?c, ?s, :char ], - [ ?P, ?s, :post ], - [ ?S, ?s, :current ], - [ ?W, ?w, :widget ], + KEY_TBL = [ + [ ?c, ?s, :char ], + [ ?P, ?s, :post ], + [ ?S, ?s, :current ], + [ ?W, ?w, :widget ], nil ] - PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + PROC_TBL = [ + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] diff --git a/ext/tk/lib/tkextlib/iwidgets/spintime.rb b/ext/tk/lib/tkextlib/iwidgets/spintime.rb index 0ff683ab56..20f8197a09 100644 --- a/ext/tk/lib/tkextlib/iwidgets/spintime.rb +++ b/ext/tk/lib/tkextlib/iwidgets/spintime.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Spintime TkCommandNames = ['::iwidgets::spintime'.freeze].freeze WidgetClassName = 'Spintime'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'houron' << 'militaryon' << 'minutelabel' << 'secondlabel' diff --git a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb index dbb90e5102..f56efa9aaf 100644 --- a/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb +++ b/ext/tk/lib/tkextlib/iwidgets/tabnotebook.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Tabnotebook TkCommandNames = ['::iwidgets::tabnotebook'.freeze].freeze WidgetClassName = 'Tabnotebook'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -46,13 +46,14 @@ class Tk::Iwidgets::Tabnotebook end end + alias pagecget_tkstring itemcget_tkstring alias pagecget itemcget alias pagecget_strict itemcget_strict alias pageconfigure itemconfigure alias pageconfiginfo itemconfiginfo alias current_pageconfiginfo current_itemconfiginfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### diff --git a/ext/tk/lib/tkextlib/iwidgets/tabset.rb b/ext/tk/lib/tkextlib/iwidgets/tabset.rb index 300ba9dee0..501ead4964 100644 --- a/ext/tk/lib/tkextlib/iwidgets/tabset.rb +++ b/ext/tk/lib/tkextlib/iwidgets/tabset.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Tabset TkCommandNames = ['::iwidgets::tabset'.freeze].freeze WidgetClassName = 'Tabset'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self #################################### @@ -41,13 +41,14 @@ class Tk::Iwidgets::Tabset end end + alias tabcget_tkstring itemcget_tkstring alias tabcget itemcget alias tabcget_strict itemcget_strict alias tabconfigure itemconfigure alias tabconfiginfo itemconfiginfo alias current_tabconfiginfo current_itemconfiginfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo #################################### @@ -116,9 +117,9 @@ class Tk::Iwidgets::Tabset return end tabs_size = @canvas.winfo_width - tab_start, tab_end = @canvas . - find_overlapping(head, 0, head + delta, @canvas.winfo_height) . - find_all{|id| @canvas.itemtype(id) == TkcPolygon} . + tab_start, tab_end = @canvas . + find_overlapping(head, 0, head + delta, @canvas.winfo_height) . + find_all{|id| @canvas.itemtype(id) == TkcPolygon} . map!{|id| bbox = @canvas.bbox(id); [bbox[0], bbox[2]]} . max when 'e', 'w' @@ -127,9 +128,9 @@ class Tk::Iwidgets::Tabset return end tabs_size = @canvas.winfo_height - tab_start, tab_end = @canvas . - find_overlapping(0, head, @canvas.winfo_width, head + delta) . - find_all{|id| @canvas.itemtype(id) == TkcPolygon} . + tab_start, tab_end = @canvas . + find_overlapping(0, head, @canvas.winfo_width, head + delta) . + find_all{|id| @canvas.itemtype(id) == TkcPolygon} . map!{|id| bbox = @canvas.bbox(id); [bbox[1], bbox[3]]} . max end diff --git a/ext/tk/lib/tkextlib/iwidgets/timeentry.rb b/ext/tk/lib/tkextlib/iwidgets/timeentry.rb index 588da77dc8..b0afb3afd9 100644 --- a/ext/tk/lib/tkextlib/iwidgets/timeentry.rb +++ b/ext/tk/lib/tkextlib/iwidgets/timeentry.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Timeentry TkCommandNames = ['::iwidgets::timeentry'.freeze].freeze WidgetClassName = 'Timeentry'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'closetext' diff --git a/ext/tk/lib/tkextlib/iwidgets/timefield.rb b/ext/tk/lib/tkextlib/iwidgets/timefield.rb index 28e1504797..c34281d4ff 100644 --- a/ext/tk/lib/tkextlib/iwidgets/timefield.rb +++ b/ext/tk/lib/tkextlib/iwidgets/timefield.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Timefield TkCommandNames = ['::iwidgets::timefield'.freeze].freeze WidgetClassName = 'Timefield'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'gmt' diff --git a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb index 17cfa62156..5b474c3816 100644 --- a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Toolbar TkCommandNames = ['::iwidgets::toolbar'.freeze].freeze WidgetClassName = 'Toolbar'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __tkvariable_optkeys super() << 'helpvariable' @@ -105,7 +105,7 @@ class Tk::Iwidgets::Toolbar else tag = Tk::Itk::Component.new(self) end - window(tk_call(@path, 'insert', index(idx), type, + window(tk_call(@path, 'insert', index(idx), type, tagid(tag), *hash_kv(keys))) tag end diff --git a/ext/tk/lib/tkextlib/iwidgets/watch.rb b/ext/tk/lib/tkextlib/iwidgets/watch.rb index ab2b687cf9..f10ec54cb2 100644 --- a/ext/tk/lib/tkextlib/iwidgets/watch.rb +++ b/ext/tk/lib/tkextlib/iwidgets/watch.rb @@ -16,7 +16,7 @@ end class Tk::Iwidgets::Watch TkCommandNames = ['::iwidgets::watch'.freeze].freeze WidgetClassName = 'Watch'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'showampm' @@ -24,7 +24,7 @@ class Tk::Iwidgets::Watch private :__boolval_optkeys def __strval_optkeys - super() << 'clockcolor' << 'hourcolor' << 'minutecolor' << + super() << 'clockcolor' << 'hourcolor' << 'minutecolor' << 'pivotcolor' << 'secondcolor' << 'tickcolor' end private :__strval_optkeys diff --git a/ext/tk/lib/tkextlib/pkg_checker.rb b/ext/tk/lib/tkextlib/pkg_checker.rb index 5002ed7ff8..ecc6bfa131 100755 --- a/ext/tk/lib/tkextlib/pkg_checker.rb +++ b/ext/tk/lib/tkextlib/pkg_checker.rb @@ -151,7 +151,7 @@ def subdir_check(dir, verbose=false) if err.empty? print 'Ready : ', path, ' : require->', suc.inspect, "\n" else - print '*LACK : ', path, ' : require->', suc.inspect, + print '*LACK : ', path, ' : require->', suc.inspect, ' FAIL->', err.inspect, "\n" end end @@ -176,7 +176,7 @@ Dir.chdir(dir) if err.empty? print 'Ready : ', f, ' : require->', suc.inspect, "\n" else - print '*LACK : ', f, ' : require->', suc.inspect, + print '*LACK : ', f, ' : require->', suc.inspect, ' FAIL->', err.inspect, "\n" end diff --git a/ext/tk/lib/tkextlib/setup.rb b/ext/tk/lib/tkextlib/setup.rb index 12867e8f9c..79facc5ee3 100644 --- a/ext/tk/lib/tkextlib/setup.rb +++ b/ext/tk/lib/tkextlib/setup.rb @@ -1,8 +1,8 @@ # # setup.rb -- setup script before using Tk extension libraries # -# If you need some setup operations for Tk extensions (for example, -# modify the dynamic library path) required, please write the setup -# operations in this file. This file is required at the last of -# "require 'tk'". +# If you need some setup operations for Tk extensions (for example, +# modify the dynamic library path) required, please write the setup +# operations in this file. This file is required at the last of +# "require 'tk'". # diff --git a/ext/tk/lib/tkextlib/tcllib.rb b/ext/tk/lib/tkextlib/tcllib.rb index c6138f4275..2831989759 100644 --- a/ext/tk/lib/tkextlib/tcllib.rb +++ b/ext/tk/lib/tkextlib/tcllib.rb @@ -42,19 +42,25 @@ module Tk module Tcllib TkComm::TkExtlibAutoloadModule.unshift(self) + # package:: autoscroll + autoload :Autoscroll, 'tkextlib/tcllib/autoscroll' + # package:: ctext autoload :CText, 'tkextlib/tcllib/ctext' + # package:: cursor + autoload :Cursor, 'tkextlib/tcllib/cursor' + + # package:: datefield + autoload :Datefield, 'tkextlib/tcllib/datefield' + autoload :DateField, 'tkextlib/tcllib/datefield' + # package:: getstring autoload :GetString_Dialog, 'tkextlib/tcllib/getstring' # package:: history autoload :History, 'tkextlib/tcllib/history' - # package:: datefield - autoload :Datefield, 'tkextlib/tcllib/datefield' - autoload :DateField, 'tkextlib/tcllib/datefield' - # package:: ico autoload :ICO, 'tkextlib/tcllib/ico' @@ -62,12 +68,21 @@ module Tk autoload :IP_Entry, 'tkextlib/tcllib/ip_entry' autoload :IPEntry, 'tkextlib/tcllib/ip_entry' - # package:: swaplist - autoload :Swaplist_Dialog, 'tkextlib/tcllib/swaplist' + # package:: khim + autoload :KHIM, 'tkextlib/tcllib/khim' + + # package:: ntext + autoload :Ntext, 'tkextlib/tcllib/ntext' # package:: Plotchart autoload :Plotchart, 'tkextlib/tcllib/plotchart' + # package:: style + autoload :Style, 'tkextlib/tcllib/style' + + # package:: swaplist + autoload :Swaplist_Dialog, 'tkextlib/tcllib/swaplist' + # package:: tablelist autoload :Tablelist, 'tkextlib/tcllib/tablelist' autoload :TableList, 'tkextlib/tcllib/tablelist' @@ -81,7 +96,7 @@ module Tk autoload :Tooltip, 'tkextlib/tcllib/tooltip' # package:: widget - autoload :Wdiget, 'tkextlib/tcllib/widget' + autoload :Widget, 'tkextlib/tcllib/widget' end end diff --git a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb index 7db3c2e2b7..2def59bf73 100644 --- a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb +++ b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb @@ -7,20 +7,20 @@ # # (The following is the original description of the library.) # -# This package allows scrollbars to be mapped and unmapped as needed -# depending on the size and content of the scrollbars scrolled widget. -# The scrollbar must be managed by either pack or grid, other geometry +# This package allows scrollbars to be mapped and unmapped as needed +# depending on the size and content of the scrollbars scrolled widget. +# The scrollbar must be managed by either pack or grid, other geometry # managers are not supported. # -# When managed by pack, any geometry changes made in the scrollbars parent -# between the time a scrollbar is unmapped, and when it is mapped will be -# lost. It is an error to destroy any of the scrollbars siblings while the -# scrollbar is unmapped. When managed by grid, if anything becomes gridded -# in the same row and column the scrollbar occupied it will be replaced by +# When managed by pack, any geometry changes made in the scrollbars parent +# between the time a scrollbar is unmapped, and when it is mapped will be +# lost. It is an error to destroy any of the scrollbars siblings while the +# scrollbar is unmapped. When managed by grid, if anything becomes gridded +# in the same row and column the scrollbar occupied it will be replaced by # the scrollbar when remapped. # -# This package may be used on any scrollbar-like widget as long as it -# supports the set subcommand in the same style as scrollbar. If the set +# This package may be used on any scrollbar-like widget as long as it +# supports the set subcommand in the same style as scrollbar. If the set # subcommand is not used then this package will have no effect. # @@ -110,14 +110,14 @@ end class Tk::Scrollbar def autoscroll - # Arranges for the already existing scrollbar to be mapped + # Arranges for the already existing scrollbar to be mapped # and unmapped as needed. #tk_call_without_enc('::autoscroll::autoscroll', @path) Tk::Tcllib::Autoscroll.autoscroll(self) self end def unautoscroll - # Returns the scrollbar to its original static state. + # Returns the scrollbar to its original static state. #tk_call_without_enc('::autoscroll::unautoscroll', @path) Tk::Tcllib::Autoscroll.unautoscroll(self) self diff --git a/ext/tk/lib/tkextlib/tcllib/calendar.rb b/ext/tk/lib/tkextlib/tcllib/calendar.rb new file mode 100644 index 0000000000..b6843df176 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/calendar.rb @@ -0,0 +1,55 @@ +# +# tkextlib/tcllib/calendar.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * calendar widget +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::calendar', '0.9') +TkPackage.require('widget::calendar') + +module Tk::Tcllib + module Widget + class Calendar < TkCanvas + PACKAGE_NAME = 'widget::calendar'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::calendar') + rescue + '' + end + end + end + end +end + +class Tk::Tcllib::Widget::Calendar + TkCommandNames = ['::widget::calendar'.freeze].freeze + + def __boolval_optkeys + super() << 'showpast' + end + private :__boolval_optkeys + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def get(what = 'all') + tk_send('get', what) + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/canvas_sqmap.rb b/ext/tk/lib/tkextlib/tcllib/canvas_sqmap.rb new file mode 100644 index 0000000000..0bd59511c1 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/canvas_sqmap.rb @@ -0,0 +1,36 @@ +# +# tkextlib/tcllib/canvas.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::canvas_sqmap', '0.2') +TkPackage.require('widget::canvas_sqmap') + +module Tk::Tcllib + module Widget + class Canvas_Sqmap < Canvas + TkCommandNames = ['::widget::canvas_sqmap'.freeze].freeze + + def image_set(cell, img) + tk_send('image', 'set', cell, img) + self + end + + def image_unset(cell) + tk_send('image', 'unset', cell) + self + end + + def flush + tk_send('flush') + self + end + end + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/canvas_zoom.rb b/ext/tk/lib/tkextlib/tcllib/canvas_zoom.rb new file mode 100644 index 0000000000..e2a5061112 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/canvas_zoom.rb @@ -0,0 +1,21 @@ +# +# tkextlib/tcllib/canvas.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::canvas_zoom', '0.1') +TkPackage.require('widget::canvas_zoom') + +module Tk::Tcllib + module Widget + class Canvas_Zoom < Canvas + TkCommandNames = ['::widget::canvas_zoom'.freeze].freeze + end + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/chatwidget.rb b/ext/tk/lib/tkextlib/tcllib/chatwidget.rb new file mode 100644 index 0000000000..860b9e899b --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/chatwidget.rb @@ -0,0 +1,151 @@ +# +# tkextlib/tcllib/chatwidget.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * chatwidget - Provides a multi-paned view suitable for display of +# chat room or irc channel information +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('chatwidget', '1.1.0') +TkPackage.require('chatwidget') + +module Tk::Tcllib + class ChatWidget < TkText + PACKAGE_NAME = 'chatwidget'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('chatwidget') + rescue + '' + end + end + end +end + +class Tk::Tcllib::ChatWidget + TkCommandNames = ['::chatwidget::chatwidget'.freeze].freeze + + def show_topic + tk_send_without_enc('topic', 'show') + self + end + + def hide_topic + tk_send_without_enc('topic', 'hide') + self + end + + def set_topic(topic) + tk_send('topic', 'set', topic) + end + + def list_name + tk_split_simplelist(tk_send('name', 'list')) + end + + def list_name_full + tk_split_simplelist(tk_send('name', 'list')).map{|lst| + nick, *opts = tk_split_simplelist(lst) + h_opt = {} + opts.slice(2){|k, v| h_opt[k[1..-1]] = tk_tcl2ruby(v)} + [nick, h_opt] + } + end + + def add_name(nick, opts={}) + tk_send('name', 'add', nick, *(hash_kv(opts))) + end + + def delete_name(nick) + tk_send('name', 'delete', nick) + end + + def get_name(nick) + lst = tk_send('name', 'get', nick) + return nil if lst.empty? + nick, *opts = tk_split_simplelist(lst) + h_opt = {} + opts.slice(2){|k, v| h_opt[k[1..-1]] = tk_tcl2ruby(v)} + [nick, h_opt] + end + + def message(msg, opts={}) + tk_send('message', msg, *(hash_kv(opts))) + self + end + + def _parse_hook_list(lst) + tk_split_simplelist(lst).map{|hook| + cmd, prior = tk_split_simplelist(hook) + [procedure(cmd), number(prior)] + } + end + private :_parse_hook_list + + def hook_add(type, *args, &blk) # args -> [prior, cmd], [prior], [cmd] + #type -> 'message', 'post', 'names_group', 'names_nick', 'chatstate', 'url' + + if prior = args.shift + if !prior.kind_of?(Numeric) + cmd = prior + if (prior = args.shift) && !prior.kind_of?(Numeric) # error + args.unshift(prior) + end + args.unshift(cmd) + end + prior ||= 50 # default priority + end + + cmd = args.shift || blk + + fail ArgumentError, "invalid arguments" unless args.empty? + fail ArgumentError, "no callback is given" unless cmd + + _parse_hook_list(tk_send('hook', 'add', type, cmd, prior)) + end + + def hook_remove(type, cmd) + #type -> 'message', 'post', 'names_group', 'names_nick', 'chatstate', 'url' + _parse_hook_list(tk_send('hook', 'remove', type, cmd)) + end + + def hook_run(type, *cmd_args) + #type -> 'message', 'post', 'names_group', 'names_nick', 'chatstate', 'url' + tk_send('hook', 'run', type, *cmd_args) + end + + def hook_list(type) + #type -> 'message', 'post', 'names_group', 'names_nick', 'chatstate', 'url' + _parse_hook_list(tk_send('hook', 'list', type)) + end + + def show_names + tk_send('names', 'show') + self + end + + def hide_names + tk_send('names', 'hide') + self + end + + def names_widget + window(tk_send('names')) + end + + def entry_widget + window(tk_send('entry')) + end + + def chat_widget + window(tk_send('chat')) + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/crosshair.rb b/ext/tk/lib/tkextlib/tcllib/crosshair.rb new file mode 100644 index 0000000000..49b5361e4f --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/crosshair.rb @@ -0,0 +1,117 @@ +# +# tkextlib/tcllib/crosshair.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * Crosshairs for Tk canvas +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('crosshair', '1.0.2') +TkPackage.require('crosshair') + +module Tk::Tcllib + module Crosshair + PACKAGE_NAME = 'crosshair'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('crosshair') + rescue + '' + end + end + end +end + +module Tk::Tcllib::Crosshair + include TkCore + TkCommandNames = ['::crosshair::crosshair'.freeze].freeze + + def self.crosshair(w, keys={}) + Tk.tk_call('::crosshair::crosshair', w, *hash_kv(keys)) + w + end + def self.on(w, keys={}) + self.crosshair(w, keys) + end + + def self.off(w) + Tk.tk_call('::crosshair::off', w) + w + end + + def self.track_on(w, &b) + Tk.tk_call('::crosshair::track_on', w, b) + w + end + + def self.track_off(w) + Tk.tk_call('::crosshair::track_off', w) + w + end +end + +class << Tk::Tcllib::Crosshair + include TkComm + include TkCanvasItemConfig + + def __item_methodcall_optkeys(id) + {} + end + private :__item_methodcall_optkeys + + def __item_config_cmd(id) + # maybe need to override + ['::crosshair::configure', id] + end + private :__item_config_cmd + + private :itemcget_tkstring, :itemcget, :itemcget_strict + private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo + + def confugure(w, slot, value=None) + itemconfigure(w, slot, value) + end + def confuginfo(w, slot = nil) + itemconfiginfo(w, slot) + end + def current_configinfo(w, slot = nil) + current_itemconfiginfo(w, slot) + end + def cget(w, slot) + current_itemconfiginfo(w, slot).values[0] + end +end + +module Tk::Tcllib::Crosshair + def crosshair_on(keys={}) + Tk::Tcllib::Crosshair.on(self, keys) + end + def crosshair_off + Tk::Tcllib::Crosshair.off(self) + end + def crosshair_track_on(&b) + Tk::Tcllib::Crosshair.track_on(self, &b) + end + def crosshair_track_off + Tk::Tcllib::Crosshair.track_off(self) + end + def crosshair_configure(*args) + Tk::Tcllib::Crosshair.configure(self, *args) + end + def crosshair_configinfo(slot = nil) + Tk::Tcllib::Crosshair.configinfo(self, slot) + end + def crosshair_current_configinfo(slot = nil) + Tk::Tcllib::Crosshair.current_configinfo(self, slot) + end + def crosshair_cget(slot) + Tk::Tcllib::Crosshair.cget(self, slot) + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/ctext.rb b/ext/tk/lib/tkextlib/tcllib/ctext.rb index 9014037f3d..308847c233 100644 --- a/ext/tk/lib/tkextlib/tcllib/ctext.rb +++ b/ext/tk/lib/tkextlib/tcllib/ctext.rb @@ -35,11 +35,11 @@ end class Tk::Tcllib::CText TkCommandNames = ['ctext'.freeze].freeze WidgetClassName = 'Ctext'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -48,7 +48,7 @@ class Tk::Tcllib::CText private :create_self def __strval_optkeys - super() << 'linemapfg' << 'linemapbg' << + super() << 'linemapfg' << 'linemapbg' << 'linemap_select_fg' << 'linemap_select_bg' end private :__strval_optkeys @@ -96,19 +96,19 @@ class Tk::Tcllib::CText end def add_highlight_class_for_special_chars(klass, col, *chrs) - tk_call('ctext::addHighlightClassForSpecialChars', + tk_call('ctext::addHighlightClassForSpecialChars', @path, klass, col, chrs.join('')) self end def add_highlight_class_for_regexp(klass, col, tcl_regexp) - tk_call('ctext::addHighlightClassForRegexp', + tk_call('ctext::addHighlightClassForRegexp', @path, klass, col, tcl_regexp) self end def add_highlight_class_with_only_char_start(klass, col, chr) - tk_call('ctext::addHighlightClassWithOnlyCharStart', + tk_call('ctext::addHighlightClassWithOnlyCharStart', @path, klass, col, chr) self end diff --git a/ext/tk/lib/tkextlib/tcllib/cursor.rb b/ext/tk/lib/tkextlib/tcllib/cursor.rb index 9bb828e8dd..5c47f9709b 100644 --- a/ext/tk/lib/tkextlib/tcllib/cursor.rb +++ b/ext/tk/lib/tkextlib/tcllib/cursor.rb @@ -44,8 +44,8 @@ module Tk end def self.cursor_display(parent=None) - # Pops up a dialog with a listbox containing all the cursor names. - # Selecting a cursor name will display it in that dialog. + # Pops up a dialog with a listbox containing all the cursor names. + # Selecting a cursor name will display it in that dialog. # This is simply for viewing any available cursors on the platform . #tk_call_without_enc('::cursor::display', parent) Tk::Tcllib::Cursor.cursor_display(parent) @@ -54,15 +54,15 @@ end class TkWindow def cursor_propagate(cursor) - # Sets the cursor for self and all its descendants to cursor. + # Sets the cursor for self and all its descendants to cursor. #tk_call_without_enc('::cursor::propagate', @path, cursor) Tk::Tcllib::Cursor.cursor_propagate(self, cursor) end def cursor_restore(cursor = None) - # Restore the original or previously set cursor for self and all its - # descendants. If cursor is specified, that will be used if on any - # widget that did not have a preset cursor (set by a previous call - # to TkWindow#cursor_propagate). + # Restore the original or previously set cursor for self and all its + # descendants. If cursor is specified, that will be used if on any + # widget that did not have a preset cursor (set by a previous call + # to TkWindow#cursor_propagate). #tk_call_without_enc('::cursor::restore', @path, cursor) Tk::Tcllib::Cursor.cursor_restore(self, cursor) end diff --git a/ext/tk/lib/tkextlib/tcllib/dateentry.rb b/ext/tk/lib/tkextlib/tcllib/dateentry.rb new file mode 100644 index 0000000000..77038d95bc --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/dateentry.rb @@ -0,0 +1,62 @@ +# +# tkextlib/tcllib/dateentry.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * dateentry widget +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::dateentry', '0.91') +TkPackage.require('widget::dateentry') + +module Tk::Tcllib + module Widget + class Dateentry < Tk::Tile::TEntry + PACKAGE_NAME = 'widget::dateentry'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::dateentry') + rescue + '' + end + end + end + DateEntry = Dateentry + end +end + +class Tk::Tcllib::Widget::Dateentry + TkCommandNames = ['::widget::dateentry'.freeze].freeze + + def __strval_optkeys + super() << ['dateformat'] + end + private :__strval_optkeys + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def post + tk_send('post') + self + end + + def unpost + tk_send('unpost') + self + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/datefield.rb b/ext/tk/lib/tkextlib/tcllib/datefield.rb index 2244dd7a9a..4c2eae741e 100644 --- a/ext/tk/lib/tkextlib/tcllib/datefield.rb +++ b/ext/tk/lib/tkextlib/tcllib/datefield.rb @@ -7,12 +7,12 @@ # # (The following is the original description of the library.) # -# The datefield package provides the datefield widget which is an enhanced -# text entry widget for the purpose of date entry. Only valid dates of the +# The datefield package provides the datefield widget which is an enhanced +# text entry widget for the purpose of date entry. Only valid dates of the # form MM/DD/YYYY can be entered. -# -# The datefield widget is, in fact, just an entry widget with specialized -# bindings. This means all the command and options for an entry widget apply +# +# The datefield widget is, in fact, just an entry widget with specialized +# bindings. This means all the command and options for an entry widget apply # equally here. require 'tk' @@ -47,7 +47,7 @@ class Tk::Tcllib::Datefield def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/diagrams.rb b/ext/tk/lib/tkextlib/tcllib/diagrams.rb new file mode 100644 index 0000000000..d24ba9d232 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/diagrams.rb @@ -0,0 +1,224 @@ +# +# tkextlib/tcllib/diagrams.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * Draw diagrams +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('Diagrams', '0.3') +TkPackage.require('Diagrams') + +module Tk::Tcllib + module Diagrams + PACKAGE_NAME = 'Diagrams'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('Diagrams') + rescue + '' + end + end + end +end + +class << Tk::Tcllib::Diagrams + include TkCore + + def drawin(canvas) + tk_call('::Diagrams::drawin', canvas) + canvas + end + alias draw_in drawin + + def saveps(filename) + tk_call('::Diagrams::saveps', filename) + filename + end + alias save_ps saveps + + def direction(dir) + tk_call('::Diagrams::direction', dir) + dir + end + + def currentpos(pos) + list(tk_call('::Diagrams::currentpos', pos)) + end + alias current_pos currentpos + alias currentpos= currentpos + alias current_pos= currentpos + + def getpos(anchor, obj) + list(tk_call('::Diagrams::getpos', anchor, obj)) + end + alias get_pos getpos + + def position(x, y) + list(tk_call('::Diagrams::position', x, y)) + end + + def box(text, width=nil, height=nil) + if width || height + width = '' unless width + height = '' unless height + list(tk_call('::Diagrams::box', text, width, height)) + else + list(tk_call('::Diagrams::box', text)) + end + end + + def plaintext(text, width=nil, height=nil) + if width || height + width = '' unless width + height = '' unless height + list(tk_call('::Diagrams::plaintext', text, width, height)) + else + list(tk_call('::Diagrams::plaintext', text)) + end + end + + def circle(text, radius=nil) + if radius + list(tk_call('::Diagrams::circle', text, radius)) + else + list(tk_call('::Diagrams::circle', text)) + end + end + + def slanted(text, width=nil, height=nil, angle=nil) + if width || height || angle + width = '' unless width + height = '' unless height + if angle + list(tk_call('::Diagrams::slanted', text, width, height, angle)) + else + list(tk_call('::Diagrams::slanted', text, width, height)) + end + else + list(tk_call('::Diagrams::slanted', text)) + end + end + + def diamond(text, width=nil, height=nil) + if width || height + width = '' unless width + height = '' unless height + list(tk_call('::Diagrams::diamond', text, width, height)) + else + list(tk_call('::Diagrams::diamond', text)) + end + end + + def drum(text, width=nil, height=nil) + if width || height + width = '' unless width + height = '' unless height + list(tk_call('::Diagrams::drum', text, width, height)) + else + list(tk_call('::Diagrams::drum', text)) + end + end + + def arrow(text=nil, length=nil, head=nil) + if length || head + text = '' unless text + length = '' unless length + list(tk_call('::Diagrams::arrow', text, length, head)) + else + if text + list(tk_call('::Diagrams::arrow', text)) + else + list(tk_call('::Diagrams::arrow')) + end + end + end + + def line(*args) + ary = [] + args.each{|arg| + if arg.kind_of?(Array) && arg.length == 2 # [length, angle] + ary.concat arg + else # ["POSITION", x, y] or length or angle + ary << arg + end + } + list(tk_call('::Diagrams::line', *ary)) + end + + def bracket(dir, dist, from_pos, to_pos) + list(tk_call('::Diagrams::bracket', dir, dist, from_pos, to_pos)) + end + + def attach(anchor=None) + tk_call('::Diagrams::attach', anchor) + end + + def color(name=None) + tk_call('::Diagrams::color', name) + end + + def fillcolor(name=None) + tk_call('::Diagrams::fillcolor', name) + end + + def textcolor(name=None) + tk_call('::Diagrams::textcolor', name) + end + + def usegap(mode=None) + bool(tk_call('::Diagrams::usegap', mode)) + end + alias use_gap usegap + + def xgap(val=None) + number(tk_call('::Diagrams::xgap', val)) + end + + def ygap(val=None) + number(tk_call('::Diagrams::ygap', val)) + end + + def textfont(fnt=None) + tk_call('::Diagrams::textfont', fnt) + end + + def linewidth(pixels=None) + number(tk_call('::Diagrams::linewidth', pixels)) + end + + def linestyle(style=None) + tk_call('::Diagrams::linestyle', style) + end + + def pushstate + tk_call('::Diagrams::pushstate') + end + alias push_state pushstate + + def popstate + tk_call('::Diagrams::popstate') + end + alias pop_state popstate + + def computepos + list(tk_call('::Diagrams::computepos')) + end + alias compute_pos computepos + + def boxcoords(x1, y1, x2, y2) + list(tk_call('::Diagrams::boxcoords', x1, y1, x2, y2)) + end + + def moveobject(obj) + list(tk_call('::Diagrams::moveobject', obj)) + end + alias move_object moveobject +end diff --git a/ext/tk/lib/tkextlib/tcllib/dialog.rb b/ext/tk/lib/tkextlib/tcllib/dialog.rb index 825621b5a1..86a0ef2269 100644 --- a/ext/tk/lib/tkextlib/tcllib/dialog.rb +++ b/ext/tk/lib/tkextlib/tcllib/dialog.rb @@ -41,7 +41,7 @@ class Tk::Tcllib::Widget::Dialog def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/getstring.rb b/ext/tk/lib/tkextlib/tcllib/getstring.rb index fc5d8b26d9..48711d3b66 100644 --- a/ext/tk/lib/tkextlib/tcllib/getstring.rb +++ b/ext/tk/lib/tkextlib/tcllib/getstring.rb @@ -34,7 +34,7 @@ end class Tk::Tcllib::GetString_Dialog TkCommandNames = ['::getstring::tk_getString'.freeze].freeze WidgetClassName = 'TkSDialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.show(*args) dialog = self.new(*args) @@ -74,7 +74,7 @@ class Tk::Tcllib::GetString_Dialog def show @variable.value = '' - @status = bool(tk_call(self.class::TkCommandNames[0], + @status = bool(tk_call(self.class::TkCommandNames[0], @path, @variable, @text, *hash_kv(@keys))) end alias display show diff --git a/ext/tk/lib/tkextlib/tcllib/ico.rb b/ext/tk/lib/tkextlib/tcllib/ico.rb index 8c92926a4c..36a32c6b09 100644 --- a/ext/tk/lib/tkextlib/tcllib/ico.rb +++ b/ext/tk/lib/tkextlib/tcllib/ico.rb @@ -8,7 +8,7 @@ require 'tk' require 'tk/image' -require 'tkextlib/tcllib.rb' +#require 'tkextlib/tcllib.rb' # TkPackage.require('ico', '0.3') TkPackage.require('ico') @@ -38,9 +38,39 @@ class Tk::Tcllib::ICO *hash_kv(keys, true))) end + def self.icons(file, keys=nil) + tk_split_simplelist(tk_call_without_enc('::ico::icons', file, + *hash_kv(keys, true))).map{|elem| + num_or_str(elem) + } + end + + def self.get_members(file, name, keys=nil) + tk_split_simplelist(tk_call_without_enc('::ico::getMembers', file, name, + *hash_kv(keys, true))).map{|elem| + name, width, height, bpp = tk_split_simplelist(elem) + [name, number(width), number(height), number(bpp)] + } + end + def self.get(file, index, keys=nil) tk_call_without_enc('::ico::getIcon', file, index, *hash_kv(keys, true)) end + def self.get_icon(*args) + get(*args) + end + + def self.get_by_name(file, name, keys=nil) + tk_call_without_enc('::ico::getIconByName', file, name, + *hash_kv(keys, true)) + end + def self.get_icon_by_name(*args) + get_by_name(*args) + end + + def self.get_fileicon(file, keys=nil) + tk_call_without_enc('::ico::getFileIcon', file, *hash_kv(keys, true)) + end def self.get_image(file, index, keys={}) keys = _symbolkey2str(keys) @@ -50,23 +80,23 @@ class Tk::Tcllib::ICO def self.get_data(file, index, keys={}) keys['format'] = 'data' - tk_split_list(tk_call_without_enc('::ico::getIcon', file, index, + tk_split_list(tk_call_without_enc('::ico::getIcon', file, index, *hash_kv(keys, true))) end def self.write(file, index, depth, data, keys=nil) - tk_call_without_enc('::ico::writeIcon', file, index, depth, data, + tk_call_without_enc('::ico::writeIcon', file, index, depth, data, *hash_kv(keys, true)) end def self.copy(from_file, from_index, to_file, to_index, keys=nil) - tk_call_without_enc('::ico::copyIcon', - from_file, from_index, to_file, to_index, + tk_call_without_enc('::ico::copyIcon', + from_file, from_index, to_file, to_index, *hash_kv(keys, true)) end def self.exe_to_ico(exe_file, ico_file, keys=nil) - tk_call_without_enc('::ico::copyIcon', exe_file, ico_file, + tk_call_without_enc('::ico::copyIcon', exe_file, ico_file, *hash_kv(keys, true)) end @@ -76,7 +106,7 @@ class Tk::Tcllib::ICO def self.transparent_color(image, color) if image.kind_of?(Array) - tk_split_list(tk_call_without_enc('::ico::transparentColor', + tk_split_list(tk_call_without_enc('::ico::transparentColor', image, color)) else tk_call_without_enc('::ico::transparentColor', image, color) @@ -99,7 +129,7 @@ class Tk::Tcllib::ICO Tk_Image_ID[1].succ! } end - tk_call_without_enc('::ico::getIcon', file, index, '-name', @path, + tk_call_without_enc('::ico::getIcon', file, index, '-name', @path, '-format', 'image', *hash_kv(keys, true)) Tk_IMGTBL[@path] = self end diff --git a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb index c4b8240c04..e5e0f8d42d 100644 --- a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb +++ b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb @@ -7,7 +7,7 @@ # # (The following is the original description of the library.) # -# This package provides a widget for the entering of a IP address. +# This package provides a widget for the entering of a IP address. # It guarantees a valid address at all times. require 'tk' @@ -33,17 +33,22 @@ module Tk end end IPEntry = IP_Entry + + class IP_Entry6 < IP_Entry + end + IPEntry6 = IP_Entry6 + IP6_Entry = IP_Entry6 end end class Tk::Tcllib::IP_Entry TkCommandNames = ['::ipentry::ipentry'.freeze].freeze WidgetClassName = 'IPEntry'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -64,3 +69,7 @@ class Tk::Tcllib::IP_Entry tk_send_without_enc('insert', array2tk_list(ip.flatten)) end end + +class Tk::Tcllib::IP_Entry6 < Tk::Tcllib::IP_Entry + TkCommandNames = ['::ipentry::ipentry6'.freeze].freeze +end diff --git a/ext/tk/lib/tkextlib/tcllib/khim.rb b/ext/tk/lib/tkextlib/tcllib/khim.rb new file mode 100644 index 0000000000..00acff91d9 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/khim.rb @@ -0,0 +1,68 @@ +# +# tkextlib/tcllib/khim.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * Kevin's Hacky Input Method +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('khim', '1.0') +TkPackage.require('khim') + +module Tk::Tcllib + class KHIM < TkToplevel + PACKAGE_NAME = 'khim'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('khim') + rescue + '' + end + end + end +end + +class Tk::Tcllib::KHIM + TkCommandNames = ['::khim::getOptions'.freeze].freeze + + def self.get_options(parent='') + path = parent + '.tcllib_widget_khim_dialog' + self.new(:widgetname => path) + end + + def self.get_config #=> cmd_string + Tk.tk_call_without_enc('::khim::getConfig') + end + + def self.set_config(*args) + if args.length == 1 + # cmd_string generated by + #Tk.ip_eval_without_enc(cmd_string) + Tk.ip_eval(cmd_string) + else + # args for setConfig command + #Tk.tk_call_without_enc('::khim::setConfig', *args) + Tk.tk_call('::khim::setConfig', *args) + end + end + + def self.showHelp + Tk::Tcllib::KHIM::Help.new + end + + def create_self(keys=None) + @db_class = @classname = nil + super(None) # ignore keys + end +end + +class Tk::Tcllib::KHIM::Help < TkToplevel + TkCommandNames = ['::khim::showHelp'.freeze].freeze +end diff --git a/ext/tk/lib/tkextlib/tcllib/menuentry.rb b/ext/tk/lib/tkextlib/tcllib/menuentry.rb new file mode 100644 index 0000000000..f1eb2f295c --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/menuentry.rb @@ -0,0 +1,47 @@ +# +# tkextlib/tcllib/menuentry.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * menuentry widget +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::menuentry', '1.0') +TkPackage.require('widget::menuentry') + +module Tk::Tcllib + module Widget + class Menuentry < Tk::Tile::TEntry + PACKAGE_NAME = 'widget::menuentry'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::menuentry') + rescue + '' + end + end + end + MenuEntry = Menuentry + end +end + +class Tk::Tcllib::Widget::Menuentry + TkCommandNames = ['::widget::menuentry'.freeze].freeze + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self +end diff --git a/ext/tk/lib/tkextlib/tcllib/ntext.rb b/ext/tk/lib/tkextlib/tcllib/ntext.rb new file mode 100644 index 0000000000..7888ed4871 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/ntext.rb @@ -0,0 +1,146 @@ +# +# tkextlib/tcllib/ntext.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * Ntext bindtag +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('ntext', '0.81') +TkPackage.require('ntext') + +module Tk::Tcllib + Ntext = TkBindTag.new_by_name('Ntext') +end + +# variables +Tk::Tcllib::Ntext.instance_eval{ + # boolean + @classicAnchor = TkVarAccess.new('::ntext::classicAnchor') + @classicExtras = TkVarAccess.new('::ntext::classicExtras') + @classicMouseSelect = TkVarAccess.new('::ntext::classicMouseSelect') + @classicWordBreak = TkVarAccess.new('::ntext::classicWordBreak') + @classicWrap = TkVarAccess.new('::ntext::classicWrap') + @overwrite = TkVarAccess.new('::ntext::overwrite') + + # regexp + @newWrapRegexp = TkVarAccess.new('::ntext::newWrapRegexp') + + # variables (advanced use) + @tcl_match_wordBreakAfter = TkVarAccess.new('::ntext::tcl_match_wordBreakAfter') + @tcl_match_wordBreakBefore = TkVarAccess.new('::ntext::tcl_match_wordBreakBefore') + @tcl_match_endOfWord = TkVarAccess.new('::ntext::tcl_match_endOfWord') + @tcl_match_startOfNextWord = TkVarAccess.new('::ntext::tcl_match_startOfNextWord') + @tcl_match_startOfPreviousWord = TkVarAccess.new('::ntext::tcl_match_startOfPreviousWord') +} + +class << Tk::Tcllib::Ntext + def wrapIndent(txt, *args) + TK.tk_call('::next::wrapIndent', txt, *args) + end + + def initializeMatchPatterns + TK.tk_call('::next::initializeMatchPatterns') + self + end + + def createMatchPatterns(*args) + TK.tk_call('::next::createMatchPatterns', *args) + self + end + + # functions (advanced use) + #ntext::new_wordBreakAfter + #ntext::new_wordBreakBefore + #ntext::new_endOfWord + #ntext::new_startOfNextWord + #ntext::new_startOfPreviousWord + + # accessor + def classicAnchor + @classicAnchor.bool + end + def classicAnchor=(mode) + @classicAnchor.bool = mode + end + + def classicExtras + @classicExtras.bool + end + def classicExtras=(mode) + @classicExtras.bool = mode + end + + def classicMouseSelect + @classicMouseSelect.bool + end + def classicMouseSelect=(mode) + @classicMouseSelect.bool = mode + end + + def classicWordBreak + @classicWordBreak.bool + end + def classicWordBreak=(mode) + @classicWordBreak.bool = mode + end + + def classicWrap + @classicWrap.bool + end + def classicWrap=(mode) + @classicWrap.bool = mode + end + + def overwrite + @overwrite.bool + end + def overwrite=(mode) + @classic.bool = mode + end + + def newWrapRegexp + @newWrapRegexp.value + end + def newWrapRegexp=(val) + @newWrapRegexp.value = val + end + + def tcl_match_wordBreakAfter + @tcl_match_wordBreakAfter.value + end + def tcl_match_wordBreakAfter=(val) + @tcl_match_wordBreakAfter.value = val + end + + def tcl_match_wordBreakBefore + @tcl_match_wordBreakBefore.value + end + def tcl_match_wordBreakBefore=(val) + @tcl_match_wordBreakBefore.value = val + end + + def tcl_match_endOfWord + @tcl_match_endOfWord.value + end + def tcl_match_endOfWord=(val) + @tcl_match_endOfWord.value = val + end + + def tcl_match_startOfNextWord + @tcl_match_startOfNextWord.value + end + def tcl_match_startOfNextWord=(val) + @tcl_match_startOfNextWord.value = val + end + + def tcl_match_startOfPreviousWord + @tcl_match_startOfPreviousWord.value + end + def tcl_match_startOfPreviousWord=(val) + @tcl_match_startOfPreviousWord.value = val + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/panelframe.rb b/ext/tk/lib/tkextlib/tcllib/panelframe.rb index 2a4562e779..020c51cbd1 100644 --- a/ext/tk/lib/tkextlib/tcllib/panelframe.rb +++ b/ext/tk/lib/tkextlib/tcllib/panelframe.rb @@ -37,7 +37,7 @@ class Tk::Tcllib::Widget::PanelFrame def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -60,11 +60,17 @@ class Tk::Tcllib::Widget::PanelFrame def remove(*wins) tk_send('remove', *wins) + self end def remove_destroy(*wins) tk_send('remove', '-destroy', *wins) + self + end + + def delete(*wins) + tk_send('delete', *wins) + self end - alias delete remove_destroy def items simplelist(tk_send('items')).collect!{|w| window(w)} diff --git a/ext/tk/lib/tkextlib/tcllib/plotchart.rb b/ext/tk/lib/tkextlib/tcllib/plotchart.rb index 06ab20f3e6..6b7a526b75 100644 --- a/ext/tk/lib/tkextlib/tcllib/plotchart.rb +++ b/ext/tk/lib/tkextlib/tcllib/plotchart.rb @@ -7,10 +7,10 @@ # # (The following is the original description of the library.) # -# Plotchart is a Tcl-only package that focuses on the easy creation of -# xy-plots, barcharts and other common types of graphical presentations. -# The emphasis is on ease of use, rather than flexibility. The procedures -# that create a plot use the entire canvas window, making the layout of the +# Plotchart is a Tcl-only package that focuses on the easy creation of +# xy-plots, barcharts and other common types of graphical presentations. +# The emphasis is on ease of use, rather than flexibility. The procedures +# that create a plot use the entire canvas window, making the layout of the # plot completely automatic. # # This results in the creation of an xy-plot in, say, ten lines of code: @@ -32,27 +32,27 @@ # $s title "Data series" # -------------------------------------------------------------------- # -# A drawback of the package might be that it does not do any data management. -# So if the canvas that holds the plot is to be resized, the whole plot must -# be redrawn. The advantage, though, is that it offers a number of plot and +# A drawback of the package might be that it does not do any data management. +# So if the canvas that holds the plot is to be resized, the whole plot must +# be redrawn. The advantage, though, is that it offers a number of plot and # chart types: # # * XY-plots like the one shown above with any number of data series. -# * Stripcharts, a kind of XY-plots where the horizontal axis is adjusted -# automatically. The result is a kind of sliding window on the data +# * Stripcharts, a kind of XY-plots where the horizontal axis is adjusted +# automatically. The result is a kind of sliding window on the data # series. # * Polar plots, where the coordinates are polar instead of cartesian. -# * Isometric plots, where the scale of the coordinates in the two -# directions is always the same, i.e. a circle in world coordinates +# * Isometric plots, where the scale of the coordinates in the two +# directions is always the same, i.e. a circle in world coordinates # appears as a circle on the screen. -# You can zoom in and out, as well as pan with these plots (Note: this -# works best if no axes are drawn, the zooming and panning routines do -# not distinguish the axes), using the mouse buttons with the control +# You can zoom in and out, as well as pan with these plots (Note: this +# works best if no axes are drawn, the zooming and panning routines do +# not distinguish the axes), using the mouse buttons with the control # key and the arrow keys with the control key. # * Piecharts, with automatic scaling to indicate the proportions. -# * Barcharts, with either vertical or horizontal bars, stacked bars or +# * Barcharts, with either vertical or horizontal bars, stacked bars or # bars side by side. -# * Timecharts, where bars indicate a time period and milestones or other +# * Timecharts, where bars indicate a time period and milestones or other # important moments in time are represented by triangles. # * 3D plots (both for displaying surfaces and 3D bars) # @@ -62,6 +62,7 @@ require 'tkextlib/tcllib.rb' # TkPackage.require('Plotchart', '0.9') # TkPackage.require('Plotchart', '1.1') +# TkPackage.require('Plotchart', '1.6.3') TkPackage.require('Plotchart') module Tk @@ -91,13 +92,13 @@ module Tk::Tcllib::Plotchart end def self.world_coordinates(w, *args) # args := xmin, ymin, xmax, ymax - tk_call_without_enc('::Plotchart::worldCoordinates', + tk_call_without_enc('::Plotchart::worldCoordinates', w.path, *(args.flatten)) end - def self.world_3D_coordinates(w, *args) + def self.world_3D_coordinates(w, *args) # args := xmin, ymin, zmin, xmax, ymax, zmax - tk_call_without_enc('::Plotchart::world3DCoordinates', + tk_call_without_enc('::Plotchart::world3DCoordinates', w.path, *(args.flatten)) end @@ -109,6 +110,29 @@ module Tk::Tcllib::Plotchart list(tk_call_without_enc('::Plotchart::coords3DToPixel', w.path, x, y, z)) end + def self.plotconfig(*args) + case args.length + when 0, 1, 2 + # 0: (no args) --> list of chat types + # 1: charttype --> list of components + # 2: charttype, component --> list of properties + simplelist(tk_call('::Plotchart::plotconfig', *args)) + when 3 + # 3: charttype, component, property --> current value + tk_call('::Plotchart::plotconfig', *args) + else + # 4: charttype, component, property, value : set new value + # 5+: Error on Tcl/Tk + tk_call('::Plotchart::plotconfig', *args) + nil + end + end + + def self.plotpack(w, dir, *plots) + tk_call_without_enc('::Plotchart::plotpack', w.path, dir, *plots) + w + end + def self.polar_coordinates(w, radmax) tk_call_without_enc('::Plotchart::polarCoordinates', w.path, radmax) end @@ -157,8 +181,7 @@ module Tk::Tcllib::Plotchart if key.kind_of?(Hash) tk_call_without_enc(@chart, 'xconfig', *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'xconfig', - "-#{key}", _get_eval_enc_str(value)) + tk_call(@chart, 'xconfig', "-#{key}",value) end self end @@ -167,27 +190,100 @@ module Tk::Tcllib::Plotchart if key.kind_of?(Hash) tk_call_without_enc(@chart, 'yconfig', *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'yconfig', - "-#{key}", _get_eval_enc_str(value)) + tk_call(@chart, 'yconfig', "-#{key}", value) end self end + def background(part, color_or_image, dir) + tk_call_without_enc(@chart, 'background', + part, color_or_image, dir) + self + end + + def xticklines(color=None) + tk_call(@chart, 'xticklines', color) + self + end + + def yticklines(color=None) + tk_call(@chart, 'yticklines', color) + self + end + + def legendconfig(key, value=None) + if key.kind_of?(Hash) + tk_call_without_enc(@chart, 'legendconfig', *hash_kv(key, true)) + else + tk_call(@chart, 'legendconfig', "-#{key}", value) + end + self + end + + def legend(series, text) + tk_call_without_enc(@chart, 'legend', + _get_eval_enc_str(series), _get_eval_enc_str(text)) + self + end + + def balloon(*args) # args => (x, y, text, dir) or ([x, y], text, dir) + if args[0].kind_of?(Array) + # args => ([x, y], text, dir) + x, y = args.shift + else + # args => (x, y, text, dir) + x = args.shift + y = args.shift + end + + text, dir = args + + tk_call_without_enc(@chart, 'balloon', x, y, + _get_eval_enc_str(text), dir) + self + end + + def balloonconfig(key, value=None) + if key.kind_of?(Hash) + tk_call_without_enc(@chart, 'balloonconfig', *hash_kv(key, true)) + else + tk_call(@chart, 'balloonconfig', "-#{key}", value) + end + end + + def plaintext(*args) # args => (x, y, text, dir) or ([x, y], text, dir) + if args[0].kind_of?(Array) + # args => ([x, y], text, dir) + x, y = args.shift + else + # args => (x, y, text, dir) + x = args.shift + y = args.shift + end + + text, dir = args + + tk_call_without_enc(@chart, 'plaintext', x, y, + _get_eval_enc_str(text), dir) + self + end + ############################ + def view_port(*args) # args := pxmin, pymin, pxmax, pymax tk_call_without_enc('::Plotchart::viewPort', @path, *(args.flatten)) self end def world_coordinates(*args) # args := xmin, ymin, xmax, ymax - tk_call_without_enc('::Plotchart::worldCoordinates', + tk_call_without_enc('::Plotchart::worldCoordinates', @path, *(args.flatten)) self end - def world_3D_coordinates(*args) + def world_3D_coordinates(*args) # args := xmin, ymin, zmin, xmax, ymax, zmax - tk_call_without_enc('::Plotchart::world3DCoordinates', + tk_call_without_enc('::Plotchart::world3DCoordinates', @path, *(args.flatten)) self end @@ -200,6 +296,11 @@ module Tk::Tcllib::Plotchart list(tk_call_without_enc('::Plotchart::coords3DToPixel', @path, x, y, z)) end + def plotpack(dir, *plots) + tk_call_without_enc('::Plotchart::plotpack', @path, dir, *plots) + self + end + def polar_coordinates(radmax) tk_call_without_enc('::Plotchart::polarCoordinates', @path, radmax) self @@ -229,7 +330,7 @@ module Tk::Tcllib::Plotchart include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createXYPlot'.freeze ].freeze @@ -259,7 +360,7 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, + tk_call_without_enc(self.class::TkCommandNames[1], @path, array2tk_list(@xaxis), array2tk_list(@yaxis)) end private :_create_chart @@ -281,27 +382,27 @@ module Tk::Tcllib::Plotchart vals = array2tk_list(vals) if vals.kind_of?(Array) clss = array2tk_list(clss) if clss.kind_of?(Array) - tk_call_without_enc(@chart, 'contourlines', xcrd, ycrd, vals, clss) + tk_call(@chart, 'contourlines', xcrd, ycrd, vals, clss) self end - def contourfill(xcrd, ycrd, vals, klasses=None) + def contourfill(xcrd, ycrd, vals, clss=None) xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array) ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array) vals = array2tk_list(vals) if vals.kind_of?(Array) clss = array2tk_list(clss) if clss.kind_of?(Array) - tk_call_without_enc(@chart, 'contourfill', xcrd, ycrd, vals, clss) + tk_call(@chart, 'contourfill', xcrd, ycrd, vals, clss) self end - def contourbox(xcrd, ycrd, vals, klasses=None) + def contourbox(xcrd, ycrd, vals, clss=None) xcrd = array2tk_list(xcrd) if xcrd.kind_of?(Array) ycrd = array2tk_list(ycrd) if ycrd.kind_of?(Array) vals = array2tk_list(vals) if vals.kind_of?(Array) clss = array2tk_list(clss) if clss.kind_of?(Array) - tk_call_without_enc(@chart, 'contourbox', xcrd, ycrd, vals, clss) + tk_call(@chart, 'contourbox', xcrd, ycrd, vals, clss) self end @@ -324,26 +425,110 @@ module Tk::Tcllib::Plotchart if key.kind_of?(Hash) tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'dataconfig', series, - "-#{key}", _get_eval_enc_str(value)) + tk_call(@chart, 'dataconfig', series, "-#{key}", value) end end + + def rescale(xscale, yscale) # xscale|yscale => [newmin, newmax, newstep] + tk_call_without_enc(@chart, 'rescale', xscale, yscale) + self + end + + def trend(series, xcrd, ycrd) + tk_call_without_enc(@chart, 'trend', + _get_eval_enc_str(series), xcrd, ycrd) + self + end + + def rchart(series, xcrd, ycrd) + tk_call_without_enc(@chart, 'rchart', + _get_eval_enc_str(series), xcrd, ycrd) + self + end + + def interval(series, xcrd, ymin, ymax, ycenter=None) + tk_call(@chart, 'interval', series, xcrd, ymin, ymax, ycenter) + self + end + + def box_and_whiskers(series, xcrd, ycrd) + tk_call_without_enc(@chart, 'box-and-whiskers', + _get_eval_enc_str(series), xcrd, ycrd) + self + end + alias box_whiskers box_and_whiskers + + def vectorconfig(series, key, value=None) + if key.kind_of?(Hash) + tk_call_without_enc(@chart, 'vectorconfig', + _get_eval_enc_str(series), *hash_kv(key, true)) + else + tk_call(@chart, 'vectorconfig', series, "-#{key}", value) + end + self + end + + def vector(series, xcrd, ycrd, ucmp, vcmp) + tk_call_without_enc(@chart, 'vector', _get_eval_enc_str(series), + xcrd, ycrd, ucmp, vcmp) + self + end + + def dotconfig(series, key, value=None) + if key.kind_of?(Hash) + tk_call_without_enc(@chart, 'dotconfig', + _get_eval_enc_str(series), *hash_kv(key, true)) + else + tk_call(@chart, 'dotconfig', series, "-#{key}", value) + end + self + end + + def dot(series, xcrd, ycrd, value) + tk_call_without_enc(@chart, 'dot', _get_eval_enc_str(series), + xcrd, ycrd, value) + self + end end ############################ class Stripchart < XYPlot TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createStripchart'.freeze ].freeze end + ############################ + class TXPlot < XYPlot + TkCommandNames = [ + 'canvas'.freeze, + '::Plotchart::createTXPlot'.freeze + ].freeze + end + + ############################ + class XLogYPlot < XYPlot + TkCommandNames = [ + 'canvas'.freeze, + '::Plotchart::createXLogYPlot'.freeze + ].freeze + end + + ############################ + class Histogram < XYPlot + TkCommandNames = [ + 'canvas'.freeze, + '::Plotchart::createHistgram'.freeze + ].freeze + end + ############################ class PolarPlot < Tk::Canvas include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createPolarplot'.freeze ].freeze @@ -370,7 +555,7 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, + tk_call_without_enc(self.class::TkCommandNames[1], @path, array2tk_list(@radius_data)) end private :_create_chart @@ -382,17 +567,17 @@ module Tk::Tcllib::Plotchart end def plot(series, radius, angle) - tk_call_without_enc(@chart, 'plot', _get_eval_enc_str(series), + tk_call_without_enc(@chart, 'plot', _get_eval_enc_str(series), radius, angle) self end def dataconfig(series, key, value=None) if key.kind_of?(Hash) - tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true)) + tk_call_without_enc(@chart, 'dataconfig', _get_eval_enc_str(series), + *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'dataconfig', series, - "-#{key}", _get_eval_enc_str(value)) + tk_call(@chart, 'dataconfig', series, "-#{key}", value) end end end @@ -403,7 +588,7 @@ module Tk::Tcllib::Plotchart include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createIsometricPlot'.freeze ].freeze @@ -446,8 +631,8 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@xaxis), array2tk_list(@yaxis), + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@xaxis), array2tk_list(@yaxis), @stepsize) end private :_create_chart @@ -483,7 +668,7 @@ module Tk::Tcllib::Plotchart include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::create3DPlot'.freeze ].freeze @@ -516,9 +701,9 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@xaxis), - array2tk_list(@yaxis), + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@xaxis), + array2tk_list(@yaxis), array2tk_list(@zaxis)) end private :_create_chart @@ -541,15 +726,33 @@ module Tk::Tcllib::Plotchart self end + def plot_line(dat, color) + # dat has to be provided as a 2 level array. + # 1st level contains rows, drawn in y-direction, + # and each row is an array whose elements are drawn in x-direction, + # for the columns. + tk_call_without_enc(@chart, 'plotline', dat, color) + self + end + def plot_data(dat) - # dat has to be provided as a 2 level array. - # 1st level contains rows, drawn in y-direction, - # and each row is an array whose elements are drawn in x-direction, - # for the columns. + # dat has to be provided as a 2 level array. + # 1st level contains rows, drawn in y-direction, + # and each row is an array whose elements are drawn in x-direction, + # for the columns. tk_call_without_enc(@chart, 'plotdata', dat) self end + def zconfig(key, value=None) + if key.kind_of?(Hash) + tk_call_without_enc(@chart, 'zconfig', *hash_kv(key, true)) + else + tk_call(@chart, 'zconfig', "-#{key}", value) + end + self + end + def colour(fill, border) # configure the colours to use for polygon borders and inner area tk_call_without_enc(@chart, 'colour', fill, border) @@ -560,12 +763,138 @@ module Tk::Tcllib::Plotchart alias color colour end + ############################ + class Barchart3D < Tk::Canvas + include ChartMethod + + TkCommandNames = [ + 'canvas'.freeze, + '::Plotchart::create3DBarchart'.freeze + ].freeze + + def initialize(*args) # args := ([parent,] yaxis, nobars [, keys]) + # yaxis := Array of [minimum, maximum, stepsize] + # nobars := number of bars + if args[0].kind_of?(Array) + @yaxis = args.shift + @nobars = args.shift + + super(*args) # create canvas widget + else + parent = args.shift + + @yaxis = args.shift + @nobars = args.shift + + if parent.kind_of?(Tk::Canvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end + end + + @chart = _create_chart + end + + def _create_chart + p self.class::TkCommandNames[1] if $DEBUG + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@yaxis), @nobars) + end + private :_create_chart + + def plot(label, yvalue, color) + tk_call_without_enc(@chart, 'plot', _get_eval_enc_str(label), + _get_eval_enc_str(yvalue), color) + self + end + + def config(key, value=None) + if key.kind_of?(Hash) + tk_call_without_enc(@chart, 'config', *hash_kv(key, true)) + else + tk_call(@chart, 'config', "-#{key}", value) + end + self + end + end + + ############################ + class RibbonChart3D < Tk::Canvas + include ChartMethod + + TkCommandNames = [ + 'canvas'.freeze, + '::Plotchart::create3DRibbonChart'.freeze + ].freeze + + def initialize(*args) # args := ([parent,] names, yaxis, zaxis [, keys]) + # names := Array of the series + # yaxis := Array of [minimum, maximum, stepsize] + # zaxis := Array of [minimum, maximum, stepsize] + if args[0].kind_of?(Array) + @names = args.shift + @yaxis = args.shift + @zaxis = args.shift + + super(*args) # create canvas widget + else + parent = args.shift + + @names = args.shift + @yaxis = args.shift + @zaxis = args.shift + + if parent.kind_of?(Tk::Canvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end + end + + @chart = _create_chart + end + + def _create_chart + p self.class::TkCommandNames[1] if $DEBUG + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@names), + array2tk_list(@yaxis), + array2tk_list(@zaxis)) + end + private :_create_chart + + def line(*args) # xypairs, color + color = args.pop # last argument is a color + xypairs = TkComm.slice_ary(args.flatten, 2) # regenerate xypairs + tk_call_without_enc(@chart, 'line', xypairs, color) + self + end + + def area(*args) # xypairs, color + color = args.pop # last argument is a color + xypairs = TkComm.slice_ary(args.flatten, 2) # regenerate xypairs + tk_call_without_enc(@chart, 'area', xypairs, color) + self + end + + def zconfig(key, value=None) + if key.kind_of?(Hash) + tk_call_without_enc(@chart, 'zconfig', *hash_kv(key, true)) + else + tk_call(@chart, 'zconfig',"-#{key}", value) + end + self + end + end + + ############################ class Piechart < Tk::Canvas include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createPiechart'.freeze ].freeze @@ -586,9 +915,76 @@ module Tk::Tcllib::Plotchart private :_create_chart def plot(*dat) # argument is a list of [label, value] - tk_call_without_enc(@chart, 'plot', dat.flatten) + tk_call(@chart, 'plot', dat.flatten) self end + + def colours(*list) + tk_call_without_enc(@chart, 'colours', *list) + self + end + alias colors colours + end + + + ############################ + class Radialchart < Tk::Canvas + include ChartMethod + + TkCommandNames = [ + 'canvas'.freeze, + '::Plotchart::createRadialchart'.freeze + ].freeze + + def initialize(*args) # args := ([parent,] names, scale, style [, keys]) + # radius_data := Array of [maximum_radius, stepsize] + if args[0].kind_of?(Array) + @names = args.shift + @scale = args.shift + @style = args.shift + + super(*args) # create canvas widget + else + parent = args.shift + + @names = args.shift + @scale = args.shift + @style = args.shift + + if parent.kind_of?(Tk::Canvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end + end + + @chart = _create_chart + end + + def _create_chart + p self.class::TkCommandNames[1] if $DEBUG + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@names), @scale, @style) + end + private :_create_chart + + def __destroy_hook__ + Tk::Tcllib::Plotchart::PlotSeries::SeriesID_TBL.mutex.synchronize{ + Tk::Tcllib::Plotchart::PlotSeries::SeriesID_TBL.delete(@path) + } + end + + def plot(data, color, thickness) + tk_call_without_enc(@chart, 'plot', _get_eval_enc_str(data), + color, thickness) + self + end + + def colours(*list) + tk_call_without_enc(@chart, 'colours', *list) + self + end + alias colors colours end ############################ @@ -596,11 +992,11 @@ module Tk::Tcllib::Plotchart include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createBarchart'.freeze ].freeze - def initialize(*args) + def initialize(*args) # args := ([parent,] xlabels, ylabels [, series] [, keys]) # xlabels, ylabels := labels | axis ( depend on normal or horizontal ) # labels := Array of [label, label, ...] @@ -642,8 +1038,8 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@xlabels), array2tk_list(@ylabels), + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@xlabels), array2tk_list(@ylabels), @series_size) end private :_create_chart @@ -655,13 +1051,13 @@ module Tk::Tcllib::Plotchart end def plot(series, dat, col=None) - tk_call_without_enc(@chart, 'plot', series, dat, col) + tk_call(@chart, 'plot', series, dat, col) self end def colours(*cols) # set the colours to be used - tk_call_without_enc(@chart, 'colours', *cols) + tk_call(@chart, 'colours', *cols) self end alias colour colours @@ -672,11 +1068,107 @@ module Tk::Tcllib::Plotchart ############################ class HorizontalBarchart < Barchart TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createHorizontalBarchart'.freeze ].freeze end + ############################ + class Boxplot < Tk::Canvas + include ChartMethod + + TkCommandNames = [ + 'canvas'.freeze, + '::Plotchart::createBoxplot'.freeze + ].freeze + + def initialize(*args) # args := ([parent,] xaxis, ylabels [, keys]) + # xaxis := Array of [minimum, maximum, stepsize] + # yaxis := List of labels for the y-axis + if args[0].kind_of?(Array) + @xaxis = args.shift + @ylabels = args.shift + + super(*args) # create canvas widget + else + parent = args.shift + + @xaxis = args.shift + @ylabels = args.shift + + if parent.kind_of?(Tk::Canvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end + end + + @chart = _create_chart + end + + def _create_chart + p self.class::TkCommandNames[1] if $DEBUG + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@xaxis), array2tk_list(@ylabels)) + end + private :_create_chart + + def __destroy_hook__ + Tk::Tcllib::Plotchart::PlotSeries::SeriesID_TBL.mutex.synchronize{ + Tk::Tcllib::Plotchart::PlotSeries::SeriesID_TBL.delete(@path) + } + end + + def plot(label, *values) + tk_call(@chart, 'plot', label, values.flatten) + self + end + end + + ############################ + class RightAxis < Tk::Canvas + include ChartMethod + + TkCommandNames = [ + 'canvas'.freeze, + '::Plotchart::createRightAxis'.freeze + ].freeze + + def initialize(*args) # args := ([parent,] yaxis [, keys]) + # yaxis := Array of [minimum, maximum, stepsize] + if args[0].kind_of?(Array) + @yaxis = args.shift + + super(*args) # create canvas widget + else + parent = args.shift + + @yaxis = args.shift + + if parent.kind_of?(Tk::Canvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end + end + + @chart = _create_chart + end + + def _create_chart + p self.class::TkCommandNames[1] if $DEBUG + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@yaxis)) + end + private :_create_chart + + def __destroy_hook__ + Tk::Tcllib::Plotchart::PlotSeries::SeriesID_TBL.mutex.synchronize{ + Tk::Tcllib::Plotchart::PlotSeries::SeriesID_TBL.delete(@path) + } + end + end + ############################ class Timechart < Tk::Canvas include ChartMethod @@ -717,52 +1209,66 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, + tk_call_without_enc(self.class::TkCommandNames[1], @path, @time_begin, @time_end, @items) end private :_create_chart def period(txt, time_begin, time_end, col=None) - tk_call_without_enc(@chart, 'period', txt, time_begin, time_end, col) + tk_call(@chart, 'period', txt, time_begin, time_end, col) self end def milestone(txt, time, col=None) - tk_call_without_enc(@chart, 'milestone', txt, time, col) + tk_call(@chart, 'milestone', txt, time, col) self end def vertline(txt, time) - tk_call_without_enc(@chart, 'vertline', txt, time) + tk_call(@chart, 'vertline', txt, time) + self + end + + def hscroll=(scr) + tk_call_without_enc(@chart, 'hscroll', scr) + scr + end + def hscroll(scr) + tk_call_without_enc(@chart, 'hscroll', scr) + self + end + + def vscroll=(scr) + tk_call_without_enc(@chart, 'vscroll', scr) + scr + end + def vscroll(scr) + tk_call_without_enc(@chart, 'vscroll', scr) self end end ############################ - class Gnattchart < Tk::Canvas + class Ganttchart < Tk::Canvas include ChartMethod TkCommandNames = [ 'canvas'.freeze, - '::Plotchart::createGnattchart'.freeze + '::Plotchart::createGanttchart'.freeze ].freeze def initialize(*args) # args := ([parent,] time_begin, time_end, items [, text_width] [, keys]) # time_begin := String of time format (e.g. "1 january 2004") # time_end := String of time format (e.g. "1 january 2004") - # items := Expected/maximum number of items - # ( This determines the vertical spacing. ) + # args := Expected/maximum number of items + # ( This determines the vertical spacing. ), + # Expected/maximum width of items, + # Option Hash ( { key=>value, ... } ) if args[0].kind_of?(String) @time_begin = args.shift @time_end = args.shift - @items = args.shift - - if args[0].kind_of?(Fixnum) - @text_width = args.shift - else - @text_width = None - end + @args = args super(*args) # create canvas widget else @@ -770,13 +1276,7 @@ module Tk::Tcllib::Plotchart @time_begin = args.shift @time_end = args.shift - @items = args.shift - - if args[0].kind_of?(Fixnum) - @text_width = args.shift - else - @text_width = None - end + @args = args if parent.kind_of?(Tk::Canvas) @path = parent.path @@ -790,25 +1290,25 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, - @time_begin, @time_end, @items, @text_width) + tk_call(self.class::TkCommandNames[1], @path, + @time_begin, @time_end, *args) end private :_create_chart def task(txt, time_begin, time_end, completed=0.0) - list(tk_call_without_enc(@chart, 'task', txt, time_begin, time_end, - completed)).collect!{|id| + list(tk_call(@chart, 'task', txt, time_begin, time_end, + completed)).collect!{|id| TkcItem.id2obj(self, id) } end def milestone(txt, time, col=None) - tk_call_without_enc(@chart, 'milestone', txt, time, col) + tk_call(@chart, 'milestone', txt, time, col) self end def vertline(txt, time) - tk_call_without_enc(@chart, 'vertline', txt, time) + tk_call(@chart, 'vertline', txt, time) self end @@ -816,23 +1316,41 @@ module Tk::Tcllib::Plotchart from_task = array2tk_list(from_task) if from_task.kind_of?(Array) to_task = array2tk_list(to_task) if to_task.kind_of?(Array) - tk_call_without_enc(@chart, 'connect', from_task, to_task) + tk_call(@chart, 'connect', from_task, to_task) self end def summary(txt, tasks) tasks = array2tk_list(tasks) if tasks.kind_of?(Array) - tk_call_without_enc(@chart, 'summary', tasks) + tk_call(@chart, 'summary', tasks) self end def color_of_part(keyword, newcolor) - tk_call_without_enc(@chart, 'color', keyword, newcolor) + tk_call(@chart, 'color', keyword, newcolor) self end def font_of_part(keyword, newfont) - tk_call_without_enc(@chart, 'font', keyword, newfont) + tk_call(@chart, 'font', keyword, newfont) + self + end + + def hscroll=(scr) + tk_call_without_enc(@chart, 'hscroll', scr) + scr + end + def hscroll(scr) + tk_call_without_enc(@chart, 'hscroll', scr) + self + end + + def vscroll=(scr) + tk_call_without_enc(@chart, 'vscroll', scr) + scr + end + def vscroll(scr) + tk_call_without_enc(@chart, 'vscroll', scr) self end end @@ -841,7 +1359,7 @@ module Tk::Tcllib::Plotchart class PlotSeries < TkObject SeriesID_TBL = TkCore::INTERP.create_table - (Series_ID = ['series'.freeze, '00000'.taint]).instance_eval{ + (Series_ID = ['series'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze diff --git a/ext/tk/lib/tkextlib/tcllib/ruler.rb b/ext/tk/lib/tkextlib/tcllib/ruler.rb index 88ffb2c912..d22dafa053 100644 --- a/ext/tk/lib/tkextlib/tcllib/ruler.rb +++ b/ext/tk/lib/tkextlib/tcllib/ruler.rb @@ -46,7 +46,7 @@ class Tk::Tcllib::Widget::Ruler def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/screenruler.rb b/ext/tk/lib/tkextlib/tcllib/screenruler.rb index 1b4067e2f0..75fa36b66d 100644 --- a/ext/tk/lib/tkextlib/tcllib/screenruler.rb +++ b/ext/tk/lib/tkextlib/tcllib/screenruler.rb @@ -47,7 +47,7 @@ class Tk::Tcllib::Widget::ScreenRuler def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/scrolledwindow.rb b/ext/tk/lib/tkextlib/tcllib/scrolledwindow.rb new file mode 100644 index 0000000000..c9488b4686 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/scrolledwindow.rb @@ -0,0 +1,57 @@ +# +# tkextlib/tcllib/scrolledwindow.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * scrolledwindow widget +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::scrolledwindow', '1.2') +TkPackage.require('widget::scrolledwindow') + +module Tk::Tcllib + module Widget + class Scrolledwindow < Tk::Tile::TFrame + PACKAGE_NAME = 'widget::scrolledwindow'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::scrolledwindow') + rescue + '' + end + end + end + ScrolledWindow = Scrolledwindow + end +end + +class Tk::Tcllib::Widget::ScrolledWindow + TkCommandNames = ['::widget::scrolledwindow'.freeze].freeze + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def getframe + window(tk_send_without_enc('getframe')) + end + alias get_frame getframe + + def setwidget(w) + window(tk_send_without_enc('setwidget', w)) + end + alias set_widget setwidget +end diff --git a/ext/tk/lib/tkextlib/tcllib/scrollwin.rb b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb index 717728e34a..c9f6062fef 100644 --- a/ext/tk/lib/tkextlib/tcllib/scrollwin.rb +++ b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb @@ -42,7 +42,7 @@ class Tk::Tcllib::Widget::ScrolledWindow def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/setup.rb b/ext/tk/lib/tkextlib/tcllib/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tcllib/setup.rb +++ b/ext/tk/lib/tkextlib/tcllib/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tcllib/statusbar.rb b/ext/tk/lib/tkextlib/tcllib/statusbar.rb new file mode 100644 index 0000000000..46a4b9d8b6 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/statusbar.rb @@ -0,0 +1,79 @@ +# +# tkextlib/tcllib/statusbar.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * statusbar widget +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::statusbar', '1.2') +TkPackage.require('widget::statusbar') + +module Tk::Tcllib + module Widget + class Statusbar < Tk::Tile::TFrame + PACKAGE_NAME = 'widget::statusbar'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::statusbar') + rescue + '' + end + end + end + end +end + +class Tk::Tcllib::Widget::Statusbar + TkCommandNames = ['::widget::statusbar'.freeze].freeze + + def __boolval_optkeys + super() << 'separator' << 'resize' << 'resizeseparator' + end + private :__boolval_optkeys + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def getframe + window(tk_send_without_enc('getframe')) + end + alias get_frame getframe + + def add(w, keys={}) + window(tk_send_without_enc('setwidget', *(hash_kv(keys)))) + end + + def remove(*wins) + tk_send_without_enc('remove', *wins) + self + end + + def remove_with_destroy(*wins) + tk_send_without_enc('remove', '-destroy', *wins) + self + end + + def delete(*wins) + tk_send_without_enc('delete', *wins) + self + end + + def items(pat=None) + tk_split_list(tk_send('items', pat)) + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/superframe.rb b/ext/tk/lib/tkextlib/tcllib/superframe.rb index 35da37efbf..adc9c4adbd 100644 --- a/ext/tk/lib/tkextlib/tcllib/superframe.rb +++ b/ext/tk/lib/tkextlib/tcllib/superframe.rb @@ -37,7 +37,7 @@ class Tk::Tcllib::Widget::SuperFrame def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/swaplist.rb b/ext/tk/lib/tkextlib/tcllib/swaplist.rb index 1c813e36da..7698640534 100644 --- a/ext/tk/lib/tkextlib/tcllib/swaplist.rb +++ b/ext/tk/lib/tkextlib/tcllib/swaplist.rb @@ -33,7 +33,7 @@ end class Tk::Tcllib::Swaplist_Dialog TkCommandNames = ['::swaplist::swaplist'.freeze].freeze WidgetClassName = 'Swaplist'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.show(*args) dialog = self.new(*args) @@ -44,7 +44,7 @@ class Tk::Tcllib::Swaplist_Dialog self.show(*args) end - def initialize(*args) + def initialize(*args) # args = (parent=nil, complete_list=[], selected_list=[], keys=nil) keys = args.pop if keys.kind_of?(Hash) @@ -74,9 +74,9 @@ class Tk::Tcllib::Swaplist_Dialog def show @variable.value = '' - @status = bool(tk_call(self.class::TkCommandNames[0], - @path, @variable, - @complete_list, @selected_list, + @status = bool(tk_call(self.class::TkCommandNames[0], + @path, @variable, + @complete_list, @selected_list, *hash_kv(@keys))) end alias display show diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist.rb b/ext/tk/lib/tkextlib/tcllib/tablelist.rb index efeb8fbbac..b40f7a5b8b 100644 --- a/ext/tk/lib/tkextlib/tcllib/tablelist.rb +++ b/ext/tk/lib/tkextlib/tcllib/tablelist.rb @@ -10,7 +10,8 @@ require 'tkextlib/tcllib.rb' # check Tile extension :: If already loaded, use tablelist_tile. unless defined? Tk::Tcllib::Tablelist_usingTile - Tk::Tcllib::Tablelist_usingTile = TkPackage.provide('tile') + Tk::Tcllib::Tablelist_usingTile = + TkPackage.provide('tile') || TkPackage.provide('Ttk') end if Tk::Tcllib::Tablelist_usingTile @@ -20,8 +21,8 @@ if Tk::Tcllib::Tablelist_usingTile else # without Tile - # TkPackage.require('Tablelist', '4.2') - TkPackage.require('Tablelist') + # TkPackage.require('tablelist', '4.2') + TkPackage.require('tablelist') require 'tkextlib/tcllib/tablelist_core' end diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb index d7a6c97210..850e75d845 100644 --- a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb +++ b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb @@ -4,7 +4,7 @@ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # # * Part of tcllib extension -# * This file is required by 'tkextlib/tcllib/tablelist.rb' or +# * This file is required by 'tkextlib/tcllib/tablelist.rb' or # 'tkextlib/tcllib/tablelist_tile.rb'. # @@ -54,7 +54,7 @@ module Tk::Tcllib::TablelistItemConfig elsif idx =~ /([^,]+),([^,]+)/ row = $1, column = $2 [num_or_str(row), num_or_str(column)] - else + else num_or_str(idx) end end @@ -67,6 +67,9 @@ module Tk::Tcllib::TablelistItemConfig [self.path, mixed_id[0] + 'configure', _to_idx(mixed_id[1])] end + def cell_cget_tkstring(tagOrId, option) + itemcget_tkstring(['cell', tagOrId], option) + end def cell_cget(tagOrId, option) itemcget(['cell', tagOrId], option) end @@ -82,12 +85,16 @@ module Tk::Tcllib::TablelistItemConfig def current_cell_configinfo(tagOrId, slot=nil) current_itemconfiginfo(['cell', tagOrId], slot) end + alias cellcget_tkstring cell_cget_tkstring alias cellcget cell_cget alias cellcget_strict cell_cget_strict alias cellconfigure cell_configure alias cellconfiginfo cell_configinfo alias current_cellconfiginfo current_cell_configinfo + def column_cget_tkstring(tagOrId, option) + itemcget_tkstring(['column', tagOrId], option) + end def column_cget(tagOrId, option) itemcget(['column', tagOrId], option) end @@ -103,12 +110,16 @@ module Tk::Tcllib::TablelistItemConfig def current_column_configinfo(tagOrId, slot=nil) current_itemconfiginfo(['column', tagOrId], slot) end + alias columncget_tkstring column_cget_tkstring alias columncget column_cget alias columncget_strict column_cget_strict alias columnconfigure column_configure alias columnconfiginfo column_configinfo alias current_columnconfiginfo current_column_configinfo + def row_cget_tkstring(tagOrId, option) + itemcget_tkstring(['row', tagOrId], option) + end def row_cget(tagOrId, option) itemcget(['row', tagOrId], option) end @@ -124,13 +135,14 @@ module Tk::Tcllib::TablelistItemConfig def current_row_configinfo(tagOrId, slot=nil) current_itemconfiginfo(['row', tagOrId], slot) end + alias rowcget_tkstring row_cget_tkstring alias rowcget row_cget alias rowcget_strict row_cget_strict alias rowconfigure row_configure alias rowconfiginfo row_configinfo alias current_rowconfiginfo current_row_configinfo - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo end @@ -140,11 +152,11 @@ class Tk::Tcllib::Tablelist TkCommandNames = ['::tablelist::tablelist'.freeze].freeze WidgetClassName = 'Tablelist'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -165,16 +177,16 @@ class Tk::Tcllib::Tablelist private :__strval_optkeys def __boolval_optkeys - super() + [ - 'forceeditendcommand', 'movablecolumns', 'movablerows', - 'protecttitlecolumns', 'resizablecolumns', + super() - ['takefocus'] + [ + 'forceeditendcommand', 'movablecolumns', 'movablerows', + 'protecttitlecolumns', 'resizablecolumns', 'setfocus', 'showarrow', 'showlabels', 'showseparators' ] end private :__boolval_optkeys def __listval_optkeys - super() + ['columns'] + super() + ['columns', 'columntitles'] end private :__listval_optkeys @@ -186,7 +198,21 @@ class Tk::Tcllib::Tablelist def __val2ruby_optkeys # { key=>proc, ... } # The method is used to convert a opt-value to a ruby's object. # When get the value of the option "key", "proc.call(value)" is called. - super().update('stretch'=>proc{|v| (v == 'all')? v: simplelist(v)}) + super().update('stretch'=>proc{|v| + (v == 'all')? v: simplelist(v) + }, + 'takefocus'=>proc{|v| + case v + when '1' + true + when '0' + false + when '' + nil + else # cmd + tk_tcl2ruby(cmd) + end + }) end private :__val2ruby_optkeys @@ -194,8 +220,20 @@ class Tk::Tcllib::Tablelist # The method is used to convert a ruby's object to a opt-value. # When set the value of the option "key", "proc.call(value)" is called. # That is, "-#{key} #{proc.call(value)}". - super().update('stretch'=>proc{|v| + super().update('stretch'=>proc{|v| (v.kind_of?(Array))? v.collect{|e| _to_idx(e)}: v + }, + 'takefocus'=>proc{|v| + case v + when true + '1' + when false + '0' + when nil + '' + else + _get_eval_string(v) + end }) end private :__ruby2val_optkeys @@ -211,14 +249,15 @@ class Tk::Tcllib::Tablelist if id[0] == 'cell' super(id) + ['title'] else - super(id) - ['text'] + ['title'] + super(id) - ['text'] + ['title', 'name'] end end private :__item_strval_optkeys def __item_boolval_optkeys(id) super(id) + [ - 'editable', 'hide', 'resizable', 'showarrow', 'stretchable', + 'changesnipside', 'editable', 'hide', 'resizable', 'selectable', + 'showarrow', 'showlinenumbers', 'stretchable', 'stretchwindow', 'wrap' ] end private :__item_boolval_optkeys @@ -249,7 +288,7 @@ class Tk::Tcllib::Tablelist tk_send('activatecell', _to_idx(index)) self end - alias activatecell activate_cell + alias activatecell activate_cell def get_attrib(name=nil) if name && name != None @@ -280,12 +319,29 @@ class Tk::Tcllib::Tablelist TkBindTag.new_by_name(tk_send('bodytag')) end - def cancel_editing + def cancel_editing tk_send('cancelediting') self end alias cancelediting cancel_editing + def get_cellattrib(name=nil) + if name && name != None + tk_send('cellattrib', name) + else + ret = [] + lst = simplelist(tk_send('cellattrib')) + until lst.empty? + ret << ( [lst.shift] << lst.shift ) + end + ret + end + end + def set_cellattrib(*args) + tk_send('cellattrib', *(args.flatten)) + self + end + def cellindex(idx) _from_idx(tk_send('cellindex', _to_idx(idx))) end @@ -321,6 +377,23 @@ class Tk::Tcllib::Tablelist self end + def get_columnattrib(name=nil) + if name && name != None + tk_send('columnattrib', name) + else + ret = [] + lst = simplelist(tk_send('columnattrib')) + until lst.empty? + ret << ( [lst.shift] << lst.shift ) + end + ret + end + end + def set_columnattrib(*args) + tk_send('columnattrib', *(args.flatten)) + self + end + def columncount number(tk_send('columncount')) end @@ -329,6 +402,83 @@ class Tk::Tcllib::Tablelist number(tk_send('columnindex', _to_idx(idx))) end + def columnwidth(idx, opt=nil) + if opt + number(tk_send('columnwidth', _to_idx(idx), "-#{opt}")) + else + number(tk_send('columnwidth', _to_idx(idx))) + end + end + def requested_columnwidth(idx) + columnwidth(idx, 'requested') + end + def stretched_columnwidth(idx) + columnwidth(idx, 'stretched') + end + def total_columnwidth(idx) + columnwidth(idx, 'total') + end + + def configcelllist(lst) # lst ==> [idx, opt, val, idx, opt, val, ...] + ary = [] + lst.slice(3){|idx, opt, val| + ary << _to_idx(idx) << "-#{opt}" << val + } + tk_send('configcelllist', ary) + self + end + alias config_celllist configcelllist + + def configcells(*args) # args ==> idx, opt, val, idx, opt, val, ... + ary = [] + args.slice(3){|idx, opt, val| + ary << _to_idx(idx) << "-#{opt}" << val + } + tk_send('configcells', *ary) + self + end + alias config_cells configcells + + def configcolumnlist(lst) # lst ==> [idx, opt, val, idx, opt, val, ...] + ary = [] + lst.slice(3){|idx, opt, val| + ary << _to_idx(idx) << "-#{opt}" << val + } + tk_send('configcolumnlist', ary) + self + end + alias config_columnlist configcolumnlist + + def configcolumns(*args) # args ==> idx, opt, val, idx, opt, val, ... + ary = [] + args.slice(3){|idx, opt, val| + ary << _to_idx(idx) << "-#{opt}" << val + } + tk_send('configcolumns', *ary) + self + end + alias config_columns configcolumns + + def configrowlist(lst) # lst ==> [idx, opt, val, idx, opt, val, ...] + ary = [] + lst.slice(3){|idx, opt, val| + ary << _to_idx(idx) << "-#{opt}" << val + } + tk_send('configrowlist', ary) + self + end + alias config_rowlist configrowlist + + def configrows(*args) # args ==> idx, opt, val, idx, opt, val, ... + ary = [] + args.slice(3){|idx, opt, val| + ary << _to_idx(idx) << "-#{opt}" << val + } + tk_send('configrows', *ary) + self + end + alias config_rows configrows + def containing(y) idx = num_or_str(tk_send('containing', y)) (idx.kind_of?(Fixnum) && idx < 0)? nil: idx @@ -338,7 +488,7 @@ class Tk::Tcllib::Tablelist idx = _from_idx(tk_send('containingcell', x, y)) if idx.kind_of?(Array) [ - ((idx[0].kind_of?(Fixnum) && idx[0] < 0)? nil: idx[0]), + ((idx[0].kind_of?(Fixnum) && idx[0] < 0)? nil: idx[0]), ((idx[1].kind_of?(Fixnum) && idx[1] < 0)? nil: idx[1]) ] else @@ -392,6 +542,10 @@ class Tk::Tcllib::Tablelist end alias editcell edit_cell + def editwintag + TkBindTag.new_by_name(tk_send('editwintag')) + end + def editwinpath window(tk_send('editwinpath')) end @@ -412,6 +566,11 @@ class Tk::Tcllib::Tablelist end alias finishediting finish_editing + def formatinfo + key, row, col = simplelist(tk_send('formatinfo')) + [key, number(row), number(col)] + end + def get(first, last=nil) if first.kind_of?(Array) simplelist(tk_send('get', first.collect{|idx| _to_idx(idx)})).collect!{|elem| simplelist(elem) } @@ -455,6 +614,22 @@ class Tk::Tcllib::Tablelist end alias getkeys get_keys + def has_attrib?(name) + bool(tk_send('hasattrib', name)) + end + + def has_cellattrib?(idx, name) + bool(tk_send('hascellattrib', _to_idx(idx), name)) + end + + def has_columnattrib?(idx, name) + bool(tk_send('hascolumnattrib', _to_idx(idx), name)) + end + + def has_rowattrib?(idx, name) + bool(tk_send('hasrowattrib', _to_idx(idx), name)) + end + def imagelabelpath(idx) window(tk_send('imagelabelpath', _to_idx(idx))) end @@ -486,6 +661,16 @@ class Tk::Tcllib::Tablelist end alias insertlist insert_list + def is_elem_snipped?(cellidx, tkvar) + bool(tk_send('iselemsnipped', _to_idx(cellidx), tkvar)) + end + alias elem_snipped? is_elem_snipped? + + def is_title_snipped?(colidx, tkvar) + bool(tk_send('istitlesnipped', _to_idx(colidx), tkvar)) + end + alias title_snipped? is_title_snipped? + def itemlistvar TkVarAccess.new(tk_send('itemlistvar')) end @@ -498,6 +683,10 @@ class Tk::Tcllib::Tablelist simplelist(tk_send('labels')) end + def labeltag + TkBindTag.new_by_name(tk_send('labeltag')) + end + def move(src, target) tk_send('move', _to_idx(src), _to_idx(target)) self @@ -535,6 +724,23 @@ class Tk::Tcllib::Tablelist end alias resetsortinfo reset_sortinfo + def get_rowattrib(name=nil) + if name && name != None + tk_send('rowattrib', name) + else + ret = [] + lst = simplelist(tk_send('rowattrib')) + until lst.empty? + ret << ( [lst.shift] << lst.shift ) + end + ret + end + end + def set_rowattrib(*args) + tk_send('rowattrib', *(args.flatten)) + self + end + def scan_mark(x, y) tk_send('scan', 'mark', x, y) self @@ -633,7 +839,22 @@ class Tk::Tcllib::Tablelist self end - DEFAULT_sortByColumn_cmd = '::tablelist::sortByColumn' + + # default of 'labelcommand' option + DEFAULT_labelcommand_value = + DEFAULT_sortByColumn_cmd = '::tablelist::sortByColumn' + + # default of 'labelcommand2' option + DEFAULT_labelcommand2_value = + DEFAULT_addToSortColumns_cmd = '::tablelist::addToSortColumns' + + def sortByColumn_with_event_generate(idx) + tk_call('::tablelist::sortByColumn', @path, _to_idx(idx)) + end + + def addToSortColumns_with_event_generate(idx) + tk_call('::tablelist::addToSortColumns', @path, _to_idx(idx)) + end def sort_by_column(idx, order=nil) if order @@ -659,15 +880,49 @@ class Tk::Tcllib::Tablelist self end + def sort_by_columnlist(idxlist, orderlist=None) + # orderlist :: list of 'increasing' or 'decreasing' + tk_send('sortbycolumnlist', idxlist.map{|idx| _to_idx(idx)}, orderlist) + self + end + def sortcolumn idx = num_or_str(tk_send('sortcolum')) (idx.kind_of?(Fixnum) && idx < 0)? nil: idx end + def sortcolumnlist + simplelist(tk_send('sortcolumlist')).map{|col| num_or_str(col)} + end + def sortorder tk_send('sortorder') end + def sortorderlist + simplelist(tk_send('sortorderlist')) + end + + def toggle_columnhide(first, last=nil) + if first.kind_of?(Array) + tk_send('togglecolumnhide', first.collect{|idx| _to_idx(idx)}) + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + tk_send('togglecolumnhide', first, last) + end + end + + def toggle_rowhide(first, last=nil) + if first.kind_of?(Array) + tk_send('togglerowhide', first.collect{|idx| _to_idx(idx)}) + else + first = _to_idx(first) + last = (last)? _to_idx(last): first + tk_send('togglerowhide', first, last) + end + end + def toggle_visibility(first, last=nil) if first.kind_of?(Array) tk_send('togglevisibility', first.collect{|idx| _to_idx(idx)}) @@ -680,6 +935,26 @@ class Tk::Tcllib::Tablelist end alias togglevisibility toggle_visibility + def unset_attrib(name) + tk_send('unsetattrib', name) + self + end + + def unset_cellattrib(idx, name) + tk_send('unsetcellattrib', _to_idx(idx), name) + self + end + + def unset_columnattrib(idx, name) + tk_send('unsetcolumnattrib', _to_idx(idx), name) + self + end + + def unset_rowattrib(idx, name) + tk_send('unsetrowattrib', _to_idx(idx), name) + self + end + def windowpath(idx) window(tk_send('windowpath', _to_idx(idx))) end @@ -692,13 +967,18 @@ class << Tk::Tcllib::Tablelist window(Tk.tk_call('::tablelist::getTablelistPath', descendant)) end + def getTablelistColumn(descendant) + num_or_str(Tk.tk_call('::tablelist::getTablelistColumn', headerlabel)) + end + + def convEventFields(descendant, x, y) window(Tk.tk_call('::tablelist::convEventFields', descendant, x, y)) end ############################################################ - # with the BWidget package + # with the BWidget package def addBWidgetEntry(name=None) Tk.tk_call('::tablelist::addBWidgetEntry', name) end @@ -713,7 +993,7 @@ class << Tk::Tcllib::Tablelist ############################################################ - # with the Iwidgets ([incr Widgets]) package + # with the Iwidgets ([incr Widgets]) package def addIncrEntryfield(name=None) Tk.tk_call('::tablelist::addIncrEntry', name) end @@ -767,6 +1047,16 @@ class << Tk::Tcllib::Tablelist Tk.tk_call('::tablelist::addTimeMentry', format, separator, gmt, name) end + def addDateTimeMentry(format, date_sep, time_sep, gmt=false, name=None) + if gmt && gmt != None + gmt = '-gmt' + else + gmt = None + end + Tk.tk_call('::tablelist::addDateTimeMentry', + format, date_sep, time_sep, gmt, name) + end + def addFixedPointMentry(count1, count2, comma=false, name=None) if comma && comma != None comma = '-comma' diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb index 0cb4eb735d..0a1458415e 100644 --- a/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb +++ b/ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb @@ -9,7 +9,7 @@ require 'tk' require 'tkextlib/tcllib.rb' # TkPackage.require('tablelist_tile', '4.2') -TkPackage.require('Tablelist_tile') +TkPackage.require('tablelist_tile') unless defined? Tk::Tcllib::Tablelist_usingTile Tk::Tcllib::Tablelist_usingTile = true @@ -19,6 +19,24 @@ requrie 'tkextlib/tcllib/tablelist_core' module Tk module Tcllib + class Tablelist + # commands related to tile Themems + def self.set_theme(theme) + Tk.tk_call('::tablelist::setTheme', theme) + end + + def self.get_current_theme + Tk.tk_call('::tablelist::getCurrentTheme') + end + + def self.get_theme_list + TkComm.simplelist(Tk.tk_call('::tablelist::getThemes')) + end + def self.set_theme_defaults + Tk.tk_call('::tablelist::setThemeDefaults') + end + end + Tablelist_Tile = Tablelist TableList_Tile = Tablelist end diff --git a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb index b366e0198b..2f6e4b44fc 100644 --- a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb +++ b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb @@ -52,7 +52,7 @@ module Tk::Tcllib::Tkpiechart private :__config_cmd def __configinfo_struct - {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, + {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, :default_value=>1, :current_value=>2} end private :__configinfo_struct @@ -63,7 +63,7 @@ module Tk::Tcllib::Tkpiechart private :__boolval_optkeys def __strval_optkeys - super() << 'bordercolor' << 'textbackground' << + super() << 'bordercolor' << 'textbackground' << 'widestvaluetext' << 'title' end private :__strval_optkeys @@ -90,7 +90,7 @@ module Tk::Tcllib::Tkpiechart def create_self(x, y, width, height, keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', 'pie', + @tag_key = tk_call_without_enc('::stooop::new', 'pie', @c, x, y, *hash_kv(keys, true)) else @tag_key = tk_call_without_enc('::stooop::new', 'pie', @c, x, y) @@ -148,7 +148,7 @@ module Tk::Tcllib::Tkpiechart end def selected_slices - tk_split_simplelist(tk_call_without_enc('pie::selectedSlices', + tk_split_simplelist(tk_call_without_enc('pie::selectedSlices', @tag_key)).collect{|slice| @slice_tbl[slice] || Slice.new(:no_create, self, slice) } @@ -212,7 +212,7 @@ module Tk::Tcllib::Tkpiechart end def size(share, disp=None) - tk_call_without_enc('pie::sizeSlice', + tk_call_without_enc('pie::sizeSlice', @pie.tag_key, @tag_key, share, disp) self end @@ -236,7 +236,7 @@ module Tk::Tcllib::Tkpiechart def create_self(keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler', + @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler', *hash_kv(keys, true)) else @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler') @@ -268,8 +268,8 @@ module Tk::Tcllib::Tkpiechart def create_self(keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', - 'piePeripheralLabeler', + @tag_key = tk_call_without_enc('::stooop::new', + 'piePeripheralLabeler', *hash_kv(keys, true)) else @tag_key = tk_call_without_enc('::stooop::new', 'piePeripheralLabeler') @@ -296,11 +296,11 @@ module Tk::Tcllib::Tkpiechart def create_self(x, y, keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', - @c, x, y, width, height, + @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', + @c, x, y, width, height, *hash_kv(keys, true)) else - @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', + @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', @c, x, y, width, height) end diff --git a/ext/tk/lib/tkextlib/tcllib/toolbar.rb b/ext/tk/lib/tkextlib/tcllib/toolbar.rb new file mode 100644 index 0000000000..6eae4eb3e1 --- /dev/null +++ b/ext/tk/lib/tkextlib/tcllib/toolbar.rb @@ -0,0 +1,175 @@ +# +# tkextlib/tcllib/toolbar.rb +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +# * Part of tcllib extension +# * toolbar widget +# + +require 'tk' +require 'tkextlib/tcllib.rb' + +# TkPackage.require('widget::toolbar', '1.2') +TkPackage.require('widget::toolbar') + +module Tk::Tcllib + module Widget + class Toolbar < TkWindow + PACKAGE_NAME = 'widget::toolbar'.freeze + def self.package_name + PACKAGE_NAME + end + + def self.package_version + begin + TkPackage.require('widget::toolbar') + rescue + '' + end + end + end + + module ToolbarItemConfig + include TkItemConfigMethod + end + end +end + + +class Tk::Tcllib::Widget::ToolbarItem < TkObject + include TkTreatTagFont + + ToolbarItemID_TBL = TkCore::INTERP.create_table + + TkCore::INTERP.init_ip_env{ + TTagID_TBL.mutex.synchronize{ TTagID_TBL.clear } + } + + def ToolbarItem.id2obj(tbar, id) + tpath = tbar.path + ToolbarItemID_TBL.mutex.synchronize{ + if ToolbarItemID_TBL[tpath] + ToolbarItemID_TBL[tpath][id]? ToolbarItemID_TBL[tpath][id]: id + else + id + end + } + end + + def initaialize(parent, *args) + @parent = @t = parent + @tpath = parent.path + + @path = @id = @t.tk_send('add', *args) + # A same id is rejected by the Tcl function. + + ToolbarItemID_TBL.mutex.synchronize{ + ToolbarItemID_TBL[@id] = self + ToolbarItemID_TBL[@tpath] = {} unless ToolbarItemID_TBL[@tpath] + ToolbarItemID_TBL[@tpath][@id] = self + } + end + + def [](key) + cget key + end + + def []=(key,val) + configure key, val + val + end + + def cget_tkstring(option) + @t.itemcget_tkstring(@id, option) + end + def cget(option) + @t.itemcget(@id, option) + end + def cget_strict(option) + @t.itemcget_strict(@id, option) + end + + def configure(key, value=None) + @t.itemconfigure(@id, key, value) + self + end + + def configinfo(key=nil) + @t.itemconfiginfo(@id, key) + end + + def current_configinfo(key=nil) + @t.current_itemconfiginfo(@id, key) + end + + def delete + @t.delete(@id) + end + + def itemid + @t.itemid(@id) + end + + def remove + @t.remove(@id) + end + def remove_with_destroy + @t.remove_with_destroy(@id) + end +end + +class Tk::Tcllib::Widget::Toolbar + include Tk::Tcllib::Widget::ToolbarItemConfig + + TkCommandNames = ['::widget::toolbar'.freeze].freeze + + def __destroy_hook__ + Tk::Tcllib::Widget::ToolbarItem::ToolbarItemID_TBL.mutex.synchronize{ + Tk::Tcllib::Widget::ToolbarItem::ToolbarItemID_TBL.delete(@path) + } + end + + def create_self(keys) + if keys and keys != None + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + else + tk_call_without_enc(self.class::TkCommandNames[0], @path) + end + end + private :create_self + + def getframe + window(tk_send('getframe')) + end + alias get_frame getframe + + def add(*args) + Tk::Tcllib::Widget::Toolbar.new(self, *args) + end + + def itemid(item) + window(tk_send('itemid')) + end + + def items(pattern) + tk_split_simplelist(tk_send('items', pattern)).map{|id| + Tk::Tcllib::Widget::ToolbarItem.id2obj(self, id) + } + end + + def remove(*items) + tk_send('remove', *items) + self + end + + def remove_with_destroy(*items) + tk_send('remove', '-destroy', *items) + self + end + + def delete(*items) + tk_send('delete', *items) + self + end +end diff --git a/ext/tk/lib/tkextlib/tcllib/tooltip.rb b/ext/tk/lib/tkextlib/tcllib/tooltip.rb index 4301b39fd3..070e63a7b5 100644 --- a/ext/tk/lib/tkextlib/tcllib/tooltip.rb +++ b/ext/tk/lib/tkextlib/tcllib/tooltip.rb @@ -3,7 +3,7 @@ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # # * Part of tcllib extension -# * Provides tooltips, a small text message that is displayed when the +# * Provides tooltips, a small text message that is displayed when the # mouse hovers over a widget. # @@ -34,6 +34,8 @@ module Tk::Tcllib::Tooltip extend TkCore WidgetClassName = 'Tooltip'.freeze + WidgetClassNames[WidgetClassName] ||= self + def self.database_classname self::WidgetClassName end @@ -64,6 +66,13 @@ module Tk::Tcllib::Tooltip self.delay(millisecs) end + def self.fade? + bool(tk_call_without_enc('::tooltip::tooltip', 'fade')) + end + def self.fade(mode) + tk_call_without_enc('::tooltip::tooltip', 'fade', mode) + end + def self.disable tk_call_without_enc('::tooltip::tooltip', 'disable') false @@ -86,7 +95,7 @@ module Tk::Tcllib::Tooltip else args = msg end - tk_call_without_enc('::tooltip::tooltip', widget.path, *args) + tk_call('::tooltip::tooltip', widget.path, *args) end def self.erase(widget) diff --git a/ext/tk/lib/tkextlib/tcllib/widget.rb b/ext/tk/lib/tkextlib/tcllib/widget.rb index ed69f67ce6..57fdf7a575 100644 --- a/ext/tk/lib/tkextlib/tcllib/widget.rb +++ b/ext/tk/lib/tkextlib/tcllib/widget.rb @@ -26,10 +26,41 @@ module Tk::Tcllib '' end end + + #--- followings may be private functions of tklib + def self.isa(compare_as, *args) + begin + return Tk.tk_call('::widget::isa', compare_as, *args) + rescue => e + if TkComm.bool(Tk.tk_call('info','command','::widget::isa')) || + ! TkComm.bool(Tk.tk_call('info','command','::widget::validate')) + fail e + end + end + Tk.tk_call('::widget::validate', compare_as, *args) + end + def self.validate(compare_as, *args) + begin + return Tk.tk_call('::widget::validate', compare_as, *args) + rescue => e + if TkComm.bool(Tk.tk_call('info','command','::widget::validate')) || + ! TkComm.bool(Tk.tk_call('info','command','::widget::isa')) + fail e + end + end + Tk.tk_call('::widget::isa', compare_as, *args) + end end end module Tk::Tcllib::Widget + TkComm::TkExtlibAutoloadModule.unshift(self) + + autoload :Calendar, 'tkextlib/tcllib/calendar' + + autoload :Canvas_Sqmap, 'tkextlib/tcllib/canvas_sqmap' + autoload :Canvas_Zoom, 'tkextlib/tcllib/canvas_zoom' + autoload :Dialog, 'tkextlib/tcllib/dialog' autoload :Panelframe, 'tkextlib/tcllib/panelframe' @@ -45,4 +76,7 @@ module Tk::Tcllib::Widget autoload :Superframe, 'tkextlib/tcllib/superframe' autoload :SuperFrame, 'tkextlib/tcllib/superframe' + + autoload :Toolbar, 'tkextlib/tcllib/toolbar' + autoload :ToolbarItem, 'tkextlib/tcllib/toolbar' end diff --git a/ext/tk/lib/tkextlib/tclx/setup.rb b/ext/tk/lib/tkextlib/tclx/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tclx/setup.rb +++ b/ext/tk/lib/tkextlib/tclx/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb index 60ea012cc0..6c11e212ae 100644 --- a/ext/tk/lib/tkextlib/tile.rb +++ b/ext/tk/lib/tkextlib/tile.rb @@ -16,12 +16,39 @@ require 'tkextlib/tile/setup.rb' # TkPackage.require('tile', '0.4') # TkPackage.require('tile', '0.6') # TkPackage.require('tile', '0.7') -if Tk::TK_MAJOR_VERSION > 8 || +if Tk::TK_MAJOR_VERSION > 8 || (Tk::TK_MAJOR_VERSION == 8 && Tk::TK_MINOR_VERSION >= 5) - TkPackage.require('tile') # for compatibility (version check of 'tile') - verstr = TkPackage.require('Ttk') + begin + TkPackage.require('tile') # for compatibility (version check of 'tile') + rescue RuntimeError + # ignore, even if cannot find package 'tile' + end + pkgname = 'Ttk' else - verstr = TkPackage.require('tile') + pkgname = 'tile' +end + +begin + verstr = TkPackage.require(pkgname) +rescue RuntimeError + # define dummy methods + module Tk + module Tile + CANNOT_FIND_PACKAGE = true + def self.const_missing(sym) + TkPackage.require(PACKAGE_NAME) + end + def self.method_missing(*args) + TkPackage.require(PACKAGE_NAME) + end + end + end + Tk.__cannot_find_tk_package_for_widget_set__(:Ttk, pkgname) + if pkgname == 'Ttk' + verstr = Tk::TK_PATCHLEVEL # dummy + else + verstr = '0.7' # dummy + end end ver = verstr.split('.') @@ -105,17 +132,17 @@ module Tk def self.__define_LoadImages_proc_for_compatibility__! # Ttk 8.5 (Tile 0.8) lost 'LoadImages' utility procedure. - # So, some old scripts doen't work, because those scripts use the - # procedure to define local styles. - # Of course, rewriting such Tcl/Tk scripts isn't difficult for - # Tcl/Tk users. However, it may be troublesome for Ruby/Tk users + # So, some old scripts doen't work, because those scripts use the + # procedure to define local styles. + # Of course, rewriting such Tcl/Tk scripts isn't difficult for + # Tcl/Tk users. However, it may be troublesome for Ruby/Tk users # who use such Tcl/Tk scripts as it is. - # This method may help Ruby/Tk users who don't want to modify old + # This method may help Ruby/Tk users who don't want to modify old # Tcl/Tk scripts for the latest version of Ttk (Tile) extension. - # This method defines a comaptible 'LoadImages' procedure on the - # Tcl/Tk interpreter working under Ruby/Tk. - # Please give attention to use this method. It may conflict with - # some definitions on Tcl/Tk scripts. + # This method defines a comaptible 'LoadImages' procedure on the + # Tcl/Tk interpreter working under Ruby/Tk. + # Please give attention to use this method. It may conflict with + # some definitions on Tcl/Tk scripts. klass_name = self.name proc_name = 'LoadImages' if Tk::Tile::USE_TTK_NAMESPACE @@ -140,7 +167,7 @@ module Tk next end TkNamespace.eval(ns){ - TkCore::INTERP.add_tk_procs(proc_name, 'imgdir {patterns {*.gif}}', + TkCore::INTERP.add_tk_procs(proc_name, 'imgdir {patterns {*.gif}}', <<-'EOS') foreach pattern $patterns { foreach file [glob -directory $imgdir $pattern] { @@ -166,7 +193,7 @@ module Tk pat ||= TkComm::None images = Hash[*TkComm.simplelist(Tk.tk_call(cmd, imgdir, pat))] images.keys.each{|k| - images[k] = TkPhotoImage.new(:imagename=>images[k], + images[k] = TkPhotoImage.new(:imagename=>images[k], :without_creating=>true) } else ## TILE_SPEC_VERSION_ID >= 8 @@ -181,7 +208,7 @@ module Tk Dir.glob(pat).each{|f| img = File.basename(f, '.*') unless TkComm.bool(Tk.info('exists', "images(#{img})")) - Tk.tk_call('set', "images(#{img})", + Tk.tk_call('set', "images(#{img})", Tk.tk_call('image', 'create', 'photo', '-file', f)) end } @@ -189,7 +216,7 @@ module Tk } images = Hash[*TkComm.simplelist(Tk.tk_call('array', 'get', 'images'))] images.keys.each{|k| - images[k] = TkPhotoImage.new(:imagename=>images[k], + images[k] = TkPhotoImage.new(:imagename=>images[k], :without_creating=>true) } end @@ -213,8 +240,8 @@ module Tk begin TkComm.simplelist(Tk.tk_call_without_enc(*cmd)) rescue - TkComm.simplelist(Tk.tk_call('lsearch', '-all', '-inline', - Tk::Tile::Style.theme_names, + TkComm.simplelist(Tk.tk_call('lsearch', '-all', '-inline', + Tk::Tile::Style.theme_names, glob_ptn)) end end @@ -264,8 +291,8 @@ module Tk Icon = 'TkIconFont' TkFont::SYSTEM_FONT_NAMES.add [ - 'TkDefaultFont', 'TkTextFont', 'TkHeadingFont', - 'TkCaptionFont', 'TkTooltipFont', 'TkFixedFont', + 'TkDefaultFont', 'TkTextFont', 'TkHeadingFont', + 'TkCaptionFont', 'TkTooltipFont', 'TkFixedFont', 'TkMenuFont', 'TkSmallCaptionFont', 'TkIconFont' ] end @@ -280,7 +307,7 @@ module Tk until lst.empty? if lst[0][0] == ?- k = lst.shift[1..-1] - children = lst.shift + children = lst.shift children = _style_layout(children) if children.kind_of?(Array) keys[k] = children else @@ -332,7 +359,7 @@ module Tk end alias tile_identify ttk_identify - # remove instate/state/identify method + # remove instate/state/identify method # to avoid the conflict with widget options if Tk.const_defined?(:USE_OBSOLETE_TILE_STATE_METHOD) && Tk::USE_OBSOLETE_TILE_STATE_METHOD alias instate ttk_instate @@ -404,6 +431,9 @@ module Tk autoload :TSeparator, 'tkextlib/tile/tseparator' autoload :Separator, 'tkextlib/tile/tseparator' + autoload :TSpinbox, 'tkextlib/tile/tspinbox' + autoload :Spinbox, 'tkextlib/tile/tspinbox' + autoload :TSquare, 'tkextlib/tile/tsquare' autoload :Square, 'tkextlib/tile/tsquare' diff --git a/ext/tk/lib/tkextlib/tile/dialog.rb b/ext/tk/lib/tkextlib/tile/dialog.rb index ef2d1fe577..b112e6152b 100644 --- a/ext/tk/lib/tkextlib/tile/dialog.rb +++ b/ext/tk/lib/tkextlib/tile/dialog.rb @@ -12,6 +12,12 @@ module Tk end end +begin + TkPackage.require('ttk::dialog') # this may be required. +rescue RuntimeError + # ignore +end + class Tk::Tile::Dialog TkCommandNames = ['::ttk::dialog'.freeze].freeze diff --git a/ext/tk/lib/tkextlib/tile/setup.rb b/ext/tk/lib/tkextlib/tile/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tile/setup.rb +++ b/ext/tk/lib/tkextlib/tile/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tile/sizegrip.rb b/ext/tk/lib/tkextlib/tile/sizegrip.rb index c5068919a4..d7da0a4075 100644 --- a/ext/tk/lib/tkextlib/tile/sizegrip.rb +++ b/ext/tk/lib/tkextlib/tile/sizegrip.rb @@ -13,17 +13,20 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Sizegrip, :TkSizegrip, :TkSizeGrip) - - class Tk::Tile::SizeGrip < TkWindow include Tk::Tile::TileWidget TkCommandNames = ['::ttk::sizegrip'.freeze].freeze WidgetClassName = 'TSizegrip'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Sizegrip, +# :TkSizegrip, :TkSizeGrip) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/sizegrip.rb', + :Ttk, Tk::Tile::Sizegrip, + :TkSizegrip, :TkSizeGrip) diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb index ca7ee99c32..f38deda503 100644 --- a/ext/tk/lib/tkextlib/tile/style.rb +++ b/ext/tk/lib/tkextlib/tile/style.rb @@ -21,16 +21,16 @@ class << Tk::Tile::Style TkCommandNames = ['style'.freeze].freeze # --- Tk::Tile::Style.__define_wrapper_proc_for_compatibility__! --- - # On Ttk (Tile) extension, 'style' command has imcompatible changes - # depend on the version of the extention. It requires modifying the - # Tcl/Tk scripts to define local styles. The rule for modification - # is a simple one. But, if users want to keep compatibility between - # versions of the extension, they will have to contrive to do that. + # On Ttk (Tile) extension, 'style' command has imcompatible changes + # depend on the version of the extention. It requires modifying the + # Tcl/Tk scripts to define local styles. The rule for modification + # is a simple one. But, if users want to keep compatibility between + # versions of the extension, they will have to contrive to do that. # It may be troublesome, especially for Ruby/Tk users. - # This method may help such work. This method make some definitions - # on the Tcl/Tk interpreter to work with different version of style - # command format. Please give attention to use this method. It may - # conflict with some definitions on Tcl/Tk scripts. + # This method may help such work. This method make some definitions + # on the Tcl/Tk interpreter to work with different version of style + # command format. Please give attention to use this method. It may + # conflict with some definitions on Tcl/Tk scripts. if Tk::Tile::TILE_SPEC_VERSION_ID < 7 def __define_wrapper_proc_for_compatibility__! __define_themes_and_setTheme_proc__! @@ -210,7 +210,7 @@ class << Tk::Tile::Style end def lookup(style, opt, state=None, fallback_value=None) - tk_call(TkCommandNames[0], 'lookup', style, + tk_call(TkCommandNames[0], 'lookup', style, '-' << opt.to_s, state, fallback_value) end @@ -233,6 +233,8 @@ class << Tk::Tile::Style def element_create(name, type, *args) if type == 'image' || type == :image element_create_image(name, *args) + elsif type == 'vsapi' || type == :vsapi + element_create_vsapi(name, *args) else tk_call(TkCommandNames[0], 'element', 'create', name, type, *args) end @@ -253,7 +255,7 @@ class << Tk::Tile::Style # probably, command format is tile 0.8+ (Tcl/Tk8.5+) style if Tk::Tile::TILE_SPEC_VERSION_ID >= 8 if opts - tk_call(TkCommandNames[0], + tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec, opts) else tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec) @@ -262,7 +264,7 @@ class << Tk::Tile::Style fail ArgumentError, 'illegal arguments' if opts.key?('map') base = spec.shift opts['map'] = spec - tk_call(TkCommandNames[0], + tk_call(TkCommandNames[0], 'element', 'create', name, 'image', base, opts) end else @@ -271,7 +273,7 @@ class << Tk::Tile::Style spec = [spec, *(opts.delete('map'))] if opts.key?('map') end if opts - tk_call(TkCommandNames[0], + tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec, opts) else tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec) @@ -279,6 +281,24 @@ class << Tk::Tile::Style end end + def element_create_vsapi(name, class_name, part_id, *args) + # supported on Tcl/Tk 8.6 or later + + # argument check + if (state_map = args.shift || None) + if state_map.kind_of?(Hash) + opts = _symbolkey2str(state_map) + state_map = None + end + end + opts = args.shift || None + fail ArgumentError, "too many arguments" unless args.empty? + + # define a Microsoft Visual Styles element + tk_call(TkCommandNames[0], 'element', 'create', name, 'vsapi', + class_name, part_id, state_map, opts) + end + def element_names() list(tk_call(TkCommandNames[0], 'element', 'names')) end diff --git a/ext/tk/lib/tkextlib/tile/tbutton.rb b/ext/tk/lib/tkextlib/tile/tbutton.rb index 5d7db10fe9..c852024842 100644 --- a/ext/tk/lib/tkextlib/tile/tbutton.rb +++ b/ext/tk/lib/tkextlib/tile/tbutton.rb @@ -13,9 +13,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Button, :TkButton) - - class Tk::Tile::TButton < Tk::Button include Tk::Tile::TileWidget @@ -25,9 +22,13 @@ class Tk::Tile::TButton < Tk::Button TkCommandNames = ['::tbutton'.freeze].freeze end WidgetClassName = 'TButton'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Button, :TkButton) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tbutton.rb', + :Ttk, Tk::Tile::Button, :TkButton) diff --git a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb index 172225fcec..01751ede0f 100644 --- a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb +++ b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb @@ -15,10 +15,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Checkbutton, - :TkCheckbutton, :TkCheckButton) - - class Tk::Tile::TCheckButton < Tk::CheckButton include Tk::Tile::TileWidget @@ -28,9 +24,15 @@ class Tk::Tile::TCheckButton < Tk::CheckButton TkCommandNames = ['::tcheckbutton'.freeze].freeze end WidgetClassName = 'TCheckbutton'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Checkbutton, +# :TkCheckbutton, :TkCheckButton) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tcheckbutton.rb', + :Ttk, Tk::Tile::Checkbutton, + :TkCheckbutton, :TkCheckButton) diff --git a/ext/tk/lib/tkextlib/tile/tcombobox.rb b/ext/tk/lib/tkextlib/tile/tcombobox.rb index b64372f1c9..b5ab827e2d 100644 --- a/ext/tk/lib/tkextlib/tile/tcombobox.rb +++ b/ext/tk/lib/tkextlib/tile/tcombobox.rb @@ -13,9 +13,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Combobox, :TkCombobox) - - class Tk::Tile::TCombobox < Tk::Tile::TEntry include Tk::Tile::TileWidget @@ -25,7 +22,7 @@ class Tk::Tile::TCombobox < Tk::Tile::TEntry TkCommandNames = ['::tcombobox'.freeze].freeze end WidgetClassName = 'TCombobox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys super() << 'exportselection' @@ -52,3 +49,7 @@ class Tk::Tile::TCombobox < Tk::Tile::TEntry tk_send('set', val) end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Combobox, :TkCombobox) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tcombobox.rb', + :Ttk, Tk::Tile::Combobox, :TkCombobox) diff --git a/ext/tk/lib/tkextlib/tile/tentry.rb b/ext/tk/lib/tkextlib/tile/tentry.rb index 0bea98dcd9..8d2633a774 100644 --- a/ext/tk/lib/tkextlib/tile/tentry.rb +++ b/ext/tk/lib/tkextlib/tile/tentry.rb @@ -13,9 +13,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Entry, :TkEntry) - - class Tk::Tile::TEntry < Tk::Entry include Tk::Tile::TileWidget @@ -25,7 +22,7 @@ class Tk::Tile::TEntry < Tk::Entry TkCommandNames = ['::tentry'.freeze].freeze end WidgetClassName = 'TEntry'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __optkey_aliases {:vcmd=>:validatecommand, :invcmd=>:invalidcommand} @@ -46,3 +43,7 @@ class Tk::Tile::TEntry < Tk::Entry [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Entry, :TkEntry) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tentry.rb', + :Ttk, Tk::Tile::Entry, :TkEntry) diff --git a/ext/tk/lib/tkextlib/tile/tframe.rb b/ext/tk/lib/tkextlib/tile/tframe.rb index 3b5f98bb6e..d6d4312628 100644 --- a/ext/tk/lib/tkextlib/tile/tframe.rb +++ b/ext/tk/lib/tkextlib/tile/tframe.rb @@ -13,9 +13,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Frame, :TkFrame) - - class Tk::Tile::TFrame < Tk::Frame include Tk::Tile::TileWidget @@ -25,9 +22,13 @@ class Tk::Tile::TFrame < Tk::Frame TkCommandNames = ['::tframe'.freeze].freeze end WidgetClassName = 'TFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Frame, :TkFrame) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tframe.rb', + :Ttk, Tk::Tile::Frame, :TkFrame) diff --git a/ext/tk/lib/tkextlib/tile/tlabel.rb b/ext/tk/lib/tkextlib/tile/tlabel.rb index 7d074d3842..55b98acc68 100644 --- a/ext/tk/lib/tkextlib/tile/tlabel.rb +++ b/ext/tk/lib/tkextlib/tile/tlabel.rb @@ -13,9 +13,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Label, :TkLabel) - - class Tk::Tile::TLabel < Tk::Label include Tk::Tile::TileWidget @@ -25,9 +22,13 @@ class Tk::Tile::TLabel < Tk::Label TkCommandNames = ['::tlabel'.freeze].freeze end WidgetClassName = 'TLabel'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Label, :TkLabel) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tlabel.rb', + :Ttk, Tk::Tile::Label, :TkLabel) diff --git a/ext/tk/lib/tkextlib/tile/tlabelframe.rb b/ext/tk/lib/tkextlib/tile/tlabelframe.rb index cff66d8658..a34c98583f 100644 --- a/ext/tk/lib/tkextlib/tile/tlabelframe.rb +++ b/ext/tk/lib/tkextlib/tile/tlabelframe.rb @@ -15,10 +15,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Labelframe, - :TkLabelframe, :TkLabelFrame) - - class Tk::Tile::TLabelframe < Tk::Tile::TFrame include Tk::Tile::TileWidget @@ -28,9 +24,15 @@ class Tk::Tile::TLabelframe < Tk::Tile::TFrame TkCommandNames = ['::tlabelframe'.freeze].freeze end WidgetClassName = 'TLabelframe'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Labelframe, +# :TkLabelframe, :TkLabelFrame) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tlabelframe.rb', + :Ttk, Tk::Tile::Labelframe, + :TkLabelframe, :TkLabelFrame) diff --git a/ext/tk/lib/tkextlib/tile/tmenubutton.rb b/ext/tk/lib/tkextlib/tile/tmenubutton.rb index 7c6ab28e52..1cf553ec8c 100644 --- a/ext/tk/lib/tkextlib/tile/tmenubutton.rb +++ b/ext/tk/lib/tkextlib/tile/tmenubutton.rb @@ -15,10 +15,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Menubutton, - :TkMenubutton, :TkMenuButton) - - class Tk::Tile::TMenubutton < Tk::Menubutton include Tk::Tile::TileWidget @@ -28,9 +24,15 @@ class Tk::Tile::TMenubutton < Tk::Menubutton TkCommandNames = ['::tmenubutton'.freeze].freeze end WidgetClassName = 'TMenubutton'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Menubutton, +# :TkMenubutton, :TkMenuButton) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tmenubutton.rb', + :Ttk, Tk::Tile::Menubutton, + :TkMenubutton, :TkMenuButton) diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb index 4d65e363da..9e27e2c1fd 100644 --- a/ext/tk/lib/tkextlib/tile/tnotebook.rb +++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb @@ -13,13 +13,10 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Notebook, :TkNotebook) - - class Tk::Tile::TNotebook < TkWindow ################################ include TkItemConfigMethod - + def __item_cget_cmd(id) [self.path, 'tab', id] end @@ -46,8 +43,11 @@ class Tk::Tile::TNotebook < TkWindow alias tabconfiginfo itemconfiginfo alias current_tabconfiginfo current_itemconfiginfo + def tabcget_tkstring(tagOrId, option) + tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{option}")), false, true)[-1] + end def tabcget_strict(tagOrId, option) - tabconfigure(tagOrId, option)[-1] + tabconfiginfo(tagOrId, option)[-1] end def tabcget(tagOrId, option) unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ @@ -80,7 +80,7 @@ class Tk::Tile::TNotebook < TkWindow TkCommandNames = ['::tnotebook'.freeze].freeze end WidgetClassName = 'TNotebook'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') @@ -109,7 +109,11 @@ class Tk::Tile::TNotebook < TkWindow def forget(idx) tk_send('forget', idx) self - end + end + + def hide(idx) + tk_send('hide', idx) + end def index(idx) number(tk_send('index', idx)) @@ -137,3 +141,7 @@ class Tk::Tile::TNotebook < TkWindow list(tk_send('tabs')) end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Notebook, :TkNotebook) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tnotebook.rb', + :Ttk, Tk::Tile::Notebook, :TkNotebook) diff --git a/ext/tk/lib/tkextlib/tile/tpaned.rb b/ext/tk/lib/tkextlib/tile/tpaned.rb index d96ff43973..d6ad234559 100644 --- a/ext/tk/lib/tkextlib/tile/tpaned.rb +++ b/ext/tk/lib/tkextlib/tile/tpaned.rb @@ -13,10 +13,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Panedwindow, - :TkPanedwindow, :TkPanedWindow) - - class Tk::Tile::TPaned < TkWindow include Tk::Tile::TileWidget @@ -30,7 +26,7 @@ class Tk::Tile::TPaned < TkWindow TkCommandNames = ['::tpaned'.freeze].freeze end WidgetClassName = 'TPaned'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') @@ -66,6 +62,12 @@ class Tk::Tile::TPaned < TkWindow self end + def panecget_tkstring(pane, slot) + pane = _epath(pane) + tk_send_without_enc('pane', pane, "-#{slot}") + end + alias pane_cget_tkstring panecget_tkstring + def panecget_strict(pane, slot) pane = _epath(pane) tk_tcl2ruby(tk_send_without_enc('pane', pane, "-#{slot}")) @@ -127,7 +129,7 @@ class Tk::Tile::TPaned < TkWindow end conf else - tk_split_simplelist(tk_send_without_enc('pane', + tk_split_simplelist(tk_send_without_enc('pane', win)).collect{|conflist| conf = tk_split_simplelist(conflist) conf[0] = conf[0][1..-1] @@ -135,18 +137,18 @@ class Tk::Tile::TPaned < TkWindow if conf[0] == 'hide' conf[3] = bool(conf[3]) unless conf[3].empty? elsif conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[0] == 'hide' conf[4] = bool(conf[4]) unless conf[4].empty? elsif conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end conf[1] = conf[1][1..-1] if conf.size == 2 # alias info @@ -165,7 +167,7 @@ class Tk::Tile::TPaned < TkWindow { key => conf } else ret = {} - tk_split_simplelist(tk_send_without_enc('pane', + tk_split_simplelist(tk_send_without_enc('pane', win)).each{|conflist| conf = tk_split_simplelist(conflist) key = conf.shift[1..-1] @@ -173,18 +175,18 @@ class Tk::Tile::TPaned < TkWindow if key == 'hide' conf[2] = bool(conf[2]) unless conf[2].empty? elsif conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if key == 'hide' conf[3] = bool(conf[3]) unless conf[3].empty? elsif conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf.size == 1 @@ -221,11 +223,23 @@ class Tk::Tile::TPaned < TkWindow end alias current_pane_configinfo current_paneconfiginfo + def panes + tk_split_simplelist(tk_send_without_enc('panes')).map{|w| + (obj = window(w))? obj: w + } + end + def identify(x, y) - list(tk_send_without_enc('identify', x, y)) + num_or_nil(tk_send_without_enc('identify', x, y)) end def sashpos(idx, newpos=None) num_or_str(tk_send_without_enc('sashpos', idx, newpos)) end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Panedwindow, +# :TkPanedwindow, :TkPanedWindow) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tpaned.rb', + :Ttk, Tk::Tile::Panedwindow, + :TkPanedwindow, :TkPanedWindow) diff --git a/ext/tk/lib/tkextlib/tile/tprogressbar.rb b/ext/tk/lib/tkextlib/tile/tprogressbar.rb index f786d370dd..0c9d15e1b9 100644 --- a/ext/tk/lib/tkextlib/tile/tprogressbar.rb +++ b/ext/tk/lib/tkextlib/tile/tprogressbar.rb @@ -13,9 +13,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Progressbar, :TkProgressbar) - - class Tk::Tile::TProgressbar include Tk::Tile::TileWidget @@ -25,7 +22,7 @@ class Tk::Tile::TProgressbar TkCommandNames = ['::tprogressbar'.freeze].freeze end WidgetClassName = 'TProgressbar'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') @@ -54,3 +51,7 @@ class Tk::Tile::TProgressbar end end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Progressbar, :TkProgressbar) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tprogressbar.rb', + :Ttk, Tk::Tile::Progressbar, :TkProgressbar) diff --git a/ext/tk/lib/tkextlib/tile/tradiobutton.rb b/ext/tk/lib/tkextlib/tile/tradiobutton.rb index d653a6d256..5dbf260666 100644 --- a/ext/tk/lib/tkextlib/tile/tradiobutton.rb +++ b/ext/tk/lib/tkextlib/tile/tradiobutton.rb @@ -15,10 +15,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Radiobutton, - :TkRadiobutton, :TkRadioButton) - - class Tk::Tile::TRadioButton < Tk::RadioButton include Tk::Tile::TileWidget @@ -28,9 +24,15 @@ class Tk::Tile::TRadioButton < Tk::RadioButton TkCommandNames = ['::tradiobutton'.freeze].freeze end WidgetClassName = 'TRadiobutton'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Radiobutton, +# :TkRadiobutton, :TkRadioButton) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tradiobutton.rb', + :Ttk, Tk::Tile::Radiobutton, + :TkRadiobutton, :TkRadioButton) diff --git a/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb index 566e48def3..70db3d6d78 100644 --- a/ext/tk/lib/tkextlib/tile/treeview.rb +++ b/ext/tk/lib/tkextlib/tile/treeview.rb @@ -12,15 +12,12 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Treeview, :TkTreeview) - - module Tk::Tile::TreeviewConfig include TkItemConfigMethod def __item_configinfo_struct(id) # maybe need to override - {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, + {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, :default_value=>nil, :current_value=>1} end private :__item_configinfo_struct @@ -451,7 +448,7 @@ module Tk::Tile::TreeviewConfig def __item_val2ruby_optkeys(id) case id[0] when :item, 'item' - { + { 'tags'=>proc{|arg_id, val| simplelist(val).collect{|tag| Tk::Tile::Treeview::Tag.id2obj(self, tag) @@ -498,7 +495,7 @@ module Tk::Tile::TreeviewConfig end slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] end while(org_slot != slot) - fail RuntimeError, + fail RuntimeError, "there is a configure alias loop about '#{org_slot}'" else ret = {} @@ -519,16 +516,20 @@ module Tk::Tile::TreeviewConfig end end + alias __itemcget_tkstring itemcget_tkstring alias __itemcget itemcget alias __itemcget_strict itemcget_strict alias __itemconfigure itemconfigure alias __itemconfiginfo itemconfiginfo alias __current_itemconfiginfo current_itemconfiginfo - private :__itemcget, :__itemcget_strict + private :__itemcget_tkstring, :__itemcget, :__itemcget_strict private :__itemconfigure, :__itemconfiginfo, :__current_itemconfiginfo # Treeview Item + def itemcget_tkstring(tagOrId, option) + __itemcget_tkstring([:item, tagOrId], option) + end def itemcget(tagOrId, option) __itemcget([:item, tagOrId], option) end @@ -546,6 +547,9 @@ module Tk::Tile::TreeviewConfig end # Treeview Column + def columncget_tkstring(tagOrId, option) + __itemcget_tkstring([:column, tagOrId], option) + end def columncget(tagOrId, option) __itemcget([:column, tagOrId], option) end @@ -561,6 +565,7 @@ module Tk::Tile::TreeviewConfig def current_columnconfiginfo(tagOrId, slot=nil) __current_itemconfiginfo([:column, tagOrId], slot) end + alias column_cget_tkstring columncget_tkstring alias column_cget columncget alias column_cget_strict columncget_strict alias column_configure columnconfigure @@ -568,6 +573,19 @@ module Tk::Tile::TreeviewConfig alias current_column_configinfo current_columnconfiginfo # Treeview Heading + def headingcget_tkstring(tagOrId, option) + if __tile_specific_item_optkeys([:heading, tagOrId]).index(option.to_s) + begin + # On tile-0.7.{2-8}, 'state' options has no '-' at its head. + tk_call(*(__item_cget_cmd([:heading, tagOrId]) << option.to_s)) + rescue + # Maybe, 'state' option has '-' in future. + tk_call(*(__item_cget_cmd([:heading, tagOrId]) << "-#{option}")) + end + else + __itemcget_tkstring([:heading, tagOrId], option) + end + end def headingcget_strict(tagOrId, option) if __tile_specific_item_optkeys([:heading, tagOrId]).index(option.to_s) begin @@ -630,6 +648,7 @@ module Tk::Tile::TreeviewConfig def current_headingconfiginfo(tagOrId, slot=nil) __current_itemconfiginfo([:heading, tagOrId], slot) end + alias heading_cget_tkstring headingcget_tkstring alias heading_cget headingcget alias heading_cget_strict headingcget_strict alias heading_configure headingconfigure @@ -637,6 +656,9 @@ module Tk::Tile::TreeviewConfig alias current_heading_configinfo current_headingconfiginfo # Treeview Tag + def tagcget_tkstring(tagOrId, option) + __itemcget_tkstring([:tag, :configure, tagOrId], option) + end def tagcget(tagOrId, option) __itemcget([:tag, :configure, tagOrId], option) end @@ -652,6 +674,7 @@ module Tk::Tile::TreeviewConfig def current_tagconfiginfo(tagOrId, slot=nil) __current_itemconfiginfo([:tag, :configure, tagOrId], slot) end + alias tag_cget_tkstring tagcget_tkstring alias tag_cget tagcget alias tag_cget_strict tagcget_strict alias tag_configure tagconfigure @@ -707,7 +730,7 @@ class Tk::Tile::Treeview::Item < TkObject keys = _symbolkey2str(keys) id = keys.delete('id') if id - num_or_str(tk_call(tree, 'insert', + num_or_str(tk_call(tree, 'insert', parent_item, idx, '-id', id, *hash_kv(keys))) else num_or_str(tk_call(tree, 'insert', parent_item, idx, *hash_kv(keys))) @@ -737,6 +760,9 @@ class Tk::Tile::Treeview::Item < TkObject @id end + def cget_tkstring(option) + @t.itemcget_tkstring(@id, option) + end def cget(option) @t.itemcget(@id, option) end @@ -769,6 +795,11 @@ class Tk::Tile::Treeview::Item < TkObject self end + def tag_has?(tag) + @t.tag_has?(tag, @id) + end + alias has_tag? tag_has? + def bbox(column=None) @t.bbox(@id, column) end @@ -907,7 +938,7 @@ class Tk::Tile::Treeview::Tag < TkObject TagID_TBL = TkCore::INTERP.create_table - (Tag_ID = ['tile_treeview_tag'.freeze, '00000'.taint]).instance_eval{ + (Tag_ID = ['tile_treeview_tag'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -950,6 +981,11 @@ class Tk::Tile::Treeview::Tag < TkObject @id end + def tag_has?(item) + @t.tag_has?(@id, item) + end + alias added? tag_has? + def bind(seq, *args) if TkComm._callback_entry?(args[0]) || !block_given? cmd = args.shift @@ -979,6 +1015,9 @@ class Tk::Tile::Treeview::Tag < TkObject @t.tag_bindinfo(@id, seq) end + def cget_tkstring(option) + @t.tagcget_tkstring(@id, option) + end def cget(option) @t.tagcget(@id, option) end @@ -1014,7 +1053,7 @@ class Tk::Tile::Treeview < TkWindow TkCommandNames = ['::treeview'.freeze].freeze end WidgetClassName = 'Treeview'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __destroy_hook__ Tk::Tile::Treeview::Item::ItemID_TBL.mutex.synchronize{ @@ -1030,7 +1069,7 @@ class Tk::Tile::Treeview < TkWindow end def tagid(id) - if id.kind_of?(Tk::Tile::Treeview::Item) || + if id.kind_of?(Tk::Tile::Treeview::Item) || id.kind_of?(Tk::Tile::Treeview::Tag) id.id elsif id.kind_of?(Array) @@ -1055,7 +1094,7 @@ class Tk::Tile::Treeview < TkWindow } end def set_children(item, *items) - tk_send_without_enc('children', item, + tk_send_without_enc('children', item, array2tk_list(items.flatten, true)) self end @@ -1098,14 +1137,29 @@ class Tk::Tile::Treeview < TkWindow end end + def identify_region(x, y) + tk_send('identify', 'region', x, y) + end + + def identify_item(x, y) + id = tk_send('identify', 'item', x, y) + (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id) + end + + def identify_element(x, y) + tk_send('identify', 'element', x, y) + end + def row_identify(x, y) id = tk_send('identify', 'row', x, y) (id.empty?)? nil: Tk::Tile::Treeview::Item.id2obj(self, id) end + alias identify_row row_identify def column_identify(x, y) tk_send('identify', 'column', x, y) end + alias identify_column column_identify def index(item) number(tk_send('index', item)) @@ -1204,6 +1258,15 @@ class Tk::Tile::Treeview < TkWindow self end + def tag_has?(tag, item) + bool(tk_send('tag', 'has', tagid(tag), tagid(item))) + end + def tag_has(tag) + tk_split_simplelist(tk_send('tag', 'has', tagid(tag))).collect{|id| + Tk::Tile::Treeview::Item.id2obj(self, id) + } + end + def tag_bind(tag, seq, *args) if TkComm._callback_entry?(args[0]) || !block_given? cmd = args.shift @@ -1237,3 +1300,7 @@ class Tk::Tile::Treeview < TkWindow end alias tagbindinfo tag_bindinfo end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Treeview, :TkTreeview) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/treeview.rb', + :Ttk, Tk::Tile::Treeview, :TkTreeview) diff --git a/ext/tk/lib/tkextlib/tile/tscale.rb b/ext/tk/lib/tkextlib/tile/tscale.rb index 2c46fd9bd4..7eefcef731 100644 --- a/ext/tk/lib/tkextlib/tile/tscale.rb +++ b/ext/tk/lib/tkextlib/tile/tscale.rb @@ -17,9 +17,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scale, :TkScale) - - class Tk::Tile::TScale < Tk::Scale include Tk::Tile::TileWidget @@ -29,11 +26,13 @@ class Tk::Tile::TScale < Tk::Scale TkCommandNames = ['::tscale'.freeze].freeze end WidgetClassName = 'TScale'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end + + alias identify ttk_identify end class Tk::Tile::TProgress < Tk::Tile::TScale @@ -45,9 +44,13 @@ class Tk::Tile::TProgress < Tk::Tile::TScale TkCommandNames = ['::tprogress'.freeze].freeze end WidgetClassName = 'TProgress'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scale, :TkScale) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscale.rb', + :Ttk, Tk::Tile::Scale, :TkScale) diff --git a/ext/tk/lib/tkextlib/tile/tscrollbar.rb b/ext/tk/lib/tkextlib/tile/tscrollbar.rb index 163b8f4713..c6bba5810b 100644 --- a/ext/tk/lib/tkextlib/tile/tscrollbar.rb +++ b/ext/tk/lib/tkextlib/tile/tscrollbar.rb @@ -13,9 +13,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scrollbar, :TkScrollbar) - - class Tk::Tile::TScrollbar < Tk::Scrollbar include Tk::Tile::TileWidget @@ -25,13 +22,21 @@ class Tk::Tile::TScrollbar < Tk::Scrollbar TkCommandNames = ['::tscrollbar'.freeze].freeze end WidgetClassName = 'TScrollbar'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end + + alias identify ttk_identify end +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Scrollbar, :TkScrollbar) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscrollbar.rb', + :Ttk, Tk::Tile::Scrollbar, :TkScrollbar) + +####################################################################### + class Tk::Tile::XScrollbar < Tk::Tile::TScrollbar def create_self(keys) keys = {} unless keys @@ -50,5 +55,9 @@ class Tk::Tile::YScrollbar < Tk::Tile::TScrollbar private :create_self end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::XScrollbar, :TkXScrollbar) -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::YScrollbar, :TkYScrollbar) +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::XScrollbar, :TkXScrollbar) +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::YScrollbar, :TkYScrollbar) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscrollbar.rb', + :Ttk, Tk::Tile::XScrollbar, :TkXScrollbar) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tscrollbar.rb', + :Ttk, Tk::Tile::YScrollbar, :TkYScrollbar) diff --git a/ext/tk/lib/tkextlib/tile/tseparator.rb b/ext/tk/lib/tkextlib/tile/tseparator.rb index 30fae2c525..ffd2f6f89f 100644 --- a/ext/tk/lib/tkextlib/tile/tseparator.rb +++ b/ext/tk/lib/tkextlib/tile/tseparator.rb @@ -13,9 +13,6 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Separator, :TkSeparator) - - class Tk::Tile::TSeparator < TkWindow include Tk::Tile::TileWidget @@ -25,9 +22,13 @@ class Tk::Tile::TSeparator < TkWindow TkCommandNames = ['::tseparator'.freeze].freeze end WidgetClassName = 'TSeparator'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') end end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Separator, :TkSeparator) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tseparator.rb', + :Ttk, Tk::Tile::Separator, :TkSeparator) diff --git a/ext/tk/lib/tkextlib/tile/tspinbox.rb b/ext/tk/lib/tkextlib/tile/tspinbox.rb new file mode 100644 index 0000000000..2f2d73c5ab --- /dev/null +++ b/ext/tk/lib/tkextlib/tile/tspinbox.rb @@ -0,0 +1,107 @@ +# +# ttk::spinbox widget (Tcl/Tk 8.6b1 or later) +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +require 'tk' +require 'tkextlib/tile.rb' + +module Tk + module Tile + class TSpinbox < Tk::Tile::TEntry + end + Spinbox = TSpinbox + end +end + +class Tk::Tile::TSpinbox < Tk::Tile::TEntry + include Tk::Tile::TileWidget + + if Tk::Tile::USE_TTK_NAMESPACE + TkCommandNames = ['::ttk::spinbox'.freeze].freeze + else + TkCommandNames = ['::tspinbox'.freeze].freeze + end + WidgetClassName = 'TSpinbox'.freeze + WidgetClassNames[WidgetClassName] ||= self + + class SpinCommand < TkValidateCommand + class ValidateArgs < TkUtil::CallbackSubst + KEY_TBL = [ + [ ?d, ?s, :direction ], + [ ?s, ?e, :current ], + [ ?W, ?w, :widget ], + nil + ] + + PROC_TBL = [ + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + + [ ?e, proc{|val| + #enc = Tk.encoding + enc = ((Tk.encoding)? Tk.encoding : Tk.encoding_system) + if enc + Tk.fromUTF8(TkComm::string(val), enc) + else + TkComm::string(val) + end + } + ], + + nil + ] + + _setup_subst_table(KEY_TBL, PROC_TBL); + + def self.ret_val(val) + (val)? '1': '0' + end + end + + def self._config_keys + ['command'] + end + end + + def __validation_class_list + super() << SpinCommand + end + + Tk::ValidateConfigure.__def_validcmd(binding, SpinCommand) + + def __boolval_optkeys + super() << 'wrap' + end + private :__boolval_optkeys + + def __strval_optkeys + super() << 'buttonbackground' << 'format' + end + private :__strval_optkeys + + def __listval_optkeys + super() << 'values' + end + private :__listval_optkeys + + def self.style(*args) + [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') + end + + def current + number(tk_send_without_enc('current')) + end + def current=(idx) + tk_send('current', idx) + end + + def set(val) + tk_send('set', val) + end + + alias identify ttk_identify +end + +#Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Spinbox, :TkSpinbox) +Tk.__set_loaded_toplevel_aliases__('tkextlib/tile/tspinbox.rb', + :Ttk, Tk::Tile::Spinbox, :TkSpinbox) diff --git a/ext/tk/lib/tkextlib/tile/tsquare.rb b/ext/tk/lib/tkextlib/tile/tsquare.rb index 600b55e4e7..a81cd7b98a 100644 --- a/ext/tk/lib/tkextlib/tile/tsquare.rb +++ b/ext/tk/lib/tkextlib/tile/tsquare.rb @@ -22,7 +22,7 @@ class Tk::Tile::TSquare < TkWindow TkCommandNames = ['::tsquare'.freeze].freeze end WidgetClassName = 'TSquare'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def self.style(*args) [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') diff --git a/ext/tk/lib/tkextlib/tkDND/setup.rb b/ext/tk/lib/tkextlib/tkDND/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tkDND/setup.rb +++ b/ext/tk/lib/tkextlib/tkDND/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb index 9a9b2dc42c..97cdfc7f1c 100644 --- a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb +++ b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb @@ -30,30 +30,30 @@ module Tk class DND_Subst < TkUtil::CallbackSubst KEY_TBL = [ - [ ?a, ?l, :actions ], - [ ?A, ?s, :action ], - [ ?b, ?L, :codes ], - [ ?c, ?s, :code ], - [ ?d, ?l, :descriptions ], - [ ?D, ?l, :data ], - [ ?L, ?l, :source_types ], - [ ?m, ?l, :modifiers ], - [ ?t, ?l, :types ], - [ ?T, ?s, :type ], - [ ?W, ?w, :widget ], - [ ?x, ?n, :x ], - [ ?X, ?n, :x_root ], - [ ?y, ?n, :y ], - [ ?Y, ?n, :y_root ], + [ ?a, ?l, :actions ], + [ ?A, ?s, :action ], + [ ?b, ?L, :codes ], + [ ?c, ?s, :code ], + [ ?d, ?l, :descriptions ], + [ ?D, ?l, :data ], + [ ?L, ?l, :source_types ], + [ ?m, ?l, :modifiers ], + [ ?t, ?l, :types ], + [ ?T, ?s, :type ], + [ ?W, ?w, :widget ], + [ ?x, ?n, :x ], + [ ?X, ?n, :x_root ], + [ ?y, ?n, :y ], + [ ?Y, ?n, :y_root ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?l, TkComm.method(:list) ], - [ ?L, TkComm.method(:simplelist) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?l, TkComm.method(:list) ], + [ ?L, TkComm.method(:simplelist) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -101,11 +101,11 @@ module Tk #def dnd_bindtarget(type, event, cmd=Proc.new, prior=50, *args) # event = tk_event_sequence(event) # if prior.kind_of?(Numeric) - # tk_call('dnd', 'bindtarget', @path, type, event, - # install_bind_for_event_class(DND_Subst, cmd, *args), + # tk_call('dnd', 'bindtarget', @path, type, event, + # install_bind_for_event_class(DND_Subst, cmd, *args), # prior) # else - # tk_call('dnd', 'bindtarget', @path, type, event, + # tk_call('dnd', 'bindtarget', @path, type, event, # install_bind_for_event_class(DND_Subst, cmd, prior, *args)) # end # self @@ -123,11 +123,11 @@ module Tk event = tk_event_sequence(event) if prior.kind_of?(Numeric) - tk_call('dnd', 'bindtarget', @path, type, event, - install_bind_for_event_class(DND_Subst, cmd, *args), + tk_call('dnd', 'bindtarget', @path, type, event, + install_bind_for_event_class(DND_Subst, cmd, *args), prior) else - tk_call('dnd', 'bindtarget', @path, type, event, + tk_call('dnd', 'bindtarget', @path, type, event, install_bind_for_event_class(DND_Subst, cmd, prior, *args)) end self diff --git a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb index d893a83cf2..b9ee90aace 100644 --- a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb +++ b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb @@ -36,7 +36,7 @@ end class Tk::HTML_Widget::ClippingWindow WidgetClassName = 'HtmlClip'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self HtmlClip_TBL = TkCore::INTERP.create_table @@ -73,7 +73,7 @@ class Tk::HTML_Widget::ClippingWindow ppath = ppath2 end - + parent = TkComm._genobj_for_tkwidget(ppath) unless parent.kind_of?(Tk::HTML_Widget) fail ArgumentError, "parent must be a Tk::HTML_Widget instance" @@ -101,11 +101,11 @@ class Tk::HTML_Widget TkCommandNames = ['html'.freeze].freeze WidgetClassName = 'Html'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tkHTML/setup.rb b/ext/tk/lib/tkextlib/tkHTML/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tkHTML/setup.rb +++ b/ext/tk/lib/tkextlib/tkHTML/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tkimg/setup.rb b/ext/tk/lib/tkextlib/tkimg/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tkimg/setup.rb +++ b/ext/tk/lib/tkextlib/tkimg/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tktable/setup.rb b/ext/tk/lib/tkextlib/tktable/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tktable/setup.rb +++ b/ext/tk/lib/tkextlib/tktable/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tktable/tktable.rb b/ext/tk/lib/tkextlib/tktable/tktable.rb index f6cf24b40f..bc7a6c9a2e 100644 --- a/ext/tk/lib/tkextlib/tktable/tktable.rb +++ b/ext/tk/lib/tkextlib/tktable/tktable.rb @@ -74,6 +74,9 @@ module Tk::TkTable::ConfigMethod end private :__item_val2ruby_optkeys + def tag_cget_tkstring(tagOrId, option) + itemcget_tkstring(['tag', tagid(tagOrId)], option) + end def tag_cget(tagOrId, option) itemcget(['tag', tagid(tagOrId)], option) end @@ -90,6 +93,9 @@ module Tk::TkTable::ConfigMethod current_itemconfiginfo(['tag', tagid(tagOrId)], slot) end + def window_cget_tkstring(tagOrId, option) + itemcget_tkstring(['window', tagid(tagOrId)], option) + end def window_cget(tagOrId, option) itemcget(['window', tagid(tagOrId)], option) end @@ -114,7 +120,7 @@ module Tk::TkTable::ConfigMethod current_itemconfiginfo(['window', tagid(tagOrId)], slot) end - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo end @@ -125,7 +131,7 @@ class Tk::TkTable::CellTag CellTagID_TBL = TkCore::INTERP.create_table - (CellTag_ID = ['tktbl:celltag'.freeze, '00000'.taint]).instance_eval{ + (CellTag_ID = ['tktbl:celltag'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -197,6 +203,9 @@ class Tk::TkTable::CellTag @t.tag_lower(@id, target) end + def cget_tkstring(key) + @t.tag_cget_tkstring(@id, key) + end def cget(key) @t.tag_cget(@id, key) end @@ -253,7 +262,7 @@ end class Tk::TkTable TkCommandNames = ['table'.freeze].freeze WidgetClassName = 'Table'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self include Scrollable include Tk::TkTable::ConfigMethod @@ -282,21 +291,21 @@ class Tk::TkTable class BrowseCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :column ], - [ ?C, ?s, :index ], - [ ?i, ?x, :cursor ], - [ ?r, ?n, :row ], - [ ?s, ?s, :last_index ], - [ ?S, ?s, :new_index ], - [ ?W, ?w, :widget ], + [ ?c, ?n, :column ], + [ ?C, ?s, :index ], + [ ?i, ?x, :cursor ], + [ ?r, ?n, :row ], + [ ?s, ?s, :last_index ], + [ ?S, ?s, :new_index ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?x, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:number) ], + [ ?x, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -333,21 +342,21 @@ class Tk::TkTable class CellCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :column ], - [ ?C, ?s, :index ], - [ ?i, ?m, :rw_mode ], - [ ?r, ?n, :row ], - [ ?s, ?v, :value ], - [ ?W, ?w, :widget ], + [ ?c, ?n, :column ], + [ ?C, ?s, :index ], + [ ?i, ?m, :rw_mode ], + [ ?r, ?n, :row ], + [ ?s, ?v, :value ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], - [ ?m, proc{|val| (val == '0')? (:r) : (:w)} ], - [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + [ ?m, proc{|val| (val == '0')? (:r) : (:w)} ], + [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], nil ] @@ -384,19 +393,19 @@ class Tk::TkTable class SelectionCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :sel_columns ], - [ ?C, ?s, :sel_area ], - [ ?i, ?n, :total ], - [ ?r, ?n, :sel_rows ], - [ ?s, ?s, :value ], - [ ?W, ?w, :widget ], + [ ?c, ?n, :sel_columns ], + [ ?C, ?s, :sel_area ], + [ ?i, ?n, :total ], + [ ?r, ?n, :sel_rows ], + [ ?s, ?s, :value ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -433,22 +442,22 @@ class Tk::TkTable class ValidateCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :column ], - [ ?C, ?s, :index ], - [ ?i, ?x, :cursor ], - [ ?r, ?n, :row ], - [ ?s, ?v, :current_value ], - [ ?S, ?v, :new_value ], - [ ?W, ?w, :widget ], + [ ?c, ?n, :column ], + [ ?C, ?s, :index ], + [ ?i, ?x, :cursor ], + [ ?r, ?n, :row ], + [ ?s, ?v, :current_value ], + [ ?S, ?v, :new_value ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?x, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], - [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], + [ ?n, TkComm.method(:number) ], + [ ?x, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], nil ] @@ -481,7 +490,7 @@ class Tk::TkTable ################################# def __validation_class_list - super() << + super() << BrowseCommand << CellCommand << SelectionCommand << ValidateCommand end @@ -597,7 +606,7 @@ class Tk::TkTable def hidden_list simplelist(tk_send('hidden')) - end + end def hidden?(idx, *args) if args.empty? if (ret = tk_send('hidden', tagid(idx))) == '' @@ -701,7 +710,7 @@ class Tk::TkTable self end - def set(*pairs) # idx, val, idx, val, ... + def set(*pairs) # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -710,7 +719,7 @@ class Tk::TkTable tk_send('set', *args) self end - def set_row(*pairs) # idx, val, idx, val, ... + def set_row(*pairs) # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -719,7 +728,7 @@ class Tk::TkTable tk_send('set', 'row', *args) self end - def set_col(*pairs) # idx, val, idx, val, ... + def set_col(*pairs) # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -736,7 +745,7 @@ class Tk::TkTable pairs.each{|idx, val| args << tagid(idx) << val } tk_send('set', *args) else - # idx, val, idx, val, ... + # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -753,7 +762,7 @@ class Tk::TkTable pairs.each{|idx, val| args << tagid(idx) << val } tk_send('set', 'row', *args) else - # idx, val, idx, val, ... + # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -770,7 +779,7 @@ class Tk::TkTable pairs.each{|idx, val| args << idx << val } tk_send('set', 'col', *args) else - # idx, val, idx, val, ... + # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -798,7 +807,7 @@ class Tk::TkTable [idx [rows, cols]] end def set_spans(*pairs) - # idx, val, idx, val, ... + # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -827,7 +836,7 @@ class Tk::TkTable } tk_send('spans', *args) else - # idx, val, idx, val, ... + # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -894,9 +903,9 @@ class Tk::TkTable Tk::TkTable::CellTag::CellTagID_TBL.mutex.synchronize{ if Tk::TkTable::CellTag::CellTagID_TBL[@path] if tag.kind_of? Tk::TkTable::CellTag - Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag.id) + Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag.id) else - Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag) + Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag) end end } diff --git a/ext/tk/lib/tkextlib/tktrans/setup.rb b/ext/tk/lib/tkextlib/tktrans/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tktrans/setup.rb +++ b/ext/tk/lib/tkextlib/tktrans/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/treectrl/setup.rb b/ext/tk/lib/tkextlib/treectrl/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/treectrl/setup.rb +++ b/ext/tk/lib/tkextlib/treectrl/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb index e10e6e299e..1879a531ae 100644 --- a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb +++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb @@ -32,14 +32,14 @@ module Tk end end - HasColumnCreateCommand = + HasColumnCreateCommand = (TkPackage.vcompare(self.package_version, '1.1') >= 0) - # dummy :: - # pkgIndex.tcl of TreeCtrl-1.0 doesn't support auto_load for - # 'loupe' command (probably it is bug, I think). - # So, calling a 'treectrl' command for loading the dll with - # the auto_load facility. + # dummy :: + # pkgIndex.tcl of TreeCtrl-1.0 doesn't support auto_load for + # 'loupe' command (probably it is bug, I think). + # So, calling a 'treectrl' command for loading the dll with + # the auto_load facility. begin tk_call('treectrl') rescue @@ -48,7 +48,7 @@ module Tk # NOTE: platform == 'unix' only # img => TkPhotoImage - # x, y => screen coords + # x, y => screen coords # w, h => magnifier width and height # zoom => zooming rate Tk.tk_call_without_enc('loupe', img, x, y, w, h, zoom) @@ -76,28 +76,28 @@ end class Tk::TreeCtrl::NotifyEvent # [ <'%' subst-key char>, , ] KEY_TBL = [ - [ ?c, ?n, :item_num ], - [ ?d, ?s, :detail ], - [ ?D, ?l, :items ], - [ ?e, ?e, :event ], - [ ?I, ?n, :id ], - [ ?l, ?n, :lower_bound ], - [ ?p, ?n, :active_id ], - [ ?P, ?e, :pattern ], - [ ?S, ?l, :sel_items ], - [ ?T, ?w, :widget ], - [ ?u, ?n, :upper_bound ], - [ ?W, ?o, :object ], - [ ??, ?x, :parm_info ], + [ ?c, ?n, :item_num ], + [ ?d, ?s, :detail ], + [ ?D, ?l, :items ], + [ ?e, ?e, :event ], + [ ?I, ?n, :id ], + [ ?l, ?n, :lower_bound ], + [ ?p, ?n, :active_id ], + [ ?P, ?e, :pattern ], + [ ?S, ?l, :sel_items ], + [ ?T, ?w, :widget ], + [ ?u, ?n, :upper_bound ], + [ ?W, ?o, :object ], + [ ??, ?x, :parm_info ], nil ] # [ , ] PROC_TBL = [ - [ ?n, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?l, TkComm.method(:list) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?l, TkComm.method(:list) ], + [ ?w, TkComm.method(:window) ], [ ?e, proc{|val| case val @@ -109,9 +109,9 @@ class Tk::TreeCtrl::NotifyEvent val end } - ], + ], - [ ?o, proc{|val| TkComm.tk_tcl2ruby(val)} ], + [ ?o, proc{|val| TkComm.tk_tcl2ruby(val)} ], [ ?x, proc{|val| begin @@ -132,7 +132,7 @@ class Tk::TreeCtrl::NotifyEvent rescue val end - } ], + } ], nil ] @@ -157,15 +157,15 @@ class Tk::TreeCtrl::NotifyEvent # setup tables to be used by scan_args, _get_subst_key, _get_all_subst_keys # - # _get_subst_key() and _get_all_subst_keys() generates key-string - # which describe how to convert callback arguments to ruby objects. - # When binding parameters are given, use _get_subst_key(). - # But when no parameters are given, use _get_all_subst_keys() to - # create a Event class object as a callback parameter. + # _get_subst_key() and _get_all_subst_keys() generates key-string + # which describe how to convert callback arguments to ruby objects. + # When binding parameters are given, use _get_subst_key(). + # But when no parameters are given, use _get_all_subst_keys() to + # create a Event class object as a callback parameter. # - # scan_args() is used when doing callback. It convert arguments - # ( which are Tcl strings ) to ruby objects based on the key string - # that is generated by _get_subst_key() or _get_all_subst_keys(). + # scan_args() is used when doing callback. It convert arguments + # ( which are Tcl strings ) to ruby objects based on the key string + # that is generated by _get_subst_key() or _get_all_subst_keys(). # _setup_subst_table(KEY_TBL, PROC_TBL); end @@ -185,7 +185,7 @@ module Tk::TreeCtrl::ConfigMethod if (obj.kind_of?(Tk::TreeCtrl::Column) || obj.kind_of?(Tk::TreeCtrl::Element) || obj.kind_of?(Tk::TreeCtrl::Item) || - obj.kind_of?(Tk::TreeCtrl::Style)) + obj.kind_of?(Tk::TreeCtrl::Style)) obj = obj.id end @@ -236,7 +236,7 @@ module Tk::TreeCtrl::ConfigMethod def __item_cget_cmd(mixed_id) if mixed_id[0] == 'column' && mixed_id[1] == 'drag' return [self.path, 'column', 'dragcget'] - end + end if mixed_id[1].kind_of?(Array) id = mixed_id[1] @@ -255,7 +255,7 @@ module Tk::TreeCtrl::ConfigMethod def __item_config_cmd(mixed_id) if mixed_id[0] == 'column' && mixed_id[1] == 'drag' return [self.path, 'column', 'dragconfigure'] - end + end if mixed_id[1].kind_of?(Array) id = mixed_id[1] @@ -291,10 +291,10 @@ module Tk::TreeCtrl::ConfigMethod def __item_configinfo_struct(id) if id.kind_of?(Array) && id[0].to_s == 'notify' - {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, + {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, :default_value=>nil, :current_value=>1} else - {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, + {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, :default_value=>3, :current_value=>4} end end @@ -302,7 +302,7 @@ module Tk::TreeCtrl::ConfigMethod def __item_font_optkeys(id) - if id.kind_of?(Array) && (id[0] == 'element' || + if id.kind_of?(Array) && (id[0] == 'element' || (id[0].kind_of?(Array) && id[0][1] == 'element')) [] else @@ -322,7 +322,7 @@ module Tk::TreeCtrl::ConfigMethod def __item_boolval_optkeys(id) if id == 'debug' - ['data', 'display', 'enable'] + ['data', 'display', 'enable', 'span', 'textlayout'] elsif id == 'dragimage' ['visible'] elsif id == 'marquee' @@ -330,20 +330,20 @@ module Tk::TreeCtrl::ConfigMethod elsif id.kind_of?(Array) case id[0] when 'item' - ['button', 'visible'] + ['visible', 'wrap', 'open', 'returnid', 'visible'] when 'column' if id[1] == 'drag' ['enable'] else - ['button', 'expand', 'resize', 'squeeze', 'sunken', + ['button', 'expand', 'resize', 'squeeze', 'sunken', 'visible', 'widthhack'] end when 'element' - ['draw', 'filled', 'showfocus', 'destroy'] + ['draw', 'filled', 'showfocus', 'clip', 'destroy'] when 'notify' ['active'] when 'style' - ['detach'] + ['detach', 'indent', 'visible'] else if id[0].kind_of?(Array) && id[0][1] == 'element' ['filled', 'showfocus'] @@ -401,19 +401,36 @@ module Tk::TreeCtrl::ConfigMethod end private :__item_listval_optkeys + def __item_val2ruby_optkeys(id) + if id.kind_of?(Array) + case id[0] + when 'item' + { 'button' => proc{|id,val| (val == 'auto')? val: TkComm.bool(val)} } + else + [] + end + else + [] + end + end + private :__item_val2ruby_optkeys + def __item_keyonly_optkeys(id) # { def_key=>(undef_key|nil), ... } { - 'notreally'=>nil, + 'notreally'=>nil, 'increasing'=>'decreasing', - 'decreasing'=>'increasing', + 'decreasing'=>'increasing', 'ascii'=>nil, - 'dictionary'=>nil, - 'integer'=>nil, + 'dictionary'=>nil, + 'integer'=>nil, 'real'=>nil } end private :__item_keyonly_optkeys + def column_cget_tkstring(tagOrId, option) + itemcget_tkstring(['column', tagOrId], option) + end def column_cget(tagOrId, option) itemcget(['column', tagOrId], option) end @@ -430,6 +447,9 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo(['column', tagOrId], slot) end + def column_dragcget_tkstring(option) + itemcget_tkstring(['column', 'drag'], option) + end def column_dragcget(option) itemcget(['column', 'drag'], option) end @@ -446,6 +466,9 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo(['column', 'drag'], slot) end + def debug_cget_tkstring(option) + itemcget_tkstring('debug', option) + end def debug_cget(option) itemcget('debug', option) end @@ -462,6 +485,9 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo('debug', slot) end + def dragimage_cget_tkstring(option) + itemcget_tkstring('dragimage', option) + end def dragimage_cget(option) itemcget('dragimage', option) end @@ -478,6 +504,9 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo('dragimage', slot) end + def element_cget_tkstring(tagOrId, option) + itemcget_tkstring(['element', tagOrId], option) + end def element_cget(tagOrId, option) itemcget(['element', tagOrId], option) end @@ -494,6 +523,9 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo(['element', tagOrId], slot) end + def item_cget_tkstring(tagOrId, option) + itemcget_tkstring(['item', tagOrId], option) + end def item_cget(tagOrId, option) itemcget(['item', tagOrId], option) end @@ -510,6 +542,9 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo(['item', tagOrId], slot) end + def item_element_cget_tkstring(item, column, elem, option) + itemcget_tkstring([['item', 'element'], [item, column, elem]], option) + end def item_element_cget(item, column, elem, option) itemcget([['item', 'element'], [item, column, elem]], option) end @@ -526,6 +561,9 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo([['item', 'element'], [item, column, elem]], slot) end + def marquee_cget_tkstring(option) + itemcget_tkstring('marquee', option) + end def marquee_cget(option) itemcget('marquee', option) end @@ -542,6 +580,11 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo('marquee', slot) end + def notify_cget_tkstring(win, pattern, option) + pattern = "<#{pattern}>" + # "notify" doesn't have cget subcommand. + tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(['notify', [win, pattern]])) << "-#{option}")), false, true)[-1] + end def notify_cget(win, pattern, option) pattern = "<#{pattern}>" # "notify" doesn't have cget subcommand. @@ -571,6 +614,9 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo(['notify', [win, pattern]], slot) end + def style_cget_tkstring(tagOrId, option) + itemcget_tkstring(['style', tagOrId], option) + end def style_cget(tagOrId, option) itemcget(['style', tagOrId], option) end @@ -587,7 +633,7 @@ module Tk::TreeCtrl::ConfigMethod current_itemconfiginfo(['style', tagOrId], slot) end - private :itemcget, :itemcget_strict + private :itemcget_tkstring, :itemcget, :itemcget_strict private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo end @@ -599,7 +645,7 @@ class Tk::TreeCtrl TkCommandNames = ['treectrl'.freeze].freeze WidgetClassName = 'TreeCtrl'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self ######################### @@ -629,9 +675,9 @@ class Tk::TreeCtrl def __boolval_optkeys [ - 'itemwidthequal', 'usetheme', - 'showbuttons', 'showheader', 'showlines', 'showroot', - 'showrootbutton', 'showrootlines', + 'itemwidthequal', 'usetheme', + 'showbuttons', 'showheader', 'showlines', 'showroot', + 'showrootbutton', 'showrootlines', 'showrootchildbuttons' ] end private :__boolval_optkeys @@ -651,7 +697,7 @@ class Tk::TreeCtrl def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -680,7 +726,7 @@ class Tk::TreeCtrl end def collapse_recurse(*dsc) - tk_send_without_enc('collapse', '-recurse', + tk_send_without_enc('collapse', '-recurse', *(dsc.map!{|d| _get_eval_string(d, true)})) self end @@ -931,7 +977,7 @@ class Tk::TreeCtrl end def item_collapse_recurse(item) - tk_send_without_enc('item', 'collapse', + tk_send_without_enc('item', 'collapse', _get_eval_string(item, true), '-recurse') self end @@ -941,8 +987,8 @@ class Tk::TreeCtrl end def item_complex(item, *args) - tk_send_without_enc('item', 'complex', - _get_eval_string(item, true), + tk_send_without_enc('item', 'complex', + _get_eval_string(item, true), *(args.map!{|arg| _get_eval_string(arg, true)})) self end @@ -1008,12 +1054,12 @@ class Tk::TreeCtrl def item_firstchild(parent, child=nil) if child - tk_send_without_enc('item', 'firstchild', - _get_eval_string(parent, true), + tk_send_without_enc('item', 'firstchild', + _get_eval_string(parent, true), _get_eval_string(child, true)) self else - id = num_or_str(tk_send_without_enc('item', 'firstchild', + id = num_or_str(tk_send_without_enc('item', 'firstchild', _get_eval_string(parent, true))) Tk::TreeCtrl::Item.id2obj(self, id) end @@ -1022,11 +1068,11 @@ class Tk::TreeCtrl def item_hasbutton(item, st=None) if st == None - bool(tk_send_without_enc('item', 'hasbutton', + bool(tk_send_without_enc('item', 'hasbutton', _get_eval_string(item, true))) else - tk_send_without_enc('item', 'hasbutton', - _get_eval_string(item, true), + tk_send_without_enc('item', 'hasbutton', + _get_eval_string(item, true), _get_eval_string(st)) self end @@ -1086,12 +1132,12 @@ class Tk::TreeCtrl def item_lastchild(parent, child=nil) if child - tk_send_without_enc('item', 'lastchild', + tk_send_without_enc('item', 'lastchild', _get_eval_string(parent, true), _get_eval_string(child, true)) self else - id = num_or_str(tk_send_without_enc('item', 'lastchild', + id = num_or_str(tk_send_without_enc('item', 'lastchild', _get_eval_string(parent, true))) Tk::TreeCtrl::Item.id2obj(self, id) end @@ -1110,7 +1156,7 @@ class Tk::TreeCtrl alias item_next_sibling item_nextsibling def item_numchildren(item) - number(tk_send_without_enc('item', 'numchildren', + number(tk_send_without_enc('item', 'numchildren', _get_eval_string(item, true))) end alias item_num_children item_numchildren @@ -1271,20 +1317,20 @@ class Tk::TreeCtrl def item_style_set(item, column=nil, *args) if args.empty? if column - id = tk_send_without_enc('item', 'style', 'set', - _get_eval_string(item, true), + id = tk_send_without_enc('item', 'style', 'set', + _get_eval_string(item, true), _get_eval_string(column, true)) Tk::TreeCtrl::Style.id2obj(self, id) else - list(tk_send_without_enc('item', 'style', 'set', + list(tk_send_without_enc('item', 'style', 'set', _get_eval_string(item, true))).collect!{|id| Tk::TreeCtrl::Style.id2obj(self, id) } end else - tk_send_without_enc('item', 'style', 'set', - _get_eval_string(item, true), - _get_eval_string(column, true), + tk_send_without_enc('item', 'style', 'set', + _get_eval_string(item, true), + _get_eval_string(column, true), *(args.flatten.map!{|arg| _get_eval_string(arg, true) })) @@ -1547,8 +1593,8 @@ class Tk::TreeCtrl self end - def see(item) - tk_send('see', item) + def see(item, column=None, keys={}) + tk_send('see', item, column, *hash_kv(keys)) self end @@ -1640,8 +1686,8 @@ class Tk::TreeCtrl tk_send('style', 'layout', style, elem, *hash_kv(keys)) self else - _conv_style_layout_val(keys, - tk_send('style', 'layout', + _conv_style_layout_val(keys, + tk_send('style', 'layout', style, elem, "-#{keys}")) end else @@ -1686,7 +1732,7 @@ end class Tk::TreeCtrl::Column < TkObject TreeCtrlColumnID_TBL = TkCore::INTERP.create_table - (TreeCtrlColumnID = ['treectrl_column'.freeze, '00000'.taint]).instance_eval{ + (TreeCtrlColumnID = ['treectrl_column'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -1717,7 +1763,7 @@ class Tk::TreeCtrl::Column < TkObject keys = _symbolkey2str(keys) Tk::TreeCtrl::Column::TreeCtrlColumnID.mutex.synchronize{ - @path = @id = + @path = @id = keys.delete('tag') || Tk::TreeCtrl::Column::TreeCtrlColumnID.join(TkCore::INTERP._ip_id_) Tk::TreeCtrl::Column::TreeCtrlColumnID[1].succ! @@ -1726,7 +1772,7 @@ class Tk::TreeCtrl::Column < TkObject keys['tag'] = @id Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.mutex.synchronize{ - Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath] ||= {} + Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath] ||= {} Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath][@id] = self } @@ -1741,6 +1787,9 @@ class Tk::TreeCtrl::Column < TkObject @id.to_s.dup end + def cget_tkstring(opt) + @tree.column_cget_tkstring(@tree.column_index(@id), opt) + end def cget(opt) @tree.column_cget(@tree.column_index(@id), opt) end @@ -1789,7 +1838,7 @@ end class Tk::TreeCtrl::Element < TkObject TreeCtrlElementID_TBL = TkCore::INTERP.create_table - (TreeCtrlElementID = ['treectrl_element'.freeze, '00000'.taint]).instance_eval{ + (TreeCtrlElementID = ['treectrl_element'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -1823,13 +1872,13 @@ class Tk::TreeCtrl::Element < TkObject @tpath = parent.path @type = type.to_s Tk::TreeCtrl::Element::TreeCtrlElementID.mutex.synchronize{ - @path = @id = + @path = @id = Tk::TreeCtrl::Element::TreeCtrlElementID.join(TkCore::INTERP._ip_id_) Tk::TreeCtrl::Element::TreeCtrlElementID[1].succ! } Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.mutex.synchronize{ - Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath] ||= {} + Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath] ||= {} Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath][@id] = self } @@ -1844,6 +1893,9 @@ class Tk::TreeCtrl::Element < TkObject @id.dup end + def cget_tkstring(opt) + @tree.element_cget_tkstring(@id, opt) + end def cget(opt) @tree.element_cget(@id, opt) end @@ -1938,7 +1990,7 @@ class Tk::TreeCtrl::Item < TkObject @path = @id = @tree.item_create(keys) Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{ - Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath] ||= {} + Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath] ||= {} Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath][@id] = self } end @@ -1978,6 +2030,9 @@ class Tk::TreeCtrl::Item < TkObject self end + def cget_tkstring(opt) + @tree.item_cget_tkstring(@id, opt) + end def cget(opt) @tree.item_cget(@id, opt) end @@ -2014,7 +2069,10 @@ class Tk::TreeCtrl::Item < TkObject @tree.item_element_actual(@id, column, elem, key) end - def element_cget(opt) + def element_cget_tkstring(opt) + @tree.item_element_cget(@id, opt) + end + def element_cget_tkstring(opt) @tree.item_element_cget(@id, opt) end def element_cget_strict(opt) @@ -2218,7 +2276,7 @@ end class Tk::TreeCtrl::Style < TkObject TreeCtrlStyleID_TBL = TkCore::INTERP.create_table - (TreeCtrlStyleID = ['treectrl_style'.freeze, '00000'.taint]).instance_eval{ + (TreeCtrlStyleID = ['treectrl_style'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -2247,13 +2305,13 @@ class Tk::TreeCtrl::Style < TkObject @tpath = parent.path Tk::TreeCtrl::Style::TreeCtrlStyleID.mutex.synchronize{ - @path = @id = + @path = @id = Tk::TreeCtrl::Style::TreeCtrlStyleID.join(TkCore::INTERP._ip_id_) Tk::TreeCtrl::Style::TreeCtrlStyleID[1].succ! } Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.mutex.synchronize{ - Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath] ||= {} + Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath] ||= {} Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath][@id] = self } @@ -2268,6 +2326,9 @@ class Tk::TreeCtrl::Style < TkObject @id.dup end + def cget_tkstring(opt) + @tree.style_cget_tkstring(@id, opt) + end def cget(opt) @tree.style_cget(@id, opt) end diff --git a/ext/tk/lib/tkextlib/trofs/setup.rb b/ext/tk/lib/tkextlib/trofs/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/trofs/setup.rb +++ b/ext/tk/lib/tkextlib/trofs/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/version.rb b/ext/tk/lib/tkextlib/version.rb index 82ed7ef542..3bc3ec5ae2 100644 --- a/ext/tk/lib/tkextlib/version.rb +++ b/ext/tk/lib/tkextlib/version.rb @@ -2,5 +2,5 @@ # release date of tkextlib # module Tk - Tkextlib_RELEASE_DATE = '2008-11-25'.freeze + Tkextlib_RELEASE_DATE = '2009-07-12'.freeze end diff --git a/ext/tk/lib/tkextlib/vu/bargraph.rb b/ext/tk/lib/tkextlib/vu/bargraph.rb index 27ff3c7cd0..b9fcf925f3 100644 --- a/ext/tk/lib/tkextlib/vu/bargraph.rb +++ b/ext/tk/lib/tkextlib/vu/bargraph.rb @@ -19,7 +19,7 @@ require 'tkextlib/vu.rb' class Tk::Vu::Bargraph < TkWindow TkCommandNames = ['::vu::bargraph'.freeze].freeze WidgetClassName = 'Bargraph'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self ############################### @@ -30,10 +30,10 @@ class Tk::Vu::Bargraph < TkWindow def __strval_optkeys super() + [ - 'title', - 'barbackground', 'barcolor', 'barcolour', - 'tickcolor', 'tickcolour', - 'textcolor', 'textcolour', + 'title', + 'barbackground', 'barcolor', 'barcolour', + 'tickcolor', 'tickcolour', + 'textcolor', 'textcolour', ] end private :__strval_optkeys diff --git a/ext/tk/lib/tkextlib/vu/charts.rb b/ext/tk/lib/tkextlib/vu/charts.rb index ee4298fa1c..8569ac5541 100644 --- a/ext/tk/lib/tkextlib/vu/charts.rb +++ b/ext/tk/lib/tkextlib/vu/charts.rb @@ -18,7 +18,7 @@ module Tk private :__item_boolval_optkeys def __item_strval_optkeys(id) - super(id) << 'bar' << 'color' << 'outline' << + super(id) << 'bar' << 'color' << 'outline' << 'fill' << 'scaleline' << 'stripline' end private :__item_strval_optkeys diff --git a/ext/tk/lib/tkextlib/vu/dial.rb b/ext/tk/lib/tkextlib/vu/dial.rb index e27a38ae42..eca0bbb67c 100644 --- a/ext/tk/lib/tkextlib/vu/dial.rb +++ b/ext/tk/lib/tkextlib/vu/dial.rb @@ -19,7 +19,7 @@ require 'tkextlib/vu.rb' class Tk::Vu::Dial < TkWindow TkCommandNames = ['::vu::dial'.freeze].freeze WidgetClassName = 'Dial'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self ############################### diff --git a/ext/tk/lib/tkextlib/vu/pie.rb b/ext/tk/lib/tkextlib/vu/pie.rb index c1fb6857bf..6b0c485d8a 100644 --- a/ext/tk/lib/tkextlib/vu/pie.rb +++ b/ext/tk/lib/tkextlib/vu/pie.rb @@ -37,7 +37,7 @@ end class Tk::Vu::Pie < TkWindow TkCommandNames = ['::vu::pie'.freeze].freeze WidgetClassName = 'Pie'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __destroy_hook__ Tk::Vu::PieSlice::SliceID_TBL.delete(@path) @@ -117,7 +117,7 @@ end class Tk::Vu::PieSlice SliceID_TBL = TkCore::INTERP.create_table - (Pie_Slice_ID = ['vu:pie'.freeze, '00000'.taint]).instance_eval{ + (Pie_Slice_ID = ['vu:pie'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -173,6 +173,10 @@ class Tk::Vu::PieSlice val end + def cget_tkstring(slot) + @pie.itemcget_tkstring(@id, slot) + end + def cget(slot) @pie.itemcget(@id, slot) end diff --git a/ext/tk/lib/tkextlib/vu/setup.rb b/ext/tk/lib/tkextlib/vu/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/vu/setup.rb +++ b/ext/tk/lib/tkextlib/vu/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/vu/spinbox.rb b/ext/tk/lib/tkextlib/vu/spinbox.rb index a7e40ea319..7d6104f4d1 100644 --- a/ext/tk/lib/tkextlib/vu/spinbox.rb +++ b/ext/tk/lib/tkextlib/vu/spinbox.rb @@ -7,7 +7,7 @@ # require 'tk' -if (Tk::TK_MAJOR_VERSION < 8 || +if (Tk::TK_MAJOR_VERSION < 8 || (Tk::TK_MAJOR_VERSION == 8 && Tk::TK_MINOR_VERSION < 4)) # call setup script -- /tkextlib/vu.rb require 'tkextlib/vu.rb' diff --git a/ext/tk/lib/tkextlib/winico/setup.rb b/ext/tk/lib/tkextlib/winico/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/winico/setup.rb +++ b/ext/tk/lib/tkextlib/winico/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/winico/winico.rb b/ext/tk/lib/tkextlib/winico/winico.rb index 00316fd441..9160c2960f 100644 --- a/ext/tk/lib/tkextlib/winico/winico.rb +++ b/ext/tk/lib/tkextlib/winico/winico.rb @@ -46,7 +46,7 @@ class Tk::Winico end def self.info - simplelist(Tk.tk_call('winico', 'info')).collect{|id| + simplelist(Tk.tk_call('winico', 'info')).collect{|id| Tk::Winico.id2obj(id) } end @@ -82,7 +82,7 @@ class Tk::Winico elsif winico_id @id = winico_id else - fail ArgumentError, + fail ArgumentError, "must be given proper information from where loading icons" end @path = @id @@ -96,7 +96,7 @@ class Tk::Winico end def set_window(win_id, *opts) # opts := ?'big'|'small'?, ?pos? - # NOTE:: the window, which is denoted by win_id, MUST BE MAPPED. + # NOTE:: the window, which is denoted by win_id, MUST BE MAPPED. # If not, then this may fail or crash. tk_call('winico', 'setwindow', win_id, @id, *opts) end @@ -119,22 +119,22 @@ class Tk::Winico class Winico_callback < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?m, ?s, :message ], - [ ?i, ?x, :icon ], - [ ?x, ?n, :x ], - [ ?y, ?n, :y ], - [ ?X, ?n, :last_x ], - [ ?Y, ?n, :last_y ], - [ ?t, ?n, :tickcount ], - [ ?w, ?n, :icon_idnum ], - [ ?l, ?n, :msg_idnum ], + [ ?m, ?s, :message ], + [ ?i, ?x, :icon ], + [ ?x, ?n, :x ], + [ ?y, ?n, :y ], + [ ?X, ?n, :last_x ], + [ ?Y, ?n, :last_y ], + [ ?t, ?n, :tickcount ], + [ ?w, ?n, :icon_idnum ], + [ ?l, ?n, :msg_idnum ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?x, proc{|id| + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?x, proc{|id| Tk::Winico::WinicoID_TBL.mutex.synchronize{ if Tk::Winico::WinicoID_TBL.key?(id) obj = Tk::Winico::WinicoID_TBL[id] @@ -146,7 +146,7 @@ class Tk::Winico end obj } - } ], + } ], nil ] diff --git a/ext/tk/old-extconf.rb b/ext/tk/old-extconf.rb new file mode 100644 index 0000000000..ebc83a0c0b --- /dev/null +++ b/ext/tk/old-extconf.rb @@ -0,0 +1,440 @@ +# extconf.rb for tcltklib + +require 'mkmf' + +is_win32 = (/mswin|mingw|cygwin|bccwin/ =~ RUBY_PLATFORM) +#is_macosx = (/darwin/ =~ RUBY_PLATFORM) + +have_func("ruby_native_thread_p", "ruby.h") +have_func("rb_errinfo", "ruby.h") +have_func("rb_safe_level", "ruby.h") +have_struct_member("struct RArray", "ptr", "ruby.h") +have_struct_member("struct RArray", "len", "ruby.h") + +def find_framework(tcl_hdr, tk_hdr) + if framework_dir = with_config("tcltk-framework") + paths = [framework_dir] + else + unless tcl_hdr || tk_hdr || + enable_config("tcltk-framework", false) || + enable_config("mac-tcltk-framework", false) + return false + end + paths = ["/Library/Frameworks", "/System/Library/Frameworks"] + end + + checking_for('Tcl/Tk Framework') { + paths.find{|dir| + dir.strip! + dir.chomp!('/') + (tcl_hdr || FileTest.directory?(dir + "/Tcl.framework/") ) && + (tk_hdr || FileTest.directory?(dir + "/Tk.framework/") ) + } + } +end + +tcl_framework_header = with_config("tcl-framework-header") +tk_framework_header = with_config("tk-framework-header") + +tcltk_framework = find_framework(tcl_framework_header, tk_framework_header) + +unless is_win32 + have_library("nsl", "t_open") + have_library("socket", "socket") + have_library("dl", "dlopen") + have_library("m", "log") +end + +tk_idir, tk_ldir = dir_config("tk") +tcl_idir, tcl_ldir = dir_config("tcl") +x11_idir, x11_ldir = dir_config("X11") + +tk_ldir2 = with_config("tk-lib") +tcl_ldir2 = with_config("tcl-lib") +x11_ldir2 = with_config("X11-lib") + +tk_ldir_list = [tk_ldir2, tk_ldir] +tcl_ldir_list = [tcl_ldir2, tcl_ldir] + +tklib = with_config("tklib") +tcllib = with_config("tcllib") +stubs = enable_config("tcltk_stubs") || with_config("tcltk_stubs") + +tcltk_version = with_config("tcltkversion") + +use_X = with_config("X11", (! is_win32)) + +def parse_tclConfig(file) + # check tclConfig.sh/tkConfig.sh + tbl = {} + IO.foreach(file){|line| + line.strip! + next if line !~ /^([^\#=][^=]*)=(['"]|)(.*)\2$/ + key, val = $1, $3 + tbl[key] = val.gsub(/\$\{([^}]+)\}/){|s| tbl[$1]} rescue nil + } + tbl +end + +def check_tcltk_version(version) + return [nil, nil] unless version + + version = version.strip + + tclver = version.dup + tkver = version.dup + + major = dot = minor = dot = plvl = ext = nil + + if version =~ /^(\d)(\.?)(\d)(\.?)(\d*)(.*)$/ + major = $1; minor_dot = $2; minor = $3; plvl_dot = $4; plvl = $5; ext = $6 + dot = ! minor_dot.empty? + if plvl_dot.empty? && ! plvl.empty? + minor << plvl + end + elsif version =~ /^(\d)(\.?)(\d?)(.*)$/ + major = $1; minor_dot = $2; minor = $3; ext = $4 + dot = ! minor_dot.empty? + else # unknown -> believe user + return [tclver, tkver] + end + + # check Tcl7.6 / Tk4.2 ? + if major == "7" # Tcl7.6 ( not support Tclversion < 7.6 ) + # Tk4.2 + tkver = "4" + ((dot)? ".": "") + ((minor.empty)? "": "2") + ext + elsif major == "4" # Tk4.2 ( not support Tkversion < 4.2 ) + # Tcl7.6 + tclver = "7" + ((dot)? ".": "") + ((minor.empty)? "": "6") + ext + end + + [tclver, tkver] +end + +def find_tcl(tcllib, stubs, version, *opt_paths) + default_paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"] + default_paths << "/Tcl/lib" # default for ActiveTcl + + if (paths = opt_paths.compact).empty? + paths = default_paths + end + + if stubs + func = "Tcl_InitStubs" + lib = "tclstub" + else + func = "Tcl_FindExecutable" + lib = "tcl" + end + + if version && ! version.empty? + versions = [version] + else + versions = %w[8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 7.6] + end + + if tcllib + st = find_library(tcllib, func, *paths) + else + st = versions.find { |ver| + find_library("#{lib}#{ver}", func, *paths) or + find_library("#{lib}#{ver.delete('.')}", func, *paths) or + find_library("#{lib}#{ver}g", func, *paths) or + find_library("#{lib}#{ver.delete('.')}g", func, *paths) or + find_library("tcl#{ver}", func, *paths) or + find_library("tcl#{ver.delete('.')}", func, *paths) or + find_library("tcl#{ver}g", func, *paths) or + find_library("tcl#{ver.delete('.')}g", func, *paths) + } || (!version && find_library(lib, func, *paths)) + end + + unless st + puts("Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options.") + end + st +end + +def find_tk(tklib, stubs, version, *opt_paths) + default_paths = ["/usr/local/lib", "/usr/pkg/lib", "/usr/lib"] + default_paths << "/Tcl/lib" # default for ActiveTcl + + if (paths = opt_paths.compact).empty? + paths = default_paths + end + + if stubs + func = "Tk_InitStubs" + lib = "tkstub" + else + func = "Tk_Init" + lib = "tk" + end + + if version && ! version.empty? + versions = [version] + else + versions = %w[8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 4.2] + end + + if tklib + st = find_library(tklib, func, *paths) + else + st = versions.find { |ver| + find_library("#{lib}#{ver}", func, *paths) or + find_library("#{lib}#{ver.delete('.')}", func, *paths) or + find_library("#{lib}#{ver}g", func, *paths) or + find_library("#{lib}#{ver.delete('.')}g", func, *paths) or + find_library("tk#{ver}", func, *paths) or + find_library("tk#{ver.delete('.')}", func, *paths) or + find_library("tk#{ver}g", func, *paths) or + find_library("tk#{ver.delete('.')}g", func, *paths) + } || (!version && find_library(lib, func, *paths)) + end + + unless st + puts("Warning:: cannot find Tk library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options.") + end + st +end + +def find_tcltk_header(tclver, tkver) + base_dir = ['/usr/local/include', '/usr/pkg/include', '/usr/include'] + base_dir << '/Tcl/include' # default for ActiveTcl + + unless have_tcl_h = have_header('tcl.h') + if tclver && ! tclver.empty? + versions = [tclver] + else + versions = %w[8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 7.6] + end + paths = base_dir.dup + versions.each{|ver| paths.concat(base_dir.map{|dir| dir + '/tcl' + ver})} + have_tcl_h = find_header('tcl.h', *paths) + end + + unless have_tk_h = have_header("tk.h") + if tkver && ! tkver.empty? + versions = [tkver] + else + versions = %w[8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 4.2] + end + paths = base_dir.dup + versions.each{|ver| paths.concat(base_dir.map{|dir| dir + '/tk' + ver})} + have_tk_h = find_header('tk.h', *paths) + end + + have_tcl_h && have_tk_h +end + +def find_X11(*opt_paths) + default_paths = + [ "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib" ] + paths = opt_paths.compact.concat(default_paths) + st = find_library("X11", "XOpenDisplay", *paths) + unless st + puts("Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.") + end + st +end + +def pthread_check() + tcl_major_ver = nil + tcl_minor_ver = nil + + # Is tcl-thread given by user ? + case enable_config("tcl-thread") + when true + tcl_enable_thread = true + when false + tcl_enable_thread = false + else + tcl_enable_thread = nil + end + + if (tclConfig = with_config("tclConfig-file")) + if tcl_enable_thread == true + puts("Warning: --with-tclConfig-file option is ignored, because --enable-tcl-thread option is given.") + elsif tcl_enable_thread == false + puts("Warning: --with-tclConfig-file option is ignored, because --disable-tcl-thread option is given.") + else + # tcl-thread is unknown and tclConfig.sh is given + begin + tbl = parse_tclConfig(tclConfig) + if tbl['TCL_THREADS'] + tcl_enable_thread = (tbl['TCL_THREADS'] == "1") + else + tcl_major_ver = tbl['TCL_MAJOR_VERSION'].to_i + tcl_minor_ver = tbl['TCL_MINOR_VERSION'].to_i + if tcl_major_ver < 8 || (tcl_major_ver == 8 && tcl_minor_ver == 0) + tcl_enable_thread = false + end + end + + if tcl_enable_thread == nil + # cannot find definition + if tcl_major_ver + puts("Warning: '#{tclConfig}' doesn't include TCL_THREADS definition.") + else + puts("Warning: '#{tclConfig}' may not be a tclConfig file.") + end + tclConfig = false + end + rescue Exception + puts("Warning: fail to read '#{tclConfig}'!! --> ignore the file") + tclConfig = false + end + end + end + + if tcl_enable_thread == nil && !tclConfig + # tcl-thread is unknown and tclConfig is unavailable + begin + try_run_available = try_run("int main() { exit(0); }") + rescue Exception + # cannot try_run. Is CROSS-COMPILE environment? + puts(%Q'\ +***************************************************************************** +** +** PTHREAD SUPPORT CHECK WARNING: +** +** We cannot check the consistency of pthread support between Ruby +** and the Tcl/Tk library in your environment (are you perhaps +** cross-compiling?). If pthread support for these 2 packages is +** inconsistent you may find you get errors when running Ruby/Tk +** (e.g. hangs or segmentation faults). We strongly recommend +** you to check the consistency manually. +** +***************************************************************************** +') + return true + end + end + + if tcl_enable_thread == nil + # tcl-thread is unknown + if try_run(< +int main() { + Tcl_Interp *ip; + ip = Tcl_CreateInterp(); + exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1); +} +EOF + tcl_enable_thread = true + elsif try_run(< +static Tcl_ThreadDataKey dataKey; +int main() { exit((Tcl_GetThreadData(&dataKey, 1) == dataKey)? 1: 0); } +EOF + tcl_enable_thread = true + else + tcl_enable_thread = false + end + end + + # check pthread mode + if (macro_defined?('HAVE_NATIVETHREAD', '#include "ruby.h"')) + # ruby -> enable + unless tcl_enable_thread + # ruby -> enable && tcl -> disable + puts(%Q'\ +***************************************************************************** +** +** PTHREAD SUPPORT MODE WARNING: +** +** Ruby is compiled with --enable-pthread, but your Tcl/Tk library +** seems to be compiled without pthread support. Although you can +** create the tcltklib library, this combination may cause errors +** (e.g. hangs or segmentation faults). If you have no reason to +** keep the current pthread support status, we recommend you reconfigure +** and recompile the libraries so that both or neither support pthreads. +** +** If you want change the status of pthread support, please recompile +** Ruby without "--enable-pthread" configure option or recompile Tcl/Tk +** with "--enable-threads" configure option (if your Tcl/Tk is later +** than or equal to Tcl/Tk 8.1). +** +***************************************************************************** +') + end + + # ruby -> enable && tcl -> enable/disable + if tcl_enable_thread + $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1' + else + $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0' + end + + return true + + else + # ruby -> disable + if tcl_enable_thread + # ruby -> disable && tcl -> enable + puts(%Q'\ +***************************************************************************** +** +** PTHREAD SUPPORT MODE ERROR: +** +** Ruby is not compiled with --enable-pthread, but your Tcl/Tk +** library seems to be compiled with pthread support. This +** combination may cause frequent hang or segmentation fault +** errors when Ruby/Tk is working. We recommend that you NEVER +** create the library with such a combination of pthread support. +** +** Please recompile Ruby with the "--enable-pthread" configure option +** or recompile Tcl/Tk with the "--disable-threads" configure option. +** +***************************************************************************** +') + $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=1' + return false + else + # ruby -> disable && tcl -> disable + $CPPFLAGS += ' -DWITH_TCL_ENABLE_THREAD=0' + return true + end + end +end + +tclver, tkver = check_tcltk_version(tcltk_version) + +if ( tcltk_framework || + ( find_tcltk_header(tclver, tkver) && + ( !use_X || find_X11(x11_ldir2, x11_ldir) ) && + find_tcl(tcllib, stubs, tclver, *tcl_ldir_list) && + find_tk(tklib, stubs, tkver, *tk_ldir_list) ) ) + $CPPFLAGS += ' -DUSE_TCL_STUBS -DUSE_TK_STUBS' if stubs + $CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM + + if tcltk_framework + if tcl_framework_header + $CPPFLAGS += " -I#{tcl_framework_header}" + else + $CPPFLAGS += " -I#{tcltk_framework}/Tcl.framework/Headers" + end + + if tk_framework_header + $CPPFLAGS += " -I#{tk_framework_header}" + else + $CPPFLAGS += " -I#{tcltk_framework}/Tk.framework/Headers" + end + + $LDFLAGS += ' -framework Tk -framework Tcl' + end + + if stubs or pthread_check + # create Makefile + + # for SUPPORT_STATUS + $INSTALLFILES ||= [] + $INSTALLFILES << ["lib/tkextlib/SUPPORT_STATUS", "$(RUBYLIBDIR)", "lib"] + + have_func("rb_hash_lookup", "ruby.h") + + # create + $defs << %[-DRUBY_VERSION=\\"#{RUBY_VERSION}\\"] + $defs << %[-DRUBY_RELEASE_DATE=\\"#{RUBY_RELEASE_DATE}\\"] + create_makefile("tcltklib") + end +end diff --git a/ext/tk/sample/24hr_clock.rb b/ext/tk/sample/24hr_clock.rb index 60d8072c57..29f84e0b40 100644 --- a/ext/tk/sample/24hr_clock.rb +++ b/ext/tk/sample/24hr_clock.rb @@ -19,7 +19,7 @@ class Clock @mark_color = 'black' @submark_color = 'gray50' - @c = TkCanvas.new(:width=>2*@size, :height=>2*@size, + @c = TkCanvas.new(:width=>2*@size, :height=>2*@size, :scrollregion=>[-@size, -@size, @size, @size] ).pack(:fill=>:both, :expand=>true) @@ -59,26 +59,26 @@ class Clock def _create_marks @mark_tag = TkcTag.new(@c) - TkcLine.new(@c, 0, -0.90*@size, 0, -0.85*@size, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, 0, -0.90*@size, 0, -0.85*@size, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, 0.90*@size, 0, 0.85*@size, 0, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, 0.90*@size, 0, 0.85*@size, 0, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, 0, 0.90*@size, 0, 0.85*@size, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, 0, 0.90*@size, 0, 0.85*@size, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, -0.90*@size, 0, -0.85*@size, 0, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, -0.90*@size, 0, -0.85*@size, 0, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcText.new(@c, [0, -0.92*@size], :text=>0, + TkcText.new(@c, [0, -0.92*@size], :text=>0, :anchor=>'s', :fill=>@mark_color) - TkcText.new(@c, [0.92*@size, 0], :text=>@clock.div(4), + TkcText.new(@c, [0.92*@size, 0], :text=>@clock.div(4), :anchor=>'w', :fill=>@mark_color) - TkcText.new(@c, [0, 0.92*@size], :text=>@clock.div(2), + TkcText.new(@c, [0, 0.92*@size], :text=>@clock.div(2), :anchor=>'n', :fill=>@mark_color) - TkcText.new(@c, [-0.92*@size, 0], :text=>@clock.div(4)*3, + TkcText.new(@c, [-0.92*@size, 0], :text=>@clock.div(4)*3, :anchor=>'e', :fill=>@mark_color) [30.0, 60.0].each{|angle| @@ -92,17 +92,17 @@ class Clock x2 = 0.85*x_base y2 = 0.85*y_base - TkcLine.new(@c, x1, y1, x2, y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, x1, y1, x2, y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, x1, -y1, x2, -y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, x1, -y1, x2, -y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, -x1, y1, -x2, y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, -x1, y1, -x2, y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, -x1, -y1, -x2, -y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, -x1, -y1, -x2, -y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) x3 = 0.92*x_base @@ -114,13 +114,13 @@ class Clock dh = angle.to_i/30 end - TkcText.new(@c, x3, -y3, :text=>dh, + TkcText.new(@c, x3, -y3, :text=>dh, :anchor=>'sw', :fill=>@mark_color) - TkcText.new(@c, x3, y3, :text=>@clock.div(2)-dh, + TkcText.new(@c, x3, y3, :text=>@clock.div(2)-dh, :anchor=>'nw', :fill=>@mark_color) - TkcText.new(@c, -x3, y3, :text=>@clock.div(2)+dh, + TkcText.new(@c, -x3, y3, :text=>@clock.div(2)+dh, :anchor=>'ne', :fill=>@mark_color) - TkcText.new(@c, -x3, -y3, :text=>@clock-dh, + TkcText.new(@c, -x3, -y3, :text=>@clock-dh, :anchor=>'se', :fill=>@mark_color) } @@ -136,17 +136,17 @@ class Clock x2 = 0.875*x_base y2 = 0.875*y_base - TkcLine.new(@c, x1, y1, x2, y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, x1, y1, x2, y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@submark_color) - TkcLine.new(@c, x1, -y1, x2, -y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, x1, -y1, x2, -y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@submark_color) - TkcLine.new(@c, -x1, y1, -x2, y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, -x1, y1, -x2, y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@submark_color) - TkcLine.new(@c, -x1, -y1, -x2, -y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, -x1, -y1, -x2, -y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@submark_color) } end @@ -162,48 +162,48 @@ class Clock second_hand_width = 1 # 0.4*@cdot_size @hour_hand_coords = [ - [0, -0.5*@cdot_size], - [hour_hand_width, -0.5*@cdot_size-hour_hand_width], - [hour_hand_width, -hour_hand_len+hour_hand_width], - [0, -hour_hand_len], - [-hour_hand_width, -hour_hand_len+hour_hand_width], - [-hour_hand_width, -0.5*@cdot_size-hour_hand_width], + [0, -0.5*@cdot_size], + [hour_hand_width, -0.5*@cdot_size-hour_hand_width], + [hour_hand_width, -hour_hand_len+hour_hand_width], + [0, -hour_hand_len], + [-hour_hand_width, -hour_hand_len+hour_hand_width], + [-hour_hand_width, -0.5*@cdot_size-hour_hand_width], ] @minute_hand_coords = [ - [0, -0.5*@cdot_size], - [minute_hand_width, -0.5*@cdot_size - minute_hand_width], - [minute_hand_width, -minute_hand_len+minute_hand_width], - [0, -minute_hand_len], - [-minute_hand_width, -minute_hand_len+minute_hand_width], - [-minute_hand_width, -0.5*@cdot_size-minute_hand_width], + [0, -0.5*@cdot_size], + [minute_hand_width, -0.5*@cdot_size - minute_hand_width], + [minute_hand_width, -minute_hand_len+minute_hand_width], + [0, -minute_hand_len], + [-minute_hand_width, -minute_hand_len+minute_hand_width], + [-minute_hand_width, -0.5*@cdot_size-minute_hand_width], ] @second_hand_coords = [ - [0, -0.5*@cdot_size], - [second_hand_width, -0.5*@cdot_size - second_hand_width], - [second_hand_width, -second_hand_len+second_hand_width], - [0, -second_hand_len], - [-second_hand_width, -second_hand_len+second_hand_width], - [-second_hand_width, -0.5*@cdot_size-second_hand_width], + [0, -0.5*@cdot_size], + [second_hand_width, -0.5*@cdot_size - second_hand_width], + [second_hand_width, -second_hand_len+second_hand_width], + [0, -second_hand_len], + [-second_hand_width, -second_hand_len+second_hand_width], + [-second_hand_width, -0.5*@cdot_size-second_hand_width], ] - @hour_hand = TkcPolygon.new(@c, @hour_hand_coords, - :tags=>[@tag, @hand_tag], - :outline=>@hour_hand_color, + @hour_hand = TkcPolygon.new(@c, @hour_hand_coords, + :tags=>[@tag, @hand_tag], + :outline=>@hour_hand_color, :fill=>@hour_hand_color) - @minute_hand = TkcPolygon.new(@c, @minute_hand_coords, - :tags=>[@tag, @hand_tag], - :outline=>@minute_hand_color, + @minute_hand = TkcPolygon.new(@c, @minute_hand_coords, + :tags=>[@tag, @hand_tag], + :outline=>@minute_hand_color, :fill=>@minute_hand_color) - @second_hand = TkcPolygon.new(@c, @second_hand_coords, - :tags=>[@tag, @hand_tag], - :outline=>@second_hand_color, + @second_hand = TkcPolygon.new(@c, @second_hand_coords, + :tags=>[@tag, @hand_tag], + :outline=>@second_hand_color, :fill=>@second_hand_color) - @center_dot = TkcOval.new(@c, - [-@cdot_size, -@cdot_size], - [@cdot_size, @cdot_size], + @center_dot = TkcOval.new(@c, + [-@cdot_size, -@cdot_size], + [@cdot_size, @cdot_size], :outline=>@cdot_color, :fill=>@cdot_color) end private :_create_hands @@ -269,8 +269,8 @@ class Clock extent = -span/2.0 end - pie = TkcArc.new(@c, @circle_coords, :tags=>[@tag], - :outline=>'black', 'fill'=>color, + pie = TkcArc.new(@c, @circle_coords, :tags=>[@tag], + :outline=>'black', 'fill'=>color, :start=>start, :extent=>extent) _raise_hands _raise_marks diff --git a/ext/tk/sample/binding_sample.rb b/ext/tk/sample/binding_sample.rb index 693cc7de2f..3c2eb5e1cb 100644 --- a/ext/tk/sample/binding_sample.rb +++ b/ext/tk/sample/binding_sample.rb @@ -43,7 +43,7 @@ class Button_clone < TkLabel def invoke if @command - @command.call + @command.call else '' end @@ -53,7 +53,7 @@ end TkLabel.new(:text=><v).pack(:side=>:left) }.pack -TkButton.new(:text=>'normal Button widget', +TkButton.new(:text=>'normal Button widget', :command=>proc{ puts 'button is clicked!!' lbl.text 'button is clicked!!' @@ -75,7 +75,7 @@ TkButton.new(:text=>'normal Button widget', pack(:fill=>:x, :expand=>true) } -Button_clone.new(:text=>'Label with Button binding', +Button_clone.new(:text=>'Label with Button binding', :command=>proc{ puts 'label is clicked!!' lbl.text 'label is clicked!!' diff --git a/ext/tk/sample/bindtag_sample.rb b/ext/tk/sample/bindtag_sample.rb index 8c93b4a260..b13364bb68 100644 --- a/ext/tk/sample/bindtag_sample.rb +++ b/ext/tk/sample/bindtag_sample.rb @@ -2,18 +2,18 @@ require 'tk' TkLabel.new(:text=><:left).pack -This is a sample of bindtags and usage of -Tk.callback_break/Tk.callback_continue. -Please check the work of following buttons -(attend the difference between before/after - pressing the bottom button), and see the +This is a sample of bindtags and usage of +Tk.callback_break/Tk.callback_continue. +Please check the work of following buttons +(attend the difference between before/after + pressing the bottom button), and see the source code. EOT def set_class_bind - TkButton.bind('ButtonPress-1', + TkButton.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of TkButton class'}) - TkButton.bind('ButtonRelease-1', + TkButton.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of TkButton class'}) end @@ -23,21 +23,21 @@ r.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of root widget'}) r.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of root widget'}) # set 'all' binding -TkBindTag::ALL.bind('ButtonPress-1', +TkBindTag::ALL.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of the tag "all"'}) -TkBindTag::ALL.bind('ButtonRelease-1', +TkBindTag::ALL.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of the tag "all"'}) # create buttons -b1 = TkButton.new(:text=>'button-1', +b1 = TkButton.new(:text=>'button-1', :command=>proc{puts "command of button-1"}).pack -b2 = TkButton.new(:text=>'button-2', +b2 = TkButton.new(:text=>'button-2', :command=>proc{puts "command of button-2"}).pack -b3 = TkButton.new(:text=>'button-3', +b3 = TkButton.new(:text=>'button-3', :command=>proc{puts "command of button-3"}).pack -b4 = TkButton.new(:text=>'button-4', +b4 = TkButton.new(:text=>'button-4', :command=>proc{puts "command of button-4"}).pack -b5 = TkButton.new(:text=>'button-5', +b5 = TkButton.new(:text=>'button-5', :command=>proc{puts "command of button-5"}).pack # set button binding @@ -62,14 +62,14 @@ tag1.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of tag1'}) tag1.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of tag1'}) tag2 = TkBindTag.new -tag2.bind('ButtonPress-1', +tag2.bind('ButtonPress-1', proc{ puts 'bind "ButtonPress-1" of tag2' puts 'call Tk.callback_continue' Tk.callback_continue puts 'never see this message' }) -tag2.bind('ButtonRelease-1', +tag2.bind('ButtonRelease-1', proc{ puts 'bind "ButtonRelease-1" of tag2' puts 'call Tk.callback_continue' @@ -78,14 +78,14 @@ tag2.bind('ButtonRelease-1', }) tag3 = TkBindTag.new -tag3.bind('ButtonPress-1', +tag3.bind('ButtonPress-1', proc{ puts 'bind "ButtonPress-1" of tag3' puts 'call Tk.callback_break' Tk.callback_break puts 'never see this message' }) -tag3.bind('ButtonRelease-1', +tag3.bind('ButtonRelease-1', proc{ puts 'bind "ButtonRelease-1" of tag3' puts 'call Tk.callback_break' @@ -117,7 +117,7 @@ p b4.bindtags b5.bindtags([tag1, TkButton, tag2, b5]) # create button to set button class binding -TkButton.new(:text=>'set binding to TkButton class', +TkButton.new(:text=>'set binding to TkButton class', :command=>proc{ puts 'call "set_class_bind"' set_class_bind diff --git a/ext/tk/sample/binstr_usage.rb b/ext/tk/sample/binstr_usage.rb index be8399ba51..fa81f98b5e 100644 --- a/ext/tk/sample/binstr_usage.rb +++ b/ext/tk/sample/binstr_usage.rb @@ -13,7 +13,7 @@ However, when treats a binary sequence, the convert process makes troubles. Tk::BinaryString class (subclass of Tk::EncodedString class) is the class \ to avoid such troubles. Please see the source code of this sample. \ -A Tk::BinaryString instance is used to create the image for the center button. +A Tk::BinaryString instance is used to create the image for the center button. EOM ImgFile=[File.dirname(__FILE__), 'images','tcllogo.gif'].join(File::Separator) diff --git a/ext/tk/sample/cd_timer.rb b/ext/tk/sample/cd_timer.rb index 9154e89bfe..e2611fbf23 100644 --- a/ext/tk/sample/cd_timer.rb +++ b/ext/tk/sample/cd_timer.rb @@ -7,23 +7,23 @@ require 'tk' if ARGV.empty? - $stderr.puts 'Error:: No time arguments for counting down' + $stderr.puts 'Error:: No time arguments for counting down' exit(1) end width = 10 -TkButton.new(:text=>'exit', +TkButton.new(:text=>'exit', :command=>proc{exit}).pack(:side=>:bottom, :fill=>:x) b = TkButton.new(:text=>'start').pack(:side=>:top, :fill=>:x) f = TkFrame.new(:relief=>:ridge, :borderwidth=>2).pack(:fill=>:x) -TkLabel.new(f, :relief=>:flat, :pady=>3, - :background=>'black', :foreground=>'white', +TkLabel.new(f, :relief=>:flat, :pady=>3, + :background=>'black', :foreground=>'white', :text=>' elapsed: ').pack(:fill=>:x, :side=>:left, :expand=>true) -now = TkLabel.new(f, :width=>width, :relief=>:flat, :pady=>3, :anchor=>:w, - :background=>'black', :foreground=>'white', +now = TkLabel.new(f, :width=>width, :relief=>:flat, :pady=>3, :anchor=>:w, + :background=>'black', :foreground=>'white', :text=>'%4d:%02d.00' % [0, 0]).pack(:side=>:right) timers = [ TkRTTimer.new(10){|tm| @@ -41,9 +41,9 @@ timers = [ TkRTTimer.new(10){|tm| ARGV.collect{|arg| (Float(arg) * 60).to_i}.sort.each_with_index{|time, idx| f = TkFrame.new(:relief=>:ridge, :borderwidth=>2).pack(:fill=>:x) - TkLabel.new(f, :relief=>:flat, :pady=>3, + TkLabel.new(f, :relief=>:flat, :pady=>3, :text=>' %4d:%02d --> ' % (time.divmod(60))).pack(:side=>:left) - l = TkLabel.new(f, :width=>width, :relief=>:flat, :pady=>3, :anchor=>:w, + l = TkLabel.new(f, :width=>width, :relief=>:flat, :pady=>3, :anchor=>:w, :text=>'%4d:%02d' % (time.divmod(60))).pack(:side=>:right) timers << TkRTTimer.new(1000){|tm| t = (tm.return_value || time) - 1 diff --git a/ext/tk/sample/cmd_res_test.rb b/ext/tk/sample/cmd_res_test.rb index 6e954f26ee..8df2e61af7 100644 --- a/ext/tk/sample/cmd_res_test.rb +++ b/ext/tk/sample/cmd_res_test.rb @@ -1,5 +1,5 @@ require 'tk' -TkOptionDB.readfile(File.expand_path('cmd_resource', +TkOptionDB.readfile(File.expand_path('cmd_resource', File.dirname(__FILE__))) f = TkFrame.new(:class=>'BtnFrame').pack b = TkButton.new(:parent=>f, :widgetname=>'hello').pack diff --git a/ext/tk/sample/demos-en/anilabel.rb b/ext/tk/sample/demos-en/anilabel.rb index 0b9bc7357e..ebd84accd2 100644 --- a/ext/tk/sample/demos-en/anilabel.rb +++ b/ext/tk/sample/demos-en/anilabel.rb @@ -4,7 +4,7 @@ # based on Tcl/Tk8.5a2 widget demos if defined?($anilabel_demo) && $anilabel_demo - $anilabel_demo.destroy + $anilabel_demo.destroy $anilabel_demo = nil end @@ -47,7 +47,7 @@ TkFrame.new(base_frame) {|frame| # create frame for label demo f_left = TkLabelFrame.new(base_frame, :text=>'Scrolling Texts') f_right = TkLabelFrame.new(base_frame, :text=>'GIF Image') -Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both', +Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both', 'padx'=>10, 'pady'=>10) # animated label @@ -85,7 +85,7 @@ class AnimatedImageLabel < AnimatedTextLabel @btag.bind_append('Destroy'){ if @destroy_image begin - self.image.delete + self.image.delete rescue end end @@ -121,13 +121,13 @@ class AnimatedImageLabel < AnimatedTextLabel end # create labels -l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge, +l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge, :font=>{:family=>'Courier', :size=>10}) -l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove, +l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove, :font=>{:family=>'Courier', :size=>10}) -l3 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:flat, +l3 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:flat, :font=>{:family=>'Courier', :size=>10}, :width=>18) -Tk.pack(l1, l2, l3, +Tk.pack(l1, l2, l3, :side=>:top, :expand=>true, :anchor=>:w, :padx=>10, :pady=>10) limg = AnimatedImageLabel.new(f_right, :borderwidth=>0) diff --git a/ext/tk/sample/demos-en/aniwave.rb b/ext/tk/sample/demos-en/aniwave.rb index 63a04a7b98..57d58193f6 100644 --- a/ext/tk/sample/demos-en/aniwave.rb +++ b/ext/tk/sample/demos-en/aniwave.rb @@ -5,7 +5,7 @@ # destroy toplevel widget for this demo script if defined?($aniwave_demo) && $aniwave_demo - $aniwave_demo.destroy + $aniwave_demo.destroy $aniwave_demo = nil end @@ -51,11 +51,11 @@ class AnimatedWaveDemo @direction = dir # create canvas widget - @c = TkCanvas.new(frame, :width=>300, :height=>200, + @c = TkCanvas.new(frame, :width=>300, :height=>200, :background=>'black') @c.pack(:padx=>10, :pady=>10, :expand=>true) - # Creates a coordinates list of a wave. + # Creates a coordinates list of a wave. @waveCoords = [] @backupCoords = [] n = 0 @@ -67,10 +67,10 @@ class AnimatedWaveDemo # Create a smoothed line and arrange for its coordinates to be the # contents of the variable waveCoords. - @line = TkcLine.new(@c, @waveCoords, + @line = TkcLine.new(@c, @waveCoords, :width=>1, :fill=>'green', :smooth=>true) - # Main animation "loop". + # Main animation "loop". # Theoretically 100 frames-per-second (==10ms between frames) @timer = TkTimer.new(10){ basicMotion; reverser } diff --git a/ext/tk/sample/demos-en/arrow.rb b/ext/tk/sample/demos-en/arrow.rb index 055cd2af3c..452153d010 100644 --- a/ext/tk/sample/demos-en/arrow.rb +++ b/ext/tk/sample/demos-en/arrow.rb @@ -28,65 +28,65 @@ def arrowSetup(c) # Create the arrow and outline. c.delete('all') - TkcLine.new(c, v.x1, v.y, v.x2, v.y, - { 'width'=>10 * v.width, - 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c], - 'arrow'=>'last' + TkcLine.new(c, v.x1, v.y, v.x2, v.y, + { 'width'=>10 * v.width, + 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c], + 'arrow'=>'last' }.update(v.bigLineStyle) ) xtip = v.x2 - 10*v.b deltaY = 10*v.c + 5*v.width - TkcLine.new(c, v.x2, v.y, xtip, v.y + deltaY, - v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y, + TkcLine.new(c, v.x2, v.y, xtip, v.y + deltaY, + v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y, 'width'=>2, 'capstyle'=>'round', 'joinstyle'=>'round') # Create the boxes for reshaping the line and arrowhead. - TkcRectangle.new(c, v.x2-10*v.a-5, v.y-5, v.x2-10*v.a+5, v.y+5, + TkcRectangle.new(c, v.x2-10*v.a-5, v.y-5, v.x2-10*v.a+5, v.y+5, {'tags'=>['box1', $arrowTag_box]}.update(v.boxStyle) ) - TkcRectangle.new(c, xtip-5, v.y-deltaY-5, xtip+5, v.y-deltaY+5, + TkcRectangle.new(c, xtip-5, v.y-deltaY-5, xtip+5, v.y-deltaY+5, {'tags'=>['box2', $arrowTag_box]}.update(v.boxStyle) ) - TkcRectangle.new(c, v.x1-5, v.y-5*v.width-5, v.x1+5, v.y-5*v.width+5, + TkcRectangle.new(c, v.x1-5, v.y-5*v.width-5, v.x1+5, v.y-5*v.width+5, {'tags'=>['box3', $arrowTag_box]}.update(v.boxStyle) ) c.itemconfigure cur, v.activeStyle if cur # Create three arrows in actual size with the same parameters TkcLine.new(c, v.x2+50, 0, v.x2+50, 1000, 'width'=>2) tmp = v.x2+100 - TkcLine.new(c, tmp, v.y-125, tmp, v.y-75, 'width'=>v.width, + TkcLine.new(c, tmp, v.y-125, tmp, v.y-75, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - TkcLine.new(c, tmp-25, v.y, tmp+25, v.y, 'width'=>v.width, + TkcLine.new(c, tmp-25, v.y, tmp+25, v.y, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - TkcLine.new(c, tmp-25, v.y+75, tmp+25, v.y+125, 'width'=>v.width, + TkcLine.new(c, tmp-25, v.y+75, tmp+25, v.y+125, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - # Create a bunch of other arrows and text items showing the + # Create a bunch of other arrows and text items showing the # current dimensions. tmp = v.x2+10 - TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y-deltaY, + TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y-deltaY, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2+15, v.y-deltaY+5*v.c, 'text'=>v.c, 'anchor'=>'w') tmp = v.x1-10 - TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y+5*v.width, + TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y+5*v.width, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x1-15, v.y, 'text'=>v.width, 'anchor'=>'e') tmp = v.y+5*v.width+10*v.c+10 - TkcLine.new(c, v.x2-10*v.a, tmp, v.x2, tmp, + TkcLine.new(c, v.x2-10*v.a, tmp, v.x2, tmp, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2-5*v.a, tmp+5, 'text'=>v.a, 'anchor'=>'n') tmp = tmp+25 - TkcLine.new(c, v.x2-10*v.b, tmp, v.x2, tmp, + TkcLine.new(c, v.x2-10*v.b, tmp, v.x2, tmp, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2-5*v.b, tmp+5, 'text'=>v.b, 'anchor'=>'n') if $tk_version =~ /^4.*/ - TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', + TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*') - TkcText.new(c, v.x1, 330, + TkcText.new(c, v.x1, 330, 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]",'anchor'=>'w', 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*') else - TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', + TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', 'font'=>'Helvetica 18') - TkcText.new(c, v.x1, 330, + TkcText.new(c, v.x1, 330, 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]", 'anchor'=>'w', 'font'=>'Helvetica 18') end @@ -96,7 +96,7 @@ end # toplevel widget if defined?($arrow_demo) && $arrow_demo - $arrow_demo.destroy + $arrow_demo.destroy $arrow_demo = nil end @@ -110,7 +110,7 @@ $arrow_demo = TkToplevel.new {|w| base_frame = TkFrame.new($arrow_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', 'text'=>"This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item."){ pack('side'=>'top') } @@ -133,15 +133,15 @@ $arrow_buttons = TkFrame.new(base_frame) {|frame| } $arrow_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# canvas -$arrow_canvas = TkCanvas.new(base_frame, 'width'=>500, 'height'=>350, +# canvas +$arrow_canvas = TkCanvas.new(base_frame, 'width'=>500, 'height'=>350, 'relief'=>'sunken', 'borderwidth'=>2) $arrow_canvas.pack('expand'=>'yes', 'fill'=>'both') -# +# unless Struct.const_defined?("ArrowInfo") - $demo_arrowInfo = Struct.new("ArrowInfo", :a, :b, :c, :width, :motionProc, - :x1, :x2, :y, :smallTips, :count, + $demo_arrowInfo = Struct.new("ArrowInfo", :a, :b, :c, :width, :motionProc, + :x1, :x2, :y, :smallTips, :count, :bigLineStyle, :boxStyle, :activeStyle).new end $demo_arrowInfo.a = 8 @@ -159,7 +159,7 @@ if TkWinfo.depth($arrow_canvas) > 1 $demo_arrowInfo.boxStyle = {'fill'=>'', 'outline'=>'black', 'width'=>1} $demo_arrowInfo.activeStyle = {'fill'=>'red', 'outline'=>'black', 'width'=>1} else - $demo_arrowInfo.bigLineStyle = {'fill'=>'black', + $demo_arrowInfo.bigLineStyle = {'fill'=>'black', 'stipple'=>'@'+[$demo_dir,'..','images','grey.25'].join(File::Separator)} $demo_arrowInfo.boxStyle = {'fill'=>'', 'outline'=>'black', 'width'=>1} $demo_arrowInfo.activeStyle = {'fill'=>'black','outline'=>'black','width'=>1} @@ -170,16 +170,16 @@ $arrowTag_box.bind('Enter', proc{$arrow_canvas.itemconfigure('current', $demo_ar $arrowTag_box.bind('Leave', proc{$arrow_canvas.itemconfigure('current', $demo_arrowInfo.boxStyle)}) $arrowTag_box.bind('B1-Enter', proc{}) $arrowTag_box.bind('B1-Leave', proc{}) -$arrow_canvas.itembind('box1', '1', +$arrow_canvas.itembind('box1', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove1 $arrow_canvas, x, y}}) -$arrow_canvas.itembind('box2', '1', +$arrow_canvas.itembind('box2', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove2 $arrow_canvas, x, y}}) -$arrow_canvas.itembind('box3', '1', +$arrow_canvas.itembind('box3', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove3 $arrow_canvas, x, y}}) -$arrowTag_box.bind('B1-Motion', +$arrowTag_box.bind('B1-Motion', proc{|x,y| $demo_arrowInfo.motionProc.call(x,y)}, "%x %y") $arrow_canvas.bind('Any-ButtonRelease-1', proc{arrowSetup $arrow_canvas}) diff --git a/ext/tk/sample/demos-en/bind.rb b/ext/tk/sample/demos-en/bind.rb index 665592a2bc..c291e4730a 100644 --- a/ext/tk/sample/demos-en/bind.rb +++ b/ext/tk/sample/demos-en/bind.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($bind_demo) && $bind_demo - $bind_demo.destroy + $bind_demo.destroy $bind_demo = nil end @@ -38,15 +38,15 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# bind +# bind def tag_binding_for_bind_demo(tag, enter_style, leave_style) tag.bind('Any-Enter', proc{tag.configure enter_style}) tag.bind('Any-Leave', proc{tag.configure leave_style}) end -# text +# text txt = TkText.new(base_frame){|t| - # + # setgrid 'true' #width 60 #height 24 @@ -59,9 +59,9 @@ txt = TkText.new(base_frame){|t| } pack('expand'=>'yes', 'fill'=>'both') - # + # if TkWinfo.depth($root).to_i > 1 - tagstyle_bold = {'background'=>'#43ce80', 'relief'=>'raised', + tagstyle_bold = {'background'=>'#43ce80', 'relief'=>'raised', 'borderwidth'=>1} tagstyle_normal = {'background'=>'', 'relief'=>'flat'} else @@ -77,44 +77,44 @@ txt = TkText.new(base_frame){|t| insert('end', "\n\n") insert('end', '2. A simple two-dimensional plot that allows you to adjust the positions of the data points.', (d2 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '3. Anchoring and justification modes for text items.', + insert('end', '3. Anchoring and justification modes for text items.', (d3 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '4. An editor for arrow-head shapes for line items.', + insert('end', '4. An editor for arrow-head shapes for line items.', (d4 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '5. A ruler with facilities for editing tab stops.', + insert('end', '5. A ruler with facilities for editing tab stops.', (d5 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', - '6. A grid that demonstrates how canvases can be scrolled.', + insert('end', + '6. A grid that demonstrates how canvases can be scrolled.', (d6 = TkTextTag.new(t)) ) # binding [d1, d2, d3, d4, d5, d6].each{|tag| tag_binding_for_bind_demo(tag, tagstyle_bold, tagstyle_normal) } - d1.bind('1', + d1.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'items.rb'].join(File::Separator)}`, 'items.rb') }) - d2.bind('1', + d2.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'plot.rb'].join(File::Separator)}`, 'plot.rb') }) - d3.bind('1', + d3.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'ctext.rb'].join(File::Separator)}`, 'ctext.rb') }) - d4.bind('1', + d4.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'arrow.rb'].join(File::Separator)}`, 'arrow.rb') }) - d5.bind('1', + d5.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'ruler.rb'].join(File::Separator)}`, 'ruler.rb') }) - d6.bind('1', + d6.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'cscroll.rb'].join(File::Separator)}`, 'cscroll.rb') }) diff --git a/ext/tk/sample/demos-en/bitmap.rb b/ext/tk/sample/demos-en/bitmap.rb index 133adb0543..858d067d0d 100644 --- a/ext/tk/sample/demos-en/bitmap.rb +++ b/ext/tk/sample/demos-en/bitmap.rb @@ -17,7 +17,7 @@ def bitmapRow(w,*args) TkFrame.new(w){|row| pack('side'=>'top', 'fill'=>'both') - for bitmap in args + for bitmap in args TkFrame.new(row){|base| pack('side'=>'left', 'fill'=>'both', 'pady'=>'.25c', 'padx'=>'.25c') TkLabel.new(base, 'text'=>bitmap, 'width'=>9).pack('side'=>'bottom') @@ -29,7 +29,7 @@ end # toplevel widget if defined?($bitmap_demo) && $bitmap_demo - $bitmap_demo.destroy + $bitmap_demo.destroy $bitmap_demo = nil end @@ -43,7 +43,7 @@ $bitmap_demo = TkToplevel.new {|w| base_frame = TkFrame.new($bitmap_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left', +TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left', 'text'=>"This window displays all of Tk's built-in bitmaps, along with the names you can use for them in Tcl scripts."){ pack('side'=>'top') } @@ -66,7 +66,7 @@ $bitmap_buttons = TkFrame.new(base_frame) {|frame| } $bitmap_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame +# frame TkFrame.new(base_frame){|f| bitmapRow(f,'error','gray25','gray50','hourglass') bitmapRow(f,'info','question','questhead','warning') diff --git a/ext/tk/sample/demos-en/button.rb b/ext/tk/sample/demos-en/button.rb index 5c03bd499b..f63a2f3b06 100644 --- a/ext/tk/sample/demos-en/button.rb +++ b/ext/tk/sample/demos-en/button.rb @@ -6,20 +6,20 @@ # button widget demo (called by 'widget') # -# toplevel widget +# toplevel widget if defined?($button_demo) && $button_demo - $button_demo.destroy + $button_demo.destroy $button_demo = nil end -# demo toplevel widget +# demo toplevel widget $button_demo = TkToplevel.new {|w| title("Button Demonstration") iconname("button") positionWindow(w) } -# label +# label msg = TkLabel.new($button_demo) { font $kanji_font wraplength '4i' @@ -28,7 +28,7 @@ msg = TkLabel.new($button_demo) { } msg.pack('side'=>'top') -# frame +# frame $button_buttons = Tk::Frame.new($button_demo) {|frame| TkButton.new(frame) { text 'Dismiss' diff --git a/ext/tk/sample/demos-en/check.rb b/ext/tk/sample/demos-en/check.rb index 2951962a79..bf0b73476a 100644 --- a/ext/tk/sample/demos-en/check.rb +++ b/ext/tk/sample/demos-en/check.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($check_demo) && $check_demo - $check_demo.destroy + $check_demo.destroy $check_demo = nil end @@ -21,7 +21,7 @@ $check_demo = TkToplevel.new {|w| base_frame = TkFrame.new($check_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '4i' @@ -30,12 +30,12 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# wipers = TkVariable.new(0) brakes = TkVariable.new(0) sober = TkVariable.new(0) -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -56,7 +56,7 @@ TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'See Variables' command proc{ - showVars(base_frame, + showVars(base_frame, ['wipers', wipers], ['brakes', brakes], ['sober', sober]) } }.pack('side'=>'left', 'expand'=>'yes') diff --git a/ext/tk/sample/demos-en/check2.rb b/ext/tk/sample/demos-en/check2.rb index faea748a87..4f7b1f07bc 100644 --- a/ext/tk/sample/demos-en/check2.rb +++ b/ext/tk/sample/demos-en/check2.rb @@ -4,7 +4,7 @@ # delete old toplevel widget if defined?($check2_demo) && $check2_demo - $check2_demo.destroy + $check2_demo.destroy $check2_demo = nil end @@ -34,35 +34,35 @@ sober = TkVariable.new(0) # frame TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars($check2_demo, - ['safety', safety], ['wipers', wipers], + showVars($check2_demo, + ['safety', safety], ['wipers', wipers], ['brakes', brakes], ['sober', sober]) - }), - TkButton.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'check2'}), - TkButton.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + TkButton.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'check2'}), + TkButton.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $check2_demo $check2_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) }.pack('side'=>'bottom', 'fill'=>'x') # checkbutton -TkCheckButton.new(base_frame, :text=>'Safety Check', :variable=>safety, - :relief=>:flat, :onvalue=>'all', :offvalue=>'none', +TkCheckButton.new(base_frame, :text=>'Safety Check', :variable=>safety, + :relief=>:flat, :onvalue=>'all', :offvalue=>'none', :tristatevalue=>'partial'){ pack('side'=>'top', 'pady'=>2, 'anchor'=>'w') } @@ -70,7 +70,7 @@ TkCheckButton.new(base_frame, :text=>'Safety Check', :variable=>safety, [ TkCheckButton.new(base_frame, 'text'=>'Wipers OK', 'variable'=>wipers), TkCheckButton.new(base_frame, 'text'=>'Brakes OK', 'variable'=>brakes), TkCheckButton.new(base_frame, 'text'=>'Driver Sober', 'variable'=>sober) -].each{|w| +].each{|w| w.relief('flat') w.pack('side'=>'top', 'padx'=>15, 'pady'=>2, 'anchor'=>'w') } diff --git a/ext/tk/sample/demos-en/clrpick.rb b/ext/tk/sample/demos-en/clrpick.rb index 431439d55d..6da28cb112 100644 --- a/ext/tk/sample/demos-en/clrpick.rb +++ b/ext/tk/sample/demos-en/clrpick.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($clrpick_demo) && $clrpick_demo - $clrpick_demo.destroy + $clrpick_demo.destroy $clrpick_demo = nil end @@ -47,10 +47,10 @@ Tk::Frame.new($clrpick_demo) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# button +# button # TkButton.new($clrpick_demo, 'text'=>'Set background color ...') {|b| Tk::Button.new($clrpick_demo, 'text'=>'Set background color ...') {|b| - command(proc{setColor $clrpick_demo, b, 'background', + command(proc{setColor $clrpick_demo, b, 'background', ['background', 'highlightbackground']}) pack('side'=>'top', 'anchor'=>'c', 'pady'=>'2m') } @@ -64,7 +64,7 @@ Tk::Button.new($clrpick_demo, 'text'=>'Set foreground color ...') {|b| def setColor(w,button,name,options) w.grab initialColor = button[name] - color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, + color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, 'initialcolor'=>initialColor) if color != "" setColor_helper(w,options,color) diff --git a/ext/tk/sample/demos-en/colors.rb b/ext/tk/sample/demos-en/colors.rb index 4300a660ae..b0ef9590b9 100644 --- a/ext/tk/sample/demos-en/colors.rb +++ b/ext/tk/sample/demos-en/colors.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($colors_demo) && $colors_demo - $colors_demo.destroy + $colors_demo.destroy $colors_demo = nil end diff --git a/ext/tk/sample/demos-en/combo.rb b/ext/tk/sample/demos-en/combo.rb index 0907d9e8ec..d77660095c 100644 --- a/ext/tk/sample/demos-en/combo.rb +++ b/ext/tk/sample/demos-en/combo.rb @@ -5,7 +5,7 @@ # based on "Id: combo.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($combo_demo) && $combo_demo - $combo_demo.destroy + $combo_demo.destroy $combo_demo = nil end @@ -17,7 +17,7 @@ $combo_demo = TkToplevel.new {|w| base_frame = TkFrame.new($combo_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><:top, :fill=>:x) Three different combo-boxes are displayed below. \ You can add characters to the first \ @@ -40,24 +40,24 @@ ozCity = TkVariable.new Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, - ['firstVariable', firstValue], - ['secondVariable', secondValue], + showVars(base_frame, + ['firstVariable', firstValue], + ['secondVariable', secondValue], ['ozCity', ozCity]) - }), - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'combo'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'combo'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $combo_demo.destroy $combo_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -66,7 +66,7 @@ Ttk::Frame.new(base_frame) {|frame| frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true) australianCities = [ - 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', + 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', 'Hobart', 'Darwin', 'Alice Springs' ] @@ -80,17 +80,17 @@ Tk.pack(Ttk::Labelframe.new(frame, :text=>'Fully Editable'){|f| w.values <<= w.value unless w.values.include?(w.value) } }.pack(:pady=>5, :padx=>10) - }, + }, Ttk::LabelFrame.new(frame, :text=>'Disabled'){|f| Ttk::Combobox.new(f, :textvariable=>secondValue, :state=>:disabled) . pack(:pady=>5, :padx=>10) - }, + }, Ttk::LabelFrame.new(frame, :text=>'Defined List Only'){|f| - Ttk::Combobox.new(f, :textvariable=>ozCity, :state=>:readonly, + Ttk::Combobox.new(f, :textvariable=>ozCity, :state=>:readonly, :values=>australianCities) . pack(:pady=>5, :padx=>10) - }, + }, :side=>:top, :pady=>5, :padx=>10) diff --git a/ext/tk/sample/demos-en/cscroll.rb b/ext/tk/sample/demos-en/cscroll.rb index 259ed3bd8c..40a3afc0ad 100644 --- a/ext/tk/sample/demos-en/cscroll.rb +++ b/ext/tk/sample/demos-en/cscroll.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($cscroll_demo) && $cscroll_demo - $cscroll_demo.destroy + $cscroll_demo.destroy $cscroll_demo = nil end @@ -22,7 +22,7 @@ $cscroll_demo = TkToplevel.new {|w| base_frame = TkFrame.new($cscroll_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', 'text'=>"This window displays a canvas widget that can be scrolled either using the scrollbars or by dragging with button 2 in the canvas. If you click button 1 on one of the rectangles, its indices will be printed on stdout."){ pack('side'=>'top') } @@ -45,7 +45,7 @@ $cscroll_buttons = TkFrame.new(base_frame) {|frame| } $cscroll_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame +# frame unless $tk_version =~ /^4\.[01]/ $cscroll_grid = TkFrame.new(base_frame) { pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1) @@ -55,14 +55,14 @@ unless $tk_version =~ /^4\.[01]/ end # canvas -$cscroll_canvas = TkCanvas.new(base_frame, +$cscroll_canvas = TkCanvas.new(base_frame, 'relief'=>'sunken', 'borderwidth'=>2, 'scrollregion'=>['-11c', '-11c', '50c', '20c'] ) {|c| if $tk_version =~ /^4\.[01]/ - pack('expand'=>'yes', 'fill'=>'both') + pack('expand'=>'yes', 'fill'=>'both') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end @@ -71,18 +71,18 @@ $cscroll_canvas = TkCanvas.new(base_frame, if $tk_version =~ /^4\.[01]/ pack('side'=>'right', 'fill'=>'y') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end } - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}) {|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) if $tk_version =~ /^4\.[01]/ - pack('side'=>'bottom', 'fill'=>'x') + pack('side'=>'bottom', 'fill'=>'x') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end } @@ -93,9 +93,9 @@ bg = $cscroll_canvas.configinfo('bg')[4] x = -10+3*i y = -10 (0..9).each{|j| - TkcRectangle.new($cscroll_canvas, "#{x}c", "#{y}c", "#{x+2}c", "#{y+2}c", + TkcRectangle.new($cscroll_canvas, "#{x}c", "#{y}c", "#{x+2}c", "#{y+2}c", 'outline'=>'black', 'fill'=>bg, 'tags'=>'rect') - TkcText.new($cscroll_canvas, "#{x+1}c", "#{y+1}c", + TkcText.new($cscroll_canvas, "#{x+1}c", "#{y+1}c", 'text'=>"#{i},#{j}", 'anchor'=>'center', 'tags'=>'text') y += 3 } @@ -106,7 +106,7 @@ $cscroll_canvas.itembind('all', 'Any-Leave', proc{scrollLeave $cscroll_canvas}) $cscroll_canvas.itembind('all', '1', proc{scrollButton $cscroll_canvas}) $cscroll_canvas.itembind('all', 'Any-Enter', proc{scrollEnter $cscroll_canvas}) $cscroll_canvas.bind('2', proc{|x,y| $cscroll_canvas.scan_mark(x,y)}, '%x %y') -$cscroll_canvas.bind('B2-Motion', +$cscroll_canvas.bind('B2-Motion', proc{|x,y| $cscroll_canvas.scan_dragto(x,y)}, '%x %y') def scrollEnter(c) diff --git a/ext/tk/sample/demos-en/ctext.rb b/ext/tk/sample/demos-en/ctext.rb index 01374b0321..e04cb283f0 100644 --- a/ext/tk/sample/demos-en/ctext.rb +++ b/ext/tk/sample/demos-en/ctext.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($ctext_demo) && $ctext_demo - $ctext_demo.destroy + $ctext_demo.destroy $ctext_demo = nil end @@ -22,7 +22,7 @@ $ctext_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ctext_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', 'text'=>"This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification. The text also supports the following simple bindings for editing: 1. You can point, click, and type. 2. You can also select with button 1. @@ -52,20 +52,20 @@ $ctext_buttons = TkFrame.new(base_frame) {|frame| } $ctext_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# canvas -$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat', +# canvas +$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat', 'borderwidth'=>0, 'width'=>500, 'height'=>350) $ctext_canvas.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'both') -# font +# font if $tk_version =~ /^4.*/ textFont = '-*-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*' else textFont = 'Helvetica 24' end -# canvas -TkcRectangle.new($ctext_canvas, 245, 195, 255, 205, +# canvas +TkcRectangle.new($ctext_canvas, 245, 195, 255, 205, 'outline'=>'black', 'fill'=>'red') ctag_text_param = { @@ -83,24 +83,24 @@ $ctag_text.withtag(TkcText.new($ctext_canvas, 250, 200, ctag_text_param)) $ctag_text.bind('1', proc{|x,y| textB1Press $ctext_canvas,x,y}, "%x %y") $ctag_text.bind('B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y") -$ctag_text.bind('Shift-1', - proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"}, +$ctag_text.bind('Shift-1', + proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"}, "%x %y") -$ctag_text.bind('Shift-B1-Motion', +$ctag_text.bind('Shift-B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y") $ctag_text.bind('KeyPress', proc{|a| textInsert $ctext_canvas,a}, "%A") $ctag_text.bind('Return', proc{textInsert $ctext_canvas,"\n"}) $ctag_text.bind('Control-h', proc{textBs $ctext_canvas}) $ctag_text.bind('BackSpace', proc{textBs $ctext_canvas}) $ctag_text.bind('Delete', proc{textDel $ctext_canvas}) -$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"}, +$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"}, "%x %y") -# Next, create some items that allow the text's anchor position +# Next, create some items that allow the text's anchor position # to be edited. def mkTextConfig(w,x,y,option,value,color) - item = TkcRectangle.new(w, x, y, x+30, y+30, + item = TkcRectangle.new(w, x, y, x+30, y+30, 'outline'=>'black', 'fill'=>color, 'width'=>1) item.bind('1', proc{$ctag_text.configure option, value}) w.addtag_withtag('config', item) @@ -118,15 +118,15 @@ mkTextConfig $ctext_canvas, x+60, y+30, 'anchor', 'w', color mkTextConfig $ctext_canvas, x, y+60, 'anchor', 'ne', color mkTextConfig $ctext_canvas, x+30, y+60, 'anchor', 'n', color mkTextConfig $ctext_canvas, x+60, y+60, 'anchor', 'nw', color -item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50, +item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50, 'outline'=>'black', 'fill'=>'red') item.bind('1', proc{$ctag_text.configure 'anchor', 'center'}) if $tk_version =~ /^4.*/ - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', - 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', + 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', 'anchor'=>'s', 'fill'=>'brown') else - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', 'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown') end @@ -140,18 +140,18 @@ mkTextConfig $ctext_canvas, x, y, 'justify', 'left', color mkTextConfig $ctext_canvas, x+30, y, 'justify', 'center', color mkTextConfig $ctext_canvas, x+60, y, 'justify', 'right', color if $tk_version =~ /^4.*/ - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', - 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', + 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', 'anchor'=>'s', 'fill'=>'brown') else - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', 'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown') end $ctext_canvas.itembind('config', 'Enter', proc{textEnter $ctext_canvas}) -$ctext_canvas.itembind('config', 'Leave', +$ctext_canvas.itembind('config', 'Leave', proc{$ctext_canvas\ - .itemconfigure('current', + .itemconfigure('current', 'fill'=>$textConfigFill)}) $textConfigFill = '' diff --git a/ext/tk/sample/demos-en/entry1.rb b/ext/tk/sample/demos-en/entry1.rb index 6f5b10fb71..fac0afc243 100644 --- a/ext/tk/sample/demos-en/entry1.rb +++ b/ext/tk/sample/demos-en/entry1.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($entry1_demo) && $entry1_demo - $entry1_demo.destroy + $entry1_demo.destroy $entry1_demo = nil end @@ -43,13 +43,13 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# +# e1 = TkEntry.new(base_frame, 'relief'=>'sunken') e2 = TkEntry.new(base_frame, 'relief'=>'sunken') e3 = TkEntry.new(base_frame, 'relief'=>'sunken') [e1,e2,e3].each{|w| w.pack('side'=>'top', 'padx'=>10, 'pady'=>5, 'fill'=>'x')} -# +# e1.insert(0, 'Initial value') e2.insert('end', "This entry contains a long value, much too long ") e2.insert('end', "to fit in the window at one time, so long in fact ") diff --git a/ext/tk/sample/demos-en/entry2.rb b/ext/tk/sample/demos-en/entry2.rb index d67d04b56d..05a6c83cfd 100644 --- a/ext/tk/sample/demos-en/entry2.rb +++ b/ext/tk/sample/demos-en/entry2.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($entry2_demo) && $entry2_demo - $entry2_demo.destroy + $entry2_demo.destroy $entry2_demo = nil end @@ -82,7 +82,7 @@ TkFrame.new(base_frame, 'borderwidth'=>10) {|w| e3.pack('side'=>'top', 'fill'=>'x') s3.pack('side'=>'top', 'fill'=>'x') - # + # e1.insert(0, 'Initial value') e2.insert('end', "This entry contains a long value, much too long ") e2.insert('end', "to fit in the window at one time, so long in fact ") diff --git a/ext/tk/sample/demos-en/entry3.rb b/ext/tk/sample/demos-en/entry3.rb index f7df3a5653..d3bc629fdf 100644 --- a/ext/tk/sample/demos-en/entry3.rb +++ b/ext/tk/sample/demos-en/entry3.rb @@ -7,7 +7,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($entry3_demo) && $entry3_demo - $entry3_demo.destroy + $entry3_demo.destroy $entry3_demo = nil end @@ -19,8 +19,8 @@ $entry3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($entry3_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><:top) Four different entries are displayed below. You can add characters \ by pointing, clicking and typing, though each is constrained in what \ @@ -63,8 +63,8 @@ TkFrame.new(base_frame){|f| def focusAndFlash(widget, fg, bg, count=5) return if count <= 0 if fg && !fg.empty? && bg && !bg.empty? - TkTimer.new(200, count, - proc{widget.configure(:foreground=>bg, :background=>fg)}, + TkTimer.new(200, count, + proc{widget.configure(:foreground=>bg, :background=>fg)}, proc{widget.configure(:foreground=>fg, :background=>bg)} ).start else @@ -86,7 +86,7 @@ def focusAndFlash(widget, fg, bg, count=5) end l1 = TkLabelFrame.new(base_frame, :text=>"Integer Entry") -TkEntry.new(l1, :validate=>:focus, +TkEntry.new(l1, :validate=>:focus, :vcmd=>[ proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' ]) {|e| @@ -97,7 +97,7 @@ TkEntry.new(l1, :validate=>:focus, } l2 = TkLabelFrame.new(base_frame, :text=>"Length-Constrained Entry") -TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell}, +TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell}, :vcmd=>[proc{|s| s.length < 10}, '%P'] ).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m') @@ -171,7 +171,7 @@ end def validatePhoneChange(widget, vmode, idx, char) return true if idx == nil - Tk.after_idle(proc{widget.configure(:validate=>vmode, + Tk.after_idle(proc{widget.configure(:validate=>vmode, :invcmd=>proc{Tk.bell})}) if !(idx<3 || idx==6 || idx==7 || idx==11 || idx>15) && char =~ /[0-9A-Za-z]/ widget.delete(idx) @@ -179,17 +179,17 @@ def validatePhoneChange(widget, vmode, idx, char) Tk.after_idle(proc{phoneSkipRight(widget, -1)}) return true # Tk.update(true) # <- Don't work 'update' inter validation callback. - # It depends on Tcl/Tk side (tested on Tcl/Tk8.5a1). + # It depends on Tcl/Tk side (tested on Tcl/Tk8.5a1). end return false end l3 = TkLabelFrame.new(base_frame, :text=>"US Phone-Number Entry") -TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, - :textvariable=>entry3content, +TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, + :textvariable=>entry3content, :vcmd=>[ - proc{|w,v,i,s| validatePhoneChange(w,v,i,s)}, + proc{|w,v,i,s| validatePhoneChange(w,v,i,s)}, "%W %v %i %S" ]){|e| # Click to focus goes to the first editable character... @@ -205,9 +205,9 @@ TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, } l4 = TkLabelFrame.new(base_frame, :text=>"Password Entry") -TkEntry.new(l4, :validate=>:key, :show=>'*', +TkEntry.new(l4, :validate=>:key, :show=>'*', :vcmd=>[ - proc{|s| s.length <= 8}, + proc{|s| s.length <= 8}, '%P' ]).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m') diff --git a/ext/tk/sample/demos-en/filebox.rb b/ext/tk/sample/demos-en/filebox.rb index 676c347409..0c284c11d4 100644 --- a/ext/tk/sample/demos-en/filebox.rb +++ b/ext/tk/sample/demos-en/filebox.rb @@ -6,7 +6,7 @@ # toplevel widget if defined?($filebox_demo) && $filebox_demo - $filebox_demo.destroy + $filebox_demo.destroy $filebox_demo = nil end @@ -49,7 +49,7 @@ TkFrame.new(base_frame) {|frame| TkEntry.new(f, 'width'=>20) {|e| pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x') - TkButton.new(f, 'text'=>'Browse ...', + TkButton.new(f, 'text'=>'Browse ...', 'command'=>proc{fileDialog base_frame,e,type})\ .pack('side'=>'left') } @@ -60,9 +60,9 @@ TkFrame.new(base_frame) {|frame| $tk_strictMotif = TkVarAccess.new('tk_strictMotif') if ($tk_platform['platform'] == 'unix') - TkCheckButton.new(base_frame, - 'text'=>'Use Motif Style Dialog', - 'variable'=>$tk_strictMotif, + TkCheckButton.new(base_frame, + 'text'=>'Use Motif Style Dialog', + 'variable'=>$tk_strictMotif, 'onvalue'=>1, 'offvalue'=>0 ).pack('anchor'=>'c') end @@ -71,23 +71,23 @@ def fileDialog(w,ent,operation) # #-------------------------------------------------------- types = [ - ['Text files', ['.txt','.doc'] ], - ['Text files', [], 'TEXT' ], - ['Ruby Scripts', ['.rb'], 'TEXT' ], - ['Tcl Scripts', ['.tcl'], 'TEXT' ], - ['C Source Files', ['.c','.h'] ], - ['All Source Files', ['.rb','.tcl','.c','.h'] ], - ['Image Files', ['.gif'] ], - ['Image Files', ['.jpeg','.jpg'] ], - ['Image Files', [], ['GIFF','JPEG']], + ['Text files', ['.txt','.doc'] ], + ['Text files', [], 'TEXT' ], + ['Ruby Scripts', ['.rb'], 'TEXT' ], + ['Tcl Scripts', ['.tcl'], 'TEXT' ], + ['C Source Files', ['.c','.h'] ], + ['All Source Files', ['.rb','.tcl','.c','.h'] ], + ['Image Files', ['.gif'] ], + ['Image Files', ['.jpeg','.jpg'] ], + ['Image Files', [], ['GIFF','JPEG']], ['All files', '*' ] ] if operation == 'open' file = Tk.getOpenFile('filetypes'=>types, 'parent'=>w) else - file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, - 'initialfile'=>'Untitled', + file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, + 'initialfile'=>'Untitled', 'defaultextension'=>'.txt') end if file != "" diff --git a/ext/tk/sample/demos-en/floor.rb b/ext/tk/sample/demos-en/floor.rb index 7023f2a72e..eb8b23eb7d 100644 --- a/ext/tk/sample/demos-en/floor.rb +++ b/ext/tk/sample/demos-en/floor.rb @@ -21,7 +21,7 @@ def floorDisplay(w,active) w.delete('all') $activeFloor = active - # First go through the three floors, displaying the backgrounds for + # First go through the three floors, displaying the backgrounds for # each floor. floor_bg1(w,$floor_colors['bg1'],$floor_colors['outline1']) @@ -32,12 +32,12 @@ def floorDisplay(w,active) w.raise("floor#{active}") - # Create a dummy item just to mark this point in the display list, + # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. TkcRectangle.new(w,0,100,1,101, 'fill'=>'', 'outline'=>'', 'tags'=>'marker') - # Add the walls and labels for the active floor, along with + # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. @@ -302,7 +302,7 @@ def floor_bg3(w,fill,outline) TkcLine.new(w,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) - TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, + TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end @@ -316,316 +316,316 @@ end # color - Color to use for drawing foreground information. def floor_fg1(w,color) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '101' $floorItems['101'] = i - TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Pub Lift1' $floorItems['Pub Lift1'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Priv Lift1' $floorItems['Priv Lift1'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, + i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '110' $floorItems['110'] = i - TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, + TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, + i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '109' $floorItems['109'] = i - TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, + TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, + i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '111' $floorItems['111'] = i - TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, + TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, + i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117B' $floorItems['117B'] = i - TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, + TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, + i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '112' $floorItems['112'] = i - TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, + TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, + i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '113' $floorItems['113'] = i - TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, + TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, + i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117A' $floorItems['117A'] = i - TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, + TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, + i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117' $floorItems['117'] = i - TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, + TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, + i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '114' $floorItems['114'] = i - TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, + TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, + i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '115' $floorItems['115'] = i - TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, + TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, + i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '116' $floorItems['116'] = i - TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, + TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, + i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '118' $floorItems['118'] = i - TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, + TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, - 163,91,163,112,149,112,149,128, + 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '120' $floorItems['120'] = i - TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, + TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, - 156,192,156,169,175,169,175,246,79,246, + 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '122' $floorItems['122'] = i - TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, + TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, + i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '121' $floorItems['121'] = i - TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, + TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, + i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106A' $floorItems['106A'] = i - TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, + TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, + i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '105' $floorItems['105'] = i - TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, + TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, + i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106B' $floorItems['106B'] = i - TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, + TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, + i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '104' $floorItems['104'] = i - TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, + TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, + i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '108' $floorItems['108'] = i - TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, + TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, + i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '107' $floorItems['107'] = i - TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, + TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, + i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Smoking' $floorItems['Smoking'] = i - TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, + TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, + i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '123' $floorItems['123'] = i - TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, + TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, + i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '103' $floorItems['103'] = i - TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, + TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, + i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '124' $floorItems['124'] = i - TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, + TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, + i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '125' $floorItems['125'] = i - TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, + TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, + i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '126' $floorItems['126'] = i - TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, + TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, - 486,253,486,239,474,239,474,209, + 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '127' $floorItems['127'] = i - TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, + TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, - 490,188,490,204,476,204,476,164, + 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'MShower' $floorItems['MShower'] = i - TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, + TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, + i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Closet' $floorItems['Closet'] = i - TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, + TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, + i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'WShower' $floorItems['WShower'] = i - TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, + TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, - 515,174,503,174,503,161,486,161, + 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '130' $floorItems['130'] = i - TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, + TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, - 393,309,300,309,300,248,308,248, + 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '102' $floorItems['102'] = i - TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, + TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, + i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '128' $floorItems['128'] = i - TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, + TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '129' $floorItems['129'] = i - TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, + TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, - 642,389,561,389,561,277,696,277, + 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '133' $floorItems['133'] = i - TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, + TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, + i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '132' $floorItems['132'] = i - TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, + TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, + i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '134' $floorItems['134'] = i - TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, + TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, + i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '135' $floorItems['135'] = i - TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, + TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, - 331,347,332,351,334,354,336,357,341,359, + 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Ramona Stair' $floorItems['Ramona Stair'] = i - TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, + TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, - 122,28,123,32,123,68,220,68,220,87,90,87,90,23, + 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'University Stair' $floorItems['University Stair'] = i - TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, + TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, - 227,13,223,17,221,22,220,34,260,34, + 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Stair' $floorItems['Plaza Stair'] = i - TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, + TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, - 386,104,386,128,220,128, + 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Deck' $floorItems['Plaza Deck'] = i - TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, + TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106' $floorItems['106'] = i - TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, + TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, - 112,130,97,130,97,168,175,168,175,131,146,131, + 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '119' $floorItems['119'] = i - TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, + TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) TkcLine.new(w,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) @@ -798,321 +798,321 @@ end def floor_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, - 800,222,800,168,748,168, + 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '238' $floorItems['238'] = i - TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, + TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '237' $floorItems['237'] = i - TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, + TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, - 715,205,755,205,755,190,724,190,724,187, + 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '246' $floorItems['246'] = i - TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, + TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, + i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '247' $floorItems['247'] = i - TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, + TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, - 559,274,482,274,482,278,396,278,396,274,232,274, + 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '202' $floorItems['202'] = i - TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, + TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, - 156,196,176,196,176,228, + 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '206' $floorItems['206'] = i - TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, + TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, + i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '212' $floorItems['212'] = i - TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, + TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, + i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '245' $floorItems['245'] = i - TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, + TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, + i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '244' $floorItems['244'] = i - TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, + TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, + i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '243' $floorItems['243'] = i - TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, + TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, + i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '242' $floorItems['242'] = i - TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, + TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, + i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Barbecue Deck' $floorItems['Barbecue Deck'] = i - TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, + TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, + i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '240' $floorItems['240'] = i - TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, + TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, + i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '241' $floorItems['241'] = i - TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, + TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, + i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '239' $floorItems['239'] = i - TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, + TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, + i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '248' $floorItems['248'] = i - TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, + TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, + i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '236' $floorItems['236'] = i - TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, + TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, + i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '235' $floorItems['235'] = i - TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, + TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, - 572,143,579,143,579,185,626,185, + 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '234' $floorItems['234'] = i - TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, + TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, - 578,185,527,185,527,131,557,131, + 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '233' $floorItems['233'] = i - TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, + TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '230' $floorItems['230'] = i - TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, + TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, + i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '232' $floorItems['232'] = i - TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, + TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, + i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '229' $floorItems['229'] = i - TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, + TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, + i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '227' $floorItems['227'] = i - TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, + TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, + i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '228' $floorItems['228'] = i - TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, + TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, + i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '226' $floorItems['226'] = i - TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, + TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, + i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '225' $floorItems['225'] = i - TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, + TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, + i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '224' $floorItems['224'] = i - TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, + TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, + i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '223' $floorItems['223'] = i - TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, + TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, + i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '222' $floorItems['222'] = i - TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, + TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, + i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '221' $floorItems['221'] = i - TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, + TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, + i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '204' $floorItems['204'] = i - TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, + TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, + i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '205' $floorItems['205'] = i - TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, + TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '207' $floorItems['207'] = i - TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, + TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, + i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '208' $floorItems['208'] = i - TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, + TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, + i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '209' $floorItems['209'] = i - TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, + TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, + i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217' $floorItems['217'] = i - TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, + TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, + i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217A' $floorItems['217A'] = i - TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, + TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, + i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '216' $floorItems['216'] = i - TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, + TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, + i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '215' $floorItems['215'] = i - TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, + TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, + i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '214' $floorItems['214'] = i - TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, + TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, + i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '213' $floorItems['213'] = i - TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, + TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, + i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '210' $floorItems['210'] = i - TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, + TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, + i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '211' $floorItems['211'] = i - TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, + TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, + i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '203' $floorItems['203'] = i - TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, + TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, - 154,198,154,192,109,192,109,169,99,169, + 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '220' $floorItems['220'] = i - TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, + TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Priv Lift2' $floorItems['Priv Lift2'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Pub Lift 2' $floorItems['Pub Lift 2'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '218' $floorItems['218'] = i - TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, + TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '219' $floorItems['219'] = i - TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, + TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '201' $floorItems['201'] = i - TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) TkcLine.new(w,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) @@ -1283,206 +1283,206 @@ def floor_fg3(w,color) 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316' $floorItems['316'] = i - TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, + TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, + i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '309' $floorItems['309'] = i - TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, + TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, + i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '308' $floorItems['308'] = i - TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, + TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, + i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '307' $floorItems['307'] = i - TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, + TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, + i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '305' $floorItems['305'] = i - TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, + TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324B' $floorItems['324B'] = i - TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, + TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, + i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324A' $floorItems['324A'] = i - TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, + TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, + i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '320' $floorItems['320'] = i - TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, + TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, + i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '310' $floorItems['310'] = i - TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, + TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, + i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '312' $floorItems['312'] = i - TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, + TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, + i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '313' $floorItems['313'] = i - TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, + TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, + i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '314' $floorItems['314'] = i - TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, + TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, + i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '315' $floorItems['315'] = i - TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, + TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, + i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316B' $floorItems['316B'] = i - TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, + TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, + i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316A' $floorItems['316A'] = i - TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, + TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, - 174,198,174,226,101,226,101,179,97,179, + 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '319' $floorItems['319'] = i - TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, + TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, + i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '311' $floorItems['311'] = i - TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, + TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '318' $floorItems['318'] = i - TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, + TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '317' $floorItems['317'] = i - TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, + TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, + i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '323' $floorItems['323'] = i - TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, + TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, + i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '325' $floorItems['325'] = i - TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, + TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, + i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '321' $floorItems['321'] = i - TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, + TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, - 264,181,264,135,314,135, + 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '322' $floorItems['322'] = i - TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, + TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Pub Lift3' $floorItems['Pub Lift3'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Priv Lift3' $floorItems['Priv Lift3'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, + i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '303' $floorItems['303'] = i - TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, + TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, - 244,230,244,221,252,221,252,203, + 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324' $floorItems['324'] = i - TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, + TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, + i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '304' $floorItems['304'] = i - TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, + TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '301' $floorItems['301'] = i - TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, + i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '327' $floorItems['327'] = i - TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, + TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, + i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '326' $floorItems['326'] = i - TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, + TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, - 375,274,397,274,397,248,339,248,339,242,308,242, + 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '302' $floorItems['302'] = i - TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, + TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, - 107,248,160,248,160,301,107,301,107,275,70,275, + 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '306' $floorItems['306'] = i - TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, + TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) TkcLine.new(w,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) @@ -1577,7 +1577,7 @@ end # toplevel widget if defined?($floor_demo) && $floor_demo - $floor_demo.destroy + $floor_demo.destroy $floor_demo = nil end @@ -1593,7 +1593,7 @@ $floor_demo = TkToplevel.new {|w| base_frame = TkFrame.new($floor_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', 'text'=>"This window contains a canvas widget showing the floorplan of Digital Equipment Corporation's Western Research Laboratory. It has three levels. At any given time one of the levels is active, meaning that you can see its room structure. To activate a level, click the left mouse button anywhere on it. As the mouse moves over the active level, the room under the mouse lights up and its room number appears in the \"Room:\" entry. You can also type a room number in the entry and the room will light up."){ pack('side'=>'top') } @@ -1616,18 +1616,18 @@ $floor_buttons = TkFrame.new(base_frame) {|frame| } $floor_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# +# $floorLabels = {} $floorItems = {} -# canvas +# canvas if $tk_version =~ /^4\.[01]/ $floor_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken', 'highlightthickness'=>2) - $floor_canvas = TkCanvas.new($floor_canvas_frame, - 'width'=>900, 'height'=>500, 'borderwidth'=>0, + $floor_canvas = TkCanvas.new($floor_canvas_frame, + 'width'=>900, 'height'=>500, 'borderwidth'=>0, 'highlightthickness'=>0) {|c| - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}){|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) pack('side'=>'bottom', 'fill'=>'x') @@ -1648,20 +1648,20 @@ else v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical') TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1| - $floor_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, - 'borderwidth'=>0, + $floor_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, + 'borderwidth'=>0, 'highlightthickness'=>0) { xscrollcommand(proc{|first,last| h.set first,last}) yscrollcommand(proc{|first,last| v.set first,last}) pack('expand'=>'yes', 'fill'=>'both') } - grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') } - v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) @@ -1678,7 +1678,7 @@ end # Create an entry for displaying and typing in current room. $currentRoom = TkVariable.new -$floor_entry = TkEntry.new($floor_canvas, 'width'=>10, 'relief'=>'sunken', +$floor_entry = TkEntry.new($floor_canvas, 'width'=>10, 'relief'=>'sunken', 'bd'=>2, 'textvariable'=>$currentRoom) # Choose colors, then fill in the floorplan. @@ -1715,7 +1715,7 @@ $floor_canvas.itembind('floor3', '1', proc{floorDisplay $floor_canvas,3}) $floor_canvas.itembind('room', 'Enter', proc{newRoom $floor_canvas}) $floor_canvas.itembind('room', 'Leave', proc{$currentRoom.value = ''}) $floor_canvas.bind('2', proc{|x,y| $floor_canvas.scan_mark x,y}, '%x %y') -$floor_canvas.bind('B2-Motion', +$floor_canvas.bind('B2-Motion', proc{|x,y| $floor_canvas.scan_dragto x,y}, '%x %y') $floor_canvas.bind('Destroy', proc{$currentRoom.unset}) $currentRoom.value = '' diff --git a/ext/tk/sample/demos-en/floor2.rb b/ext/tk/sample/demos-en/floor2.rb index 88b07aeee4..3bfa89a920 100644 --- a/ext/tk/sample/demos-en/floor2.rb +++ b/ext/tk/sample/demos-en/floor2.rb @@ -21,7 +21,7 @@ def floorDisplay2(w,active) w.delete('all') $activeFloor2 = active - # First go through the three floors, displaying the backgrounds for + # First go through the three floors, displaying the backgrounds for # each floor. floor2_bg1(w,$floor2_colors['bg1'],$floor2_colors['outline1']) @@ -32,12 +32,12 @@ def floorDisplay2(w,active) w.raise("floor#{active}") - # Create a dummy item just to mark this point in the display list, + # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. w.create(TkcRectangle,0,100,1,101,'fill'=>'','outline'=>'','tags'=>'marker') - # Add the walls and labels for the active floor, along with + # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. @@ -302,7 +302,7 @@ def floor2_bg3(w,fill,outline) w.create(TkcLine,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) - w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, + w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end @@ -316,316 +316,316 @@ end # color - Color to use for drawing foreground information. def floor2_fg1(w,color) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '101' $floorItems2['101'] = i - w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Pub Lift1' $floorItems2['Pub Lift1'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Priv Lift1' $floorItems2['Priv Lift1'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, + i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '110' $floorItems2['110'] = i - w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, + w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, + i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '109' $floorItems2['109'] = i - w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, + w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, + i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '111' $floorItems2['111'] = i - w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, + w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, + i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117B' $floorItems2['117B'] = i - w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, + w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, + i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '112' $floorItems2['112'] = i - w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, + w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, + i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '113' $floorItems2['113'] = i - w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, + w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, + i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117A' $floorItems2['117A'] = i - w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, + w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, + i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117' $floorItems2['117'] = i - w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, + w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, + i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '114' $floorItems2['114'] = i - w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, + w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, + i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '115' $floorItems2['115'] = i - w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, + w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, + i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '116' $floorItems2['116'] = i - w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, + w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, + i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '118' $floorItems2['118'] = i - w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, + w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, - 163,91,163,112,149,112,149,128, + 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '120' $floorItems2['120'] = i - w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, + w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, - 156,192,156,169,175,169,175,246,79,246, + 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '122' $floorItems2['122'] = i - w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, + w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, + i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '121' $floorItems2['121'] = i - w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, + w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, + i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106A' $floorItems2['106A'] = i - w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, + w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, + i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '105' $floorItems2['105'] = i - w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, + w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, + i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106B' $floorItems2['106B'] = i - w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, + w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, + i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '104' $floorItems2['104'] = i - w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, + w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, + i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '108' $floorItems2['108'] = i - w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, + w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, + i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '107' $floorItems2['107'] = i - w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, + w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, + i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Smoking' $floorItems2['Smoking'] = i - w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, + w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, + i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '123' $floorItems2['123'] = i - w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, + w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, + i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '103' $floorItems2['103'] = i - w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, + w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, + i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '124' $floorItems2['124'] = i - w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, + w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, + i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '125' $floorItems2['125'] = i - w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, + w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, + i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '126' $floorItems2['126'] = i - w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, + w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, - 486,253,486,239,474,239,474,209, + 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '127' $floorItems2['127'] = i - w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, + w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, - 490,188,490,204,476,204,476,164, + 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'MShower' $floorItems2['MShower'] = i - w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, + w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, + i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Closet' $floorItems2['Closet'] = i - w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, + w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, + i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'WShower' $floorItems2['WShower'] = i - w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, + w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, - 515,174,503,174,503,161,486,161, + 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '130' $floorItems2['130'] = i - w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, + w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, - 393,309,300,309,300,248,308,248, + 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '102' $floorItems2['102'] = i - w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, + w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, + i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '128' $floorItems2['128'] = i - w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, + w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '129' $floorItems2['129'] = i - w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, + w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, - 642,389,561,389,561,277,696,277, + 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '133' $floorItems2['133'] = i - w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, + w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, + i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '132' $floorItems2['132'] = i - w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, + w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, + i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '134' $floorItems2['134'] = i - w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, + w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, + i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '135' $floorItems2['135'] = i - w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, + w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, - 331,347,332,351,334,354,336,357,341,359, + 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Ramona Stair' $floorItems2['Ramona Stair'] = i - w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, + w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, - 122,28,123,32,123,68,220,68,220,87,90,87,90,23, + 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'University Stair' $floorItems2['University Stair'] = i - w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, + w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, - 227,13,223,17,221,22,220,34,260,34, + 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Stair' $floorItems2['Plaza Stair'] = i - w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, + w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, - 386,104,386,128,220,128, + 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Deck' $floorItems2['Plaza Deck'] = i - w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, + w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106' $floorItems2['106'] = i - w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, + w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, - 112,130,97,130,97,168,175,168,175,131,146,131, + 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '119' $floorItems2['119'] = i - w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, + w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) w.create(TkcLine,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) @@ -798,321 +798,321 @@ end def floor2_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, - 800,222,800,168,748,168, + 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '238' $floorItems2['238'] = i - w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, + w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '237' $floorItems2['237'] = i - w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, + w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, - 715,205,755,205,755,190,724,190,724,187, + 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '246' $floorItems2['246'] = i - w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, + w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, + i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '247' $floorItems2['247'] = i - w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, + w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, - 559,274,482,274,482,278,396,278,396,274,232,274, + 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '202' $floorItems2['202'] = i - w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, + w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, - 156,196,176,196,176,228, + 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '206' $floorItems2['206'] = i - w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, + w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, + i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '212' $floorItems2['212'] = i - w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, + w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, + i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '245' $floorItems2['245'] = i - w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, + w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, + i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '244' $floorItems2['244'] = i - w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, + w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, + i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '243' $floorItems2['243'] = i - w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, + w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, + i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '242' $floorItems2['242'] = i - w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, + w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, + i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Barbecue Deck' $floorItems2['Barbecue Deck'] = i - w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, + w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, + i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '240' $floorItems2['240'] = i - w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, + w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, + i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '241' $floorItems2['241'] = i - w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, + w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, + i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '239' $floorItems2['239'] = i - w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, + w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, + i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '248' $floorItems2['248'] = i - w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, + w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, + i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '236' $floorItems2['236'] = i - w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, + w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, + i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '235' $floorItems2['235'] = i - w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, + w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, - 572,143,579,143,579,185,626,185, + 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '234' $floorItems2['234'] = i - w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, + w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, - 578,185,527,185,527,131,557,131, + 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '233' $floorItems2['233'] = i - w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, + w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '230' $floorItems2['230'] = i - w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, + w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, + i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '232' $floorItems2['232'] = i - w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, + w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, + i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '229' $floorItems2['229'] = i - w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, + w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, + i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '227' $floorItems2['227'] = i - w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, + w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, + i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '228' $floorItems2['228'] = i - w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, + w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, + i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '226' $floorItems2['226'] = i - w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, + w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, + i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '225' $floorItems2['225'] = i - w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, + w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, + i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '224' $floorItems2['224'] = i - w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, + w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, + i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '223' $floorItems2['223'] = i - w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, + w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, + i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '222' $floorItems2['222'] = i - w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, + w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, + i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '221' $floorItems2['221'] = i - w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, + w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, + i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '204' $floorItems2['204'] = i - w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, + w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, + i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '205' $floorItems2['205'] = i - w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, + w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '207' $floorItems2['207'] = i - w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, + w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, + i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '208' $floorItems2['208'] = i - w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, + w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, + i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '209' $floorItems2['209'] = i - w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, + w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, + i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217' $floorItems2['217'] = i - w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, + w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, + i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217A' $floorItems2['217A'] = i - w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, + w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, + i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '216' $floorItems2['216'] = i - w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, + w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, + i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '215' $floorItems2['215'] = i - w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, + w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, + i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '214' $floorItems2['214'] = i - w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, + w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, + i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '213' $floorItems2['213'] = i - w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, + w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, + i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '210' $floorItems2['210'] = i - w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, + w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, + i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '211' $floorItems2['211'] = i - w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, + w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, + i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '203' $floorItems2['203'] = i - w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, + w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, - 154,198,154,192,109,192,109,169,99,169, + 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '220' $floorItems2['220'] = i - w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, + w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Priv Lift2' $floorItems2['Priv Lift2'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Pub Lift 2' $floorItems2['Pub Lift 2'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '218' $floorItems2['218'] = i - w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, + w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '219' $floorItems2['219'] = i - w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, + w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '201' $floorItems2['201'] = i - w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) w.create(TkcLine,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) @@ -1283,206 +1283,206 @@ def floor2_fg3(w,color) 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316' $floorItems2['316'] = i - w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, + w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, + i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '309' $floorItems2['309'] = i - w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, + w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, + i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '308' $floorItems2['308'] = i - w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, + w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, + i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '307' $floorItems2['307'] = i - w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, + w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, + i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '305' $floorItems2['305'] = i - w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, + w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324B' $floorItems2['324B'] = i - w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, + w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, + i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324A' $floorItems2['324A'] = i - w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, + w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, + i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '320' $floorItems2['320'] = i - w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, + w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, + i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '310' $floorItems2['310'] = i - w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, + w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, + i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '312' $floorItems2['312'] = i - w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, + w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, + i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '313' $floorItems2['313'] = i - w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, + w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, + i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '314' $floorItems2['314'] = i - w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, + w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, + i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '315' $floorItems2['315'] = i - w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, + w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, + i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316B' $floorItems2['316B'] = i - w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, + w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, + i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316A' $floorItems2['316A'] = i - w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, + w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, - 174,198,174,226,101,226,101,179,97,179, + 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '319' $floorItems2['319'] = i - w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, + w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, + i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '311' $floorItems2['311'] = i - w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, + w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '318' $floorItems2['318'] = i - w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, + w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '317' $floorItems2['317'] = i - w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, + w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, + i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '323' $floorItems2['323'] = i - w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, + w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, + i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '325' $floorItems2['325'] = i - w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, + w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, + i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '321' $floorItems2['321'] = i - w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, + w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, - 264,181,264,135,314,135, + 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '322' $floorItems2['322'] = i - w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, + w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Pub Lift3' $floorItems2['Pub Lift3'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Priv Lift3' $floorItems2['Priv Lift3'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, + i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '303' $floorItems2['303'] = i - w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, + w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, - 244,230,244,221,252,221,252,203, + 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324' $floorItems2['324'] = i - w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, + w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, + i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '304' $floorItems2['304'] = i - w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, + w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '301' $floorItems2['301'] = i - w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, + i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '327' $floorItems2['327'] = i - w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, + w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, + i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '326' $floorItems2['326'] = i - w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, + w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, - 375,274,397,274,397,248,339,248,339,242,308,242, + 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '302' $floorItems2['302'] = i - w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, + w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, - 107,248,160,248,160,301,107,301,107,275,70,275, + 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '306' $floorItems2['306'] = i - w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, + w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) @@ -1577,7 +1577,7 @@ end # toplevel widget if defined?($floor2_demo) && $floor2_demo - $floor2_demo.destroy + $floor2_demo.destroy $floor2_demo = nil end @@ -1593,7 +1593,7 @@ $floor2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($floor2_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', 'text'=>"This window contains a canvas widget showing the floorplan of Digital Equipment Corporation's Western Research Laboratory. It has three levels. At any given time one of the levels is active, meaning that you can see its room structure. To activate a level, click the left mouse button anywhere on it. As the mouse moves over the active level, the room under the mouse lights up and its room number appears in the \"Room:\" entry. You can also type a room number in the entry and the room will light up."){ pack('side'=>'top') } @@ -1616,18 +1616,18 @@ $floor2_buttons = TkFrame.new(base_frame) {|frame| } $floor2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# +# $floorLabels2 = {} $floorItems2 = {} -# canvas +# canvas if $tk_version =~ /^4\.[01]/ $floor2_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken', 'highlightthickness'=>2) - $floor2_canvas = TkCanvas.new($floor2_canvas_frame, - 'width'=>900, 'height'=>500, 'borderwidth'=>0, + $floor2_canvas = TkCanvas.new($floor2_canvas_frame, + 'width'=>900, 'height'=>500, 'borderwidth'=>0, 'highlightthickness'=>0) {|c| - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}){|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) pack('side'=>'bottom', 'fill'=>'x') @@ -1648,20 +1648,20 @@ else v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical') TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1| - $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, - 'borderwidth'=>0, + $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, + 'borderwidth'=>0, 'highlightthickness'=>0) { xscrollcommand(proc{|first,last| h.set first,last}) yscrollcommand(proc{|first,last| v.set first,last}) pack('expand'=>'yes', 'fill'=>'both') } - grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') } - v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) @@ -1678,7 +1678,7 @@ end # Create an entry for displaying and typing in current room. $currentRoom2 = TkVariable.new -$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken', +$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken', 'bd'=>2, 'textvariable'=>$currentRoom2) # Choose colors, then fill in the floorplan. @@ -1715,7 +1715,7 @@ $floor2_canvas.itembind('floor3', '1', proc{floorDisplay2 $floor2_canvas,3}) $floor2_canvas.itembind('room', 'Enter', proc{newRoom2 $floor2_canvas}) $floor2_canvas.itembind('room', 'Leave', proc{$currentRoom2.value = ''}) $floor2_canvas.bind('2', proc{|x,y| $floor2_canvas.scan_mark x,y}, '%x %y') -$floor2_canvas.bind('B2-Motion', +$floor2_canvas.bind('B2-Motion', proc{|x,y| $floor2_canvas.scan_dragto x,y}, '%x %y') $floor2_canvas.bind('Destroy', proc{$currentRoom2.unset}) $currentRoom2.value = '' diff --git a/ext/tk/sample/demos-en/form.rb b/ext/tk/sample/demos-en/form.rb index 3119752b1c..abb3e0e10e 100644 --- a/ext/tk/sample/demos-en/form.rb +++ b/ext/tk/sample/demos-en/form.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($form_demo) && $form_demo - $form_demo.destroy + $form_demo.destroy $form_demo = nil end @@ -43,7 +43,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# entry +# entry form_data = [] (1..5).each{|i| f = TkFrame.new(base_frame, 'bd'=>2) @@ -54,7 +54,7 @@ form_data = [] form_data[i] = {'frame'=>f, 'entry'=>e, 'label'=>l} } -# +# form_data[1]['label'].text('Name:') form_data[2]['label'].text('Address:') form_data[5]['label'].text('Phone:') diff --git a/ext/tk/sample/demos-en/goldberg.rb b/ext/tk/sample/demos-en/goldberg.rb index c6fa37c09c..d3956ef78c 100644 --- a/ext/tk/sample/demos-en/goldberg.rb +++ b/ext/tk/sample/demos-en/goldberg.rb @@ -43,7 +43,7 @@ #>># lots of canvas create and move calls. if defined?($goldberg_demo) && $goldberg_demo - $goldberg_demo.destroy + $goldberg_demo.destroy $goldberg_demo = nil end @@ -101,7 +101,7 @@ class TkGoldberg_Demo @S['pause'] = TkVariable.new @S['details'] = TkVariable.new(true) - @S['mode'] = TkVariable.new(:MSTART, :symbol) + @S['mode'] = TkVariable.new(:MSTART, :symbol) # :MSTART, :MGO, :MPAUSE, :MSSTEP, :MBSTEP, :MDONE, :MDEBUG # 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 @@ -132,19 +132,19 @@ class TkGoldberg_Demo @XY = {} @XY6 = { - '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], + '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], '-5'=>[340, 190], '-6'=>[349, 177], '-7'=>[366, 177], '-8'=>[380, 176], - '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], - '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], - '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], - '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], - '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], - '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], - '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], - '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], - '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], - '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], - '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], + '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], + '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], + '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], + '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], + '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], + '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], + '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], + '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], + '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], + '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], + '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], '13,15'=>[376, 410], '13,16'=>[360, 403] } @@ -161,11 +161,11 @@ class TkGoldberg_Demo def do_display() @ctrl = TkFrame.new(@parent, :relief=>:ridge, :bd=>2, :padx=>5, :pady=>5) - @screen = TkFrame.new(@parent, :bd=>2, - :relief=>:raised).pack(:side=>:left, :fill=>:both, + @screen = TkFrame.new(@parent, :bd=>2, + :relief=>:raised).pack(:side=>:left, :fill=>:both, :expand=>true) - @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, + @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, :bg=>@C['bg'], :highlightthickness=>0){ scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up yview_moveto(0.05) @@ -204,8 +204,8 @@ class TkGoldberg_Demo command proc{showCode 'goldberg'} }.pack('side'=>'left', 'padx'=>5) - # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, - @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, :bg=>@C['bg'], :activebackground=>@C['bg']) @show.pack('side'=>'left') frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) @@ -214,34 +214,34 @@ class TkGoldberg_Demo end def do_ctrl_frame - @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, + @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, :command=>proc{do_button(0)}) if font = @start['font'] @start.font(font.weight('bold')) end - @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, - :command=>proc{do_button(1)}, :relief=>:raised, + @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, + :command=>proc{do_button(1)}, :relief=>:raised, :variable=>@S['pause']) - @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, + @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, :command=>proc{do_button(2)}) - @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, + @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, :command=>proc{do_button(4)}) - @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, + @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, :command=>proc{do_button(3)}) @details = TkFrame.new(@parent, :bd=>2, :relief=>:ridge) - @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, + @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, :relief=>:raised, :variable=>@S['details']) - @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], + @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], :justify=>:center) - @speed_scale = TkScale.new(@parent, :orient=>:horizontal, - :from=>1, :to=>10, :font=>font, - :variable=>@S['speed'], :bd=>2, + @speed_scale = TkScale.new(@parent, :orient=>:horizontal, + :from=>1, :to=>10, :font=>font, + :variable=>@S['speed'], :bd=>2, :relief=>:ridge, :showvalue=>false) - @about = TkButton.new(@parent, :text=>'About', + @about = TkButton.new(@parent, :text=>'About', :command=>proc{about}, :font=>font) Tk.grid(@start, :in=>@ctrl, :row=>0, :sticky=>:ew) @@ -269,17 +269,17 @@ class TkGoldberg_Demo def do_detail_frame @f_details = TkFrame.new(@details) - @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], + @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], :bd=>1, :relief=>:solid, :bg=>'white') Tk.grid(@label, '-', '-', '-', :sticky=>:ew, :row=>0) idx = 1 loop { break unless respond_to?("move#{idx}") - l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, + l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, :width=>2, :bd=>1, :relief=>:solid, :bg=>'white') @STEP[idx] = 0 - ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), + ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), :width=>5, :bd=>1, :relief=>:solid, :bg=>'white') row = (idx + 1)/2 col = ((idx + 1) & 1) * 2 @@ -383,7 +383,7 @@ class TkGoldberg_Demo who = who.to_i n = send("move#{who}") if (n & 1).nonzero? # This guy still alive - alive << who + alive << who end if (n & 2).nonzero? # Next guy is active alive << (who + 1) @@ -416,10 +416,10 @@ class TkGoldberg_Demo # START HERE! banner def draw0 color = @C['0'] - TkcText.new(@canvas, [579, 119], :text=>'START HERE!', - :fill=>color, :anchor=>:w, + TkcText.new(@canvas, [579, 119], :text=>'START HERE!', + :fill=>color, :anchor=>:w, :tag=>'I0', :font=>['Times Roman', 12, :italic, :bold]) - TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, + TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, :width=>5, :arrow=>:last, :arrowshape=>[18, 18, 5]) @canvas.itembind('I0', '1'){ start } end @@ -433,7 +433,7 @@ class TkGoldberg_Demo end pos = [ - [673, 119], [678, 119], [683, 119], [688, 119], + [673, 119], [678, 119], [683, 119], [688, 119], [693, 119], [688, 119], [683, 119], [678, 119] ] step = step % pos.length @@ -445,15 +445,15 @@ class TkGoldberg_Demo def draw1 color = @C['1a'] color2 = @C['1b'] - TkcPolygon.new(@canvas, - [ 844, 133, 800, 133, 800, 346, 820, 346, - 820, 168, 844, 168, 844, 133 ], + TkcPolygon.new(@canvas, + [ 844, 133, 800, 133, 800, 346, 820, 346, + 820, 168, 844, 168, 844, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcPolygon.new(@canvas, - [ 771, 133, 685, 133, 685, 168, 751, 168, - 751, 346, 771, 346, 771, 133 ], + TkcPolygon.new(@canvas, + [ 771, 133, 685, 133, 685, 168, 751, 168, + 751, 346, 771, 346, 771, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcOval.new(@canvas, box(812, 122, 9), + TkcOval.new(@canvas, box(812, 122, 9), :tag=>'I1', :fill=>color2, :outline=>'') @canvas.itembind('I1', '1'){ start } @@ -462,9 +462,9 @@ class TkGoldberg_Demo def move1(step = nil) step = get_step(1, step) pos = [ - [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], - [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], - [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], + [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], + [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], + [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], [-100, -100] ] return 0 if step >= pos.length @@ -480,40 +480,40 @@ class TkGoldberg_Demo color = @C['2'] # Fulcrum - TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], + TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], :fill=>@C['fg'], :outline=>@C['fg']) # Strike box - TkcRectangle.new(@canvas, [628, 335, 660, 383], + TkcRectangle.new(@canvas, [628, 335, 660, 383], :fill=>'', :outline=>@C['fg']) (0..2).each{|y| yy = 335 + y*16 - TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) - TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) } # Lever - TkcLine.new(@canvas, [702, 366, 798, 366], + TkcLine.new(@canvas, [702, 366, 798, 366], :fill=>@C['fg'], :width=>6, :tag=>'I2_0') # R strap - TkcLine.new(@canvas, [712, 363, 712, 355], + TkcLine.new(@canvas, [712, 363, 712, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_1') # L strap - TkcLine.new(@canvas, [705, 363, 705, 355], + TkcLine.new(@canvas, [705, 363, 705, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_2') # Match stick - TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], + TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], :fill=>@C['fg'], :width=>3, :tag=>'I2_3') # Match head - TkcPolygon.new(@canvas, - [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, - 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], + TkcPolygon.new(@canvas, + [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, + 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], :fill=>color, :outline=>color, :tag=>'I2_4') end @@ -523,15 +523,15 @@ class TkGoldberg_Demo stages = [0, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 1] xy = [] xy[0] = [ - 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, + 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, 662, 318, 662, 328, 671, 336 ] xy[1] = [ - 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, + 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, 661, 327, 671, 335 ] xy[2] = [ - 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, + 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, 666, 309, 660, 324, 672, 336 ] @@ -542,7 +542,7 @@ class TkGoldberg_Demo if step == 0 # Rotate the match beta = 20 - + ox, oy = anchor('I2_0', :s) # Where to pivot i = 0 @@ -567,23 +567,23 @@ class TkGoldberg_Demo xy = [ [602, 296], [577, 174], [518, 174] ] xy.each{|x, y| # 3 Pulleys - TkcOval.new(@canvas, box(x, y, 13), + TkcOval.new(@canvas, box(x, y, 13), :fill=>color, :outline=>@C['fg'], :width=>3) TkcOval.new(@canvas, box(x, y, 2), :fill=>@C['fg'], :outline=>@C['fg']) } # Wall to flame - TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', + TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', :width=>3, :fill=>@C['fg'], :smooth=>true) # Flame to pulley 1 - TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', + TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', :width=>3, :fill=>@C['fg'], :smooth=>true) - TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', + TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', :width=>3, :fill=>@C['fg'], :smooth=>true) # Pulley 1 half way to 2 - TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', + TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', :width=>3, :fill=>@C['fg']) # Pulley 1 other half to 2 @@ -593,26 +593,26 @@ class TkGoldberg_Demo TkcLine.new(@canvas, [577, 161, 518, 161], :width=>3, :fill=>@C['fg']) # Down to weight - TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', + TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', :width=>3, :fill=>@C['fg']) # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle x1, y1, x2, y2 = [515, 207, 495, 207] - TkcOval.new(@canvas, box(x1, y1, 6), + TkcOval.new(@canvas, box(x1, y1, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcOval.new(@canvas, box(x2, y2, 6), + TkcOval.new(@canvas, box(x2, y2, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, + TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, :tag=>'I3_', :fill=>color2, :outline=>color2) - - TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), + + TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), :smooth=>true, :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcLine.new(@canvas, [500, 217, 511, 217], + TkcLine.new(@canvas, [500, 217, 511, 217], :tag=>'I3_', :fill=>color2, :width=>10) # Bottom weight target - TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], + TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], :tag=>'I3__', :fill=>@C['fg'], :joinstyle=>:miter, :width=>10) end @@ -655,7 +655,7 @@ class TkGoldberg_Demo } # Swing gate - TkcLine.new(@canvas, [518, 464, 518, 428], + TkcLine.new(@canvas, [518, 464, 518, 428], :tag=>'I4', :fill=>color, :width=>1) end @@ -682,7 +682,7 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3) xy = [ - 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, + 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, 575, 452, 574, 454, 566, 456, 554, 456, 545, 456, 537, 454, 530, 452 ] TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_0'], :fill=>color) @@ -692,7 +692,7 @@ class TkGoldberg_Demo xy = box(540, 446, 2) # Eye xy = [540, 444, 541, 445, 541, 447, 540, 448, 538, 447, 538, 445] - TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], + TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], :outline=>'', :smooth=>true) xy = [538, 454, 535, 461] # Front leg @@ -712,9 +712,9 @@ class TkGoldberg_Demo step = get_step(5, step) pos = [ - [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], - [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], - [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], + [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], + [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], + [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], [422, 274, -30], [422, 260.5, -30, :x], [422.5, 248.5, -28], [425, 237] ] @@ -735,16 +735,16 @@ class TkGoldberg_Demo color = @C['6'] xy = [324, 130, 391, 204] # Ball holder xy = round_rect(xy, 10) - TkcPolygon.new(@canvas, xy, :smooth=>true, + TkcPolygon.new(@canvas, xy, :smooth=>true, :outline=>@C['fg'], :width=>3, :fill=>color) xy = [339, 204, 376, 253] # Below the ball holder - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>color, :tag=>'I6c') xy = box(346, 339, 28) TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') # Roter - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>80, :extent=>205) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>-41, :extent=>85) xy = box(346, 339, 15) # Center of rotor @@ -759,10 +759,10 @@ class TkGoldberg_Demo TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'') xy = [ - 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, + 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, 352, 403, 352, 366 ] - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2) # Below rotor TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2) xy = box(275, 342, 7) # On/off rotor @@ -787,7 +787,7 @@ class TkGoldberg_Demo loc = -i color = colors[i] x, y = @XY6["#{loc}"] - TkcOval.new(@canvas, box(x, y, 5), + TkcOval.new(@canvas, box(x, y, 5), :fill=>color, :outline=>color, :tag=>"I6_b#{i}") } draw6a(12) # The wheel @@ -813,7 +813,7 @@ class TkGoldberg_Demo @canvas.move('I6_', -7, 0) if step == 1 # Poke a hole xy = [348, 226, 365, 240] - TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), + TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), :outline=>'') end return 1 @@ -853,24 +853,24 @@ class TkGoldberg_Demo def draw7 color = @C['7'] xy = [198, 306, 277, 374] # Box - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :fill=>color, :tag=>'I7z') @canvas.lower('I7z') xy = [275, 343, 230, 349] - TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, + TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, :arrowshape=>[23, 23, 8], :width=>6) xy = [225, 324] # On button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 323] # On text font = ['Times Roman', 8] - TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, :fill=>@C['fg'], :font=>font) xy = [225, 350] # Off button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 349] # Off text - TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, :fill=>@C['fg'], :font=>font) end @@ -915,7 +915,7 @@ class TkGoldberg_Demo xy = [280, 209, 296, 248] TkcOval.new(@canvas, xy, :outline=>color, :fill=>color) xy = [ - 288, 249, 252, 249, 260, 240, 280, 234, + 288, 249, 252, 249, 260, 240, 280, 234, 296, 234, 316, 240, 324, 249, 288, 249 ] TkcPolygon.new(@canvas, xy, :fill=>color, :smooth=>true) @@ -924,16 +924,16 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color) xy = [255, 206, 265, 234] # Fan blades - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 176, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 206, 265, 220] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') xy = [255, 190, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') end @@ -958,17 +958,17 @@ class TkGoldberg_Demo color = @C['10a'] color2 = @C['10b'] xy = [191, 230, 233, 230, 233, 178, 191, 178] # Sail - TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], :tag=>'I10') xy = box(209, 204, 31) # Front - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = box(249, 204, 31) # Back - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = [200, 171, 200, 249] # Mast @@ -988,10 +988,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(239, 262, 17) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>95, :extent=>103) xy = box(76, 266, 21) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>190) end @@ -999,9 +999,9 @@ class TkGoldberg_Demo step = get_step(10, step) pos = [ - [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], - [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], - [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], + [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], + [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], + [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], [116, 212], [111, 212] ] @@ -1028,21 +1028,21 @@ class TkGoldberg_Demo xy = [55, 504, 55, 591] # Bottom right side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(71, 460, 48) # Outer loop - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>110, :extent=>-290, :tag=>'I11i') xy = box(71, 460, 16) # Inner loop - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', :width=>3, :tag=>'I11i') TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['bg'], :width=>3) xy = [23, 264, 23, 591] # Left side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(1, 266, 23) # Top left curve - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>90) xy = box(75, 235, 9) # The ball - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', :width=>3, :tag=>'I11') end @@ -1050,8 +1050,8 @@ class TkGoldberg_Demo step = get_step(11, step) pos = [ - [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], - [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], + [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], + [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], [100, 437], [65, 423], [-100, -100], [38, 505], [38, 527, :x], [38, 591] ] @@ -1065,11 +1065,11 @@ class TkGoldberg_Demo # Hand def draw12 xy = [ - 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, + 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, 60, 590, 60, 610, 60, 610 ] xy.concat([60, 610, 65, 620, 60, 631]) # Thumb - xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, + xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, 56, 669, 50, 669, 50, 662, 50, 637]) y0 = 637 # Bumps for fingers @@ -1079,7 +1079,7 @@ class TkGoldberg_Demo x2 = x - 10 xy << x << y0 << x1 << y1 << x2 << y0 } - TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], :smooth=>true, :tag=>'I12', :width=>3) end @@ -1103,25 +1103,25 @@ class TkGoldberg_Demo ] radii = [2, 9, 9, 8, 5, 5, 2] - round_poly(@canvas, xy, radii, :width=>3, + round_poly(@canvas, xy, radii, :width=>3, :outline=>@C['fg'], :fill=>color) - round_poly(@canvas, xy2, radii, :width=>3, + round_poly(@canvas, xy2, radii, :width=>3, :outline=>@C['fg'], :fill=>color) xy = [56, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13') xy = [809, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13R') xy = [112, 687] # Label - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [762, 687] - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [138, 663, 148, 636, 178, 636] # Paper guide @@ -1129,7 +1129,7 @@ class TkGoldberg_Demo xy = [732, 663, 722, 636, 692, 636] TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3) - sine([149, 688, 720, 688], 5, 15, + sine([149, 688, 720, 688], 5, 15, :tag=>'I13_s', :fill=>@C['fg'], :width=>3) end @@ -1159,17 +1159,17 @@ class TkGoldberg_Demo def draw14 color = @C['14'] xy = [102, 661, 113, 632, 130, 618] # Left paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_0') xy = [148, 629, 125, 640, 124, 662] # Right paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_1') draw14a('L') xy = [ 768.0, 662.5, 767.991316225, 662.433786215, 767.926187912, 662.396880171 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_0') @canvas.lower('I14R_0') # NB. these numbers are VERY sensitive, you must start with final size @@ -1177,7 +1177,7 @@ class TkGoldberg_Demo xy = [ 745.947897349, 662.428358855, 745.997829056, 662.452239237, 746.0, 662.5 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_1') @canvas.lower('I14R_1') end @@ -1190,11 +1190,11 @@ class TkGoldberg_Demo x3, y3, x4, y4, x5, y5 = xy2 zz = [ - x0, y0, x0, y0, xy, x2, y2, x2, y2, + x0, y0, x0, y0, xy, x2, y2, x2, y2, x3, y3, x3, y3, xy2, x5, y5, x5, y5 ].flatten @canvas.delete("I14#{side}") - TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, + TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, :fill=>color, :outline=>color, :width=>3) @canvas.lower("I14#{side}") end @@ -1247,7 +1247,7 @@ class TkGoldberg_Demo xy = [765, 557, 784, 583] TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2) - sine([658, 580, 765, 580], 3, 15, + sine([658, 580, 765, 580], 3, 15, :tag=>'I15_s', :fill=>@C['fg'], :width=>3) end @@ -1286,7 +1286,7 @@ class TkGoldberg_Demo xy = [722, 485, 791, 556] TkcRectangle.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3) xy = box(752, 515, 25) # Bell - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', :tag=>'I16b', :width=>2) xy = box(752, 515, 5) # Bell button TkcOval.new(@canvas, xy, :fill=>'black', :outline=>'black', :tag=>'I16b') @@ -1325,24 +1325,24 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = [664, 523, 717, 549] # Body - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :style=>:chord, :start=>128, :extent=>260, :tag=>'I17') xy = [709, 554, 690, 543] # Paw - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = [657, 544, 676, 555] - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = box(660, 535, 15) # Lower face - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>150, :extent=>240, :tag=>'I17_') - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:chord, :start=>150, :extent=>240, :tag=>'I17_') xy = [674, 529, 670, 513, 662, 521, 658, 521, 650, 513, 647, 529] # Ears TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, :tag=>['I17_', 'I17_c']) xy = [652, 542, 628, 539] # Whiskers TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') @@ -1352,23 +1352,23 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [668, 543, 687, 538] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 544, 688, 546] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 547, 688, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [649, 530, 654, 538, 659, 530] # Left eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [671, 530, 666, 538, 661, 530] # Right eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [655, 543, 660, 551, 665, 543] # Mouth - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') end @@ -1381,10 +1381,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = box(654, 530, 4) # Left eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') xy = box(666, 530, 4) # Right eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') @canvas.move('I17_', 0, -20) # Move face up @@ -1394,19 +1394,19 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [ # Body - 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, - 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, + 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, + 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, 668, 527, 668, 527, 675, 522, 676, 517, 677, 512 ] - TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), - :outline=>@C['fg'], :width=>3, :smooth=>true, + TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), + :outline=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = [716, 514, 716, 554] # Back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [694, 532, 694, 554] # 2nd back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [715, 514, 718, 506, 719, 495, 716, 488] # Tail - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') @canvas.raise('I17w') # Make whiskers visible @@ -1435,14 +1435,14 @@ class TkGoldberg_Demo step = get_step(18, step) pos = [ - [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], + [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], [136, 506], [16, 506], [-100, -100] ] b = [] b[0] = [490, 502, 719, 507, 524, 512] # Band collapsing b[1] = [ - 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, + 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, 553, 536, 538, 534, 532, 519, 529, 499 ] b[2] = [ @@ -1473,54 +1473,54 @@ class TkGoldberg_Demo color = @C['19'] xx = [[249, 181], [155, 118], [86, 55], [22, 0]] xx.each{|x1, x2| - TkcRectangle.new(@canvas, x1, 453, x2, 467, + TkcRectangle.new(@canvas, x1, 453, x2, 467, :fill=>color, :outline=>'', :tag=>'I19') - TkcLine.new(@canvas, x1, 453, x2, 453, + TkcLine.new(@canvas, x1, 453, x2, 453, :fill=>@C['fg'], :width=>1) # Pipe top - TkcLine.new(@canvas, x1, 467, x2, 467, + TkcLine.new(@canvas, x1, 467, x2, 467, :fill=>@C['fg'], :width=>1) # Pipe bottom } @canvas.raise('I11i') xy = box(168, 460, 16) # Bulge by the joint TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>21, :extent=>136) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>-21, :extent=>-130) xy = [249, 447, 255, 473] # First joint 26x6 TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1) xy = box(257, 433, 34) # Bend up - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>-91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 433, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>-92) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 421, 34) # Bend left - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(257, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(243, 421, 34) # Bend down - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = box(243, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = [270, 427, 296, 433] # 2nd joint bottom @@ -1562,7 +1562,7 @@ class TkGoldberg_Demo pos = [451, 462, 473, 484, 496, 504, 513, 523, 532] freq = [20, 40, 40, 40, 40, 40, 40, 40, 40] pos = [ - [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], + [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], [504, 40], [513, 40], [523, 40], [532, 40, :x] ] return 0 if step >= pos.length @@ -1579,11 +1579,11 @@ class TkGoldberg_Demo color = @C['20'] @canvas.delete('I20') - sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], + sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], :width=>3, :fill=>color, :smooth=>true) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20a']) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20b']) @canvas.move('I20a', 8, 0) @canvas.move('I20b', 16, 0) @@ -1599,18 +1599,18 @@ class TkGoldberg_Demo xy = [245, 490, 237, 535] # Right side xy2 = [189, 535, 181, 490] # Left side - TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', :tag=>['I21', 'I21f']) TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21') TkcLine.new(@canvas, xy2, :fill=>@C['fg'], :width=>2, :tag=>'I21') xy = [182, 486, 244, 498] # Top - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, :tag=>['I21', 'I21f']) - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21t']) xy = [189, 532, 237, 540] # Bottom - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21b']) end @@ -1633,7 +1633,7 @@ class TkGoldberg_Demo @canvas.itemconfigure('I21b', :fill=>@C['20']) @canvas.delete('I21w') - TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, + TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, :tag=>['I21', 'I21w'], :outline=>'', :fill=>@C['20']) @canvas.lower('I21w', 'I21') @canvas.raise('I21b') @@ -1669,21 +1669,21 @@ class TkGoldberg_Demo color3 = @C['23c'] xy = [185, 623, 253, 650] # Block - TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], + TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], :width=>2, :tag=>'I23a') xy = [187, 592, 241, 623] # Balloon TkcOval.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', :style=>:arc, :start=>12, :extent=>336) xy = [239, 604, 258, 589, 258, 625, 239, 610] # Balloon nozzle TkcPolygon.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23b') xy = [285, 611, 250, 603] # Dart body - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 596, 249, 618, 264, 607, 249, 596] # Dart tail - TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 607, 268, 607] # Dart detail TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d') @@ -1695,7 +1695,7 @@ class TkGoldberg_Demo step = get_step(23, step) pos = [ - [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], + [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], [487, 607], [587, 607], [687, 607], [787, 607], [-100, -100] ] @@ -1715,7 +1715,7 @@ class TkGoldberg_Demo def draw24 color = @C['24a'] xy = [366, 518, 462, 665] # Balloon - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3, :tag=>'I24') xy = [414, 666, 414, 729] # String TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I24') @@ -1724,16 +1724,16 @@ class TkGoldberg_Demo :width=>3, :tag=>'I24') xy = [387, 567, 390, 549, 404, 542] # Reflections - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [395, 568, 399, 554, 413, 547] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [403, 570, 396, 555, 381, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [408, 564, 402, 547, 386, 545] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') end @@ -1746,16 +1746,16 @@ class TkGoldberg_Demo if step == 0 @canvas.delete('I24') # Exploding balloon xy = [ - 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, - 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, - 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, - 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, + 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, + 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, + 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, + 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, 431, 441, 431, 440, 400, 502, 347, 465, 347, 465 ] - TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], + TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], :outline=>@C['24a'], :width=>10, :smooth=>true) msg = Tk.subst(@S['message'].value) - TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], + TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], :justify=>:center, :font=>['Times Roman', 18, :bold]) return 1 end @@ -1786,8 +1786,8 @@ class TkGoldberg_Demo if step >= 3 @canvas.delete('I24', 'I26') - TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26', - :text=>'click to continue', + TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26', + :text=>'click to continue', :font=>['Times Roman', 24, :bold]) @canvas.bind('1', proc{reset}) return 4 @@ -1967,11 +1967,11 @@ class TkGoldberg_Demo def sparkle(oxy, tag) xy = [ - [299, 283], [298, 302], [295, 314], [271, 331], + [299, 283], [298, 302], [295, 314], [271, 331], [239, 310], [242, 292], [256, 274], [281, 273] ] xy.each{|x, y| - TkcLine.new(@canvas, 271, 304, x, y, + TkcLine.new(@canvas, 271, 304, x, y, :fill=>'white', :width=>3, :tag=>tag) } move_abs(tag, oxy) diff --git a/ext/tk/sample/demos-en/icon.rb b/ext/tk/sample/demos-en/icon.rb index a3921d2333..bab40da214 100644 --- a/ext/tk/sample/demos-en/icon.rb +++ b/ext/tk/sample/demos-en/icon.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($icon_demo) && $icon_demo - $icon_demo.destroy + $icon_demo.destroy $icon_demo = nil end @@ -48,7 +48,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# image +# image flagup = \ TkBitmapImage.new('file'=>[$demo_dir,'..', 'images','flagup.xbm'].join(File::Separator), diff --git a/ext/tk/sample/demos-en/image1.rb b/ext/tk/sample/demos-en/image1.rb index a9072bb308..233cb963d1 100644 --- a/ext/tk/sample/demos-en/image1.rb +++ b/ext/tk/sample/demos-en/image1.rb @@ -7,7 +7,7 @@ # toplevel widget if defined?($image1_demo) && $image1_demo - $image1_demo.destroy + $image1_demo.destroy $image1_demo = nil end diff --git a/ext/tk/sample/demos-en/image2.rb b/ext/tk/sample/demos-en/image2.rb index 1975dd6b02..13098af1b6 100644 --- a/ext/tk/sample/demos-en/image2.rb +++ b/ext/tk/sample/demos-en/image2.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($image2_demo) && $image2_demo - $image2_demo.destroy + $image2_demo.destroy $image2_demo = nil end @@ -87,13 +87,13 @@ TkFrame.new(base_frame){|w| }.pack('side'=>'top', 'anchor'=>'w') -# image +# image [ TkFrame.new(base_frame, 'height'=>'3m', 'width'=>20), TkLabel.new(base_frame, 'text'=>'Image:'), TkLabel.new(base_frame, 'image'=>$image2a) ].each{|w| w.pack('side'=>'top', 'anchor'=>'w')} -# +# def loadDir(w) w.delete(0,'end') Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f| diff --git a/ext/tk/sample/demos-en/image3.rb b/ext/tk/sample/demos-en/image3.rb index 43afab7ecd..edb6d231bf 100644 --- a/ext/tk/sample/demos-en/image3.rb +++ b/ext/tk/sample/demos-en/image3.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($image3_demo) && $image3_demo - $image3_demo.destroy + $image3_demo.destroy $image3_demo = nil end @@ -21,7 +21,7 @@ $image3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($image3_demo).pack(:fill=>:both, :expand=>true) -# +# def loadDir3(w) w.delete(0,'end') Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f| @@ -37,10 +37,10 @@ end # Arguments: # w - Name of the toplevel window of the demo. def selectAndLoadDir3(w, lbox) - dir = Tk.chooseDirectory(:initialdir=>$dirName.value, + dir = Tk.chooseDirectory(:initialdir=>$dirName.value, :parent=>w, :mustexist=>true) if dir.length > 0 - $dirName.value = dir + $dirName.value = dir loadDir3(lbox) end end @@ -92,11 +92,11 @@ image3_f = TkFrame.new(base_frame).pack(:fill=>:both, :expand=>true) image3_df = TkLabelFrame.new(base_frame, :text=>'Directory:') -image3_ff = TkLabelFrame.new(base_frame, :text=>'File:', +image3_ff = TkLabelFrame.new(base_frame, :text=>'File:', :padx=>'2m', :pady=>'2m') image3_lbx = TkListbox.new(image3_ff, :width=>20, :height=>10) { pack(:side=>:left, :fill=>:y, :expand=>true) - yscrollbar(TkScrollbar.new(image3_ff).pack(:side=>:left, :fill=>:y, + yscrollbar(TkScrollbar.new(image3_ff).pack(:side=>:left, :fill=>:y, :expand=>true)) insert(0, *(%w(earth.gif earthris.gif teapot.ppm))) bind('Double-1', proc{|x,y| loadImage(self, x, y)}, '%x %y') @@ -107,7 +107,7 @@ image3_ent = TkEntry.new(image3_df, :width=>30, :textvariable=>$dirName){ bind('Return', proc{loadDir3(image3_lbx)}) } -TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"Select Dir.", +TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"Select Dir.", :command=>proc{selectAndLoadDir3(image3_ent, image3_lbx)}) { pack(:side=>:left, :fill=>:y, :padx=>[0, '2m'], :pady=>'2m') } @@ -119,7 +119,7 @@ image3_if = TkLabelFrame.new(base_frame, :text=>'Image:') {|f| Tk.grid(image3_df, '-', :sticky=>:ew, :padx=>'1m', :pady=>'1m', :in=>image3_f) -Tk.grid(image3_ff, image3_if, +Tk.grid(image3_ff, image3_if, :sticky=>:nw, :padx=>'1m', :pady=>'1m', :in=>image3_f) TkGrid.columnconfigure(image3_f, 1, :weight=>1) diff --git a/ext/tk/sample/demos-en/items.rb b/ext/tk/sample/demos-en/items.rb index 3fd44fd4f4..01a4072cb7 100644 --- a/ext/tk/sample/demos-en/items.rb +++ b/ext/tk/sample/demos-en/items.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($items_demo) && $items_demo - $items_demo.destroy + $items_demo.destroy $items_demo = nil end @@ -49,7 +49,7 @@ TkFrame.new(base_frame) {|frame| # frame cvs = nil TkFrame.new(base_frame) {|cf| - # canvas + # canvas cvs = TkCanvas.new(cf) {|c| focus scrollregion '0c 0c 30c 24c' @@ -75,11 +75,11 @@ TkFrame.new(base_frame) {|cf| c.pack('in'=>cf, 'expand'=>'yes', 'fill'=>'both') else - c.grid('in'=>cf, 'row'=>0, 'column'=>0, + c.grid('in'=>cf, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - vs.grid('row'=>0, 'column'=>1, + vs.grid('row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - hs.grid('row'=>1, 'column'=>0, + hs.grid('row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(cf, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(cf, 0, 'weight'=>1, 'minsize'=>0) @@ -115,13 +115,13 @@ else green = 'black' end -# tag +# tag $tag_item = TkcGroup.new(cvs) # Set up demos within each of the areas of the grid. TkcText.new(cvs, '5c', '.2c', 'text'=>'Lines', 'anchor'=>'n') -TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c', - 'width'=>2, 'fill'=>blue, 'capstyle'=>'butt', +TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c', + 'width'=>2, 'fill'=>blue, 'capstyle'=>'butt', 'join'=>'miter', 'tags'=>$tag_item ) TkcLine.new(cvs, '4.67c','1c','4.67c','4c', 'arrow'=>'last', 'tags'=>$tag_item) TkcLine.new(cvs, '6.33c','1c','6.33c','4c', 'arrow'=>'both', 'tags'=>$tag_item) @@ -129,38 +129,38 @@ TkcLine.new(cvs, '5c','6c','9c','6c','9c','1c','8c','1c','8c','4.8c','8.8c', '4.8c','8.8c','1.2c','8.2c','1.2c','8.2c','4.6c','8.6c','4.6c', '8.6c','1.4c','8.4c','1.4c','8.4c','4.4c', 'width'=>3, 'fill'=>red, 'tags'=>$tag_item ) -TkcLine.new(cvs, '1c','5c','7c','5c','7c','7c','9c','7c', 'width'=>'.5c', +TkcLine.new(cvs, '1c','5c','7c','5c','7c','7c','9c','7c', 'width'=>'.5c', 'stipple'=>'@'+[$demo_dir,'..', - 'images','gray25.xbm'].join(File::Separator), + 'images','gray25.xbm'].join(File::Separator), 'arrow'=>'both', 'arrowshape'=>'15 15 7', 'tags'=>$tag_item ) TkcLine.new(cvs, '1c','7c','1.75c','5.8c','2.5c','7c','3.25c','5.8c','4c','7c', - 'width'=>'.5c', 'capstyle'=>'round', 'join'=>'round', + 'width'=>'.5c', 'capstyle'=>'round', 'join'=>'round', 'tags'=>$tag_item ) -TkcText.new(cvs, '15c', '.2c', +TkcText.new(cvs, '15c', '.2c', 'text'=>'Curves (smoothed lines)', 'anchor'=>'n') -TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c', +TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c', 'smooth'=>'on', 'fill'=>blue, 'tags'=>$tag_item ) -TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c', +TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c', 'smooth'=>'on', 'arrow'=>'both', 'width'=>3, 'tags'=>$tag_item ) -TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c', +TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c', '16.5c','4.5c','13.5c','7.5c','12c','6c', - 'smooth'=>'on', 'width'=>'3m', 'capstyle'=>'round', + 'smooth'=>'on', 'width'=>'3m', 'capstyle'=>'round', 'stipple'=>'@'+[$demo_dir, '..', - 'images', 'gray25.xbm'].join(File::Separator), + 'images', 'gray25.xbm'].join(File::Separator), 'fill'=>red, 'tags'=>$tag_item ) TkcText.new(cvs, '25c', '.2c', 'text'=>'Polygons', 'anchor'=>'n') TkcPolygon.new(cvs, '21c','1.0c','22.5c','1.75c','24c','1.0c','23.25c','2.5c', '24c','4.0c','22.5c','3.25c','21c','4.0c','21.75c','2.5c', - 'fill'=>'green', 'outline'=>'black', 'width'=>4, + 'fill'=>'green', 'outline'=>'black', 'width'=>4, 'tags'=>$tag_item ) TkcPolygon.new(cvs, '25c','4c','25c','4c','25c','1c','26c','1c','27c','4c', '28c','1c','29c','1c','29c','4c','29c','4c', 'fill'=>red, 'smooth'=>'on', 'tags'=> $tag_item) TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c', '28c','5.25c','24c','5.25c','24c','6.0c','26c','6c','26c', - '7.5c','22c','7.5c', + '7.5c','22c','7.5c', 'stipple'=>'@' + [$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator), 'outline'=>'black', 'tags'=>$tag_item ) @@ -168,7 +168,7 @@ TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c', TkcText.new(cvs, '5c', '8.2c', 'text'=>'Rectangles', 'anchor'=>'n') TkcRectangle.new(cvs, '1c','9.5c','4c','12.5c', 'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item) -TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c', +TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c', 'fill'=>green, 'tags'=>$tag_item ) TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'', 'stipple'=>'@'+[$demo_dir,'..', @@ -178,7 +178,7 @@ TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'', TkcText.new(cvs, '15c', '8.2c', 'text'=>'Ovals', 'anchor'=>'n') TkcOval.new(cvs, '11c','9.5c','14c','12.5c', 'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item) -TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c', +TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c', 'fill'=>green, 'tags'=>$tag_item ) TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', 'stipple'=>'@'+[$demo_dir,'..', @@ -187,40 +187,40 @@ TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', TkcText.new(cvs, '25c', '8.2c', 'text'=>'Text', 'anchor'=>'n') TkcRectangle.new(cvs, '22.4c','8.9c','22.6c','9.1c') -TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', +TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', 'text'=>'A short string of text, word-wrapped, justified left, and anchored north (at the top). The rectangles show the anchor points for each piece of text.', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '25.4c','10.9c','25.6c','11.1c') -TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, +TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, 'text'=>"Several lines,\n each centered\nindividually,\nand all anchored\nat the left edge.", 'justify'=>'center', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '24.9c','13.9c','25.1c','14.1c') if $tk_version =~ /^4\.[01]/ - TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, + TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, 'stipple'=>'@' + [$demo_dir, '..', 'images', 'grey.5'].join(File::Separator), 'text'=>'Stippled characters', 'tags'=>$tag_item ) else - TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, - 'stipple'=>'gray50', 'text'=>'Stippled characters', + TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, + 'stipple'=>'gray50', 'text'=>'Stippled characters', 'tags'=>$tag_item ) end TkcText.new(cvs, '5c', '16.2c', 'text'=>'Arcs', 'anchor'=>'n') -TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black', +TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black', 'start'=>45, 'extent'=>270, 'style'=>'pieslice', 'tags'=>$tag_item) -#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', -# 'outline'=>blue, 'start'=>135, 'extent'=>270, +#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', +# 'outline'=>blue, 'start'=>135, 'extent'=>270, # 'outlinestipple'=>'@' + ['images', 'grey.25'].join(File::Separator), # 'tags'=>$tag_item) -TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', - 'outline'=>blue, 'start'=>135, 'extent'=>270, +TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', + 'outline'=>blue, 'start'=>135, 'extent'=>270, 'outlinestipple'=>'@'+[$demo_dir, '..', 'images','gray25.xbm'].join(File::Separator), 'tags'=>$tag_item) -TkcArc.new(cvs, '0.5c','20c','9.5c','24c', 'width'=>'4m', 'style'=>'pieslice', - 'fill'=>'', 'outline'=>red, 'start'=>225, 'extent'=>90, +TkcArc.new(cvs, '0.5c','20c','9.5c','24c', 'width'=>'4m', 'style'=>'pieslice', + 'fill'=>'', 'outline'=>red, 'start'=>225, 'extent'=>90, 'tags'=>$tag_item) TkcArc.new(cvs, '5.5c','20.5c','9.5c','23.5c', 'width'=>'4m', 'style'=>'chord', - 'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270, + 'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270, 'tags'=>$tag_item) TkcText.new(cvs, '15c', '16.2c', 'text'=>'Bitmaps', 'anchor'=>'n') @@ -241,7 +241,7 @@ TkcBitmap.new(cvs, '17c','18.5c', #TkcBitmap.new(cvs, '17c','21.5c', # 'bitmap'=>'@' + ['images', 'letters'].join(File::Separator), # 'tags'=>$tag_item) -# +# TkcBitmap.new(cvs, '17c','21.5c') { bitmap '@' + [$demo_dir, '..', 'images', 'letters.xbm'].join(File::Separator) tags $tag_item @@ -255,17 +255,17 @@ TkcText.new(cvs, '25c', '16.2c', 'text'=>'Windows', 'anchor'=>'n') TkButton.new(cvs) {|b| text 'Press Me' command proc{butPress cvs, red} - TkcWindow.new(cvs, '21c','18c', + TkcWindow.new(cvs, '21c','18c', 'window'=>b, 'anchor'=>'nw', 'tags'=>$tag_item) } TkEntry.new(cvs, 'width'=>20, 'relief'=>'sunken') {|e| insert 'end', 'Edit this text' - TkcWindow.new(cvs, '21c','21c', + TkcWindow.new(cvs, '21c','21c', 'window'=>e, 'anchor'=>'nw', 'tags'=>$tag_item) } -TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c', +TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c', 'width'=>'.5c', 'tickinterval'=>0 ) {|scl| - TkcWindow.new(cvs, '28.5c','17.5c', + TkcWindow.new(cvs, '28.5c','17.5c', 'window'=>scl, 'anchor'=>'n', 'tags'=>$tag_item) } TkcText.new(cvs, '21c', '17.9c', 'text'=>'Button:', 'anchor'=>'sw') @@ -316,7 +316,7 @@ def itemLeave(c) $restoreCmd.call if $restoreCmd end -# Utility methods for stroking out a rectangle and printing what's +# Utility methods for stroking out a rectangle and printing what's # underneath the rectangle's area. def itemMark(c,x,y) @@ -330,7 +330,7 @@ def itemStroke(c,x,y) y = c.canvasy(y) if $areaX1 != x && $areaY1 != y c.delete 'area' - c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, + c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, '-outline', 'black') $areaX2 = x $areaY2 = y @@ -371,11 +371,11 @@ def itemDrag(c,x,y) $lastY = y end -# Method that's invoked when the button embedded in the canvas +# Method that's invoked when the button embedded in the canvas # is invoked. def butPress(w,color) - i = TkcText.new(w, '25c', '18.1c', + i = TkcText.new(w, '25c', '18.1c', 'text'=>'Ouch!!', 'fill'=>color, 'anchor'=>'n') Tk.after(500, proc{w.delete i}) end diff --git a/ext/tk/sample/demos-en/knightstour.rb b/ext/tk/sample/demos-en/knightstour.rb index 618fce5f02..6f96a5be10 100644 --- a/ext/tk/sample/demos-en/knightstour.rb +++ b/ext/tk/sample/demos-en/knightstour.rb @@ -155,16 +155,16 @@ class Knights_Tour frame = Ttk::Frame.new($knightstour) sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'knightstour'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'knightstour'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $knightstour.destroy $knightstour = nil - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) frame @@ -176,7 +176,7 @@ class Knights_Tour $knightstour.withdraw base_f = Ttk::Frame.new($knightstour) @board = Tk::Canvas.new(base_f, :width=>240, :height=>240) - @log = Tk::Text.new(base_f, :width=>12, :height=>1, + @log = Tk::Text.new(base_f, :width=>12, :height=>1, :font=>'Arial 8', :background=>'white') scr = @log.yscrollbar(Ttk::Scrollbar.new(base_f)) @@ -186,13 +186,13 @@ class Knights_Tour tool_f = Ttk::Frame.new($knightstour) label = Ttk::Label.new(tool_f, :text=>'Speed') - scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay, + scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay, :command=>proc{|n| set_delay(n)}) - check = Ttk::Checkbutton.new(tool_f, :text=>'Repeat', + check = Ttk::Checkbutton.new(tool_f, :text=>'Repeat', :variable=>@continuous) - @start_btn = Ttk::Button.new(tool_f, :text=>'Start', + @start_btn = Ttk::Button.new(tool_f, :text=>'Start', :command=>proc{tour()}) - @exit_btn = Ttk::Button.new(tool_f, :text=>'Exit', + @exit_btn = Ttk::Button.new(tool_f, :text=>'Exit', :command=>proc{_exit()}) 7.downto(0){|row| @@ -205,16 +205,16 @@ class Knights_Tour dfill = 'tan4' end coords = [col * 30 + 4, row * 30 + 4, col * 30 + 30, row * 30 + 30] - @board.create(TkcRectangle, coords, + @board.create(TkcRectangle, coords, :fill=>fill, :disabledfill=>dfill, :width=>2, :state=>:disabled) } } @knight_font = TkFont.new(:size=>-24) - @knight = TkcText.new(@board, 0, 0, :font=>@knight_font, - :text=>Tk::UTF8_String.new('\u265e'), - :anchor=>'nw', # :tags=>'knight', + @knight = TkcText.new(@board, 0, 0, :font=>@knight_font, + :text=>Tk::UTF8_String.new('\u265e'), + :anchor=>'nw', # :tags=>'knight', :fill=>'black', :activefill=>'#600000') @knight.coords(@board.coords(rand(64)+1)[0..1]) @knight.bind('ButtonPress-1', '%W %x %y'){|w,x,y| drag_start(w,x,y)} diff --git a/ext/tk/sample/demos-en/label.rb b/ext/tk/sample/demos-en/label.rb index 91e41e4a22..5be06eafee 100644 --- a/ext/tk/sample/demos-en/label.rb +++ b/ext/tk/sample/demos-en/label.rb @@ -8,11 +8,11 @@ # toplevel widget if defined?($label_demo) && $label_demo - $label_demo.destroy + $label_demo.destroy $label_demo = nil end -# demo toplevel widget +# demo toplevel widget $label_demo = TkToplevel.new {|w| title("Label Demonstration") iconname("label") @@ -21,7 +21,7 @@ $label_demo = TkToplevel.new {|w| base_frame = TkFrame.new($label_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '4i' @@ -30,7 +30,7 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -48,15 +48,15 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# label demo +# label demo f_left = TkFrame.new(base_frame) f_right = TkFrame.new(base_frame) -[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', +[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', 'padx'=>10, 'pady'=>10, 'fill'=>'both')} -# label +# label [ TkLabel.new(f_left, 'text'=>'First label'), - TkLabel.new(f_left, 'text'=>'Second label, raised', + TkLabel.new(f_left, 'text'=>'Second label, raised', 'relief'=>'raised'), TkLabel.new(f_left, 'text'=>'Third label, sunken', 'relief'=>'sunken') ].each{|w| w.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'anchor'=>'w')} diff --git a/ext/tk/sample/demos-en/labelframe.rb b/ext/tk/sample/demos-en/labelframe.rb index c912ff4c52..ad968bc061 100644 --- a/ext/tk/sample/demos-en/labelframe.rb +++ b/ext/tk/sample/demos-en/labelframe.rb @@ -7,7 +7,7 @@ if defined?($labelframe_demo) && $labelframe_demo - $labelframe_demo.destroy + $labelframe_demo.destroy $labelframe_demo = nil end @@ -20,8 +20,8 @@ $labelframe_demo = TkToplevel.new {|w| base_frame = TkFrame.new($labelframe_demo).pack(:fill=>:both, :expand=>true) # Some information -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top) Labelframes are used to group related widgets together. \ The label may be either plain text or another widget. \ @@ -45,17 +45,17 @@ TkFrame.new(base_frame){|f| } # Demo area -w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both, +w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both, :expand=>true) # A group of radiobuttons in a labelframe -TkLabelFrame.new(w, :text=>'Value', +TkLabelFrame.new(w, :text=>'Value', :padx=>2, :pady=>2) {|f| grid(:row=>0, :column=>0, :pady=>'2m', :padx=>'2m') v = TkVariable.new (1..4).each{|i| - TkRadiobutton.new(f, :text=>"This is value #{i}", + TkRadiobutton.new(f, :text=>"This is value #{i}", :variable=>v, :value=>i) { pack(:side=>:top, :fill=>:x, :pady=>2) } @@ -78,7 +78,7 @@ def lfEnableButtons(w) end TkLabelFrame.new(w, :pady=>2, :padx=>2){|f| - TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy, + TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy, :text=>"Use this option.", :padx=>0) {|cb| command proc{lfEnableButtons(f)} f.labelwidget(cb) diff --git a/ext/tk/sample/demos-en/mclist.rb b/ext/tk/sample/demos-en/mclist.rb index a849eba515..17019bb15b 100644 --- a/ext/tk/sample/demos-en/mclist.rb +++ b/ext/tk/sample/demos-en/mclist.rb @@ -6,7 +6,7 @@ # based on "Id: mclist.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($mclist_demo) && $mclist_demo - $mclist_demo.destroy + $mclist_demo.destroy $mclist_demo = nil end @@ -19,8 +19,8 @@ $mclist_demo = TkToplevel.new {|w| base_frame = TkFrame.new($mclist_demo).pack(:fill=>:both, :expand=>true) ## Explanatory text -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', - :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', + :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><:x) Ttk is the new Tk themed widget set. \ One of the widgets it includes is a tree widget, \ @@ -36,23 +36,23 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'mclist'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'mclist'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $mclist_demo.destroy $mclist_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) } container = Ttk::Frame.new(base_frame) -tree = Ttk::Treeview.new(base_frame, :columns=>%w(country capital currency), +tree = Ttk::Treeview.new(base_frame, :columns=>%w(country capital currency), :show=>:headings) if Tk.windowingsystem != 'aqua' vsb = tree.yscrollbar(Ttk::Scrollbar.new(base_frame)) @@ -70,20 +70,20 @@ container.grid_rowconfigure(0, :weight=>1) ## The data we're going to insert data = [ - ['Argentina', 'Buenos Aires', 'ARS'], - ['Australia', 'Canberra', 'AUD'], - ['Brazil', 'Brazilia', 'BRL'], - ['Canada', 'Ottawa', 'CAD'], - ['China', 'Beijing', 'CNY'], - ['France', 'Paris', 'EUR'], - ['Germany', 'Berlin', 'EUR'], - ['India', 'New Delhi', 'INR'], - ['Italy', 'Rome', 'EUR'], - ['Japan', 'Tokyo', 'JPY'], - ['Mexico', 'Mexico City', 'MXN'], - ['Russia', 'Moscow', 'RUB'], - ['South Africa', 'Pretoria', 'ZAR'], - ['United Kingdom', 'London', 'GBP'], + ['Argentina', 'Buenos Aires', 'ARS'], + ['Australia', 'Canberra', 'AUD'], + ['Brazil', 'Brazilia', 'BRL'], + ['Canada', 'Ottawa', 'CAD'], + ['China', 'Beijing', 'CNY'], + ['France', 'Paris', 'EUR'], + ['Germany', 'Berlin', 'EUR'], + ['India', 'New Delhi', 'INR'], + ['Italy', 'Rome', 'EUR'], + ['Japan', 'Tokyo', 'JPY'], + ['Mexico', 'Mexico City', 'MXN'], + ['Russia', 'Moscow', 'RUB'], + ['South Africa', 'Pretoria', 'ZAR'], + ['United Kingdom', 'London', 'GBP'], ['United States', 'Washington, D.C.', 'USD'], ] @@ -91,7 +91,7 @@ data = [ font = Ttk::Style.lookup(tree[:style], :font) cols = %w(country capital currency) cols.zip(%w(Country Capital Currency)).each{|col, name| - tree.heading_configure(col, :text=>name, + tree.heading_configure(col, :text=>name, :command=>proc{sort_by(tree, col, false)}) tree.column_configure(col, :width=>TkFont.measure(font, name)) } @@ -109,8 +109,8 @@ data.each{|country, capital, currency| ## Code to do the sorting of the tree contents when clicked on def sort_by(tree, col, direction) - tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . - sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . + tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . + sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . each_with_index{|info, idx| tree.move(info[1], nil, idx)} tree.heading_configure(col, :command=>proc{sort_by(tree, col, ! direction)}) diff --git a/ext/tk/sample/demos-en/menu.rb b/ext/tk/sample/demos-en/menu.rb index bf6c22cb9d..a458dbbc14 100644 --- a/ext/tk/sample/demos-en/menu.rb +++ b/ext/tk/sample/demos-en/menu.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($menu_demo) && $menu_demo - $menu_demo.destroy + $menu_demo.destroy $menu_demo = nil end @@ -54,7 +54,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# menu +# menu TkMenubutton.new($menu_frame, 'text'=>'File', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|file_menu| @@ -86,8 +86,8 @@ TkMenubutton.new($menu_frame, 'text'=>'Basic', 'underline'=>0) {|m| m.configure('menu'=>basic_menu) add('command', 'label'=>'Long entry that does nothing') ['A','B','C','D','E','F','G'].each{|c| - add('command', 'label'=>"Print letter \"#{c}\"", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + add('command', 'label'=>"Print letter \"#{c}\"", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -98,17 +98,17 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|cascade_menu| m.configure('menu'=>cascade_menu) - add('command', 'label'=>'Print hello', - 'command'=>proc{print "Hello\n"}, + add('command', 'label'=>'Print hello', + 'command'=>proc{print "Hello\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu_demo.bind("#{modifier}-h", proc{print "Hello\n"}) - add('command', 'label'=>'Print goodbye', - 'command'=>proc{print "Goodbye\n"}, + add('command', 'label'=>'Print goodbye', + 'command'=>proc{print "Goodbye\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu_demo.bind("#{modifier}-g", proc{print "Goodbye\n"}) TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_check| - cascade_menu.add('cascade', 'label'=>'Check buttons', + cascade_menu.add('cascade', 'label'=>'Check buttons', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'Oil checked', 'variable'=>oil) @@ -119,18 +119,18 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| lights = TkVariable.new(0) add('check', 'label'=>'Lights checked', 'variable'=>lights) add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu_demo, - ['oil', oil], - ['trans', trans], - ['brakes', brakes], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu_demo, + ['oil', oil], + ['trans', trans], + ['brakes', brakes], ['lights', lights])} ) invoke 1 invoke 3 } TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_radio| - cascade_menu.add('cascade', 'label'=>'Radio buttons', + cascade_menu.add('cascade', 'label'=>'Radio buttons', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 point', 'variable'=>pointSize, 'value'=>10) @@ -144,9 +144,9 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| add('radio', 'label'=>'Bold', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'Italic', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu_demo, - ['pointSize', pointSize], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu_demo, + ['pointSize', pointSize], ['style', style])} ) invoke 1 invoke 7 @@ -158,15 +158,15 @@ TkMenubutton.new($menu_frame, 'text'=>'Icons', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|icon_menu| m.configure('menu'=>icon_menu) - add('command', + add('command', 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'The menu entry you invoked displays a bitmap rather than a text string. Other than this, it is just like any other menu entry.', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'Dismiss')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, + add('command', 'bitmap'=>icon, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } } @@ -178,7 +178,7 @@ TkMenubutton.new($menu_frame, 'text'=>'More', 'underline'=>0) {|m| m.configure('menu'=>more_menu) [ 'An entry','Another entry','Does nothing','Does almost nothing', 'Make life meaningful' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } } @@ -189,7 +189,7 @@ TkMenubutton.new($menu_frame, 'text'=>'Colors', 'underline'=>0) {|m| TkMenu.new(m) {|colors_menu| m.configure('menu'=>colors_menu) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } diff --git a/ext/tk/sample/demos-en/menu84.rb b/ext/tk/sample/demos-en/menu84.rb index 4029ce5541..4fc53962e7 100644 --- a/ext/tk/sample/demos-en/menu84.rb +++ b/ext/tk/sample/demos-en/menu84.rb @@ -4,7 +4,7 @@ # toplevel widget if defined?($menu84_demo) && $menu84_demo - $menu84_demo.destroy + $menu84_demo.destroy $menu84_demo = nil end @@ -36,9 +36,9 @@ TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') { menustatus = TkVariable.new(" ") TkFrame.new(base_frame) {|frame| - TkLabel.new(frame, 'textvariable'=>menustatus, 'relief'=>'sunken', - 'bd'=>1, 'font'=>['Helvetica', '10'], - 'anchor'=>'w').pack('side'=>'left', 'padx'=>2, + TkLabel.new(frame, 'textvariable'=>menustatus, 'relief'=>'sunken', + 'bd'=>1, 'font'=>['Helvetica', '10'], + 'anchor'=>'w').pack('side'=>'left', 'padx'=>2, 'expand'=>true, 'fill'=>'both') pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2) } @@ -92,8 +92,8 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Basic', 'menu'=>m, 'underline'=>0) add('command', 'label'=>'Long entry that does nothing') ['A','B','C','D','E','F','G'].each{|c| - add('command', 'label'=>"Print letter \"#{c}\"", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + add('command', 'label'=>"Print letter \"#{c}\"", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu84_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -101,17 +101,17 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Cascades', 'menu'=>m, 'underline'=>0) - add('command', 'label'=>'Print hello', - 'command'=>proc{print "Hello\n"}, + add('command', 'label'=>'Print hello', + 'command'=>proc{print "Hello\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu84_demo.bind("#{modifier}-h", proc{print "Hello\n"}) - add('command', 'label'=>'Print goodbye', - 'command'=>proc{print "Goodbye\n"}, + add('command', 'label'=>'Print goodbye', + 'command'=>proc{print "Goodbye\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu84_demo.bind("#{modifier}-g", proc{print "Goodbye\n"}) TkMenu.new(m, 'tearoff'=>false) {|cascade_check| - m.add('cascade', 'label'=>'Check buttons', + m.add('cascade', 'label'=>'Check buttons', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'Oil checked', 'variable'=>oil) @@ -122,18 +122,18 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| lights = TkVariable.new(0) add('check', 'label'=>'Lights checked', 'variable'=>lights) add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu84_demo, - ['oil', oil], - ['trans', trans], - ['brakes', brakes], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu84_demo, + ['oil', oil], + ['trans', trans], + ['brakes', brakes], ['lights', lights])} ) invoke 1 invoke 3 } TkMenu.new(m, 'tearoff'=>false) {|cascade_radio| - m.add('cascade', 'label'=>'Radio buttons', + m.add('cascade', 'label'=>'Radio buttons', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 point', 'variable'=>pointSize, 'value'=>10) @@ -147,9 +147,9 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| add('radio', 'label'=>'Bold', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'Italic', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu84_demo, - ['pointSize', pointSize], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu84_demo, + ['pointSize', pointSize], ['style', style])} ) invoke 1 invoke 7 @@ -158,15 +158,15 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Icons', 'menu'=>m, 'underline'=>0) - add('command', 'hidemargin'=>1, + add('command', 'hidemargin'=>1, 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'The menu entry you invoked displays a bitmap rather than a text string. Other than this, it is just like any other menu entry.', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'Dismiss')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, 'hidemargin'=>1, + add('command', 'bitmap'=>icon, 'hidemargin'=>1, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } @@ -177,19 +177,19 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'More', 'menu'=>m, 'underline'=>0) [ 'An entry','Another entry','Does nothing','Does almost nothing', 'Make life meaningful' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } - m.entryconfigure('Does almost nothing', - 'bitmap'=>'questhead', 'compound'=>'left', + m.entryconfigure('Does almost nothing', + 'bitmap'=>'questhead', 'compound'=>'left', 'command'=>proc{ - TkDialog.new('title'=>'Compound Menu Entry', + TkDialog.new('title'=>'Compound Menu Entry', 'message'=>'The menu entry you invoked'+ 'displays both a bitmap and '+ 'a text string. Other than '+ 'this, it isjust like any '+ - 'other menu entry.', + 'other menu entry.', 'buttons'=>['OK'], 'bitmap'=>'') }) } @@ -197,7 +197,7 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame) {|m| $menu84_frame.add('cascade', 'label'=>'Colors', 'menu'=>m, 'underline'=>0) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } diff --git a/ext/tk/sample/demos-en/menubu.rb b/ext/tk/sample/demos-en/menubu.rb index b37367e515..6e28e813b3 100644 --- a/ext/tk/sample/demos-en/menubu.rb +++ b/ext/tk/sample/demos-en/menubu.rb @@ -21,7 +21,7 @@ def optionMenu(menubutton, varName, firstValue, *rest) for i in rest menu.add 'radio', 'label'=>i, 'variable'=>varName end - + return menu end @@ -188,7 +188,7 @@ msg.pack('side'=>'top', 'padx'=>25, 'pady'=>25) TkFrame.new(center) {|f| menubuttonoptions = TkVariable.new mbutton = TkMenubutton.new(f) - options = optionMenu(mbutton, menubuttonoptions, + options = optionMenu(mbutton, menubuttonoptions, 'one', 'two', 'three') mbutton.pack('side'=>'left', 'padx'=>25, 'pady'=>25) paletteColor = TkVariable.new diff --git a/ext/tk/sample/demos-en/msgbox.rb b/ext/tk/sample/demos-en/msgbox.rb index 62b1f2b985..d3d66bfeb0 100644 --- a/ext/tk/sample/demos-en/msgbox.rb +++ b/ext/tk/sample/demos-en/msgbox.rb @@ -7,7 +7,7 @@ # toplevel widget if defined?($msgbox_demo) && $msgbox_demo - $msgbox_demo.destroy + $msgbox_demo.destroy $msgbox_demo = nil end @@ -49,9 +49,9 @@ TkFrame.new(base_frame) {|frame| # frame $msgbox_leftframe = TkFrame.new(base_frame) $msgbox_rightframe = TkFrame.new(base_frame) -$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') -$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') TkLabel.new($msgbox_leftframe, 'text'=>'Icon').pack('side'=>'top') @@ -60,9 +60,9 @@ TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ $msgboxIcon = TkVariable.new('info') ['error', 'info', 'question', 'warning'].each {|icon| - TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, - 'relief'=>'flat', 'value'=>icon, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, + 'relief'=>'flat', 'value'=>icon, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } @@ -71,20 +71,20 @@ TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ .pack('side'=>'top', 'fill'=>'x', 'expand'=>'no') $msgboxType = TkVariable.new('ok') -['abortretryignore', 'ok', 'okcancel', +['abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel'].each {|type| - TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, - 'relief'=>'flat', 'value'=>type, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, + 'relief'=>'flat', 'value'=>type, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } def showMessageBox(w) - button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, + button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, 'message'=>"This is a \"#{$msgboxType.value}\" type messagebox with the \"#{$msgboxIcon.value}\" icon") - Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, + Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"You have selected \"#{button}\"") end diff --git a/ext/tk/sample/demos-en/msgbox2.rb b/ext/tk/sample/demos-en/msgbox2.rb index 136a723c73..c227b59bb1 100644 --- a/ext/tk/sample/demos-en/msgbox2.rb +++ b/ext/tk/sample/demos-en/msgbox2.rb @@ -7,7 +7,7 @@ # toplevel widget if defined?($msgbox2_demo) && $msgbox2_demo - $msgbox2_demo.destroy + $msgbox2_demo.destroy $msgbox2_demo = nil end @@ -49,9 +49,9 @@ TkFrame.new(base_frame) {|frame| # frame $msgbox_leftframe = TkFrame.new(base_frame) $msgbox_rightframe = TkFrame.new(base_frame) -$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') -$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') TkLabel.new($msgbox_leftframe, 'text'=>'Icon').pack('side'=>'top') @@ -60,9 +60,9 @@ TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ $msgboxIcon = TkVariable.new('info') ['error', 'info', 'question', 'warning'].each {|icon| - TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, - 'relief'=>'flat', 'value'=>icon, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, + 'relief'=>'flat', 'value'=>icon, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } @@ -71,21 +71,21 @@ TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ .pack('side'=>'top', 'fill'=>'x', 'expand'=>'no') $msgboxType = TkVariable.new('ok') -['abortretryignore', 'ok', 'okcancel', +['abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel'].each {|type| - TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, - 'relief'=>'flat', 'value'=>type, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, + 'relief'=>'flat', 'value'=>type, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } def showMessageBox2(w) - button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, + button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, 'message'=>"\"#{$msgboxType.value}\" Type MessageBox", 'detail'=>"This is a \"#{$msgboxType.value}\" type messagebox with the \"#{$msgboxIcon.value}\" icon. Please click one of the following button.") - Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, + Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"You have selected \"#{button}\"") end diff --git a/ext/tk/sample/demos-en/paned1.rb b/ext/tk/sample/demos-en/paned1.rb index 26941b84a8..d3d66d1b16 100644 --- a/ext/tk/sample/demos-en/paned1.rb +++ b/ext/tk/sample/demos-en/paned1.rb @@ -6,7 +6,7 @@ # based on "Id: paned1.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp" if defined?($paned1_demo) && $paned1_demo - $paned1_demo.destroy + $paned1_demo.destroy $paned1_demo = nil end @@ -18,8 +18,8 @@ $paned1_demo = TkToplevel.new {|w| base_frame = TkFrame.new($paned1_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top) The sash between the two coloured windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.) If your Tk library linked to Ruby doesn't include a 'panedwindow', this demo doesn't work. Please use later version of Tk which supports a 'panedwindow'. @@ -40,7 +40,7 @@ TkFrame.new(base_frame){|f| } TkPanedwindow.new(base_frame, :orient=>:horizontal){|f| - add(Tk::Label.new(f, :text=>"This is the\nleft side", :bg=>'yellow'), + add(Tk::Label.new(f, :text=>"This is the\nleft side", :bg=>'yellow'), Tk::Label.new(f, :text=>"This is the\nright side", :bg=>'cyan')) pack(:side=>:top, :expand=>true, :fill=>:both, :pady=>2, :padx=>'2m') diff --git a/ext/tk/sample/demos-en/paned2.rb b/ext/tk/sample/demos-en/paned2.rb index 0e62013886..02293b0309 100644 --- a/ext/tk/sample/demos-en/paned2.rb +++ b/ext/tk/sample/demos-en/paned2.rb @@ -6,7 +6,7 @@ # based on "Id: paned2.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp" if defined?($paned2_demo) && $paned2_demo - $paned2_demo.destroy + $paned2_demo.destroy $paned2_demo = nil end @@ -18,8 +18,8 @@ $paned2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($paned2_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top) The sash between the two scrolled windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.) If your Tk library linked to Ruby doesn't include a 'panedwindow', this demo doesn't work. Please use later version of Tk which supports a 'panedwindow'. @@ -42,23 +42,23 @@ TkFrame.new(base_frame){|f| paneList = TkVariable.new # define as normal variable (not array) paneList.value = [ # ruby's array --> tcl's list 'List of Ruby/Tk Widgets', - 'TkButton', - 'TkCanvas', - 'TkCheckbutton', - 'TkEntry', - 'TkFrame', - 'TkLabel', - 'TkLabelframe', - 'TkListbox', - 'TkMenu', - 'TkMenubutton', - 'TkMessage', - 'TkPanedwindow', - 'TkRadiobutton', - 'TkScale', - 'TkScrollbar', - 'TkSpinbox', - 'TkText', + 'TkButton', + 'TkCanvas', + 'TkCheckbutton', + 'TkEntry', + 'TkFrame', + 'TkLabel', + 'TkLabelframe', + 'TkListbox', + 'TkMenu', + 'TkMenubutton', + 'TkMessage', + 'TkPanedwindow', + 'TkRadiobutton', + 'TkScale', + 'TkScrollbar', + 'TkSpinbox', + 'TkText', 'TkToplevel' ] @@ -69,13 +69,13 @@ TkPanedwindow.new(base_frame, :orient=>:vertical){|f| add(TkFrame.new(f){|paned2_top| TkListbox.new(paned2_top, :listvariable=>paneList) { # Invert the first item to highlight it - itemconfigure(0, :background=>self.cget(:foreground), + itemconfigure(0, :background=>self.cget(:foreground), :foreground=>self.cget(:background) ) - yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right, + yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right, :fill=>:y)) pack(:fill=>:both, :expand=>true) } - }, + }, TkFrame.new(f, :height=>120) {|paned2_bottom| # The bottom window is a text widget with scrollbar diff --git a/ext/tk/sample/demos-en/pendulum.rb b/ext/tk/sample/demos-en/pendulum.rb index 5f7d361170..306ac94a21 100644 --- a/ext/tk/sample/demos-en/pendulum.rb +++ b/ext/tk/sample/demos-en/pendulum.rb @@ -7,7 +7,7 @@ # destroy toplevel widget for this demo script if defined?($pendulum_demo) && $pendulum_demo - $pendulum_demo.destroy + $pendulum_demo.destroy $pendulum_demo = nil end @@ -59,14 +59,14 @@ class PendulumAnimationDemo # Create the canvas containing the graphical representation of the # simulated system. - @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white', + @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white', :borderwidth=>2, :relief=>:sunken) - TkcText.new(@c, 5, 5, :anchor=>:nw, + TkcText.new(@c, 5, 5, :anchor=>:nw, :text=>'Click to Adjust Bob Start Position') # Coordinates of these items don't matter; they will be set properly below @plate = TkcLine.new(@c, 0, 25, 320, 25, :width=>2, :fill=>'grey50') @rod = TkcLine.new(@c, 1, 1, 1, 1, :width=>3, :fill=>'black') - @bob = TkcOval.new(@c, 1, 1, 2, 2, + @bob = TkcOval.new(@c, 1, 1, 2, 2, :width=>3, :fill=>'yellow', :outline=>'black') TkcOval.new(@c, 155, 20, 165, 30, :fill=>'grey50', :outline=>'') @@ -76,22 +76,22 @@ class PendulumAnimationDemo # Create the canvas containing the phase space graph; this consists of # a line that gets gradually paler as it ages, which is an extremely # effective visual trick. - @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white', + @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white', :borderwidth=>2, :relief=>:sunken) @y_axis = TkcLine.new(@k, 160, 200, 160, 0, :fill=>'grey75', :arrow=>:last) @x_axis = TkcLine.new(@k, 0, 100, 320, 100, :fill=>'grey75', :arrow=>:last) @graph = {} 90.step(0, -10){|i| - # Coordinates of these items don't matter; + # Coordinates of these items don't matter; # they will be set properly below @graph[i] = TkcLine.new(@k, 0, 0, 1, 1, :smooth=>true, :fill=>"grey#{i}") } # labels - @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne, + @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne, :text=>'q', :font=>'Symbol 8') - @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne, + @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne, :text=>'dq', :font=>'Symbol 8') # pack @@ -109,19 +109,19 @@ class PendulumAnimationDemo # binding @c.bindtags_unshift(btag = TkBindTag.new) btag.bind('Destroy'){ @timer.stop } - btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x.to_i, y.to_i)}, + btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x.to_i, y.to_i)}, '%x %y') btag.bind('B1-Motion', proc{|x, y| showPendulum(x.to_i, y.to_i)}, '%x %y') - btag.bind('ButtonRelease-1', - proc{|x, y| showPendulum(x.to_i, y.to_i); @timer.start }, + btag.bind('ButtonRelease-1', + proc{|x, y| showPendulum(x.to_i, y.to_i); @timer.start }, '%x %y') btag.bind('Configure', proc{|w| @plate.coords(0, 25, w.to_i, 25)}, '%w') - @k.bind('Configure', proc{|h, w| + @k.bind('Configure', proc{|h, w| h = h.to_i w = w.to_i - @psh = h/2; + @psh = h/2; @psw = w/2 @x_axis.coords(2, @psh, w-2, @psh) @y_axis.coords(@psw, h-2, @psw, 2) @@ -142,9 +142,9 @@ class PendulumAnimationDemo end # This procedure makes the pendulum appear at the correct place on the - # canvas. If the additional arguments x, y are passed instead of computing - # the position of the pendulum from the length of the pendulum rod and its - # angle, the length and angle are computed in reverse from the given + # canvas. If the additional arguments x, y are passed instead of computing + # the position of the pendulum from the length of the pendulum rod and its + # angle, the length and angle are computed in reverse from the given # location (which is taken to be the centre of the pendulum bob.) def showPendulum(x=nil, y=nil) if x && y && (x != 160 || y != 25) diff --git a/ext/tk/sample/demos-en/plot.rb b/ext/tk/sample/demos-en/plot.rb index 628c9df584..f70daa3fb2 100644 --- a/ext/tk/sample/demos-en/plot.rb +++ b/ext/tk/sample/demos-en/plot.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($plot_demo) && $plot_demo - $plot_demo.destroy + $plot_demo.destroy $plot_demo = nil end @@ -22,7 +22,7 @@ $plot_demo = TkToplevel.new {|w| base_frame = TkFrame.new($plot_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', 'text'=>"This window displays a canvas widget containing a simple 2-dimensional plot. You can doctor the data by dragging any of the points with mouse button 1."){ pack('side'=>'top') } @@ -45,55 +45,55 @@ $plot_buttons = TkFrame.new(base_frame) {|frame| } $plot_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# font +# font plotFont = '-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*' -# canvas +# canvas $plot_canvas = TkCanvas.new(base_frame,'relief'=>'raised','width'=>450,'height'=>300) $plot_canvas.pack('side'=>'top', 'fill'=>'x') -# plot +# plot TkcLine.new($plot_canvas, 100, 250, 400, 250, 'width'=>2) TkcLine.new($plot_canvas, 100, 250, 100, 50, 'width'=>2) -TkcText.new($plot_canvas, 225, 20, +TkcText.new($plot_canvas, 225, 20, 'text'=>"A Simple Plot", 'font'=>plotFont, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($plot_canvas, x, 250, x, 245, 'width'=>2) - TkcText.new($plot_canvas, x, 254, + TkcText.new($plot_canvas, x, 254, 'text'=>10*i, 'font'=>plotFont, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($plot_canvas, 100, y, 105, y, 'width'=>2) - TkcText.new($plot_canvas, 96, y, + TkcText.new($plot_canvas, 96, y, 'text'=>"#{i*50}.0", 'font'=>plotFont, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6, + item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end -$plot_canvas.itembind('point', 'Any-Enter', +$plot_canvas.itembind('point', 'Any-Enter', proc{$plot_canvas.itemconfigure 'current','fill','red'}) -$plot_canvas.itembind('point', 'Any-Leave', +$plot_canvas.itembind('point', 'Any-Leave', proc{$plot_canvas.itemconfigure 'current','fill','SkyBlue2'}) -$plot_canvas.itembind('point', '1', +$plot_canvas.itembind('point', '1', proc{|x,y| plotDown $plot_canvas,x,y}, "%x %y") -$plot_canvas.itembind('point', 'ButtonRelease-1', +$plot_canvas.itembind('point', 'ButtonRelease-1', proc{$plot_canvas.dtag 'selected'}) -$plot_canvas.bind('B1-Motion', +$plot_canvas.bind('B1-Motion', proc{|x,y| plotMove $plot_canvas,x,y}, "%x %y") $plot = {'lastX'=>0, 'lastY'=>0} # plotDown -- -# This method is invoked when the mouse is pressed over one of the +# This method is invoked when the mouse is pressed over one of the # data points. It sets up state to allow the point to be dragged. # # Arguments: diff --git a/ext/tk/sample/demos-en/puzzle.rb b/ext/tk/sample/demos-en/puzzle.rb index 43c61f519f..f16414aa4c 100644 --- a/ext/tk/sample/demos-en/puzzle.rb +++ b/ext/tk/sample/demos-en/puzzle.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($puzzle_demo) && $puzzle_demo - $puzzle_demo.destroy + $puzzle_demo.destroy $puzzle_demo = nil end @@ -70,7 +70,7 @@ end # depend_on_button_width = true depend_on_button_width = false - + s = TkScrollbar.new(base_frame) base = TkFrame.new(base_frame) { width frameWidth @@ -101,7 +101,7 @@ order = [3,1,6,2,5,7,15,13,4,11,8,9,14,10,12] if depend_on_button_width && (w.winfo_reqwidth * 4 > base.width) base.width = w.winfo_reqwidth * 4 end - }.place('relx'=>$xpos[num], 'rely'=>$ypos[num], + }.place('relx'=>$xpos[num], 'rely'=>$ypos[num], 'relwidth'=>0.25, 'relheight'=>0.25) } $xpos['space'] = 0.75 diff --git a/ext/tk/sample/demos-en/radio.rb b/ext/tk/sample/demos-en/radio.rb index 25cfac2134..bde31508e1 100644 --- a/ext/tk/sample/demos-en/radio.rb +++ b/ext/tk/sample/demos-en/radio.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($radio_demo) && $radio_demo - $radio_demo.destroy + $radio_demo.destroy $radio_demo = nil end @@ -21,7 +21,7 @@ $radio_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '4i' @@ -30,11 +30,11 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# size = TkVariable.new color = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -59,13 +59,13 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame +# frame f_left = TkFrame.new(base_frame) f_right = TkFrame.new(base_frame) f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') -# radiobutton +# radiobutton [10, 12, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "Point Size #{sz}" diff --git a/ext/tk/sample/demos-en/radio2.rb b/ext/tk/sample/demos-en/radio2.rb index 6c02aef0cf..72fc2c610c 100644 --- a/ext/tk/sample/demos-en/radio2.rb +++ b/ext/tk/sample/demos-en/radio2.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($radio2_demo) && $radio2_demo - $radio2_demo.destroy + $radio2_demo.destroy $radio2_demo = nil end @@ -21,7 +21,7 @@ $radio2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio2_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '5i' @@ -30,12 +30,12 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# size = TkVariable.new color = TkVariable.new align = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'Dismiss' @@ -55,24 +55,24 @@ TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'See Variables' command proc{ - showVars(base_frame, + showVars(base_frame, ['size', size], ['color', color], ['compound', align]) } }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame -f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', +# frame +f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', 'pady'=>2, 'padx'=>2) -f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', +f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', 'pady'=>2, 'padx'=>2) -f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', +f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', 'pady'=>2, 'padx'=>2) f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_mid.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') -# radiobutton +# radiobutton [10, 12, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "Point Size #{sz}" @@ -92,15 +92,15 @@ f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x') } -# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', -label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', 'compound'=>'left') label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top') label.height(TkWinfo.reqheight(label)) abtn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a| lower = a.downcase - TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', - 'value'=>lower, 'indicatoron'=>0, 'width'=>7, + TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', + 'value'=>lower, 'indicatoron'=>0, 'width'=>7, 'command'=>proc{label.compound(align.value)}) } diff --git a/ext/tk/sample/demos-en/radio3.rb b/ext/tk/sample/demos-en/radio3.rb index 9c9d75ef4a..8a147edda7 100644 --- a/ext/tk/sample/demos-en/radio3.rb +++ b/ext/tk/sample/demos-en/radio3.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($radio3_demo) && $radio3_demo - $radio3_demo.destroy + $radio3_demo.destroy $radio3_demo = nil end @@ -21,7 +21,7 @@ $radio3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio3_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '5i' @@ -35,50 +35,50 @@ size = TkVariable.new color = TkVariable.new align = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, ['size', size], + showVars(base_frame, ['size', size], ['color', color], ['compound', align]) - }), - TkButton.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'radio3'}), - TkButton.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + TkButton.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'radio3'}), + TkButton.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $radio3_demo $radio3_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) TkGrid(frame, :row=>3, :column=>0, :columnspan=>3, :sticky=>'nsew') } -# frame -f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', +# frame +f_left = TkLabelFrame.new(base_frame, 'text'=>'Point Size', 'pady'=>2, 'padx'=>2) -f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', +f_mid = TkLabelFrame.new(base_frame, 'text'=>'Color', 'pady'=>2, 'padx'=>2) -f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', +f_right = TkLabelFrame.new(base_frame, 'text'=>'Alignment', 'pady'=>2, 'padx'=>2) f_left .grid('column'=>0, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2) f_mid .grid('column'=>1, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2) f_right.grid('column'=>2, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c') -TkButton.new(base_frame, 'text'=>'Tristate', +TkButton.new(base_frame, 'text'=>'Tristate', 'command'=>proc{size.value = 'multi'; color.value = 'multi'}){ grid('column'=>2, 'row'=>2, 'pady'=>'.5c', 'padx'=>'.5c') } -# radiobutton +# radiobutton [10, 12, 14, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "Point Size #{sz}" @@ -101,14 +101,14 @@ TkButton.new(base_frame, 'text'=>'Tristate', }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x') } -# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', -label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +# label = TkLabel.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', +label = Tk::Label.new(f_right, 'text'=>'Label', 'bitmap'=>'questhead', 'compound'=>'left') label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top') label.height(TkWinfo.reqheight(label)) a_btn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a| - TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', - 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7, + TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', + 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7, 'command'=>proc{label.compound(align.value)}) } diff --git a/ext/tk/sample/demos-en/ruler.rb b/ext/tk/sample/demos-en/ruler.rb index 26cd4f3b1c..a9773699f7 100644 --- a/ext/tk/sample/demos-en/ruler.rb +++ b/ext/tk/sample/demos-en/ruler.rb @@ -21,7 +21,7 @@ end # toplevel widget if defined?($ruler_demo) && $ruler_demo - $ruler_demo.destroy + $ruler_demo.destroy $ruler_demo = nil end @@ -35,7 +35,7 @@ $ruler_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ruler_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', 'text'=>"This canvas widget shows a mock-up of a ruler. You can create tab stops by dragging them out of the well to the right of the ruler. You can also drag existing tab stops. If you drag a tab stop far enough up or down so that it turns dim, it will be deleted when you release the mouse button."){ pack('side'=>'top') } @@ -58,14 +58,14 @@ $ruler_buttons = TkFrame.new(base_frame) {|frame| } $ruler_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# canvas +# canvas $ruler_canvas = TkCanvas.new(base_frame, 'width'=>'14.8c', 'height'=>'2.5c') $ruler_canvas.pack('side'=>'top', 'fill'=>'x') -# +# unless Struct.const_defined?("RulerInfo") - $demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y, - :top, :bottom, :size, :normalStyle, + $demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y, + :top, :bottom, :size, :normalStyle, :activeStyle, :deleteStyle).new end $demo_rulerInfo.grid = '.25c' @@ -77,17 +77,17 @@ $demo_rulerInfo.size = TkWinfo.fpixels($ruler_canvas, '.2c') $demo_rulerInfo.normalStyle = {'fill'=>'black'} if TkWinfo.depth($ruler_canvas) > 1 $demo_rulerInfo.activeStyle = {'fill'=>'red', 'stipple'=>''} - $demo_rulerInfo.deleteStyle = {'fill'=>'red', - 'stipple'=>'@'+[$demo_dir, '..', + $demo_rulerInfo.deleteStyle = {'fill'=>'red', + 'stipple'=>'@'+[$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator)} else $demo_rulerInfo.activeStyle = {'fill'=>'black', 'stipple'=>''} - $demo_rulerInfo.deleteStyle = {'fill'=>'black', - 'stipple'=>'@'+[$demo_dir, '..', + $demo_rulerInfo.deleteStyle = {'fill'=>'black', + 'stipple'=>'@'+[$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator)} end -TkcLine.new($ruler_canvas, +TkcLine.new($ruler_canvas, '1c', '0.5c', '1c', '1c', '13c', '1c', '13c', '0.5c', 'width'=>1) (0..11).each{|i| x = i+1 @@ -101,21 +101,21 @@ TkcLine.new($ruler_canvas, $rulerTag_well = TkcTag.new($ruler_canvas) $ruler_canvas\ .addtag_withtag($rulerTag_well, - TkcRectangle.new($ruler_canvas, - '13.2c', '1c', '13.8c', '0.5c', - 'outline'=>'black', + TkcRectangle.new($ruler_canvas, + '13.2c', '1c', '13.8c', '0.5c', + 'outline'=>'black', 'fill'=>($ruler_canvas\ .configinfo('background'))[4]) ) $ruler_canvas\ .addtag_withtag($rulerTag_well, - rulerMkTab($ruler_canvas, - TkWinfo.pixels($ruler_canvas, '13.5c'), + rulerMkTab($ruler_canvas, + TkWinfo.pixels($ruler_canvas, '13.5c'), TkWinfo.pixels($ruler_canvas, '.65c') ) ) $rulerTag_well.bind('1', proc{|x,y| rulerNewTab($ruler_canvas,x,y)}, '%x %y') -$ruler_canvas.itembind('tab', '1', +$ruler_canvas.itembind('tab', '1', proc{|x,y| rulerSelectTab($ruler_canvas,x,y)}, '%x %y') -$ruler_canvas.bind('B1-Motion', +$ruler_canvas.bind('B1-Motion', proc{|x,y| rulerMoveTab($ruler_canvas,x,y)}, '%x %y') $ruler_canvas.bind('Any-ButtonRelease-1', proc{rulerReleaseTab($ruler_canvas)}) diff --git a/ext/tk/sample/demos-en/sayings.rb b/ext/tk/sample/demos-en/sayings.rb index 06ec7c1e75..a4dcf37cdc 100644 --- a/ext/tk/sample/demos-en/sayings.rb +++ b/ext/tk/sample/demos-en/sayings.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($sayings_demo) && $sayings_demo - $sayings_demo.destroy + $sayings_demo.destroy $sayings_demo = nil end @@ -70,11 +70,11 @@ TkFrame.new(base_frame, 'borderwidth'=>10) {|w| sayings_lbox.pack('expand'=>'yes', 'fill'=>'y') else - sayings_lbox.grid('row'=>0, 'column'=>0, + sayings_lbox.grid('row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - sv.grid('row'=>0, 'column'=>1, + sv.grid('row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - sh.grid('row'=>1, 'column'=>0, + sh.grid('row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(w, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(w, 0, 'weight'=>1, 'minsize'=>0) diff --git a/ext/tk/sample/demos-en/search.rb b/ext/tk/sample/demos-en/search.rb index e1fc565e9d..7fb40d88b2 100644 --- a/ext/tk/sample/demos-en/search.rb +++ b/ext/tk/sample/demos-en/search.rb @@ -62,13 +62,13 @@ end def textToggle(cmd1,sleep1,cmd2,sleep2) sleep_list = [sleep2, sleep1] - TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, + TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, -1, cmd1, cmd2).start(sleep1) end # toplevel widget if defined?($search_demo) && $search_demo - $search_demo.destroy + $search_demo.destroy $search_demo = nil end @@ -101,35 +101,35 @@ $search_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame TkFrame.new(base_frame) {|f| - TkLabel.new(f, 'text'=>'File name:', + TkLabel.new(f, 'text'=>'File name:', 'width'=>13, 'anchor'=>'w').pack('side'=>'left') $search_fileName = TkVariable.new - TkEntry.new(f, 'width'=>40, + TkEntry.new(f, 'width'=>40, 'textvariable'=>$search_fileName) { pack('side'=>'left') bind('Return', proc{textLoadFile($search_text, $search_fileName.value) $search_string_entry.focus}) focus } - TkButton.new(f, 'text'=>'Load File', - 'command'=>proc{textLoadFile($search_text, + TkButton.new(f, 'text'=>'Load File', + 'command'=>proc{textLoadFile($search_text, $search_fileName.value)})\ .pack('side'=>'left', 'pady'=>5, 'padx'=>10) }.pack('side'=>'top', 'fill'=>'x') TkFrame.new(base_frame) {|f| - TkLabel.new(f, 'text'=>'Search string:', + TkLabel.new(f, 'text'=>'Search string:', 'width'=>13, 'anchor'=>'w').pack('side'=>'left') $search_searchString = TkVariable.new - $search_string_entry = TkEntry.new(f, 'width'=>40, + $search_string_entry = TkEntry.new(f, 'width'=>40, 'textvariable'=>$search_searchString) { pack('side'=>'left') - bind('Return', proc{textSearch($search_text, $search_searchString.value, + bind('Return', proc{textSearch($search_text, $search_searchString.value, $search_Tag)}) } - TkButton.new(f, 'text'=>'Highlight', - 'command'=>proc{textSearch($search_text, - $search_searchString.value, + TkButton.new(f, 'text'=>'Highlight', + 'command'=>proc{textSearch($search_text, + $search_searchString.value, $search_Tag)}) { pack('side'=>'left', 'pady'=>5, 'padx'=>10) } @@ -148,20 +148,20 @@ $search_text = TkText.new(base_frame, 'setgrid'=>true, 'wrap'=>'word') {|t| if TkWinfo.depth($search_demo) > 1 textToggle(proc{ - $search_Tag.configure('background'=>'#ce5555', + $search_Tag.configure('background'=>'#ce5555', 'foreground'=>'white') }, - 800, + 800, proc{ $search_Tag.configure('background'=>'', 'foreground'=>'') }, 200 ) else textToggle(proc{ - $search_Tag.configure('background'=>'black', + $search_Tag.configure('background'=>'black', 'foreground'=>'white') }, - 800, + 800, proc{ $search_Tag.configure('background'=>'', 'foreground'=>'') }, diff --git a/ext/tk/sample/demos-en/spin.rb b/ext/tk/sample/demos-en/spin.rb index c2a3a8949b..d51b7e6619 100644 --- a/ext/tk/sample/demos-en/spin.rb +++ b/ext/tk/sample/demos-en/spin.rb @@ -5,7 +5,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($spin_demo) && $spin_demo - $spin_demo.destroy + $spin_demo.destroy $spin_demo = nil end @@ -17,8 +17,8 @@ $spin_demo = TkToplevel.new {|w| base_frame = TkFrame.new($spin_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><:top) Three different spin-boxes are displayed below. \ You can add characters by pointing, clicking and typing. \ @@ -50,16 +50,16 @@ TkFrame.new(base_frame){|f| } australianCities = [ - 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', + 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', 'Hobart', 'Darwin', 'Alice Springs' ] [ - TkSpinbox.new(base_frame, :from=>1, :to=>10, :width=>10, :validate=>:key, + TkSpinbox.new(base_frame, :from=>1, :to=>10, :width=>10, :validate=>:key, :validatecommand=>[ proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' - ]), - TkSpinbox.new(base_frame, :from=>0, :to=>3, :increment=>0.5, - :format=>'%05.2f', :width=>10), + ]), + TkSpinbox.new(base_frame, :from=>0, :to=>3, :increment=>0.5, + :format=>'%05.2f', :width=>10), TkSpinbox.new(base_frame, :values=>australianCities, :width=>10) ].each{|sbox| sbox.pack(:side=>:top, :pady=>5, :padx=>10)} diff --git a/ext/tk/sample/demos-en/states.rb b/ext/tk/sample/demos-en/states.rb index add0e84800..a5c01a867c 100644 --- a/ext/tk/sample/demos-en/states.rb +++ b/ext/tk/sample/demos-en/states.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($states_demo) && $states_demo - $states_demo.destroy + $states_demo.destroy $states_demo = nil end @@ -63,16 +63,16 @@ TkFrame.new(base_frame, 'borderwidth'=>'.5c') {|w| }.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'y') ins_data = [ - 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', - 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', - 'Hawaii', 'Idaho', 'Illinois', - 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', - 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', - 'Montana', 'Nebraska', 'Nevada', 'New_Hampshire', 'New_Jersey', 'New_Mexico', - 'New_York', 'North_Carolina', 'North_Dakota', - 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode_Island', - 'South_Carolina', 'South_Dakota', - 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', + 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', + 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', + 'Hawaii', 'Idaho', 'Illinois', + 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', + 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', + 'Montana', 'Nebraska', 'Nevada', 'New_Hampshire', 'New_Jersey', 'New_Mexico', + 'New_York', 'North_Carolina', 'North_Dakota', + 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode_Island', + 'South_Carolina', 'South_Dakota', + 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West_Virginia', 'Wisconsin', 'Wyoming' ] diff --git a/ext/tk/sample/demos-en/style.rb b/ext/tk/sample/demos-en/style.rb index c2fed23926..5c8777379e 100644 --- a/ext/tk/sample/demos-en/style.rb +++ b/ext/tk/sample/demos-en/style.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($style_demo) && $style_demo - $style_demo.destroy + $style_demo.destroy $style_demo = nil end @@ -38,9 +38,9 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# text +# text txt = TkText.new(base_frame){|t| - # + # setgrid 'true' #width 70 #height 32 @@ -53,7 +53,7 @@ txt = TkText.new(base_frame){|t| } pack('expand'=>'yes', 'fill'=>'both') - # + # family = 'Courier' if $tk_version =~ /^4.*/ @@ -76,44 +76,44 @@ txt = TkText.new(base_frame){|t| # when /^8.*/ # unless $style_demo_do_first # $style_demo_do_first = true -# Tk.tk_call('font', 'create', '@bigascii', +# Tk.tk_call('font', 'create', '@bigascii', # '-copy', '-*-Courier-Bold-R-Normal--*-140-*-*-*-*-*-*') -# Tk.tk_call('font', 'create', '@smallascii', +# Tk.tk_call('font', 'create', '@smallascii', # '-copy', '-Adobe-Helvetica-Bold-R-Normal-*-100-*') -# Tk.tk_call('font', 'create', '@cBigFont', +# Tk.tk_call('font', 'create', '@cBigFont', # '-compound', '@bigascii @msg_knj') -# Tk.tk_call('font', 'create', '@cSmallFont', +# Tk.tk_call('font', 'create', '@cSmallFont', # '-compound', '@smallascii @kanji') # end # style_tag_big = TkTextTag.new(t, 'font'=>'@cBigFont') # style_tag_small = TkTextTag.new(t, 'font'=>'@cSmallFont') # end - # + # if TkWinfo.depth($root).to_i > 1 style_tag_color1 = TkTextTag.new(t, 'background'=>'#a0b7ce') style_tag_color2 = TkTextTag.new(t, 'foreground'=>'red') style_tag_raised = TkTextTag.new(t, 'relief'=>'raised', 'borderwidth'=>1) style_tag_sunken = TkTextTag.new(t, 'relief'=>'sunken', 'borderwidth'=>1) else - style_tag_color1 = TkTextTag.new(t, 'background'=>'black', + style_tag_color1 = TkTextTag.new(t, 'background'=>'black', 'foreground'=>'white') - style_tag_color2 = TkTextTag.new(t, 'background'=>'black', + style_tag_color2 = TkTextTag.new(t, 'background'=>'black', 'foreground'=>'white') - style_tag_raised = TkTextTag.new(t, 'background'=>'white', + style_tag_raised = TkTextTag.new(t, 'background'=>'white', 'relief'=>'raised', 'borderwidth'=>1) - style_tag_sunken = TkTextTag.new(t, 'background'=>'white', + style_tag_sunken = TkTextTag.new(t, 'background'=>'white', 'relief'=>'sunken', 'borderwidth'=>1) end - # + # if $tk_version =~ /^4\.[01]/ - style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', - 'borderwidth'=>0, + style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', + 'borderwidth'=>0, 'bgstipple'=>'gray25') else - style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', - 'borderwidth'=>0, + style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', + 'borderwidth'=>0, 'bgstipple'=>'gray12') end style_tag_fgstipple = TkTextTag.new(t, 'fgstipple'=>'gray50') @@ -134,7 +134,7 @@ txt = TkText.new(base_frame){|t| 'lmargin1'=>'12m', 'lmargin2'=>'6m', 'rmargin'=>'10m') - # + # insert('end', 'Text widgets like this one allow you to display information in a variety of styles. Display styles are controlled using a mechanism called ') diff --git a/ext/tk/sample/demos-en/text.rb b/ext/tk/sample/demos-en/text.rb index 3ce8cdfda8..5794a85e87 100644 --- a/ext/tk/sample/demos-en/text.rb +++ b/ext/tk/sample/demos-en/text.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($text_demo) && $text_demo - $text_demo.destroy + $text_demo.destroy $text_demo = nil end @@ -45,7 +45,7 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# text +# text TkText.new(base_frame){|t| relief 'sunken' bd 2 @@ -62,7 +62,7 @@ TkText.new(base_frame){|t| } pack('expand'=>'yes', 'fill'=>'both') - # + # insert('0.0', <"text#{cnt}") sbar = TkScrollbar.new(win, :widgetname=>"sb#{cnt}") peer.yscrollbar sbar - b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", :text=>'Make Peer', + b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", :text=>'Make Peer', :command=>proc{makeClone(count, win, peer)}) - b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", :text=>'Delete Peer', + b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", :text=>'Delete Peer', :command=>proc{killClone(win, cnt)}) row = cnt * 2 TkGrid.configure(peer, sbar, b1, :sticky=>'nsew', :row=>row) @@ -51,7 +51,7 @@ def makeClone(count, win, txt) end def killClone(win, cnt) - Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", + Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", "#{win.path}.clone#{cnt}", "#{win.path}.kill#{cnt}") end diff --git a/ext/tk/sample/demos-en/toolbar.rb b/ext/tk/sample/demos-en/toolbar.rb index 633c52c15d..e7cbeb4235 100644 --- a/ext/tk/sample/demos-en/toolbar.rb +++ b/ext/tk/sample/demos-en/toolbar.rb @@ -5,7 +5,7 @@ # based on "Id: toolbar.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($toolbar_demo) && $toolbar_demo - $toolbar_demo.destroy + $toolbar_demo.destroy $toolbar_demo = nil end @@ -18,7 +18,7 @@ $toolbar_demo = TkToplevel.new {|w| base_frame = Ttk::Frame.new($toolbar_demo).pack(:fill=>:both, :expand=>true) if Tk.windowingsystem != 'aqua' - msg = Ttk::Label.new(base_frame, :wraplength=>'4i', + msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=>Tk::UTF8_String.new(<'4i', + msg = Ttk::Label.new(base_frame, :wraplength=>'4i', :text=>Tk::UTF8_String.new(<40, :height=>10) ## Toolbar contents -tb_btn = Ttk::Button.new(tbar_base, :text=>'Button', :style=>'Toolbutton', +tb_btn = Ttk::Button.new(tbar_base, :text=>'Button', :style=>'Toolbutton', :command=>proc{text.insert(:end, "Button Pressed\n")}) -tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'Check', :style=>'Toolbutton', - :variable=>(check = TkVariable.new), +tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'Check', :style=>'Toolbutton', + :variable=>(check = TkVariable.new), :command=>proc{ text.insert(:end, "Check is #{check.value}\n") }) tb_mbtn = Ttk::Menubutton.new(tbar_base, :text=>'Menu') -tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families, +tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families, :state=>:readonly) tb_mbtn.menu(menu = Tk::Menu.new(tb_mbtn)) menu.add(:command, :label=>'Just', :command=>proc{text.insert(:end, "Just\n")}) menu.add(:command, :label=>'An', :command=>proc{text.insert(:end, "An\n")}) -menu.add(:command, :label=>'Example', +menu.add(:command, :label=>'Example', :command=>proc{text.insert(:end, "Example\n")}) tb_combo.bind(''){ text.font.family = tb_combo.get } ## Arrange contents -Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, +Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, :in=>contents, :padx=>2, :sticky=>'ns') Tk.grid(tbar_base, :sticky=>'ew') Tk.grid(sep, :sticky=>'ew') @@ -114,16 +114,16 @@ base_frame.grid_columnconfigure(text, :weight=>1) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'toolbar'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'toolbar'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $toolbar_demo.destroy $toolbar_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) Tk.grid(frame, :sticky=>'ew') diff --git a/ext/tk/sample/demos-en/tree.rb b/ext/tk/sample/demos-en/tree.rb index 0c7f0e71a2..cd62ba8c9b 100644 --- a/ext/tk/sample/demos-en/tree.rb +++ b/ext/tk/sample/demos-en/tree.rb @@ -6,7 +6,7 @@ # based on "Id: tree.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp" if defined?($tree_demo) && $tree_demo - $tree_demo.destroy + $tree_demo.destroy $tree_demo = nil end @@ -19,8 +19,8 @@ $tree_demo = TkToplevel.new {|w| base_frame = TkFrame.new($tree_demo).pack(:fill=>:both, :expand=>true) ## Explanatory text -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', - :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', + :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><:x) Ttk is the new Tk themed widget set. \ One of the widgets it includes is a tree widget, \ @@ -37,16 +37,16 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'tree'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'tree'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $tree_demo.destroy $tree_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -55,7 +55,7 @@ Ttk::Frame.new(base_frame) {|frame| ## Code to populate the roots of the tree (can be more than one on Windows) def populate_roots(tree) TkComm.simplelist(Tk.tk_call('file', 'volumes')).sort.each{|dir| - populate_tree(tree, tree.insert(nil, :end, :text=>dir, + populate_tree(tree, tree.insert(nil, :end, :text=>dir, :values=>[dir, 'directory'])) } end @@ -68,7 +68,7 @@ def populate_tree(tree, node) tree.delete(tree.children(node)) Dir.glob("#{path}/*").sort.each{|f| type = File.ftype(f) - id = tree.insert(node, :end, + id = tree.insert(node, :end, :text=>File.basename(f), :values=>[f, type]).id if type == 'directory' ## Make it so that this node is openable @@ -94,7 +94,7 @@ def populate_tree(tree, node) end ## Create the tree and set it up -tree = Ttk::Treeview.new(base_frame, :columns=>%w(fullpath type size), +tree = Ttk::Treeview.new(base_frame, :columns=>%w(fullpath type size), :displaycolumns=>['size']) if Tk.windowingsystem != 'aqua' vsb = tree.yscrollbar(Ttk::Scrollbar.new(base_frame)) diff --git a/ext/tk/sample/demos-en/ttkbut.rb b/ext/tk/sample/demos-en/ttkbut.rb index b5780f589a..a784efcc08 100644 --- a/ext/tk/sample/demos-en/ttkbut.rb +++ b/ext/tk/sample/demos-en/ttkbut.rb @@ -7,7 +7,7 @@ # based on "Id: ttkbut.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp" if defined?($ttkbut_demo) && $ttkbut_demo - $ttkbut_demo.destroy + $ttkbut_demo.destroy $ttkbut_demo = nil end @@ -19,7 +19,7 @@ $ttkbut_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkbut_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top, :fill=>:x) Ttk is the new Tk themed widget set. This is a Ttk themed label, \ and below are three groups of Ttk widgets in Ttk labelframes. \ @@ -34,11 +34,11 @@ EOL ## Add buttons for setting the theme buttons = Ttk::Labelframe.new(base_frame, :text=>'Buttons') # Ttk::Style.theme_names.each{|theme| -# Ttk::Button.new(buttons, :text=>theme, +# Ttk::Button.new(buttons, :text=>theme, # :command=>proc{Ttk::Style.theme_use theme}).pack(:pady=>2) # } Ttk.themes.each{|theme| - Ttk::Button.new(buttons, :text=>theme, + Ttk::Button.new(buttons, :text=>theme, :command=>proc{Ttk.set_theme theme}).pack(:pady=>2) } @@ -62,9 +62,9 @@ end ## Set up the checkbutton group checks = Ttk::Labelframe.new(base_frame, :text=>'Checkbuttons') enabled = TkVariable.new(true) -e = Ttk::Checkbutton.new(checks, :text=>'Enabled', :variable=>enabled, +e = Ttk::Checkbutton.new(checks, :text=>'Enabled', :variable=>enabled, :command=>proc{ - setState($ttkbut_demo, + setState($ttkbut_demo, ((enabled.bool)? "!disabled" : "disabled"), e) }) @@ -90,15 +90,15 @@ radios = Ttk::Labelframe.new(base_frame, :text=>'Radiobuttons') happyness = TkVariable.new -r1 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r1 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Great', :value=>'great') -r2 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r2 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Good', :value=>'good') -r3 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r3 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Ok', :value=>'ok') -r4 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r4 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Poor', :value=>'poor') -r5 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r5 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Awful', :value=>'awful') Tk.pack(r1, r2, r3, r4, r5, :fill=>:x, :padx=>3, :pady=>2) @@ -107,26 +107,26 @@ Tk.pack(r1, r2, r3, r4, r5, :fill=>:x, :padx=>3, :pady=>2) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Variables', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Variables', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, ['enabled', enabled], - ['cheese', cheese], ['tomato', tomato], - ['basil', basil], ['oregano', oregano], + showVars(base_frame, ['enabled', enabled], + ['cheese', cheese], ['tomato', tomato], + ['basil', basil], ['oregano', oregano], ['happyness', happyness]) - }), - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkbut'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + }), + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkbut'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $ttkbut_demo $ttkbut_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x, :expand=>true) diff --git a/ext/tk/sample/demos-en/ttkmenu.rb b/ext/tk/sample/demos-en/ttkmenu.rb index 75ecdb09c4..9399568313 100644 --- a/ext/tk/sample/demos-en/ttkmenu.rb +++ b/ext/tk/sample/demos-en/ttkmenu.rb @@ -6,7 +6,7 @@ # based on "Id: ttkmenu.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkmenu_demo) && $ttkmenu_demo - $ttkmenu_demo.destroy + $ttkmenu_demo.destroy $ttkmenu_demo = nil end @@ -18,7 +18,7 @@ $ttkmenu_demo = TkToplevel.new {|w| base_frame = Ttk::Frame.new($ttkmenu_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top, :fill=>:x) Ttk is the new Tk themed widget set, \ and one widget that is available in themed form is the menubutton. \ @@ -39,16 +39,16 @@ Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x) Ttk::Frame.new($ttkmenu_demo) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkmenu'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkmenu'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkmenu_demo.destroy $ttkmenu_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) diff --git a/ext/tk/sample/demos-en/ttknote.rb b/ext/tk/sample/demos-en/ttknote.rb index c2a22b447a..bc0c7b369a 100644 --- a/ext/tk/sample/demos-en/ttknote.rb +++ b/ext/tk/sample/demos-en/ttknote.rb @@ -6,7 +6,7 @@ # based on "Id: ttknote.tcl,v 1.5 2007/12/13 15:27:07 dgp Exp" if defined?($ttknote_demo) && $ttknote_demo - $ttknote_demo.destroy + $ttknote_demo.destroy $ttknote_demo = nil end @@ -20,16 +20,16 @@ $ttknote_demo = TkToplevel.new {|w| Ttk::Frame.new($ttknote_demo) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttknote'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttknote'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttknote_demo.destroy $ttknote_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -38,13 +38,13 @@ Ttk::Frame.new($ttknote_demo) {|frame| base_frame = Ttk::Frame.new($ttknote_demo).pack(:fill=>:both, :expand=>true) ## Make the notebook and set up Ctrl+Tab traversal -notebook = Ttk::Notebook.new(base_frame).pack(:fill=>:both, :expand=>true, +notebook = Ttk::Notebook.new(base_frame).pack(:fill=>:both, :expand=>true, :padx=>2, :pady=>3) notebook.enable_traversal ## Popuplate the first pane f_msg = Ttk::Frame.new(notebook) -msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'4i', +msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'4i', :justify=>:left, :anchor=>'n', :text=><'Neat!', :underline=>0, +msg_b = Ttk::Button.new(f_msg, :text=>'Neat!', :underline=>0, :command=>proc{ neat.value = 'Yeah, I know...' Tk.after_cancel(after_id) if after_id diff --git a/ext/tk/sample/demos-en/ttkpane.rb b/ext/tk/sample/demos-en/ttkpane.rb index 56df613db4..87c4dedeb2 100644 --- a/ext/tk/sample/demos-en/ttkpane.rb +++ b/ext/tk/sample/demos-en/ttkpane.rb @@ -5,7 +5,7 @@ # based on "Id: ttkpane.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkpane_demo) && $ttkpane_demo - $ttkpane_demo.destroy + $ttkpane_demo.destroy $ttkpane_demo = nil end @@ -17,7 +17,7 @@ $ttkpane_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkpane_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top, :fill=>:x) This demonstration shows off a nested set of themed paned windows. \ Their sizes can be changed by grabbing the area \ @@ -30,16 +30,16 @@ Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkpane'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkpane'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkpane_demo.destroy $ttkpane_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -59,25 +59,25 @@ if Tk.windowingsystem == 'aqua' end # Fill the button pane -Ttk::Button.new(left_top, :text=>'Press Me', +Ttk::Button.new(left_top, :text=>'Press Me', :command=>proc{ - Tk.messageBox(:type=>'ok', :icon=>'info', :message=>'Ouch!', - :detail=>'That hurt...', :parent=>base_frame, + Tk.messageBox(:type=>'ok', :icon=>'info', :message=>'Ouch!', + :detail=>'That hurt...', :parent=>base_frame, :title=>'Button Pressed') }).pack(:padx=>2, :pady=>5) zones_list = [ - [':Europe/Berlin'], - [':America/Argentina/Buenos_Aires', ':America/Buenos_Aires'], - [':Africa/Johannesburg'], - [':Europe/London'], - [':America/Los_Angeles'], + [':Europe/Berlin'], + [':America/Argentina/Buenos_Aires', ':America/Buenos_Aires'], + [':Africa/Johannesburg'], + [':Europe/London'], + [':America/Los_Angeles'], [':Europe/Moscow'], - [':America/New_York'], - [':Asia/Singapore'], - [':Australia/Sydney'], - [':Asia/Tokyo'], + [':America/New_York'], + [':Asia/Singapore'], + [':Australia/Sydney'], + [':Asia/Tokyo'], ] zones = [] @@ -155,7 +155,7 @@ time = TkVariable.new_hash case tzinfo when :tcl update_proc = proc{|now, tz, label| - time[label] = Tk.tk_call('clock', 'format', now.tv_sec, + time[label] = Tk.tk_call('clock', 'format', now.tv_sec, '-timezone', tz, '-format', '%T') } when :tzinfo @@ -176,7 +176,7 @@ end zones.each_with_index{|(zone, label), idx| Ttk::Separator.new(left_bot).pack(:fill=>:x) if idx > 0 Ttk::Label.new(left_bot, :text=>label, :anchor=>'w').pack(:fill=>:x) - Ttk::Label.new(left_bot, :textvariable=>time.ref(label), + Ttk::Label.new(left_bot, :textvariable=>time.ref(label), :anchor=>'w').pack(:fill=>:x) } diff --git a/ext/tk/sample/demos-en/ttkprogress.rb b/ext/tk/sample/demos-en/ttkprogress.rb index 3eb9a64a4a..c341a9385f 100644 --- a/ext/tk/sample/demos-en/ttkprogress.rb +++ b/ext/tk/sample/demos-en/ttkprogress.rb @@ -5,7 +5,7 @@ # based on "Id: ttkprogress.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkprogress_demo) && $ttkprogress_demo - $ttkprogress_demo.destroy + $ttkprogress_demo.destroy $ttkprogress_demo = nil end @@ -17,7 +17,7 @@ $ttkprogress_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkprogress_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=>Tk::UTF8_String.new(<:top, :fill=>:x) Below are two progress bars. \ The top one is a \\u201Cdeterminate\\u201D progress bar, \ @@ -32,16 +32,16 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkprogress'}), - Ttk::Button.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkprogress'}), + Ttk::Button.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkprogress_demo.destroy $ttkprogress_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -52,9 +52,9 @@ frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true) p1 = Ttk::Progressbar.new(frame, :mode=>:determinate) p2 = Ttk::Progressbar.new(frame, :mode=>:indeterminate) -start = Ttk::Button.new(frame, :text=>'Start Progress', +start = Ttk::Button.new(frame, :text=>'Start Progress', :command=>proc{ p1.start; p2.start }) -stop = Ttk::Button.new(frame, :text=>'Stop Progress', +stop = Ttk::Button.new(frame, :text=>'Stop Progress', :command=>proc{ p1.stop; p2.stop }) Tk.grid(p1, '-', :pady=>5, :padx=>10) diff --git a/ext/tk/sample/demos-en/twind.rb b/ext/tk/sample/demos-en/twind.rb index 65ee712ff7..60a345d0b4 100644 --- a/ext/tk/sample/demos-en/twind.rb +++ b/ext/tk/sample/demos-en/twind.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($twind_demo) && $twind_demo - $twind_demo.destroy + $twind_demo.destroy $twind_demo = nil end @@ -41,10 +41,10 @@ $twind_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame $twind_text = nil -TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, +TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, 'relief'=>'sunken') {|f| - $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font, - 'width'=>'70', 'height'=>35, 'wrap'=>'word', + $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font, + 'width'=>'70', 'height'=>35, 'wrap'=>'word', 'highlightthickness'=>0, 'borderwidth'=>0 ){|t| TkScrollbar.new(f) {|s| command proc{|*args| t.yview(*args)} @@ -53,12 +53,12 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, }.pack('expand'=>'yes', 'fill'=>'both') }.pack('expand'=>'yes', 'fill'=>'both') -# -$tag_center = TkTextTag.new($twind_text, +# +$tag_center = TkTextTag.new($twind_text, 'justify' =>'center', 'spacing1'=>'5m', 'spacing3'=>'5m' ) -$tag_buttons = TkTextTag.new($twind_text, +$tag_buttons = TkTextTag.new($twind_text, 'lmargin1'=>'1c', 'lmargin2'=>'1c', 'rmargin' =>'1c', @@ -71,7 +71,7 @@ $twind_text.insert('end', "it. These are called \"embedded windows\", ") $twind_text.insert('end', "and they can consist of arbitrary widgets. ") $twind_text.insert('end', "For example, here are two embedded button ") $twind_text.insert('end', "widgets. You can click on the first button to ") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { #text 'ON' text 'Turn On' @@ -81,7 +81,7 @@ TkTextWindow.new($twind_text, 'end', $twind_text.insert('end', " horizontal scrolling, which also turns off ") $twind_text.insert('end', "word wrapping. Or, you can click on the second ") $twind_text.insert('end', "button to\n") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { #text 'OFF' text 'Turn Off' @@ -91,7 +91,7 @@ TkTextWindow.new($twind_text, 'end', $twind_text.insert('end', " horizontal scrolling and turn back on word wrapping.\n\n") $twind_text.insert('end', "Or, here is another example. If you ") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text 'Click Here' command proc{textWindPlot $twind_text} @@ -102,7 +102,7 @@ $mark_plot = TkTextMark.new($twind_text, 'insert') $mark_plot.gravity='left' $twind_text.insert('end', " You can drag the data points around with the mouse, ") $twind_text.insert('end', "or you can click here to ") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text 'Delete' command proc{textWindDel $twind_text} @@ -124,7 +124,7 @@ $twind_text.insert('end', "changes the layout. Click on the button again ") $twind_text.insert('end', "to restore the short string.\n") -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) {|b| text 'Default' command proc{embDefBg $twind_text} @@ -133,7 +133,7 @@ TkTextWindow.new($twind_text, 'end', }, 'padx'=>3 ) embToggle = TkVariable.new('Short') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkCheckButton.new($twind_text) { textvariable embToggle indicatoron 0 @@ -144,25 +144,25 @@ TkTextWindow.new($twind_text, 'end', pady 5 padx 2 }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) -[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', - 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', - 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', - 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' +[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', + 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', + 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', + 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' ].each{|twind_color| - TkTextWindow.new($twind_text, 'end', + TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text twind_color cursor 'top_left_arrow' command proc{$twind_text.bg twind_color} }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) } -# +# def textWindOn (w,f) if defined? $twind_scroll begin @@ -216,39 +216,39 @@ def textWindPlot (t) TkcLine.new($twind_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind_plot, 100, 250, 100, 50, 'width'=>2) - TkcText.new($twind_plot, 225, 20, + TkcText.new($twind_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind_plot, x, 250, x, 245, 'width'=>2) - TkcText.new($twind_plot, x, 254, + TkcText.new($twind_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind_plot, 100, y, 105, y, 'width'=>2) - TkcText.new($twind_plot, 96, y, + TkcText.new($twind_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, + item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end - $twind_plot.itembind('point', 'Any-Enter', + $twind_plot.itembind('point', 'Any-Enter', proc{$twind_plot.itemconfigure 'current', 'fill', 'red'}) - $twind_plot.itembind('point', 'Any-Leave', + $twind_plot.itembind('point', 'Any-Leave', proc{$twind_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) - $twind_plot.itembind('point', '1', + $twind_plot.itembind('point', '1', proc{|x,y| embPlotDown $twind_plot,x,y}, "%x %y") - $twind_plot.itembind('point', 'ButtonRelease-1', + $twind_plot.itembind('point', 'ButtonRelease-1', proc{$twind_plot.dtag 'selected'}) - $twind_plot.bind('B1-Motion', + $twind_plot.bind('B1-Motion', proc{|x,y| embPlotMove $twind_plot,x,y}, "%x %y") while ($twind_text.get($mark_plot) =~ /[ \t\n]/) $twind_text.delete $mark_plot diff --git a/ext/tk/sample/demos-en/twind2.rb b/ext/tk/sample/demos-en/twind2.rb index 43990c1151..af7313dd82 100644 --- a/ext/tk/sample/demos-en/twind2.rb +++ b/ext/tk/sample/demos-en/twind2.rb @@ -4,7 +4,7 @@ # delete toplevel widget if defined?($twind2_demo) && $twind2_demo - $twind2_demo.destroy + $twind2_demo.destroy $twind2_demo = nil end @@ -19,20 +19,20 @@ base_frame = TkFrame.new($twind2_demo).pack(:fill=>:both, :expand=>true) # frame $twind2_buttons = TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'See Code', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'twind2'}), - TkButton.new(frame, :text=>'Dismiss', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'See Code', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'twind2'}), + TkButton.new(frame, :text=>'Dismiss', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $twind2_demo $twind2_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) } @@ -40,11 +40,11 @@ $twind2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame $twind2_text = nil -TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, +TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, 'relief'=>'sunken') {|f| $twind2_text = TkText.new(f, 'setgrid'=>true, 'font'=>$font, - # 'width'=>'70', 'height'=>35, 'wrap'=>'word', - 'width'=>'70', 'height'=>35, 'wrap'=>'char', + # 'width'=>'70', 'height'=>35, 'wrap'=>'word', + 'width'=>'70', 'height'=>35, 'wrap'=>'char', 'highlightthickness'=>0, 'borderwidth'=>0 ){|t| TkScrollbar.new(f) {|s| command proc{|*args| t.yview(*args)} @@ -54,11 +54,11 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, }.pack('expand'=>'yes', 'fill'=>'both') # text tags -$tag2_center = TkTextTag.new($twind2_text, +$tag2_center = TkTextTag.new($twind2_text, 'justify' =>'center', 'spacing1'=>'5m', 'spacing3'=>'5m' ) -$tag2_buttons = TkTextTag.new($twind2_text, +$tag2_buttons = TkTextTag.new($twind2_text, 'lmargin1'=>'1c', 'lmargin2'=>'1c', 'rmargin' =>'1c', @@ -67,7 +67,7 @@ $tag2_buttons = TkTextTag.new($twind2_text, 'spacing3'=>0 ) # insert text -$twind2_text.insert('end', +$twind2_text.insert('end', 'A text widget can contain many different kinds of items, ') $twind2_text.insert('end', "both active and passive. It can lay these out in various ") @@ -82,7 +82,7 @@ $twind2_text.insert('end', "it. These are called \"embedded windows\", ") $twind2_text.insert('end', "and they can consist of arbitrary widgets. ") $twind2_text.insert('end', "For example, here are two embedded button ") $twind2_text.insert('end', "widgets. You can click on the first button to ") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'ON' command proc{textWindOn2 $twind2_text,$twind2_buttons} @@ -91,30 +91,30 @@ TkTextWindow.new($twind2_text, 'end', $twind2_text.insert('end', " horizontal scrolling, which also turns off ") $twind2_text.insert('end', "word wrapping. Or, you can click on the second ") $twind2_text.insert('end', "button to\n") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'OFF' command proc{textWindOff2 $twind2_text} cursor 'top_left_arrow' }) -$twind2_text.insert('end', +$twind2_text.insert('end', " horizontal scrolling and turn back on word wrapping.\n\n") $twind2_text.insert('end', "Or, here is another example. If you ") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'Click Here' command proc{textWindPlot2 $twind2_text} cursor 'top_left_arrow' }) -$twind2_text.insert('end', +$twind2_text.insert('end', " a canvas displaying an x-y plot will appear right here.") $mark2_plot = TkTextMark.new($twind2_text, 'insert') $mark2_plot.gravity='left' -$twind2_text.insert('end', +$twind2_text.insert('end', " You can drag the data points around with the mouse, ") $twind2_text.insert('end', "or you can click here to ") -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text 'Delete' command proc{textWindDel2 $twind2_text} @@ -122,19 +122,19 @@ TkTextWindow.new($twind2_text, 'end', }) $twind2_text.insert('end', " the plot again.\n\n") -$twind2_text.insert('end', +$twind2_text.insert('end', "You may also find it useful to put embedded windows in ") -$twind2_text.insert('end', +$twind2_text.insert('end', "a text without any actual text. In this case the ") $twind2_text.insert('end', "text widget acts like a geometry manager. For ") -$twind2_text.insert('end', +$twind2_text.insert('end', "example, here is a collection of buttons laid out ") -$twind2_text.insert('end', +$twind2_text.insert('end', "neatly into rows by the text widget. These buttons ") -$twind2_text.insert('end', +$twind2_text.insert('end', "can be used to change the background color of the ") $twind2_text.insert('end', "text widget (\"Default\" restores the color to ") -$twind2_text.insert('end', +$twind2_text.insert('end', "its default). If you click on the button labeled ") $twind2_text.insert('end', "\"Short\", it changes to a longer string so that ") $twind2_text.insert('end', "you can see how the text widget automatically ") @@ -148,7 +148,7 @@ btn_default = TkButton.new($twind2_text) {|b| } TkTextWindow.new($twind2_text, 'end', 'window'=>btn_default, 'padx'=>3) embToggle = TkVariable.new('Short') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkCheckButton.new($twind2_text) { textvariable embToggle indicatoron 0 @@ -159,21 +159,21 @@ TkTextWindow.new($twind2_text, 'end', pady 5 padx 2 }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) -[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', - 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', - 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', - 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' +[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', + 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', + 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', + 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' ].each{|twind_color| - TkTextWindow.new($twind2_text, 'end', + TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text twind_color cursor 'top_left_arrow' command proc{$twind2_text.bg twind_color} }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) } @@ -187,54 +187,54 @@ $text_normal2['pad'] = $twind2_text.cget('padx') $twind2_text.insert('end', "\nYou can also change the usual border width and ") $twind2_text.insert('end', "highlightthickness and padding.\n") -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big borders", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big borders", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigB2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Small borders", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Small borders", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallB2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big highlight", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big highlight", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigH2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text, :text=>"Small highlight", - :cursor=>'top_left_arrow', + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallH2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big pad", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big pad", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigP2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Small pad", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Small pad", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallP2 $twind2_text })) -$twind2_text.insert('end', +$twind2_text.insert('end', "\n\nFinally, images fit comfortably in text widgets too:") -TkTextImage.new($twind2_text, 'end', +TkTextImage.new($twind2_text, 'end', 'image'=>TkBitmapImage.new(:file=>[ - $demo_dir, '..', + $demo_dir, '..', 'images', 'face.xbm' ].join(File::Separator))) @@ -309,39 +309,39 @@ def textWindPlot2 (t) TkcLine.new($twind2_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind2_plot, 100, 250, 100, 50, 'width'=>2) - TkcText.new($twind2_plot, 225, 20, + TkcText.new($twind2_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind2_plot, x, 250, x, 245, 'width'=>2) - TkcText.new($twind2_plot, x, 254, + TkcText.new($twind2_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind2_plot, 100, y, 105, y, 'width'=>2) - TkcText.new($twind2_plot, 96, y, + TkcText.new($twind2_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, + item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end - $twind2_plot.itembind('point', 'Any-Enter', + $twind2_plot.itembind('point', 'Any-Enter', proc{$twind2_plot.itemconfigure 'current', 'fill', 'red'}) - $twind2_plot.itembind('point', 'Any-Leave', + $twind2_plot.itembind('point', 'Any-Leave', proc{$twind2_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) - $twind2_plot.itembind('point', '1', + $twind2_plot.itembind('point', '1', proc{|x,y| embPlotDown2 $twind2_plot,x,y}, "%x %y") - $twind2_plot.itembind('point', 'ButtonRelease-1', + $twind2_plot.itembind('point', 'ButtonRelease-1', proc{$twind2_plot.dtag 'selected'}) - $twind2_plot.bind('B1-Motion', + $twind2_plot.bind('B1-Motion', proc{|x,y| embPlotMove2 $twind2_plot,x,y}, "%x %y") while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/) $twind2_text.delete $mark2_plot diff --git a/ext/tk/sample/demos-en/unicodeout.rb b/ext/tk/sample/demos-en/unicodeout.rb index 9c230a2536..ee7b5afa15 100644 --- a/ext/tk/sample/demos-en/unicodeout.rb +++ b/ext/tk/sample/demos-en/unicodeout.rb @@ -6,7 +6,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($unicodeout_demo) && $unicodeout_demo - $unicodeout_demo.destroy + $unicodeout_demo.destroy $unicodeout_demo = nil end @@ -18,8 +18,8 @@ $unicodeout_demo = TkToplevel.new {|w| base_frame = TkFrame.new($unicodeout_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5.4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5.4i', :justify=>:left, :text=><:top) This is a sample of Tk's support for languages that use non-Western \ character sets. However, what you will actually see below depends \ @@ -32,10 +32,10 @@ the definition of @@font on the Unicodeout_SampleFrame class. The strings are written in Tcl using UNICODE characters \ using the \\uXXXX escape so as to do so in a portable fashion. -ATTENTION: +ATTENTION: The strings are converted to the encoded string objects \ (completed to rewrite Tcl's escapes) by Tk::UTF8_String method. \ -And the Tk::UTF8_String objects are passed to the label widgets. +And the Tk::UTF8_String objects are passed to the label widgets. EOL TkFrame.new(base_frame){|f| @@ -51,8 +51,8 @@ TkFrame.new(base_frame){|f| }).pack(:side=>:left, :expand=>true) } -wait_msg = TkLabel.new(base_frame, - :text=>"Please wait while loading fonts...", +wait_msg = TkLabel.new(base_frame, + :text=>"Please wait while loading fonts...", :font=>"Helvetica 12 italic").pack class Unicodeout_SampleFrame < TkFrame @@ -72,10 +72,10 @@ class Unicodeout_SampleFrame < TkFrame def add_sample(lang, *args) sample_txt = Tk::UTF8_String(args.join('')) - l = TkLabel.new(self, :font=>@@font, :text=>lang+':', + l = TkLabel.new(self, :font=>@@font, :text=>lang+':', :anchor=>:nw, :pady=>0) - #s = TkLabel.new(self, :font=>@@font, :text=>sample_txt, - s = TkLabel.new(self, :font=>TkFont.new(@@font), :text=>sample_txt, + #s = TkLabel.new(self, :font=>@@font, :text=>sample_txt, + s = TkLabel.new(self, :font=>TkFont.new(@@font), :text=>sample_txt, :anchor=>:nw, :width=>30, :pady=>0) Tk.grid(l, s, :sticky=>:ew, :pady=>0) l.grid_config(:padx, '1m') @@ -91,23 +91,23 @@ oldCursor = $unicodeout_demo.cursor $unicodeout_demo.cursor('watch') Tk.update -f.add_sample('Arabic', - '\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94', +f.add_sample('Arabic', + '\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94', '\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D') f.add_sample('Trad. Chinese', '\u4E2D\u570B\u7684\u6F22\u5B57') f.add_sample('Simpl. Chinese', '\u6C49\u8BED') -f.add_sample('Greek', - '\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE ', +f.add_sample('Greek', + '\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE ', '\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1') -f.add_sample('Hebrew', - '\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 ', +f.add_sample('Hebrew', + '\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 ', '\u05DC\u05D9\u05D0\u05E8\u05E9\u05D9') -f.add_sample('Japanese', - '\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, ', +f.add_sample('Japanese', + '\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, ', '\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA') f.add_sample('Korean', '\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00') -f.add_sample('Russian', - '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 ', +f.add_sample('Russian', + '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 ', '\u044F\u0437\u044B\u043A') wait_msg.destroy diff --git a/ext/tk/sample/demos-en/widget b/ext/tk/sample/demos-en/widget index 9a0605d8b9..250c589116 100644 --- a/ext/tk/sample/demos-en/widget +++ b/ext/tk/sample/demos-en/widget @@ -170,9 +170,12 @@ else } scr.command(proc{|*args| txt.yview(*args)}) # txt.pack('in'=>textFrame, 'expand'=>'yes', 'fill'=>'both', 'padx'=>1) - txt.pack('in'=>textFrame, 'expand'=>'yes', 'fill'=>'both') +# txt.pack('in'=>textFrame, 'expand'=>'yes', 'fill'=>'both') # textFrame.pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>2) textFrame.pack('expand'=>'yes', 'fill'=>'both') + # $root.withdraw.deiconify + Tk.update_idletasks + txt.pack('in'=>textFrame, 'expand'=>'yes', 'fill'=>'both') statusBar = TkFrame.new($root) {|f| if $tk_version =~ /^4.*/ @@ -1035,7 +1038,7 @@ end # def aboutBox Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo', - 'message'=>"Ruby/Tk widget demonstration Ver.1.7.0-en\n\n" + + 'message'=>"Ruby/Tk widget demonstration Ver.1.7.1-en\n\n" + "based on demos of Tk8.1 -- 8.5 " + "( Copyright of Tcl/Tk demos:: " + "(c) 1996-1997 Sun Microsystems, Inc. / " + diff --git a/ext/tk/sample/demos-jp/anilabel.rb b/ext/tk/sample/demos-jp/anilabel.rb index aee57f9f6a..d2f5b12041 100644 --- a/ext/tk/sample/demos-jp/anilabel.rb +++ b/ext/tk/sample/demos-jp/anilabel.rb @@ -6,7 +6,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($anilabel_demo) && $anilabel_demo - $anilabel_demo.destroy + $anilabel_demo.destroy $anilabel_demo = nil end @@ -50,7 +50,7 @@ TkFrame.new(base_frame) {|frame| # label demo Íѥե졼¥àÀ¸À® f_left = TkLabelFrame.new(base_frame, :text=>'Scrolling Texts') f_right = TkLabelFrame.new(base_frame, :text=>'GIF Image') -Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both', +Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both', 'padx'=>10, 'pady'=>10) # animated label @@ -88,7 +88,7 @@ class AnimatedImageLabel < AnimatedTextLabel @btag.bind_append('Destroy'){ if @destroy_image begin - self.image.delete + self.image.delete rescue end end @@ -124,13 +124,13 @@ class AnimatedImageLabel < AnimatedTextLabel end # label À¸À® -l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge, +l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge, :font=>{:family=>'Courier', :size=>10}) -l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove, +l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove, :font=>{:family=>'Courier', :size=>10}) -l3 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:flat, +l3 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:flat, :font=>{:family=>'Courier', :size=>10}, :width=>18) -Tk.pack(l1, l2, l3, +Tk.pack(l1, l2, l3, :side=>:top, :expand=>true, :anchor=>:w, :padx=>10, :pady=>10) limg = AnimatedImageLabel.new(f_right, :borderwidth=>0) diff --git a/ext/tk/sample/demos-jp/aniwave.rb b/ext/tk/sample/demos-jp/aniwave.rb index 8fa14f65fe..973c1be1e9 100644 --- a/ext/tk/sample/demos-jp/aniwave.rb +++ b/ext/tk/sample/demos-jp/aniwave.rb @@ -6,7 +6,7 @@ # destroy toplevel widget for this demo script if defined?($aniwave_demo) && $aniwave_demo - $aniwave_demo.destroy + $aniwave_demo.destroy $aniwave_demo = nil end @@ -53,11 +53,11 @@ class AnimatedWaveDemo @direction = dir # create canvas widget - @c = TkCanvas.new(frame, :width=>300, :height=>200, + @c = TkCanvas.new(frame, :width=>300, :height=>200, :background=>'black') @c.pack(:padx=>10, :pady=>10, :expand=>true) - # Creates a coordinates list of a wave. + # Creates a coordinates list of a wave. @waveCoords = [] @backupCoords = [] n = 0 @@ -69,10 +69,10 @@ class AnimatedWaveDemo # Create a smoothed line and arrange for its coordinates to be the # contents of the variable waveCoords. - @line = TkcLine.new(@c, @waveCoords, + @line = TkcLine.new(@c, @waveCoords, :width=>1, :fill=>'green', :smooth=>true) - # Main animation "loop". + # Main animation "loop". # Theoretically 100 frames-per-second (==10ms between frames) @timer = TkTimer.new(10){ basicMotion; reverser } diff --git a/ext/tk/sample/demos-jp/arrow.rb b/ext/tk/sample/demos-jp/arrow.rb index 3c49e67b09..a1694d019d 100644 --- a/ext/tk/sample/demos-jp/arrow.rb +++ b/ext/tk/sample/demos-jp/arrow.rb @@ -25,65 +25,65 @@ def arrowSetup(c) # Create the arrow and outline. c.delete('all') - TkcLine.new(c, v.x1, v.y, v.x2, v.y, - { 'width'=>10 * v.width, - 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c], - 'arrow'=>'last' + TkcLine.new(c, v.x1, v.y, v.x2, v.y, + { 'width'=>10 * v.width, + 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c], + 'arrow'=>'last' }.update(v.bigLineStyle) ) xtip = v.x2 - 10*v.b deltaY = 10*v.c + 5*v.width - TkcLine.new(c, v.x2, v.y, xtip, v.y + deltaY, - v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y, + TkcLine.new(c, v.x2, v.y, xtip, v.y + deltaY, + v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y, 'width'=>2, 'capstyle'=>'round', 'joinstyle'=>'round') # Create the boxes for reshaping the line and arrowhead. - TkcRectangle.new(c, v.x2-10*v.a-5, v.y-5, v.x2-10*v.a+5, v.y+5, + TkcRectangle.new(c, v.x2-10*v.a-5, v.y-5, v.x2-10*v.a+5, v.y+5, {'tags'=>['box1', $arrowTag_box]}.update(v.boxStyle) ) - TkcRectangle.new(c, xtip-5, v.y-deltaY-5, xtip+5, v.y-deltaY+5, + TkcRectangle.new(c, xtip-5, v.y-deltaY-5, xtip+5, v.y-deltaY+5, {'tags'=>['box2', $arrowTag_box]}.update(v.boxStyle) ) - TkcRectangle.new(c, v.x1-5, v.y-5*v.width-5, v.x1+5, v.y-5*v.width+5, + TkcRectangle.new(c, v.x1-5, v.y-5*v.width-5, v.x1+5, v.y-5*v.width+5, {'tags'=>['box3', $arrowTag_box]}.update(v.boxStyle) ) c.itemconfigure cur, v.activeStyle if cur # Create three arrows in actual size with the same parameters TkcLine.new(c, v.x2+50, 0, v.x2+50, 1000, 'width'=>2) tmp = v.x2+100 - TkcLine.new(c, tmp, v.y-125, tmp, v.y-75, 'width'=>v.width, + TkcLine.new(c, tmp, v.y-125, tmp, v.y-75, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - TkcLine.new(c, tmp-25, v.y, tmp+25, v.y, 'width'=>v.width, + TkcLine.new(c, tmp-25, v.y, tmp+25, v.y, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - TkcLine.new(c, tmp-25, v.y+75, tmp+25, v.y+125, 'width'=>v.width, + TkcLine.new(c, tmp-25, v.y+75, tmp+25, v.y+125, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - # Create a bunch of other arrows and text items showing the + # Create a bunch of other arrows and text items showing the # current dimensions. tmp = v.x2+10 - TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y-deltaY, + TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y-deltaY, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2+15, v.y-deltaY+5*v.c, 'text'=>v.c, 'anchor'=>'w') tmp = v.x1-10 - TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y+5*v.width, + TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y+5*v.width, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x1-15, v.y, 'text'=>v.width, 'anchor'=>'e') tmp = v.y+5*v.width+10*v.c+10 - TkcLine.new(c, v.x2-10*v.a, tmp, v.x2, tmp, + TkcLine.new(c, v.x2-10*v.a, tmp, v.x2, tmp, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2-5*v.a, tmp+5, 'text'=>v.a, 'anchor'=>'n') tmp = tmp+25 - TkcLine.new(c, v.x2-10*v.b, tmp, v.x2, tmp, + TkcLine.new(c, v.x2-10*v.b, tmp, v.x2, tmp, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2-5*v.b, tmp+5, 'text'=>v.b, 'anchor'=>'n') if $tk_version =~ /^4.*/ - TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', + TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*') - TkcText.new(c, v.x1, 330, + TkcText.new(c, v.x1, 330, 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]",'anchor'=>'w', 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*') else - TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', + TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', 'font'=>'Helvetica 18') - TkcText.new(c, v.x1, 330, + TkcText.new(c, v.x1, 330, 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]", 'anchor'=>'w', 'font'=>'Helvetica 18') end @@ -93,7 +93,7 @@ end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($arrow_demo) && $arrow_demo - $arrow_demo.destroy + $arrow_demo.destroy $arrow_demo = nil end @@ -107,7 +107,7 @@ $arrow_demo = TkToplevel.new {|w| base_frame = TkFrame.new($arrow_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', 'text'=>"¤³¤Î widget ¤Ç¡¢¥­¥ã¥ó¥Ð¥¹¤Ç»È¤ï¤ì¤ë¥é¥¤¥ó¤Ë¤Ä¤¤¤ÆÍÍ¡¹¤ÊÉý¤äÌð°õ¤ÎƬ¤Î·Á¤ò»î¤·¤Æ¤ß¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£Àþ¤ÎÉý¤äÌð°õ¤Î·Á¤òÊѤ¨¤ë¤Ë¤Ï¡¢³ÈÂ礵¤ì¤¿Ìð°õ¤Ë¤Ä¤¤¤Æ¤¤¤ë 3¤Ä¤Î»Í³Ñ¤ò¥É¥é¥Ã¥°¤·¤Æ¤¯¤À¤µ¤¤¡£±¦Â¦¤ÎÌð°õ¤ÏÉáÄ̤ÎÂ礭¤µ¤Ç¤Î¥µ¥ó¥×¥ë¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£²¼¤Î¥Æ¥­¥¹¥È¤Ï¥é¥¤¥ó¥¢¥¤¥Æ¥à¤ËÂФ¹¤ëÀßÄꥪ¥×¥·¥ç¥ó¤Ç¤¹¡£"){ pack('side'=>'top') } @@ -132,14 +132,14 @@ $arrow_buttons = TkFrame.new(base_frame) {|frame| $arrow_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # canvas ÀßÄê -$arrow_canvas = TkCanvas.new(base_frame, 'width'=>500, 'height'=>350, +$arrow_canvas = TkCanvas.new(base_frame, 'width'=>500, 'height'=>350, 'relief'=>'sunken', 'borderwidth'=>2) $arrow_canvas.pack('expand'=>'yes', 'fill'=>'both') # ÃÍÀßÄê unless Struct.const_defined?("ArrowInfo") - $demo_arrowInfo = Struct.new("ArrowInfo", :a, :b, :c, :width, :motionProc, - :x1, :x2, :y, :smallTips, :count, + $demo_arrowInfo = Struct.new("ArrowInfo", :a, :b, :c, :width, :motionProc, + :x1, :x2, :y, :smallTips, :count, :bigLineStyle, :boxStyle, :activeStyle).new end $demo_arrowInfo.a = 8 @@ -157,7 +157,7 @@ if TkWinfo.depth($arrow_canvas) > 1 $demo_arrowInfo.boxStyle = {'fill'=>'', 'outline'=>'black', 'width'=>1} $demo_arrowInfo.activeStyle = {'fill'=>'red', 'outline'=>'black', 'width'=>1} else - $demo_arrowInfo.bigLineStyle = {'fill'=>'black', + $demo_arrowInfo.bigLineStyle = {'fill'=>'black', 'stipple'=>'@'+[$demo_dir,'..','images','grey.25'].join(File::Separator)} $demo_arrowInfo.boxStyle = {'fill'=>'', 'outline'=>'black', 'width'=>1} $demo_arrowInfo.activeStyle = {'fill'=>'black','outline'=>'black','width'=>1} @@ -168,16 +168,16 @@ $arrowTag_box.bind('Enter', proc{$arrow_canvas.itemconfigure('current', $demo_ar $arrowTag_box.bind('Leave', proc{$arrow_canvas.itemconfigure('current', $demo_arrowInfo.boxStyle)}) $arrowTag_box.bind('B1-Enter', proc{}) $arrowTag_box.bind('B1-Leave', proc{}) -$arrow_canvas.itembind('box1', '1', +$arrow_canvas.itembind('box1', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove1 $arrow_canvas, x, y}}) -$arrow_canvas.itembind('box2', '1', +$arrow_canvas.itembind('box2', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove2 $arrow_canvas, x, y}}) -$arrow_canvas.itembind('box3', '1', +$arrow_canvas.itembind('box3', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove3 $arrow_canvas, x, y}}) -$arrowTag_box.bind('B1-Motion', +$arrowTag_box.bind('B1-Motion', proc{|x,y| $demo_arrowInfo.motionProc.call(x,y)}, "%x %y") $arrow_canvas.bind('Any-ButtonRelease-1', proc{arrowSetup $arrow_canvas}) diff --git a/ext/tk/sample/demos-jp/bind.rb b/ext/tk/sample/demos-jp/bind.rb index a1bcfdd2e7..99e5c1718c 100644 --- a/ext/tk/sample/demos-jp/bind.rb +++ b/ext/tk/sample/demos-jp/bind.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($bind_demo) && $bind_demo - $bind_demo.destroy + $bind_demo.destroy $bind_demo = nil end @@ -59,7 +59,7 @@ txt = TkText.new(base_frame){|t| # ¥¹¥¿¥¤¥ëÀßÄê if TkWinfo.depth($root).to_i > 1 - tagstyle_bold = {'background'=>'#43ce80', 'relief'=>'raised', + tagstyle_bold = {'background'=>'#43ce80', 'relief'=>'raised', 'borderwidth'=>1} tagstyle_normal = {'background'=>'', 'relief'=>'flat'} else @@ -75,44 +75,44 @@ txt = TkText.new(base_frame){|t| insert('end', "\n\n") insert('end', '2. ´Êñ¤Ê 2¼¡¸µ¤Î¥×¥í¥Ã¥È¡£¥Ç¡¼¥¿¤òɽ¤¹ÅÀ¤òư¤«¤¹¤³¤È¤¬¤Ç¤­¤ë¡£', (d2 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '3. ¥Æ¥­¥¹¥È¥¢¥¤¥Æ¥à¤Î¥¢¥ó¥«¡¼¤È¹Ô·¤¨¡£', + insert('end', '3. ¥Æ¥­¥¹¥È¥¢¥¤¥Æ¥à¤Î¥¢¥ó¥«¡¼¤È¹Ô·¤¨¡£', (d3 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '4. ¥é¥¤¥ó¥¢¥¤¥Æ¥à¤Î¤¿¤á¤ÎÌð°õ¤ÎƬ¤Î·Á¤Î¥¨¥Ç¥£¥¿¡£', + insert('end', '4. ¥é¥¤¥ó¥¢¥¤¥Æ¥à¤Î¤¿¤á¤ÎÌð°õ¤ÎƬ¤Î·Á¤Î¥¨¥Ç¥£¥¿¡£', (d4 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '5. ¥¿¥Ö¥¹¥È¥Ã¥×¤òÊѹ¹¤¹¤ë¤¿¤á¤Îµ¡Ç½¤Ä¤­¤Î¥ë¡¼¥é¡¼¡£', + insert('end', '5. ¥¿¥Ö¥¹¥È¥Ã¥×¤òÊѹ¹¤¹¤ë¤¿¤á¤Îµ¡Ç½¤Ä¤­¤Î¥ë¡¼¥é¡¼¡£', (d5 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', - '6. ¥­¥ã¥ó¥Ð¥¹¤¬¤É¤¦¤ä¤Ã¤Æ¥¹¥¯¥í¡¼¥ë¤¹¤ë¤Î¤«¤ò¼¨¤¹¥°¥ê¥Ã¥É¡£', + insert('end', + '6. ¥­¥ã¥ó¥Ð¥¹¤¬¤É¤¦¤ä¤Ã¤Æ¥¹¥¯¥í¡¼¥ë¤¹¤ë¤Î¤«¤ò¼¨¤¹¥°¥ê¥Ã¥É¡£', (d6 = TkTextTag.new(t)) ) # binding [d1, d2, d3, d4, d5, d6].each{|tag| tag_binding_for_bind_demo(tag, tagstyle_bold, tagstyle_normal) } - d1.bind('1', + d1.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'items.rb'].join(File::Separator)}`, 'items.rb') }) - d2.bind('1', + d2.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'plot.rb'].join(File::Separator)}`, 'plot.rb') }) - d3.bind('1', + d3.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'ctext.rb'].join(File::Separator)}`, 'ctext.rb') }) - d4.bind('1', + d4.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'arrow.rb'].join(File::Separator)}`, 'arrow.rb') }) - d5.bind('1', + d5.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'ruler.rb'].join(File::Separator)}`, 'ruler.rb') }) - d6.bind('1', + d6.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'cscroll.rb'].join(File::Separator)}`, 'cscroll.rb') }) diff --git a/ext/tk/sample/demos-jp/bitmap.rb b/ext/tk/sample/demos-jp/bitmap.rb index b6b0e54bbe..1193e8de24 100644 --- a/ext/tk/sample/demos-jp/bitmap.rb +++ b/ext/tk/sample/demos-jp/bitmap.rb @@ -15,7 +15,7 @@ def bitmapRow(w,*args) TkFrame.new(w){|row| pack('side'=>'top', 'fill'=>'both') - for bitmap in args + for bitmap in args TkFrame.new(row){|base| pack('side'=>'left', 'fill'=>'both', 'pady'=>'.25c', 'padx'=>'.25c') TkLabel.new(base, 'text'=>bitmap, 'width'=>9).pack('side'=>'bottom') @@ -27,7 +27,7 @@ end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($bitmap_demo) && $bitmap_demo - $bitmap_demo.destroy + $bitmap_demo.destroy $bitmap_demo = nil end @@ -41,7 +41,7 @@ $bitmap_demo = TkToplevel.new {|w| base_frame = TkFrame.new($bitmap_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left', +TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left', 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¡¢Tk ¤ËÁȤ߹þ¤Þ¤ì¤¿¤¹¤Ù¤Æ¤Î¥Ó¥Ã¥È¥Þ¥Ã¥×¤¬¡¢¤½¤ì¤é¤Î̾Á°¤È¶¦¤Ëɽ¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Tcl ¤Î¥¹¥¯¥ê¥×¥ÈÃæ¤Ç¤Ï¡¢¤½¤ì¤¾¤ì¤Î̾Á°¤òÍѤ¤¤Æ»²¾È¤·¤Þ¤¹¡£"){ pack('side'=>'top') } diff --git a/ext/tk/sample/demos-jp/button.rb b/ext/tk/sample/demos-jp/button.rb index 18e42008c9..87ced45810 100644 --- a/ext/tk/sample/demos-jp/button.rb +++ b/ext/tk/sample/demos-jp/button.rb @@ -6,7 +6,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($button_demo) && $button_demo - $button_demo.destroy + $button_demo.destroy $button_demo = nil end diff --git a/ext/tk/sample/demos-jp/check.rb b/ext/tk/sample/demos-jp/check.rb index b953e7f623..762b99778b 100644 --- a/ext/tk/sample/demos-jp/check.rb +++ b/ext/tk/sample/demos-jp/check.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($check_demo) && $check_demo - $check_demo.destroy + $check_demo.destroy $check_demo = nil end @@ -54,7 +54,7 @@ TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'ÊÑ¿ô»²¾È' command proc{ - showVars(base_frame, + showVars(base_frame, ['wipers', wipers], ['brakes', brakes], ['sober', sober]) } }.pack('side'=>'left', 'expand'=>'yes') diff --git a/ext/tk/sample/demos-jp/check2.rb b/ext/tk/sample/demos-jp/check2.rb index 7f7cb9e932..9f845183f3 100644 --- a/ext/tk/sample/demos-jp/check2.rb +++ b/ext/tk/sample/demos-jp/check2.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($check2_demo) && $check2_demo - $check2_demo.destroy + $check2_demo.destroy $check2_demo = nil end @@ -35,35 +35,35 @@ sober = TkVariable.new(0) # frame À¸À® TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars($check2_demo, - ['safety', safety], ['wipers', wipers], + showVars($check2_demo, + ['safety', safety], ['wipers', wipers], ['brakes', brakes], ['sober', sober]) - }), - TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'check2'}), - TkButton.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + }), + TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'check2'}), + TkButton.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $check2_demo $check2_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) }.pack('side'=>'bottom', 'fill'=>'x') # checkbutton À¸À® -TkCheckButton.new(base_frame, :text=>'°ÂÁ´À­¸¡ºº', :variable=>safety, - :relief=>:flat, :onvalue=>'all', :offvalue=>'none', +TkCheckButton.new(base_frame, :text=>'°ÂÁ´À­¸¡ºº', :variable=>safety, + :relief=>:flat, :onvalue=>'all', :offvalue=>'none', :tristatevalue=>'partial'){ pack('side'=>'top', 'pady'=>2, 'anchor'=>'w') } @@ -71,7 +71,7 @@ TkCheckButton.new(base_frame, :text=>' [ TkCheckButton.new(base_frame, 'text'=>'¥ï¥¤¥Ñ¡¼ OK', 'variable'=>wipers), TkCheckButton.new(base_frame, 'text'=>'¥Ö¥ì¡¼¥­ OK', 'variable'=>brakes), TkCheckButton.new(base_frame, 'text'=>'±¿Å¾¼ê ÁÇÌÌ', 'variable'=>sober) -].each{|w| +].each{|w| w.relief('flat') w.pack('side'=>'top', 'padx'=>15, 'pady'=>2, 'anchor'=>'w') } diff --git a/ext/tk/sample/demos-jp/clrpick.rb b/ext/tk/sample/demos-jp/clrpick.rb index ce6b99ab94..c188723c5a 100644 --- a/ext/tk/sample/demos-jp/clrpick.rb +++ b/ext/tk/sample/demos-jp/clrpick.rb @@ -7,7 +7,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($clrpick_demo) && $clrpick_demo - $clrpick_demo.destroy + $clrpick_demo.destroy $clrpick_demo = nil end @@ -47,7 +47,7 @@ Tk::Frame.new($clrpick_demo) {|frame| # button À¸À® # TkButton.new($clrpick_demo, 'text'=>'ÇØ·Ê¿§¤òÀßÄê ...') {|b| Tk::Button.new($clrpick_demo, 'text'=>'ÇØ·Ê¿§¤òÀßÄê ...') {|b| - command(proc{setColor $clrpick_demo, b, 'background', + command(proc{setColor $clrpick_demo, b, 'background', ['background', 'highlightbackground']}) pack('side'=>'top', 'anchor'=>'c', 'pady'=>'2m') } @@ -61,7 +61,7 @@ Tk::Button.new($clrpick_demo, 'text'=>' def setColor(w,button,name,options) w.grab initialColor = button[name] - color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, + color = Tk.chooseColor('title'=>"Choose a #{name} color", 'parent'=>w, 'initialcolor'=>initialColor) if color != "" setColor_helper(w,options,color) diff --git a/ext/tk/sample/demos-jp/colors.rb b/ext/tk/sample/demos-jp/colors.rb index 91817a947b..9fcf0333b5 100644 --- a/ext/tk/sample/demos-jp/colors.rb +++ b/ext/tk/sample/demos-jp/colors.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($colors_demo) && $colors_demo - $colors_demo.destroy + $colors_demo.destroy $colors_demo = nil end diff --git a/ext/tk/sample/demos-jp/combo.rb b/ext/tk/sample/demos-jp/combo.rb index da00d712ba..2059662d48 100644 --- a/ext/tk/sample/demos-jp/combo.rb +++ b/ext/tk/sample/demos-jp/combo.rb @@ -7,7 +7,7 @@ # based on "Id: combo.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($combo_demo) && $combo_demo - $combo_demo.destroy + $combo_demo.destroy $combo_demo = nil end @@ -19,7 +19,7 @@ $combo_demo = TkToplevel.new {|w| base_frame = TkFrame.new($combo_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><:top, :fill=>:x) °Ê²¼¤Ç¤Ï3¼ïÎà¤Î¥³¥ó¥Ü¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥\ ºÇ½é¤Î¤â¤Î¤Ï¡¤¥¨¥ó¥È¥ê¥¦¥£¥¸¥§¥Ã¥È¤ÈƱ¤¸Íͤˡ¤\ @@ -42,24 +42,24 @@ ozCity = TkVariable.new Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'ÊÑ¿ô»²¾È', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'ÊÑ¿ô»²¾È', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, - ['firstVariable', firstValue], - ['secondVariable', secondValue], + showVars(base_frame, + ['firstVariable', firstValue], + ['secondVariable', secondValue], ['ozCity', ozCity]) - }), - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'combo'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + }), + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'combo'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $combo_demo.destroy $combo_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -68,7 +68,7 @@ Ttk::Frame.new(base_frame) {|frame| frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true) australianCities = [ - '¥­¥ã¥ó¥Ù¥é', '¥·¥É¥Ë¡¼', '¥á¥ë¥Ü¥ë¥ó', '¥Ñ¡¼¥¹', '¥¢¥Ç¥ì¡¼¥É', + '¥­¥ã¥ó¥Ù¥é', '¥·¥É¥Ë¡¼', '¥á¥ë¥Ü¥ë¥ó', '¥Ñ¡¼¥¹', '¥¢¥Ç¥ì¡¼¥É', '¥Ö¥ê¥¹¥Ù¡¼¥ó', '¥Û¥Ð¡¼¥È', '¥À¡¼¥¦¥£¥ó', '¥¢¥ê¥¹ ¥¹¥×¥ê¥ó¥°¥¹' ] @@ -82,17 +82,17 @@ Tk.pack(Ttk::Labelframe.new(frame, :text=>'Fully Editable'){|f| w.values <<= w.value unless w.values.include?(w.value) } }.pack(:pady=>5, :padx=>10) - }, + }, Ttk::LabelFrame.new(frame, :text=>'Disabled'){|f| Ttk::Combobox.new(f, :textvariable=>secondValue, :state=>:disabled) . pack(:pady=>5, :padx=>10) - }, + }, Ttk::LabelFrame.new(frame, :text=>'Defined List Only'){|f| - Ttk::Combobox.new(f, :textvariable=>ozCity, :state=>:readonly, + Ttk::Combobox.new(f, :textvariable=>ozCity, :state=>:readonly, :values=>australianCities) . pack(:pady=>5, :padx=>10) - }, + }, :side=>:top, :pady=>5, :padx=>10) diff --git a/ext/tk/sample/demos-jp/cscroll.rb b/ext/tk/sample/demos-jp/cscroll.rb index 845952679a..0a31f28b5e 100644 --- a/ext/tk/sample/demos-jp/cscroll.rb +++ b/ext/tk/sample/demos-jp/cscroll.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($cscroll_demo) && $cscroll_demo - $cscroll_demo.destroy + $cscroll_demo.destroy $cscroll_demo = nil end @@ -19,7 +19,7 @@ $cscroll_demo = TkToplevel.new {|w| base_frame = TkFrame.new($cscroll_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥¹¥¯¥í¡¼¥ë¥Ð¡¼¤ä¥Þ¥¦¥¹¤Î¥Ü¥¿¥ó2 ¤Ç¥¹¥¯¥í¡¼¥ë¤Ç¤­¤ë¥­¥ã¥ó¥Ð¥¹ widget ¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£»Í³Ñ¤Î¾å¤Ç¥Ü¥¿¥ó1 ¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢¤½¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬É¸½à½ÐÎϤ˽ÐÎϤµ¤ì¤Þ¤¹¡£"){ pack('side'=>'top') } @@ -53,14 +53,14 @@ unless $tk_version =~ /^4\.[01]/ end # canvas ÀßÄê -$cscroll_canvas = TkCanvas.new(base_frame, +$cscroll_canvas = TkCanvas.new(base_frame, 'relief'=>'sunken', 'borderwidth'=>2, 'scrollregion'=>['-11c', '-11c', '50c', '20c'] ) {|c| if $tk_version =~ /^4\.[01]/ - pack('expand'=>'yes', 'fill'=>'both') + pack('expand'=>'yes', 'fill'=>'both') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end @@ -69,18 +69,18 @@ $cscroll_canvas = TkCanvas.new(base_frame, if $tk_version =~ /^4\.[01]/ pack('side'=>'right', 'fill'=>'y') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end } - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}) {|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) if $tk_version =~ /^4\.[01]/ - pack('side'=>'bottom', 'fill'=>'x') + pack('side'=>'bottom', 'fill'=>'x') else - grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + grid('in'=>$cscroll_grid, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') end } @@ -91,9 +91,9 @@ bg = $cscroll_canvas.configinfo('bg')[4] x = -10+3*i y = -10 (0..9).each{|j| - TkcRectangle.new($cscroll_canvas, "#{x}c", "#{y}c", "#{x+2}c", "#{y+2}c", + TkcRectangle.new($cscroll_canvas, "#{x}c", "#{y}c", "#{x+2}c", "#{y+2}c", 'outline'=>'black', 'fill'=>bg, 'tags'=>'rect') - TkcText.new($cscroll_canvas, "#{x+1}c", "#{y+1}c", + TkcText.new($cscroll_canvas, "#{x+1}c", "#{y+1}c", 'text'=>"#{i},#{j}", 'anchor'=>'center', 'tags'=>'text') y += 3 } @@ -104,7 +104,7 @@ $cscroll_canvas.itembind('all', 'Any-Leave', proc{scrollLeave $cscroll_canvas}) $cscroll_canvas.itembind('all', '1', proc{scrollButton $cscroll_canvas}) $cscroll_canvas.itembind('all', 'Any-Enter', proc{scrollEnter $cscroll_canvas}) $cscroll_canvas.bind('2', proc{|x,y| $cscroll_canvas.scan_mark(x,y)}, '%x %y') -$cscroll_canvas.bind('B2-Motion', +$cscroll_canvas.bind('B2-Motion', proc{|x,y| $cscroll_canvas.scan_dragto(x,y)}, '%x %y') def scrollEnter(c) diff --git a/ext/tk/sample/demos-jp/ctext.rb b/ext/tk/sample/demos-jp/ctext.rb index 05ca732cfd..70c1cad1a7 100644 --- a/ext/tk/sample/demos-jp/ctext.rb +++ b/ext/tk/sample/demos-jp/ctext.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($ctext_demo) && $ctext_demo - $ctext_demo.destroy + $ctext_demo.destroy $ctext_demo = nil end @@ -19,7 +19,7 @@ $ctext_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ctext_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥­¥ã¥ó¥Ð¥¹widget¤Î¥Æ¥­¥¹¥Èµ¡Ç½¤ò¥Ç¥â¤¹¤ë¤¿¤á¤Î¥Æ¥­¥¹¥Èʸ»úÎó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£¥Þ¥¦¥¹¤ò»Í³Ñ¤ÎÃæ¤Ë»ý¤Ã¤Æ¤¤¤­¡¢¥¯¥ê¥Ã¥¯¤¹¤ë¤È°ÌÃÖ¤®¤áÍѤÎÅÀ¤«¤é¤ÎÁêÂаÌÃÖ¤òÊѤ¨¤¿¤ê¡¢¹Ô·¤¨¤òÊѤ¨¤¿¤ê¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤Þ¤¿°Ê²¼¤Î¤è¤¦¤ÊÊÔ½¸¤Î¤¿¤á¤Î´Êñ¤Ê¥Ð¥¤¥ó¥Ç¥£¥ó¥°¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤¹¡£ 1. ¥Þ¥¦¥¹¤ò»ý¤Ã¤Æ¤¤¤­¡¢¥¯¥ê¥Ã¥¯¤·¡¢ÆþÎϤǤ­¤Þ¤¹¡£ @@ -50,7 +50,7 @@ $ctext_buttons = TkFrame.new(base_frame) {|frame| $ctext_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # canvas À¸À® -$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat', +$ctext_canvas = TkCanvas.new(base_frame, 'relief'=>'flat', 'borderwidth'=>0, 'width'=>500, 'height'=>350) $ctext_canvas.pack('side'=>'top', 'expand'=>'yes', 'fill'=>'both') @@ -62,7 +62,7 @@ else end # canvas ÀßÄê -TkcRectangle.new($ctext_canvas, 245, 195, 255, 205, +TkcRectangle.new($ctext_canvas, 245, 195, 255, 205, 'outline'=>'black', 'fill'=>'red') ctag_text_param = { @@ -80,24 +80,24 @@ $ctag_text.withtag(TkcText.new($ctext_canvas, 250, 200, ctag_text_param)) $ctag_text.bind('1', proc{|x,y| textB1Press $ctext_canvas,x,y}, "%x %y") $ctag_text.bind('B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y") -$ctag_text.bind('Shift-1', - proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"}, +$ctag_text.bind('Shift-1', + proc{|x,y| $ctext_canvas.seleect_adjust 'current', "@#{x},#{y}"}, "%x %y") -$ctag_text.bind('Shift-B1-Motion', +$ctag_text.bind('Shift-B1-Motion', proc{|x,y| textB1Move $ctext_canvas,x,y}, "%x %y") $ctag_text.bind('KeyPress', proc{|a| textInsert $ctext_canvas,a}, "%A") $ctag_text.bind('Return', proc{textInsert $ctext_canvas,"\n"}) $ctag_text.bind('Control-h', proc{textBs $ctext_canvas}) $ctag_text.bind('BackSpace', proc{textBs $ctext_canvas}) $ctag_text.bind('Delete', proc{textDel $ctext_canvas}) -$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"}, +$ctag_text.bind('2', proc{|x,y| textPaste $ctext_canvas, "@#{x},#{y}"}, "%x %y") -# Next, create some items that allow the text's anchor position +# Next, create some items that allow the text's anchor position # to be edited. def mkTextConfig(w,x,y,option,value,color) - item = TkcRectangle.new(w, x, y, x+30, y+30, + item = TkcRectangle.new(w, x, y, x+30, y+30, 'outline'=>'black', 'fill'=>color, 'width'=>1) item.bind('1', proc{$ctag_text.configure option, value}) w.addtag_withtag('config', item) @@ -115,15 +115,15 @@ mkTextConfig $ctext_canvas, x+60, y+30, 'anchor', 'w', color mkTextConfig $ctext_canvas, x, y+60, 'anchor', 'ne', color mkTextConfig $ctext_canvas, x+30, y+60, 'anchor', 'n', color mkTextConfig $ctext_canvas, x+60, y+60, 'anchor', 'nw', color -item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50, +item = TkcRectangle.new($ctext_canvas, x+40, y+40, x+50, y+50, 'outline'=>'black', 'fill'=>'red') item.bind('1', proc{$ctag_text.configure 'anchor', 'center'}) if $tk_version =~ /^4.*/ - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', - 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', + 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', 'anchor'=>'s', 'fill'=>'brown') else - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Text Position', 'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown') end @@ -137,18 +137,18 @@ mkTextConfig $ctext_canvas, x, y, 'justify', 'left', color mkTextConfig $ctext_canvas, x+30, y, 'justify', 'center', color mkTextConfig $ctext_canvas, x+60, y, 'justify', 'right', color if $tk_version =~ /^4.*/ - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', - 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', + 'font'=>'-*-times-medium-r-normal--*-240-*-*-*-*-*-*', 'anchor'=>'s', 'fill'=>'brown') else - TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', + TkcText.new($ctext_canvas, x+45, y-5, 'text'=>'Justification', 'font'=>'Times 24', 'anchor'=>'s', 'fill'=>'brown') end $ctext_canvas.itembind('config', 'Enter', proc{textEnter $ctext_canvas}) -$ctext_canvas.itembind('config', 'Leave', +$ctext_canvas.itembind('config', 'Leave', proc{$ctext_canvas\ - .itemconfigure('current', + .itemconfigure('current', 'fill'=>$textConfigFill)}) $textConfigFill = '' diff --git a/ext/tk/sample/demos-jp/entry1.rb b/ext/tk/sample/demos-jp/entry1.rb index 2be29c18d3..eb71e87aec 100644 --- a/ext/tk/sample/demos-jp/entry1.rb +++ b/ext/tk/sample/demos-jp/entry1.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($entry1_demo) && $entry1_demo - $entry1_demo.destroy + $entry1_demo.destroy $entry1_demo = nil end diff --git a/ext/tk/sample/demos-jp/entry2.rb b/ext/tk/sample/demos-jp/entry2.rb index 2675b5d324..b5187ab508 100644 --- a/ext/tk/sample/demos-jp/entry2.rb +++ b/ext/tk/sample/demos-jp/entry2.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($entry2_demo) && $entry2_demo - $entry2_demo.destroy + $entry2_demo.destroy $entry2_demo = nil end diff --git a/ext/tk/sample/demos-jp/entry3.rb b/ext/tk/sample/demos-jp/entry3.rb index 6b9cd4cf37..2728de0b93 100644 --- a/ext/tk/sample/demos-jp/entry3.rb +++ b/ext/tk/sample/demos-jp/entry3.rb @@ -8,7 +8,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($entry3_demo) && $entry3_demo - $entry3_demo.destroy + $entry3_demo.destroy $entry3_demo = nil end @@ -20,8 +20,8 @@ $entry3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($entry3_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><:top) °Ê²¼¤Ë¤Ï£´¼ïÎà¤Î¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡¥³Æ¥¨¥ó¥È¥ê¥Ü¥Ã¥¯¥¹¤Ï¡¤\ ¥Þ¥¦¥¹¥¯¥ê¥Ã¥¯¤ÇÁªÂò¤·Ê¸»ú¤òÂǤÁ¹þ¤à¤³¤È¤¬²Äǽ¤Ç¤¹¤¬¡¤¤½¤ì¤¾¤ì¤¬¤É¤Î¤è¤¦¤Ê\ @@ -68,20 +68,20 @@ TkFrame.new(base_frame){|f| def focusAndFlash(widget, fg, bg, count=5) return if count <= 0 if fg && !fg.empty? && bg && !bg.empty? - TkTimer.new(200, count, - proc{widget.configure(:foreground=>bg, :background=>fg)}, + TkTimer.new(200, count, + proc{widget.configure(:foreground=>bg, :background=>fg)}, proc{widget.configure(:foreground=>fg, :background=>bg)} ).start else # TkTimer.new(150, 3){Tk.bell}.start Tk.bell - TkTimer.new(200, count, - proc{widget.configure(:foreground=>'white', - :background=>'black')}, - proc{widget.configure(:foreground=>'black', + TkTimer.new(200, count, + proc{widget.configure(:foreground=>'white', + :background=>'black')}, + proc{widget.configure(:foreground=>'black', :background=>'white')} ).at_end{begin - widget.configure(:foreground=>fg, + widget.configure(:foreground=>fg, :background=>bg) rescue # ignore @@ -91,7 +91,7 @@ def focusAndFlash(widget, fg, bg, count=5) end l1 = TkLabelFrame.new(base_frame, :text=>"À°¿ô¥¨¥ó¥È¥ê") -TkEntry.new(l1, :validate=>:focus, +TkEntry.new(l1, :validate=>:focus, :vcmd=>[ proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' ]) {|e| @@ -102,7 +102,7 @@ TkEntry.new(l1, :validate=>:focus, } l2 = TkLabelFrame.new(base_frame, :text=>"ŤµÀ©ÌóÉÕ¤­¥¨¥ó¥È¥ê") -TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell}, +TkEntry.new(l2, :validate=>:key, :invcmd=>proc{Tk.bell}, :vcmd=>[proc{|s| s.length < 10}, '%P'] ).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m') @@ -176,7 +176,7 @@ end def validatePhoneChange(widget, vmode, idx, char) return true if idx == nil - Tk.after_idle(proc{widget.configure(:validate=>vmode, + Tk.after_idle(proc{widget.configure(:validate=>vmode, :invcmd=>proc{Tk.bell})}) if !(idx<3 || idx==6 || idx==7 || idx==11 || idx>15) && char =~ /[0-9A-Za-z]/ widget.delete(idx) @@ -191,10 +191,10 @@ end l3 = TkLabelFrame.new(base_frame, :text=>"ÊÆ¹ñÅÅÏÃÈֹ楨¥ó¥È¥ê") -TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, - :textvariable=>entry3content, +TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, + :textvariable=>entry3content, :vcmd=>[ - proc{|w,v,i,s| validatePhoneChange(w,v,i,s)}, + proc{|w,v,i,s| validatePhoneChange(w,v,i,s)}, "%W %v %i %S" ]){|e| # Click to focus goes to the first editable character... @@ -210,9 +210,9 @@ TkEntry.new(l3, :validate=>:key, :invcmd=>proc{Tk.bell}, } l4 = TkLabelFrame.new(base_frame, :text=>"¥Ñ¥¹¥ï¡¼¥É¥¨¥ó¥È¥ê") -TkEntry.new(l4, :validate=>:key, :show=>'*', +TkEntry.new(l4, :validate=>:key, :show=>'*', :vcmd=>[ - proc{|s| s.length <= 8}, + proc{|s| s.length <= 8}, '%P' ]).pack(:fill=>:x, :expand=>true, :padx=>'1m', :pady=>'1m') diff --git a/ext/tk/sample/demos-jp/filebox.rb b/ext/tk/sample/demos-jp/filebox.rb index b8846d08a0..ffe5fbc5c6 100644 --- a/ext/tk/sample/demos-jp/filebox.rb +++ b/ext/tk/sample/demos-jp/filebox.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($filebox_demo) && $entry2_demo - $filebox_demo.destroy + $filebox_demo.destroy $filebox_demo = nil end @@ -49,7 +49,7 @@ TkFrame.new(base_frame) {|frame| TkEntry.new(f, 'width'=>20) {|e| pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x') - TkButton.new(f, 'text'=>'Browse ...', + TkButton.new(f, 'text'=>'Browse ...', 'command'=>proc{fileDialog base_frame,e,type})\ .pack('side'=>'left') } @@ -60,9 +60,9 @@ TkFrame.new(base_frame) {|frame| $tk_strictMotif = TkVarAccess.new('tk_strictMotif') if ($tk_platform['platform'] == 'unix') - TkCheckButton.new(base_frame, - 'text'=>'Motif¥¹¥¿¥¤¥ë¤Î¥À¥¤¥¢¥í¥°¤òÍѤ¤¤ë', - 'variable'=>$tk_strictMotif, + TkCheckButton.new(base_frame, + 'text'=>'Motif¥¹¥¿¥¤¥ë¤Î¥À¥¤¥¢¥í¥°¤òÍѤ¤¤ë', + 'variable'=>$tk_strictMotif, 'onvalue'=>1, 'offvalue'=>0 ).pack('anchor'=>'c') end @@ -71,23 +71,23 @@ def fileDialog(w,ent,operation) # #-------------------------------------------------------- types = [ - ['Text files', ['.txt','.doc'] ], - ['Text files', [], 'TEXT' ], - ['Ruby Scripts', ['.rb'], 'TEXT' ], - ['Tcl Scripts', ['.tcl'], 'TEXT' ], - ['C Source Files', ['.c','.h'] ], - ['All Source Files', ['.rb','.tcl','.c','.h'] ], - ['Image Files', ['.gif'] ], - ['Image Files', ['.jpeg','.jpg'] ], - ['Image Files', [], ['GIFF','JPEG']], + ['Text files', ['.txt','.doc'] ], + ['Text files', [], 'TEXT' ], + ['Ruby Scripts', ['.rb'], 'TEXT' ], + ['Tcl Scripts', ['.tcl'], 'TEXT' ], + ['C Source Files', ['.c','.h'] ], + ['All Source Files', ['.rb','.tcl','.c','.h'] ], + ['Image Files', ['.gif'] ], + ['Image Files', ['.jpeg','.jpg'] ], + ['Image Files', [], ['GIFF','JPEG']], ['All files', '*' ] ] if operation == '³«¤¯' file = Tk.getOpenFile('filetypes'=>types, 'parent'=>w) else - file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, - 'initialfile'=>'Untitled', + file = Tk.getSaveFile('filetypes'=>types, 'parent'=>w, + 'initialfile'=>'Untitled', 'defaultextension'=>'.txt') end if file != "" diff --git a/ext/tk/sample/demos-jp/floor.rb b/ext/tk/sample/demos-jp/floor.rb index a2ec2e9969..78cc23a245 100644 --- a/ext/tk/sample/demos-jp/floor.rb +++ b/ext/tk/sample/demos-jp/floor.rb @@ -18,7 +18,7 @@ def floorDisplay(w,active) w.delete('all') $activeFloor = active - # First go through the three floors, displaying the backgrounds for + # First go through the three floors, displaying the backgrounds for # each floor. floor_bg1(w,$floor_colors['bg1'],$floor_colors['outline1']) @@ -29,12 +29,12 @@ def floorDisplay(w,active) w.raise("floor#{active}") - # Create a dummy item just to mark this point in the display list, + # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. TkcRectangle.new(w,0,100,1,101, 'fill'=>'', 'outline'=>'', 'tags'=>'marker') - # Add the walls and labels for the active floor, along with + # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. @@ -299,7 +299,7 @@ def floor_bg3(w,fill,outline) TkcLine.new(w,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) TkcLine.new(w,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) - TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, + TkcLine.new(w,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end @@ -313,316 +313,316 @@ end # color - Color to use for drawing foreground information. def floor_fg1(w,color) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '101' $floorItems['101'] = i - TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Pub Lift1' $floorItems['Pub Lift1'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Priv Lift1' $floorItems['Priv Lift1'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, + i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '110' $floorItems['110'] = i - TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, + TkcText.new(w,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, + i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '109' $floorItems['109'] = i - TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, + TkcText.new(w,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, + i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '111' $floorItems['111'] = i - TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, + TkcText.new(w,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, + i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117B' $floorItems['117B'] = i - TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, + TkcText.new(w,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, + i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '112' $floorItems['112'] = i - TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, + TkcText.new(w,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, + i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '113' $floorItems['113'] = i - TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, + TkcText.new(w,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, + i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117A' $floorItems['117A'] = i - TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, + TkcText.new(w,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, + i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '117' $floorItems['117'] = i - TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, + TkcText.new(w,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, + i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '114' $floorItems['114'] = i - TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, + TkcText.new(w,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, + i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '115' $floorItems['115'] = i - TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, + TkcText.new(w,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, + i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '116' $floorItems['116'] = i - TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, + TkcText.new(w,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, + i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '118' $floorItems['118'] = i - TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, + TkcText.new(w,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, - 163,91,163,112,149,112,149,128, + 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '120' $floorItems['120'] = i - TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, + TkcText.new(w,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, - 156,192,156,169,175,169,175,246,79,246, + 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '122' $floorItems['122'] = i - TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, + TkcText.new(w,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, + i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '121' $floorItems['121'] = i - TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, + TkcText.new(w,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, + i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106A' $floorItems['106A'] = i - TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, + TkcText.new(w,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, + i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '105' $floorItems['105'] = i - TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, + TkcText.new(w,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, + i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106B' $floorItems['106B'] = i - TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, + TkcText.new(w,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, + i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '104' $floorItems['104'] = i - TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, + TkcText.new(w,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, + i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '108' $floorItems['108'] = i - TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, + TkcText.new(w,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, + i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '107' $floorItems['107'] = i - TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, + TkcText.new(w,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, + i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Smoking' $floorItems['Smoking'] = i - TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, + TkcText.new(w,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, + i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '123' $floorItems['123'] = i - TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, + TkcText.new(w,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, + i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '103' $floorItems['103'] = i - TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, + TkcText.new(w,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, + i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '124' $floorItems['124'] = i - TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, + TkcText.new(w,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, + i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '125' $floorItems['125'] = i - TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, + TkcText.new(w,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, + i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '126' $floorItems['126'] = i - TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, + TkcText.new(w,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, - 486,253,486,239,474,239,474,209, + 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '127' $floorItems['127'] = i - TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, + TkcText.new(w,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, - 490,188,490,204,476,204,476,164, + 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'MShower' $floorItems['MShower'] = i - TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, + TkcText.new(w,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, + i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Closet' $floorItems['Closet'] = i - TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, + TkcText.new(w,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, + i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'WShower' $floorItems['WShower'] = i - TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, + TkcText.new(w,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, - 515,174,503,174,503,161,486,161, + 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '130' $floorItems['130'] = i - TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, + TkcText.new(w,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, - 393,309,300,309,300,248,308,248, + 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '102' $floorItems['102'] = i - TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, + TkcText.new(w,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, + i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '128' $floorItems['128'] = i - TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, + TkcText.new(w,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '129' $floorItems['129'] = i - TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, + TkcText.new(w,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, - 642,389,561,389,561,277,696,277, + 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '133' $floorItems['133'] = i - TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, + TkcText.new(w,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, + i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '132' $floorItems['132'] = i - TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, + TkcText.new(w,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, + i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '134' $floorItems['134'] = i - TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, + TkcText.new(w,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, + i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '135' $floorItems['135'] = i - TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, + TkcText.new(w,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, - 331,347,332,351,334,354,336,357,341,359, + 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Ramona Stair' $floorItems['Ramona Stair'] = i - TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, + TkcText.new(w,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, - 122,28,123,32,123,68,220,68,220,87,90,87,90,23, + 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'University Stair' $floorItems['University Stair'] = i - TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, + TkcText.new(w,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, - 227,13,223,17,221,22,220,34,260,34, + 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Stair' $floorItems['Plaza Stair'] = i - TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, + TkcText.new(w,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, - 386,104,386,128,220,128, + 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = 'Plaza Deck' $floorItems['Plaza Deck'] = i - TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, + TkcText.new(w,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '106' $floorItems['106'] = i - TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, + TkcText.new(w,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, - 112,130,97,130,97,168,175,168,175,131,146,131, + 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels[i.id] = '119' $floorItems['119'] = i - TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, + TkcText.new(w,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) TkcLine.new(w,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) TkcLine.new(w,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) @@ -795,321 +795,321 @@ end def floor_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, - 800,222,800,168,748,168, + 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '238' $floorItems['238'] = i - TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, + TkcText.new(w,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '237' $floorItems['237'] = i - TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, + TkcText.new(w,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, - 715,205,755,205,755,190,724,190,724,187, + 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '246' $floorItems['246'] = i - TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, + TkcText.new(w,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, + i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '247' $floorItems['247'] = i - TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, + TkcText.new(w,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, - 559,274,482,274,482,278,396,278,396,274,232,274, + 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '202' $floorItems['202'] = i - TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, + TkcText.new(w,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, - 156,196,176,196,176,228, + 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '206' $floorItems['206'] = i - TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, + TkcText.new(w,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, + i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '212' $floorItems['212'] = i - TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, + TkcText.new(w,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, + i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '245' $floorItems['245'] = i - TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, + TkcText.new(w,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, + i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '244' $floorItems['244'] = i - TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, + TkcText.new(w,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, + i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '243' $floorItems['243'] = i - TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, + TkcText.new(w,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, + i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '242' $floorItems['242'] = i - TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, + TkcText.new(w,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, + i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Barbecue Deck' $floorItems['Barbecue Deck'] = i - TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, + TkcText.new(w,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, + i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '240' $floorItems['240'] = i - TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, + TkcText.new(w,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, + i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '241' $floorItems['241'] = i - TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, + TkcText.new(w,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, + i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '239' $floorItems['239'] = i - TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, + TkcText.new(w,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, + i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '248' $floorItems['248'] = i - TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, + TkcText.new(w,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, + i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '236' $floorItems['236'] = i - TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, + TkcText.new(w,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, + i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '235' $floorItems['235'] = i - TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, + TkcText.new(w,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, - 572,143,579,143,579,185,626,185, + 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '234' $floorItems['234'] = i - TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, + TkcText.new(w,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, - 578,185,527,185,527,131,557,131, + 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '233' $floorItems['233'] = i - TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, + TkcText.new(w,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '230' $floorItems['230'] = i - TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, + TkcText.new(w,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, + i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '232' $floorItems['232'] = i - TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, + TkcText.new(w,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, + i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '229' $floorItems['229'] = i - TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, + TkcText.new(w,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, + i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '227' $floorItems['227'] = i - TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, + TkcText.new(w,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, + i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '228' $floorItems['228'] = i - TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, + TkcText.new(w,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, + i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '226' $floorItems['226'] = i - TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, + TkcText.new(w,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, + i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '225' $floorItems['225'] = i - TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, + TkcText.new(w,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, + i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '224' $floorItems['224'] = i - TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, + TkcText.new(w,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, + i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '223' $floorItems['223'] = i - TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, + TkcText.new(w,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, + i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '222' $floorItems['222'] = i - TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, + TkcText.new(w,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, + i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '221' $floorItems['221'] = i - TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, + TkcText.new(w,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, + i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '204' $floorItems['204'] = i - TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, + TkcText.new(w,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, + i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '205' $floorItems['205'] = i - TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, + TkcText.new(w,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '207' $floorItems['207'] = i - TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, + TkcText.new(w,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, + i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '208' $floorItems['208'] = i - TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, + TkcText.new(w,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, + i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '209' $floorItems['209'] = i - TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, + TkcText.new(w,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, + i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217' $floorItems['217'] = i - TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, + TkcText.new(w,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, + i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '217A' $floorItems['217A'] = i - TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, + TkcText.new(w,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, + i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '216' $floorItems['216'] = i - TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, + TkcText.new(w,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, + i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '215' $floorItems['215'] = i - TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, + TkcText.new(w,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, + i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '214' $floorItems['214'] = i - TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, + TkcText.new(w,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, + i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '213' $floorItems['213'] = i - TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, + TkcText.new(w,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, + i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '210' $floorItems['210'] = i - TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, + TkcText.new(w,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, + i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '211' $floorItems['211'] = i - TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, + TkcText.new(w,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, + i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '203' $floorItems['203'] = i - TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, + TkcText.new(w,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, - 154,198,154,192,109,192,109,169,99,169, + 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '220' $floorItems['220'] = i - TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, + TkcText.new(w,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Priv Lift2' $floorItems['Priv Lift2'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = 'Pub Lift 2' $floorItems['Pub Lift 2'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '218' $floorItems['218'] = i - TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, + TkcText.new(w,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '219' $floorItems['219'] = i - TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, + TkcText.new(w,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels[i.id] = '201' $floorItems['201'] = i - TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) TkcLine.new(w,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) TkcLine.new(w,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) @@ -1280,206 +1280,206 @@ def floor_fg3(w,color) 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316' $floorItems['316'] = i - TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, + TkcText.new(w,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, + i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '309' $floorItems['309'] = i - TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, + TkcText.new(w,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, + i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '308' $floorItems['308'] = i - TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, + TkcText.new(w,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, + i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '307' $floorItems['307'] = i - TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, + TkcText.new(w,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, + i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '305' $floorItems['305'] = i - TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, + TkcText.new(w,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324B' $floorItems['324B'] = i - TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, + TkcText.new(w,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, + i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324A' $floorItems['324A'] = i - TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, + TkcText.new(w,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, + i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '320' $floorItems['320'] = i - TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, + TkcText.new(w,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, + i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '310' $floorItems['310'] = i - TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, + TkcText.new(w,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, + i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '312' $floorItems['312'] = i - TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, + TkcText.new(w,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, + i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '313' $floorItems['313'] = i - TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, + TkcText.new(w,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, + i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '314' $floorItems['314'] = i - TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, + TkcText.new(w,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, + i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '315' $floorItems['315'] = i - TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, + TkcText.new(w,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, + i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316B' $floorItems['316B'] = i - TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, + TkcText.new(w,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, + i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '316A' $floorItems['316A'] = i - TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, + TkcText.new(w,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, - 174,198,174,226,101,226,101,179,97,179, + 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '319' $floorItems['319'] = i - TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, + TkcText.new(w,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, + i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '311' $floorItems['311'] = i - TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, + TkcText.new(w,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '318' $floorItems['318'] = i - TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, + TkcText.new(w,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '317' $floorItems['317'] = i - TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, + TkcText.new(w,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, + i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '323' $floorItems['323'] = i - TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, + TkcText.new(w,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, + i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '325' $floorItems['325'] = i - TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, + TkcText.new(w,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, + i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '321' $floorItems['321'] = i - TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, + TkcText.new(w,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, - 264,181,264,135,314,135, + 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '322' $floorItems['322'] = i - TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, + TkcText.new(w,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Pub Lift3' $floorItems['Pub Lift3'] = i - TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, + TkcText.new(w,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = 'Priv Lift3' $floorItems['Priv Lift3'] = i - TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, + TkcText.new(w,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, + i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '303' $floorItems['303'] = i - TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, + TkcText.new(w,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, - 244,230,244,221,252,221,252,203, + 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '324' $floorItems['324'] = i - TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, + TkcText.new(w,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, + i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '304' $floorItems['304'] = i - TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, + TkcText.new(w,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '301' $floorItems['301'] = i - TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, + TkcText.new(w,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, + i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '327' $floorItems['327'] = i - TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, + TkcText.new(w,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, + i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '326' $floorItems['326'] = i - TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, + TkcText.new(w,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, - 375,274,397,274,397,248,339,248,339,242,308,242, + 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '302' $floorItems['302'] = i - TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, + TkcText.new(w,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, - 107,248,160,248,160,301,107,301,107,275,70,275, + 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels[i.id] = '306' $floorItems['306'] = i - TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, + TkcText.new(w,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) TkcLine.new(w,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) TkcLine.new(w,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) @@ -1574,7 +1574,7 @@ end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($floor_demo) && $floor_demo - $floor_demo.destroy + $floor_demo.destroy $floor_demo = nil end @@ -1590,7 +1590,7 @@ $floor_demo = TkToplevel.new {|w| base_frame = TkFrame.new($floor_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥Ç¥£¥¸¥¿¥ë¥¨¥¯¥¤¥Ã¥×¥á¥ó¥È¼Ò¤Î¥¦¥§¥¹¥¿¥ó¥ê¥µ¡¼¥Á¥é¥Ü¥é¥È¥ê (DECWRL) ¤Î´Ö¼è¤ê¤¬½ñ¤«¤ì¤¿¥­¥ã¥ó¥Ð¥¹ widget ¤¬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ï 3³¬·ú¤Æ¤Ç¡¢¾ï¤Ë¤½¤Î¤¦¤Á¤Î1³¬Ê¬¤¬ÁªÂò¡¢¤Ä¤Þ¤ê¤½¤Î´Ö¼è¤ê¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¤¢¤ë³¬¤òÁªÂò¤¹¤ë¤Ë¤Ï¡¢¤½¤Î¾å¤Ç¥Þ¥¦¥¹¤Îº¸¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£¥Þ¥¦¥¹¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë³¬¤Î¾å¤òư¤¯¤È¡¢¤½¤Î²¼¤Ë¤¢¤ëÉô²°¤Î¿§¤¬ÊѤï¤ê¡¢Éô²°Èֹ椬¡ÖÉô²°ÈÖ¹æ:¡×¥¨¥ó¥È¥ê¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¢¥¨¥ó¥È¥ê¤ËÉô²°ÈÖ¹æ¤ò½ñ¤¯¤È¤½¤ÎÉô²°¤Î¿§¤¬ÊѤï¤ê¤Þ¤¹¡£"){ pack('side'=>'top') } @@ -1622,10 +1622,10 @@ $floorItems = {} if $tk_version =~ /^4\.[01]/ $floor_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken', 'highlightthickness'=>2) - $floor_canvas = TkCanvas.new($floor_canvas_frame, - 'width'=>900, 'height'=>500, 'borderwidth'=>0, + $floor_canvas = TkCanvas.new($floor_canvas_frame, + 'width'=>900, 'height'=>500, 'borderwidth'=>0, 'highlightthickness'=>0) {|c| - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}){|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) pack('side'=>'bottom', 'fill'=>'x') @@ -1646,20 +1646,20 @@ else v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical') TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1| - $floor_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, - 'borderwidth'=>0, + $floor_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, + 'borderwidth'=>0, 'highlightthickness'=>0) { xscrollcommand(proc{|first,last| h.set first,last}) yscrollcommand(proc{|first,last| v.set first,last}) pack('expand'=>'yes', 'fill'=>'both') } - grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') } - v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) @@ -1676,7 +1676,7 @@ end # Create an entry for displaying and typing in current room. $currentRoom = TkVariable.new -$floor_entry = TkEntry.new($floor_canvas, 'width'=>10, 'relief'=>'sunken', +$floor_entry = TkEntry.new($floor_canvas, 'width'=>10, 'relief'=>'sunken', 'bd'=>2, 'textvariable'=>$currentRoom) # Choose colors, then fill in the floorplan. @@ -1713,7 +1713,7 @@ $floor_canvas.itembind('floor3', '1', proc{floorDisplay $floor_canvas,3}) $floor_canvas.itembind('room', 'Enter', proc{newRoom $floor_canvas}) $floor_canvas.itembind('room', 'Leave', proc{$currentRoom.value = ''}) $floor_canvas.bind('2', proc{|x,y| $floor_canvas.scan_mark x,y}, '%x %y') -$floor_canvas.bind('B2-Motion', +$floor_canvas.bind('B2-Motion', proc{|x,y| $floor_canvas.scan_dragto x,y}, '%x %y') $floor_canvas.bind('Destroy', proc{$currentRoom.unset}) $currentRoom.value = '' diff --git a/ext/tk/sample/demos-jp/floor2.rb b/ext/tk/sample/demos-jp/floor2.rb index d4381c5543..92ace6b51a 100644 --- a/ext/tk/sample/demos-jp/floor2.rb +++ b/ext/tk/sample/demos-jp/floor2.rb @@ -18,7 +18,7 @@ def floorDisplay2(w,active) w.delete('all') $activeFloor2 = active - # First go through the three floors, displaying the backgrounds for + # First go through the three floors, displaying the backgrounds for # each floor. floor2_bg1(w,$floor2_colors['bg1'],$floor2_colors['outline1']) @@ -29,12 +29,12 @@ def floorDisplay2(w,active) w.raise("floor#{active}") - # Create a dummy item just to mark this point in the display list, + # Create a dummy item just to mark this point in the display list, # so we can insert highlights here. w.create(TkcRectangle,0,100,1,101,'fill'=>'','outline'=>'','tags'=>'marker') - # Add the walls and labels for the active floor, along with + # Add the walls and labels for the active floor, along with # transparent polygons that define the rooms on the floor. # Make sure that the room polygons are on top. @@ -299,7 +299,7 @@ def floor2_bg3(w,fill,outline) w.create(TkcLine,21,331,0,331, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,21,331,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) w.create(TkcLine,96,133,21,133, 'fill'=>outline, 'tags'=>['floor3','bg']) - w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, + w.create(TkcLine,107,300,159,300,159,248,107,248,107,300, 'fill'=>outline, 'tags'=>['floor3','bg']) end @@ -313,316 +313,316 @@ end # color - Color to use for drawing foreground information. def floor2_fg1(w,color) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '101' $floorItems2['101'] = i - w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'101', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Pub Lift1' $floorItems2['Pub Lift1'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Priv Lift1' $floorItems2['Priv Lift1'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift1', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, + i = TkcPolygon.new(w,42,389,42,337,1,337,1,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '110' $floorItems2['110'] = i - w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, + w.create(TkcText,21.5,363, 'text'=>'110', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, + i = TkcPolygon.new(w,59,389,59,385,90,385,90,337,44,337,44,389, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '109' $floorItems2['109'] = i - w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, + w.create(TkcText,67,363, 'text'=>'109', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, + i = TkcPolygon.new(w,51,300,51,253,6,253,6,300, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '111' $floorItems2['111'] = i - w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, + w.create(TkcText,28.5,276.5, 'text'=>'111', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, + i = TkcPolygon.new(w,98,248,98,309,79,309,79,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117B' $floorItems2['117B'] = i - w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, + w.create(TkcText,88.5,278.5, 'text'=>'117B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, + i = TkcPolygon.new(w,51,251,51,204,6,204,6,251, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '112' $floorItems2['112'] = i - w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, + w.create(TkcText,28.5,227.5, 'text'=>'112', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, + i = TkcPolygon.new(w,6,156,51,156,51,203,6,203, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '113' $floorItems2['113'] = i - w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, + w.create(TkcText,28.5,179.5, 'text'=>'113', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, + i = TkcPolygon.new(w,85,169,79,169,79,192,85,192, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117A' $floorItems2['117A'] = i - w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, + w.create(TkcText,82,180.5, 'text'=>'117A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, + i = TkcPolygon.new(w,77,302,77,168,53,168,53,302, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '117' $floorItems2['117'] = i - w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, + w.create(TkcText,65,235, 'text'=>'117', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, + i = TkcPolygon.new(w,51,155,51,115,6,115,6,155, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '114' $floorItems2['114'] = i - w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, + w.create(TkcText,28.5,135, 'text'=>'114', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, + i = TkcPolygon.new(w,95,115,53,115,53,168,95,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '115' $floorItems2['115'] = i - w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, + w.create(TkcText,74,141.5, 'text'=>'115', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, + i = TkcPolygon.new(w,87,113,87,27,10,27,10,113, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '116' $floorItems2['116'] = i - w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, + w.create(TkcText,48.5,70, 'text'=>'116', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, + i = TkcPolygon.new(w,89,91,128,91,128,113,89,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '118' $floorItems2['118'] = i - w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, + w.create(TkcText,108.5,102, 'text'=>'118', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,178,128,178,132,216,132,216,91, - 163,91,163,112,149,112,149,128, + 163,91,163,112,149,112,149,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '120' $floorItems2['120'] = i - w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, + w.create(TkcText,189.5,111.5, 'text'=>'120', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,79,193,87,193,87,169,136,169,136,192, - 156,192,156,169,175,169,175,246,79,246, + 156,192,156,169,175,169,175,246,79,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '122' $floorItems2['122'] = i - w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, + w.create(TkcText,131,207.5, 'text'=>'122', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, + i = TkcPolygon.new(w,138,169,154,169,154,191,138,191, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '121' $floorItems2['121'] = i - w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, + w.create(TkcText,146,180, 'text'=>'121', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, + i = TkcPolygon.new(w,99,300,126,300,126,309,99,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106A' $floorItems2['106A'] = i - w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, + w.create(TkcText,112.5,304.5, 'text'=>'106A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, + i = TkcPolygon.new(w,128,299,128,309,150,309,150,248,99,248,99,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '105' $floorItems2['105'] = i - w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, + w.create(TkcText,124.5,278.5, 'text'=>'105', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, + i = TkcPolygon.new(w,174,309,174,300,152,300,152,309, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106B' $floorItems2['106B'] = i - w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, + w.create(TkcText,163,304.5, 'text'=>'106B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, + i = TkcPolygon.new(w,176,299,176,309,216,309,216,248,152,248,152,299, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '104' $floorItems2['104'] = i - w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, + w.create(TkcText,184,278.5, 'text'=>'104', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, + i = TkcPolygon.new(w,138,385,138,337,91,337,91,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '108' $floorItems2['108'] = i - w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, + w.create(TkcText,114.5,361, 'text'=>'108', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, + i = TkcPolygon.new(w,256,337,140,337,140,385,256,385, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '107' $floorItems2['107'] = i - w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, + w.create(TkcText,198,361, 'text'=>'107', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, + i = TkcPolygon.new(w,300,353,300,329,260,329,260,353, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Smoking' $floorItems2['Smoking'] = i - w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, + w.create(TkcText,280,341, 'text'=>'Smoking', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, + i = TkcPolygon.new(w,314,135,314,170,306,170,306,246,177,246,177,135, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '123' $floorItems2['123'] = i - w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, + w.create(TkcText,245.5,190.5, 'text'=>'123', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, + i = TkcPolygon.new(w,217,248,301,248,301,326,257,326,257,310,217,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '103' $floorItems2['103'] = i - w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, + w.create(TkcText,259,287, 'text'=>'103', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, + i = TkcPolygon.new(w,396,188,377,188,377,169,316,169,316,131,396,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '124' $floorItems2['124'] = i - w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, + w.create(TkcText,356,150, 'text'=>'124', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, + i = TkcPolygon.new(w,397,226,407,226,407,189,377,189,377,246,397,246, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '125' $floorItems2['125'] = i - w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, + w.create(TkcText,392,217.5, 'text'=>'125', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, + i = TkcPolygon.new(w,399,187,409,187,409,207,474,207,474,164,399,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '126' $floorItems2['126'] = i - w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, + w.create(TkcText,436.5,185.5, 'text'=>'126', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,409,209,409,229,399,229,399,253, - 486,253,486,239,474,239,474,209, + 486,253,486,239,474,239,474,209, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '127' $floorItems2['127'] = i - w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, + w.create(TkcText,436.5,'231', 'text'=>'127', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,501,164,501,174,495,174,495,188, - 490,188,490,204,476,204,476,164, + 490,188,490,204,476,204,476,164, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'MShower' $floorItems2['MShower'] = i - w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, + w.create(TkcText,488.5,'184', 'text'=>'MShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, + i = TkcPolygon.new(w,497,176,513,176,513,204,492,204,492,190,497,190, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Closet' $floorItems2['Closet'] = i - w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, + w.create(TkcText,502.5,190, 'text'=>'Closet', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, + i = TkcPolygon.new(w,476,237,476,206,513,206,513,254,488,254,488,237, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'WShower' $floorItems2['WShower'] = i - w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, + w.create(TkcText,494.5,230, 'text'=>'WShower', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,486,131,558,131,558,135,724,135,724,166, 697,166,697,275,553,275,531,254,515,254, - 515,174,503,174,503,161,486,161, + 515,174,503,174,503,161,486,161, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '130' $floorItems2['130'] = i - w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, + w.create(TkcText,638.5,205, 'text'=>'130', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,308,242,339,242,339,248,342,248, 342,246,397,246,397,276,393,276, - 393,309,300,309,300,248,308,248, + 393,309,300,309,300,248,308,248, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '102' $floorItems2['102'] = i - w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, + w.create(TkcText,367.5,278.5, 'text'=>'102', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, + i = TkcPolygon.new(w,397,255,486,255,486,276,397,276, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '128' $floorItems2['128'] = i - w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, + w.create(TkcText,441.5,265.5, 'text'=>'128', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,510,309,486,309,486,255,530,255, 552,277,561,277,561,325,510,325, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '129' $floorItems2['129'] = i - w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, + w.create(TkcText,535.5,293, 'text'=>'129', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,696,281,740,281,740,387,642,387, - 642,389,561,389,561,277,696,277, + 642,389,561,389,561,277,696,277, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '133' $floorItems2['133'] = i - w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, + w.create(TkcText,628.5,335, 'text'=>'133', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, + i = TkcPolygon.new(w,742,387,742,281,800,281,800,387, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '132' $floorItems2['132'] = i - w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, + w.create(TkcText,771,334, 'text'=>'132', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, + i = TkcPolygon.new(w,800,168,800,280,699,280,699,168, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '134' $floorItems2['134'] = i - w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, + w.create(TkcText,749.5,224, 'text'=>'134', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) - i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, + i = TkcPolygon.new(w,726,131,726,166,800,166,800,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '135' $floorItems2['135'] = i - w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, + w.create(TkcText,763,148.5, 'text'=>'135', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,340,360,335,363,331,365,326,366,304,366, 304,312,396,312,396,288,400,288,404,288, 409,290,413,292,418,297,421,302,422,309, 421,318,417,325,411,330,405,332,397,333, 344,333,340,334,336,336,335,338,332,342, - 331,347,332,351,334,354,336,357,341,359, + 331,347,332,351,334,354,336,357,341,359, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Ramona Stair' $floorItems2['Ramona Stair'] = i - w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, + w.create(TkcText,368,323, 'text'=>'Ramona Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,30,23,30,5,93,5,98,5,104,7,110,10,116,16,119,20, - 122,28,123,32,123,68,220,68,220,87,90,87,90,23, + 122,28,123,32,123,68,220,68,220,87,90,87,90,23, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'University Stair' $floorItems2['University Stair'] = i - w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, + w.create(TkcText,155,77.5, 'text'=>'University Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,282,37,295,40,312,49,323,56,337,70,352,56, 358,48,363,39,365,29,348,25,335,22,321,14, 300,5,283,1,260,0,246,0,242,2,236,4,231,8, - 227,13,223,17,221,22,220,34,260,34, + 227,13,223,17,221,22,220,34,260,34, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Stair' $floorItems2['Plaza Stair'] = i - w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, + w.create(TkcText,317.5,28.5, 'text'=>'Plaza Stair', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,220,34,260,34,282,37,295,40,312,49, 323,56,337,70,350,83,365,94,377,100, - 386,104,386,128,220,128, + 386,104,386,128,220,128, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = 'Plaza Deck' $floorItems2['Plaza Deck'] = i - w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, + w.create(TkcText,303,81, 'text'=>'Plaza Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,257,336,77,336,6,336,6,301,77,301,77,310,257,310, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '106' $floorItems2['106'] = i - w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, + w.create(TkcText,131.5,318.5, 'text'=>'106', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) i = TkcPolygon.new(w,146,110,162,110,162,91,130,91,130,115,95,115, 95,128,114,128,114,151,157,151,157,153,112,153, - 112,130,97,130,97,168,175,168,175,131,146,131, + 112,130,97,130,97,168,175,168,175,131,146,131, 'fill'=>'', 'tags'=>['floor1','room']) $floorLabels2[i.id] = '119' $floorItems2['119'] = i - w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, + w.create(TkcText,143.5,133, 'text'=>'119', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor1','label']) w.create(TkcLine,155,191,155,189, 'fill'=>color, 'tags'=>['floor1','wall']) w.create(TkcLine,155,177,155,169, 'fill'=>color, 'tags'=>['floor1','wall']) @@ -795,321 +795,321 @@ end def floor2_fg2(w,color) i = TkcPolygon.new(w,748,188,755,188,755,205,758,205,758,222, - 800,222,800,168,748,168, + 800,222,800,168,748,168, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '238' $floorItems2['238'] = i - w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, + w.create(TkcText,774,195, 'text'=>'238', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,726,188,746,188,746,166,800,166,800,131,726,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '237' $floorItems2['237'] = i - w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, + w.create(TkcText,763,148.5, 'text'=>'237', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,497,187,497,204,559,204,559,324,641,324, 643,324,643,291,641,291,641,205,696,205, 696,291,694,291,694,314,715,314,715,291, - 715,205,755,205,755,190,724,190,724,187, + 715,205,755,205,755,190,724,190,724,187, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '246' $floorItems2['246'] = i - w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, + w.create(TkcText,600,264, 'text'=>'246', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, + i = TkcPolygon.new(w,694,279,643,279,643,314,694,314, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '247' $floorItems2['247'] = i - w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, + w.create(TkcText,668.5,296.5, 'text'=>'247', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,232,250,308,250,308,242,339,242,339,246, 397,246,397,255,476,255,476,250,482,250,559,250, - 559,274,482,274,482,278,396,278,396,274,232,274, + 559,274,482,274,482,278,396,278,396,274,232,274, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '202' $floorItems2['202'] = i - w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, + w.create(TkcText,285.5,260, 'text'=>'202', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,53,228,53,338,176,338,233,338,233,196, 306,196,306,180,175,180,175,169,156,169, - 156,196,176,196,176,228, + 156,196,176,196,176,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '206' $floorItems2['206'] = i - w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, + w.create(TkcText,143,267, 'text'=>'206', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, + i = TkcPolygon.new(w,51,277,6,277,6,338,51,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '212' $floorItems2['212'] = i - w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, + w.create(TkcText,28.5,307.5, 'text'=>'212', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, + i = TkcPolygon.new(w,557,276,486,276,486,309,510,309,510,325,557,325, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '245' $floorItems2['245'] = i - w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, + w.create(TkcText,521.5,300.5, 'text'=>'245', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, + i = TkcPolygon.new(w,560,389,599,389,599,326,560,326, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '244' $floorItems2['244'] = i - w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, + w.create(TkcText,579.5,357.5, 'text'=>'244', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, + i = TkcPolygon.new(w,601,389,601,326,643,326,643,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '243' $floorItems2['243'] = i - w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, + w.create(TkcText,622,357.5, 'text'=>'243', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, + i = TkcPolygon.new(w,688,316,645,316,645,365,688,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '242' $floorItems2['242'] = i - w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, + w.create(TkcText,666.5,340.5, 'text'=>'242', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, + i = TkcPolygon.new(w,802,367,759,367,759,226,802,226, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Barbecue Deck' $floorItems2['Barbecue Deck'] = i - w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, + w.create(TkcText,780.5,296.5, 'text'=>'Barbecue Deck', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, + i = TkcPolygon.new(w,755,262,755,314,717,314,717,262, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '240' $floorItems2['240'] = i - w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, + w.create(TkcText,736,288, 'text'=>'240', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, + i = TkcPolygon.new(w,755,316,689,316,689,365,755,365, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '241' $floorItems2['241'] = i - w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, + w.create(TkcText,722,340.5, 'text'=>'241', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, + i = TkcPolygon.new(w,755,206,717,206,717,261,755,261, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '239' $floorItems2['239'] = i - w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, + w.create(TkcText,736,233.5, 'text'=>'239', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, + i = TkcPolygon.new(w,695,277,643,277,643,206,695,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '248' $floorItems2['248'] = i - w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, + w.create(TkcText,669,241.5, 'text'=>'248', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, + i = TkcPolygon.new(w,676,135,676,185,724,185,724,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '236' $floorItems2['236'] = i - w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, + w.create(TkcText,700,160, 'text'=>'236', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, + i = TkcPolygon.new(w,675,135,635,135,635,145,628,145,628,185,675,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '235' $floorItems2['235'] = i - w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, + w.create(TkcText,651.5,160, 'text'=>'235', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,626,143,633,143,633,135,572,135, - 572,143,579,143,579,185,626,185, + 572,143,579,143,579,185,626,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '234' $floorItems2['234'] = i - w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, + w.create(TkcText,606,160, 'text'=>'234', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,557,135,571,135,571,145,578,145, - 578,185,527,185,527,131,557,131, + 578,185,527,185,527,131,557,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '233' $floorItems2['233'] = i - w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, + w.create(TkcText,552.5,158, 'text'=>'233', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,476,249,557,249,557,205,476,205, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '230' $floorItems2['230'] = i - w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, + w.create(TkcText,516.5,227, 'text'=>'230', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, + i = TkcPolygon.new(w,476,164,486,164,486,131,525,131,525,185,476,185, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '232' $floorItems2['232'] = i - w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, + w.create(TkcText,500.5,158, 'text'=>'232', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, + i = TkcPolygon.new(w,476,186,495,186,495,204,476,204, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '229' $floorItems2['229'] = i - w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, + w.create(TkcText,485.5,195, 'text'=>'229', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, + i = TkcPolygon.new(w,474,207,409,207,409,187,399,187,399,164,474,164, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '227' $floorItems2['227'] = i - w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, + w.create(TkcText,436.5,185.5, 'text'=>'227', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, + i = TkcPolygon.new(w,399,228,399,253,474,253,474,209,409,209,409,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '228' $floorItems2['228'] = i - w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, + w.create(TkcText,436.5,231, 'text'=>'228', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, + i = TkcPolygon.new(w,397,246,397,226,407,226,407,189,377,189,377,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '226' $floorItems2['226'] = i - w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, + w.create(TkcText,392,217.5, 'text'=>'226', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, + i = TkcPolygon.new(w,377,169,316,169,316,131,397,131,397,188,377,188, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '225' $floorItems2['225'] = i - w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, + w.create(TkcText,356.5,150, 'text'=>'225', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, + i = TkcPolygon.new(w,234,198,306,198,306,249,234,249, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '224' $floorItems2['224'] = i - w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, + w.create(TkcText,270,223.5, 'text'=>'224', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, + i = TkcPolygon.new(w,270,179,306,179,306,170,314,170,314,135,270,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '223' $floorItems2['223'] = i - w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, + w.create(TkcText,292,157, 'text'=>'223', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, + i = TkcPolygon.new(w,268,179,221,179,221,135,268,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '222' $floorItems2['222'] = i - w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, + w.create(TkcText,244.5,157, 'text'=>'222', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, + i = TkcPolygon.new(w,177,179,219,179,219,135,177,135, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '221' $floorItems2['221'] = i - w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, + w.create(TkcText,198,157, 'text'=>'221', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, + i = TkcPolygon.new(w,299,327,349,327,349,284,341,284,341,276,299,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '204' $floorItems2['204'] = i - w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, + w.create(TkcText,324,301.5, 'text'=>'204', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, + i = TkcPolygon.new(w,234,276,297,276,297,327,257,327,257,338,234,338, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '205' $floorItems2['205'] = i - w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, + w.create(TkcText,265.5,307, 'text'=>'205', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,256,385,256,340,212,340,212,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '207' $floorItems2['207'] = i - w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, + w.create(TkcText,234,362.5, 'text'=>'207', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, + i = TkcPolygon.new(w,210,340,164,340,164,385,210,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '208' $floorItems2['208'] = i - w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, + w.create(TkcText,187,362.5, 'text'=>'208', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, + i = TkcPolygon.new(w,115,340,162,340,162,385,115,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '209' $floorItems2['209'] = i - w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, + w.create(TkcText,138.5,362.5, 'text'=>'209', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, + i = TkcPolygon.new(w,89,228,89,156,53,156,53,228, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217' $floorItems2['217'] = i - w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, + w.create(TkcText,71,192, 'text'=>'217', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, + i = TkcPolygon.new(w,89,169,97,169,97,190,89,190, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '217A' $floorItems2['217A'] = i - w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, + w.create(TkcText,93,179.5, 'text'=>'217A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, + i = TkcPolygon.new(w,89,156,89,168,95,168,95,135,53,135,53,156, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '216' $floorItems2['216'] = i - w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, + w.create(TkcText,71,145.5, 'text'=>'216', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, + i = TkcPolygon.new(w,51,179,51,135,6,135,6,179, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '215' $floorItems2['215'] = i - w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, + w.create(TkcText,28.5,157, 'text'=>'215', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, + i = TkcPolygon.new(w,51,227,6,227,6,180,51,180, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '214' $floorItems2['214'] = i - w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, + w.create(TkcText,28.5,203.5, 'text'=>'214', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, + i = TkcPolygon.new(w,51,275,6,275,6,229,51,229, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '213' $floorItems2['213'] = i - w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, + w.create(TkcText,28.5,252, 'text'=>'213', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, + i = TkcPolygon.new(w,114,340,67,340,67,385,114,385, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '210' $floorItems2['210'] = i - w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, + w.create(TkcText,90.5,362.5, 'text'=>'210', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, + i = TkcPolygon.new(w,59,389,59,385,65,385,65,340,1,340,1,389, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '211' $floorItems2['211'] = i - w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, + w.create(TkcText,33,364.5, 'text'=>'211', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, + i = TkcPolygon.new(w,393,309,350,309,350,282,342,282,342,276,393,276, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '203' $floorItems2['203'] = i - w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, + w.create(TkcText,367.5,292.5, 'text'=>'203', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) i = TkcPolygon.new(w,99,191,91,191,91,226,174,226,174,198, - 154,198,154,192,109,192,109,169,99,169, + 154,198,154,192,109,192,109,169,99,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '220' $floorItems2['220'] = i - w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, + w.create(TkcText,132.5,208.5, 'text'=>'220', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Priv Lift2' $floorItems2['Priv Lift2'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = 'Pub Lift 2' $floorItems2['Pub Lift 2'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift 2', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '218' $floorItems2['218'] = i - w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, + w.create(TkcText,136,149.5, 'text'=>'218', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '219' $floorItems2['219'] = i - w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, + w.create(TkcText,132.5,180, 'text'=>'219', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor2','room']) $floorLabels2[i.id] = '201' $floorItems2['201'] = i - w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'201', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor2','label']) w.create(TkcLine,641,186,678,186, 'fill'=>color, 'tags'=>['floor2','wall']) w.create(TkcLine,757,350,757,367, 'fill'=>color, 'tags'=>['floor2','wall']) @@ -1280,206 +1280,206 @@ def floor2_fg3(w,color) 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316' $floorItems2['316'] = i - w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, + w.create(TkcText,79.5,204, 'text'=>'316', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, + i = TkcPolygon.new(w,115,368,162,368,162,323,115,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '309' $floorItems2['309'] = i - w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, + w.create(TkcText,138.5,345.5, 'text'=>'309', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, + i = TkcPolygon.new(w,164,323,164,368,211,368,211,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '308' $floorItems2['308'] = i - w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, + w.create(TkcText,187.5,345.5, 'text'=>'308', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, + i = TkcPolygon.new(w,256,368,212,368,212,323,256,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '307' $floorItems2['307'] = i - w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, + w.create(TkcText,234,345.5, 'text'=>'307', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, + i = TkcPolygon.new(w,244,276,297,276,297,327,260,327,260,321,244,321, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '305' $floorItems2['305'] = i - w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, + w.create(TkcText,270.5,301.5, 'text'=>'305', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,251,219,251,203,244,203,244,219, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324B' $floorItems2['324B'] = i - w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, + w.create(TkcText,247.5,211, 'text'=>'324B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, + i = TkcPolygon.new(w,251,249,244,249,244,232,251,232, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324A' $floorItems2['324A'] = i - w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, + w.create(TkcText,247.5,240.5, 'text'=>'324A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, + i = TkcPolygon.new(w,223,135,223,179,177,179,177,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '320' $floorItems2['320'] = i - w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, + w.create(TkcText,200,157, 'text'=>'320', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, + i = TkcPolygon.new(w,114,368,114,323,67,323,67,368, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '310' $floorItems2['310'] = i - w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, + w.create(TkcText,90.5,345.5, 'text'=>'310', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, + i = TkcPolygon.new(w,23,277,23,321,68,321,68,277, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '312' $floorItems2['312'] = i - w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, + w.create(TkcText,45.5,299, 'text'=>'312', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, + i = TkcPolygon.new(w,23,229,68,229,68,275,23,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '313' $floorItems2['313'] = i - w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, + w.create(TkcText,45.5,252, 'text'=>'313', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, + i = TkcPolygon.new(w,68,227,23,227,23,180,68,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '314' $floorItems2['314'] = i - w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, + w.create(TkcText,40.5,203.5, 'text'=>'314', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, + i = TkcPolygon.new(w,95,179,95,135,23,135,23,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '315' $floorItems2['315'] = i - w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, + w.create(TkcText,59,157, 'text'=>'315', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, + i = TkcPolygon.new(w,99,226,99,204,91,204,91,226, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316B' $floorItems2['316B'] = i - w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, + w.create(TkcText,95,215, 'text'=>'316B', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, + i = TkcPolygon.new(w,91,202,99,202,99,180,91,180, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '316A' $floorItems2['316A'] = i - w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, + w.create(TkcText,95,191, 'text'=>'316A', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,97,169,109,169,109,192,154,192,154,198, - 174,198,174,226,101,226,101,179,97,179, + 174,198,174,226,101,226,101,179,97,179, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '319' $floorItems2['319'] = i - w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, + w.create(TkcText,141.5,209, 'text'=>'319', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, + i = TkcPolygon.new(w,65,368,58,368,58,389,1,389,1,333,23,333,23,323,65,323, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '311' $floorItems2['311'] = i - w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, + w.create(TkcText,29.5,361, 'text'=>'311', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, + i = TkcPolygon.new(w,154,191,111,191,111,169,154,169, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '318' $floorItems2['318'] = i - w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, + w.create(TkcText,132.5,180, 'text'=>'318', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, + i = TkcPolygon.new(w,175,168,97,168,97,131,175,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '317' $floorItems2['317'] = i - w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, + w.create(TkcText,136,149.5, 'text'=>'317', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, + i = TkcPolygon.new(w,274,194,274,221,306,221,306,194, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '323' $floorItems2['323'] = i - w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, + w.create(TkcText,290,207.5, 'text'=>'323', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, + i = TkcPolygon.new(w,306,222,274,222,274,249,306,249, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '325' $floorItems2['325'] = i - w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, + w.create(TkcText,290,235.5, 'text'=>'325', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, + i = TkcPolygon.new(w,263,179,224,179,224,135,263,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '321' $floorItems2['321'] = i - w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, + w.create(TkcText,243.5,157, 'text'=>'321', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,314,169,306,169,306,192,273,192, - 264,181,264,135,314,135, + 264,181,264,135,314,135, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '322' $floorItems2['322'] = i - w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, + w.create(TkcText,293.5,163.5, 'text'=>'322', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, + i = TkcPolygon.new(w,307,240,339,240,339,206,307,206, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Pub Lift3' $floorItems2['Pub Lift3'] = i - w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, + w.create(TkcText,323,223, 'text'=>'Pub Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, + i = TkcPolygon.new(w,339,205,307,205,307,171,339,171, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = 'Priv Lift3' $floorItems2['Priv Lift3'] = i - w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, + w.create(TkcText,323,188, 'text'=>'Priv Lift3', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, + i = TkcPolygon.new(w,350,284,376,284,376,276,397,276,397,309,350,309, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '303' $floorItems2['303'] = i - w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, + w.create(TkcText,373.5,292.5, 'text'=>'303', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,272,203,272,249,252,249,252,230, - 244,230,244,221,252,221,252,203, + 244,230,244,221,252,221,252,203, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '324' $floorItems2['324'] = i - w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, + w.create(TkcText,262,226, 'text'=>'324', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, + i = TkcPolygon.new(w,299,276,299,327,349,327,349,284,341,284,341,276, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '304' $floorItems2['304'] = i - w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, + w.create(TkcText,324,301.5, 'text'=>'304', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, + i = TkcPolygon.new(w,375,246,375,172,341,172,341,246, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '301' $floorItems2['301'] = i - w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, + w.create(TkcText,358,209, 'text'=>'301', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, + i = TkcPolygon.new(w,397,246,377,246,377,185,397,185, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '327' $floorItems2['327'] = i - w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, + w.create(TkcText,387,215.5, 'text'=>'327', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) - i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, + i = TkcPolygon.new(w,316,131,316,169,377,169,377,185,397,185,397,131, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '326' $floorItems2['326'] = i - w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, + w.create(TkcText,365.5,150, 'text'=>'326', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,308,251,242,251,242,274,342,274,342,282,375, 282, - 375,274,397,274,397,248,339,248,339,242,308,242, + 375,274,397,274,397,248,339,248,339,242,308,242, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '302' $floorItems2['302'] = i - w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, + w.create(TkcText,319.5,261, 'text'=>'302', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) i = TkcPolygon.new(w,70,321,242,321,242,200,259,200,259,203,272,203, 272,193,263,180,242,180,175,180,175,169,156,169, 156,196,177,196,177,228,107,228,70,228,70,275,107,275, - 107,248,160,248,160,301,107,301,107,275,70,275, + 107,248,160,248,160,301,107,301,107,275,70,275, 'fill'=>'', 'tags'=>['floor3','room']) $floorLabels2[i.id] = '306' $floorItems2['306'] = i - w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, + w.create(TkcText,200.5,284.5, 'text'=>'306', 'fill'=>color, 'anchor'=>'c', 'tags'=>['floor3','label']) w.create(TkcLine,341,275,341,283, 'fill'=>color, 'tags'=>['floor3','wall']) w.create(TkcLine,162,197,155,197, 'fill'=>color, 'tags'=>['floor3','wall']) @@ -1574,7 +1574,7 @@ end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($floor2_demo) && $floor2_demo - $floor2_demo.destroy + $floor2_demo.destroy $floor2_demo = nil end @@ -1590,7 +1590,7 @@ $floor2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($floor2_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'8i', 'justify'=>'left', 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ë¤Ï¥Ç¥£¥¸¥¿¥ë¥¨¥¯¥¤¥Ã¥×¥á¥ó¥È¼Ò¤Î¥¦¥§¥¹¥¿¥ó¥ê¥µ¡¼¥Á¥é¥Ü¥é¥È¥ê (DECWRL) ¤Î´Ö¼è¤ê¤¬½ñ¤«¤ì¤¿¥­¥ã¥ó¥Ð¥¹ widget ¤¬Æþ¤Ã¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ï 3³¬·ú¤Æ¤Ç¡¢¾ï¤Ë¤½¤Î¤¦¤Á¤Î1³¬Ê¬¤¬ÁªÂò¡¢¤Ä¤Þ¤ê¤½¤Î´Ö¼è¤ê¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£¤¢¤ë³¬¤òÁªÂò¤¹¤ë¤Ë¤Ï¡¢¤½¤Î¾å¤Ç¥Þ¥¦¥¹¤Îº¸¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£¥Þ¥¦¥¹¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë³¬¤Î¾å¤òư¤¯¤È¡¢¤½¤Î²¼¤Ë¤¢¤ëÉô²°¤Î¿§¤¬ÊѤï¤ê¡¢Éô²°Èֹ椬¡ÖÉô²°ÈÖ¹æ:¡×¥¨¥ó¥È¥ê¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£¤Þ¤¿¡¢¥¨¥ó¥È¥ê¤ËÉô²°ÈÖ¹æ¤ò½ñ¤¯¤È¤½¤ÎÉô²°¤Î¿§¤¬ÊѤï¤ê¤Þ¤¹¡£"){ pack('side'=>'top') } @@ -1622,10 +1622,10 @@ $floorItems2 = {} if $tk_version =~ /^4\.[01]/ $floor2_canvas_frame = TkFrame.new(base_frame,'bd'=>2,'relief'=>'sunken', 'highlightthickness'=>2) - $floor2_canvas = TkCanvas.new($floor2_canvas_frame, - 'width'=>900, 'height'=>500, 'borderwidth'=>0, + $floor2_canvas = TkCanvas.new($floor2_canvas_frame, + 'width'=>900, 'height'=>500, 'borderwidth'=>0, 'highlightthickness'=>0) {|c| - TkScrollbar.new(base_frame, 'orient'=>'horiz', + TkScrollbar.new(base_frame, 'orient'=>'horiz', 'command'=>proc{|*args| c.xview(*args)}){|hs| c.xscrollcommand(proc{|first,last| hs.set first,last}) pack('side'=>'bottom', 'fill'=>'x') @@ -1646,20 +1646,20 @@ else v = TkScrollbar.new(f, 'highlightthickness'=>0, 'orient'=>'vertical') TkFrame.new(f, 'bd'=>2, 'relief'=>'sunken') {|f1| - $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, - 'borderwidth'=>0, + $floor2_canvas = TkCanvas.new(f1, 'width'=>900, 'height'=>500, + 'borderwidth'=>0, 'highlightthickness'=>0) { xscrollcommand(proc{|first,last| h.set first,last}) yscrollcommand(proc{|first,last| v.set first,last}) pack('expand'=>'yes', 'fill'=>'both') } - grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, + grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') } - v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, + v.grid('padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, + h.grid('padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0) @@ -1675,7 +1675,7 @@ end # Create an entry for displaying and typing in current room. $currentRoom2 = TkVariable.new -$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken', +$floor2_entry = TkEntry.new($floor2_canvas, 'width'=>10, 'relief'=>'sunken', 'bd'=>2, 'textvariable'=>$currentRoom2) # Choose colors, then fill in the floorplan. @@ -1712,7 +1712,7 @@ $floor2_canvas.itembind('floor3', '1', proc{floorDisplay2 $floor2_canvas,3}) $floor2_canvas.itembind('room', 'Enter', proc{newRoom2 $floor2_canvas}) $floor2_canvas.itembind('room', 'Leave', proc{$currentRoom2.value = ''}) $floor2_canvas.bind('2', proc{|x,y| $floor2_canvas.scan_mark x,y}, '%x %y') -$floor2_canvas.bind('B2-Motion', +$floor2_canvas.bind('B2-Motion', proc{|x,y| $floor2_canvas.scan_dragto x,y}, '%x %y') $floor2_canvas.bind('Destroy', proc{$currentRoom2.unset}) $currentRoom2.value = '' diff --git a/ext/tk/sample/demos-jp/form.rb b/ext/tk/sample/demos-jp/form.rb index 4de7056764..84ed94de88 100644 --- a/ext/tk/sample/demos-jp/form.rb +++ b/ext/tk/sample/demos-jp/form.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($form_demo) && $form_demo - $form_demo.destroy + $form_demo.destroy $form_demo = nil end diff --git a/ext/tk/sample/demos-jp/goldberg.rb b/ext/tk/sample/demos-jp/goldberg.rb index a81c7ec70c..ea521b82ec 100644 --- a/ext/tk/sample/demos-jp/goldberg.rb +++ b/ext/tk/sample/demos-jp/goldberg.rb @@ -44,7 +44,7 @@ #>># lots of canvas create and move calls. if defined?($goldberg_demo) && $goldberg_demo - $goldberg_demo.destroy + $goldberg_demo.destroy $goldberg_demo = nil end @@ -103,7 +103,7 @@ class TkGoldberg_Demo @S['pause'] = TkVariable.new @S['details'] = TkVariable.new(true) - @S['mode'] = TkVariable.new(:MSTART, :symbol) + @S['mode'] = TkVariable.new(:MSTART, :symbol) # :MSTART, :MGO, :MPAUSE, :MSSTEP, :MBSTEP, :MDONE, :MDEBUG # 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 @@ -134,19 +134,19 @@ class TkGoldberg_Demo @XY = {} @XY6 = { - '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], + '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], '-5'=>[340, 190], '-6'=>[349, 177], '-7'=>[366, 177], '-8'=>[380, 176], - '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], - '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], - '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], - '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], - '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], - '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], - '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], - '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], - '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], - '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], - '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], + '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], + '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], + '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], + '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], + '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], + '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], + '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], + '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], + '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], + '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], + '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], '13,15'=>[376, 410], '13,16'=>[360, 403] } @@ -163,11 +163,11 @@ class TkGoldberg_Demo def do_display() @ctrl = TkFrame.new(@parent, :relief=>:ridge, :bd=>2, :padx=>5, :pady=>5) - @screen = TkFrame.new(@parent, :bd=>2, - :relief=>:raised).pack(:side=>:left, :fill=>:both, + @screen = TkFrame.new(@parent, :bd=>2, + :relief=>:raised).pack(:side=>:left, :fill=>:both, :expand=>true) - @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, + @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, :bg=>@C['bg'], :highlightthickness=>0){ scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up yview_moveto(0.05) @@ -206,8 +206,8 @@ class TkGoldberg_Demo command proc{showCode 'goldberg'} }.pack('side'=>'left', 'padx'=>5) - # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, - @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, :bg=>@C['bg'], :activebackground=>@C['bg']) @show.pack('side'=>'left') frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) @@ -216,34 +216,34 @@ class TkGoldberg_Demo end def do_ctrl_frame - @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, + @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, :command=>proc{do_button(0)}) if font = @start['font'] @start.font(font.weight('bold')) end - @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, - :command=>proc{do_button(1)}, :relief=>:raised, + @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, + :command=>proc{do_button(1)}, :relief=>:raised, :variable=>@S['pause']) - @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, + @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, :command=>proc{do_button(2)}) - @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, + @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, :command=>proc{do_button(4)}) - @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, + @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, :command=>proc{do_button(3)}) @details = TkFrame.new(@parent, :bd=>2, :relief=>:ridge) - @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, + @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, :relief=>:raised, :variable=>@S['details']) - @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], + @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], :justify=>:center) - @speed_scale = TkScale.new(@parent, :orient=>:horizontal, - :from=>1, :to=>10, :font=>font, - :variable=>@S['speed'], :bd=>2, + @speed_scale = TkScale.new(@parent, :orient=>:horizontal, + :from=>1, :to=>10, :font=>font, + :variable=>@S['speed'], :bd=>2, :relief=>:ridge, :showvalue=>false) - @about = TkButton.new(@parent, :text=>'About', + @about = TkButton.new(@parent, :text=>'About', :command=>proc{about}, :font=>font) Tk.grid(@start, :in=>@ctrl, :row=>0, :sticky=>:ew) @@ -271,17 +271,17 @@ class TkGoldberg_Demo def do_detail_frame @f_details = TkFrame.new(@details) - @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], + @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], :bd=>1, :relief=>:solid, :bg=>'white') Tk.grid(@label, '-', '-', '-', :sticky=>:ew, :row=>0) idx = 1 loop { break unless respond_to?("move#{idx}") - l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, + l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, :width=>2, :bd=>1, :relief=>:solid, :bg=>'white') @STEP[idx] = 0 - ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), + ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), :width=>5, :bd=>1, :relief=>:solid, :bg=>'white') row = (idx + 1)/2 col = ((idx + 1) & 1) * 2 @@ -385,7 +385,7 @@ class TkGoldberg_Demo who = who.to_i n = send("move#{who}") if (n & 1).nonzero? # This guy still alive - alive << who + alive << who end if (n & 2).nonzero? # Next guy is active alive << (who + 1) @@ -418,12 +418,12 @@ class TkGoldberg_Demo # START HERE! banner def draw0 color = @C['0'] - TkcText.new(@canvas, - # [579, 119], :text=>'START HERE!', - [558, 119], :text=>'¤³¤³¤«¤é¥¹¥¿¡¼¥È¡ª', - :fill=>color, :anchor=>:w, + TkcText.new(@canvas, + # [579, 119], :text=>'START HERE!', + [558, 119], :text=>'¤³¤³¤«¤é¥¹¥¿¡¼¥È¡ª', + :fill=>color, :anchor=>:w, :tag=>'I0', :font=>['Times Roman', 12, :italic, :bold]) - TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, + TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, :width=>5, :arrow=>:last, :arrowshape=>[18, 18, 5]) @canvas.itembind('I0', '1'){ start } end @@ -437,7 +437,7 @@ class TkGoldberg_Demo end pos = [ - [673, 119], [678, 119], [683, 119], [688, 119], + [673, 119], [678, 119], [683, 119], [688, 119], [693, 119], [688, 119], [683, 119], [678, 119] ] step = step % pos.length @@ -449,15 +449,15 @@ class TkGoldberg_Demo def draw1 color = @C['1a'] color2 = @C['1b'] - TkcPolygon.new(@canvas, - [ 844, 133, 800, 133, 800, 346, 820, 346, - 820, 168, 844, 168, 844, 133 ], + TkcPolygon.new(@canvas, + [ 844, 133, 800, 133, 800, 346, 820, 346, + 820, 168, 844, 168, 844, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcPolygon.new(@canvas, - [ 771, 133, 685, 133, 685, 168, 751, 168, - 751, 346, 771, 346, 771, 133 ], + TkcPolygon.new(@canvas, + [ 771, 133, 685, 133, 685, 168, 751, 168, + 751, 346, 771, 346, 771, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcOval.new(@canvas, box(812, 122, 9), + TkcOval.new(@canvas, box(812, 122, 9), :tag=>'I1', :fill=>color2, :outline=>'') @canvas.itembind('I1', '1'){ start } @@ -466,9 +466,9 @@ class TkGoldberg_Demo def move1(step = nil) step = get_step(1, step) pos = [ - [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], - [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], - [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], + [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], + [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], + [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], [-100, -100] ] return 0 if step >= pos.length @@ -484,40 +484,40 @@ class TkGoldberg_Demo color = @C['2'] # Fulcrum - TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], + TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], :fill=>@C['fg'], :outline=>@C['fg']) # Strike box - TkcRectangle.new(@canvas, [628, 335, 660, 383], + TkcRectangle.new(@canvas, [628, 335, 660, 383], :fill=>'', :outline=>@C['fg']) (0..2).each{|y| yy = 335 + y*16 - TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) - TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) } # Lever - TkcLine.new(@canvas, [702, 366, 798, 366], + TkcLine.new(@canvas, [702, 366, 798, 366], :fill=>@C['fg'], :width=>6, :tag=>'I2_0') # R strap - TkcLine.new(@canvas, [712, 363, 712, 355], + TkcLine.new(@canvas, [712, 363, 712, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_1') # L strap - TkcLine.new(@canvas, [705, 363, 705, 355], + TkcLine.new(@canvas, [705, 363, 705, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_2') # Match stick - TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], + TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], :fill=>@C['fg'], :width=>3, :tag=>'I2_3') # Match head - TkcPolygon.new(@canvas, - [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, - 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], + TkcPolygon.new(@canvas, + [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, + 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], :fill=>color, :outline=>color, :tag=>'I2_4') end @@ -527,15 +527,15 @@ class TkGoldberg_Demo stages = [0, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 1] xy = [] xy[0] = [ - 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, + 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, 662, 318, 662, 328, 671, 336 ] xy[1] = [ - 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, + 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, 661, 327, 671, 335 ] xy[2] = [ - 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, + 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, 666, 309, 660, 324, 672, 336 ] @@ -546,7 +546,7 @@ class TkGoldberg_Demo if step == 0 # Rotate the match beta = 20 - + ox, oy = anchor('I2_0', :s) # Where to pivot i = 0 @@ -571,23 +571,23 @@ class TkGoldberg_Demo xy = [ [602, 296], [577, 174], [518, 174] ] xy.each{|x, y| # 3 Pulleys - TkcOval.new(@canvas, box(x, y, 13), + TkcOval.new(@canvas, box(x, y, 13), :fill=>color, :outline=>@C['fg'], :width=>3) TkcOval.new(@canvas, box(x, y, 2), :fill=>@C['fg'], :outline=>@C['fg']) } # Wall to flame - TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', + TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', :width=>3, :fill=>@C['fg'], :smooth=>true) # Flame to pulley 1 - TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', + TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', :width=>3, :fill=>@C['fg'], :smooth=>true) - TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', + TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', :width=>3, :fill=>@C['fg'], :smooth=>true) # Pulley 1 half way to 2 - TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', + TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', :width=>3, :fill=>@C['fg']) # Pulley 1 other half to 2 @@ -597,26 +597,26 @@ class TkGoldberg_Demo TkcLine.new(@canvas, [577, 161, 518, 161], :width=>3, :fill=>@C['fg']) # Down to weight - TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', + TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', :width=>3, :fill=>@C['fg']) # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle x1, y1, x2, y2 = [515, 207, 495, 207] - TkcOval.new(@canvas, box(x1, y1, 6), + TkcOval.new(@canvas, box(x1, y1, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcOval.new(@canvas, box(x2, y2, 6), + TkcOval.new(@canvas, box(x2, y2, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, + TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, :tag=>'I3_', :fill=>color2, :outline=>color2) - - TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), + + TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), :smooth=>true, :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcLine.new(@canvas, [500, 217, 511, 217], + TkcLine.new(@canvas, [500, 217, 511, 217], :tag=>'I3_', :fill=>color2, :width=>10) # Bottom weight target - TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], + TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], :tag=>'I3__', :fill=>@C['fg'], :joinstyle=>:miter, :width=>10) end @@ -659,7 +659,7 @@ class TkGoldberg_Demo } # Swing gate - TkcLine.new(@canvas, [518, 464, 518, 428], + TkcLine.new(@canvas, [518, 464, 518, 428], :tag=>'I4', :fill=>color, :width=>1) end @@ -686,7 +686,7 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3) xy = [ - 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, + 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, 575, 452, 574, 454, 566, 456, 554, 456, 545, 456, 537, 454, 530, 452 ] TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_0'], :fill=>color) @@ -696,7 +696,7 @@ class TkGoldberg_Demo xy = box(540, 446, 2) # Eye xy = [540, 444, 541, 445, 541, 447, 540, 448, 538, 447, 538, 445] - TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], + TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], :outline=>'', :smooth=>true) xy = [538, 454, 535, 461] # Front leg @@ -716,9 +716,9 @@ class TkGoldberg_Demo step = get_step(5, step) pos = [ - [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], - [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], - [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], + [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], + [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], + [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], [422, 274, -30], [422, 260.5, -30, :x], [422.5, 248.5, -28], [425, 237] ] @@ -739,16 +739,16 @@ class TkGoldberg_Demo color = @C['6'] xy = [324, 130, 391, 204] # Ball holder xy = round_rect(xy, 10) - TkcPolygon.new(@canvas, xy, :smooth=>true, + TkcPolygon.new(@canvas, xy, :smooth=>true, :outline=>@C['fg'], :width=>3, :fill=>color) xy = [339, 204, 376, 253] # Below the ball holder - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>color, :tag=>'I6c') xy = box(346, 339, 28) TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') # Roter - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>80, :extent=>205) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>-41, :extent=>85) xy = box(346, 339, 15) # Center of rotor @@ -763,10 +763,10 @@ class TkGoldberg_Demo TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'') xy = [ - 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, + 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, 352, 403, 352, 366 ] - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2) # Below rotor TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2) xy = box(275, 342, 7) # On/off rotor @@ -791,7 +791,7 @@ class TkGoldberg_Demo loc = -i color = colors[i] x, y = @XY6["#{loc}"] - TkcOval.new(@canvas, box(x, y, 5), + TkcOval.new(@canvas, box(x, y, 5), :fill=>color, :outline=>color, :tag=>"I6_b#{i}") } draw6a(12) # The wheel @@ -817,7 +817,7 @@ class TkGoldberg_Demo @canvas.move('I6_', -7, 0) if step == 1 # Poke a hole xy = [348, 226, 365, 240] - TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), + TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), :outline=>'') end return 1 @@ -857,24 +857,24 @@ class TkGoldberg_Demo def draw7 color = @C['7'] xy = [198, 306, 277, 374] # Box - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :fill=>color, :tag=>'I7z') @canvas.lower('I7z') xy = [275, 343, 230, 349] - TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, + TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, :arrowshape=>[23, 23, 8], :width=>6) xy = [225, 324] # On button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 323] # On text font = ['Times Roman', 8] - TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, :fill=>@C['fg'], :font=>font) xy = [225, 350] # Off button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 349] # Off text - TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, :fill=>@C['fg'], :font=>font) end @@ -919,7 +919,7 @@ class TkGoldberg_Demo xy = [280, 209, 296, 248] TkcOval.new(@canvas, xy, :outline=>color, :fill=>color) xy = [ - 288, 249, 252, 249, 260, 240, 280, 234, + 288, 249, 252, 249, 260, 240, 280, 234, 296, 234, 316, 240, 324, 249, 288, 249 ] TkcPolygon.new(@canvas, xy, :fill=>color, :smooth=>true) @@ -928,16 +928,16 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color) xy = [255, 206, 265, 234] # Fan blades - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 176, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 206, 265, 220] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') xy = [255, 190, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') end @@ -962,17 +962,17 @@ class TkGoldberg_Demo color = @C['10a'] color2 = @C['10b'] xy = [191, 230, 233, 230, 233, 178, 191, 178] # Sail - TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], :tag=>'I10') xy = box(209, 204, 31) # Front - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = box(249, 204, 31) # Back - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = [200, 171, 200, 249] # Mast @@ -992,10 +992,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(239, 262, 17) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>95, :extent=>103) xy = box(76, 266, 21) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>190) end @@ -1003,9 +1003,9 @@ class TkGoldberg_Demo step = get_step(10, step) pos = [ - [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], - [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], - [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], + [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], + [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], + [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], [116, 212], [111, 212] ] @@ -1032,21 +1032,21 @@ class TkGoldberg_Demo xy = [55, 504, 55, 591] # Bottom right side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(71, 460, 48) # Outer loop - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>110, :extent=>-290, :tag=>'I11i') xy = box(71, 460, 16) # Inner loop - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', :width=>3, :tag=>'I11i') TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['bg'], :width=>3) xy = [23, 264, 23, 591] # Left side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(1, 266, 23) # Top left curve - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>90) xy = box(75, 235, 9) # The ball - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', :width=>3, :tag=>'I11') end @@ -1054,8 +1054,8 @@ class TkGoldberg_Demo step = get_step(11, step) pos = [ - [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], - [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], + [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], + [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], [100, 437], [65, 423], [-100, -100], [38, 505], [38, 527, :x], [38, 591] ] @@ -1069,11 +1069,11 @@ class TkGoldberg_Demo # Hand def draw12 xy = [ - 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, + 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, 60, 590, 60, 610, 60, 610 ] xy.concat([60, 610, 65, 620, 60, 631]) # Thumb - xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, + xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, 56, 669, 50, 669, 50, 662, 50, 637]) y0 = 637 # Bumps for fingers @@ -1083,7 +1083,7 @@ class TkGoldberg_Demo x2 = x - 10 xy << x << y0 << x1 << y1 << x2 << y0 } - TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], :smooth=>true, :tag=>'I12', :width=>3) end @@ -1107,25 +1107,25 @@ class TkGoldberg_Demo ] radii = [2, 9, 9, 8, 5, 5, 2] - round_poly(@canvas, xy, radii, :width=>3, + round_poly(@canvas, xy, radii, :width=>3, :outline=>@C['fg'], :fill=>color) - round_poly(@canvas, xy2, radii, :width=>3, + round_poly(@canvas, xy2, radii, :width=>3, :outline=>@C['fg'], :fill=>color) xy = [56, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13') xy = [809, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13R') xy = [112, 687] # Label - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [762, 687] - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [138, 663, 148, 636, 178, 636] # Paper guide @@ -1133,7 +1133,7 @@ class TkGoldberg_Demo xy = [732, 663, 722, 636, 692, 636] TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3) - sine([149, 688, 720, 688], 5, 15, + sine([149, 688, 720, 688], 5, 15, :tag=>'I13_s', :fill=>@C['fg'], :width=>3) end @@ -1163,17 +1163,17 @@ class TkGoldberg_Demo def draw14 color = @C['14'] xy = [102, 661, 113, 632, 130, 618] # Left paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_0') xy = [148, 629, 125, 640, 124, 662] # Right paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_1') draw14a('L') xy = [ 768.0, 662.5, 767.991316225, 662.433786215, 767.926187912, 662.396880171 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_0') @canvas.lower('I14R_0') # NB. these numbers are VERY sensitive, you must start with final size @@ -1181,7 +1181,7 @@ class TkGoldberg_Demo xy = [ 745.947897349, 662.428358855, 745.997829056, 662.452239237, 746.0, 662.5 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_1') @canvas.lower('I14R_1') end @@ -1194,11 +1194,11 @@ class TkGoldberg_Demo x3, y3, x4, y4, x5, y5 = xy2 zz = [ - x0, y0, x0, y0, xy, x2, y2, x2, y2, + x0, y0, x0, y0, xy, x2, y2, x2, y2, x3, y3, x3, y3, xy2, x5, y5, x5, y5 ].flatten @canvas.delete("I14#{side}") - TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, + TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, :fill=>color, :outline=>color, :width=>3) @canvas.lower("I14#{side}") end @@ -1251,7 +1251,7 @@ class TkGoldberg_Demo xy = [765, 557, 784, 583] TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2) - sine([658, 580, 765, 580], 3, 15, + sine([658, 580, 765, 580], 3, 15, :tag=>'I15_s', :fill=>@C['fg'], :width=>3) end @@ -1290,7 +1290,7 @@ class TkGoldberg_Demo xy = [722, 485, 791, 556] TkcRectangle.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3) xy = box(752, 515, 25) # Bell - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', :tag=>'I16b', :width=>2) xy = box(752, 515, 5) # Bell button TkcOval.new(@canvas, xy, :fill=>'black', :outline=>'black', :tag=>'I16b') @@ -1329,24 +1329,24 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = [664, 523, 717, 549] # Body - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :style=>:chord, :start=>128, :extent=>260, :tag=>'I17') xy = [709, 554, 690, 543] # Paw - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = [657, 544, 676, 555] - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = box(660, 535, 15) # Lower face - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>150, :extent=>240, :tag=>'I17_') - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:chord, :start=>150, :extent=>240, :tag=>'I17_') xy = [674, 529, 670, 513, 662, 521, 658, 521, 650, 513, 647, 529] # Ears TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, :tag=>['I17_', 'I17_c']) xy = [652, 542, 628, 539] # Whiskers TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') @@ -1356,23 +1356,23 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [668, 543, 687, 538] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 544, 688, 546] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 547, 688, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [649, 530, 654, 538, 659, 530] # Left eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [671, 530, 666, 538, 661, 530] # Right eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [655, 543, 660, 551, 665, 543] # Mouth - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') end @@ -1385,10 +1385,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = box(654, 530, 4) # Left eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') xy = box(666, 530, 4) # Right eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') @canvas.move('I17_', 0, -20) # Move face up @@ -1398,19 +1398,19 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [ # Body - 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, - 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, + 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, + 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, 668, 527, 668, 527, 675, 522, 676, 517, 677, 512 ] - TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), - :outline=>@C['fg'], :width=>3, :smooth=>true, + TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), + :outline=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = [716, 514, 716, 554] # Back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [694, 532, 694, 554] # 2nd back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [715, 514, 718, 506, 719, 495, 716, 488] # Tail - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') @canvas.raise('I17w') # Make whiskers visible @@ -1439,14 +1439,14 @@ class TkGoldberg_Demo step = get_step(18, step) pos = [ - [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], + [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], [136, 506], [16, 506], [-100, -100] ] b = [] b[0] = [490, 502, 719, 507, 524, 512] # Band collapsing b[1] = [ - 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, + 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, 553, 536, 538, 534, 532, 519, 529, 499 ] b[2] = [ @@ -1477,54 +1477,54 @@ class TkGoldberg_Demo color = @C['19'] xx = [[249, 181], [155, 118], [86, 55], [22, 0]] xx.each{|x1, x2| - TkcRectangle.new(@canvas, x1, 453, x2, 467, + TkcRectangle.new(@canvas, x1, 453, x2, 467, :fill=>color, :outline=>'', :tag=>'I19') - TkcLine.new(@canvas, x1, 453, x2, 453, + TkcLine.new(@canvas, x1, 453, x2, 453, :fill=>@C['fg'], :width=>1) # Pipe top - TkcLine.new(@canvas, x1, 467, x2, 467, + TkcLine.new(@canvas, x1, 467, x2, 467, :fill=>@C['fg'], :width=>1) # Pipe bottom } @canvas.raise('I11i') xy = box(168, 460, 16) # Bulge by the joint TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>21, :extent=>136) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>-21, :extent=>-130) xy = [249, 447, 255, 473] # First joint 26x6 TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1) xy = box(257, 433, 34) # Bend up - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>-91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 433, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>-92) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 421, 34) # Bend left - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(257, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(243, 421, 34) # Bend down - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = box(243, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = [270, 427, 296, 433] # 2nd joint bottom @@ -1566,7 +1566,7 @@ class TkGoldberg_Demo pos = [451, 462, 473, 484, 496, 504, 513, 523, 532] freq = [20, 40, 40, 40, 40, 40, 40, 40, 40] pos = [ - [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], + [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], [504, 40], [513, 40], [523, 40], [532, 40, :x] ] return 0 if step >= pos.length @@ -1583,11 +1583,11 @@ class TkGoldberg_Demo color = @C['20'] @canvas.delete('I20') - sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], + sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], :width=>3, :fill=>color, :smooth=>true) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20a']) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20b']) @canvas.move('I20a', 8, 0) @canvas.move('I20b', 16, 0) @@ -1603,18 +1603,18 @@ class TkGoldberg_Demo xy = [245, 490, 237, 535] # Right side xy2 = [189, 535, 181, 490] # Left side - TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', :tag=>['I21', 'I21f']) TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21') TkcLine.new(@canvas, xy2, :fill=>@C['fg'], :width=>2, :tag=>'I21') xy = [182, 486, 244, 498] # Top - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, :tag=>['I21', 'I21f']) - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21t']) xy = [189, 532, 237, 540] # Bottom - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21b']) end @@ -1637,7 +1637,7 @@ class TkGoldberg_Demo @canvas.itemconfigure('I21b', :fill=>@C['20']) @canvas.delete('I21w') - TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, + TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, :tag=>['I21', 'I21w'], :outline=>'', :fill=>@C['20']) @canvas.lower('I21w', 'I21') @canvas.raise('I21b') @@ -1673,21 +1673,21 @@ class TkGoldberg_Demo color3 = @C['23c'] xy = [185, 623, 253, 650] # Block - TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], + TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], :width=>2, :tag=>'I23a') xy = [187, 592, 241, 623] # Balloon TkcOval.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', :style=>:arc, :start=>12, :extent=>336) xy = [239, 604, 258, 589, 258, 625, 239, 610] # Balloon nozzle TkcPolygon.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23b') xy = [285, 611, 250, 603] # Dart body - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 596, 249, 618, 264, 607, 249, 596] # Dart tail - TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 607, 268, 607] # Dart detail TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d') @@ -1699,7 +1699,7 @@ class TkGoldberg_Demo step = get_step(23, step) pos = [ - [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], + [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], [487, 607], [587, 607], [687, 607], [787, 607], [-100, -100] ] @@ -1719,7 +1719,7 @@ class TkGoldberg_Demo def draw24 color = @C['24a'] xy = [366, 518, 462, 665] # Balloon - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3, :tag=>'I24') xy = [414, 666, 414, 729] # String TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I24') @@ -1728,16 +1728,16 @@ class TkGoldberg_Demo :width=>3, :tag=>'I24') xy = [387, 567, 390, 549, 404, 542] # Reflections - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [395, 568, 399, 554, 413, 547] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [403, 570, 396, 555, 381, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [408, 564, 402, 547, 386, 545] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') end @@ -1750,16 +1750,16 @@ class TkGoldberg_Demo if step == 0 @canvas.delete('I24') # Exploding balloon xy = [ - 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, - 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, - 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, - 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, + 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, + 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, + 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, + 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, 431, 441, 431, 440, 400, 502, 347, 465, 347, 465 ] - TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], + TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], :outline=>@C['24a'], :width=>10, :smooth=>true) msg = Tk.subst(@S['message'].value) - TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], + TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], :justify=>:center, :font=>['Times Roman', 18, :bold]) return 1 end @@ -1790,9 +1790,9 @@ class TkGoldberg_Demo if step >= 3 @canvas.delete('I24', 'I26') - TkcText.new(@canvas, 430, 735, :anchor=>:s, :tag=>'I26', - #:text=>'click to continue', - :text=>'¥¯¥ê¥Ã¥¯¤Ç¥ê¥»¥Ã¥È¤·¤Þ¤¹', + TkcText.new(@canvas, 430, 735, :anchor=>:s, :tag=>'I26', + #:text=>'click to continue', + :text=>'¥¯¥ê¥Ã¥¯¤Ç¥ê¥»¥Ã¥È¤·¤Þ¤¹', :font=>['Times Roman', 20, :bold]) @canvas.bind('1', proc{reset}) return 4 @@ -1972,11 +1972,11 @@ class TkGoldberg_Demo def sparkle(oxy, tag) xy = [ - [299, 283], [298, 302], [295, 314], [271, 331], + [299, 283], [298, 302], [295, 314], [271, 331], [239, 310], [242, 292], [256, 274], [281, 273] ] xy.each{|x, y| - TkcLine.new(@canvas, 271, 304, x, y, + TkcLine.new(@canvas, 271, 304, x, y, :fill=>'white', :width=>3, :tag=>tag) } move_abs(tag, oxy) diff --git a/ext/tk/sample/demos-jp/icon.rb b/ext/tk/sample/demos-jp/icon.rb index a2ca6651dc..935519435b 100644 --- a/ext/tk/sample/demos-jp/icon.rb +++ b/ext/tk/sample/demos-jp/icon.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($icon_demo) && $icon_demo - $icon_demo.destroy + $icon_demo.destroy $icon_demo = nil end diff --git a/ext/tk/sample/demos-jp/image1.rb b/ext/tk/sample/demos-jp/image1.rb index d9435cc1a2..10078c6c22 100644 --- a/ext/tk/sample/demos-jp/image1.rb +++ b/ext/tk/sample/demos-jp/image1.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($image1_demo) && $image1_demo - $image1_demo.destroy + $image1_demo.destroy $image1_demo = nil end diff --git a/ext/tk/sample/demos-jp/image2.rb b/ext/tk/sample/demos-jp/image2.rb index 1bb2c9e9c3..3e8b87461f 100644 --- a/ext/tk/sample/demos-jp/image2.rb +++ b/ext/tk/sample/demos-jp/image2.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($image2_demo) && $image2_demo - $image2_demo.destroy + $image2_demo.destroy $image2_demo = nil end diff --git a/ext/tk/sample/demos-jp/image3.rb b/ext/tk/sample/demos-jp/image3.rb index 12b8aafd8e..625e69a21d 100644 --- a/ext/tk/sample/demos-jp/image3.rb +++ b/ext/tk/sample/demos-jp/image3.rb @@ -9,7 +9,7 @@ # toplevel widget if defined?($image3_demo) && $image3_demo - $image3_demo.destroy + $image3_demo.destroy $image3_demo = nil end @@ -22,7 +22,7 @@ $image3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($image3_demo).pack(:fill=>:both, :expand=>true) -# +# def loadDir3(w) w.delete(0,'end') Dir.glob([$dirName,'*'].join(File::Separator)).sort.each{|f| @@ -38,10 +38,10 @@ end # Arguments: # w - Name of the toplevel window of the demo. def selectAndLoadDir3(w, lbox) - dir = Tk.chooseDirectory(:initialdir=>$dirName.value, + dir = Tk.chooseDirectory(:initialdir=>$dirName.value, :parent=>w, :mustexist=>true) if dir.length > 0 - $dirName.value = dir + $dirName.value = dir loadDir3(lbox) end end @@ -94,11 +94,11 @@ image3_f = TkFrame.new(base_frame).pack(:fill=>:both, :expand=>true) image3_df = TkLabelFrame.new(base_frame, :text=>'¥Ç¥£¥ì¥¯¥È¥ê:') -image3_ff = TkLabelFrame.new(base_frame, :text=>'¥Õ¥¡¥¤¥ë:', +image3_ff = TkLabelFrame.new(base_frame, :text=>'¥Õ¥¡¥¤¥ë:', :padx=>'2m', :pady=>'2m') image3_lbx = TkListbox.new(image3_ff, :width=>20, :height=>10) { pack(:side=>:left, :fill=>:y, :expand=>true) - yscrollbar(TkScrollbar.new(image3_ff).pack(:side=>:left, :fill=>:y, + yscrollbar(TkScrollbar.new(image3_ff).pack(:side=>:left, :fill=>:y, :expand=>true)) insert(0, *(%w(earth.gif earthris.gif teapot.ppm))) bind('Double-1', proc{|x,y| loadImage3(self, x, y)}, '%x %y') @@ -109,7 +109,7 @@ image3_ent = TkEntry.new(image3_df, :width=>30, :textvariable=>$dirName){ bind('Return', proc{loadDir3(image3_lbx)}) } -TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"¥Ç¥£¥ì¥¯¥È¥êÁªÂò", +TkButton.new(image3_df, :pady=>0, :padx=>'2m', :text=>"¥Ç¥£¥ì¥¯¥È¥êÁªÂò", :command=>proc{selectAndLoadDir3(image3_ent, image3_lbx)}) { pack(:side=>:left, :fill=>:y, :padx=>[0, '2m'], :pady=>'2m') } @@ -121,7 +121,7 @@ image3_if = TkLabelFrame.new(base_frame, :text=>' Tk.grid(image3_df, '-', :sticky=>:ew, :padx=>'1m', :pady=>'1m', :in=>image3_f) -Tk.grid(image3_ff, image3_if, +Tk.grid(image3_ff, image3_if, :sticky=>:nw, :padx=>'1m', :pady=>'1m', :in=>image3_f) TkGrid.columnconfigure(image3_f, 1, :weight=>1) diff --git a/ext/tk/sample/demos-jp/items.rb b/ext/tk/sample/demos-jp/items.rb index 64ceeff3ec..4440905db8 100644 --- a/ext/tk/sample/demos-jp/items.rb +++ b/ext/tk/sample/demos-jp/items.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($items_demo) && $items_demo - $items_demo.destroy + $items_demo.destroy $items_demo = nil end @@ -73,11 +73,11 @@ TkFrame.new(base_frame) {|cf| c.pack('in'=>cf, 'expand'=>'yes', 'fill'=>'both') else - c.grid('in'=>cf, 'row'=>0, 'column'=>0, + c.grid('in'=>cf, 'row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - vs.grid('row'=>0, 'column'=>1, + vs.grid('row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - hs.grid('row'=>1, 'column'=>0, + hs.grid('row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(cf, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(cf, 0, 'weight'=>1, 'minsize'=>0) @@ -118,8 +118,8 @@ $tag_item = TkcGroup.new(cvs) # Set up demos within each of the areas of the grid. TkcText.new(cvs, '5c', '.2c', 'text'=>'¥é¥¤¥ó', 'anchor'=>'n') -TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c', - 'width'=>2, 'fill'=>blue, 'capstyle'=>'butt', +TkcLine.new(cvs, '1c', '1c', '3c', '1c', '1c', '4c', '3c', '4c', + 'width'=>2, 'fill'=>blue, 'capstyle'=>'butt', 'join'=>'miter', 'tags'=>$tag_item ) TkcLine.new(cvs, '4.67c','1c','4.67c','4c', 'arrow'=>'last', 'tags'=>$tag_item) TkcLine.new(cvs, '6.33c','1c','6.33c','4c', 'arrow'=>'both', 'tags'=>$tag_item) @@ -127,38 +127,38 @@ TkcLine.new(cvs, '5c','6c','9c','6c','9c','1c','8c','1c','8c','4.8c','8.8c', '4.8c','8.8c','1.2c','8.2c','1.2c','8.2c','4.6c','8.6c','4.6c', '8.6c','1.4c','8.4c','1.4c','8.4c','4.4c', 'width'=>3, 'fill'=>red, 'tags'=>$tag_item ) -TkcLine.new(cvs, '1c','5c','7c','5c','7c','7c','9c','7c', 'width'=>'.5c', +TkcLine.new(cvs, '1c','5c','7c','5c','7c','7c','9c','7c', 'width'=>'.5c', 'stipple'=>'@'+[$demo_dir,'..', - 'images','gray25.xbm'].join(File::Separator), + 'images','gray25.xbm'].join(File::Separator), 'arrow'=>'both', 'arrowshape'=>'15 15 7', 'tags'=>$tag_item ) TkcLine.new(cvs, '1c','7c','1.75c','5.8c','2.5c','7c','3.25c','5.8c','4c','7c', - 'width'=>'.5c', 'capstyle'=>'round', 'join'=>'round', + 'width'=>'.5c', 'capstyle'=>'round', 'join'=>'round', 'tags'=>$tag_item ) -TkcText.new(cvs, '15c', '.2c', +TkcText.new(cvs, '15c', '.2c', 'text'=>'¶ÊÀþ (³ê¤é¤«¤Ë¤Ä¤Ê¤¤¤ÀľÀþ)', 'anchor'=>'n') -TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c', +TkcLine.new(cvs, '11c','4c','11.5c','1c','13.5c','1c','14c','4c', 'smooth'=>'on', 'fill'=>blue, 'tags'=>$tag_item ) -TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c', +TkcLine.new(cvs, '15.5c','1c','19.5c','1.5c','15.5c','4.5c','19.5c','4c', 'smooth'=>'on', 'arrow'=>'both', 'width'=>3, 'tags'=>$tag_item ) -TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c', +TkcLine.new(cvs, '12c','6c','13.5c','4.5c','16.5c','7.5c','18c','6c', '16.5c','4.5c','13.5c','7.5c','12c','6c', - 'smooth'=>'on', 'width'=>'3m', 'capstyle'=>'round', + 'smooth'=>'on', 'width'=>'3m', 'capstyle'=>'round', 'stipple'=>'@'+[$demo_dir, '..', - 'images', 'gray25.xbm'].join(File::Separator), + 'images', 'gray25.xbm'].join(File::Separator), 'fill'=>red, 'tags'=>$tag_item ) TkcText.new(cvs, '25c', '.2c', 'text'=>'¿³Ñ·Á', 'anchor'=>'n') TkcPolygon.new(cvs, '21c','1.0c','22.5c','1.75c','24c','1.0c','23.25c','2.5c', '24c','4.0c','22.5c','3.25c','21c','4.0c','21.75c','2.5c', - 'fill'=>'green', 'outline'=>'black', 'width'=>4, + 'fill'=>'green', 'outline'=>'black', 'width'=>4, 'tags'=>$tag_item ) TkcPolygon.new(cvs, '25c','4c','25c','4c','25c','1c','26c','1c','27c','4c', '28c','1c','29c','1c','29c','4c','29c','4c', 'fill'=>red, 'smooth'=>'on', 'tags'=> $tag_item) TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c', '28c','5.25c','24c','5.25c','24c','6.0c','26c','6c','26c', - '7.5c','22c','7.5c', + '7.5c','22c','7.5c', 'stipple'=>'@' + [$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator), 'outline'=>'black', 'tags'=>$tag_item ) @@ -166,7 +166,7 @@ TkcPolygon.new(cvs, '22c','4.5c','25c','4.5c','25c','6.75c','28c','6.75c', TkcText.new(cvs, '5c', '8.2c', 'text'=>'¶ë·Á', 'anchor'=>'n') TkcRectangle.new(cvs, '1c','9.5c','4c','12.5c', 'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item) -TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c', +TkcRectangle.new(cvs, '0.5c','13.5c','4.5c','15.5c', 'fill'=>green, 'tags'=>$tag_item ) TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'', 'stipple'=>'@'+[$demo_dir,'..', @@ -176,7 +176,7 @@ TkcRectangle.new(cvs, '6c','10c','9c','15c', 'outline'=>'', TkcText.new(cvs, '15c', '8.2c', 'text'=>'Âʱß', 'anchor'=>'n') TkcOval.new(cvs, '11c','9.5c','14c','12.5c', 'outline'=>red, 'width'=>'3m', 'tags'=>$tag_item) -TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c', +TkcOval.new(cvs, '10.5c','13.5c','14.5c','15.5c', 'fill'=>green, 'tags'=>$tag_item ) TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', 'stipple'=>'@'+[$demo_dir,'..', @@ -185,40 +185,40 @@ TkcOval.new(cvs, '16c','10c','19c','15c', 'outline'=>'', TkcText.new(cvs, '25c', '8.2c', 'text'=>'¥Æ¥­¥¹¥È', 'anchor'=>'n') TkcRectangle.new(cvs, '22.4c','8.9c','22.6c','9.1c') -TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', +TkcText.new(cvs, '22.5c', '9c', 'anchor'=>'n', 'font'=>font1, 'width'=>'4c', 'text'=>'û¤¤¥Æ¥­¥¹¥È¡£¥ï¡¼¥É¥é¥Ã¥×¡¢º¸Â·¤¨¡¢¥¢¥ó¥«¡¼¤ÏËÌ(¾å)¡£¢¢¤Ï³Æ¥Æ¥­¥¹¥È¤Î¥¢¥ó¥«¡¼¥Ý¥¤¥ó¥È¤ò¼¨¤¹¡£', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '25.4c','10.9c','25.6c','11.1c') -TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, +TkcText.new(cvs, '25.5c', '11c', 'anchor'=>'w', 'font'=>font1, 'fill'=>blue, 'text'=>"¤¤¤¯¤Ä¤«¤Î¹Ô¡£\n¤½¤ì¤¾¤ìÆÈΩ¤Ë\n¹Ô·¤¨¡£\nÁ´¤Æº¸Ã¼¤¬¥¢¥ó¥«¡¼¤µ¤ì¤Æ¤¤¤ë¡£", 'justify'=>'center', 'tags'=>$tag_item ) TkcRectangle.new(cvs, '24.9c','13.9c','25.1c','14.1c') if $tk_version =~ /^4\.[01]/ - TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, + TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, 'stipple'=>'@' + [$demo_dir, '..', 'images', 'grey.5'].join(File::Separator), 'text'=>'Stippled characters', 'tags'=>$tag_item ) else - TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, - 'stipple'=>'gray50', 'text'=>'Stippled characters', + TkcText.new(cvs, '25c', '14c', 'anchor'=>'c', 'font'=>font2, 'fill'=>red, + 'stipple'=>'gray50', 'text'=>'Stippled characters', 'tags'=>$tag_item ) end TkcText.new(cvs, '5c', '16.2c', 'text'=>'¸Ì', 'anchor'=>'n') -TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black', +TkcArc.new(cvs, '0.5c','17c','7c','20c', 'fill'=>green, 'outline'=>'black', 'start'=>45, 'extent'=>270, 'style'=>'pieslice', 'tags'=>$tag_item) -#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', -# 'outline'=>blue, 'start'=>135, 'extent'=>270, +#TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', +# 'outline'=>blue, 'start'=>135, 'extent'=>270, # 'outlinestipple'=>'@' + ['images', 'grey.25'].join(File::Separator), # 'tags'=>$tag_item) -TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', - 'outline'=>blue, 'start'=>135, 'extent'=>270, +TkcArc.new(cvs, '6.5c','17c','9.5c','20c', 'width'=>'4m', 'style'=>'arc', + 'outline'=>blue, 'start'=>135, 'extent'=>270, 'outlinestipple'=>'@'+[$demo_dir, '..', 'images','gray25.xbm'].join(File::Separator), 'tags'=>$tag_item) -TkcArc.new(cvs, '0.5c','20c','9.5c','24c', 'width'=>'4m', 'style'=>'pieslice', - 'fill'=>'', 'outline'=>red, 'start'=>225, 'extent'=>90, +TkcArc.new(cvs, '0.5c','20c','9.5c','24c', 'width'=>'4m', 'style'=>'pieslice', + 'fill'=>'', 'outline'=>red, 'start'=>225, 'extent'=>90, 'tags'=>$tag_item) TkcArc.new(cvs, '5.5c','20.5c','9.5c','23.5c', 'width'=>'4m', 'style'=>'chord', - 'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270, + 'fill'=>blue, 'outline'=>'', 'start'=>45, 'extent'=>270, 'tags'=>$tag_item) TkcText.new(cvs, '15c', '16.2c', 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×', 'anchor'=>'n') @@ -253,17 +253,17 @@ TkcText.new(cvs, '25c', '16.2c', 'text'=>' TkButton.new(cvs) {|b| text '²¡¤·¤Æ¤Í' command proc{butPress cvs, red} - TkcWindow.new(cvs, '21c','18c', + TkcWindow.new(cvs, '21c','18c', 'window'=>b, 'anchor'=>'nw', 'tags'=>$tag_item) } TkEntry.new(cvs, 'width'=>20, 'relief'=>'sunken') {|e| insert 'end', 'ÊÔ½¸¤·¤Æ¤Í' - TkcWindow.new(cvs, '21c','21c', + TkcWindow.new(cvs, '21c','21c', 'window'=>e, 'anchor'=>'nw', 'tags'=>$tag_item) } -TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c', +TkScale.new(cvs, 'from'=>0, 'to'=>100, 'length'=>'6c', 'sliderlength'=>'.4c', 'width'=>'.5c', 'tickinterval'=>0 ) {|scl| - TkcWindow.new(cvs, '28.5c','17.5c', + TkcWindow.new(cvs, '28.5c','17.5c', 'window'=>scl, 'anchor'=>'n', 'tags'=>$tag_item) } TkcText.new(cvs, '21c', '17.9c', 'text'=>'¥Ü¥¿¥ó:', 'anchor'=>'sw') @@ -314,7 +314,7 @@ def itemLeave(c) $restoreCmd.call if $restoreCmd end -# Utility methods for stroking out a rectangle and printing what's +# Utility methods for stroking out a rectangle and printing what's # underneath the rectangle's area. def itemMark(c,x,y) @@ -328,7 +328,7 @@ def itemStroke(c,x,y) y = c.canvasy(y) if $areaX1 != x && $areaY1 != y c.delete 'area' - c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, + c.addtag_withtag 'area', TkcRectangle.new(c, $areaX1, $areaY1, x, y, '-outline', 'black') $areaX2 = x $areaY2 = y @@ -369,11 +369,11 @@ def itemDrag(c,x,y) $lastY = y end -# Method that's invoked when the button embedded in the canvas +# Method that's invoked when the button embedded in the canvas # is invoked. def butPress(w,color) - i = TkcText.new(w, '25c', '18.1c', + i = TkcText.new(w, '25c', '18.1c', 'text'=>'¤¤¤Æ¤Æ!!', 'fill'=>color, 'anchor'=>'n') Tk.after(500, proc{w.delete i}) end diff --git a/ext/tk/sample/demos-jp/knightstour.rb b/ext/tk/sample/demos-jp/knightstour.rb index d4595ea441..ae0f13076e 100644 --- a/ext/tk/sample/demos-jp/knightstour.rb +++ b/ext/tk/sample/demos-jp/knightstour.rb @@ -157,16 +157,16 @@ class Knights_Tour frame = Ttk::Frame.new($knightstour) sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'knightstour'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'knightstour'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $knightstour.destroy $knightstour = nil - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) frame @@ -178,7 +178,7 @@ class Knights_Tour $knightstour.withdraw base_f = Ttk::Frame.new($knightstour) @board = Tk::Canvas.new(base_f, :width=>240, :height=>240) - @log = Tk::Text.new(base_f, :width=>12, :height=>1, + @log = Tk::Text.new(base_f, :width=>12, :height=>1, :font=>'Arial 8', :background=>'white') scr = @log.yscrollbar(Ttk::Scrollbar.new(base_f)) @@ -188,13 +188,13 @@ class Knights_Tour tool_f = Ttk::Frame.new($knightstour) label = Ttk::Label.new(tool_f, :text=>'¼Â¹Ô®ÅÙ') - scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay, + scale = Ttk::Scale.new(tool_f, :from=>8, :to=>2000, :variable=>@delay, :command=>proc{|n| set_delay(n)}) - check = Ttk::Checkbutton.new(tool_f, :text=>'È¿Éü', + check = Ttk::Checkbutton.new(tool_f, :text=>'È¿Éü', :variable=>@continuous) - @start_btn = Ttk::Button.new(tool_f, :text=>'³«»Ï', + @start_btn = Ttk::Button.new(tool_f, :text=>'³«»Ï', :command=>proc{tour()}) - @exit_btn = Ttk::Button.new(tool_f, :text=>'½ªÎ»', + @exit_btn = Ttk::Button.new(tool_f, :text=>'½ªÎ»', :command=>proc{_exit()}) 7.downto(0){|row| @@ -207,16 +207,16 @@ class Knights_Tour dfill = 'tan4' end coords = [col * 30 + 4, row * 30 + 4, col * 30 + 30, row * 30 + 30] - @board.create(TkcRectangle, coords, + @board.create(TkcRectangle, coords, :fill=>fill, :disabledfill=>dfill, :width=>2, :state=>:disabled) } } @knight_font = TkFont.new(:size=>-24) - @knight = TkcText.new(@board, 0, 0, :font=>@knight_font, - :text=>Tk::UTF8_String.new('\u265e'), - :anchor=>'nw', # :tags=>'knight', + @knight = TkcText.new(@board, 0, 0, :font=>@knight_font, + :text=>Tk::UTF8_String.new('\u265e'), + :anchor=>'nw', # :tags=>'knight', :fill=>'black', :activefill=>'#600000') @knight.coords(@board.coords(rand(64)+1)[0..1]) @knight.bind('ButtonPress-1', '%W %x %y'){|w,x,y| drag_start(w,x,y)} diff --git a/ext/tk/sample/demos-jp/label.rb b/ext/tk/sample/demos-jp/label.rb index 2e6b3e7e57..19105e6f71 100644 --- a/ext/tk/sample/demos-jp/label.rb +++ b/ext/tk/sample/demos-jp/label.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($label_demo) && $label_demo - $label_demo.destroy + $label_demo.destroy $label_demo = nil end @@ -49,12 +49,12 @@ TkFrame.new(base_frame) {|frame| # label demo Íѥե졼¥àÀ¸À® f_left = TkFrame.new(base_frame) f_right = TkFrame.new(base_frame) -[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', +[f_left, f_right].each{|w| w.pack('side'=>'left', 'expand'=>'yes', 'padx'=>10, 'pady'=>10, 'fill'=>'both')} # label À¸À® [ TkLabel.new(f_left, 'text'=>'ºÇ½é¤Î¥é¥Ù¥ë'), - TkLabel.new(f_left, 'text'=>'2 ÈÖÌÜ¡£¤Á¤ç¤Ã¤ÈÉ⤭¾å¤¬¤é¤»¤Æ¤ß¤Þ¤·¤¿', + TkLabel.new(f_left, 'text'=>'2 ÈÖÌÜ¡£¤Á¤ç¤Ã¤ÈÉ⤭¾å¤¬¤é¤»¤Æ¤ß¤Þ¤·¤¿', 'relief'=>'raised'), TkLabel.new(f_left, 'text'=>'3 ÈÖÌÜ¡£ÄÀ¤ó¤Ç¤¤¤Þ¤¹ ', 'relief'=>'sunken') ].each{|w| w.pack('side'=>'top', 'expand'=>'yes', 'pady'=>2, 'anchor'=>'w')} diff --git a/ext/tk/sample/demos-jp/labelframe.rb b/ext/tk/sample/demos-jp/labelframe.rb index 11b0d27308..cee504f4b6 100644 --- a/ext/tk/sample/demos-jp/labelframe.rb +++ b/ext/tk/sample/demos-jp/labelframe.rb @@ -9,7 +9,7 @@ if defined?($labelframe_demo) && $labelframe_demo - $labelframe_demo.destroy + $labelframe_demo.destroy $labelframe_demo = nil end @@ -22,18 +22,18 @@ $labelframe_demo = TkToplevel.new {|w| base_frame = TkFrame.new($labelframe_demo).pack(:fill=>:both, :expand=>true) # Some information -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top) -TkLabelFrame ¥¦¥£¥¸¥§¥Ã¥È¤Ï´ØÏ¢¤¹¤ë widget +TkLabelFrame ¥¦¥£¥¸¥§¥Ã¥È¤Ï´ØÏ¢¤¹¤ë widget ·²¤ò¤Þ¤È¤á¤Æ¼è¤ê°·¤¦¤¿¤á¤ËÍѤ¤¤é¤ì¤Þ¤¹¡£¥é ¥Ù¥ë¤ÏÄ̾ï¤Îʸ»úÎó¤Ç¤â²¿¤é¤«¤Î¥¦¥£¥¸¥§¥Ã¥È -¤Ç¤â¤«¤Þ¤¤¤Þ¤»¤ó¡£¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë -Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬ +¤Ç¤â¤«¤Þ¤¤¤Þ¤»¤ó¡£¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë +Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬ labelframe ¥¦¥£¥¸¥§¥Ã¥È¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤ ¾ì¹ç¡¢¤³¤Î¥Ç¥â¤Ï¤¦¤Þ¤¯Æ°¤«¤Ê¤¤¤Ï¤º¤Ç¤¹¡£ ¤½¤Î¾ì¹ç¤Ë¤Ï labelframe ¥¦¥£¥¸¥§¥Ã¥È¤¬¼ÂÁõ -¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk +¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk ¤òÁȤ߹ç¤ï¤»¤Æ»î¤¹¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£ EOL @@ -52,17 +52,17 @@ TkFrame.new(base_frame){|f| } # Demo area -w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both, +w = TkFrame.new(base_frame).pack(:side=>:bottom, :fill=>:both, :expand=>true) # A group of radiobuttons in a labelframe -TkLabelFrame.new(w, :text=>'ÁªÂòÃÍ', +TkLabelFrame.new(w, :text=>'ÁªÂòÃÍ', :padx=>2, :pady=>2) {|f| grid(:row=>0, :column=>0, :pady=>'2m', :padx=>'2m') v = TkVariable.new (1..4).each{|i| - TkRadiobutton.new(f, :text=>"This is value #{i}", + TkRadiobutton.new(f, :text=>"This is value #{i}", :variable=>v, :value=>i) { pack(:side=>:top, :fill=>:x, :pady=>2) } @@ -85,7 +85,7 @@ def lfEnableButtons(w) end TkLabelFrame.new(w, :pady=>2, :padx=>2){|f| - TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy, + TkCheckButton.new(f, :widgetname=>'cb', :variable=>$lfdummy, :text=>"¥ª¥×¥·¥ç¥ó¤ò»ÈÍÑ", :padx=>0) {|cb| command proc{lfEnableButtons(f)} f.labelwidget(cb) diff --git a/ext/tk/sample/demos-jp/mclist.rb b/ext/tk/sample/demos-jp/mclist.rb index a7834d2668..37f5dfa8eb 100644 --- a/ext/tk/sample/demos-jp/mclist.rb +++ b/ext/tk/sample/demos-jp/mclist.rb @@ -8,7 +8,7 @@ # based on "Id: mclist.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($mclist_demo) && $mclist_demo - $mclist_demo.destroy + $mclist_demo.destroy $mclist_demo = nil end @@ -21,8 +21,8 @@ $mclist_demo = TkToplevel.new {|w| base_frame = TkFrame.new($mclist_demo).pack(:fill=>:both, :expand=>true) ## Explanatory text -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', - :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', + :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><:x) Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\ Ttk::Treeview¥¦¥£¥¸¥§¥Ã¥È¤Ï\ @@ -40,23 +40,23 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'mclist'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'mclist'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $mclist_demo.destroy $mclist_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) } container = Ttk::Frame.new(base_frame) -tree = Ttk::Treeview.new(base_frame, :columns=>%w(country capital currency), +tree = Ttk::Treeview.new(base_frame, :columns=>%w(country capital currency), :show=>:headings) if Tk.windowingsystem != 'aquq' vsb = tree.yscrollbar(Ttk::Scrollbar.new(base_frame)) @@ -74,20 +74,20 @@ container.grid_rowconfigure(0, :weight=>1) ## The data we're going to insert data = [ - ['¥¢¥ë¥¼¥ó¥Á¥ó', '¥Ö¥¨¥Î¥¹¥¢¥¤¥ì¥¹', 'ARS'], - ['¥ª¡¼¥¹¥È¥é¥ê¥¢', '¥­¥ã¥ó¥Ù¥é', 'AUD'], - ['¥Ö¥é¥¸¥ë', '¥Ö¥é¥¸¥ê¥¢', 'BRL'], - ['¥«¥Ê¥À', '¥ª¥¿¥ï', 'CAD'], - ['Ãæ¹ñ', 'Ë̵þ', 'CNY'], - ['¥Õ¥é¥ó¥¹', '¥Ñ¥ê', 'EUR'], - ['¥É¥¤¥Ä', '¥Ù¥ë¥ê¥ó', 'EUR'], - ['¥¤¥ó¥É', '¥Ë¥å¡¼¥Ç¥ê¡¼', 'INR'], - ['¥¤¥¿¥ê¥¢', '¥í¡¼¥Þ', 'EUR'], - ['ÆüËÜ', 'Åìµþ', 'JPY'], - ['¥á¥­¥·¥³', '¥á¥­¥·¥³¥·¥Æ¥£', 'MXN'], - ['¥í¥·¥¢', '¥â¥¹¥¯¥ï', 'RUB'], - ['Æî¥¢¥Õ¥ê¥«', '¥×¥ì¥È¥ê¥¢', 'ZAR'], - ['±Ñ¹ñ', '¥í¥ó¥É¥ó', 'GBP'], + ['¥¢¥ë¥¼¥ó¥Á¥ó', '¥Ö¥¨¥Î¥¹¥¢¥¤¥ì¥¹', 'ARS'], + ['¥ª¡¼¥¹¥È¥é¥ê¥¢', '¥­¥ã¥ó¥Ù¥é', 'AUD'], + ['¥Ö¥é¥¸¥ë', '¥Ö¥é¥¸¥ê¥¢', 'BRL'], + ['¥«¥Ê¥À', '¥ª¥¿¥ï', 'CAD'], + ['Ãæ¹ñ', 'Ë̵þ', 'CNY'], + ['¥Õ¥é¥ó¥¹', '¥Ñ¥ê', 'EUR'], + ['¥É¥¤¥Ä', '¥Ù¥ë¥ê¥ó', 'EUR'], + ['¥¤¥ó¥É', '¥Ë¥å¡¼¥Ç¥ê¡¼', 'INR'], + ['¥¤¥¿¥ê¥¢', '¥í¡¼¥Þ', 'EUR'], + ['ÆüËÜ', 'Åìµþ', 'JPY'], + ['¥á¥­¥·¥³', '¥á¥­¥·¥³¥·¥Æ¥£', 'MXN'], + ['¥í¥·¥¢', '¥â¥¹¥¯¥ï', 'RUB'], + ['Æî¥¢¥Õ¥ê¥«', '¥×¥ì¥È¥ê¥¢', 'ZAR'], + ['±Ñ¹ñ', '¥í¥ó¥É¥ó', 'GBP'], ['¥¢¥á¥ê¥«', '¥ï¥·¥ó¥È¥ó D.C.', 'USD'], ] @@ -95,7 +95,7 @@ data = [ font = Ttk::Style.lookup(tree[:style], :font) cols = %w(country capital currency) cols.zip(%w(¹ñ̾ ¼óÅÔ Ä̲ß)).each{|col, name| - tree.heading_configure(col, :text=>name, + tree.heading_configure(col, :text=>name, :command=>proc{sort_by(tree, col, false)}) tree.column_configure(col, :width=>TkFont.measure(font, name)) } @@ -113,8 +113,8 @@ data.each{|country, capital, currency| ## Code to do the sorting of the tree contents when clicked on def sort_by(tree, col, direction) - tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . - sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . + tree.children(nil).map!{|row| [tree.get(row, col), row.id]} . + sort(&((direction)? proc{|x, y| y <=> x}: proc{|x, y| x <=> y})) . each_with_index{|info, idx| tree.move(info[1], nil, idx)} tree.heading_configure(col, :command=>proc{sort_by(tree, col, ! direction)}) diff --git a/ext/tk/sample/demos-jp/menu.rb b/ext/tk/sample/demos-jp/menu.rb index c3d95176b4..e38a467000 100644 --- a/ext/tk/sample/demos-jp/menu.rb +++ b/ext/tk/sample/demos-jp/menu.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($menu_demo) && $menu_demo - $menu_demo.destroy + $menu_demo.destroy $menu_demo = nil end @@ -88,9 +88,9 @@ TkMenubutton.new($menu_frame, 'text'=>'Basic', 'underline'=>0) {|m| m.configure('menu'=>basic_menu) add('command', 'label'=>'²¿¤â¤·¤Ê¤¤Ä¹¤¤¥¨¥ó¥È¥ê') ['A','B','C','D','E','F','G'].each{|c| - # add('command', 'label'=>"ʸ»ú \"#{c}\" ¤ò°õ»ú", 'underline'=>4, - add('command', 'label'=>"Print letter \"#{c}\" (ʸ»ú \"#{c}\" ¤ò°õ»ú)", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + # add('command', 'label'=>"ʸ»ú \"#{c}\" ¤ò°õ»ú", 'underline'=>4, + add('command', 'label'=>"Print letter \"#{c}\" (ʸ»ú \"#{c}\" ¤ò°õ»ú)", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -101,18 +101,18 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|cascade_menu| m.configure('menu'=>cascade_menu) - add('command', 'label'=>'Print hello(¤³¤ó¤Ë¤Á¤Ï)', - 'command'=>proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}, + add('command', 'label'=>'Print hello(¤³¤ó¤Ë¤Á¤Ï)', + 'command'=>proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu_demo.bind("#{modifier}-h", proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}) - add('command', 'label'=>'Print goodbye(¤µ¤è¤¦¤Ê¤é)', - 'command'=>proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}, + add('command', 'label'=>'Print goodbye(¤µ¤è¤¦¤Ê¤é)', + 'command'=>proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu_demo.bind("#{modifier}-g", proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}) # TkMenu.new(m, 'tearoff'=>false) {|cascade_check| TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_check| - cascade_menu.add('cascade', 'label'=>'Check buttons(¥Á¥§¥Ã¥¯¥Ü¥¿¥ó)', + cascade_menu.add('cascade', 'label'=>'Check buttons(¥Á¥§¥Ã¥¯¥Ü¥¿¥ó)', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'¥ª¥¤¥ëÅÀ¸¡', 'variable'=>oil) @@ -123,11 +123,11 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| lights = TkVariable.new(0) add('check', 'label'=>'¥é¥¤¥ÈÅÀ¸¡', 'variable'=>lights) add('separator') - add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', - 'command'=>proc{showVars($menu_demo, - ['¥ª¥¤¥ëÅÀ¸¡', oil], - ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', trans], - ['¥Ö¥ì¡¼¥­ÅÀ¸¡', brakes], + add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', + 'command'=>proc{showVars($menu_demo, + ['¥ª¥¤¥ëÅÀ¸¡', oil], + ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', trans], + ['¥Ö¥ì¡¼¥­ÅÀ¸¡', brakes], ['¥é¥¤¥ÈÅÀ¸¡', lights])} ) invoke 1 invoke 3 @@ -135,7 +135,7 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| #TkMenu.new(m, 'tearoff'=>false) {|cascade_radio| TkMenu.new(cascade_menu, 'tearoff'=>false) {|cascade_radio| - cascade_menu.add('cascade', 'label'=>'Radio buttons(¥é¥¸¥ª¥Ü¥¿¥ó)', + cascade_menu.add('cascade', 'label'=>'Radio buttons(¥é¥¸¥ª¥Ü¥¿¥ó)', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>10) @@ -149,9 +149,9 @@ TkMenubutton.new($menu_frame, 'text'=>'Cascades', 'underline'=>0) {|m| add('radio', 'label'=>'¥Ü¡¼¥ë¥É', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'¥¤¥¿¥ê¥Ã¥¯', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', - 'command'=>proc{showVars($menu_demo, - ['¥Ý¥¤¥ó¥È¥µ¥¤¥º', pointSize], + add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', + 'command'=>proc{showVars($menu_demo, + ['¥Ý¥¤¥ó¥È¥µ¥¤¥º', pointSize], ['¥¹¥¿¥¤¥ë', style])} ) invoke 1 invoke 7 @@ -163,15 +163,15 @@ TkMenubutton.new($menu_frame, 'text'=>'Icons', 'underline'=>0) {|m| pack('side'=>'left') TkMenu.new(m, 'tearoff'=>false) {|icon_menu| m.configure('menu'=>icon_menu) - add('command', + add('command', 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'º£¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¤Î¹àÌܤϥƥ­¥¹¥È¤Ç¤Ï¤Ê¤¯¥Ó¥Ã¥È¥Þ¥Ã¥×¤òɽ¼¨¤·¤Æ¤¤¤Þ¤·¤¿¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¾¤Î¥á¥Ë¥å¡¼¹àÌܤÈÊѤï¤ê¤Þ¤»¤ó¡£', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'λ²ò')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, + add('command', 'bitmap'=>icon, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } } @@ -183,7 +183,7 @@ TkMenubutton.new($menu_frame, 'text'=>'More', 'underline'=>0) {|m| m.configure('menu'=>more_menu) [ '¥¨¥ó¥È¥ê','Ê̤Υ¨¥ó¥È¥ê','²¿¤â¤·¤Ê¤¤','¤Û¤È¤ó¤É²¿¤â¤·¤Ê¤¤', '¿ÍÀ¸¤ò°ÕµÁ¤¢¤ë¤â¤Î¤Ë' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } } @@ -194,7 +194,7 @@ TkMenubutton.new($menu_frame, 'text'=>'Colors', 'underline'=>0) {|m| TkMenu.new(m) {|colors_menu| m.configure('menu'=>colors_menu) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } diff --git a/ext/tk/sample/demos-jp/menu84.rb b/ext/tk/sample/demos-jp/menu84.rb index a631bacd43..094853a728 100644 --- a/ext/tk/sample/demos-jp/menu84.rb +++ b/ext/tk/sample/demos-jp/menu84.rb @@ -5,7 +5,7 @@ # toplevel widget if defined?($menu84_demo) && $menu84_demo - $menu84_demo.destroy + $menu84_demo.destroy $menu84_demo = nil end @@ -37,9 +37,9 @@ TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') { menustatus = TkVariable.new(" ") TkFrame.new(base_frame) {|frame| - TkLabel.new(frame, 'textvariable'=>menustatus, 'relief'=>'sunken', - 'bd'=>1, 'font'=>['Helvetica', '10'], - 'anchor'=>'w').pack('side'=>'left', 'padx'=>2, + TkLabel.new(frame, 'textvariable'=>menustatus, 'relief'=>'sunken', + 'bd'=>1, 'font'=>['Helvetica', '10'], + 'anchor'=>'w').pack('side'=>'left', 'padx'=>2, 'expand'=>true, 'fill'=>'both') pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2) } @@ -94,8 +94,8 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Basic', 'menu'=>m, 'underline'=>0) add('command', 'label'=>'Long entry that does nothing') ['A','B','C','D','E','F','G'].each{|c| - add('command', 'label'=>"Print letter \"#{c}\"", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + add('command', 'label'=>"Print letter \"#{c}\"", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu84_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -103,17 +103,17 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Cascades', 'menu'=>m, 'underline'=>0) - add('command', 'label'=>'Print hello', - 'command'=>proc{print "Hello\n"}, + add('command', 'label'=>'Print hello', + 'command'=>proc{print "Hello\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu84_demo.bind("#{modifier}-h", proc{print "Hello\n"}) - add('command', 'label'=>'Print goodbye', - 'command'=>proc{print "Goodbye\n"}, + add('command', 'label'=>'Print goodbye', + 'command'=>proc{print "Goodbye\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu84_demo.bind("#{modifier}-g", proc{print "Goodbye\n"}) TkMenu.new(m, 'tearoff'=>false) {|cascade_check| - m.add('cascade', 'label'=>'Check button', + m.add('cascade', 'label'=>'Check button', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'¥ª¥¤¥ë¸¡ºº', 'variable'=>oil) @@ -124,18 +124,18 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| lights = TkVariable.new(0) add('check', 'label'=>'¥é¥¤¥È¸¡ºº', 'variable'=>lights) add('separator') - add('command', 'label'=>'Show current values', - 'command'=>proc{showVars($menu84_demo, - ['¥ª¥¤¥ë', oil], - ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥ó', trans], - ['¥Ö¥ì¡¼¥­', brakes], + add('command', 'label'=>'Show current values', + 'command'=>proc{showVars($menu84_demo, + ['¥ª¥¤¥ë', oil], + ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥ó', trans], + ['¥Ö¥ì¡¼¥­', brakes], ['¥é¥¤¥È', lights])} ) invoke 1 invoke 3 } TkMenu.new(m, 'tearoff'=>false) {|cascade_radio| - m.add('cascade', 'label'=>'Radio buttons', + m.add('cascade', 'label'=>'Radio buttons', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 point', 'variable'=>pointSize, 'value'=>10) @@ -149,9 +149,9 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| add('radio', 'label'=>'Bold', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'Italic', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'¸½ºßÃͤÎɽ¼¨', - 'command'=>proc{showVars($menu84_demo, - ['pointSize', pointSize], + add('command', 'label'=>'¸½ºßÃͤÎɽ¼¨', + 'command'=>proc{showVars($menu84_demo, + ['pointSize', pointSize], ['style', style])} ) invoke 1 invoke 7 @@ -160,15 +160,15 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'Icons', 'menu'=>m, 'underline'=>0) - add('command', 'hidemargin'=>1, + add('command', 'hidemargin'=>1, 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¹àÌܤϡ¢Ê¸»úÎó¤ÎÂå¤ï¤ê¤Ë¥Ó¥Ã¥È¥Þ¥Ã¥×¥¤¥á¡¼¥¸¤Ç¹àÌܤòɽ¼¨¤·¤¿¤â¤Î¤Ç¤¹¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¡¢¤Û¤«¤Î¥á¥Ë¥å¡¼¹àÌÜ¤È¤Î´Ö¤ÇÆÃ¤Ë°ã¤¤¤¬¤¢¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'ÊĤ¸¤ë')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, 'hidemargin'=>1, + add('command', 'bitmap'=>icon, 'hidemargin'=>1, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } @@ -179,14 +179,14 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| $menu84_frame.add('cascade', 'label'=>'More', 'menu'=>m, 'underline'=>0) [ 'An entry','Another entry','Does nothing','Does almost nothing', 'Make life meaningful' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } - m.entryconfigure('Does almost nothing', - 'bitmap'=>'questhead', 'compound'=>'left', + m.entryconfigure('Does almost nothing', + 'bitmap'=>'questhead', 'compound'=>'left', 'command'=>proc{ - TkDialog.new('title'=>'Compound Menu Entry', + TkDialog.new('title'=>'Compound Menu Entry', 'message'=>'¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¹àÌܤϡ¢¥Ó¥Ã¥È¥Þ¥Ã¥×¥¤¥á¡¼¥¸¤Èʸ»úÎó¤È¤òƱ»þ¤Ë°ì¤Ä¤Î¹àÌܤËɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤¿¤â¤Î¤Ç¤¹¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¡¢¤Û¤«¤Î¥á¥Ë¥å¡¼¹àÌÜ¤È¤Î´Ö¤ÇÆÃ¤Ë°ã¤¤¤¬¤¢¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£', 'buttons'=>['λ²ò'], 'bitmap'=>'') }) @@ -195,7 +195,7 @@ TkMenu.new($menu84_frame, 'tearoff'=>false) {|m| TkMenu.new($menu84_frame) {|m| $menu84_frame.add('cascade', 'label'=>'Colors', 'menu'=>m, 'underline'=>0) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } diff --git a/ext/tk/sample/demos-jp/menu8x.rb b/ext/tk/sample/demos-jp/menu8x.rb index 9249f2491a..49aca6786d 100644 --- a/ext/tk/sample/demos-jp/menu8x.rb +++ b/ext/tk/sample/demos-jp/menu8x.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($menu8x_demo) && $menu8x_demo - $menu8x_demo.destroy + $menu8x_demo.destroy $menu8x_demo = nil end @@ -65,7 +65,7 @@ TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left') { # ¾õÂÖɽ¼¨¤ÎÀ¸À® $menu8xstatus = TkVariable.new(" ") TkFrame.new(base_frame) {|frame| - TkLabel.new(frame, 'textvariable'=>$menu8xstatus, 'relief'=>'sunken', + TkLabel.new(frame, 'textvariable'=>$menu8xstatus, 'relief'=>'sunken', 'bd'=>1, 'font'=>['Helvetica', '10'], 'anchor'=>'w')\ .pack('side'=>'left', 'padx'=>2, 'expand'=>'yes', 'fill'=>'both') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2) @@ -116,9 +116,9 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| m.add('cascade', 'label'=>'Basic', 'menu'=>basic_menu, 'underline'=>0) add('command', 'label'=>'²¿¤â¤·¤Ê¤¤Ä¹¤¤¥¨¥ó¥È¥ê') ['A','B','C','D','E','F','G'].each{|c| - # add('command', 'label'=>"ʸ»ú \"#{c}\" ¤ò°õ»ú", 'underline'=>4, - add('command', 'label'=>"Print letter \"#{c}\" (ʸ»ú \"#{c}\" ¤ò°õ»ú)", - 'underline'=>14, 'accelerator'=>"Meta+#{c}", + # add('command', 'label'=>"ʸ»ú \"#{c}\" ¤ò°õ»ú", 'underline'=>4, + add('command', 'label'=>"Print letter \"#{c}\" (ʸ»ú \"#{c}\" ¤ò°õ»ú)", + 'underline'=>14, 'accelerator'=>"Meta+#{c}", 'command'=>proc{print c,"\n"}, 'accelerator'=>"#{modifier}+#{c}") $menu8x_demo.bind("#{modifier}-#{c.downcase}", proc{print c,"\n"}) } @@ -126,17 +126,17 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| TkMenu.new(m, 'tearoff'=>false) {|cascade_menu| m.add('cascade', 'label'=>'Cascades', 'menu'=>cascade_menu, 'underline'=>0) - add('command', 'label'=>'Print hello(¤³¤ó¤Ë¤Á¤Ï)', - 'command'=>proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}, + add('command', 'label'=>'Print hello(¤³¤ó¤Ë¤Á¤Ï)', + 'command'=>proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}, 'accelerator'=>"#{modifier}+H", 'underline'=>6) $menu8x_demo.bind("#{modifier}-h", proc{print "Hello(¤³¤ó¤Ë¤Á¤Ï)\n"}) - add('command', 'label'=>'Print goodbye(¤µ¤è¤¦¤Ê¤é)', - 'command'=>proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}, + add('command', 'label'=>'Print goodbye(¤µ¤è¤¦¤Ê¤é)', + 'command'=>proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}, 'accelerator'=>"#{modifier}+G", 'underline'=>6) $menu8x_demo.bind("#{modifier}-g", proc{print "Goodbye(¤µ¤è¤¦¤Ê¤é)\n"}) TkMenu.new(m, 'tearoff'=>false) {|cascade_check| - cascade_menu.add('cascade', 'label'=>'Check buttons(¥Á¥§¥Ã¥¯¥Ü¥¿¥ó)', + cascade_menu.add('cascade', 'label'=>'Check buttons(¥Á¥§¥Ã¥¯¥Ü¥¿¥ó)', 'menu'=>cascade_check, 'underline'=>0) oil = TkVariable.new(0) add('check', 'label'=>'¥ª¥¤¥ëÅÀ¸¡', 'variable'=>oil) @@ -147,18 +147,18 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| lights = TkVariable.new(0) add('check', 'label'=>'¥é¥¤¥ÈÅÀ¸¡', 'variable'=>lights) add('separator') - add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', - 'command'=>proc{showVars($menu8x_demo, - ['¥ª¥¤¥ëÅÀ¸¡', oil], - ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', trans], - ['¥Ö¥ì¡¼¥­ÅÀ¸¡', brakes], + add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', + 'command'=>proc{showVars($menu8x_demo, + ['¥ª¥¤¥ëÅÀ¸¡', oil], + ['¥È¥é¥ó¥¹¥ß¥Ã¥·¥ç¥óÅÀ¸¡', trans], + ['¥Ö¥ì¡¼¥­ÅÀ¸¡', brakes], ['¥é¥¤¥ÈÅÀ¸¡', lights])} ) invoke 1 invoke 3 } TkMenu.new(m, 'tearoff'=>false) {|cascade_radio| - cascade_menu.add('cascade', 'label'=>'Radio buttons(¥é¥¸¥ª¥Ü¥¿¥ó)', + cascade_menu.add('cascade', 'label'=>'Radio buttons(¥é¥¸¥ª¥Ü¥¿¥ó)', 'menu'=>cascade_radio, 'underline'=>0) pointSize = TkVariable.new add('radio', 'label'=>'10 ¥Ý¥¤¥ó¥È', 'variable'=>pointSize, 'value'=>10) @@ -172,9 +172,9 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| add('radio', 'label'=>'¥Ü¡¼¥ë¥É', 'variable'=>style, 'value'=>'bold') add('radio', 'label'=>'¥¤¥¿¥ê¥Ã¥¯', 'variable'=>style, 'value'=>'italic') add('separator') - add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', - 'command'=>proc{showVars($menu8x_demo, - ['¥Ý¥¤¥ó¥È¥µ¥¤¥º', pointSize], + add('command', 'label'=>'¸½ºß¤ÎÃͤòɽ¼¨', + 'command'=>proc{showVars($menu8x_demo, + ['¥Ý¥¤¥ó¥È¥µ¥¤¥º', pointSize], ['¥¹¥¿¥¤¥ë', style])} ) invoke 1 invoke 7 @@ -183,16 +183,16 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| TkMenu.new(m, 'tearoff'=>false) {|icon_menu| m.add('cascade', 'label'=>'Icons', 'menu'=>icon_menu, 'underline'=>0) - add('command', + add('command', 'bitmap'=>'@'+[$demo_dir,'..', 'images','pattern.xbm'].join(File::Separator), - 'hidemargin'=>1, - 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', + 'hidemargin'=>1, + 'command'=>proc{TkDialog.new('title'=>'Bitmap Menu Entry', 'text'=>'º£¤¢¤Ê¤¿¤¬ÁªÂò¤·¤¿¥á¥Ë¥å¡¼¤Î¹àÌܤϥƥ­¥¹¥È¤Ç¤Ï¤Ê¤¯¥Ó¥Ã¥È¥Þ¥Ã¥×¤òɽ¼¨¤·¤Æ¤¤¤Þ¤·¤¿¡£¤½¤ì°Ê³°¤ÎÅÀ¤Ç¤Ï¾¤Î¥á¥Ë¥å¡¼¹àÌܤÈÊѤï¤ê¤Þ¤»¤ó¡£', - 'bitmap'=>'', 'default'=>0, + 'bitmap'=>'', 'default'=>0, 'buttons'=>'λ²ò')} ) ['info', 'questhead', 'error'].each{|icon| - add('command', 'bitmap'=>icon, 'hidemargin'=>1, + add('command', 'bitmap'=>icon, 'hidemargin'=>1, 'command'=>proc{print "You invoked the #{icon} bitmap\n"}) } @@ -203,7 +203,7 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| m.add('cascade', 'label'=>'More', 'menu'=>more_menu, 'underline'=>0) [ '¥¨¥ó¥È¥ê','Ê̤Υ¨¥ó¥È¥ê','²¿¤â¤·¤Ê¤¤','¤Û¤È¤ó¤É²¿¤â¤·¤Ê¤¤', '¿ÍÀ¸¤ò°ÕµÁ¤¢¤ë¤â¤Î¤Ë' ].each{|i| - add('command', 'label'=>i, + add('command', 'label'=>i, 'command'=>proc{print "You invoked \"#{i}\"\n"}) } } @@ -211,7 +211,7 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| TkMenu.new(m) {|colors_menu| m.add('cascade', 'label'=>'Colors', 'menu'=>colors_menu, 'underline'=>1) ['red', 'orange', 'yellow', 'green', 'blue'].each{|c| - add('command', 'label'=>c, 'background'=>c, + add('command', 'label'=>c, 'background'=>c, 'command'=>proc{print "You invoked \"#{c}\"\n"}) } } @@ -219,8 +219,8 @@ TkMenu.new($menu8x_demo, 'tearoff'=>false) {|m| $menu8x_demo.configure('menu'=>m) } -TkMenu.bind('', - proc{|w| +TkMenu.bind('', + proc{|w| begin label = w.entrycget('active', 'label') rescue diff --git a/ext/tk/sample/demos-jp/menubu.rb b/ext/tk/sample/demos-jp/menubu.rb index 90dc367305..78418ce3ea 100644 --- a/ext/tk/sample/demos-jp/menubu.rb +++ b/ext/tk/sample/demos-jp/menubu.rb @@ -17,7 +17,7 @@ def optionMenu(menubutton, varName, firstValue, *rest) for i in rest menu.add 'radio', 'label'=>i, 'variable'=>varName end - + return menu end @@ -189,7 +189,7 @@ msg.pack('side'=>'top', 'padx'=>25, 'pady'=>25) TkFrame.new(center) {|f| menubuttonoptions = TkVariable.new mbutton = TkMenubutton.new(f) - options = optionMenu(mbutton, menubuttonoptions, + options = optionMenu(mbutton, menubuttonoptions, 'one', 'two', 'three') mbutton.pack('side'=>'left', 'padx'=>25, 'pady'=>25) paletteColor = TkVariable.new diff --git a/ext/tk/sample/demos-jp/msgbox.rb b/ext/tk/sample/demos-jp/msgbox.rb index 88380e08bd..ed5d01252e 100644 --- a/ext/tk/sample/demos-jp/msgbox.rb +++ b/ext/tk/sample/demos-jp/msgbox.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($msgbox_demo) && $msgbox_demo - $msgbox_demo.destroy + $msgbox_demo.destroy $msgbox_demo = nil end @@ -48,9 +48,9 @@ TkFrame.new(base_frame) {|frame| # frame À¸À® $msgbox_leftframe = TkFrame.new(base_frame) $msgbox_rightframe = TkFrame.new(base_frame) -$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') -$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') TkLabel.new($msgbox_leftframe, 'text'=>'¥¢¥¤¥³¥ó').pack('side'=>'top') @@ -59,9 +59,9 @@ TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ $msgboxIcon = TkVariable.new('info') ['error', 'info', 'question', 'warning'].each {|icon| - TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, - 'relief'=>'flat', 'value'=>icon, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, + 'relief'=>'flat', 'value'=>icon, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } @@ -70,20 +70,20 @@ TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ .pack('side'=>'top', 'fill'=>'x', 'expand'=>'no') $msgboxType = TkVariable.new('ok') -['abortretryignore', 'ok', 'okcancel', +['abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel'].each {|type| - TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, - 'relief'=>'flat', 'value'=>type, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, + 'relief'=>'flat', 'value'=>type, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } def showMessageBox(w) - button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, + button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, 'message'=>"¤³¤ì¤Ï\"#{$msgboxType.value}\"¤È¤¤¤¦¼ïÎà¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹¤Ç¡¢\"#{$msgboxIcon.value}\"¤Î¥¢¥¤¥³¥ó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£") - Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, + Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"¤¢¤Ê¤¿¤Ï \"#{button}\" ¤ò²¡¤·¤Þ¤·¤¿¤Í¡£") end diff --git a/ext/tk/sample/demos-jp/msgbox2.rb b/ext/tk/sample/demos-jp/msgbox2.rb index e2944c59ed..8c80e08d70 100644 --- a/ext/tk/sample/demos-jp/msgbox2.rb +++ b/ext/tk/sample/demos-jp/msgbox2.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($msgbox2_demo) && $msgbox2_demo - $msgbox2_demo.destroy + $msgbox2_demo.destroy $msgbox2_demo = nil end @@ -48,9 +48,9 @@ TkFrame.new(base_frame) {|frame| # frame À¸À® $msgbox_leftframe = TkFrame.new(base_frame) $msgbox_rightframe = TkFrame.new(base_frame) -$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_leftframe .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') -$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', +$msgbox_rightframe.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'y', 'pady'=>'.5c', 'padx'=>'.5c') TkLabel.new($msgbox_leftframe, 'text'=>'¥¢¥¤¥³¥ó').pack('side'=>'top') @@ -59,9 +59,9 @@ TkFrame.new($msgbox_leftframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ $msgboxIcon = TkVariable.new('info') ['error', 'info', 'question', 'warning'].each {|icon| - TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, - 'relief'=>'flat', 'value'=>icon, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_leftframe, 'text'=>icon, 'variable'=>$msgboxIcon, + 'relief'=>'flat', 'value'=>icon, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } @@ -70,21 +70,21 @@ TkFrame.new($msgbox_rightframe, 'relief'=>'ridge', 'bd'=>1, 'height'=>2)\ .pack('side'=>'top', 'fill'=>'x', 'expand'=>'no') $msgboxType = TkVariable.new('ok') -['abortretryignore', 'ok', 'okcancel', +['abortretryignore', 'ok', 'okcancel', 'retrycancel', 'yesno', 'yesnocancel'].each {|type| - TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, - 'relief'=>'flat', 'value'=>type, 'width'=>16, - 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, + TkRadioButton.new($msgbox_rightframe, 'text'=>type, 'variable'=>$msgboxType, + 'relief'=>'flat', 'value'=>type, 'width'=>16, + 'anchor'=>'w').pack('side'=>'top', 'pady'=>2, 'anchor'=>'w', 'fill'=>'x') } def showMessageBox2(w) - button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, + button = Tk.messageBox('icon'=>$msgboxIcon.value, 'type'=>$msgboxType.value, 'title'=>'Message', 'parent'=>w, - 'message'=>"\"#{$msgboxType.value}\"¥¿¥¤¥×¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹", + 'message'=>"\"#{$msgboxType.value}\"¥¿¥¤¥×¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹", 'detail'=>"¤³¤ì¤Ï\"#{$msgboxType.value}\"¤È¤¤¤¦¼ïÎà¤Î¥á¥Ã¥»¡¼¥¸¥Ü¥Ã¥¯¥¹¤Ç¡¢\"#{$msgboxIcon.value}\"¤Î¥¢¥¤¥³¥ó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£²¼¤Î¥Ü¥¿¥ó¤Î¤¤¤º¤ì¤«¤òÁªÂò¤·¤Æ¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£") - Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, + Tk.messageBox('icon'=>'info', 'type'=>'ok', 'parent'=>w, 'message'=>"¤¢¤Ê¤¿¤Ï \"#{button}\" ¤ò²¡¤·¤Þ¤·¤¿¤Í¡£") end diff --git a/ext/tk/sample/demos-jp/paned1.rb b/ext/tk/sample/demos-jp/paned1.rb index f994e83ff1..987a073086 100644 --- a/ext/tk/sample/demos-jp/paned1.rb +++ b/ext/tk/sample/demos-jp/paned1.rb @@ -8,7 +8,7 @@ # based on "Id: paned1.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp" if defined?($paned1_demo) && $paned1_demo - $paned1_demo.destroy + $paned1_demo.destroy $paned1_demo = nil end @@ -20,8 +20,8 @@ $paned1_demo = TkToplevel.new {|w| base_frame = TkFrame.new($paned1_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top) ²¼¤Î¿§ÉÕ¤±¤µ¤ì¤¿Æó¤Ä¤Î¥¦¥£¥ó¥É¥¦¤Î´Ö¤Î»ÅÀÚ¤êÏȤϡ¢°ì¤Ä¤ÎÎΰè¤ò¤½¤ì¤¾¤ì¤Î¥¦¥£¥ó¥É¥¦¤Î¤¿¤á¤Ëʬ³ä¤¹¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¹¡£º¸¥Ü¥¿¥ó¤Ç»ÅÀÚ¤ê¤òÁàºî¤¹¤ë¤È¡¢Ê¬³ä¥µ¥¤¥ºÊѹ¹¤ÎÁàºîÅÓÃæ¤Ç¤ÏºÆÉ½¼¨¤Ï¤Ê¤µ¤ì¤º¡¢³ÎÄꤵ¤»¤¿¤È¤­¤Ëɽ¼¨¤¬¹¹¿·¤µ¤ì¤Þ¤¹¡£¥Þ¥¦¥¹¤Ë¤è¤ë»ÅÀÚ¤ê¤ÎÁàºî¤ËÄɿ路¤Æ¥µ¥¤¥º¤òÊѹ¹¤·¤¿É½¼¨¤¬¤Ê¤ï¤ì¤ë¤è¤¦¤Ë¤·¤¿¤¤¾ì¹ç¤Ï¡¢¥Þ¥¦¥¹¤ÎÃæ±û¥Ü¥¿¥ó¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£ ¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬ panedwindow ¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤ @@ -45,7 +45,7 @@ TkFrame.new(base_frame){|f| } TkPanedwindow.new(base_frame, :orient=>:horizontal){|f| - add(Tk::Label.new(f, :text=>"This is the\nleft side", :bg=>'yellow'), + add(Tk::Label.new(f, :text=>"This is the\nleft side", :bg=>'yellow'), Tk::Label.new(f, :text=>"This is the\nright side", :bg=>'cyan')) pack(:side=>:top, :expand=>true, :fill=>:both, :pady=>2, :padx=>'2m') diff --git a/ext/tk/sample/demos-jp/paned2.rb b/ext/tk/sample/demos-jp/paned2.rb index cdc8253402..a1aee81690 100644 --- a/ext/tk/sample/demos-jp/paned2.rb +++ b/ext/tk/sample/demos-jp/paned2.rb @@ -8,7 +8,7 @@ # based on "Id: paned2.tcl,v 1.1 2002/02/22 14:07:01 dkf Exp" if defined?($paned2_demo) && $paned2_demo - $paned2_demo.destroy + $paned2_demo.destroy $paned2_demo = nil end @@ -20,8 +20,8 @@ $paned2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($paned2_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top) ²¼¤Î¥¹¥¯¥í¡¼¥ë¥Ð¡¼ÉÕ¤­¤Î¥¦¥£¥¸¥§¥Ã¥È¤¬ÃÖ¤«¤ì¤¿Æó¤Ä¤Î¥¦¥£¥ó¥É¥¦¤Î´Ö¤Î»ÅÀÚ¤êÏȤϡ¢°ì¤Ä¤ÎÎΰè¤ò¤½¤ì¤¾¤ì¤Î¥¦¥£¥ó¥É¥¦¤Î¤¿¤á¤Ëʬ³ä¤¹¤ë¤¿¤á¤Î¤â¤Î¤Ç¤¹¡£º¸¥Ü¥¿¥ó¤Ç»ÅÀÚ¤ê¤òÁàºî¤¹¤ë¤È¡¢Ê¬³ä¥µ¥¤¥ºÊѹ¹¤ÎÁàºîÅÓÃæ¤Ç¤ÏºÆÉ½¼¨¤Ï¤Ê¤µ¤ì¤º¡¢³ÎÄꤵ¤»¤¿¤È¤­¤Ëɽ¼¨¤¬¹¹¿·¤µ¤ì¤Þ¤¹¡£¥Þ¥¦¥¹¤Ë¤è¤ë»ÅÀÚ¤ê¤ÎÁàºî¤ËÄɿ路¤Æ¥µ¥¤¥º¤òÊѹ¹¤·¤¿É½¼¨¤¬¤Ê¤ï¤ì¤ë¤è¤¦¤Ë¤·¤¿¤¤¾ì¹ç¤Ï¡¢¥Þ¥¦¥¹¤ÎÃæ±û¥Ü¥¿¥ó¤ò»È¤Ã¤Æ¤¯¤À¤µ¤¤¡£ ¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤¥Ö¥é¥ê¤¬ panedwindow ¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤ @@ -47,23 +47,23 @@ TkFrame.new(base_frame){|f| paneList = TkVariable.new # define as normal variable (not array) paneList.value = [ # ruby's array --> tcl's list 'Ruby/Tk ¤Î¥¦¥£¥¸¥§¥Ã¥È°ìÍ÷', - 'TkButton', - 'TkCanvas', - 'TkCheckbutton', - 'TkEntry', - 'TkFrame', - 'TkLabel', - 'TkLabelframe', - 'TkListbox', - 'TkMenu', - 'TkMenubutton', - 'TkMessage', - 'TkPanedwindow', - 'TkRadiobutton', - 'TkScale', - 'TkScrollbar', - 'TkSpinbox', - 'TkText', + 'TkButton', + 'TkCanvas', + 'TkCheckbutton', + 'TkEntry', + 'TkFrame', + 'TkLabel', + 'TkLabelframe', + 'TkListbox', + 'TkMenu', + 'TkMenubutton', + 'TkMessage', + 'TkPanedwindow', + 'TkRadiobutton', + 'TkScale', + 'TkScrollbar', + 'TkSpinbox', + 'TkText', 'TkToplevel' ] @@ -74,20 +74,20 @@ TkPanedwindow.new(base_frame, :orient=>:vertical){|f| add(TkFrame.new(f){|paned2_top| TkListbox.new(paned2_top, :listvariable=>paneList) { # Invert the first item to highlight it - itemconfigure(0, :background=>self.cget(:foreground), + itemconfigure(0, :background=>self.cget(:foreground), :foreground=>self.cget(:background) ) - yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right, + yscrollbar(TkScrollbar.new(paned2_top).pack(:side=>:right, :fill=>:y)) pack(:fill=>:both, :expand=>true) } - }, + }, TkFrame.new(f, :height=>120) {|paned2_bottom| # The bottom window is a text widget with scrollbar paned2_xscr = TkScrollbar.new(paned2_bottom) paned2_yscr = TkScrollbar.new(paned2_bottom) paned2_text = TkText.new(paned2_bottom, :width=>30, :wrap=>:non) { - insert('1.0', '¤³¤³¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ï¡¢' + + insert('1.0', '¤³¤³¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ï¡¢' + '¤´¤¯ÉáÄ̤Υƥ­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ç¤¹¡£') xscrollbar(paned2_xscr) yscrollbar(paned2_yscr) diff --git a/ext/tk/sample/demos-jp/pendulum.rb b/ext/tk/sample/demos-jp/pendulum.rb index b115f5be2c..48839aa58a 100644 --- a/ext/tk/sample/demos-jp/pendulum.rb +++ b/ext/tk/sample/demos-jp/pendulum.rb @@ -8,7 +8,7 @@ # destroy toplevel widget for this demo script if defined?($pendulum_demo) && $pendulum_demo - $pendulum_demo.destroy + $pendulum_demo.destroy $pendulum_demo = nil end @@ -61,14 +61,14 @@ class PendulumAnimationDemo # Create the canvas containing the graphical representation of the # simulated system. - @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white', + @c = TkCanvas.new(@lf1, :width=>320, :height=>200, :background=>'white', :borderwidth=>2, :relief=>:sunken) - TkcText.new(@c, 5, 5, :anchor=>:nw, + TkcText.new(@c, 5, 5, :anchor=>:nw, :text=>'Click to Adjust Bob Start Position') # Coordinates of these items don't matter; they will be set properly below @plate = TkcLine.new(@c, 0, 25, 320, 25, :width=>2, :fill=>'grey50') @rod = TkcLine.new(@c, 1, 1, 1, 1, :width=>3, :fill=>'black') - @bob = TkcOval.new(@c, 1, 1, 2, 2, + @bob = TkcOval.new(@c, 1, 1, 2, 2, :width=>3, :fill=>'yellow', :outline=>'black') TkcOval.new(@c, 155, 20, 165, 30, :fill=>'grey50', :outline=>'') @@ -78,22 +78,22 @@ class PendulumAnimationDemo # Create the canvas containing the phase space graph; this consists of # a line that gets gradually paler as it ages, which is an extremely # effective visual trick. - @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white', + @k = TkCanvas.new(@lf2, :width=>320, :height=>200, :background=>'white', :borderwidth=>2, :relief=>:sunken) @y_axis = TkcLine.new(@k, 160, 200, 160, 0, :fill=>'grey75', :arrow=>:last) @x_axis = TkcLine.new(@k, 0, 100, 320, 100, :fill=>'grey75', :arrow=>:last) @graph = {} 90.step(0, -10){|i| - # Coordinates of these items don't matter; + # Coordinates of these items don't matter; # they will be set properly below @graph[i] = TkcLine.new(@k, 0, 0, 1, 1, :smooth=>true, :fill=>"grey#{i}") } # labels - @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne, + @label_theta = TkcText.new(@k, 0, 0, :anchor=>:ne, :text=>'q', :font=>'Symbol 8') - @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne, + @label_dtheta = TkcText.new(@k, 0, 0, :anchor=>:ne, :text=>'dq', :font=>'Symbol 8') # pack @@ -111,19 +111,19 @@ class PendulumAnimationDemo # binding @c.bindtags_unshift(btag = TkBindTag.new) btag.bind('Destroy'){ @timer.stop } - btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x.to_i, y.to_i)}, + btag.bind('1', proc{|x, y| @timer.stop; showPendulum(x.to_i, y.to_i)}, '%x %y') btag.bind('B1-Motion', proc{|x, y| showPendulum(x.to_i, y.to_i)}, '%x %y') - btag.bind('ButtonRelease-1', - proc{|x, y| showPendulum(x.to_i, y.to_i); @timer.start }, + btag.bind('ButtonRelease-1', + proc{|x, y| showPendulum(x.to_i, y.to_i); @timer.start }, '%x %y') btag.bind('Configure', proc{|w| @plate.coords(0, 25, w.to_i, 25)}, '%w') - @k.bind('Configure', proc{|h, w| + @k.bind('Configure', proc{|h, w| h = h.to_i w = w.to_i - @psh = h/2; + @psh = h/2; @psw = w/2 @x_axis.coords(2, @psh, w-2, @psh) @y_axis.coords(@psw, h-2, @psw, 2) @@ -144,9 +144,9 @@ class PendulumAnimationDemo end # This procedure makes the pendulum appear at the correct place on the - # canvas. If the additional arguments x, y are passed instead of computing - # the position of the pendulum from the length of the pendulum rod and its - # angle, the length and angle are computed in reverse from the given + # canvas. If the additional arguments x, y are passed instead of computing + # the position of the pendulum from the length of the pendulum rod and its + # angle, the length and angle are computed in reverse from the given # location (which is taken to be the centre of the pendulum bob.) def showPendulum(x=nil, y=nil) if x && y && (x != 160 || y != 25) diff --git a/ext/tk/sample/demos-jp/plot.rb b/ext/tk/sample/demos-jp/plot.rb index 9ff71904cd..a49ed00df8 100644 --- a/ext/tk/sample/demos-jp/plot.rb +++ b/ext/tk/sample/demos-jp/plot.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($plot_demo) && $plot_demo - $plot_demo.destroy + $plot_demo.destroy $plot_demo = nil end @@ -19,7 +19,7 @@ $plot_demo = TkToplevel.new {|w| base_frame = TkFrame.new($plot_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'4i', 'justify'=>'left', 'text'=>"¤³¤Î¥¦¥£¥ó¥É¥¦¤Ï´Êñ¤Ê2¼¡¸µ¤Î¥×¥í¥Ã¥È¤ò´Þ¤ó¤À¥­¥ã¥ó¥Ð¥¹ widget¤Ç¤¹¡£É½¼¨¤µ¤ì¤¿ÅÀ¤ò¥Þ¥¦¥¹¥Ü¥¿¥ó1¤Ç¥É¥é¥Ã¥°¤·¤Æ¥Ç¡¼¥¿¤ò¤¤¤¸¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£"){ pack('side'=>'top') } @@ -57,45 +57,45 @@ $plot_canvas.pack('side'=>'top', 'fill'=>'x') # plot À¸À® TkcLine.new($plot_canvas, 100, 250, 400, 250, 'width'=>2) TkcLine.new($plot_canvas, 100, 250, 100, 50, 'width'=>2) -TkcText.new($plot_canvas, 225, 20, +TkcText.new($plot_canvas, 225, 20, 'text'=>"´Êñ¤Ê¥×¥í¥Ã¥È", 'font'=>plotFont, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($plot_canvas, x, 250, x, 245, 'width'=>2) - TkcText.new($plot_canvas, x, 254, + TkcText.new($plot_canvas, x, 254, 'text'=>10*i, 'font'=>plotFont, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($plot_canvas, 100, y, 105, y, 'width'=>2) - TkcText.new($plot_canvas, 96, y, + TkcText.new($plot_canvas, 96, y, 'text'=>"#{i*50}.0", 'font'=>plotFont, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6, + item = TkcOval.new($plot_canvas, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end -$plot_canvas.itembind('point', 'Any-Enter', +$plot_canvas.itembind('point', 'Any-Enter', proc{$plot_canvas.itemconfigure 'current','fill','red'}) -$plot_canvas.itembind('point', 'Any-Leave', +$plot_canvas.itembind('point', 'Any-Leave', proc{$plot_canvas.itemconfigure 'current','fill','SkyBlue2'}) -$plot_canvas.itembind('point', '1', +$plot_canvas.itembind('point', '1', proc{|x,y| plotDown $plot_canvas,x,y}, "%x %y") -$plot_canvas.itembind('point', 'ButtonRelease-1', +$plot_canvas.itembind('point', 'ButtonRelease-1', proc{$plot_canvas.dtag 'selected'}) -$plot_canvas.bind('B1-Motion', +$plot_canvas.bind('B1-Motion', proc{|x,y| plotMove $plot_canvas,x,y}, "%x %y") $plot = {'lastX'=>0, 'lastY'=>0} # plotDown -- -# This method is invoked when the mouse is pressed over one of the +# This method is invoked when the mouse is pressed over one of the # data points. It sets up state to allow the point to be dragged. # # Arguments: diff --git a/ext/tk/sample/demos-jp/puzzle.rb b/ext/tk/sample/demos-jp/puzzle.rb index 2febc2c55a..16d7ce497c 100644 --- a/ext/tk/sample/demos-jp/puzzle.rb +++ b/ext/tk/sample/demos-jp/puzzle.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($puzzle_demo) && $puzzle_demo - $puzzle_demo.destroy + $puzzle_demo.destroy $puzzle_demo = nil end @@ -49,7 +49,7 @@ TkFrame.new(base_frame) {|frame| # frame À¸À® # # Special trick: scrollbar widget ¤òÀ¸À®¤·¤Æ¤½¤Î trough color ¤òÍѤ¤¤ë¤³¤È¤Ç -# ¶õÇòÉôʬ¤Î¤¿¤á¤Î°Å¿§¤òÁªÂò¤·¡¤ÀßÄꤹ¤ë +# ¶õÇòÉôʬ¤Î¤¿¤á¤Î°Å¿§¤òÁªÂò¤·¡¤ÀßÄꤹ¤ë # begin if Tk.windowingsystem() == 'aqua' @@ -69,7 +69,7 @@ end # depend_on_button_width = true depend_on_button_width = false - + s = TkScrollbar.new(base_frame) base = TkFrame.new(base_frame) { width frameWidth @@ -103,7 +103,7 @@ order = [3,1,6,2,5,7,15,13,4,11,8,9,14,10,12] if depend_on_button_width && (w.winfo_reqwidth * 4 > base.width) base.width = w.winfo_reqwidth * 4 end - }.place('relx'=>$xpos[num], 'rely'=>$ypos[num], + }.place('relx'=>$xpos[num], 'rely'=>$ypos[num], 'relwidth'=>0.25, 'relheight'=>0.25) } $xpos['space'] = 0.75 diff --git a/ext/tk/sample/demos-jp/radio.rb b/ext/tk/sample/demos-jp/radio.rb index a61ad46d9b..3355f25116 100644 --- a/ext/tk/sample/demos-jp/radio.rb +++ b/ext/tk/sample/demos-jp/radio.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($radio_demo) && $radio_demo - $radio_demo.destroy + $radio_demo.destroy $radio_demo = nil end diff --git a/ext/tk/sample/demos-jp/radio2.rb b/ext/tk/sample/demos-jp/radio2.rb index cf53e3e485..91496beb6d 100644 --- a/ext/tk/sample/demos-jp/radio2.rb +++ b/ext/tk/sample/demos-jp/radio2.rb @@ -10,7 +10,7 @@ # toplevel widget if defined?($radio2_demo) && $radio2_demo - $radio2_demo.destroy + $radio2_demo.destroy $radio2_demo = nil end @@ -23,7 +23,7 @@ $radio2_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio2_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '5i' @@ -32,12 +32,12 @@ msg = TkLabel.new(base_frame) { } msg.pack('side'=>'top') -# +# size = TkVariable.new color = TkVariable.new align = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| TkButton.new(frame) { #text 'λ²ò' @@ -58,24 +58,24 @@ TkFrame.new(base_frame) {|frame| TkButton.new(frame) { text 'ÊÑ¿ô»²¾È' command proc{ - showVars(base_frame, + showVars(base_frame, ['size', size], ['color', color], ['compound', align]) } }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame -f_left = TkLabelFrame.new(base_frame, 'text'=>'ʸ»ú¥µ¥¤¥º', +# frame +f_left = TkLabelFrame.new(base_frame, 'text'=>'ʸ»ú¥µ¥¤¥º', 'pady'=>2, 'padx'=>2) -f_mid = TkLabelFrame.new(base_frame, 'text'=>'¿§', +f_mid = TkLabelFrame.new(base_frame, 'text'=>'¿§', 'pady'=>2, 'padx'=>2) -f_right = TkLabelFrame.new(base_frame, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ', +f_right = TkLabelFrame.new(base_frame, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ', 'pady'=>2, 'padx'=>2) f_left.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_mid.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') -# radiobutton +# radiobutton [10, 12, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "¥Ý¥¤¥ó¥È¥µ¥¤¥º #{sz}" @@ -95,15 +95,15 @@ f_right.pack('side'=>'left', 'expand'=>'yes', 'padx'=>'.5c', 'pady'=>'.5c') }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x') } -# label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', -label = Tk::Label.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', +# label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', +label = Tk::Label.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', 'compound'=>'left') label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top') label.height(TkWinfo.reqheight(label)) abtn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a| lower = a.downcase - TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', - 'value'=>lower, 'indicatoron'=>0, 'width'=>7, + TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', + 'value'=>lower, 'indicatoron'=>0, 'width'=>7, 'command'=>proc{label.compound(align.value)}) } diff --git a/ext/tk/sample/demos-jp/radio3.rb b/ext/tk/sample/demos-jp/radio3.rb index 4bbc1b31f5..763c522448 100644 --- a/ext/tk/sample/demos-jp/radio3.rb +++ b/ext/tk/sample/demos-jp/radio3.rb @@ -10,7 +10,7 @@ # toplevel widget if defined?($radio3_demo) && $radio3_demo - $radio3_demo.destroy + $radio3_demo.destroy $radio3_demo = nil end @@ -23,7 +23,7 @@ $radio3_demo = TkToplevel.new {|w| base_frame = TkFrame.new($radio3_demo).pack(:fill=>:both, :expand=>true) -# label +# label msg = TkLabel.new(base_frame) { font $font wraplength '5i' @@ -37,50 +37,50 @@ size = TkVariable.new color = TkVariable.new align = TkVariable.new -# frame +# frame TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'ÊÑ¿ô»²¾È', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, ['size', size], + showVars(base_frame, ['size', size], ['color', color], ['compound', align]) - }), - TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'radio3'}), - TkButton.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + }), + TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'radio3'}), + TkButton.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $radio3_demo $radio3_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) TkGrid(frame, :row=>3, :column=>0, :columnspan=>3, :sticky=>'nsew') } -# frame -f_left = TkLabelFrame.new(base_frame, 'text'=>'ʸ»ú¥µ¥¤¥º', +# frame +f_left = TkLabelFrame.new(base_frame, 'text'=>'ʸ»ú¥µ¥¤¥º', 'pady'=>2, 'padx'=>2) -f_mid = TkLabelFrame.new(base_frame, 'text'=>'¿§', +f_mid = TkLabelFrame.new(base_frame, 'text'=>'¿§', 'pady'=>2, 'padx'=>2) -f_right = TkLabelFrame.new(base_frame, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ', +f_right = TkLabelFrame.new(base_frame, 'text'=>'¥Ó¥Ã¥È¥Þ¥Ã¥×ÇÛÃÖ', 'pady'=>2, 'padx'=>2) f_left .grid('column'=>0, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2) f_mid .grid('column'=>1, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c', 'rowspan'=>2) f_right.grid('column'=>2, 'row'=>1, 'pady'=>'.5c', 'padx'=>'.5c') -TkButton.new(base_frame, 'text'=>'¥È¥é¥¤¥¹¥Æ¡¼¥È', +TkButton.new(base_frame, 'text'=>'¥È¥é¥¤¥¹¥Æ¡¼¥È', 'command'=>proc{size.value = 'multi'; color.value = 'multi'}){ grid('column'=>2, 'row'=>2, 'pady'=>'.5c', 'padx'=>'.5c') } -# radiobutton +# radiobutton [10, 12, 14, 18, 24].each {|sz| TkRadioButton.new(f_left) { text "¥Ý¥¤¥ó¥È¥µ¥¤¥º #{sz}" @@ -103,14 +103,14 @@ TkButton.new(base_frame, 'text'=>' }.pack('side'=>'top', 'pady'=>2, 'fill'=>'x') } -# label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', -label = Tk::Label.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', +# label = TkLabel.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', +label = Tk::Label.new(f_right, 'text'=>'¥é¥Ù¥ë', 'bitmap'=>'questhead', 'compound'=>'left') label.configure('width'=>TkWinfo.reqwidth(label), 'compound'=>'top') label.height(TkWinfo.reqheight(label)) a_btn = ['Top', 'Left', 'Right', 'Bottom'].collect{|a| - TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', - 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7, + TkRadioButton.new(f_right, 'text'=>a, 'variable'=>align, 'relief'=>'flat', + 'value'=>a.downcase, 'indicatoron'=>0, 'width'=>7, 'command'=>proc{label.compound(align.value)}) } diff --git a/ext/tk/sample/demos-jp/ruler.rb b/ext/tk/sample/demos-jp/ruler.rb index d6bc9e76d1..a721b95a6a 100644 --- a/ext/tk/sample/demos-jp/ruler.rb +++ b/ext/tk/sample/demos-jp/ruler.rb @@ -18,7 +18,7 @@ end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($ruler_demo) && $ruler_demo - $ruler_demo.destroy + $ruler_demo.destroy $ruler_demo = nil end @@ -32,7 +32,7 @@ $ruler_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ruler_demo).pack(:fill=>:both, :expand=>true) # label À¸À® -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', 'text'=>"¤³¤Î¥­¥ã¥ó¥Ð¥¹widget¤Ï¥ë¡¼¥é¡¼¤ÎÌÏ·¿¤Ç¤¹¡£¥ë¡¼¥é¡¼¤Î±¦¤Ë¤¢¤ë¤Î¤Ï¥¿¥Ö¥¹¥È¥Ã¥×¤Î°æ¸Í¤Ç¡¢¤³¤³¤«¤é°ú¤ÃÄ¥¤Ã¤Æ¤¯¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥¿¥Ö¥¹¥È¥Ã¥×¤òºî¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£¤Þ¤¿¡¢¤¹¤Ç¤Ë¤¢¤ë¥¿¥Ö¥¹¥È¥Ã¥×¤òư¤«¤¹¤³¤È¤â¤Ç¤­¤Þ¤¹¡£¥¿¥Ö¥¹¥È¥Ã¥×¤ò¾åÊý¤Þ¤¿¤Ï²¼Êý¤Ë¤«¤¹¤ì¤ÆÉ½¼¨¤µ¤ì¤ë¤Þ¤Ç¥É¥é¥Ã¥°¤¹¤ë¤È¡¢¥Þ¥¦¥¹¥Ü¥¿¥ó¤òÎ¥¤·¤¿»þ¤Ë¤½¤Î¥¿¥Ö¥¹¥È¥Ã¥×¤Ï¾Ã¤¨¤Þ¤¹¡£"){ pack('side'=>'top') } @@ -62,8 +62,8 @@ $ruler_canvas.pack('side'=>'top', 'fill'=>'x') # ÃÍÀßÄê unless Struct.const_defined?("RulerInfo") - $demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y, - :top, :bottom, :size, :normalStyle, + $demo_rulerInfo = Struct.new("RulerInfo", :grid, :left, :right, :x, :y, + :top, :bottom, :size, :normalStyle, :activeStyle, :deleteStyle).new end $demo_rulerInfo.grid = '.25c' @@ -75,17 +75,17 @@ $demo_rulerInfo.size = TkWinfo.fpixels($ruler_canvas, '.2c') $demo_rulerInfo.normalStyle = {'fill'=>'black'} if TkWinfo.depth($ruler_canvas) > 1 $demo_rulerInfo.activeStyle = {'fill'=>'red', 'stipple'=>''} - $demo_rulerInfo.deleteStyle = {'fill'=>'red', - 'stipple'=>'@'+[$demo_dir, '..', + $demo_rulerInfo.deleteStyle = {'fill'=>'red', + 'stipple'=>'@'+[$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator)} else $demo_rulerInfo.activeStyle = {'fill'=>'black', 'stipple'=>''} - $demo_rulerInfo.deleteStyle = {'fill'=>'black', - 'stipple'=>'@'+[$demo_dir, '..', + $demo_rulerInfo.deleteStyle = {'fill'=>'black', + 'stipple'=>'@'+[$demo_dir, '..', 'images', 'gray25.xbm'].join(File::Separator)} end -TkcLine.new($ruler_canvas, +TkcLine.new($ruler_canvas, '1c', '0.5c', '1c', '1c', '13c', '1c', '13c', '0.5c', 'width'=>1) (0..11).each{|i| x = i+1 @@ -99,21 +99,21 @@ TkcLine.new($ruler_canvas, $rulerTag_well = TkcTag.new($ruler_canvas) $ruler_canvas\ .addtag_withtag($rulerTag_well, - TkcRectangle.new($ruler_canvas, - '13.2c', '1c', '13.8c', '0.5c', - 'outline'=>'black', + TkcRectangle.new($ruler_canvas, + '13.2c', '1c', '13.8c', '0.5c', + 'outline'=>'black', 'fill'=>($ruler_canvas\ .configinfo('background'))[4]) ) $ruler_canvas\ .addtag_withtag($rulerTag_well, - rulerMkTab($ruler_canvas, - TkWinfo.pixels($ruler_canvas, '13.5c'), + rulerMkTab($ruler_canvas, + TkWinfo.pixels($ruler_canvas, '13.5c'), TkWinfo.pixels($ruler_canvas, '.65c') ) ) $rulerTag_well.bind('1', proc{|x,y| rulerNewTab($ruler_canvas,x,y)}, '%x %y') -$ruler_canvas.itembind('tab', '1', +$ruler_canvas.itembind('tab', '1', proc{|x,y| rulerSelectTab($ruler_canvas,x,y)}, '%x %y') -$ruler_canvas.bind('B1-Motion', +$ruler_canvas.bind('B1-Motion', proc{|x,y| rulerMoveTab($ruler_canvas,x,y)}, '%x %y') $ruler_canvas.bind('Any-ButtonRelease-1', proc{rulerReleaseTab($ruler_canvas)}) diff --git a/ext/tk/sample/demos-jp/sayings.rb b/ext/tk/sample/demos-jp/sayings.rb index aa24b3a2ad..b3bdbe0bc5 100644 --- a/ext/tk/sample/demos-jp/sayings.rb +++ b/ext/tk/sample/demos-jp/sayings.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($sayings_demo) && $sayings_demo - $sayings_demo.destroy + $sayings_demo.destroy $sayings_demo = nil end @@ -67,11 +67,11 @@ TkFrame.new(base_frame, 'borderwidth'=>10) {|w| sayings_lbox.pack('expand'=>'yes', 'fill'=>'y') else - sayings_lbox.grid('row'=>0, 'column'=>0, + sayings_lbox.grid('row'=>0, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - sv.grid('row'=>0, 'column'=>1, + sv.grid('row'=>0, 'column'=>1, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') - sh.grid('row'=>1, 'column'=>0, + sh.grid('row'=>1, 'column'=>0, 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news') TkGrid.rowconfigure(w, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(w, 0, 'weight'=>1, 'minsize'=>0) diff --git a/ext/tk/sample/demos-jp/search.rb b/ext/tk/sample/demos-jp/search.rb index 9838ff5d19..293ae83910 100644 --- a/ext/tk/sample/demos-jp/search.rb +++ b/ext/tk/sample/demos-jp/search.rb @@ -58,13 +58,13 @@ end def textToggle(cmd1,sleep1,cmd2,sleep2) sleep_list = [sleep2, sleep1] - TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, + TkAfter.new(proc{sleep = sleep_list.shift; sleep_list.push(sleep); sleep}, -1, cmd1, cmd2).start(sleep1) end # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($search_demo) && $search_demo - $search_demo.destroy + $search_demo.destroy $search_demo = nil end @@ -98,35 +98,35 @@ $search_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame À¸À® TkFrame.new(base_frame) {|f| - TkLabel.new(f, 'text'=>'¥Õ¥¡¥¤¥ë̾:', + TkLabel.new(f, 'text'=>'¥Õ¥¡¥¤¥ë̾:', 'width'=>13, 'anchor'=>'w').pack('side'=>'left') $search_fileName = TkVariable.new - TkEntry.new(f, 'width'=>40, + TkEntry.new(f, 'width'=>40, 'textvariable'=>$search_fileName) { pack('side'=>'left') bind('Return', proc{textLoadFile($search_text, $search_fileName.value) $search_string_entry.focus}) focus } - TkButton.new(f, 'text'=>'ÆÉ¤ß¹þ¤ß', - 'command'=>proc{textLoadFile($search_text, + TkButton.new(f, 'text'=>'ÆÉ¤ß¹þ¤ß', + 'command'=>proc{textLoadFile($search_text, $search_fileName.value)})\ .pack('side'=>'left', 'pady'=>5, 'padx'=>10) }.pack('side'=>'top', 'fill'=>'x') TkFrame.new(base_frame) {|f| - TkLabel.new(f, 'text'=>'¸¡º÷ʸ»úÎó:', + TkLabel.new(f, 'text'=>'¸¡º÷ʸ»úÎó:', 'width'=>13, 'anchor'=>'w').pack('side'=>'left') $search_searchString = TkVariable.new - $search_string_entry = TkEntry.new(f, 'width'=>40, + $search_string_entry = TkEntry.new(f, 'width'=>40, 'textvariable'=>$search_searchString) { pack('side'=>'left') - bind('Return', proc{textSearch($search_text, $search_searchString.value, + bind('Return', proc{textSearch($search_text, $search_searchString.value, $search_Tag)}) } - TkButton.new(f, 'text'=>'ȿž', - 'command'=>proc{textSearch($search_text, - $search_searchString.value, + TkButton.new(f, 'text'=>'ȿž', + 'command'=>proc{textSearch($search_text, + $search_searchString.value, $search_Tag)}) { pack('side'=>'left', 'pady'=>5, 'padx'=>10) } @@ -139,26 +139,26 @@ $search_text = TkText.new(base_frame, 'setgrid'=>true) {|t| pack('side'=>'right', 'fill'=>'y') } pack('expand'=>'yes', 'fill'=>'both') -} +} # Set up display styles for text highlighting. if TkWinfo.depth($search_demo) > 1 textToggle(proc{ - $search_Tag.configure('background'=>'#ce5555', + $search_Tag.configure('background'=>'#ce5555', 'foreground'=>'white') }, - 800, + 800, proc{ $search_Tag.configure('background'=>'', 'foreground'=>'') }, 200 ) else textToggle(proc{ - $search_Tag.configure('background'=>'black', + $search_Tag.configure('background'=>'black', 'foreground'=>'white') }, - 800, + 800, proc{ $search_Tag.configure('background'=>'', 'foreground'=>'') }, diff --git a/ext/tk/sample/demos-jp/spin.rb b/ext/tk/sample/demos-jp/spin.rb index 8d4e33cda0..2bcc3217e6 100644 --- a/ext/tk/sample/demos-jp/spin.rb +++ b/ext/tk/sample/demos-jp/spin.rb @@ -7,7 +7,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($spin_demo) && $spin_demo - $spin_demo.destroy + $spin_demo.destroy $spin_demo = nil end @@ -19,8 +19,8 @@ $spin_demo = TkToplevel.new {|w| base_frame = TkFrame.new($spin_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5i', :justify=>:left, :text=><:top) ²¼¤Ë¤Ï£³¼ïÎà¤Î¥¹¥Ô¥ó¥Ü¥Ã¥¯¥¹¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ ¤½¤ì¤¾¤ì¡¢¥Þ¥¦¥¹¤ÇÁªÂò¤·¤ÆÊ¸»ú¤òÆþÎϤ¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ @@ -38,7 +38,7 @@ Backspace ¤â¤·¤¢¤Ê¤¿¤¬»È¤Ã¤Æ¤¤¤ë Ruby ¤Ë¥ê¥ó¥¯¤µ¤ì¤Æ¤¤¤ë Tk ¥é¥¤ ¥Ö¥é¥ê¤¬ spinbox ¥¦¥£¥¸¥§¥Ã¥È¤ò¼ÂÁõ¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¤³¤Î ¥Ç¥â¤Ï¤¦¤Þ¤¯Æ°¤«¤Ê¤¤¤Ï¤º¤Ç¤¹¡£¤½¤Î¾ì¹ç¤Ë¤Ï spinbox ¥¦¥£ -¥¸¥§¥Ã¥È¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk +¥¸¥§¥Ã¥È¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ê¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Î Tk ¤òÁȤ߹ç¤ï¤»¤Æ»î¤¹¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£ EOL @@ -56,16 +56,16 @@ TkFrame.new(base_frame){|f| } australianCities = [ - 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', + 'Canberra', 'Sydney', 'Melbourne', 'Perth', 'Adelaide', 'Brisbane', 'Hobart', 'Darwin', 'Alice Springs' ] [ - TkSpinbox.new(base_frame, :from=>1, :to=>10, :width=>10, :validate=>:key, + TkSpinbox.new(base_frame, :from=>1, :to=>10, :width=>10, :validate=>:key, :validatecommand=>[ proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' - ]), - TkSpinbox.new(base_frame, :from=>0, :to=>3, :increment=>0.5, - :format=>'%05.2f', :width=>10), + ]), + TkSpinbox.new(base_frame, :from=>0, :to=>3, :increment=>0.5, + :format=>'%05.2f', :width=>10), TkSpinbox.new(base_frame, :values=>australianCities, :width=>10) ].each{|sbox| sbox.pack(:side=>:top, :pady=>5, :padx=>10)} diff --git a/ext/tk/sample/demos-jp/states.rb b/ext/tk/sample/demos-jp/states.rb index 5e242b7c38..f354d28d84 100644 --- a/ext/tk/sample/demos-jp/states.rb +++ b/ext/tk/sample/demos-jp/states.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($states_demo) && $states_demo - $states_demo.destroy + $states_demo.destroy $states_demo = nil end diff --git a/ext/tk/sample/demos-jp/style.rb b/ext/tk/sample/demos-jp/style.rb index 66b6de0251..3189e1f6d8 100644 --- a/ext/tk/sample/demos-jp/style.rb +++ b/ext/tk/sample/demos-jp/style.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($style_demo) && $style_demo - $style_demo.destroy + $style_demo.destroy $style_demo = nil end @@ -76,13 +76,13 @@ txt = TkText.new(base_frame){|t| # when /^8.*/ # unless $style_demo_do_first # $style_demo_do_first = true -# Tk.tk_call('font', 'create', '@bigascii', +# Tk.tk_call('font', 'create', '@bigascii', # '-copy', '-*-Courier-Bold-R-Normal--*-140-*-*-*-*-*-*') -# Tk.tk_call('font', 'create', '@smallascii', +# Tk.tk_call('font', 'create', '@smallascii', # '-copy', '-Adobe-Helvetica-Bold-R-Normal-*-100-*') -# Tk.tk_call('font', 'create', '@cBigFont', +# Tk.tk_call('font', 'create', '@cBigFont', # '-compound', '@bigascii @msg_knj') -# Tk.tk_call('font', 'create', '@cSmallFont', +# Tk.tk_call('font', 'create', '@cSmallFont', # '-compound', '@smallascii @kanji') # end # style_tag_big = TkTextTag.new(t, 'font'=>'@cBigFont') @@ -96,24 +96,24 @@ txt = TkText.new(base_frame){|t| style_tag_raised = TkTextTag.new(t, 'relief'=>'raised', 'borderwidth'=>1) style_tag_sunken = TkTextTag.new(t, 'relief'=>'sunken', 'borderwidth'=>1) else - style_tag_color1 = TkTextTag.new(t, 'background'=>'black', + style_tag_color1 = TkTextTag.new(t, 'background'=>'black', 'foreground'=>'white') - style_tag_color2 = TkTextTag.new(t, 'background'=>'black', + style_tag_color2 = TkTextTag.new(t, 'background'=>'black', 'foreground'=>'white') - style_tag_raised = TkTextTag.new(t, 'background'=>'white', + style_tag_raised = TkTextTag.new(t, 'background'=>'white', 'relief'=>'raised', 'borderwidth'=>1) - style_tag_sunken = TkTextTag.new(t, 'background'=>'white', + style_tag_sunken = TkTextTag.new(t, 'background'=>'white', 'relief'=>'sunken', 'borderwidth'=>1) end # ¥Æ¥­¥¹¥È¥¿¥°ÀßÄê (¤½¤Î¾) if $tk_version =~ /^4\.[01]/ - style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', - 'borderwidth'=>0, + style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', + 'borderwidth'=>0, 'bgstipple'=>'gray25') else - style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', - 'borderwidth'=>0, + style_tag_bgstipple = TkTextTag.new(t, 'background'=>'black', + 'borderwidth'=>0, 'bgstipple'=>'gray12') end style_tag_fgstipple = TkTextTag.new(t, 'fgstipple'=>'gray50') @@ -217,9 +217,9 @@ X') 9. ¥Þ¡¼¥¸¥ó', style_tag_big) insert('end', '¥Æ¥­¥¹¥È¤Îº¸Â¦¤Ë;ʬ¤Ê¶õÇò¤òÃÖ¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹: ') - insert('end', '¤³¤ÎÃÊÍî¤Ï¥Þ¡¼¥¸¥ó¤Î»ÈÍÑÎã¤Ç¤¹¡£¥¹¥¯¥ê¡¼¥ó', + insert('end', '¤³¤ÎÃÊÍî¤Ï¥Þ¡¼¥¸¥ó¤Î»ÈÍÑÎã¤Ç¤¹¡£¥¹¥¯¥ê¡¼¥ó', style_tag_margins) - insert('end', '¾å¤ÇÀÞ¤êÊÖ¤µ¤ì¤ÆÉ½¼¨¤µ¤ì¤Æ¤¤¤ë1¹Ô¤Î¥Æ¥­¥¹¥È¤Ç¤¹¡£', + insert('end', '¾å¤ÇÀÞ¤êÊÖ¤µ¤ì¤ÆÉ½¼¨¤µ¤ì¤Æ¤¤¤ë1¹Ô¤Î¥Æ¥­¥¹¥È¤Ç¤¹¡£', style_tag_margins) insert('end', 'º¸Â¦¤Ë¤Ï2¼ïÎà¤Î¥Þ¡¼¥¸¥ó¤ò»ý¤Á¤Þ¤¹¡£', style_tag_margins) insert('end', '1¹ÔÌܤËÂФ¹¤ë¤â¤Î¤È¡¢', style_tag_margins) @@ -241,9 +241,9 @@ spacing3') insert('end', '¤Î¶õ´Ö¤òÃÖ ¤¯¤«¤ò¼¨¤·¤Þ¤¹¡£ ') - insert('end', '¤³¤ì¤é¤Î¥¤¥ó¥Ç¥ó¥È¤µ¤ì¤¿ÃÊÍî¤Ï¤É¤Î¤è¤¦¤Ë', + insert('end', '¤³¤ì¤é¤Î¥¤¥ó¥Ç¥ó¥È¤µ¤ì¤¿ÃÊÍî¤Ï¤É¤Î¤è¤¦¤Ë', style_tag_spacing) - insert('end', '¥¹¥Ú¡¼¥·¥ó¥°¤¬¤¬¹Ô¤ï¤ì¤ë¤Î¤«¤ò¼¨¤·¤Þ¤¹¡£', + insert('end', '¥¹¥Ú¡¼¥·¥ó¥°¤¬¤¬¹Ô¤ï¤ì¤ë¤Î¤«¤ò¼¨¤·¤Þ¤¹¡£', style_tag_spacing) insert('end', '³ÆÃÊÍî¤Ï¼ÂºÝ¤Ï¥Æ¥­¥¹¥Èwidget', style_tag_spacing) insert('end', '¤Î1¹Ô¤Ç¡¢widget¤Ë¤è¤Ã¤ÆÀÞ¤ê¾ö¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£ @@ -253,11 +253,11 @@ spacing3') insert('end', '¤³¤ì¤Ë¤è¤ê¡¢ÃÊÍî¤Î´Ö¤ËÂ礭¤Ê´Ö³Ö¤¬', style_tag_spacing) insert('end', '¸ºß¤·¤Æ¤¤¤Þ¤¹¡£', style_tag_spacing) insert('end', 'Spacing2¤Ï2point¤ËÀßÄꤵ¤ì¤Æ¤¤¤Þ¤¹¡£', style_tag_spacing) - insert('end', '¤³¤ì¤ÇÃÊÍî¤ÎÃæ¤Ë¤Û¤ó¤Î¾¯¤·´Ö³Ö¤¬Â¸ºß¤·¤Æ¤¤¤Þ¤¹¡£', + insert('end', '¤³¤ì¤ÇÃÊÍî¤ÎÃæ¤Ë¤Û¤ó¤Î¾¯¤·´Ö³Ö¤¬Â¸ºß¤·¤Æ¤¤¤Þ¤¹¡£', style_tag_spacing) insert('end', 'Spacing3¤Ï¤³¤ÎÎã¤Ç¤Ï»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤»¤ó¡£ ', style_tag_spacing) - insert('end', '´Ö³Ö¤¬¤É¤³¤Ë¤¢¤ë¤«¤ò¸«¤¿¤±¤ì¤Ð¡¢¤³¤ì¤é¤ÎÃÊÍî¤Î', + insert('end', '´Ö³Ö¤¬¤É¤³¤Ë¤¢¤ë¤«¤ò¸«¤¿¤±¤ì¤Ð¡¢¤³¤ì¤é¤ÎÃÊÍî¤Î', style_tag_spacing) insert('end', '¤Ê¤«¤Ç¥Æ¥­¥¹¥È¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£ÁªÂò¤Î', style_tag_spacing) insert('end', 'ȿž¤·¤¿Éôʬ¤Ë¤Ï;ʬ¤Ë¤È¤é¤ì¤¿´Ö³Ö¤¬', style_tag_spacing) diff --git a/ext/tk/sample/demos-jp/text.rb b/ext/tk/sample/demos-jp/text.rb index 0ae480eb00..ea15064830 100644 --- a/ext/tk/sample/demos-jp/text.rb +++ b/ext/tk/sample/demos-jp/text.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($text_demo) && $text_demo - $text_demo.destroy + $text_demo.destroy $text_demo = nil end diff --git a/ext/tk/sample/demos-jp/textpeer.rb b/ext/tk/sample/demos-jp/textpeer.rb index 4967a99c92..de604f1940 100644 --- a/ext/tk/sample/demos-jp/textpeer.rb +++ b/ext/tk/sample/demos-jp/textpeer.rb @@ -5,7 +5,7 @@ # based on Tcl/Tk8.5.0 widget demos if defined?($textpeer_demo) && $textpeer_demo - $textpeer_demo.destroy + $textpeer_demo.destroy $textpeer_demo = nil end @@ -43,11 +43,11 @@ def makeClone(count, win, txt) peer = TkText::Peer.new(txt, win, :widgetname=>"text#{cnt}") sbar = TkScrollbar.new(win, :widgetname=>"sb#{cnt}") peer.yscrollbar sbar - b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", - :text=>'¥Ô¥¢(peer)¤ÎºîÀ®', + b1 = TkButton.new(win, :widgetname=>"clone#{cnt}", + :text=>'¥Ô¥¢(peer)¤ÎºîÀ®', :command=>proc{makeClone(count, win, peer)}) - b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", - :text=>'¥Ô¥¢(peer)¤Î¾Ãµî', + b2 = TkButton.new(win, :widgetname=>"kill#{cnt}", + :text=>'¥Ô¥¢(peer)¤Î¾Ãµî', :command=>proc{killClone(win, cnt)}) row = cnt * 2 TkGrid.configure(peer, sbar, b1, :sticky=>'nsew', :row=>row) @@ -57,7 +57,7 @@ def makeClone(count, win, txt) end def killClone(win, cnt) - Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", + Tk.destroy("#{win.path}.text#{cnt}", "#{win.path}.sb#{cnt}", "#{win.path}.clone#{cnt}", "#{win.path}.kill#{cnt}") end diff --git a/ext/tk/sample/demos-jp/toolbar.rb b/ext/tk/sample/demos-jp/toolbar.rb index 1bb265d1f8..570d52704f 100644 --- a/ext/tk/sample/demos-jp/toolbar.rb +++ b/ext/tk/sample/demos-jp/toolbar.rb @@ -7,7 +7,7 @@ # based on "Id: toolbar.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($toolbar_demo) && $toolbar_demo - $toolbar_demo.destroy + $toolbar_demo.destroy $toolbar_demo = nil end @@ -86,28 +86,28 @@ end text = TkText.new(base_frame, :width=>40, :height=>10) ## Toolbar contents -tb_btn = Ttk::Button.new(tbar_base, :text=>'¥Ü¥¿¥ó', :style=>'Toolbutton', +tb_btn = Ttk::Button.new(tbar_base, :text=>'¥Ü¥¿¥ó', :style=>'Toolbutton', :command=>proc{ text.insert(:end, "¥Ü¥¿¥ó¤¬²¡¤µ¤ì¤Þ¤·¤¿¡¥\n") }) -tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'¥Á¥§¥Ã¥¯¥Ü¥¿¥ó', - :style=>'Toolbutton', - :variable=>(check = TkVariable.new), +tb_chk = Ttk::Checkbutton.new(tbar_base, :text=>'¥Á¥§¥Ã¥¯¥Ü¥¿¥ó', + :style=>'Toolbutton', + :variable=>(check = TkVariable.new), :command=>proc{ text.insert(:end, "¥Á¥§¥Ã¥¯¥Ü¥¿¥ó¤ÎÃͤÏ#{check.value}¤Ç¤¹¡¥\n") }) tb_mbtn = Ttk::Menubutton.new(tbar_base, :text=>'¥á¥Ë¥å¡¼') -tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families, +tb_combo = Ttk::Combobox.new(tbar_base, :value=>TkFont.families, :state=>:readonly) tb_mbtn.menu(menu = Tk::Menu.new(tb_mbtn)) menu.add(:command, :label=>'Just', :command=>proc{text.insert(:end, "Just\n")}) menu.add(:command, :label=>'An', :command=>proc{text.insert(:end, "An\n")}) -menu.add(:command, :label=>'Example', +menu.add(:command, :label=>'Example', :command=>proc{text.insert(:end, "Example\n")}) tb_combo.bind(''){ text.font.family = tb_combo.get } ## Arrange contents -Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, +Tk.grid(tb_btn, tb_chk, tb_mbtn, tb_combo, :in=>contents, :padx=>2, :sticky=>'ns') Tk.grid(tbar_base, :sticky=>'ew') Tk.grid(sep, :sticky=>'ew') @@ -120,16 +120,16 @@ base_frame.grid_columnconfigure(text, :weight=>1) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'toolbar'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'toolbar'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $toolbar_demo.destroy $toolbar_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) Tk.grid(frame, :sticky=>'ew') diff --git a/ext/tk/sample/demos-jp/tree.rb b/ext/tk/sample/demos-jp/tree.rb index c3b4191144..00d715282b 100644 --- a/ext/tk/sample/demos-jp/tree.rb +++ b/ext/tk/sample/demos-jp/tree.rb @@ -8,7 +8,7 @@ # based on "Id: tree.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp" if defined?($tree_demo) && $tree_demo - $tree_demo.destroy + $tree_demo.destroy $tree_demo = nil end @@ -21,8 +21,8 @@ $tree_demo = TkToplevel.new {|w| base_frame = TkFrame.new($tree_demo).pack(:fill=>:both, :expand=>true) ## Explanatory text -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', - :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', + :justify=>:left, :anchor=>'n', :padding=>[10, 2, 10, 6], :text=><:x) Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\ ¤³¤Î¥µ¥ó¥×¥ë¤Ï¡¤¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¤è¤¦¤Ê³¬ÁØÅª¤Ê¥Ç¡¼¥¿½¸¹ç¤ò\ @@ -38,16 +38,16 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'tree'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'tree'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $tree_demo.destroy $tree_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -56,7 +56,7 @@ Ttk::Frame.new(base_frame) {|frame| ## Code to populate the roots of the tree (can be more than one on Windows) def populate_roots(tree) TkComm.simplelist(Tk.tk_call('file', 'volumes')).sort.each{|dir| - populate_tree(tree, tree.insert(nil, :end, :text=>dir, + populate_tree(tree, tree.insert(nil, :end, :text=>dir, :values=>[dir, 'directory'])) } end @@ -69,7 +69,7 @@ def populate_tree(tree, node) tree.delete(tree.children(node)) Dir.glob("#{path}/*").sort.each{|f| type = File.ftype(f) - id = tree.insert(node, :end, + id = tree.insert(node, :end, :text=>File.basename(f), :values=>[f, type]).id if type == 'directory' ## Make it so that this node is openable @@ -95,7 +95,7 @@ def populate_tree(tree, node) end ## Create the tree and set it up -tree = Ttk::Treeview.new(base_frame, :columns=>%w(fullpath type size), +tree = Ttk::Treeview.new(base_frame, :columns=>%w(fullpath type size), :displaycolumns=>['size']) if Tk.windowingsystem != 'aqua' vsb = tree.yscrollbar(Ttk::Scrollbar.new(base_frame)) diff --git a/ext/tk/sample/demos-jp/ttkbut.rb b/ext/tk/sample/demos-jp/ttkbut.rb index 4d577120bb..90ec3fce5b 100644 --- a/ext/tk/sample/demos-jp/ttkbut.rb +++ b/ext/tk/sample/demos-jp/ttkbut.rb @@ -9,7 +9,7 @@ # based on "Id: ttkbut.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp" if defined?($ttkbut_demo) && $ttkbut_demo - $ttkbut_demo.destroy + $ttkbut_demo.destroy $ttkbut_demo = nil end @@ -21,7 +21,7 @@ $ttkbut_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkbut_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top, :fill=>:x) Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\ º£¡¤¤¢¤Ê¤¿¤¬Ìܤˤ·¤Æ¤¤¤ë¤Î¤ÏTtk¤Î¥Æ¡¼¥Þ²½¥é¥Ù¥ë¤Ç¡¤\ @@ -40,11 +40,11 @@ EOL ## Add buttons for setting the theme buttons = Ttk::Labelframe.new(base_frame, :text=>'¥Ü¥¿¥ó') # Ttk::Style.theme_names.each{|theme| -# Ttk::Button.new(buttons, :text=>theme, +# Ttk::Button.new(buttons, :text=>theme, # :command=>proc{Ttk::Style.theme_use theme}).pack(:pady=>2) # } Ttk.themes.each{|theme| - Ttk::Button.new(buttons, :text=>theme, + Ttk::Button.new(buttons, :text=>theme, :command=>proc{Ttk.set_theme theme}).pack(:pady=>2) } @@ -68,9 +68,9 @@ end ## Set up the checkbutton group checks = Ttk::Labelframe.new(base_frame, :text=>'¥Á¥§¥Ã¥¯¥Ü¥¿¥ó') enabled = TkVariable.new(true) -e = Ttk::Checkbutton.new(checks, :text=>'Í­¸ú²½', :variable=>enabled, +e = Ttk::Checkbutton.new(checks, :text=>'Í­¸ú²½', :variable=>enabled, :command=>proc{ - setState($ttkbut_demo, + setState($ttkbut_demo, ((enabled.bool)? "!disabled" : "disabled"), e) }) @@ -96,15 +96,15 @@ radios = Ttk::Labelframe.new(base_frame, :text=>' happyness = TkVariable.new -r1 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r1 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Great', :value=>'great') -r2 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r2 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Good', :value=>'good') -r3 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r3 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Ok', :value=>'ok') -r4 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r4 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Poor', :value=>'poor') -r5 = Ttk::Radiobutton.new(radios, :variable=>happyness, +r5 = Ttk::Radiobutton.new(radios, :variable=>happyness, :text=>'Awful', :value=>'awful') Tk.pack(r1, r2, r3, r4, r5, :fill=>:x, :padx=>3, :pady=>2) @@ -113,26 +113,26 @@ Tk.pack(r1, r2, r3, r4, r5, :fill=>:x, :padx=>3, :pady=>2) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'ÊÑ¿ô»²¾È', - :image=>$image['view'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'ÊÑ¿ô»²¾È', + :image=>$image['view'], :compound=>:left, :command=>proc{ - showVars(base_frame, ['Í­¸ú²½', enabled], - ['¥Á¡¼¥º', cheese], ['¥È¥Þ¥È', tomato], - ['¥Ð¥¸¥ë', basil], ['¥ª¥ì¥¬¥Î', oregano], + showVars(base_frame, ['Í­¸ú²½', enabled], + ['¥Á¡¼¥º', cheese], ['¥È¥Þ¥È', tomato], + ['¥Ð¥¸¥ë', basil], ['¥ª¥ì¥¬¥Î', oregano], ['¹¬Ê¡ÅÙ', happyness]) - }), - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkbut'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + }), + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkbut'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $ttkbut_demo $ttkbut_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x, :expand=>true) diff --git a/ext/tk/sample/demos-jp/ttkmenu.rb b/ext/tk/sample/demos-jp/ttkmenu.rb index d349b42d11..9e78678c8e 100644 --- a/ext/tk/sample/demos-jp/ttkmenu.rb +++ b/ext/tk/sample/demos-jp/ttkmenu.rb @@ -8,7 +8,7 @@ # based on "Id: ttkmenu.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkmenu_demo) && $ttkmenu_demo - $ttkmenu_demo.destroy + $ttkmenu_demo.destroy $ttkmenu_demo = nil end @@ -20,7 +20,7 @@ $ttkmenu_demo = TkToplevel.new {|w| base_frame = Ttk::Frame.new($ttkmenu_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top, :fill=>:x) Ttk¤È¤Ï¡¤¥Æ¡¼¥Þ»ØÄê²Äǽ¤Ê¿·¤·¤¤¥¦¥£¥¸¥§¥Ã¥È½¸¹ç¤Ç¤¹¡¥\ ¤³¤ì¤Ë¤è¤ê¥Æ¡¼¥Þ¤ËÂбþ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¥¦¥£¥¸¥§¥Ã¥È¤Î¤Ò¤È¤Ä¤Ë\ @@ -45,16 +45,16 @@ Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x) Ttk::Frame.new($ttkmenu_demo) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkmenu'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkmenu'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkmenu_demo.destroy $ttkmenu_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) diff --git a/ext/tk/sample/demos-jp/ttknote.rb b/ext/tk/sample/demos-jp/ttknote.rb index 09cc7960a3..f0cd258893 100644 --- a/ext/tk/sample/demos-jp/ttknote.rb +++ b/ext/tk/sample/demos-jp/ttknote.rb @@ -8,7 +8,7 @@ # based on "Id: ttknote.tcl,v 1.5 2007/12/13 15:27:07 dgp Exp" if defined?($ttknote_demo) && $ttknote_demo - $ttknote_demo.destroy + $ttknote_demo.destroy $ttknote_demo = nil end @@ -22,16 +22,16 @@ $ttknote_demo = TkToplevel.new {|w| Ttk::Frame.new($ttknote_demo) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttknote'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttknote'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttknote_demo.destroy $ttknote_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -40,13 +40,13 @@ Ttk::Frame.new($ttknote_demo) {|frame| base_frame = Ttk::Frame.new($ttknote_demo).pack(:fill=>:both, :expand=>true) ## Make the notebook and set up Ctrl+Tab traversal -notebook = Ttk::Notebook.new(base_frame).pack(:fill=>:both, :expand=>true, +notebook = Ttk::Notebook.new(base_frame).pack(:fill=>:both, :expand=>true, :padx=>2, :pady=>3) notebook.enable_traversal ## Popuplate the first pane f_msg = Ttk::Frame.new(notebook) -msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'5i', +msg_m = Ttk::Label.new(f_msg, :font=>$font, :wraplength=>'5i', :justify=>:left, :anchor=>'n', :text=><'¤¹¤Æ¤­¤À¡ª(Neat!)', :underline=>6, +msg_b = Ttk::Button.new(f_msg, :text=>'¤¹¤Æ¤­¤À¡ª(Neat!)', :underline=>6, :command=>proc{ neat.value = '¤¢¤¡¡¤¤½¤Î¤È¤ª¤ê¤µ¡¥¡¥¡¥' Tk.after_cancel(after_id) if after_id diff --git a/ext/tk/sample/demos-jp/ttkpane.rb b/ext/tk/sample/demos-jp/ttkpane.rb index 96670c0e5c..a7b458a683 100644 --- a/ext/tk/sample/demos-jp/ttkpane.rb +++ b/ext/tk/sample/demos-jp/ttkpane.rb @@ -7,7 +7,7 @@ # based on "Id: ttkpane.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkpane_demo) && $ttkpane_demo - $ttkpane_demo.destroy + $ttkpane_demo.destroy $ttkpane_demo = nil end @@ -19,7 +19,7 @@ $ttkpane_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkpane_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top, :fill=>:x) ¤³¤Î¥Ç¥â¤Ï¡¤Ëä¤á¹þ¤ß´Ø·¸¤Ë¤¢¤ë¥Æ¡¼¥ÞÉÕ¤­¥Ú¥¤¥ó¥É¥¦¥£¥ó¥É¥¦¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡¥\ ¤½¤ì¤¾¤ì¤ÎÂ礭¤µ¤Ï¡¤´Þ¤Þ¤ì¤Æ¤¤¤ë¥Ú¥¤¥ó¤Î´Ö¤Ë¤¢¤ë¥¨¥ê¥¢¤ò¤Ä¤«¤ó¤Ç\ @@ -32,16 +32,16 @@ Ttk::Separator.new(base_frame).pack(:side=>:top, :fill=>:x) Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkpane'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkpane'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkpane_demo.destroy $ttkpane_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -61,26 +61,26 @@ if Tk.windowingsystem == 'aqua' end # Fill the button pane -Ttk::Button.new(left_top, :text=>'²¡¤·¤Æ¤Í', +Ttk::Button.new(left_top, :text=>'²¡¤·¤Æ¤Í', :command=>proc{ - Tk.messageBox(:type=>'ok', :icon=>'info', - :message=>'¤¤¤Æ¤Æ¡ª', - :detail=>'That hurt...', :parent=>base_frame, + Tk.messageBox(:type=>'ok', :icon=>'info', + :message=>'¤¤¤Æ¤Æ¡ª', + :detail=>'That hurt...', :parent=>base_frame, :title=>'Button Pressed') }).pack(:padx=>2, :pady=>5) zones_list = [ - [':Europe/Berlin'], - [':America/Argentina/Buenos_Aires', ':America/Buenos_Aires'], - [':Africa/Johannesburg'], - [':Europe/London'], - [':America/Los_Angeles'], + [':Europe/Berlin'], + [':America/Argentina/Buenos_Aires', ':America/Buenos_Aires'], + [':Africa/Johannesburg'], + [':Europe/London'], + [':America/Los_Angeles'], [':Europe/Moscow'], - [':America/New_York'], - [':Asia/Singapore'], - [':Australia/Sydney'], - [':Asia/Tokyo'], + [':America/New_York'], + [':Asia/Singapore'], + [':Australia/Sydney'], + [':Asia/Tokyo'], ] zones = [] @@ -158,7 +158,7 @@ time = TkVariable.new_hash case tzinfo when :tcl update_proc = proc{|now, tz, label| - time[label] = Tk.tk_call('clock', 'format', now.tv_sec, + time[label] = Tk.tk_call('clock', 'format', now.tv_sec, '-timezone', tz, '-format', '%T') } when :tzinfo @@ -179,7 +179,7 @@ end zones.each_with_index{|(zone, label), idx| Ttk::Separator.new(left_bot).pack(:fill=>:x) if idx > 0 Ttk::Label.new(left_bot, :text=>label, :anchor=>'w').pack(:fill=>:x) - Ttk::Label.new(left_bot, :textvariable=>time.ref(label), + Ttk::Label.new(left_bot, :textvariable=>time.ref(label), :anchor=>'w').pack(:fill=>:x) } diff --git a/ext/tk/sample/demos-jp/ttkprogress.rb b/ext/tk/sample/demos-jp/ttkprogress.rb index 43a9cbcd7e..82898bf50e 100644 --- a/ext/tk/sample/demos-jp/ttkprogress.rb +++ b/ext/tk/sample/demos-jp/ttkprogress.rb @@ -7,7 +7,7 @@ # based on "Id: ttkprogress.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp" if defined?($ttkprogress_demo) && $ttkprogress_demo - $ttkprogress_demo.destroy + $ttkprogress_demo.destroy $ttkprogress_demo = nil end @@ -19,7 +19,7 @@ $ttkprogress_demo = TkToplevel.new {|w| base_frame = TkFrame.new($ttkprogress_demo).pack(:fill=>:both, :expand=>true) -Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, +Ttk::Label.new(base_frame, :font=>$font, :wraplength=>'4i', :justify=>:left, :text=><:top, :fill=>:x) ²¼¤Ë¤¢¤ë¤Î¤ÏÆó¤Ä¤Î¥×¥í¥°¥ì¥¹¥Ð¡¼¤Ç¤¹¡¥\ ¾å¤Î¤â¤Î¤Ï"determinate"¥¿¥¤¥×¤Î¥×¥í¥°¥ì¥¹¥Ð¡¼¤Ç¡¤\ @@ -37,16 +37,16 @@ EOL Ttk::Frame.new(base_frame) {|frame| sep = Ttk::Separator.new(frame) Tk.grid(sep, :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'ttkprogress'}), - Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + Ttk::Button.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'ttkprogress'}), + Ttk::Button.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ $ttkprogress_demo.destroy $ttkprogress_demo = nil - }), + }), :padx=>4, :pady=>4) grid_columnconfigure(0, :weight=>1) pack(:side=>:bottom, :fill=>:x) @@ -57,9 +57,9 @@ frame = Ttk::Frame.new(base_frame).pack(:fill=>:both, :expand=>true) p1 = Ttk::Progressbar.new(frame, :mode=>:determinate) p2 = Ttk::Progressbar.new(frame, :mode=>:indeterminate) -start = Ttk::Button.new(frame, :text=>'Start Progress', +start = Ttk::Button.new(frame, :text=>'Start Progress', :command=>proc{ p1.start; p2.start }) -stop = Ttk::Button.new(frame, :text=>'Stop Progress', +stop = Ttk::Button.new(frame, :text=>'Stop Progress', :command=>proc{ p1.stop; p2.stop }) Tk.grid(p1, '-', :pady=>5, :padx=>10) diff --git a/ext/tk/sample/demos-jp/twind.rb b/ext/tk/sample/demos-jp/twind.rb index faefaefd6e..bd0b060754 100644 --- a/ext/tk/sample/demos-jp/twind.rb +++ b/ext/tk/sample/demos-jp/twind.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($twind_demo) && $twind_demo - $twind_demo.destroy + $twind_demo.destroy $twind_demo = nil end @@ -39,10 +39,10 @@ $twind_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame À¸À® $twind_text = nil -TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, +TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, 'relief'=>'sunken') {|f| - $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font, - 'width'=>'70', 'height'=>35, 'wrap'=>'word', + $twind_text = TkText.new(f, 'setgrid'=>'true', 'font'=>$font, + 'width'=>'70', 'height'=>35, 'wrap'=>'word', 'highlightthickness'=>0, 'borderwidth'=>0 ){|t| TkScrollbar.new(f) {|s| command proc{|*args| t.yview(*args)} @@ -52,11 +52,11 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, }.pack('expand'=>'yes', 'fill'=>'both') # ¥¿¥°À¸À® -$tag_center = TkTextTag.new($twind_text, +$tag_center = TkTextTag.new($twind_text, 'justify' =>'center', 'spacing1'=>'5m', 'spacing3'=>'5m' ) -$tag_buttons = TkTextTag.new($twind_text, +$tag_buttons = TkTextTag.new($twind_text, 'lmargin1'=>'1c', 'lmargin2'=>'1c', 'rmargin' =>'1c', @@ -65,14 +65,14 @@ $tag_buttons = TkTextTag.new($twind_text, 'spacing3'=>0 ) # ¥Æ¥­¥¹¥È¤ÎÀ¸À® -$twind_text.insert('end', +$twind_text.insert('end', '¥Æ¥­¥¹¥Èwidget¾å¤Ë¾¤Îwidget¤òÁȤ߹þ¤à¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£') $twind_text.insert('end', 'ÁȤ߹þ¤ß¥¦¥£¥ó¥É¥¦¤È¸Æ¤Ð¤ì¡¢Ç¤°Õ¤Îwidget¤¬²Äǽ¤Ç¤¹¡£') $twind_text.insert('end', 'Î㤨¤Ð¡¢¤³¤³¤Ë2¤Ä¤Î¥Ü¥¿¥ówidget¤¬ÁȤ߹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£') $twind_text.insert('end', 'ºÇ½é¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤È¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { #text 'ON' text '¥ª¥ó' @@ -81,7 +81,7 @@ TkTextWindow.new($twind_text, 'end', }) $twind_text.insert('end', "¤Ë¤·¤Þ¤¹¡£¤Þ¤¿2¤Ä¤á¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È\n") $twind_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { #text 'OFF' text '¥ª¥Õ' @@ -91,7 +91,7 @@ TkTextWindow.new($twind_text, 'end', $twind_text.insert('end', '¤Ë¤·¤Þ¤¹¡£') $twind_text.insert('end', '¤â¤¦¤Ò¤È¤Ä¤ÎÎã¤Ç¤¹¡£') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text '¤³¤³¤ò¥¯¥ê¥Ã¥¯' command proc{textWindPlot $twind_text} @@ -101,7 +101,7 @@ $twind_text.insert('end', ' $mark_plot = TkTextMark.new($twind_text, 'insert') $mark_plot.gravity='left' $twind_text.insert('end', '¥Þ¥¦¥¹¤Ç¥Ç¡¼¥¿¤òÉÁ²è¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text '¾Ãµî' command proc{textWindDel $twind_text} @@ -125,7 +125,7 @@ $twind_text.insert('end', ' ') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) {|b| text '¥Ç¥Õ¥©¥ë¥È' command proc{embDefBg $twind_text} @@ -134,7 +134,7 @@ TkTextWindow.new($twind_text, 'end', }, 'padx'=>3 ) embToggle = TkVariable.new('Short') -TkTextWindow.new($twind_text, 'end', +TkTextWindow.new($twind_text, 'end', 'window'=>TkCheckButton.new($twind_text) { textvariable embToggle indicatoron 0 @@ -145,21 +145,21 @@ TkTextWindow.new($twind_text, 'end', pady 5 padx 2 }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) -[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', - 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', - 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', - 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' +[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', + 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', + 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', + 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' ].each{|twind_color| - TkTextWindow.new($twind_text, 'end', + TkTextWindow.new($twind_text, 'end', 'window'=>TkButton.new($twind_text) { text twind_color cursor 'top_left_arrow' command proc{$twind_text.bg twind_color} }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) } @@ -217,39 +217,39 @@ def textWindPlot (t) TkcLine.new($twind_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind_plot, 100, 250, 100, 50, 'width'=>2) - TkcText.new($twind_plot, 225, 20, + TkcText.new($twind_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind_plot, x, 250, x, 245, 'width'=>2) - TkcText.new($twind_plot, x, 254, + TkcText.new($twind_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind_plot, 100, y, 105, y, 'width'=>2) - TkcText.new($twind_plot, 96, y, + TkcText.new($twind_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, + item = TkcOval.new($twind_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end - $twind_plot.itembind('point', 'Any-Enter', + $twind_plot.itembind('point', 'Any-Enter', proc{$twind_plot.itemconfigure 'current', 'fill', 'red'}) - $twind_plot.itembind('point', 'Any-Leave', + $twind_plot.itembind('point', 'Any-Leave', proc{$twind_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) - $twind_plot.itembind('point', '1', + $twind_plot.itembind('point', '1', proc{|x,y| embPlotDown $twind_plot,x,y}, "%x %y") - $twind_plot.itembind('point', 'ButtonRelease-1', + $twind_plot.itembind('point', 'ButtonRelease-1', proc{$twind_plot.dtag 'selected'}) - $twind_plot.bind('B1-Motion', + $twind_plot.bind('B1-Motion', proc{|x,y| embPlotMove $twind_plot,x,y}, "%x %y") while ($twind_text.get($mark_plot) =~ /[ \t\n]/) $twind_text.delete $mark_plot diff --git a/ext/tk/sample/demos-jp/twind2.rb b/ext/tk/sample/demos-jp/twind2.rb index 2a26b28ef6..96000b0e14 100644 --- a/ext/tk/sample/demos-jp/twind2.rb +++ b/ext/tk/sample/demos-jp/twind2.rb @@ -5,7 +5,7 @@ # toplevel widget ¤¬Â¸ºß¤¹¤ì¤Ðºï½ü¤¹¤ë if defined?($twind2_demo) && $twind2_demo - $twind2_demo.destroy + $twind2_demo.destroy $twind2_demo = nil end @@ -20,20 +20,20 @@ base_frame = TkFrame.new($twind2_demo).pack(:fill=>:both, :expand=>true) # frame À¸À® $twind2_buttons = TkFrame.new(base_frame) {|frame| - TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), + TkGrid(TkFrame.new(frame, :height=>2, :relief=>:sunken, :bd=>2), :columnspan=>4, :row=>0, :sticky=>'ew', :pady=>2) - TkGrid('x', - TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', - :image=>$image['view'], :compound=>:left, - :command=>proc{showCode 'twind2'}), - TkButton.new(frame, :text=>'ÊĤ¸¤ë', - :image=>$image['delete'], :compound=>:left, + TkGrid('x', + TkButton.new(frame, :text=>'¥³¡¼¥É»²¾È', + :image=>$image['view'], :compound=>:left, + :command=>proc{showCode 'twind2'}), + TkButton.new(frame, :text=>'ÊĤ¸¤ë', + :image=>$image['delete'], :compound=>:left, :command=>proc{ tmppath = $twind2_demo $twind2_demo = nil $showVarsWin[tmppath.path] = nil tmppath.destroy - }), + }), :padx=>4, :pady=>4) frame.grid_columnconfigure(0, :weight=>1) } @@ -41,11 +41,11 @@ $twind2_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') # frame À¸À® $twind2_text = nil -TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, +TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, 'relief'=>'sunken') {|f| $twind2_text = TkText.new(f, 'setgrid'=>true, 'font'=>$font, - # 'width'=>'70', 'height'=>35, 'wrap'=>'word', - 'width'=>'70', 'height'=>35, 'wrap'=>'char', + # 'width'=>'70', 'height'=>35, 'wrap'=>'word', + 'width'=>'70', 'height'=>35, 'wrap'=>'char', 'highlightthickness'=>0, 'borderwidth'=>0 ){|t| TkScrollbar.new(f) {|s| command proc{|*args| t.yview(*args)} @@ -55,11 +55,11 @@ TkFrame.new(base_frame, 'highlightthickness'=>2, 'borderwidth'=>2, }.pack('expand'=>'yes', 'fill'=>'both') # ¥¿¥°À¸À® -$tag2_center = TkTextTag.new($twind2_text, +$tag2_center = TkTextTag.new($twind2_text, 'justify' =>'center', 'spacing1'=>'5m', 'spacing3'=>'5m' ) -$tag2_buttons = TkTextTag.new($twind2_text, +$tag2_buttons = TkTextTag.new($twind2_text, 'lmargin1'=>'1c', 'lmargin2'=>'1c', 'rmargin' =>'1c', @@ -86,7 +86,7 @@ $twind2_text.insert('end', ' $twind2_text.insert('end', '¥Ü¥¿¥ó¥¦¥£¥¸¥§¥Ã¥È¤¬Ëä¤á¹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£') $twind2_text.insert('end', 'ºÇ½é¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È¡¢') $twind2_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò ') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { #text 'ON' text '¥ª¥ó' @@ -95,7 +95,7 @@ TkTextWindow.new($twind2_text, 'end', }) $twind2_text.insert('end', "¤Ë¤·¤Þ¤¹¡£¤Þ¤¿¡¢£²¤Ä¤á¤Î¥Ü¥¿¥ó¤ò¥¯¥ê¥Ã¥¯¤¹¤ë¤È\n") $twind2_text.insert('end', '¿åÊ¿Êý¸þ¤Î¥¹¥¯¥í¡¼¥ë¤ò') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { #text 'OFF' text '¥ª¥Õ' @@ -105,7 +105,7 @@ TkTextWindow.new($twind2_text, 'end', $twind2_text.insert('end', "¤Ë¤·¤Þ¤¹¡£\n\n") $twind2_text.insert('end', '¼¡¤Ï¤â¤¦¤Ò¤È¤Ä¤ÎÎã¤Ç¤¹¡£') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text '¤³¤³¤ò¥¯¥ê¥Ã¥¯' command proc{textWindPlot2 $twind2_text} @@ -116,7 +116,7 @@ $mark2_plot = TkTextMark.new($twind2_text, 'insert') $mark2_plot.gravity='left' $twind2_text.insert('end', '¥Þ¥¦¥¹¤Ç¥É¥é¥Ã¥°¤¹¤ë¤³¤È¤Ç¡¢') $twind2_text.insert('end', '¥×¥í¥Ã¥È¾å¤Î¥Ç¡¼¥¿ÅÀ¤ò°Üư¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text '¾Ãµî' command proc{textWindDel2 $twind2_text} @@ -148,7 +148,7 @@ btn_default = TkButton.new($twind2_text) {|b| } TkTextWindow.new($twind2_text, 'end', 'window'=>btn_default, 'padx'=>3) embToggle = TkVariable.new('Short') -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkCheckButton.new($twind2_text) { textvariable embToggle indicatoron 0 @@ -159,21 +159,21 @@ TkTextWindow.new($twind2_text, 'end', pady 5 padx 2 }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) -[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', - 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', - 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', - 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' +[ 'AntiqueWhite3', 'Bisque1', 'Bisque2', 'Bisque3', 'Bisque4', + 'SlateBlue3', 'RoyalBlue1', 'SteelBlue2', 'DeepSkyBlue3', 'LightBlue1', + 'DarkSlateGray1', 'Aquamarine2', 'DarkSeaGreen2', 'SeaGreen1', + 'Yellow1', 'IndianRed1', 'IndianRed2', 'Tan1', 'Tan4' ].each{|twind_color| - TkTextWindow.new($twind2_text, 'end', + TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text) { text twind_color cursor 'top_left_arrow' command proc{$twind2_text.bg twind_color} }, - 'padx'=>3, + 'padx'=>3, 'pady'=>2 ) } @@ -187,44 +187,44 @@ $text_normal2['pad'] = $twind2_text.cget('padx') $twind2_text.insert('end', "\nborder width ¤ä highlightthickness, ") $twind2_text.insert('end', "padding ¤òÄ̾ï¤ÎÃͤ«¤éÊѹ¹¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£\n") -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big borders", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big borders", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigB2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Small borders", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Small borders", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallB2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big highlight", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big highlight", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigH2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', +TkTextWindow.new($twind2_text, 'end', 'window'=>TkButton.new($twind2_text, :text=>"Small highlight", - :cursor=>'top_left_arrow', + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallH2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Big pad", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Big pad", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinBigP2 $twind2_text })) -TkTextWindow.new($twind2_text, 'end', - 'window'=>TkButton.new($twind2_text, :text=>"Small pad", - :cursor=>'top_left_arrow', +TkTextWindow.new($twind2_text, 'end', + 'window'=>TkButton.new($twind2_text, :text=>"Small pad", + :cursor=>'top_left_arrow', 'command'=>proc{ textWinSmallP2 $twind2_text })) @@ -232,9 +232,9 @@ TkTextWindow.new($twind2_text, 'end', $twind2_text.insert('end', "\n\n¹¹¤Ë¥¤¥á¡¼¥¸¤â¥Æ¥­¥¹¥È¥¦¥£¥¸¥§¥Ã¥È¤Ë") $twind2_text.insert('end', "¤¦¤Þ¤¯ÇÛÃ֤Ǥ­¤Þ¤¹¡§") -TkTextImage.new($twind2_text, 'end', +TkTextImage.new($twind2_text, 'end', 'image'=>TkBitmapImage.new(:file=>[ - $demo_dir, '..', + $demo_dir, '..', 'images', 'face.xbm' ].join(File::Separator))) @@ -309,39 +309,39 @@ def textWindPlot2 (t) TkcLine.new($twind2_plot, 100, 250, 400, 250, 'width'=>2) TkcLine.new($twind2_plot, 100, 250, 100, 50, 'width'=>2) - TkcText.new($twind2_plot, 225, 20, + TkcText.new($twind2_plot, 225, 20, 'text'=>"A Simple Plot", 'font'=>font, 'fill'=>'brown') (0..10).each {|i| x = 100 + (i * 30) TkcLine.new($twind2_plot, x, 250, x, 245, 'width'=>2) - TkcText.new($twind2_plot, x, 254, + TkcText.new($twind2_plot, x, 254, 'text'=>10*i, 'font'=>font, 'anchor'=>'n') } (0..5).each {|i| y = 250 - (i * 40) TkcLine.new($twind2_plot, 100, y, 105, y, 'width'=>2) - TkcText.new($twind2_plot, 96, y, + TkcText.new($twind2_plot, 96, y, 'text'=>"#{i*50}.0", 'font'=>font, 'anchor'=>'e') } for xx, yy in [[12,56],[20,94],[33,98],[32,120],[61,180],[75,160],[98,223]] x = 100 + (3*xx) y = 250 - (4*yy)/5 - item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, + item = TkcOval.new($twind2_plot, x-6, y-6, x+6, y+6, 'width'=>1, 'outline'=>'black', 'fill'=>'SkyBlue2') item.addtag 'point' end - $twind2_plot.itembind('point', 'Any-Enter', + $twind2_plot.itembind('point', 'Any-Enter', proc{$twind2_plot.itemconfigure 'current', 'fill', 'red'}) - $twind2_plot.itembind('point', 'Any-Leave', + $twind2_plot.itembind('point', 'Any-Leave', proc{$twind2_plot.itemconfigure 'current', 'fill', 'SkyBlue2'}) - $twind2_plot.itembind('point', '1', + $twind2_plot.itembind('point', '1', proc{|x,y| embPlotDown2 $twind2_plot,x,y}, "%x %y") - $twind2_plot.itembind('point', 'ButtonRelease-1', + $twind2_plot.itembind('point', 'ButtonRelease-1', proc{$twind2_plot.dtag 'selected'}) - $twind2_plot.bind('B1-Motion', + $twind2_plot.bind('B1-Motion', proc{|x,y| embPlotMove2 $twind2_plot,x,y}, "%x %y") while ($twind2_text.get($mark2_plot) =~ /[ \t\n]/) $twind2_text.delete $mark2_plot diff --git a/ext/tk/sample/demos-jp/unicodeout.rb b/ext/tk/sample/demos-jp/unicodeout.rb index 178077ec08..4857cd131d 100644 --- a/ext/tk/sample/demos-jp/unicodeout.rb +++ b/ext/tk/sample/demos-jp/unicodeout.rb @@ -8,7 +8,7 @@ # based on Tcl/Tk8.4.4 widget demos if defined?($unicodeout_demo) && $unicodeout_demo - $unicodeout_demo.destroy + $unicodeout_demo.destroy $unicodeout_demo = nil end @@ -20,8 +20,8 @@ $unicodeout_demo = TkToplevel.new {|w| base_frame = TkFrame.new($unicodeout_demo).pack(:fill=>:both, :expand=>true) -TkLabel.new(base_frame, - :font=>$font, :wraplength=>'5.4i', :justify=>:left, +TkLabel.new(base_frame, + :font=>$font, :wraplength=>'5.4i', :justify=>:left, :text=><:top) ¤³¤ì¤Ï¡¤Tk¤Ë¤ª¤±¤ëÈó²¤ÊÆÊ¸»ú½¸¹ç¤òÍѤ¤¤ë¸À¸ì¤ËÂФ¹¤ë¥µ¥Ý¡¼¥È¤Ë¤Ä¤¤¤Æ¤Î\ ¥µ¥ó¥×¥ë¤Ç¤¹¡¥¤¿¤À¤·¡¤²¼¤Îɽ¼¨¤Ë¤ª¤¤¤Æ¤¢¤Ê¤¿¤¬¼ÂºÝ¤Ë¤É¤Î¤è¤¦¤Êɽ¼¨¤ò\ @@ -55,9 +55,9 @@ TkFrame.new(base_frame){|f| }).pack(:side=>:left, :expand=>true) } -wait_msg = TkLabel.new(base_frame, - :text=>"¥Õ¥©¥ó¥ÈÆÉ¤ß¹þ¤ß¤Î´°Î»¤Þ¤Ç" + - "¤·¤Ð¤é¤¯¤ªÂÔ¤Á²¼¤µ¤¤¡¥¡¥¡¥", +wait_msg = TkLabel.new(base_frame, + :text=>"¥Õ¥©¥ó¥ÈÆÉ¤ß¹þ¤ß¤Î´°Î»¤Þ¤Ç" + + "¤·¤Ð¤é¤¯¤ªÂÔ¤Á²¼¤µ¤¤¡¥¡¥¡¥", :font=>"Helvetica 12 italic").pack class Unicodeout_SampleFrame < TkFrame @@ -77,10 +77,10 @@ class Unicodeout_SampleFrame < TkFrame def add_sample(lang, *args) sample_txt = Tk::UTF8_String(args.join('')) - l = TkLabel.new(self, :font=>@@font, :text=>lang+':', + l = TkLabel.new(self, :font=>@@font, :text=>lang+':', :anchor=>:nw, :pady=>0) - #s = TkLabel.new(self, :font=>@@font, :text=>sample_txt, - s = TkLabel.new(self, :font=>TkFont.new(@@font), :text=>sample_txt, + #s = TkLabel.new(self, :font=>@@font, :text=>sample_txt, + s = TkLabel.new(self, :font=>TkFont.new(@@font), :text=>sample_txt, :anchor=>:nw, :width=>30, :pady=>0) Tk.grid(l, s, :sticky=>:ew, :pady=>0) l.grid_config(:padx, '1m') @@ -96,23 +96,23 @@ oldCursor = $unicodeout_demo.cursor $unicodeout_demo.cursor('watch') Tk.update -f.add_sample('Arabic', - '\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94', +f.add_sample('Arabic', + '\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D\uFE94', '\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D') f.add_sample('Trad. Chinese', '\u4E2D\u570B\u7684\u6F22\u5B57') f.add_sample('Simpl. Chinese', '\u6C49\u8BED') -f.add_sample('Greek', - '\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE ', +f.add_sample('Greek', + '\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE ', '\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1') -f.add_sample('Hebrew', - '\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 ', +f.add_sample('Hebrew', + '\u05DD\u05D9\u05DC\u05E9\u05D5\u05E8\u05D9 ', '\u05DC\u05D9\u05D0\u05E8\u05E9\u05D9') -f.add_sample('Japanese', - '\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, ', +f.add_sample('Japanese', + '\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, ', '\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA') f.add_sample('Korean', '\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00') -f.add_sample('Russian', - '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 ', +f.add_sample('Russian', + '\u0420\u0443\u0441\u0441\u043A\u0438\u0439 ', '\u044F\u0437\u044B\u043A') wait_msg.destroy diff --git a/ext/tk/sample/demos-jp/widget b/ext/tk/sample/demos-jp/widget index 8eb699e513..dfaa9c004e 100644 --- a/ext/tk/sample/demos-jp/widget +++ b/ext/tk/sample/demos-jp/widget @@ -2,7 +2,8 @@ # -*- coding: euc-jp -*- # ´Á»ú¥³¡¼¥ÉÀßÄê ( tk.rb ¤Î¥í¡¼¥É»þ¤Î encoding ¿äÄê/ÀßÄê¤Ë»È¤ï¤ì¤ë ) -if RUBY_VERSION < '1.9.0' ### !!!!!!!!!!!!!! +#if RUBY_VERSION < '1.9.0' ### !!!!!!!!!!!!!! +unless defined?(::Encoding.default_external) $KCODE = 'euc' else DEFAULT_TK_ENCODING = 'EUC-JP' @@ -189,10 +190,14 @@ else yscrollcommand proc{|first,last| scr.set first,last} } scr.command(proc{|*args| txt.yview(*args)}) + # txt.pack('in'=>textFrame, 'expand'=>'yes', 'fill'=>'both', 'padx'=>1) - txt.pack('in'=>textFrame, 'expand'=>'yes', 'fill'=>'both') +# txt.pack('in'=>textFrame, 'expand'=>'yes', 'fill'=>'both') # textFrame.pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>2) textFrame.pack('expand'=>'yes', 'fill'=>'both') + # $root.withdraw.deiconify + Tk.update_idletasks + txt.pack('in'=>textFrame, 'expand'=>'yes', 'fill'=>'both') statusBar = TkFrame.new($root) {|f| if $tk_version =~ /^4.*/ @@ -881,18 +886,12 @@ def showCode1(demo) $code_window.title("Demo code: #{file}") $code_window.iconname(file) -# fid = open(file, 'r') - fid = open([$demo_dir, file].join(File::Separator), 'r') + code = open([$demo_dir, file].join(File::Separator), 'r'){|fid| fid.read } $code_text.delete('1.0', 'end') - #$code_text.insert('1.0', `cat #{file}`) - $code_text.insert('1.0', fid.read) - #$code_mark = TkTextMark.new($code_text, '1.0') - #$code_text.set_insert('1.0') + code.force_encoding('EUC-JP') if defined?(::Encoding.default_external) + $code_text.insert('1.0', code) TkTextMarkInsert.new($code_text,'1.0') - $set_linenum.call($code_text) - - fid.close end def showCode2(demo) @@ -973,14 +972,12 @@ def showCode2(demo) $code_window.title("Demo code: #{file}") $code_window.iconname(file) - fid = open([$demo_dir, file].join(File::Separator), 'r') + code = open([$demo_dir, file].join(File::Separator), 'r'){|fid| fid.read } $code_text.delete('1.0', 'end') - $code_text.insert('1.0', fid.read) + code.force_encoding('EUC-JP') if defined?(::Encoding.default_external) + $code_text.insert('1.0', code) TkTextMarkInsert.new($code_text,'1.0') - $set_linenum.call($code_text) - - fid.close end if $tk_major_ver < 8 @@ -1077,7 +1074,7 @@ end # def aboutBox Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo', - 'message'=>"Ruby/Tk ¥¦¥£¥¸¥§¥Ã¥È¥Ç¥â Ver.1.7.0-jp\n\n" + + 'message'=>"Ruby/Tk ¥¦¥£¥¸¥§¥Ã¥È¥Ç¥â Ver.1.7.1-jp\n\n" + "based on demos of Tk8.1 -- 8.5 " + "( Copyright of Tcl/Tk demos:: " + "(c) 1996-1997 Sun Microsystems, Inc. / " + diff --git a/ext/tk/sample/editable_listbox.rb b/ext/tk/sample/editable_listbox.rb index 99345da380..7a9ad4450b 100644 --- a/ext/tk/sample/editable_listbox.rb +++ b/ext/tk/sample/editable_listbox.rb @@ -1,28 +1,115 @@ # -# Editable_TkListbox class +# Tk::RbWidget::Editable_Listbox class # # When "DoubleClick-1" on a listbox item, the entry box is opend on the # item. And when hit "Return" key on the entry box after modifying the -# text, the entry box is closed and the item is changed. Or when hit +# text, the entry box is closed and the item is changed. Or when hit # "Escape" key, the entry box is closed without modification. # # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # require 'tk' -class Editable_TkListbox < TkListbox - def _ebox_placer(coord_y) - idx = self.nearest(coord_y) - x, y, w, h = self.bbox(idx) - @ebox.place(:x => 0, :relwidth => 1.0, - :y => y - self.selectborderwidth, - :height => h + 2 * self.selectborderwidth) +module Tk + module RbWidget + class Editable_Listbox < TkListbox + end + end +end + + +class Tk::RbWidget::Editable_Listbox < TkListbox + #------------------------------------ + BindTag = TkBindTag.new_by_name(self.to_s.gsub(/::/, '#')) + + BindTag.bind('FocusIn', :widget){|w| + w.instance_eval{ + if idx = @ebox.pos + see(idx) if bbox(idx).empty? + @ebox.focus(true) + end + } + } + + BindTag.bind('Double-1', :widget, :y){|w, y| + w.instance_eval{ _ebox_placer(nearest(y)) } + } + + BindTag.bind('Return', :widget){|w| + w.instance_eval{ + if idx = index(:active) + _ebox_placer(idx) + end + } + } + #------------------------------------ + + def configure(*args) + ret = super + + case cget(:state) + when 'normal' + # do nothing + when 'disabled' + _ebox_erase + else # unknown + # do nothing + + end + + ret + end + + def _ebox_move(idx) + return nil if cget(:state) == 'disabled' + x, y, w, h = bbox(idx) + return nil unless y && h + @ebox.place(:x => 0, :relwidth => 1.0, + :y => y - selectborderwidth, + :height => h + 2 * selectborderwidth) @ebox.pos = idx - @ebox.value = self.listvariable.list[idx] @ebox.focus end - private :_ebox_placer + def _ebox_placer(idx) + return nil unless _ebox_move(idx) + @ebox.value = listvariable.list[idx] + @ebox.xview_moveto(self.xview[0]) + end + + def _ebox_erase + @ebox.place_forget + @ebox.pos = nil + end + private :_ebox_move, :_ebox_placer, :_ebox_erase + + def _setup_ebox_bindings + # bindings for entry + @ebox.bind('Return'){ + list = listvariable.list + list[@ebox.pos] = @ebox.value if @ebox.pos + listvariable.value = list + _ebox_erase + focus + } + + @ebox.bind('Escape'){ _ebox_erase } + end + def _setup_listbox_bindings + # bindings for listbox + tags = bindtags + bindtags(tags.insert(tags.index(self) + 1, self.class::BindTag)) + end + private :_setup_ebox_bindings, :_setup_listbox_bindings + + def yview(*args) + if !@ebox.pos || bbox(@ebox.pos).empty? + @ebox.place_forget + else + _ebox_move(@ebox.pos) + end + super + end def create_self(keys) super(keys) @@ -32,38 +119,30 @@ class Editable_TkListbox < TkListbox end @ebox = TkEntry.new(self){ - @pos = -1 + @pos = nil def self.pos; @pos; end def self.pos=(idx); @pos = idx; end } - @ebox.bind('Return'){ - list = self.listvariable.list - list[@ebox.pos] = @ebox.value - self.listvariable.value = list - @ebox.place_forget - @ebox.pos = -1 - } - - @ebox.bind('Escape'){ - @ebox.place_forget - @ebox.pos = -1 - } - - self.bind('Double-1', '%y'){|y| _ebox_placer(y) } + _setup_ebox_bindings + _setup_listbox_bindings end end if $0 == __FILE__ + #lbox0 = TkListbox.new.pack(:side=>:left) + #lbox0.insert(:end, 0,1,2,3,4,5,6,7,8,9,0,1,2,3) + scr = TkScrollbar.new.pack(:side=>:right, :fill=>:y) - lbox1 = Editable_TkListbox.new.pack(:side=>:left) - lbox2 = Editable_TkListbox.new.pack(:side=>:left) + lbox1 = Tk::RbWidget::Editable_Listbox.new.pack(:side=>:left) + lbox2 = Tk::RbWidget::Editable_Listbox.new.pack(:side=>:left) scr.assign(lbox1, lbox2) lbox1.insert(:end, *%w(a b c d e f g h i j k l m n)) lbox2.insert(:end, 0,1,2,3,4,5,6,7,8,9,0,1,2,3) + Tk.mainloop end diff --git a/ext/tk/sample/encstr_usage.rb b/ext/tk/sample/encstr_usage.rb index b22c2504ac..39dc9c4018 100644 --- a/ext/tk/sample/encstr_usage.rb +++ b/ext/tk/sample/encstr_usage.rb @@ -13,12 +13,12 @@ t3 = TkText.new(:height=>5).pack src_str = IO.readlines(File.join(File.dirname(__FILE__),'iso2022-kr.txt')).join -t1.insert('end', +t1.insert('end', "use neither Tk::EncodedString class nor Tk.encoding= method\n\n") t1.insert('end', src_str) enc_str = Tk::EncodedString(src_str, 'iso2022-kr') -t2.insert('end', +t2.insert('end', "use Tk::EncodedString class (Tk.encoding => '#{Tk.encoding}')\n\n") t2.insert('end', enc_str) diff --git a/ext/tk/sample/figmemo_sample.rb b/ext/tk/sample/figmemo_sample.rb index 1b6979d2dd..25ec618fe8 100644 --- a/ext/tk/sample/figmemo_sample.rb +++ b/ext/tk/sample/figmemo_sample.rb @@ -55,14 +55,14 @@ class PhotoCanvas < TkScrolledCanvas USAGE = <:ridge, :borderwidth=>@border, - :selectborderwidth=>@selectborder, + @entry = TkEntry.new(self, :relief=>:ridge, :borderwidth=>@border, + :selectborderwidth=>@selectborder, :highlightthickness=>0) @entry.bind('Return'){@state.value = 0} @@ -131,7 +131,7 @@ EOT x = w.canvasx(x) y = w.canvasy(y) tag = nil - w.find_overlapping(x - @overlap_d, y - @overlap_d, + w.find_overlapping(x - @overlap_d, y - @overlap_d, x + @overlap_d, y + @overlap_d).find{|item| ! (item.tags.find{|name| if name =~ /^(#{@memo_id_head}\d+)$/ @@ -161,8 +161,8 @@ EOT def _state1(x,y) # set center @mode = 1 - @target = TkcOval.new(self, - [canvasx(x), canvasy(y)], [canvasx(x), canvasy(y)], + @target = TkcOval.new(self, + [canvasx(x), canvasy(y)], [canvasx(x), canvasy(y)], :outline=>@col, :width=>3, :tags=>[@memo_id_tag]) @items << @target @mark = [x,y] @@ -175,16 +175,16 @@ EOT @mode = 2 r = Integer(Math.sqrt((x-@mark[0])**2 + (y-@mark[1])**2)) - @target.coords([canvasx(@mark[0] - r), canvasy(@mark[1] - r)], + @target.coords([canvasx(@mark[0] - r), canvasy(@mark[1] - r)], [canvasx(@mark[0] + r), canvasy(@mark[1] + r)]) end def _state3(x,y) # set line start @mode = 3 - @target = TkcLine.new(self, - [canvasx(x), canvasy(y)], [canvasx(x), canvasy(y)], - :arrow=>:first, :arrowshape=>[10, 14, 5], + @target = TkcLine.new(self, + [canvasx(x), canvasy(y)], [canvasx(x), canvasy(y)], + :arrow=>:first, :arrowshape=>[10, 14, 5], :fill=>@col, :tags=>[@memo_id_tag]) @items << @target @mark = [x, y] @@ -196,7 +196,7 @@ EOT def _state4(x,y) # create line @mode = 4 - @target.coords([canvasx(@mark[0]), canvasy(@mark[1])], + @target.coords([canvasx(@mark[0]), canvasy(@mark[1])], [canvasx(x), canvasy(y)]) end @@ -232,8 +232,8 @@ EOT @entry.value = '' @entry.configure(:justify=>justify, :font=>@font, :foreground=>@col) - ewin = TkcWindow.new(self, [canvasx(x)+dx, canvasy(y)+dy], - :window=>@entry, :state=>:normal, :anchor=>anchor, + ewin = TkcWindow.new(self, [canvasx(x)+dx, canvasy(y)+dy], + :window=>@entry, :state=>:normal, :anchor=>anchor, :tags=>[@memo_id_tag]) @entry.focus @@ -243,9 +243,9 @@ EOT ewin.delete - @target = TkcText.new(self, [canvasx(x), canvasy(y)], - :anchor=>anchor, :justify=>justify, - :fill=>@col, :font=>@font, :text=>@entry.value, + @target = TkcText.new(self, [canvasx(x), canvasy(y)], + :anchor=>anchor, :justify=>justify, + :fill=>@col, :font=>@font, :text=>@entry.value, :tags=>[@memo_id_tag]) _state0() @@ -305,9 +305,9 @@ def open_file(canvas, fname) end filetypes = [ - ['GIF Files', '.gif'], - ['GIF Files', [], 'GIFF'], - ['PPM Files', '.ppm'], + ['GIF Files', '.gif'], + ['GIF Files', [], 'GIFF'], + ['PPM Files', '.ppm'], ['PGM Files', '.pgm'] ] @@ -339,7 +339,7 @@ def open_file(canvas, fname) begin canvas.load_photo(fpath) rescue => e - Tk.messageBox(:icon=>'error', :type=>'ok', + Tk.messageBox(:icon=>'error', :type=>'ok', :message=>"Fail to read '#{fpath}'.\n#{e.message}") end @@ -354,11 +354,11 @@ def save_memo(canvas, fname) initname = fname.value if initname != '-' initname = File.basename(initname, File.extname(initname)) - fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'], - ['ALL Files', '*'] ], + fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'], + ['ALL Files', '*'] ], :initialfile=>initname) else - fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'], + fpath = Tk.getSaveFile(:filetypes=>[ ['Text Files', '.txt'], ['ALL Files', '*'] ]) end return if fpath.empty? @@ -366,7 +366,7 @@ def save_memo(canvas, fname) begin fid = open(fpath, 'w') rescue => e - Tk.messageBox(:icon=>'error', :type=>'ok', + Tk.messageBox(:icon=>'error', :type=>'ok', :message=>"Fail to open '#{fname.value}'.\n#{e.message}") end @@ -384,24 +384,24 @@ def ps_print(canvas, fname) initname = fname.value if initname != '-' initname = File.basename(initname, File.extname(initname)) - fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'], - ['ALL Files', '*'] ], + fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'], + ['ALL Files', '*'] ], :initialfile=>initname) else - fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'], + fpath = Tk.getSaveFile(:filetypes=>[ ['Postscript Files', '.ps'], ['ALL Files', '*'] ]) end return if fpath.empty? bbox = canvas.bbox('all') - canvas.postscript(:file=>fpath, :x=>bbox[0], :y=>bbox[1], + canvas.postscript(:file=>fpath, :x=>bbox[0], :y=>bbox[1], :width=>bbox[2] - bbox[0], :height=>bbox[3] - bbox[1]) end # -------------------------------- def quit(canvas) - ret = Tk.messageBox(:icon=>'warning', :type=>'okcancel', - :default=>'cancel', + ret = Tk.messageBox(:icon=>'warning', :type=>'okcancel', + :default=>'cancel', :message=>'Realy quit? ') exit if ret == 'ok' end @@ -413,11 +413,11 @@ root = TkRoot.new(:title=>'Fig Memo') # create canvas frame canvas = PhotoCanvas.new(root).pack(:fill=>:both, :expand=>true) usage_frame = TkFrame.new(root, :relief=>:ridge, :borderwidth=>2) -hide_btn = TkButton.new(usage_frame, :text=>'hide usage', - :font=>{:size=>8}, :pady=>1, +hide_btn = TkButton.new(usage_frame, :text=>'hide usage', + :font=>{:size=>8}, :pady=>1, :command=>proc{usage_frame.unpack}) hide_btn.pack(:anchor=>'e', :padx=>5) -usage = TkLabel.new(usage_frame, :text=>PhotoCanvas::USAGE, +usage = TkLabel.new(usage_frame, :text=>PhotoCanvas::USAGE, :font=>'Helvetica 8', :justify=>:left).pack show_usage = proc{ @@ -426,20 +426,20 @@ show_usage = proc{ fname = TkVariable.new('-') f = TkFrame.new(root, :relief=>:sunken, :borderwidth=>1).pack(:fill=>:x) -label = TkLabel.new(f, :textvariable=>fname, - :font=>{:size=>-12, :weight=>:bold}, +label = TkLabel.new(f, :textvariable=>fname, + :font=>{:size=>-12, :weight=>:bold}, :anchor=>'w').pack(:side=>:left, :fill=>:x, :padx=>10) # create menu mspec = [ - [ ['File', 0], - ['Show Usage', proc{show_usage.call}, 5], - '---', - ['Open Image File', proc{open_file(canvas, fname)}, 0], - ['Save Memo Texts', proc{save_memo(canvas, fname)}, 0], - '---', - ['Save Postscript', proc{ps_print(canvas, fname)}, 5], - '---', + [ ['File', 0], + ['Show Usage', proc{show_usage.call}, 5], + '---', + ['Open Image File', proc{open_file(canvas, fname)}, 0], + ['Save Memo Texts', proc{save_memo(canvas, fname)}, 0], + '---', + ['Save Postscript', proc{ps_print(canvas, fname)}, 5], + '---', ['Quit', proc{quit(canvas)}, 0] ] ] diff --git a/ext/tk/sample/irbtk.rb b/ext/tk/sample/irbtk.rb index 53ef10d0d1..70dd33e4da 100644 --- a/ext/tk/sample/irbtk.rb +++ b/ext/tk/sample/irbtk.rb @@ -4,8 +4,8 @@ # # If you want to use 'multi-tk.rb', give option '--multi-tk'. # And if you want to use 'remote-tk.rb', give option '--remote-tk'. -# If you want both, you don't need to give both options, because -# 'remote-tk.rb' includes 'multi-tk.rb'. +# If you want both, you don't need to give both options, because +# 'remote-tk.rb' includes 'multi-tk.rb'. # ( There is no trouble even if you give both options. ) # require 'remote-tk' if ARGV.delete('--remote-tk') diff --git a/ext/tk/sample/menubar1.rb b/ext/tk/sample/menubar1.rb index 9fa1201d41..a233c6e088 100644 --- a/ext/tk/sample/menubar1.rb +++ b/ext/tk/sample/menubar1.rb @@ -11,21 +11,21 @@ menu_spec = [ {:label=>'Open', :command=>proc{puts('Open clicked')}, :underline=>0}, '---', ['Check_A', TkVariable.new(true), 6], - {:type=>'checkbutton', :label=>'Check_B', + {:type=>'checkbutton', :label=>'Check_B', :variable=>TkVariable.new, :underline=>6}, '---', ['Radio_X', [radio_var, 'x'], 6, '', {:foreground=>'black'}], ['Radio_Y', [radio_var, 'y'], 6], ['Radio_Z', [radio_var, 'z'], 6], '---', - ['cascade', [ - ['sss', proc{p 'sss'}, 0], - ['ttt', proc{p 'ttt'}, 0], - ['uuu', proc{p 'uuu'}, 0], - ['vvv', proc{p 'vvv'}, 0], - ], - 0, '', - {:font=>'Courier 16 italic', + ['cascade', [ + ['sss', proc{p 'sss'}, 0], + ['ttt', proc{p 'ttt'}, 0], + ['uuu', proc{p 'uuu'}, 0], + ['vvv', proc{p 'vvv'}, 0], + ], + 0, '', + {:font=>'Courier 16 italic', :menu_config=>{:font=>'Times -18 bold', :foreground=>'black'}}], '---', ['Quit', proc{exit}, 0]], @@ -33,7 +33,7 @@ menu_spec = [ [['Edit', 0], ['Cut', proc{puts('Cut clicked')}, 2], ['Copy', proc{puts('Copy clicked')}, 0], - ['Paste', proc{puts('Paste clicked')}, 0]], + ['Paste', proc{puts('Paste clicked')}, 0]], [['Help', 0, {:menu_name=>'help'}], ['About This', proc{puts('Ruby/Tk menubar sample 1')}, 6]] diff --git a/ext/tk/sample/menubar2.rb b/ext/tk/sample/menubar2.rb index 4507d8b2fe..e3cd68eaef 100644 --- a/ext/tk/sample/menubar2.rb +++ b/ext/tk/sample/menubar2.rb @@ -11,21 +11,21 @@ menu_spec = [ {:label=>'Open', :command=>proc{puts('Open clicked')}, :underline=>0}, '---', ['Check_A', TkVariable.new(true), 6], - {:type=>'checkbutton', :label=>'Check_B', + {:type=>'checkbutton', :label=>'Check_B', :variable=>TkVariable.new, :underline=>6}, '---', ['Radio_X', [radio_var, 'x'], 6, '', {:foreground=>'black'}], ['Radio_Y', [radio_var, 'y'], 6], ['Radio_Z', [radio_var, 'z'], 6], '---', - ['cascade', [ - ['sss', proc{p 'sss'}, 0], - ['ttt', proc{p 'ttt'}, 0], - ['uuu', proc{p 'uuu'}, 0], - ['vvv', proc{p 'vvv'}, 0], - ], - 0, '', - {:font=>'Courier 16 italic', + ['cascade', [ + ['sss', proc{p 'sss'}, 0], + ['ttt', proc{p 'ttt'}, 0], + ['uuu', proc{p 'uuu'}, 0], + ['vvv', proc{p 'vvv'}, 0], + ], + 0, '', + {:font=>'Courier 16 italic', :menu_config=>{:font=>'Times -18 bold', :foreground=>'black'}}], '---', ['Quit', proc{exit}, 0]], @@ -33,16 +33,16 @@ menu_spec = [ [['Edit', 0], ['Cut', proc{puts('Cut clicked')}, 2], ['Copy', proc{puts('Copy clicked')}, 0], - ['Paste', proc{puts('Paste clicked')}, 0]], + ['Paste', proc{puts('Paste clicked')}, 0]], [['Help', 0, {:menu_name=>'help'}], ['About This', proc{puts('Ruby/Tk menubar sample 2')}, 6]] ] -mbar = Tk.root.add_menubar(menu_spec, +mbar = Tk.root.add_menubar(menu_spec, # followings are default configure options 'tearoff'=>'false', - 'foreground'=>'grey40', + 'foreground'=>'grey40', 'activeforeground'=>'red', 'font'=>'Helvetia 12 bold') # This (default configure options) is NOT same the following. diff --git a/ext/tk/sample/menubar3.rb b/ext/tk/sample/menubar3.rb new file mode 100644 index 0000000000..129cfd779b --- /dev/null +++ b/ext/tk/sample/menubar3.rb @@ -0,0 +1,72 @@ +# +# menubar sample 3 : vertical layout menubar; use frame and menubuttons +# + +require 'tk' + +radio_var = TkVariable.new('y') + +menu_spec = [ + [['&File', true], # when underline option is ture, '&' index is the position + {:label=>'Open', :command=>proc{puts('Open clicked')}, :underline=>0}, + '---', + ['Check_A', TkVariable.new(true), 6], + {:type=>'checkbutton', :label=>'Check_B', + :variable=>TkVariable.new, :underline=>6}, + '---', + ['Radio_X', [radio_var, 'x'], /[XYZ]/, '', {:foreground=>'black'}], + ['Radio_Y', [radio_var, 'y'], /[XYZ]/], + ['Radio_Z', [radio_var, 'z'], /[XYZ]/], # use Regexp for underline position + '---', + ['cascade', [ + ['sss', proc{p 'sss'}, 0], + ['ttt', proc{p 'ttt'}, 0], + ['uuu', proc{p 'uuu'}, 0], + ['vvv', proc{p 'vvv'}, 0], + ], + 0, '', + {:font=>'Courier 16 italic', + :menu_config=>{:font=>'Times -18 bold', :foreground=>'black'}}], + '---', + ['Quit', proc{exit}, 0]], + + [['Edit', 0], + ['Cut', proc{puts('Cut clicked')}, 2], + ['Copy', proc{puts('Copy clicked')}, 0], + ['Paste', proc{puts('Paste clicked')}, 0]], + + [['Help', 0, {:menu_name=>'help'}], + ['About This', proc{puts('Ruby/Tk menubar sample 3')}, "This"]] + # use string index for underline position +] + +layout_proc = 'vertical' +# The following procedure is same to 'layout_proc'=>'vertical' +=begin +layout_proc = proc{|parent, mbtn| + mbtn.direction :right + mbtn.pack(:side=>:top, :fill=>:x) + + menu = mbtn.menu + cmd = proc{|m, dir| + Tk::Menu::TkInternalFunction.next_menu(m, dir) rescue nil + # ignore error when the internal function doesn't exist + } + menu.bind('Tab', cmd, :widget, 'forward') + menu.bind('Alt-Tab', cmd, :widget, 'backward') +} +=end + +menubar = TkMenubar.new(nil, menu_spec, + 'layout_proc'=>layout_proc, + 'tearoff'=>false, + 'foreground'=>'grey40', + 'activeforeground'=>'red', + 'font'=>'Helvetia 12 bold') +menubar.pack('side'=>'left', 'fill'=>'y') + +TkText.new(:wrap=>'word').pack.insert('1.0', 'This sample script generates "Menu Sidebar". +If "::tk::MenuNextMenuon" function is available your Tcl/Tk library, you will be able to move to the next menu by Tab key on the posted menu, or the previous menu by Alt + Tab key. +Please read the sample source, and check how to override default configure options of menu entries on a menu_spec. Maybe, on windows, this menubar does not work properly about keyboard shortcuts. Then, please use "menu" option of root/toplevel widget (see sample/menubar3.rb).') + +Tk.mainloop diff --git a/ext/tk/sample/multi-ip_sample.rb b/ext/tk/sample/multi-ip_sample.rb index 8d6e1bc626..eccf0201f8 100644 --- a/ext/tk/sample/multi-ip_sample.rb +++ b/ext/tk/sample/multi-ip_sample.rb @@ -19,7 +19,6 @@ cmd = Proc.new{|txt| else root = TkRoot.new(:title=>'timer sample') end - label = TkLabel.new(:parent=>root, :relief=>:raised, :width=>10) \ .pack(:side=>:bottom, :fill=>:both) @@ -48,6 +47,7 @@ cmd = Proc.new{|txt| b_start = TkButton.new(:text=>'Start', :state=>:disabled) { pack(:side=>:left, :fill=>:both, :expand=>true) } + b_stop = TkButton.new(:text=>'Stop', :state=>:normal) { pack('side'=>'left', 'fill'=>'both', 'expand'=>'yes') } @@ -80,19 +80,20 @@ safe_slave2.eval_proc(cmd, 'safe2') # label -> .w00020 cmd.call('master') # label -> .w00024 #second_master = MultiTkIp.new(&cmd) +#second_master = MultiTkIp.new(:safe=>2){p [:second_master, $SAFE]} TkTimer.new(2000, -1, proc{p ['safe1', safe_slave1.deleted?]}).start TkTimer.new(2000, -1, proc{p ['safe2', safe_slave2.deleted?]}).start TkTimer.new(2000, -1, proc{p ['trusted', trusted_slave.deleted?]}).start -TkTimer.new(5000, 1, +TkTimer.new(5000, 1, proc{ safe_slave1.eval_proc{Tk.root.destroy} safe_slave1.delete print "*** The safe_slave1 is deleted by the timer.\n" }).start -TkTimer.new(10000, 1, +TkTimer.new(10000, 1, proc{ trusted_slave.eval_proc{Tk.root.destroy} trusted_slave.delete diff --git a/ext/tk/sample/multi-ip_sample2.rb b/ext/tk/sample/multi-ip_sample2.rb index f4a45d8d9a..79c78dec4a 100644 --- a/ext/tk/sample/multi-ip_sample2.rb +++ b/ext/tk/sample/multi-ip_sample2.rb @@ -14,7 +14,7 @@ cmd = proc{|s| sleep s TkButton.new(:text=>'b2: p $SAFE', :command=>proc{p $SAFE}).pack(:fill=>:x) sleep s - TkButton.new(:text=>'b3: p MultiTkIp.ip_name', + TkButton.new(:text=>'b3: p MultiTkIp.ip_name', :command=>proc{p MultiTkIp.ip_name}).pack(:fill=>:x) sleep s TkButton.new(:text=>'EXIT', :command=>proc{exit}).pack(:fill=>:x) diff --git a/ext/tk/sample/optobj_sample.rb b/ext/tk/sample/optobj_sample.rb index cafacbdd17..a781254a28 100644 --- a/ext/tk/sample/optobj_sample.rb +++ b/ext/tk/sample/optobj_sample.rb @@ -12,13 +12,13 @@ b1 = TkButton.new(f, :text=>'AAA').pack(:fill=>:x) b2 = TkButton.new(f, :text=>'BBB').pack(:fill=>:x) b3 = TkButton.new(f, :text=>'CCC').pack(:fill=>:x) -optobj.assign( b1, - [ b2, 'configure', - { 'foreground'=>'background', - 'background'=>'foreground' } ], - [ b3, nil, - { 'foreground'=>'background', - 'activeforeground'=>nil, +optobj.assign( b1, + [ b2, 'configure', + { 'foreground'=>'background', + 'background'=>'foreground' } ], + [ b3, nil, + { 'foreground'=>'background', + 'activeforeground'=>nil, 'background'=>['foreground', 'activeforeground'] } ] ) optobj.update('activeforeground'=>'yellow') @@ -29,26 +29,26 @@ TkButton.new(f){ } TkButton.new(f){ - configure( optobj.assign([self, nil, - {'foreground'=>'activeforeground', - 'background'=>'foreground', + configure( optobj.assign([self, nil, + {'foreground'=>'activeforeground', + 'background'=>'foreground', 'activeforeground'=>'background'}]) \ + {:text=>'EEE', :relief=>:groove, :borderwidth=>5} ) pack(:fill=>:x) } -optobj.notify # To apply the convert_key ( 3rd element of widget info - # (that is, {'foreground'=>'activeforeground', ,,, } ) - # of the 'EEE' button +optobj.notify # To apply the convert_key ( 3rd element of widget info + # (that is, {'foreground'=>'activeforeground', ,,, } ) + # of the 'EEE' button -TkButton.new(f, :text=>'toggle', +TkButton.new(f, :text=>'toggle', :command=>proc{ fg = optobj['foreground'] bg = optobj['background'] optobj.configure('foreground'=>bg, 'background'=>fg) }).pack(:fill=>:x, :pady=>10) -TkButton.new(f, :text=>'exit', +TkButton.new(f, :text=>'exit', :command=>proc{exit}).pack(:fill=>:x, :pady=>10) TkFrame.new{|f| diff --git a/ext/tk/sample/propagate.rb b/ext/tk/sample/propagate.rb index 800cef553d..66f14aeb72 100644 --- a/ext/tk/sample/propagate.rb +++ b/ext/tk/sample/propagate.rb @@ -3,7 +3,7 @@ require 'tk' TkLabel.new(:text=>"Please click the bottom frame").pack -f = TkFrame.new(:width=>400, :height=>100, :background=>'yellow', +f = TkFrame.new(:width=>400, :height=>100, :background=>'yellow', :relief=>'ridge', :borderwidth=>5).pack # TkPack.propagate(f, false) # <== important!! diff --git a/ext/tk/sample/remote-ip_sample.rb b/ext/tk/sample/remote-ip_sample.rb index 3696a20852..f6eed9e985 100644 --- a/ext/tk/sample/remote-ip_sample.rb +++ b/ext/tk/sample/remote-ip_sample.rb @@ -3,8 +3,8 @@ require 'remote-tk' puts <proc{puts 'This procesure is on the controller-ip (Ruby/Tk)'}, :text=>'print on Ruby/Tk (controller-ip)').pack(:fill=>:x)} ip.eval_proc{TkButton.new(:command=>'puts {This procesure is on the remote-ip (wish)}', :text=>'print on wish (remote-ip)').pack(:fill=>:x)} -# If your remote-ip is Ruby/Tk, you can control the remote Ruby by -# 'ruby' or 'ruby_eval' or 'ruby_cmd' on the Tk interpreter. +# If your remote-ip is Ruby/Tk, you can control the remote Ruby by +# 'ruby' or 'ruby_eval' or 'ruby_cmd' on the Tk interpreter. if ip.is_rubytk? ip.eval_proc{TkButton.new(:command=>'ruby {p 111; p Array.new(3,"ruby")}', :text=>'ruby cmd on the remote-ip').pack(:fill=>:x)} end ip.eval_proc{TkButton.new(:command=>'exit', :text=>'QUIT').pack(:fill=>:x)} -TkButton.new(:command=>proc{exit}, :text=>'QUIT', +TkButton.new(:command=>proc{exit}, :text=>'QUIT', :padx=>10, :pady=>7).pack(:padx=>10, :pady=>7) Tk.mainloop diff --git a/ext/tk/sample/remote-ip_sample2.rb b/ext/tk/sample/remote-ip_sample2.rb index e12b2a96c9..d8cf3c7650 100644 --- a/ext/tk/sample/remote-ip_sample2.rb +++ b/ext/tk/sample/remote-ip_sample2.rb @@ -17,23 +17,23 @@ ip = RemoteTkIp.new(app) # setup remote-ip window btns = [] ip.eval_proc{ - btns << + btns << TkButton.new(:command=>proc{ puts 'This procesure is on the controller-ip (Ruby-side)' - }, + }, :text=>'print on controller-ip (Ruby-side)').pack(:fill=>:x) - btns << + btns << TkButton.new(:command=> 'puts {This procesure is on the remote-ip (Tk-side)}', :text=>'print on remote-ip (Tk-side)').pack(:fill=>:x) - btns << + btns << TkButton.new(:command=> 'ruby { puts "This procedure is on the remote-ip (Ruby-side)" p Array.new(3,"ruby") - }', + }', :text=>'ruby cmd on the remote-ip').pack(:fill=>:x) TkButton.new(:command=>'exit', :text=>'QUIT').pack(:fill=>:x) @@ -41,15 +41,15 @@ ip.eval_proc{ # setup controller-ip window btns.each_with_index{|btn, idx| - # The scope of the eval-block of 'eval_proc' method is different from - # the enternal. If you want to pass local values to the eval-block, + # The scope of the eval-block of 'eval_proc' method is different from + # the enternal. If you want to pass local values to the eval-block, # use arguments of eval_proc method. They are passed to block-arguments. - TkButton.new(:command=>proc{ip.eval_proc(btn){|b| b.flash}}, - :text=>"flash button-#{idx}", + TkButton.new(:command=>proc{ip.eval_proc(btn){|b| b.flash}}, + :text=>"flash button-#{idx}", :padx=>10).pack(:padx=>10, :pady=>2) } -TkButton.new(:command=>proc{exit}, :text=>'QUIT', +TkButton.new(:command=>proc{exit}, :text=>'QUIT', :padx=>10, :pady=>7).pack(:padx=>10, :pady=>7) # start eventloop diff --git a/ext/tk/sample/safe-tk.rb b/ext/tk/sample/safe-tk.rb index e2289697e0..148548efb2 100644 --- a/ext/tk/sample/safe-tk.rb +++ b/ext/tk/sample/safe-tk.rb @@ -7,29 +7,32 @@ require "multi-tk" TkLabel.new(:text=>'This is the Default Master Ipnterpreter').pack(:padx=>5, :pady=>3) TkButton.new(:text=>'QUIT', :command=>proc{exit}).pack(:pady=>3) -TkFrame.new(:borderwidth=>2, :height=>3, +TkFrame.new(:borderwidth=>2, :height=>3, :relief=>:sunken).pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>7) +safe0_p = proc{|*args| p args} + ############################### puts "---- create a safe slave IP with Ruby's safe-level == 1 ----------" -ip = MultiTkIp.new_safe_slave(1) +ip = MultiTkIp.new_safe_slave(1){|*args| safe0_p["safe_slave safe_level == #{$SAFE}", args]} puts "\n---- create procs ----------" puts 'x = proc{p [\'proc x\', "$SAFE==#{$SAFE}"]; exit}' +#x = proc{p ['proc x', "$SAFE==#{$SAFE}"]; exit} x = proc{p ['proc x', "$SAFE==#{$SAFE}"]; exit} -TkLabel.new(:text=>'x = proc{p [\'proc x\', "$SAFE==#{$SAFE}"]; exit}', +TkLabel.new(:text=>'x = proc{p [\'proc x\', "$SAFE==#{$SAFE}"]; exit}', :anchor=>:w).pack(:fill=>:x) puts 'y = proc{|label| p [\'proc y\', "$SAFE==#{$SAFE}", label]; label.text($SAFE)}' y = proc{|label| p ['proc y', "$SAFE==#{$SAFE}", label]; label.text($SAFE)} -TkLabel.new(:text=>'y = proc{|label| p [\'proc y\', "$SAFE==#{$SAFE}", label]; label.text($SAFE)}', +TkLabel.new(:text=>'y = proc{|label| p [\'proc y\', "$SAFE==#{$SAFE}", label]; label.text($SAFE)}', :anchor=>:w).pack(:fill=>:x) puts 'z = proc{p [\'proc z\', "$SAFE==#{$SAFE}"]; exit}' z = proc{p ['proc z', "$SAFE==#{$SAFE}"]; exit} -TkLabel.new(:text=>'z = proc{p [\'proc z\', "$SAFE==#{$SAFE}"]; exit}', +TkLabel.new(:text=>'z = proc{p [\'proc z\', "$SAFE==#{$SAFE}"]; exit}', :anchor=>:w).pack(:fill=>:x) puts "\n---- call 1st eval_proc ----------" @@ -42,12 +45,14 @@ p lbl = ip.eval_proc{ # TkLabel.new(f, :text=>" (<-- 'lbl' widget is here)").pack(:side=>:right) l = TkLabel.new(f).pack(:side=>:right) - TkButton.new(:text=>':command=>proc{l.text($SAFE)}', + TkButton.new(:text=>':command=>proc{l.text($SAFE)}', :command=>proc{l.text($SAFE)}).pack(:fill=>:x, :padx=>5) TkButton.new(:text=>':command=>x', :command=>x).pack(:fill=>:x, :padx=>5) - TkButton.new(:text=>':command=>proc{exit}', - :command=>proc{exit}).pack(:fill=>:x, :padx=>5) - TkFrame.new(:borderwidth=>2, :height=>3, + TkButton.new(:text=>':command=>proc{exit}', + :command=>proc{ + safe0_p["'exit' is called at $SAFE=#{$SAFE}"];exit} + ).pack(:fill=>:x, :padx=>5) + TkFrame.new(:borderwidth=>2, :height=>3, :relief=>:sunken).pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>7) l # return the label widget @@ -62,19 +67,33 @@ p ip.eval_proc(proc{ f = TkFrame.new.pack TkLabel.new(f, :text=>"$SAFE == ").pack(:side=>:left) l = TkLabel.new(f, :text=>$SAFE).pack(:side=>:right) - TkButton.new(:text=>':command=>proc{l.text($SAFE)}', - :command=>proc{l.text($SAFE)}).pack(:fill=>:x, + TkButton.new(:text=>':command=>proc{l.text($SAFE)}', + :command=>proc{l.text($SAFE)}).pack(:fill=>:x, :padx=>5) - TkButton.new(:text=>':command=>proc{y.call(l)}', - :command=>proc{y.call(l)}).pack(:fill=>:x, + TkButton.new(:text=>':command=>proc{y.call(l)}', + :command=>proc{y.call(l)}).pack(:fill=>:x, :padx=>5) + TkButton.new(:text=>':command=>proc{Proc.new(&y).call(l)}', + :command=>proc{ + Proc.new(&y).call(l) + }).pack(:fill=>:x, :padx=>5) + TkButton.new(:text=>':command=>proc{MultiTkIp._proc_on_current_safelevel(y).call(l)}', + :command=>proc{ + MultiTkIp._proc_on_current_safelevel(y).call(l) + }).pack(:fill=>:x, :padx=>5) +if Object.const_defined?(:RubyVM) && ::RubyVM.class == Class TkButton.new(:text=>':command=>proc{Thread.new(l, &y).value}', :command=>proc{ Thread.new(l, &y).value }).pack(:fill=>:x, :padx=>5) - TkButton.new(:text=>':command=>proc{z.call}', +else + # KNOWN BUG:: + # Current multi-tk.rb cannot support long term threads on callbacks. + # Such a thread freezes the Ruby/Tk process. +end + TkButton.new(:text=>':command=>proc{z.call}', :command=>proc{z.call}).pack(:fill=>:x, :padx=>5) - TkFrame.new(:borderwidth=>2, :height=>3, + TkFrame.new(:borderwidth=>2, :height=>3, :relief=>:sunken).pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>7) }) @@ -85,15 +104,15 @@ p bind = ip.eval_str(' f = TkFrame.new.pack TkLabel.new(f, :text=>"$SAFE == ").pack(:side=>:left) l = TkLabel.new(f, :text=>$SAFE).pack(:side=>:right) - TkButton.new(:text=>":command=>proc{y.call(l)}", + TkButton.new(:text=>":command=>proc{y.call(l)}", :command=>proc{y.call(l)}).pack(:fill=>:x, :padx=>5) binding ', binding) p ip.eval_str(" - TkButton.new(:text=>':command=>proc{ l.text = $SAFE }', + TkButton.new(:text=>':command=>proc{ l.text = $SAFE }', :command=>proc{ l.text = $SAFE }).pack(:fill=>:x, :padx=>5) - TkFrame.new(:borderwidth=>2, :height=>3, + TkFrame.new(:borderwidth=>2, :height=>3, :relief=>:sunken).pack(:fill=>:x, :expand=>true, :padx=>10, :pady=>7) ", bind) @@ -106,7 +125,7 @@ p ip.eval_proc{ TkLabel.new(:text=>"3rd and 4th eval_proc : $SAFE == #{$SAFE}").pack } p ip.eval_proc{ - TkButton.new(:text=>':command=>proc{ lbl.text = $SAFE }', + TkButton.new(:text=>':command=>proc{ lbl.text = $SAFE }', :command=>proc{ lbl.text = $SAFE }).pack(:fill=>:x, :padx=>5) } diff --git a/ext/tk/sample/scrollframe.rb b/ext/tk/sample/scrollframe.rb index b0ac6d3874..6a9381d465 100644 --- a/ext/tk/sample/scrollframe.rb +++ b/ext/tk/sample/scrollframe.rb @@ -1,19 +1,19 @@ # -# Tk::ScrollFrame class +# Tk::RbWidget::ScrollFrame class # # This widget class is a frame widget with scrollbars. # The ScrollFrame doesn't propagate the size of embedded widgets. # When it is configured, scrollregion of the container is changed. # -# Scrollbars can be toggled by Tk::ScrollFrame#vscroll & hscroll. -# If horizontal or virtical scrollbar is turned off, the horizontal +# Scrollbars can be toggled by Tk::RbWidget::ScrollFrame#vscroll & hscroll. +# If horizontal or virtical scrollbar is turned off, the horizontal # or virtical size of embedded widgets is propagated. # # Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # require 'tk' -class Tk::ScrollFrame < TkFrame +class Tk::RbWidget::ScrollFrame < TkFrame include TkComposite DEFAULT_WIDTH = 200 @@ -27,8 +27,8 @@ class Tk::ScrollFrame < TkFrame @v_scroll = TkScrollbar.new(@frame, 'orient'=>'vertical') # create a canvas widget - @canvas = TkCanvas.new(@frame, - :borderwidth=>0, :selectborderwidth=>0, + @canvas = TkCanvas.new(@frame, + :borderwidth=>0, :selectborderwidth=>0, :highlightthickness=>0) # allignment @@ -209,28 +209,38 @@ end # test if __FILE__ == $0 - f = Tk::ScrollFrame.new(:scrollbarwidth=>10, :width=>300, :height=>200) + f = Tk::RbWidget::ScrollFrame.new(:scrollbarwidth=>10, + :width=>300, :height=>200) f.pack(:expand=>true, :fill=>:both) TkButton.new(f, :text=>'foo button', :command=>proc{puts 'foo'}).pack TkButton.new(f, :text=>'baaar button', :command=>proc{puts 'baaar'}).pack TkButton.new(f, :text=>'baz button', :command=>proc{puts 'baz'}).pack - TkButton.new(f, :text=>'hoge hoge button', + TkButton.new(f, :text=>'hoge hoge button', :command=>proc{puts 'hoge hoge'}).pack(:side=>:bottom) # f.hscroll(false) + # add a text widget Tk.after(3000){ t = TkText.new(f).pack(:expand=>true, :fill=>:both) - t.insert(:end, 'Here is a text widget') + t.insert(:end, "An example of Tk::RbWidget::ScrollFrame widget.\n\n") + t.insert(:end, "Here is a text widget.\n") + t.insert(:end, "Please resize the application window, ") + t.insert(:end, "and try the scrollbars ") + t.insert(:end, "to move the view of packed widgets.\n") } + # remove a vertical scrollbar, and then the scrollframe is not scrollable. Tk.after(6000){ f.vscroll(false) } + # add a vertical scrollbar, and make the scrollframe scrollable. Tk.after(9000){ f.vscroll(true) } + # remove a horizontal scrollbar, and then the scrollframe is not scrollable. Tk.after(12000){ f.hscroll(false) } + # add a horizontal scrollbar, and make the scrollframe scrollable. Tk.after(15000){ f.hscroll(true) } Tk.mainloop diff --git a/ext/tk/sample/tcltklib/sample1.rb b/ext/tk/sample/tcltklib/sample1.rb index 13df440751..1965781533 100644 --- a/ext/tk/sample/tcltklib/sample1.rb +++ b/ext/tk/sample/tcltklib/sample1.rb @@ -1,5 +1,5 @@ #! /usr/local/bin/ruby -d -#! /usr/local/bin/ruby +# -*- encoding: euc-jp -*- # -d ¥ª¥×¥·¥ç¥ó¤òÉÕ¤±¤ë¤È, ¥Ç¥Ð¥Ã¥°¾ðÊó¤òɽ¼¨¤¹¤ë. # tcltk ¥é¥¤¥Ö¥é¥ê¤Î¥µ¥ó¥×¥ë diff --git a/ext/tk/sample/tcltklib/sample2.rb b/ext/tk/sample/tcltklib/sample2.rb index 110e81ebc4..f187d6ce1d 100644 --- a/ext/tk/sample/tcltklib/sample2.rb +++ b/ext/tk/sample/tcltklib/sample2.rb @@ -23,37 +23,37 @@ $button, $canvas, $checkbutton, $frame, $label, $pack, $update, $wm = "button", "canvas", "checkbutton", "frame", "label", "pack", "update", "wm") class Othello - + EMPTY = 0 BLACK = 1 WHITE = - BLACK - + attr :in_com_turn attr :game_over - + class Board - + include Observable - + DIRECTIONS = [ [-1, -1], [-1, 0], [-1, 1], [ 0, -1], [ 0, 1], [ 1, -1], [ 1, 0], [ 1, 1] ] - + attr_accessor :com_disk - + def initialize(othello) @othello = othello reset end - + def notify_observers(*arg) if @observer_peers != nil super(*arg) end end - + def reset @data = [ [EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY], @@ -68,19 +68,19 @@ class Othello changed notify_observers end - + def man_disk return - @com_disk end - + def other_disk(disk) return - disk end - + def get_disk(row, col) return @data[row][col] end - + def reverse_to(row, col, my_disk, dir_y, dir_x) y = row x = col @@ -100,7 +100,7 @@ class Othello x -= dir_x end until y == row && x == col end - + def put_disk(row, col, disk) @data[row][col] = disk changed @@ -109,7 +109,7 @@ class Othello reverse_to(row, col, disk, *dir) end end - + def count_disk(disk) num = 0 @data.each do |rows| @@ -121,7 +121,7 @@ class Othello end return num end - + def count_point_to(row, col, my_disk, dir_y, dir_x) return 0 if @data[row][col] != EMPTY count = 0 @@ -140,7 +140,7 @@ class Othello end return 0 end - + def count_point(row, col, my_disk) count = 0 DIRECTIONS.each do |dir| @@ -148,14 +148,14 @@ class Othello end return count end - + def corner?(row, col) return (row == 0 && col == 0) || (row == 0 && col == 7) || (row == 7 && col == 0) || (row == 7 && col == 7) end - + def search(my_disk) max = 0 max_row = nil @@ -173,30 +173,30 @@ class Othello return max_row, max_col end end #--------------------------> class Board ends here - + class BoardView < TclTkWidget - + BACK_GROUND_COLOR = "DarkGreen" HILIT_BG_COLOR = "green" BORDER_COLOR = "black" BLACK_COLOR = "black" WHITE_COLOR = "white" STOP_COLOR = "red" - + attr :left attr :top attr :right attr :bottom - + class Square - + attr :oval, TRUE attr :row attr :col - + def initialize(view, row, col) @view = view - @id = @view.e("create rectangle", + @id = @view.e("create rectangle", *(view.tk_rect(view.left + col, view.top + row, view.left + col + 1, @@ -219,7 +219,7 @@ class Othello view.click_square(self) })) end - + def blink(color) @view.e("itemconfigure", @id, "-fill #{color}") $update.e() @@ -227,13 +227,13 @@ class Othello @view.e("itemconfigure", @id, "-fill #{BACK_GROUND_COLOR}") end end #-----------------------> class Square ends here - + def initialize(othello, board) super($ip, $root, $canvas) @othello = othello @board = board @board.add_observer(self) - + @squares = Array.new(8) for i in 0 .. 7 @squares[i] = Array.new(8) @@ -242,7 +242,7 @@ class Othello @top = 0.5 @right = @left + 8 @bottom = @top + 8 - + i = self.e("create rectangle", *tk_rect(@left, @top, @right, @bottom)) self.e("itemconfigure", i, "-width 1m -outline #{BORDER_COLOR} -fill #{BACK_GROUND_COLOR}") @@ -252,15 +252,15 @@ class Othello @squares[row][col] = Square.new(self, row, col) end end - + update end - + def tk_rect(left, top, right, bottom) return left.to_s + "c", top.to_s + "c", right.to_s + "c", bottom.to_s + "c" end - + def clear each_square do |square| if square.oval != nil @@ -269,7 +269,7 @@ class Othello end end end - + def draw_disk(row, col, disk) if disk == EMPTY if @squares[row][col].oval != nil @@ -278,7 +278,7 @@ class Othello end return end - + $update.e() sleep(0.05) oval = @squares[row][col].oval @@ -299,7 +299,7 @@ class Othello end self.e("itemconfigure", oval, "-outline #{color} -fill #{color}") end - + def update(row = nil, col = nil) if row && col draw_disk(row, col, @board.get_disk(row, col)) @@ -311,7 +311,7 @@ class Othello end @othello.show_point end - + def each_square @squares.each do |rows| rows.each do |square| @@ -319,7 +319,7 @@ class Othello end end end - + def click_square(square) if @othello.in_com_turn || @othello.game_over || @board.count_point(square.row, @@ -331,15 +331,15 @@ class Othello @board.put_disk(square.row, square.col, @board.man_disk) @othello.com_turn end - + private :draw_disk public :update end #----------------------> class BoardView ends here - + def initialize @msg_label = TclTkWidget.new($ip, $root, $label) $pack.e(@msg_label) - + @board = Board.new(self) @board_view = BoardView.new(self, @board) #### added by Y. Shigehiro @@ -352,39 +352,39 @@ class Othello "}") #### ¤³¤³¤Þ¤Ç $pack.e(@board_view, "-fill both -expand true") - + panel = TclTkWidget.new($ip, $root, $frame) - + @play_black = TclTkWidget.new($ip, panel, $checkbutton, "-text {com is black} -command", TclTkCallback.new($ip, proc{ switch_side })) $pack.e(@play_black, "-side left") - + quit = TclTkWidget.new($ip, panel, $button, "-text Quit -command", TclTkCallback.new($ip, proc{ exit })) $pack.e(quit, "-side right -fill x") - + reset = TclTkWidget.new($ip, panel, $button, "-text Reset -command", TclTkCallback.new($ip, proc{ reset_game })) $pack.e(reset, "-side right -fill x") - + $pack.e(panel, "-side bottom -fill x") - + # root = Tk.root $wm.e("title", $root, "Othello") $wm.e("iconname", $root, "Othello") - + @board.com_disk = WHITE @game_over = FALSE - + TclTk.mainloop end - + def switch_side if @in_com_turn @play_black.e("toggle") @@ -393,7 +393,7 @@ class Othello com_turn unless @game_over end end - + def reset_game if @board.com_disk == BLACK @board.com_disk = WHITE @@ -404,7 +404,7 @@ class Othello $wm.e("title", $root, "Othello") @game_over = FALSE end - + def com_turn @in_com_turn = TRUE $update.e() diff --git a/ext/tk/sample/tkalignbox.rb b/ext/tk/sample/tkalignbox.rb index 32915a5e69..fb1b58f458 100644 --- a/ext/tk/sample/tkalignbox.rb +++ b/ext/tk/sample/tkalignbox.rb @@ -1,19 +1,26 @@ # # tkalignbox.rb : align widgets with same width/height -# +# # by Hidetoshi NAGAI # -# The box size depends on 'reqheight' and 'reqwidth' of contained widgets. -# If you want to give the box size when those requested sizes are 0, -# please set box.propagate = false (See the test routine at the tail of +# The box size depends on 'reqheight' and 'reqwidth' of contained widgets. +# If you want to give the box size when those requested sizes are 0, +# please set box.propagate = false (See the test routine at the tail of # this file). require 'tk' -class TkAlignBox < TkFrame +module Tk + module RbWidget + class AlignBox < TkFrame + end + end +end + +class Tk::RbWidget::AlignBox < TkFrame def initialize(*args) - if self.class == TkAlignBox - fail RuntimeError, "TkAlignBox is an abstract class" + if self.class == Tk::RbWidget::AlignBox + fail RuntimeError, "Tk::AlignBox is an abstract class" end @padx = 0 @pady = 0 @@ -31,12 +38,12 @@ class TkAlignBox < TkFrame end def _set_framesize - fail RuntimeError, "TkAlignBox is an abstract class" + fail RuntimeError, "Tk::AlignBox is an abstract class" end private :_set_framesize def _place_config(widget, idx, cnt) - fail RuntimeError, "TkAlignBox is an abstract class" + fail RuntimeError, "Tk::AlignBox is an abstract class" end private :_place_config @@ -117,7 +124,7 @@ class TkAlignBox < TkFrame attr_accessor :propagate end -class TkHBox < TkAlignBox +class Tk::RbWidget::HBox < Tk::RbWidget::AlignBox def _set_framesize bd = self.borderwidth self.width((@max_width + 2*@padx) * @widgets.size + 2*bd) @@ -126,28 +133,28 @@ class TkHBox < TkAlignBox private :_set_framesize def _place_config(widget, idx, cnt) - widget.place_in(self, - 'relx'=>idx/cnt, 'x'=>@padx, - 'rely'=>0, 'y'=>@pady, - 'relwidth'=>1.0/cnt, 'width'=>-2*@padx, + widget.place_in(self, + 'relx'=>idx/cnt, 'x'=>@padx, + 'rely'=>0, 'y'=>@pady, + 'relwidth'=>1.0/cnt, 'width'=>-2*@padx, 'relheight'=>1.0, 'height'=>-2*@pady) end private :_place_config end -TkHLBox = TkHBox +Tk::RbWidget::HLBox = Tk::RbWidget::HBox -class TkHRBox < TkHBox +class Tk::RbWidget::HRBox < Tk::RbWidget::HBox def _place_config(widget, idx, cnt) - widget.place_in(self, - 'relx'=>(cnt - idx - 1)/cnt, 'x'=>@padx, - 'rely'=>0, 'y'=>@pady, - 'relwidth'=>1.0/cnt, 'width'=>-2*@padx, + widget.place_in(self, + 'relx'=>(cnt - idx - 1)/cnt, 'x'=>@padx, + 'rely'=>0, 'y'=>@pady, + 'relwidth'=>1.0/cnt, 'width'=>-2*@padx, 'relheight'=>1.0, 'height'=>-2*@pady) end private :_place_config end -class TkVBox < TkAlignBox +class Tk::RbWidget::VBox < Tk::RbWidget::AlignBox def _set_framesize bd = self.borderwidth self.width(@max_width + 2*@padx + 2*bd) @@ -156,22 +163,22 @@ class TkVBox < TkAlignBox private :_set_framesize def _place_config(widget, idx, cnt) - widget.place_in(self, - 'relx'=>0, 'x'=>@padx, - 'rely'=>idx/cnt, 'y'=>@pady, - 'relwidth'=>1.0, 'width'=>-2*@padx, + widget.place_in(self, + 'relx'=>0, 'x'=>@padx, + 'rely'=>idx/cnt, 'y'=>@pady, + 'relwidth'=>1.0, 'width'=>-2*@padx, 'relheight'=>1.0/cnt, 'height'=>-2*@pady) end private :_place_config end -TkVTBox = TkVBox +Tk::RbWidget::VTBox = Tk::RbWidget::VBox -class TkVBBox < TkVBox +class Tk::RbWidget::VBBox < Tk::RbWidget::VBox def _place_config(widget, idx, cnt) - widget.place_in(self, - 'relx'=>0, 'x'=>@padx, - 'rely'=>(cnt - idx - 1)/cnt, 'y'=>@pady, - 'relwidth'=>1.0, 'width'=>-2*@padx, + widget.place_in(self, + 'relx'=>0, 'x'=>@padx, + 'rely'=>(cnt - idx - 1)/cnt, 'y'=>@pady, + 'relwidth'=>1.0, 'width'=>-2*@padx, 'relheight'=>1.0/cnt, 'height'=>-2*@pady) end private :_place_config @@ -181,43 +188,46 @@ end # test ################################################ if __FILE__ == $0 - f = TkHBox.new(:borderwidth=>3, :relief=>'ridge').pack + f = Tk::RbWidget::HBox.new(:borderwidth=>3, :relief=>'ridge').pack f.add(TkButton.new(f, :text=>'a'), TkButton.new(f, :text=>'aa', :font=>'Helvetica 16'), TkButton.new(f, :text=>'aaa'), TkButton.new(f, :text=>'aaaa')) - f = TkHBox.new(:borderwidth=>3, :relief=>'ridge', - :padx=>7, :pady=>3, :background=>'yellow').pack + f = Tk::RbWidget::HBox.new(:borderwidth=>3, :relief=>'ridge', + :padx=>7, :pady=>3, :background=>'yellow').pack f.add(TkButton.new(f, :text=>'a'), TkButton.new(f, :text=>'aa', :font=>'Helvetica 16'), TkButton.new(f, :text=>'aaa'), TkButton.new(f, :text=>'aaaa')) - f = TkVBox.new(:borderwidth=>5, :relief=>'groove').pack + f = Tk::RbWidget::VBox.new(:borderwidth=>5, + :relief=>'groove').pack(:fill=>:y, :expand=>true) f.add(TkButton.new(f, :text=>'a'), TkButton.new(f, :text=>'aa', :font=>'Helvetica 30'), TkButton.new(f, :text=>'aaa'), TkButton.new(f, :text=>'aaaa')) - f = TkHRBox.new(:borderwidth=>3, :relief=>'raised').pack(:fill=>:x) + f = Tk::RbWidget::HRBox.new(:borderwidth=>3, + :relief=>'raised').pack(:fill=>:x) f.add(TkButton.new(f, :text=>'a'), - TkButton.new(f, :text=>'aa'), + TkButton.new(f, :text=>'aa'), TkButton.new(f, :text=>'aaa')) - f = TkVBBox.new(:borderwidth=>3, :relief=>'ridge').pack(:fill=>:x) + f = Tk::RbWidget::VBBox.new(:borderwidth=>3, + :relief=>'ridge').pack(:fill=>:x) f.propagate = false f.height 100 - f.add(TkFrame.new(f){|ff| - TkButton.new(ff, :text=>'a').pack(:pady=>4, :padx=>6, + f.add(TkFrame.new(f){|ff| + TkButton.new(ff, :text=>'a').pack(:pady=>4, :padx=>6, :fill=>:both, :expand=>true) - }, - TkFrame.new(f){|ff| - TkButton.new(ff, :text=>'aa').pack(:pady=>4, :padx=>6, + }, + TkFrame.new(f){|ff| + TkButton.new(ff, :text=>'aa').pack(:pady=>4, :padx=>6, :fill=>:both, :expand=>true) - }, - TkFrame.new(f){|ff| - TkButton.new(ff, :text=>'aaaa').pack(:pady=>4, :padx=>6, + }, + TkFrame.new(f){|ff| + TkButton.new(ff, :text=>'aaaa').pack(:pady=>4, :padx=>6, :fill=>:both, :expand=>true) }) diff --git a/ext/tk/sample/tkballoonhelp.rb b/ext/tk/sample/tkballoonhelp.rb index c2c95f771d..a9bd371db6 100644 --- a/ext/tk/sample/tkballoonhelp.rb +++ b/ext/tk/sample/tkballoonhelp.rb @@ -2,16 +2,26 @@ # tkballoonhelp.rb : simple balloon help widget # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -# Add a balloon help to a widget. -# This widget has only poor featureas. If you need more useful features, +# Add a balloon help to a widget. +# This widget has only poor featureas. If you need more useful features, # please try to use the Tix extension of Tcl/Tk under Ruby/Tk. -# +# # The interval time to display a balloon help is defined 'interval' option -# (default is 1000ms). +# (default is 750ms). # require 'tk' -class TkBalloonHelp'bisque').pack + # @label = TkLabel.new(@frame, 'background'=>'bisque').pack + @label = TkLabel.new(@frame, + 'foreground'=>DEFAULT_FOREGROUND, + 'background'=>DEFAULT_BACKGROUND).pack @label.configure(_symbolkey2str(keys)) unless keys.empty? @path = @label end @@ -87,10 +100,10 @@ class TkBalloonHelp'This button has a balloon help') {|b| pack('fill'=>'x') - TkBalloonHelp.new(b, 'text'=>' Message ') + Tk::RbWidget::BalloonHelp.new(b, 'text'=>' Message ') } TkButton.new('text'=>'This button has another balloon help') {|b| pack('fill'=>'x') - TkBalloonHelp.new(b, 'text'=>'configured message', - 'interval'=>200, 'font'=>'courier', - 'background'=>'gray', 'foreground'=>'red') + Tk::RbWidget::BalloonHelp.new(b, + 'text'=>"CONFIGURED MESSAGE\nchange colors, and so on", + 'interval'=>200, 'font'=>'courier', + 'background'=>'gray', 'foreground'=>'red') } sb = TkScrollbox.new.pack(:fill=>:x) sb.insert(:end, *%w(aaa bbb ccc ddd eee fff ggg hhh iii jjj kkk lll mmm)) =begin # CASE1 : command takes no arguemnt - bh = TkBalloonHelp.new(sb, :interval=>500, - :relief=>:ridge, :background=>'white', - :command=>proc{ - y = TkWinfo.pointery(sb) - TkWinfo.rooty(sb) - bh.text "current index == #{sb.nearest(y)}" - }) + bh = Tk::RbWidget::BalloonHelp.new(sb, :interval=>500, + :relief=>:ridge, :background=>'white', + :command=>proc{ + y = TkWinfo.pointery(sb) - TkWinfo.rooty(sb) + bh.text "current index == #{sb.nearest(y)}" + }) =end =begin # CASE2 : command takes 2 arguemnts - bh = TkBalloonHelp.new(sb, :interval=>500, - :relief=>:ridge, :background=>'white', - :command=>proc{|x, y| - bh.text "current index == #{sb.nearest(y)}" - }) + bh = Tk::RbWidget::BalloonHelp.new(sb, :interval=>500, + :relief=>:ridge, :background=>'white', + :command=>proc{|x, y| + bh.text "current index == #{sb.nearest(y)}" + }) =end =begin # CASE3 : command takes 3 arguemnts - TkBalloonHelp.new(sb, :interval=>500, - :relief=>:ridge, :background=>'white', - :command=>proc{|x, y, bhelp| - bhelp.text "current index == #{sb.nearest(y)}" - }) + Tk::RbWidget::BalloonHelp.new(sb, :interval=>500, + :relief=>:ridge, :background=>'white', + :command=>proc{|x, y, bhelp| + bhelp.text "current index == #{sb.nearest(y)}" + }) =end =begin # CASE4a : command is a Proc object and takes 4 arguemnts @@ -160,16 +174,16 @@ if __FILE__ == $0 bhelp.text "current index == #{parent.nearest(y)}" } - TkBalloonHelp.new(sb, :interval=>500, - :relief=>:ridge, :background=>'white', - :command=>cmd) + Tk::RbWidget::BalloonHelp.new(sb, :interval=>500, + :relief=>:ridge, :background=>'white', + :command=>cmd) sb2 = TkScrollbox.new.pack(:fill=>:x) sb2.insert(:end, *%w(AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM)) - TkBalloonHelp.new(sb2, :interval=>500, - :padx=>5, :relief=>:raised, - :background=>'gray25', :foreground=>'white', - :command=>cmd) + Tk::RbWidget::BalloonHelp.new(sb2, :interval=>500, + :padx=>5, :relief=>:raised, + :background=>'gray25', :foreground=>'white', + :command=>cmd) =end #=begin # CASE4b : command is a Method object and takes 4 arguemnts @@ -178,16 +192,16 @@ if __FILE__ == $0 end cmd = self.method(:set_msg) - TkBalloonHelp.new(sb, :interval=>500, - :relief=>:ridge, :background=>'white', - :command=>cmd) + Tk::RbWidget::BalloonHelp.new(sb, :interval=>500, + :relief=>:ridge, :background=>'white', + :command=>cmd) sb2 = TkScrollbox.new.pack(:fill=>:x) sb2.insert(:end, *%w(AAA BBB CCC DDD EEE FFF GGG HHH III JJJ KKK LLL MMM)) - TkBalloonHelp.new(sb2, :interval=>500, - :padx=>5, :relief=>:raised, - :background=>'gray25', :foreground=>'white', - :command=>cmd) + Tk::RbWidget::BalloonHelp.new(sb2, :interval=>500, + :padx=>5, :relief=>:raised, + :background=>'gray25', :foreground=>'white', + :command=>cmd) #=end Tk.mainloop diff --git a/ext/tk/sample/tkbiff.rb b/ext/tk/sample/tkbiff.rb index c6699629cc..c0953a1b1b 100644 --- a/ext/tk/sample/tkbiff.rb +++ b/ext/tk/sample/tkbiff.rb @@ -11,10 +11,10 @@ end if ARGV.length == 0 if ENV['MAIL'] $spool = ENV['MAIL'] - else + else $spool = '/var/spool/mail/' + ENV['USER'] end -else +else $spool = ARGV[0] end @@ -40,7 +40,7 @@ class Mail @body = [] while line = f.gets() line.chop! - next if /^From / =~ line # skip From-line + next if /^From / =~ line # skip From-line break if /^$/ =~ line # end of header if /^(\S+):\s*(.*)/ =~ line @header[attr = $1.capitalize] = $2 diff --git a/ext/tk/sample/tkbrowse.rb b/ext/tk/sample/tkbrowse.rb index 4893f57f95..56d5a80fcf 100644 --- a/ext/tk/sample/tkbrowse.rb +++ b/ext/tk/sample/tkbrowse.rb @@ -69,7 +69,7 @@ end # Fill the listbox with a list of all the files in the directory (run # the "ls" command to get that information). -if ARGV.length>0 +if ARGV.length>0 dir = ARGV[0] else dir="." diff --git a/ext/tk/sample/tkcombobox.rb b/ext/tk/sample/tkcombobox.rb index cc51a2ffeb..59db565f06 100644 --- a/ext/tk/sample/tkcombobox.rb +++ b/ext/tk/sample/tkcombobox.rb @@ -1,11 +1,20 @@ # -# tkcombobox.rb : TkAutoScrollbox & TkCombobox -# +# tkcombobox.rb : auto scrollbox & combobox +# # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # require 'tk' -class TkAutoScrollbox < TkListbox +module Tk + module RbWidget + class AutoScrollListbox < TkListbox + end + class Combobox < TkEntry + end + end +end + +class Tk::RbWidget::AutoScrollListbox include TkComposite @@up_bmp = TkBitmapImage.new(:data=><@@up_bmp, + @up_arrow = TkLabel.new(@lbox, :image=>@@up_bmp, :relief=>:raised, :borderwidth=>1) - @down_arrow = TkLabel.new(@lbox, :image=>@@down_bmp, + @down_arrow = TkLabel.new(@lbox, :image=>@@down_bmp, :relief=>:raised, :borderwidth=>1) _init_binding @@ -78,7 +87,7 @@ EOD def _show_down_arrow unless @down_arrow.winfo_mapped? - @down_arrow.pack(:side=>:bottom, :fill=>:x) + @down_arrow.pack(:side=>:bottom, :fill=>:x) end end @@ -91,11 +100,11 @@ EOD def _check_sel(cidx, tidx = nil, bidx = nil) _set_sel(cidx) unless tidx - tidx = @lbox.nearest(0) + tidx = @lbox.nearest(0) tidx += 1 if tidx > 0 end unless bidx - bidx = @lbox.nearest(10000) + bidx = @lbox.nearest(10000) bidx -= 1 if bidx < @lbox.index('end') - 1 end if cidx > bidx @@ -197,7 +206,7 @@ EOD @lbox.bind('Configure', proc{_config_proc}) @lbox.bind('Enter', proc{|y| _set_sel(@lbox.nearest(y))}, '%y') - @lbox.bind('Motion', proc{|y| + @lbox.bind('Motion', proc{|y| @up_timer.stop if @up_timer.running? @down_timer.stop if @down_timer.running? _check_sel(@lbox.nearest(y)) @@ -221,17 +230,7 @@ end ################################################ -# don't use Ttk widget -Object.instance_eval{remove_const :TkCombobox} if Object.autoload? :TkCombobox - -# if you want to use the 'default_widget_set' selector, -#class TkCombobox < TkEntry; end -#Tk.__set_toplevel_aliases__(:Tk, TkCombobox, :TkCombobox) - - -################################################ - -class TkCombobox < TkEntry +class Tk::RbWidget::Combobox < TkEntry include TkComposite @@down_btn_bmp = TkBitmapImage.new(:data=><= 0 - @ent.value = @lst.get(idx) + @wait_var.tkwait + if (idx = @wait_var.to_i) >= 0 + # @ent.value = @lst.get(idx) + _set_entry_value(@lst.get(idx)) end @top.withdraw @btn.relief(:raised) @@ -297,19 +298,66 @@ EOD @btn.bind('1', proc{_button_proc(true)}) @btn.bind('3', proc{_button_proc(false)}) - @lst.bind('1', proc{|y| @var.value = @lst.nearest(y)}, '%y') - @lst.bind('Return', proc{@var.value = @lst.curselection[0]}) + @lst.bind('1', proc{|y| @wait_var.value = @lst.nearest(y)}, '%y') + @lst.bind('Return', proc{@wait_var.value = @lst.curselection[0]}) cancel = TkVirtualEvent.new('2', '3', 'Escape') - @lst.bind(cancel, proc{@var.value = -1}) + @lst.bind(cancel, proc{@wait_var.value = -1}) end private :_init_bindings + def _set_entry_value(val) + @ent.textvariable.value = val + end + private :_set_entry_value + + #---------------------------------------------------- + + def _state_control(value = None) + if value == None + # get + @ent.state + else + # set + @ent.state(value.to_s) + case value = @ent.state # regulate 'state' string + when 'normal', 'readonly' + @btn.state 'normal' + when 'disabled' + @btn.state 'disabled' + else + # unknown : do nothing + end + end + end + private :_state_control + + def __methodcall_optkeys # { key=>method, ... } + {'state' => :_state_control} + end + private :__methodcall_optkeys + + #---------------------------------------------------- + + def _textvariable_control(var = None) + if var == None + # get + ((var = @ent.textvariable) === @default_var)? nil: var + else + # set + @var = var + tk_send('configure', '-textvariable', (@var)? var: @default_var) + end + end + private :_textvariable_control + + #---------------------------------------------------- + def initialize_composite(keys={}) keys = _symbolkey2str(keys) - @btn = TkLabel.new(@frame, :relief=>:raised, :borderwidth=>3, - :image=>@@down_btn_bmp).pack(:side=>:right, + @btn = TkLabel.new(@frame, :relief=>:raised, :borderwidth=>2, + :image=>@@down_btn_bmp).pack(:side=>:right, :ipadx=>2, :fill=>:y) @ent = TkEntry.new(@frame).pack(:side=>:left) @path = @ent.path @@ -322,16 +370,21 @@ EOD startwait = keys.delete('startwait'){300} interval = keys.delete('interval'){150} - @lst = TkAutoScrollbox.new(@top, - :startwait=>startwait, - :interval=>interval).pack(:fill=>:both, - :expand=>true) + @lst = Tk::RbWidget::AutoScrollListbox.new(@top, :scrollbar=>true, + :startwait=>startwait, + :interval=>interval) + @lst.pack(:fill=>:both, :expand=>true) @ent_list = [] - @var = TkVariable.new + @wait_var = TkVariable.new + @var = @default_var = TkVariable.new + + @ent.textvariable @default_var _init_bindings + option_methods('textvariable' => :_textvariable_control) + delegate('DEFAULT', @ent) delegate('height', @lst) delegate('relief', @frame) @@ -340,6 +393,8 @@ EOD delegate('arrowrelief', @lst) delegate('arrowborderwidth', @lst) + delegate('state', false) + if mode = keys.delete('scrollbar') scrollbar(mode) end @@ -405,10 +460,14 @@ end # test ################################################ if __FILE__ == $0 +# e0 = Tk::RbWidget::Combobox.new.pack +# e0.values(%w(aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu)) + v = TkVariable.new - e = TkCombobox.new(:height=>7, :scrollbar=>true, :textvariable=>v, - :arrowrelief=>:flat, :arrowborderwidth=>0, - :startwait=>400, :interval=>200).pack + e = Tk::RbWidget::Combobox.new(:height=>7, :scrollbar=>true, + :textvariable=>v, + :arrowrelief=>:flat, :arrowborderwidth=>0, + :startwait=>400, :interval=>200).pack e.values(%w(aa bb cc dd ee ff gg hh ii jj kk ll mm nn oo pp qq rr ss tt uu)) #e.see(e.list_index('end') - 2) e.value = 'cc' @@ -418,17 +477,19 @@ if __FILE__ == $0 TkLabel.new(f, :font=>fnt, :textvariable=>v).pack(:side=>:left) }.pack - TkFrame.new(:relief=>:raised, :borderwidth=>2, + TkFrame.new(:relief=>:raised, :borderwidth=>2, :height=>3).pack(:fill=>:x, :expand=>true, :padx=>5, :pady=>3) - l = TkAutoScrollbox.new(nil, :relief=>:groove, :borderwidth=>4, - :width=>20).pack(:fill=>:both, :expand=>true) + l = Tk::RbWidget::AutoScrollListbox.new(nil, :relief=>:groove, + :borderwidth=>4,:height=>7, + :width=>20).pack(:fill=>:both, + :expand=>true) (0..20).each{|i| l.insert('end', "line #{i}")} TkFrame.new(:relief=>:ridge, :borderwidth=>3){ - TkButton.new(self, :text=>'ON', + TkButton.new(self, :text=>'ON', :command=>proc{l.scrollbar(true)}).pack(:side=>:left) - TkButton.new(self, :text=>'OFF', + TkButton.new(self, :text=>'OFF', :command=>proc{l.scrollbar(false)}).pack(:side=>:right) pack(:fill=>:x) } diff --git a/ext/tk/sample/tkdialog.rb b/ext/tk/sample/tkdialog.rb index 00cc12ab11..eb8cd04796 100644 --- a/ext/tk/sample/tkdialog.rb +++ b/ext/tk/sample/tkdialog.rb @@ -8,7 +8,7 @@ top = TkFrame.new(root) { } msg = TkMessage.new(top) { text "File main.c hasn't been saved to disk since \ -it was last modified. What should I do?" +it was last modified. What should I do?" justify 'center' aspect 200 font '-Adobe-helvetica-medium-r-normal--*-240*' diff --git a/ext/tk/sample/tkextlib/ICONS/viewIcons.rb b/ext/tk/sample/tkextlib/ICONS/viewIcons.rb index fc88eb5c85..02ba19a629 100644 --- a/ext/tk/sample/tkextlib/ICONS/viewIcons.rb +++ b/ext/tk/sample/tkextlib/ICONS/viewIcons.rb @@ -4,7 +4,7 @@ # # -- Display icons from icon library. # -# -- Copy the clicked icon data (command string of creating +# -- Copy the clicked icon data (command string of creating # a TkPhotoImage instance) to the clipboard. # require 'tk' @@ -27,7 +27,7 @@ class ViewIcons ent_library = TkEntry.new(base, :width=>50, :textvariable=>@library) ent_groups = TkEntry.new(base, :width=>50, :textvariable=>@groups) - btn_browse = TkButton.new(base, :text=>'Browse', + btn_browse = TkButton.new(base, :text=>'Browse', :command=>method(:select_icons)) btn_view = TkButton.new(base, :text=>'View', :command=>method(:display_icons)) @@ -35,8 +35,8 @@ class ViewIcons @column_btns = {} 6.step(20, 2){|i| - @column_btns[i] = TkButton.new(columns, - :text=>i.to_s, :width=>2, + @column_btns[i] = TkButton.new(columns, + :text=>i.to_s, :width=>2, :command=>proc{set_columns(i)} ).pack(:side=>:left) } @@ -90,15 +90,15 @@ class ViewIcons end def _create_info_window - @info_window = TkToplevel.new(:background=>'lightyellow', :borderwidth=>1, + @info_window = TkToplevel.new(:background=>'lightyellow', :borderwidth=>1, :relief=>:solid){|w| - lbl_name = TkLabel.new(w, :text=>'Name', :background=>'lightyellow', + lbl_name = TkLabel.new(w, :text=>'Name', :background=>'lightyellow', :font=>@boldfont, :justify=>:left) - lbl_grps = TkLabel.new(w, :text=>'Groups', :background=>'lightyellow', + lbl_grps = TkLabel.new(w, :text=>'Groups', :background=>'lightyellow', :font=>@boldfont, :justify=>:left) - lbl_type = TkLabel.new(w, :text=>'Type', :background=>'lightyellow', + lbl_type = TkLabel.new(w, :text=>'Type', :background=>'lightyellow', :font=>@boldfont, :justify=>:left) - lbl_size = TkLabel.new(w, :text=>'Size', :background=>'lightyellow', + lbl_size = TkLabel.new(w, :text=>'Size', :background=>'lightyellow', :font=>@boldfont, :justify=>:left) lbl_name.grid(:row=>0, :column=>0, :sticky=>:w) @@ -192,7 +192,7 @@ class ViewIcons def cancel_info if @delay_timer - @delay_timer.cancel + @delay_timer.cancel @delay_timer = nil end @info_window.withdraw @@ -242,9 +242,9 @@ class ViewIcons TkClipboard.append(@command) if Tk::PLATFORM['platform'] == 'unix' - TkSelection.handle(Tk.root, method(:primary_transfer), + TkSelection.handle(Tk.root, method(:primary_transfer), :selection=>'PRIMARY') - TkSelection.set_owner(Tk.root, :selection=>'PRIMARY', + TkSelection.set_owner(Tk.root, :selection=>'PRIMARY', :command=>method(:lost_selection)) end @@ -256,17 +256,17 @@ class ViewIcons bbox = @icons_window.bbox('all') width = @controls.winfo_width - @icons_window.yscrollbar.winfo_width - 8 - @icons_window.configure(:width=>width, :scrollregion=>bbox, - :xscrollincrement=>'0.1i', + @icons_window.configure(:width=>width, :scrollregion=>bbox, + :xscrollincrement=>'0.1i', :yscrollincrement=>'0.1i') end def select_icons - new_lib = Tk.getOpenFile(:initialdir=>@initial_dir, - :initialfile=>'tkIcons', - :title=>'Select Icon Library', + new_lib = Tk.getOpenFile(:initialdir=>@initial_dir, + :initialfile=>'tkIcons', + :title=>'Select Icon Library', :filetypes=>[ - ['Icon Libraries', ['tkIcons*']], + ['Icon Libraries', ['tkIcons*']], ['All Files', ['*']] ]) @@ -280,7 +280,7 @@ class ViewIcons row = 0 unless File.exist?(@library.value) - Tk.messageBox(:icon=>'warning', :message=>'File does not exist', + Tk.messageBox(:icon=>'warning', :message=>'File does not exist', :title=>'viewIcons') return end diff --git a/ext/tk/sample/tkextlib/blt/barchart5.rb b/ext/tk/sample/tkextlib/blt/barchart5.rb index db181d10ca..86101b200d 100644 --- a/ext/tk/sample/tkextlib/blt/barchart5.rb +++ b/ext/tk/sample/tkextlib/blt/barchart5.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/blt' -load File.join(File.dirname(File.expand_path(__FILE__)), +load File.join(File.dirname(File.expand_path(__FILE__)), 'scripts', 'stipples.rb') TkOption.add('*graph.x.Title', 'X Axis Label') @@ -23,27 +23,27 @@ if visual != 'staticgray' && visual != 'grayscale' end htext = Tk::BLT::Htext.new(:widgetname=>'.htext', :text=><'print', :text=>'Print', + b = TkButton.new(Tk::BLT::Htext::Htext_Widget.window, + :widgetname=>'print', :text=>'Print', :command=>proc{ $graph.postsript(:output=>'bar.ps') }) Tk::BLT::Htext::Htext_Widget.window.append(b) } -%% button. +%% button. %% ruby { - $graph = Tk::BLT::Barchart.new(:widgetname=>'.htext.graph', + $graph = Tk::BLT::Barchart.new(:widgetname=>'.htext.graph', :relief=>:raised, :borderwidth=>2) $graph.xaxis_configure(:rotate=>90, :stepsize=>0) - Tk::BLT::Htext::Htext_Widget.window.append($graph, + Tk::BLT::Htext::Htext_Widget.window.append($graph, :fill=>:both, :padx=>4) } @@ -51,8 +51,8 @@ htext = Tk::BLT::Htext.new(:widgetname=>'.htext', :text=><'quit', :text=>'Quit', + b = TkButton.new(Tk::BLT::Htext::Htext_Widget.window, + :widgetname=>'quit', :text=>'Quit', :command=>proc{ exit }) Tk::BLT::Htext::Htext_Widget.window.append(b) } @@ -86,7 +86,7 @@ x.seq(-5.0, 5.0, 0.2) y.expr("sin(#{x})") barWidth = 0.19 -$graph.element_create('sin', :relief=>:raised, :borderwidth=>1, +$graph.element_create('sin', :relief=>:raised, :borderwidth=>1, :x=>x, :y=>y, :barwidth=>barWidth) Tk::BLT::Table.add(Tk.root, htext, :fill=>:both) diff --git a/ext/tk/sample/tkextlib/blt/calendar.rb b/ext/tk/sample/tkextlib/blt/calendar.rb index 4fc6d64d9e..86d34043dc 100644 --- a/ext/tk/sample/tkextlib/blt/calendar.rb +++ b/ext/tk/sample/tkextlib/blt/calendar.rb @@ -31,17 +31,17 @@ TkOption.add('*tile', texture2) class BLT_Calendar_sample @@monthInfo = [ nil, # dummy - ['January', 31], - ['February', 28], - ['March', 31], - ['April', 30], - ['May', 31], - ['June', 30], - ['July', 31], - ['August', 31], - ['Septembar', 30], - ['October', 31], - ['November', 30], + ['January', 31], + ['February', 28], + ['March', 31], + ['April', 30], + ['May', 31], + ['June', 30], + ['July', 31], + ['August', 31], + ['Septembar', 30], + ['October', 31], + ['November', 30], ['December', 31] ] @@ -53,23 +53,23 @@ class BLT_Calendar_sample if TkComm.bool(Tk.info(:commands, '.calendar')) Tk.destroy('.calendar') end - cal = Tk::BLT::Tile::Frame.new(:widgetname=>'.calendar', - :classname=>'Calendar', + cal = Tk::BLT::Tile::Frame.new(:widgetname=>'.calendar', + :classname=>'Calendar', :width=>'3i', :height=>'3i') - mon = Tk::BLT::Tile::Label.new(cal, :font=>'Courier 14 bold', - :text=>"#{@@monthInfo[today.month][0]} " + + mon = Tk::BLT::Tile::Label.new(cal, :font=>'Courier 14 bold', + :text=>"#{@@monthInfo[today.month][0]} " + "#{today.year}") Tk::BLT::Table.add(cal, mon, [1, 0], :cspan=>7, :pady=>10) - week_f = Tk::BLT::Tile::Frame.new(cal, :widgetname=>'weekframe', + week_f = Tk::BLT::Tile::Frame.new(cal, :widgetname=>'weekframe', :relief=>:sunken, :borderwidth=>1) Tk::BLT::Table.add(cal, week_f, [2, 0], :columnspan=>7, :fill=>:both) @@abbrDays.each_with_index{|dayName, idx| - Tk::BLT::Table.add(cal, - Tk::BLT::Tile::Label.new(cal, :text=>dayName, - :font=>'Helvetica 12'), + Tk::BLT::Table.add(cal, + Tk::BLT::Tile::Label.new(cal, :text=>dayName, + :font=>'Helvetica 12'), [2, idx], :pady=>2, :padx=>2) } @@ -83,11 +83,11 @@ class BLT_Calendar_sample wkday += 7 if wkday < 0 while cnt <= numDays - Tk::BLT::Table.add(cal, + Tk::BLT::Table.add(cal, Tk::BLT::Tile::Label.new(cal, :text=>cnt){ - self.configure(:borderwidth=>1, + self.configure(:borderwidth=>1, :relief=>:sunken) if cnt == today.day - }, + }, [week+3, wkday], :fill=>:both, :ipadx=>10, :ipady=>4) cnt += 1 wkday += 1 @@ -98,11 +98,11 @@ class BLT_Calendar_sample end Tk::BLT::Tile::Frame.new(cal, :borderwidth=>1, :relief=>:sunken){|f| - Tk::BLT::Table.add(f, - Tk::BLT::Tile::Button.new(f, :widgetname=>'button', - :command=>proc{exit}, - :borderwidth=>2, - :text=>'Quit'), + Tk::BLT::Table.add(f, + Tk::BLT::Tile::Button.new(f, :widgetname=>'button', + :command=>proc{exit}, + :borderwidth=>2, + :text=>'Quit'), :padx=>4, :pady=>4) Tk::BLT::Table.add(cal, f, [week+4, 5], :cspan=>2, :pady=>4) } diff --git a/ext/tk/sample/tkextlib/blt/graph6.rb b/ext/tk/sample/tkextlib/blt/graph6.rb index f899b44115..b3eeb81231 100644 --- a/ext/tk/sample/tkextlib/blt/graph6.rb +++ b/ext/tk/sample/tkextlib/blt/graph6.rb @@ -6,55 +6,55 @@ require 'tkextlib/blt' Tk::TCL_PRECISION.value = 15 [ - ['*Graph.Width', '10i'], - ['*Graph.leftMargin', '.75i'], - ['*Graph.Height', '6i'], - ['*Graph.plotBackground', 'black'], - ['*LineMarker.color', 'white'], - ['*LineMarker.Dashes', 5], - ['*TextMarker.foreground', 'white'], - ['*TextMarker.Background', ''], + ['*Graph.Width', '10i'], + ['*Graph.leftMargin', '.75i'], + ['*Graph.Height', '6i'], + ['*Graph.plotBackground', 'black'], + ['*LineMarker.color', 'white'], + ['*LineMarker.Dashes', 5], + ['*TextMarker.foreground', 'white'], + ['*TextMarker.Background', ''], - ['*Graph.x.hide', true], - ['*Graph.x.title', ''], - ['*Graph.y.rotate', 90], - # ['*Graph.y.stepSize', 2.0], - ['*Graph.title', ''], - ['*graph.Title', 'Example s27'], - ['*graph.x.hide', false], - ['*graph.topMargin', 0], - ['*graph.bottomMargin', 0], - ['*x.Title', 'Time'], - ['*y.Title', 'Signals'], - ['*Pixels', 1], + ['*Graph.x.hide', true], + ['*Graph.x.title', ''], + ['*Graph.y.rotate', 90], + # ['*Graph.y.stepSize', 2.0], + ['*Graph.title', ''], + ['*graph.Title', 'Example s27'], + ['*graph.x.hide', false], + ['*graph.topMargin', 0], + ['*graph.bottomMargin', 0], + ['*x.Title', 'Time'], + ['*y.Title', 'Signals'], + ['*Pixels', 1], - ['*Reduce', 0.5], - ['*bufferElements', false], + ['*Reduce', 0.5], + ['*bufferElements', false], - ['*Element.color', 'green4'], - ['*Element.ScaleSymbols', true], - ['*Element.Color', 'grey70'], - ['*Element.Symbol', :none], - ['*Element.LineWidth', 1], - # ['*Element.Smooth', :natural], - ['*Element.Smooth', :catrom], + ['*Element.color', 'green4'], + ['*Element.ScaleSymbols', true], + ['*Element.Color', 'grey70'], + ['*Element.Symbol', :none], + ['*Element.LineWidth', 1], + # ['*Element.Smooth', :natural], + ['*Element.Smooth', :catrom], - ['*activeLine.LineWidth', 2], - ['*activeLine.Color', 'white'], - ['*activeLine.Color', 'green1'], + ['*activeLine.LineWidth', 2], + ['*activeLine.Color', 'white'], + ['*activeLine.Color', 'green1'], - # ['*Legend.Hide', true], - ['*Legend.Position', :right], - ['*Legend.Relief', :flat], - ['*Legend.activeRelief', :sunken], - ['*Legend.borderWidth', 2], - #['*Legend.Font', '-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*'], - ['*Legend.Font', 'Helvetica -10'], - ['*Grid.hide', false], - ['*Grid.dashes', [1, 5]], + # ['*Legend.Hide', true], + ['*Legend.Position', :right], + ['*Legend.Relief', :flat], + ['*Legend.activeRelief', :sunken], + ['*Legend.borderWidth', 2], + #['*Legend.Font', '-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*'], + ['*Legend.Font', 'Helvetica -10'], + ['*Grid.hide', false], + ['*Grid.dashes', [1, 5]], - # ['*foreground', 'white'], - ['*zoomOutline.outline', 'yellow'], + # ['*foreground', 'white'], + ['*zoomOutline.outline', 'yellow'], ].each{|k, v| TkOption.add(k, v)} ############################## @@ -71,7 +71,7 @@ class BLT_Graph_Demo @top = Tk::BLT::Tile::Toplevel.new =begin - legend = Tk::BLT::Graph.new(@top, :widgetname=>'legend', + legend = Tk::BLT::Graph.new(@top, :widgetname=>'legend', :without_creating=>true) @graph.legend_configure(:position=>legend) =end @@ -81,7 +81,7 @@ class BLT_Graph_Demo Tk::BLT::Table.add(@root, @graph, [0,0], :fill=>:both) - @quit_btn = Tk::BLT::Tile::Button.new(:text=>' quit ', :background=>'red', + @quit_btn = Tk::BLT::Tile::Button.new(:text=>' quit ', :background=>'red', :command=>proc{exit}) Tk::BLT::Table.add(@root, @quit_btn, [1,0], :anchor=>:e, :padx=>10) @@ -90,9 +90,9 @@ class BLT_Graph_Demo @graph.closest_point @graph.print_key - @graph.legend_bind(:all, 'ButtonRelease-1', + @graph.legend_bind(:all, 'ButtonRelease-1', proc{|w| highlightTrace(w)}, '%W') - @graph.legend_bind(:all, 'ButtonRelease-3', + @graph.legend_bind(:all, 'ButtonRelease-3', proc{|w| w.legend_deactivate('*') active = w.element_activate @@ -108,2098 +108,2098 @@ class BLT_Graph_Demo (1..39).each{|i| @v[i] = Tk::BLT::Vector.new(:variable=>'')} @x.set(<<-'EOD') - 0 1e-10 2e-10 3e-10 4e-10 5e-10 6e-10 7e-10 8e-10 9e-10 - 1e-09 1.1e-09 1.2e-09 1.3e-09 1.4e-09 1.5e-09 1.6e-09 1.7e-09 - 1.8e-09 1.9e-09 2e-09 2.1e-09 2.2e-09 2.3e-09 2.4e-09 2.5e-09 - 2.6e-09 2.7e-09 2.8e-09 2.9e-09 3e-09 3.1e-09 3.2e-09 3.3e-09 - 3.4e-09 3.5e-09 3.6e-09 3.7e-09 3.8e-09 3.9e-09 4e-09 4.1e-09 - 4.2e-09 4.3e-09 4.4e-09 4.5e-09 4.6e-09 4.7e-09 4.8e-09 - 4.9e-09 5e-09 5.1e-09 5.2e-09 5.3e-09 5.4e-09 5.5e-09 5.6e-09 - 5.7e-09 5.8e-09 5.9e-09 6e-09 6.1e-09 6.2e-09 6.3e-09 6.4e-09 - 6.5e-09 6.6e-09 6.7e-09 6.8e-09 6.9e-09 7e-09 7.1e-09 7.2e-09 - 7.3e-09 7.4e-09 7.5e-09 7.6e-09 7.7e-09 7.8e-09 7.9e-09 - 8e-09 8.1e-09 8.2e-09 8.3e-09 8.4e-09 8.5e-09 8.6e-09 8.7e-09 - 8.8e-09 8.9e-09 9e-09 9.1e-09 9.2e-09 9.3e-09 9.4e-09 9.5e-09 - 9.6e-09 9.7e-09 9.8e-09 9.9e-09 1e-08 1.01e-08 1.02e-08 - 1.03e-08 1.04e-08 1.05e-08 1.06e-08 1.07e-08 1.08e-08 1.09e-08 - 1.1e-08 1.11e-08 1.12e-08 1.13e-08 1.14e-08 1.15e-08 1.16e-08 - 1.17e-08 1.18e-08 1.19e-08 1.2e-08 1.21e-08 1.22e-08 1.23e-08 - 1.24e-08 1.25e-08 1.26e-08 1.27e-08 1.28e-08 1.29e-08 1.3e-08 - 1.31e-08 1.32e-08 1.33e-08 1.34e-08 1.35e-08 1.36e-08 1.37e-08 - 1.38e-08 1.39e-08 1.4e-08 1.41e-08 1.42e-08 1.43e-08 1.44e-08 - 1.45e-08 1.46e-08 1.47e-08 1.48e-08 1.49e-08 1.5e-08 1.51e-08 - 1.52e-08 1.53e-08 1.54e-08 1.55e-08 1.56e-08 1.57e-08 1.58e-08 - 1.59e-08 1.6e-08 1.61e-08 1.62e-08 1.63e-08 1.64e-08 1.65e-08 - 1.66e-08 1.67e-08 1.68e-08 1.69e-08 1.7e-08 1.71e-08 1.72e-08 - 1.73e-08 1.74e-08 1.75e-08 1.76e-08 1.77e-08 1.78e-08 1.79e-08 - 1.8e-08 1.81e-08 1.82e-08 1.83e-08 1.84e-08 1.85e-08 1.86e-08 - 1.87e-08 1.88e-08 1.89e-08 1.9e-08 1.91e-08 1.92e-08 1.93e-08 - 1.94e-08 1.95e-08 1.96e-08 1.97e-08 1.98e-08 1.99e-08 2e-08 - 2.01e-08 2.02e-08 2.03e-08 2.04e-08 2.05e-08 2.06e-08 2.07e-08 - 2.08e-08 2.09e-08 2.1e-08 2.11e-08 2.12e-08 2.13e-08 2.14e-08 - 2.15e-08 2.16e-08 2.17e-08 2.18e-08 2.19e-08 2.2e-08 2.21e-08 - 2.22e-08 2.23e-08 2.24e-08 2.25e-08 2.26e-08 2.27e-08 2.28e-08 - 2.29e-08 2.3e-08 2.31e-08 2.32e-08 2.33e-08 2.34e-08 2.35e-08 - 2.36e-08 2.37e-08 2.38e-08 2.39e-08 2.4e-08 2.41e-08 2.42e-08 - 2.43e-08 2.44e-08 2.45e-08 2.46e-08 2.47e-08 2.48e-08 2.49e-08 - 2.5e-08 2.51e-08 2.52e-08 2.53e-08 2.54e-08 2.55e-08 2.56e-08 - 2.57e-08 2.58e-08 2.59e-08 2.6e-08 2.61e-08 2.62e-08 2.63e-08 - 2.64e-08 2.65e-08 2.66e-08 2.67e-08 2.68e-08 2.69e-08 2.7e-08 - 2.71e-08 2.72e-08 2.73e-08 2.74e-08 2.75e-08 2.76e-08 2.77e-08 - 2.78e-08 2.79e-08 2.8e-08 2.81e-08 2.82e-08 2.83e-08 2.84e-08 - 2.85e-08 2.86e-08 2.87e-08 2.88e-08 2.89e-08 2.9e-08 2.91e-08 - 2.92e-08 2.93e-08 2.94e-08 2.95e-08 2.96e-08 2.97e-08 2.98e-08 - 2.99e-08 3e-08 3.01e-08 3.02e-08 3.03e-08 3.04e-08 3.05e-08 - 3.06e-08 3.07e-08 3.08e-08 3.09e-08 3.1e-08 3.11e-08 3.12e-08 - 3.13e-08 3.14e-08 3.15e-08 3.16e-08 3.17e-08 3.18e-08 3.19e-08 - 3.2e-08 3.21e-08 3.22e-08 3.23e-08 3.24e-08 3.25e-08 3.26e-08 - 3.27e-08 3.28e-08 3.29e-08 3.3e-08 3.31e-08 3.32e-08 3.33e-08 - 3.34e-08 3.35e-08 3.36e-08 3.37e-08 3.38e-08 3.39e-08 3.4e-08 - 3.41e-08 3.42e-08 3.43e-08 3.44e-08 3.45e-08 3.46e-08 3.47e-08 - 3.48e-08 3.49e-08 3.5e-08 3.51e-08 3.52e-08 3.53e-08 3.54e-08 - 3.55e-08 3.56e-08 3.57e-08 3.58e-08 3.59e-08 3.6e-08 + 0 1e-10 2e-10 3e-10 4e-10 5e-10 6e-10 7e-10 8e-10 9e-10 + 1e-09 1.1e-09 1.2e-09 1.3e-09 1.4e-09 1.5e-09 1.6e-09 1.7e-09 + 1.8e-09 1.9e-09 2e-09 2.1e-09 2.2e-09 2.3e-09 2.4e-09 2.5e-09 + 2.6e-09 2.7e-09 2.8e-09 2.9e-09 3e-09 3.1e-09 3.2e-09 3.3e-09 + 3.4e-09 3.5e-09 3.6e-09 3.7e-09 3.8e-09 3.9e-09 4e-09 4.1e-09 + 4.2e-09 4.3e-09 4.4e-09 4.5e-09 4.6e-09 4.7e-09 4.8e-09 + 4.9e-09 5e-09 5.1e-09 5.2e-09 5.3e-09 5.4e-09 5.5e-09 5.6e-09 + 5.7e-09 5.8e-09 5.9e-09 6e-09 6.1e-09 6.2e-09 6.3e-09 6.4e-09 + 6.5e-09 6.6e-09 6.7e-09 6.8e-09 6.9e-09 7e-09 7.1e-09 7.2e-09 + 7.3e-09 7.4e-09 7.5e-09 7.6e-09 7.7e-09 7.8e-09 7.9e-09 + 8e-09 8.1e-09 8.2e-09 8.3e-09 8.4e-09 8.5e-09 8.6e-09 8.7e-09 + 8.8e-09 8.9e-09 9e-09 9.1e-09 9.2e-09 9.3e-09 9.4e-09 9.5e-09 + 9.6e-09 9.7e-09 9.8e-09 9.9e-09 1e-08 1.01e-08 1.02e-08 + 1.03e-08 1.04e-08 1.05e-08 1.06e-08 1.07e-08 1.08e-08 1.09e-08 + 1.1e-08 1.11e-08 1.12e-08 1.13e-08 1.14e-08 1.15e-08 1.16e-08 + 1.17e-08 1.18e-08 1.19e-08 1.2e-08 1.21e-08 1.22e-08 1.23e-08 + 1.24e-08 1.25e-08 1.26e-08 1.27e-08 1.28e-08 1.29e-08 1.3e-08 + 1.31e-08 1.32e-08 1.33e-08 1.34e-08 1.35e-08 1.36e-08 1.37e-08 + 1.38e-08 1.39e-08 1.4e-08 1.41e-08 1.42e-08 1.43e-08 1.44e-08 + 1.45e-08 1.46e-08 1.47e-08 1.48e-08 1.49e-08 1.5e-08 1.51e-08 + 1.52e-08 1.53e-08 1.54e-08 1.55e-08 1.56e-08 1.57e-08 1.58e-08 + 1.59e-08 1.6e-08 1.61e-08 1.62e-08 1.63e-08 1.64e-08 1.65e-08 + 1.66e-08 1.67e-08 1.68e-08 1.69e-08 1.7e-08 1.71e-08 1.72e-08 + 1.73e-08 1.74e-08 1.75e-08 1.76e-08 1.77e-08 1.78e-08 1.79e-08 + 1.8e-08 1.81e-08 1.82e-08 1.83e-08 1.84e-08 1.85e-08 1.86e-08 + 1.87e-08 1.88e-08 1.89e-08 1.9e-08 1.91e-08 1.92e-08 1.93e-08 + 1.94e-08 1.95e-08 1.96e-08 1.97e-08 1.98e-08 1.99e-08 2e-08 + 2.01e-08 2.02e-08 2.03e-08 2.04e-08 2.05e-08 2.06e-08 2.07e-08 + 2.08e-08 2.09e-08 2.1e-08 2.11e-08 2.12e-08 2.13e-08 2.14e-08 + 2.15e-08 2.16e-08 2.17e-08 2.18e-08 2.19e-08 2.2e-08 2.21e-08 + 2.22e-08 2.23e-08 2.24e-08 2.25e-08 2.26e-08 2.27e-08 2.28e-08 + 2.29e-08 2.3e-08 2.31e-08 2.32e-08 2.33e-08 2.34e-08 2.35e-08 + 2.36e-08 2.37e-08 2.38e-08 2.39e-08 2.4e-08 2.41e-08 2.42e-08 + 2.43e-08 2.44e-08 2.45e-08 2.46e-08 2.47e-08 2.48e-08 2.49e-08 + 2.5e-08 2.51e-08 2.52e-08 2.53e-08 2.54e-08 2.55e-08 2.56e-08 + 2.57e-08 2.58e-08 2.59e-08 2.6e-08 2.61e-08 2.62e-08 2.63e-08 + 2.64e-08 2.65e-08 2.66e-08 2.67e-08 2.68e-08 2.69e-08 2.7e-08 + 2.71e-08 2.72e-08 2.73e-08 2.74e-08 2.75e-08 2.76e-08 2.77e-08 + 2.78e-08 2.79e-08 2.8e-08 2.81e-08 2.82e-08 2.83e-08 2.84e-08 + 2.85e-08 2.86e-08 2.87e-08 2.88e-08 2.89e-08 2.9e-08 2.91e-08 + 2.92e-08 2.93e-08 2.94e-08 2.95e-08 2.96e-08 2.97e-08 2.98e-08 + 2.99e-08 3e-08 3.01e-08 3.02e-08 3.03e-08 3.04e-08 3.05e-08 + 3.06e-08 3.07e-08 3.08e-08 3.09e-08 3.1e-08 3.11e-08 3.12e-08 + 3.13e-08 3.14e-08 3.15e-08 3.16e-08 3.17e-08 3.18e-08 3.19e-08 + 3.2e-08 3.21e-08 3.22e-08 3.23e-08 3.24e-08 3.25e-08 3.26e-08 + 3.27e-08 3.28e-08 3.29e-08 3.3e-08 3.31e-08 3.32e-08 3.33e-08 + 3.34e-08 3.35e-08 3.36e-08 3.37e-08 3.38e-08 3.39e-08 3.4e-08 + 3.41e-08 3.42e-08 3.43e-08 3.44e-08 3.45e-08 3.46e-08 3.47e-08 + 3.48e-08 3.49e-08 3.5e-08 3.51e-08 3.52e-08 3.53e-08 3.54e-08 + 3.55e-08 3.56e-08 3.57e-08 3.58e-08 3.59e-08 3.6e-08 EOD @v[1].set(<<-'EOD') - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 EOD @v[2].set(<<-'EOD') - 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 - 5.32907e-15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 - 5 5 5 5 5 5 5 5 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 + 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 + 5.32907e-15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 + 5 5 5 5 5 5 5 5 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 EOD @v[3].set(<<-'EOD') - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 8.88178e-16 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 2.13718e-14 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 8.88178e-16 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 2.13718e-14 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 EOD @v[4].set(<<-'EOD') - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 EOD @v[5].set(<<-'EOD') - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 EOD @v[6].set(<<-'EOD') - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 8.88178e-16 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 2.13718e-14 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 - 0 0 0 0 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 8.88178e-16 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 2.13718e-14 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 EOD @v[7].set(<<-'EOD') - 5 5.16904 4.84159 3.34542 0.317102 0.103304 0.0275721 0.0221534 - 0.017689 0.0142639 0.0113974 0.00918238 0.00742541 0.00616602 - 0.00481195 0.00397049 -0.0659889 -0.025671 0.165495 0.986891 - 3.05229 4.55511 4.91611 4.98192 4.99428 4.99833 4.99095 - 4.97295 4.95493 4.93428 4.90723 4.94799 4.98584 4.99566 - 4.99813 4.99907 4.99947 4.99965 4.99976 4.99984 4.99989 - 4.99992 4.99994 4.99996 4.99998 5.00002 5.00006 5.00002 - 4.99996 4.99994 4.99999 5.00003 5.00002 5 4.99997 4.99997 - 4.99997 4.99997 4.99997 4.99996 4.99997 4.99997 4.99998 - 4.99998 4.99999 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99998 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5.16575 - 4.69986 2.43862 0.0230224 0.035229 -0.0210607 -0.0292766 - -0.0172693 -0.00271479 -0.000912251 -0.000349106 -0.000116866 - -4.24733e-05 -1.39536e-05 -3.01179e-05 -0.0657192 -0.0204835 - 0.183378 1.07181 3.118 4.46472 4.84158 4.94795 4.98173 4.99236 - 4.99762 5.01939 5.0433 5.05332 5.04959 5.03955 5.02851 5.02052 - 5.01422 5.00965 5.00631 5.00405 5.00248 5.00083 5.00012 - 5.00209 5.00387 5.00347 4.99917 4.99213 4.98411 4.97521 - 4.96332 4.94601 4.9304 4.94633 4.97936 4.99264 4.99685 4.99857 - 4.99925 4.99954 4.9997 4.99973 4.9997 4.99973 4.99979 4.99983 - 4.99986 4.99988 4.9999 4.9999 4.99992 4.99993 4.99994 4.99995 - 4.99996 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 - 5.00002 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 5 5 5.14242 4.76101 3.16003 0.299374 - 0.0645506 -0.000498424 -2.45108e-05 -2.27986e-05 -5.24401e-05 - -4.9884e-05 -4.92491e-05 -2.93354e-05 -3.21402e-05 -2.11851e-05 - -3.37925e-05 -0.0657892 -0.020563 0.182582 1.06058 3.12484 - 4.46552 4.84146 4.95102 4.98556 4.99472 4.99806 4.99909 - 4.99955 4.99976 4.99994 4.99992 5.00029 4.99967 4.99849 - 4.99736 4.99884 5.00099 5.00377 5.00215 4.99994 4.99893 - 4.99788 4.99862 5.00055 5.00134 5.00127 5.00073 5.00039 - 5.00018 5.00006 5.00001 4.99985 5.00026 5.00018 5.00003 - 4.99981 4.99985 4.99987 4.99985 4.99982 4.99982 4.99982 - 4.99983 4.99985 4.99987 4.99989 4.99991 4.99992 4.99994 - 4.99995 4.99995 4.99994 4.99994 4.99996 4.99999 5.00002 - 5.00008 5.00009 5.00006 5.00001 5 4.99999 4.99998 4.99997 - 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 4.99999 - 4.99999 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99998 4.99998 - 4.99998 + 5 5.16904 4.84159 3.34542 0.317102 0.103304 0.0275721 0.0221534 + 0.017689 0.0142639 0.0113974 0.00918238 0.00742541 0.00616602 + 0.00481195 0.00397049 -0.0659889 -0.025671 0.165495 0.986891 + 3.05229 4.55511 4.91611 4.98192 4.99428 4.99833 4.99095 + 4.97295 4.95493 4.93428 4.90723 4.94799 4.98584 4.99566 + 4.99813 4.99907 4.99947 4.99965 4.99976 4.99984 4.99989 + 4.99992 4.99994 4.99996 4.99998 5.00002 5.00006 5.00002 + 4.99996 4.99994 4.99999 5.00003 5.00002 5 4.99997 4.99997 + 4.99997 4.99997 4.99997 4.99996 4.99997 4.99997 4.99998 + 4.99998 4.99999 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99998 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5.16575 + 4.69986 2.43862 0.0230224 0.035229 -0.0210607 -0.0292766 + -0.0172693 -0.00271479 -0.000912251 -0.000349106 -0.000116866 + -4.24733e-05 -1.39536e-05 -3.01179e-05 -0.0657192 -0.0204835 + 0.183378 1.07181 3.118 4.46472 4.84158 4.94795 4.98173 4.99236 + 4.99762 5.01939 5.0433 5.05332 5.04959 5.03955 5.02851 5.02052 + 5.01422 5.00965 5.00631 5.00405 5.00248 5.00083 5.00012 + 5.00209 5.00387 5.00347 4.99917 4.99213 4.98411 4.97521 + 4.96332 4.94601 4.9304 4.94633 4.97936 4.99264 4.99685 4.99857 + 4.99925 4.99954 4.9997 4.99973 4.9997 4.99973 4.99979 4.99983 + 4.99986 4.99988 4.9999 4.9999 4.99992 4.99993 4.99994 4.99995 + 4.99996 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 + 5.00002 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 5 5 5.14242 4.76101 3.16003 0.299374 + 0.0645506 -0.000498424 -2.45108e-05 -2.27986e-05 -5.24401e-05 + -4.9884e-05 -4.92491e-05 -2.93354e-05 -3.21402e-05 -2.11851e-05 + -3.37925e-05 -0.0657892 -0.020563 0.182582 1.06058 3.12484 + 4.46552 4.84146 4.95102 4.98556 4.99472 4.99806 4.99909 + 4.99955 4.99976 4.99994 4.99992 5.00029 4.99967 4.99849 + 4.99736 4.99884 5.00099 5.00377 5.00215 4.99994 4.99893 + 4.99788 4.99862 5.00055 5.00134 5.00127 5.00073 5.00039 + 5.00018 5.00006 5.00001 4.99985 5.00026 5.00018 5.00003 + 4.99981 4.99985 4.99987 4.99985 4.99982 4.99982 4.99982 + 4.99983 4.99985 4.99987 4.99989 4.99991 4.99992 4.99994 + 4.99995 4.99995 4.99994 4.99994 4.99996 4.99999 5.00002 + 5.00008 5.00009 5.00006 5.00001 5 4.99999 4.99998 4.99997 + 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 4.99999 + 4.99999 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99998 4.99998 + 4.99998 EOD @v[8].set(<<-'EOD') - 5 5.03758 5.04711 4.96911 4.20882 3.96295 4.01117 4.15521 - 4.2967 4.42274 4.5295 4.6176 4.69014 4.74831 4.7966 4.83537 - 4.80526 4.787 4.79295 4.88588 5.08978 5.15615 5.10778 5.07718 - 5.06652 5.08225 4.9744 4.52977 3.77452 2.69426 1.15294 0.245509 - 0.0981544 0.0567527 0.0367487 0.0252578 0.0180599 0.0133837 - 0.0101497 0.0078616 0.00620186 0.00499056 0.0041027 0.00344223 - 0.00295808 0.00260089 0.00229887 0.00200817 0.00176397 0.00160116 - 0.00147381 0.00134645 0.00125029 0.00116043 0.00107371 0.00101981 - 0.000965921 0.000912028 0.000858135 0.000804242 0.000761669 - 0.00072672 0.000691771 0.000656823 0.000621874 0.000588722 - 0.00057041 0.000552098 0.000533785 0.000515473 0.000497162 - 0.00047885 0.000460537 0.000442226 0.000423914 0.000405601 - 0.000388399 0.000378694 0.000368989 0.000359284 0.00034958 - 0.000339875 0.00033017 0.000320465 0.00031076 0.000301055 - 0.00029135 0.000282207 0.000276247 0.000270287 0.000264327 - 0.000258367 0.000252407 0.000246447 0.000240487 0.000234527 - 0.000228567 0.000222607 0.000217086 0.000213696 0.000210307 - 0.000206918 0.000203528 0.000200139 0.00019675 0.00019336 - 0.000189971 0.000186582 0.000183192 0.000179803 0.000176414 - 0.000173025 0.000169635 0.000166246 0.000162857 0.000159467 - 0.000156078 0.000152689 0.000149299 0.00014591 0.00014255 - 0.0316021 0.163272 0.348732 0.603651 0.35745 0.135965 0.0707354 - 0.0314595 0.0201047 0.00994945 0.00389601 0.00138839 0.00060778 - 0.000329648 0.000492396 -0.0732035 -0.0844077 -0.0789062 - -0.0390837 0.0197559 0.0183094 -0.00180099 -0.0189565 -0.0424144 - -0.0735904 -0.0892423 0.285039 1.13702 2.10809 2.95826 3.60164 - 4.0435 4.35771 4.57254 4.71769 4.81329 4.87534 4.91487 4.94264 - 4.97375 5.01526 5.06517 5.10154 5.06259 4.89005 4.5787 4.12226 - 3.46151 2.49023 1.2586 0.32725 0.116753 0.0701865 0.0455509 - 0.0286914 0.0178176 0.0117599 0.00902715 0.00760583 0.00637745 - 0.00543811 0.00439377 0.00352448 0.0030151 0.00285771 0.002465 - 0.00203114 0.00173004 0.0014839 0.00125177 0.00105327 0.000894905 - 0.000766372 0.000658894 0.000569105 0.000492114 0.000427938 - 0.000370217 0.000314758 0.000266569 0.000233726 0.000209048 - 0.000191957 0.000177169 0.000166604 0.000161 0.000157314 - 0.000143828 0.000130342 0.000116857 0.000103371 8.98855e-05 - 7.63998e-05 6.29141e-05 5.76583e-05 5.30027e-05 4.8347e-05 - 4.36913e-05 3.90357e-05 3.438e-05 2.97243e-05 2.72507e-05 - 2.59083e-05 2.45659e-05 2.32235e-05 2.18811e-05 2.05387e-05 - 1.91963e-05 1.78539e-05 1.65115e-05 1.51691e-05 1.38267e-05 - 1.24843e-05 1.11419e-05 9.79954e-06 8.51574e-06 7.69807e-06 - 6.8804e-06 6.06273e-06 5.24506e-06 0.0287318 0.0317111 -0.0320087 - -0.103609 0.0369639 0.0121128 0.00961197 0.00934971 0.00820853 - 0.00699769 0.00607002 0.00535541 0.00476552 0.00427601 0.00376357 - -0.073012 -0.0866964 -0.0809538 -0.038005 0.0277001 0.0188906 - 0.00614597 0.00373629 0.00489787 0.0146573 0.0191052 0.0151708 - 0.0124224 0.0105859 0.00879272 0.00729464 0.0070047 0.00449575 - -0.00626652 -0.0252417 -0.0147287 0.022538 0.0822905 0.0947372 - 0.0657516 0.0445506 0.0316753 0.0220971 0.0158101 0.0140971 - 0.0161498 0.0139876 0.0122447 0.0106994 0.009397 0.00822236 - 0.00686509 0.00797431 0.00751269 0.00671173 0.00595243 0.00524633 - 0.00459528 0.00401688 0.00350109 0.00303954 0.00260569 0.00222792 - 0.00191033 0.00163917 0.00140949 0.00121464 0.0010471 0.000900638 - 0.000768847 0.000645236 0.000524807 0.000460275 0.000442237 - 0.000446775 0.000397026 0.000301585 0.000228994 0.000190894 - 0.000166569 0.000152261 0.000137953 0.000123644 0.000109336 - 9.50281e-05 8.56557e-05 7.78437e-05 7.00318e-05 6.22198e-05 - 5.44079e-05 4.87539e-05 4.57761e-05 4.27982e-05 3.98203e-05 - 3.68425e-05 3.38646e-05 3.08868e-05 2.79089e-05 2.4931e-05 - 2.19532e-05 1.89753e-05 1.75244e-05 1.64095e-05 1.52946e-05 - 1.41797e-05 1.30648e-05 1.19499e-05 1.0835e-05 9.72011e-06 - 8.60521e-06 7.4903e-06 6.5117e-06 6.10334e-06 5.69497e-06 - 5.2866e-06 4.87824e-06 4.46987e-06 4.06151e-06 3.65314e-06 - 3.24477e-06 + 5 5.03758 5.04711 4.96911 4.20882 3.96295 4.01117 4.15521 + 4.2967 4.42274 4.5295 4.6176 4.69014 4.74831 4.7966 4.83537 + 4.80526 4.787 4.79295 4.88588 5.08978 5.15615 5.10778 5.07718 + 5.06652 5.08225 4.9744 4.52977 3.77452 2.69426 1.15294 0.245509 + 0.0981544 0.0567527 0.0367487 0.0252578 0.0180599 0.0133837 + 0.0101497 0.0078616 0.00620186 0.00499056 0.0041027 0.00344223 + 0.00295808 0.00260089 0.00229887 0.00200817 0.00176397 0.00160116 + 0.00147381 0.00134645 0.00125029 0.00116043 0.00107371 0.00101981 + 0.000965921 0.000912028 0.000858135 0.000804242 0.000761669 + 0.00072672 0.000691771 0.000656823 0.000621874 0.000588722 + 0.00057041 0.000552098 0.000533785 0.000515473 0.000497162 + 0.00047885 0.000460537 0.000442226 0.000423914 0.000405601 + 0.000388399 0.000378694 0.000368989 0.000359284 0.00034958 + 0.000339875 0.00033017 0.000320465 0.00031076 0.000301055 + 0.00029135 0.000282207 0.000276247 0.000270287 0.000264327 + 0.000258367 0.000252407 0.000246447 0.000240487 0.000234527 + 0.000228567 0.000222607 0.000217086 0.000213696 0.000210307 + 0.000206918 0.000203528 0.000200139 0.00019675 0.00019336 + 0.000189971 0.000186582 0.000183192 0.000179803 0.000176414 + 0.000173025 0.000169635 0.000166246 0.000162857 0.000159467 + 0.000156078 0.000152689 0.000149299 0.00014591 0.00014255 + 0.0316021 0.163272 0.348732 0.603651 0.35745 0.135965 0.0707354 + 0.0314595 0.0201047 0.00994945 0.00389601 0.00138839 0.00060778 + 0.000329648 0.000492396 -0.0732035 -0.0844077 -0.0789062 + -0.0390837 0.0197559 0.0183094 -0.00180099 -0.0189565 -0.0424144 + -0.0735904 -0.0892423 0.285039 1.13702 2.10809 2.95826 3.60164 + 4.0435 4.35771 4.57254 4.71769 4.81329 4.87534 4.91487 4.94264 + 4.97375 5.01526 5.06517 5.10154 5.06259 4.89005 4.5787 4.12226 + 3.46151 2.49023 1.2586 0.32725 0.116753 0.0701865 0.0455509 + 0.0286914 0.0178176 0.0117599 0.00902715 0.00760583 0.00637745 + 0.00543811 0.00439377 0.00352448 0.0030151 0.00285771 0.002465 + 0.00203114 0.00173004 0.0014839 0.00125177 0.00105327 0.000894905 + 0.000766372 0.000658894 0.000569105 0.000492114 0.000427938 + 0.000370217 0.000314758 0.000266569 0.000233726 0.000209048 + 0.000191957 0.000177169 0.000166604 0.000161 0.000157314 + 0.000143828 0.000130342 0.000116857 0.000103371 8.98855e-05 + 7.63998e-05 6.29141e-05 5.76583e-05 5.30027e-05 4.8347e-05 + 4.36913e-05 3.90357e-05 3.438e-05 2.97243e-05 2.72507e-05 + 2.59083e-05 2.45659e-05 2.32235e-05 2.18811e-05 2.05387e-05 + 1.91963e-05 1.78539e-05 1.65115e-05 1.51691e-05 1.38267e-05 + 1.24843e-05 1.11419e-05 9.79954e-06 8.51574e-06 7.69807e-06 + 6.8804e-06 6.06273e-06 5.24506e-06 0.0287318 0.0317111 -0.0320087 + -0.103609 0.0369639 0.0121128 0.00961197 0.00934971 0.00820853 + 0.00699769 0.00607002 0.00535541 0.00476552 0.00427601 0.00376357 + -0.073012 -0.0866964 -0.0809538 -0.038005 0.0277001 0.0188906 + 0.00614597 0.00373629 0.00489787 0.0146573 0.0191052 0.0151708 + 0.0124224 0.0105859 0.00879272 0.00729464 0.0070047 0.00449575 + -0.00626652 -0.0252417 -0.0147287 0.022538 0.0822905 0.0947372 + 0.0657516 0.0445506 0.0316753 0.0220971 0.0158101 0.0140971 + 0.0161498 0.0139876 0.0122447 0.0106994 0.009397 0.00822236 + 0.00686509 0.00797431 0.00751269 0.00671173 0.00595243 0.00524633 + 0.00459528 0.00401688 0.00350109 0.00303954 0.00260569 0.00222792 + 0.00191033 0.00163917 0.00140949 0.00121464 0.0010471 0.000900638 + 0.000768847 0.000645236 0.000524807 0.000460275 0.000442237 + 0.000446775 0.000397026 0.000301585 0.000228994 0.000190894 + 0.000166569 0.000152261 0.000137953 0.000123644 0.000109336 + 9.50281e-05 8.56557e-05 7.78437e-05 7.00318e-05 6.22198e-05 + 5.44079e-05 4.87539e-05 4.57761e-05 4.27982e-05 3.98203e-05 + 3.68425e-05 3.38646e-05 3.08868e-05 2.79089e-05 2.4931e-05 + 2.19532e-05 1.89753e-05 1.75244e-05 1.64095e-05 1.52946e-05 + 1.41797e-05 1.30648e-05 1.19499e-05 1.0835e-05 9.72011e-06 + 8.60521e-06 7.4903e-06 6.5117e-06 6.10334e-06 5.69497e-06 + 5.2866e-06 4.87824e-06 4.46987e-06 4.06151e-06 3.65314e-06 + 3.24477e-06 EOD @v[9].set(<<-'EOD') - 1.86175 1.99708 2.07867 2.01211 2.43309 3.27194 3.63896 - 3.90426 4.11074 4.27932 4.41496 4.52543 4.61491 4.68862 - 4.7479 4.79666 4.72895 4.68886 4.70354 4.81353 5.01568 5.14184 - 5.10482 5.07362 5.05143 5.03638 5.02323 5.01465 5.00853 - 5.00383 4.99985 5.00454 5.00652 5.00546 5.00411 5.003 5.00214 - 5.00151 5.00106 5.00073 5.0005 5.00034 5.00023 5.00015 5.0001 - 5.00005 5 5.00001 5.00005 5.00005 5.00003 5 4.99998 4.99996 - 4.99994 4.99995 4.99997 4.99998 5 5.00001 5.00002 5.00002 - 5.00003 5.00003 5.00003 5.00003 5.00003 5.00003 5.00002 - 5.00002 5.00001 5.00001 5.00001 5 5 5 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 - 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 5 5 5 5 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.17392 4.94828 3.78491 - 1.52079 0.608874 0.244031 0.127087 0.0552995 0.0361032 0.0169025 - 0.006364 0.00217624 0.000921391 0.000457305 0.000786754 - -0.120016 -0.148054 -0.15898 -0.0801463 0.16463 0.174017 - 0.0799249 0.0318788 0.0129696 0.00483397 0.0025677 0.0042079 - 0.00350003 0.00178404 -8.72902e-05 -0.00128497 -0.00142213 - -0.00130018 -0.00106874 -0.000789207 -0.000824335 -0.00104518 - -0.00136799 -0.004366 -0.0102621 -0.0109254 -0.00649259 - -0.00194842 0.00029793 0.00148673 0.00221085 0.00228291 - 0.00185261 0.00139687 0.00148183 0.00562266 0.00844119 0.00754627 - 0.00657396 0.00591212 0.00539269 0.0049282 0.00448417 0.0040572 - 0.00363719 0.00320392 0.00279607 0.00243938 0.00211505 0.00182302 - 0.00156254 0.0013341 0.00113834 0.000971865 0.00082776 0.000706193 - 0.000602499 0.000515059 0.000441401 0.00037897 0.000325459 - 0.00028083 0.000242096 0.000207274 0.000176444 0.000150372 - 0.000126407 0.000103373 9.05522e-05 8.53555e-05 8.63685e-05 - 9.02593e-05 8.37346e-05 7.72099e-05 7.06852e-05 6.41605e-05 - 5.76358e-05 5.11112e-05 4.45865e-05 4.08176e-05 3.72497e-05 - 3.36818e-05 3.01138e-05 2.65459e-05 2.2978e-05 1.94101e-05 - 1.76154e-05 1.67399e-05 1.58645e-05 1.4989e-05 1.41136e-05 - 1.32381e-05 1.23626e-05 1.14872e-05 1.06117e-05 9.73629e-06 - 8.86083e-06 7.98538e-06 7.10993e-06 6.23447e-06 5.44363e-06 - 5.32578e-06 5.20792e-06 5.09007e-06 4.97222e-06 0.0784323 - 0.0474527 -0.0764232 -0.151146 0.0615785 0.0144489 0.00974161 - 0.00947176 0.00849005 0.00728201 0.00630581 0.00554032 0.00487809 - 0.00441504 0.00384139 -0.118943 -0.149894 -0.161173 -0.0825299 - 0.171686 0.176912 0.0816085 0.0335236 0.013791 0.0056976 - 0.00238833 0.00105348 0.000526199 0.00025969 0.000396026 - 0.000837835 0.00170131 0.00196699 -0.000553314 -0.0061621 - -0.0111895 -0.0142698 -0.0124608 -0.00795847 -0.00467822 - -0.0043058 -0.00874449 -0.0118584 -0.00871386 -0.00377892 - 1.95244e-05 0.00218952 0.00325486 0.00386497 0.00422837 - 0.00446883 0.00447065 0.00486647 0.00547838 0.00565398 0.00559092 - 0.00538752 0.00507015 0.00466305 0.00420756 0.00373465 0.00328404 - 0.00287059 0.00250057 0.00216124 0.00184861 0.00156815 0.00134624 - 0.00117857 0.00103412 0.0008948 0.000761012 0.000619853 - 0.000462614 0.000319965 0.000287666 0.000356415 0.000379946 - 0.000339183 0.00027972 0.000252982 0.000226244 0.000199507 - 0.000172769 0.000146031 0.000130097 0.000117578 0.000105059 - 9.25401e-05 8.00213e-05 7.11204e-05 6.67061e-05 6.22918e-05 - 5.78775e-05 5.34632e-05 4.90489e-05 4.46346e-05 4.02203e-05 - 3.5806e-05 3.13916e-05 2.69773e-05 2.4827e-05 2.31747e-05 - 2.15225e-05 1.98702e-05 1.8218e-05 1.65658e-05 1.49135e-05 - 1.32613e-05 1.1609e-05 9.95678e-06 8.50108e-06 7.86765e-06 - 7.23422e-06 6.60079e-06 5.96736e-06 5.33393e-06 4.7005e-06 - 4.06707e-06 3.43363e-06 + 1.86175 1.99708 2.07867 2.01211 2.43309 3.27194 3.63896 + 3.90426 4.11074 4.27932 4.41496 4.52543 4.61491 4.68862 + 4.7479 4.79666 4.72895 4.68886 4.70354 4.81353 5.01568 5.14184 + 5.10482 5.07362 5.05143 5.03638 5.02323 5.01465 5.00853 + 5.00383 4.99985 5.00454 5.00652 5.00546 5.00411 5.003 5.00214 + 5.00151 5.00106 5.00073 5.0005 5.00034 5.00023 5.00015 5.0001 + 5.00005 5 5.00001 5.00005 5.00005 5.00003 5 4.99998 4.99996 + 4.99994 4.99995 4.99997 4.99998 5 5.00001 5.00002 5.00002 + 5.00003 5.00003 5.00003 5.00003 5.00003 5.00003 5.00002 + 5.00002 5.00001 5.00001 5.00001 5 5 5 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 + 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 5 5 5 5 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.17392 4.94828 3.78491 + 1.52079 0.608874 0.244031 0.127087 0.0552995 0.0361032 0.0169025 + 0.006364 0.00217624 0.000921391 0.000457305 0.000786754 + -0.120016 -0.148054 -0.15898 -0.0801463 0.16463 0.174017 + 0.0799249 0.0318788 0.0129696 0.00483397 0.0025677 0.0042079 + 0.00350003 0.00178404 -8.72902e-05 -0.00128497 -0.00142213 + -0.00130018 -0.00106874 -0.000789207 -0.000824335 -0.00104518 + -0.00136799 -0.004366 -0.0102621 -0.0109254 -0.00649259 + -0.00194842 0.00029793 0.00148673 0.00221085 0.00228291 + 0.00185261 0.00139687 0.00148183 0.00562266 0.00844119 0.00754627 + 0.00657396 0.00591212 0.00539269 0.0049282 0.00448417 0.0040572 + 0.00363719 0.00320392 0.00279607 0.00243938 0.00211505 0.00182302 + 0.00156254 0.0013341 0.00113834 0.000971865 0.00082776 0.000706193 + 0.000602499 0.000515059 0.000441401 0.00037897 0.000325459 + 0.00028083 0.000242096 0.000207274 0.000176444 0.000150372 + 0.000126407 0.000103373 9.05522e-05 8.53555e-05 8.63685e-05 + 9.02593e-05 8.37346e-05 7.72099e-05 7.06852e-05 6.41605e-05 + 5.76358e-05 5.11112e-05 4.45865e-05 4.08176e-05 3.72497e-05 + 3.36818e-05 3.01138e-05 2.65459e-05 2.2978e-05 1.94101e-05 + 1.76154e-05 1.67399e-05 1.58645e-05 1.4989e-05 1.41136e-05 + 1.32381e-05 1.23626e-05 1.14872e-05 1.06117e-05 9.73629e-06 + 8.86083e-06 7.98538e-06 7.10993e-06 6.23447e-06 5.44363e-06 + 5.32578e-06 5.20792e-06 5.09007e-06 4.97222e-06 0.0784323 + 0.0474527 -0.0764232 -0.151146 0.0615785 0.0144489 0.00974161 + 0.00947176 0.00849005 0.00728201 0.00630581 0.00554032 0.00487809 + 0.00441504 0.00384139 -0.118943 -0.149894 -0.161173 -0.0825299 + 0.171686 0.176912 0.0816085 0.0335236 0.013791 0.0056976 + 0.00238833 0.00105348 0.000526199 0.00025969 0.000396026 + 0.000837835 0.00170131 0.00196699 -0.000553314 -0.0061621 + -0.0111895 -0.0142698 -0.0124608 -0.00795847 -0.00467822 + -0.0043058 -0.00874449 -0.0118584 -0.00871386 -0.00377892 + 1.95244e-05 0.00218952 0.00325486 0.00386497 0.00422837 + 0.00446883 0.00447065 0.00486647 0.00547838 0.00565398 0.00559092 + 0.00538752 0.00507015 0.00466305 0.00420756 0.00373465 0.00328404 + 0.00287059 0.00250057 0.00216124 0.00184861 0.00156815 0.00134624 + 0.00117857 0.00103412 0.0008948 0.000761012 0.000619853 + 0.000462614 0.000319965 0.000287666 0.000356415 0.000379946 + 0.000339183 0.00027972 0.000252982 0.000226244 0.000199507 + 0.000172769 0.000146031 0.000130097 0.000117578 0.000105059 + 9.25401e-05 8.00213e-05 7.11204e-05 6.67061e-05 6.22918e-05 + 5.78775e-05 5.34632e-05 4.90489e-05 4.46346e-05 4.02203e-05 + 3.5806e-05 3.13916e-05 2.69773e-05 2.4827e-05 2.31747e-05 + 2.15225e-05 1.98702e-05 1.8218e-05 1.65658e-05 1.49135e-05 + 1.32613e-05 1.1609e-05 9.95678e-06 8.50108e-06 7.86765e-06 + 7.23422e-06 6.60079e-06 5.96736e-06 5.33393e-06 4.7005e-06 + 4.06707e-06 3.43363e-06 EOD @v[10].set(<<-'EOD') - 1.86175 1.99308 2.16619 2.46661 3.09359 3.76864 4.31299 - 4.65564 4.83425 4.92153 4.96157 4.98063 4.98649 4.99039 - 4.9945 4.9972 4.96206 4.89882 4.83865 4.83202 4.91016 5.04479 - 5.06078 5.04827 5.03474 5.0246 5.01639 5.00996 5.00569 5.00239 - 5.00043 5.00296 5.00437 5.00382 5.00287 5.00208 5.00148 - 5.00104 5.00073 5.0005 5.00034 5.00023 5.00016 5.00011 5.00008 - 5.00007 5.00007 5.00004 5 4.99998 4.99998 4.99997 4.99998 - 4.99999 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 - 5.00001 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 5.10081 - 5.10949 4.98359 5.00733 5.15145 4.37298 2.36126 0.470759 - 0.0577238 0.0115884 0.00262611 0.000671499 0.000389038 0.000291291 - 0.000317347 -0.0167823 -0.0158344 -0.0140559 0.0104849 0.0865874 - 0.107813 0.0524688 0.0214369 0.00876443 0.00341595 0.00170778 - 0.00259042 0.0022241 0.00118519 1.10217e-06 -0.000784506 - -0.000948169 -0.000856256 -0.000696719 -0.000485987 -0.000724787 - -0.000981491 -0.001454 -0.00552498 -0.0114992 -0.0105266 - -0.00543527 -0.000982798 0.00127356 0.00224212 0.00275439 - 0.00281098 0.0025471 0.00230368 0.00222576 0.00485522 0.00729453 - 0.00691796 0.0062615 0.00573987 0.0052688 0.00481185 0.00436934 - 0.00394326 0.00352712 0.00309978 0.00270038 0.00235335 0.00203742 - 0.00175256 0.00150067 0.00128126 0.00109323 0.000933619 - 0.000795113 0.000678182 0.00057843 0.000494345 0.000423609 - 0.000363821 0.000312766 0.000269856 0.000232389 0.000198382 - 0.000168126 0.00014267 0.000119293 9.69034e-05 8.5669e-05 - 8.26828e-05 8.64066e-05 9.26665e-05 8.5454e-05 7.82416e-05 - 7.10291e-05 6.38167e-05 5.66043e-05 4.93918e-05 4.21794e-05 - 3.86073e-05 3.53007e-05 3.19941e-05 2.86876e-05 2.5381e-05 - 2.20744e-05 1.87678e-05 1.70933e-05 1.62648e-05 1.54363e-05 - 1.46079e-05 1.37794e-05 1.2951e-05 1.21225e-05 1.12941e-05 - 1.04656e-05 9.63716e-06 8.80871e-06 7.98026e-06 7.1518e-06 - 6.32335e-06 5.5374e-06 5.08959e-06 4.64178e-06 4.19397e-06 - 3.74616e-06 0.0438026 0.0242078 -0.0602019 -0.0840866 0.00148461 - -0.00292489 0.000442098 0.00219489 0.00281478 0.00290756 - 0.00277945 0.00263896 0.00240099 0.00223283 0.001947 -0.0153629 - -0.0148815 -0.0128673 0.0126017 0.0905161 0.11051 0.0538958 - 0.022562 0.00935726 0.00397422 0.00172534 0.000790207 0.000416322 - 0.000191632 0.000469721 0.0009779 0.00192566 0.00200688 - -0.0016502 -0.00733932 -0.0128113 -0.0147608 -0.0115456 - -0.00668995 -0.00401368 -0.00463908 -0.0101197 -0.0118993 - -0.0076276 -0.00262656 0.000813059 0.00264455 0.00350796 - 0.00399494 0.0043049 0.00451658 0.00444739 0.00503842 0.00559516 - 0.00568213 0.00556459 0.0053176 0.00496654 0.00454337 0.00408592 - 0.00362171 0.00317793 0.00277001 0.00240394 0.00207009 0.00176575 - 0.00149725 0.00129045 0.00114257 0.00101135 0.000871672 - 0.000723764 0.000580438 0.000427507 0.000296956 0.000281834 - 0.000376628 0.000412266 0.000367547 0.000295305 0.000264513 - 0.000233721 0.000202929 0.000172137 0.000141345 0.000124721 - 0.000112577 0.000100433 8.82893e-05 7.61453e-05 6.75517e-05 - 6.33609e-05 5.91701e-05 5.49792e-05 5.07884e-05 4.65976e-05 - 4.24067e-05 3.82159e-05 3.40251e-05 2.98342e-05 2.56434e-05 - 2.36401e-05 2.21181e-05 2.05961e-05 1.90741e-05 1.75521e-05 - 1.60301e-05 1.45081e-05 1.29861e-05 1.14641e-05 9.94208e-06 - 8.59252e-06 7.96439e-06 7.33626e-06 6.70813e-06 6.07999e-06 - 5.45186e-06 4.82373e-06 4.1956e-06 3.56747e-06 + 1.86175 1.99308 2.16619 2.46661 3.09359 3.76864 4.31299 + 4.65564 4.83425 4.92153 4.96157 4.98063 4.98649 4.99039 + 4.9945 4.9972 4.96206 4.89882 4.83865 4.83202 4.91016 5.04479 + 5.06078 5.04827 5.03474 5.0246 5.01639 5.00996 5.00569 5.00239 + 5.00043 5.00296 5.00437 5.00382 5.00287 5.00208 5.00148 + 5.00104 5.00073 5.0005 5.00034 5.00023 5.00016 5.00011 5.00008 + 5.00007 5.00007 5.00004 5 4.99998 4.99998 4.99997 4.99998 + 4.99999 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 + 5.00001 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 5.10081 + 5.10949 4.98359 5.00733 5.15145 4.37298 2.36126 0.470759 + 0.0577238 0.0115884 0.00262611 0.000671499 0.000389038 0.000291291 + 0.000317347 -0.0167823 -0.0158344 -0.0140559 0.0104849 0.0865874 + 0.107813 0.0524688 0.0214369 0.00876443 0.00341595 0.00170778 + 0.00259042 0.0022241 0.00118519 1.10217e-06 -0.000784506 + -0.000948169 -0.000856256 -0.000696719 -0.000485987 -0.000724787 + -0.000981491 -0.001454 -0.00552498 -0.0114992 -0.0105266 + -0.00543527 -0.000982798 0.00127356 0.00224212 0.00275439 + 0.00281098 0.0025471 0.00230368 0.00222576 0.00485522 0.00729453 + 0.00691796 0.0062615 0.00573987 0.0052688 0.00481185 0.00436934 + 0.00394326 0.00352712 0.00309978 0.00270038 0.00235335 0.00203742 + 0.00175256 0.00150067 0.00128126 0.00109323 0.000933619 + 0.000795113 0.000678182 0.00057843 0.000494345 0.000423609 + 0.000363821 0.000312766 0.000269856 0.000232389 0.000198382 + 0.000168126 0.00014267 0.000119293 9.69034e-05 8.5669e-05 + 8.26828e-05 8.64066e-05 9.26665e-05 8.5454e-05 7.82416e-05 + 7.10291e-05 6.38167e-05 5.66043e-05 4.93918e-05 4.21794e-05 + 3.86073e-05 3.53007e-05 3.19941e-05 2.86876e-05 2.5381e-05 + 2.20744e-05 1.87678e-05 1.70933e-05 1.62648e-05 1.54363e-05 + 1.46079e-05 1.37794e-05 1.2951e-05 1.21225e-05 1.12941e-05 + 1.04656e-05 9.63716e-06 8.80871e-06 7.98026e-06 7.1518e-06 + 6.32335e-06 5.5374e-06 5.08959e-06 4.64178e-06 4.19397e-06 + 3.74616e-06 0.0438026 0.0242078 -0.0602019 -0.0840866 0.00148461 + -0.00292489 0.000442098 0.00219489 0.00281478 0.00290756 + 0.00277945 0.00263896 0.00240099 0.00223283 0.001947 -0.0153629 + -0.0148815 -0.0128673 0.0126017 0.0905161 0.11051 0.0538958 + 0.022562 0.00935726 0.00397422 0.00172534 0.000790207 0.000416322 + 0.000191632 0.000469721 0.0009779 0.00192566 0.00200688 + -0.0016502 -0.00733932 -0.0128113 -0.0147608 -0.0115456 + -0.00668995 -0.00401368 -0.00463908 -0.0101197 -0.0118993 + -0.0076276 -0.00262656 0.000813059 0.00264455 0.00350796 + 0.00399494 0.0043049 0.00451658 0.00444739 0.00503842 0.00559516 + 0.00568213 0.00556459 0.0053176 0.00496654 0.00454337 0.00408592 + 0.00362171 0.00317793 0.00277001 0.00240394 0.00207009 0.00176575 + 0.00149725 0.00129045 0.00114257 0.00101135 0.000871672 + 0.000723764 0.000580438 0.000427507 0.000296956 0.000281834 + 0.000376628 0.000412266 0.000367547 0.000295305 0.000264513 + 0.000233721 0.000202929 0.000172137 0.000141345 0.000124721 + 0.000112577 0.000100433 8.82893e-05 7.61453e-05 6.75517e-05 + 6.33609e-05 5.91701e-05 5.49792e-05 5.07884e-05 4.65976e-05 + 4.24067e-05 3.82159e-05 3.40251e-05 2.98342e-05 2.56434e-05 + 2.36401e-05 2.21181e-05 2.05961e-05 1.90741e-05 1.75521e-05 + 1.60301e-05 1.45081e-05 1.29861e-05 1.14641e-05 9.94208e-06 + 8.59252e-06 7.96439e-06 7.33626e-06 6.70813e-06 6.07999e-06 + 5.45186e-06 4.82373e-06 4.1956e-06 3.56747e-06 EOD @v[11].set(<<-'EOD') - 1.86175 1.73419 1.42874 1.04055 0.943004 0.268275 0.0826455 - 0.0388346 0.0214104 0.0135431 0.00961322 0.00712846 0.00588262 - 0.00432397 0.00377774 0.00270134 -0.00393731 -0.00542187 - -0.00126596 0.0113777 0.0134522 0.00477056 -0.00211067 -0.00229253 - -0.00173355 -0.00122404 -0.00113426 -0.000744931 -0.000520112 - -0.000410048 -0.000220439 0.000508104 5.15856e-05 -0.000112593 - -0.000118917 -9.57394e-05 -7.15727e-05 -5.11847e-05 -3.58275e-05 - -2.47166e-05 -1.68866e-05 -1.14082e-05 -7.66646e-06 -5.12139e-06 - -3.63426e-06 -3.01815e-06 -2.64862e-06 -1.4947e-06 -1.91403e-07 - -2.5763e-08 -7.73699e-07 -1.52164e-06 -1.07268e-06 -3.81696e-07 - 2.6727e-07 4.75489e-07 6.83708e-07 8.91926e-07 1.10014e-06 - 1.30836e-06 1.2482e-06 1.00726e-06 7.66311e-07 5.25364e-07 - 2.84417e-07 6.27857e-08 7.43904e-10 -6.12979e-08 -1.2334e-07 - -1.85382e-07 -2.47423e-07 -3.09465e-07 -3.71507e-07 -4.33549e-07 - -4.95591e-07 -5.57633e-07 -6.04571e-07 -5.4944e-07 -4.9431e-07 - -4.3918e-07 -3.84049e-07 -3.28919e-07 -2.73789e-07 -2.18659e-07 - -1.63528e-07 -1.08398e-07 -5.32678e-08 1.062e-09 5.08502e-08 - 1.00638e-07 1.50427e-07 2.00215e-07 2.50003e-07 2.99791e-07 - 3.4958e-07 3.99368e-07 4.49156e-07 4.98944e-07 5.34512e-07 - 5.01032e-07 4.67553e-07 4.34073e-07 4.00593e-07 3.67113e-07 - 3.33633e-07 3.00153e-07 2.66674e-07 2.33194e-07 1.99714e-07 - 1.66234e-07 1.32754e-07 9.92744e-08 6.57945e-08 3.23147e-08 - -1.16513e-09 -3.4645e-08 -6.81248e-08 -1.01605e-07 -1.35084e-07 - -1.68564e-07 -2.18729e-07 0.0114926 -0.0245378 -0.111828 - 0.0964775 1.61491 3.22668 4.22041 4.54492 4.82845 4.94868 - 4.98588 4.99609 4.9981 4.99908 4.99788 4.98395 4.99294 4.99724 - 5.01939 5.0471 5.00902 4.98194 4.98496 4.99188 4.99623 4.99862 - 5.00025 4.99974 4.99953 4.99946 4.99958 5.00012 4.99997 - 4.99992 4.99988 4.99985 4.9998 4.9997 4.9988 4.99806 4.99982 - 5.00143 5.00159 5.00098 5.00053 5.00028 5.00007 4.99977 - 4.99992 5.00005 5.00133 5.0009 4.99993 4.99972 4.99975 4.9998 - 4.99982 4.99983 4.99983 4.99983 4.99983 4.99984 4.99986 - 4.99987 4.99989 4.9999 4.99991 4.99992 4.99994 4.99995 4.99995 - 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 4.99998 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 5 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 5 5 5.01457 4.99482 4.96561 4.99326 - 5.03452 5.00424 5.00101 5.00045 5.00004 4.99965 4.99997 - 4.99994 4.99958 4.99999 4.99936 4.9839 4.99248 4.99717 5.01976 - 5.04869 5.0087 4.98143 4.98488 4.99199 4.99622 4.9983 4.99928 - 4.99971 4.99986 5.00031 5.00022 5.00035 5.0001 4.99884 4.99811 - 4.99803 4.99887 5.00078 5.00151 5.00116 5.00007 4.99843 - 4.99915 5.00107 5.00168 5.00141 5.00092 5.00055 5.0003 5.00016 - 5.0001 5.00001 5.00016 5.0002 5.00009 4.99993 4.99975 4.99984 - 4.99991 4.99991 4.99982 4.99974 4.99974 4.99985 4.99995 - 4.99999 4.99998 5.00004 5.00013 5.00015 5.00007 4.99988 - 4.99982 4.99985 4.99995 5.00006 5.0002 5.00025 5.0002 5.00009 - 5.00006 5.00004 5.00002 5 4.99998 4.99997 4.99998 4.99998 - 4.99999 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 - 4.99998 4.99998 4.99998 + 1.86175 1.73419 1.42874 1.04055 0.943004 0.268275 0.0826455 + 0.0388346 0.0214104 0.0135431 0.00961322 0.00712846 0.00588262 + 0.00432397 0.00377774 0.00270134 -0.00393731 -0.00542187 + -0.00126596 0.0113777 0.0134522 0.00477056 -0.00211067 -0.00229253 + -0.00173355 -0.00122404 -0.00113426 -0.000744931 -0.000520112 + -0.000410048 -0.000220439 0.000508104 5.15856e-05 -0.000112593 + -0.000118917 -9.57394e-05 -7.15727e-05 -5.11847e-05 -3.58275e-05 + -2.47166e-05 -1.68866e-05 -1.14082e-05 -7.66646e-06 -5.12139e-06 + -3.63426e-06 -3.01815e-06 -2.64862e-06 -1.4947e-06 -1.91403e-07 + -2.5763e-08 -7.73699e-07 -1.52164e-06 -1.07268e-06 -3.81696e-07 + 2.6727e-07 4.75489e-07 6.83708e-07 8.91926e-07 1.10014e-06 + 1.30836e-06 1.2482e-06 1.00726e-06 7.66311e-07 5.25364e-07 + 2.84417e-07 6.27857e-08 7.43904e-10 -6.12979e-08 -1.2334e-07 + -1.85382e-07 -2.47423e-07 -3.09465e-07 -3.71507e-07 -4.33549e-07 + -4.95591e-07 -5.57633e-07 -6.04571e-07 -5.4944e-07 -4.9431e-07 + -4.3918e-07 -3.84049e-07 -3.28919e-07 -2.73789e-07 -2.18659e-07 + -1.63528e-07 -1.08398e-07 -5.32678e-08 1.062e-09 5.08502e-08 + 1.00638e-07 1.50427e-07 2.00215e-07 2.50003e-07 2.99791e-07 + 3.4958e-07 3.99368e-07 4.49156e-07 4.98944e-07 5.34512e-07 + 5.01032e-07 4.67553e-07 4.34073e-07 4.00593e-07 3.67113e-07 + 3.33633e-07 3.00153e-07 2.66674e-07 2.33194e-07 1.99714e-07 + 1.66234e-07 1.32754e-07 9.92744e-08 6.57945e-08 3.23147e-08 + -1.16513e-09 -3.4645e-08 -6.81248e-08 -1.01605e-07 -1.35084e-07 + -1.68564e-07 -2.18729e-07 0.0114926 -0.0245378 -0.111828 + 0.0964775 1.61491 3.22668 4.22041 4.54492 4.82845 4.94868 + 4.98588 4.99609 4.9981 4.99908 4.99788 4.98395 4.99294 4.99724 + 5.01939 5.0471 5.00902 4.98194 4.98496 4.99188 4.99623 4.99862 + 5.00025 4.99974 4.99953 4.99946 4.99958 5.00012 4.99997 + 4.99992 4.99988 4.99985 4.9998 4.9997 4.9988 4.99806 4.99982 + 5.00143 5.00159 5.00098 5.00053 5.00028 5.00007 4.99977 + 4.99992 5.00005 5.00133 5.0009 4.99993 4.99972 4.99975 4.9998 + 4.99982 4.99983 4.99983 4.99983 4.99983 4.99984 4.99986 + 4.99987 4.99989 4.9999 4.99991 4.99992 4.99994 4.99995 4.99995 + 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 4.99998 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 5 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 5 5 5.01457 4.99482 4.96561 4.99326 + 5.03452 5.00424 5.00101 5.00045 5.00004 4.99965 4.99997 + 4.99994 4.99958 4.99999 4.99936 4.9839 4.99248 4.99717 5.01976 + 5.04869 5.0087 4.98143 4.98488 4.99199 4.99622 4.9983 4.99928 + 4.99971 4.99986 5.00031 5.00022 5.00035 5.0001 4.99884 4.99811 + 4.99803 4.99887 5.00078 5.00151 5.00116 5.00007 4.99843 + 4.99915 5.00107 5.00168 5.00141 5.00092 5.00055 5.0003 5.00016 + 5.0001 5.00001 5.00016 5.0002 5.00009 4.99993 4.99975 4.99984 + 4.99991 4.99991 4.99982 4.99974 4.99974 4.99985 4.99995 + 4.99999 4.99998 5.00004 5.00013 5.00015 5.00007 4.99988 + 4.99982 4.99985 4.99995 5.00006 5.0002 5.00025 5.0002 5.00009 + 5.00006 5.00004 5.00002 5 4.99998 4.99997 4.99998 4.99998 + 4.99999 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 + 4.99998 4.99998 4.99998 EOD @v[12].set(<<-'EOD') - 5 5.16975 4.78685 2.94241 0.126698 0.0487004 -0.00422591 - -0.00130689 -0.000486756 -0.000195875 -0.000108988 -6.66736e-05 - -7.26005e-05 -5.63608e-05 -3.81859e-05 -2.123e-05 -0.0646846 - -0.0184474 0.182248 1.06731 3.10988 4.46133 4.84133 4.95113 - 4.98364 4.99455 4.99694 4.99727 4.9994 4.99975 5.0001 5.00132 - 5.00089 5.00039 5.00019 5.00011 5.00006 5.00005 5.00004 - 5.00001 4.99992 4.99992 5.00002 5.00013 5.00017 5.00009 - 4.99992 4.99991 4.99994 4.99996 4.99998 4.99999 5.00001 - 5.00004 5.00006 5.00005 5.00004 5.00003 5.00002 5.00001 - 5 4.99999 4.99999 4.99998 4.99998 4.99997 4.99997 4.99998 - 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 - 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 5 5.14699 4.78074 - 3.19424 0.305663 0.0611255 -0.00179951 -0.0012032 0.000405978 - 0.000989399 0.000445194 0.000191447 8.30476e-05 3.96236e-05 - 1.91866e-05 1.70665e-05 -0.0655239 -0.0210234 0.1827 1.06848 - 3.11554 4.46518 4.84212 4.94853 4.98244 4.99434 4.9997 5.00081 - 5.00009 4.99972 4.99985 4.99974 4.9995 4.99949 4.99958 4.99973 - 4.99948 4.99914 4.99874 4.99946 5.00309 5.0091 5.01576 5.01835 - 5.01852 5.0176 5.01625 5.01479 5.01345 5.01264 5.011 5.01092 - 5.01344 5.01363 5.01289 5.01184 5.01071 5.00956 5.00848 - 5.00751 5.00663 5.00577 5.00497 5.00427 5.00365 5.0031 5.00264 - 5.00224 5.00191 5.00163 5.00138 5.00117 5.00099 5.00083 - 5.00071 5.00061 5.00053 5.00045 5.00037 5.00029 5.00022 - 5.00019 5.0002 5.00023 5.00024 5.00023 5.00023 5.00022 5.0002 - 5.00018 5.00016 5.00014 5.00011 5.00009 5.00007 5.00006 - 5.00005 5.00005 5.00004 5.00003 5.00002 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00001 5.00001 5.00001 5.14298 4.79809 3.32704 - 0.498385 0.105773 0.0160646 0.0319912 0.0299434 0.0240102 - 0.0185844 0.0130411 0.0106532 0.00864871 0.00744519 0.00660887 - -0.0612913 -0.0203719 0.174998 0.991787 3.06292 4.60005 - 4.93058 4.98917 5.00033 4.9999 4.99909 4.9966 4.9955 4.99488 - 4.99374 4.9943 5.00131 5.00506 4.99311 4.96288 4.93567 4.92439 - 4.94236 4.9732 4.98864 4.99458 5.00031 5.00694 5.01525 5.01945 - 5.01998 5.01953 5.01874 5.01766 5.0164 5.01509 5.01326 5.01423 - 5.01455 5.01361 5.01245 5.01122 5.01002 5.00888 5.00783 - 5.00687 5.00596 5.00514 5.00442 5.00379 5.00325 5.00279 - 5.0024 5.00208 5.0018 5.00153 5.00126 5.00107 5.00094 5.00085 - 5.00078 5.00072 5.00063 5.00053 5.00042 5.00038 5.00034 - 5.0003 5.00027 5.00023 5.00021 5.00019 5.00017 5.00015 5.00013 - 5.00012 5.00011 5.0001 5.0001 5.00009 5.00008 5.00007 5.00007 - 5.00006 5.00005 5.00005 5.00004 5.00004 5.00003 5.00003 - 5.00002 5.00002 5.00002 5.00001 5.00001 5 5 5 5.00001 5.00001 - 5.00001 5.00002 5.00002 5.00002 5.00002 + 5 5.16975 4.78685 2.94241 0.126698 0.0487004 -0.00422591 + -0.00130689 -0.000486756 -0.000195875 -0.000108988 -6.66736e-05 + -7.26005e-05 -5.63608e-05 -3.81859e-05 -2.123e-05 -0.0646846 + -0.0184474 0.182248 1.06731 3.10988 4.46133 4.84133 4.95113 + 4.98364 4.99455 4.99694 4.99727 4.9994 4.99975 5.0001 5.00132 + 5.00089 5.00039 5.00019 5.00011 5.00006 5.00005 5.00004 + 5.00001 4.99992 4.99992 5.00002 5.00013 5.00017 5.00009 + 4.99992 4.99991 4.99994 4.99996 4.99998 4.99999 5.00001 + 5.00004 5.00006 5.00005 5.00004 5.00003 5.00002 5.00001 + 5 4.99999 4.99999 4.99998 4.99998 4.99997 4.99997 4.99998 + 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 + 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 5 5.14699 4.78074 + 3.19424 0.305663 0.0611255 -0.00179951 -0.0012032 0.000405978 + 0.000989399 0.000445194 0.000191447 8.30476e-05 3.96236e-05 + 1.91866e-05 1.70665e-05 -0.0655239 -0.0210234 0.1827 1.06848 + 3.11554 4.46518 4.84212 4.94853 4.98244 4.99434 4.9997 5.00081 + 5.00009 4.99972 4.99985 4.99974 4.9995 4.99949 4.99958 4.99973 + 4.99948 4.99914 4.99874 4.99946 5.00309 5.0091 5.01576 5.01835 + 5.01852 5.0176 5.01625 5.01479 5.01345 5.01264 5.011 5.01092 + 5.01344 5.01363 5.01289 5.01184 5.01071 5.00956 5.00848 + 5.00751 5.00663 5.00577 5.00497 5.00427 5.00365 5.0031 5.00264 + 5.00224 5.00191 5.00163 5.00138 5.00117 5.00099 5.00083 + 5.00071 5.00061 5.00053 5.00045 5.00037 5.00029 5.00022 + 5.00019 5.0002 5.00023 5.00024 5.00023 5.00023 5.00022 5.0002 + 5.00018 5.00016 5.00014 5.00011 5.00009 5.00007 5.00006 + 5.00005 5.00005 5.00004 5.00003 5.00002 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00001 5.00001 5.00001 5.14298 4.79809 3.32704 + 0.498385 0.105773 0.0160646 0.0319912 0.0299434 0.0240102 + 0.0185844 0.0130411 0.0106532 0.00864871 0.00744519 0.00660887 + -0.0612913 -0.0203719 0.174998 0.991787 3.06292 4.60005 + 4.93058 4.98917 5.00033 4.9999 4.99909 4.9966 4.9955 4.99488 + 4.99374 4.9943 5.00131 5.00506 4.99311 4.96288 4.93567 4.92439 + 4.94236 4.9732 4.98864 4.99458 5.00031 5.00694 5.01525 5.01945 + 5.01998 5.01953 5.01874 5.01766 5.0164 5.01509 5.01326 5.01423 + 5.01455 5.01361 5.01245 5.01122 5.01002 5.00888 5.00783 + 5.00687 5.00596 5.00514 5.00442 5.00379 5.00325 5.00279 + 5.0024 5.00208 5.0018 5.00153 5.00126 5.00107 5.00094 5.00085 + 5.00078 5.00072 5.00063 5.00053 5.00042 5.00038 5.00034 + 5.0003 5.00027 5.00023 5.00021 5.00019 5.00017 5.00015 5.00013 + 5.00012 5.00011 5.0001 5.0001 5.00009 5.00008 5.00007 5.00007 + 5.00006 5.00005 5.00005 5.00004 5.00004 5.00003 5.00003 + 5.00002 5.00002 5.00002 5.00001 5.00001 5 5 5 5.00001 5.00001 + 5.00001 5.00002 5.00002 5.00002 5.00002 EOD @v[13].set(<<-'EOD') - 9.73784e-10 0.0189926 0.0926769 0.206309 0.111533 0.0953491 - 0.0426966 0.0214177 0.0117943 0.00741442 0.00528816 0.00398417 - 0.0032967 0.00266499 0.00206647 0.00158788 -0.0371391 -0.0439528 - -0.0408653 -0.0188706 0.0150241 0.0126852 0.00209817 -0.000239206 - -5.31488e-05 0.000876324 -0.00451221 -0.0165223 -0.0284127 - -0.0427584 -0.0502453 -0.0257366 -0.00903938 -0.00376456 - -0.00233385 -0.00169922 -0.00130397 -0.00102542 -0.000811435 - -0.000648115 -0.000529266 -0.00043795 -0.00036574 -0.00030716 - -0.00026221 -0.000229662 -0.000205112 -0.000181038 -0.000162045 - -0.000148988 -0.000137633 -0.000126278 -0.000115562 -0.000104976 - -9.49324e-05 -9.0585e-05 -8.62375e-05 -8.18901e-05 -7.75426e-05 - -7.31952e-05 -6.93752e-05 -6.59106e-05 -6.24461e-05 -5.89815e-05 - -5.55169e-05 -5.22412e-05 -5.05263e-05 -4.88114e-05 -4.70966e-05 - -4.53817e-05 -4.36668e-05 -4.19519e-05 -4.0237e-05 -3.85222e-05 - -3.68073e-05 -3.50924e-05 -3.34782e-05 -3.25442e-05 -3.16102e-05 - -3.06763e-05 -2.97423e-05 -2.88083e-05 -2.78744e-05 -2.69404e-05 - -2.60064e-05 -2.50725e-05 -2.41385e-05 -2.32635e-05 -2.27232e-05 - -2.21829e-05 -2.16426e-05 -2.11023e-05 -2.0562e-05 -2.00217e-05 - -1.94814e-05 -1.89411e-05 -1.84007e-05 -1.78604e-05 -1.73647e-05 - -1.70853e-05 -1.68059e-05 -1.65265e-05 -1.62471e-05 -1.59677e-05 - -1.56883e-05 -1.54089e-05 -1.51295e-05 -1.48501e-05 -1.45707e-05 - -1.42913e-05 -1.40119e-05 -1.37325e-05 -1.34531e-05 -1.31737e-05 - -1.28943e-05 -1.26149e-05 -1.23355e-05 -1.20561e-05 -1.17767e-05 - -1.14973e-05 -1.10954e-05 0.0152675 0.0228237 -0.00460678 - -0.0341525 0.0232109 -0.0138039 -0.0416538 -0.0458764 -0.0201967 - -0.00878316 -0.00379173 -0.00164621 -0.000785131 -0.00037575 - -0.000352375 -0.0545586 -0.0746881 -0.0771865 -0.05386 -0.0022199 - 0.0136703 0.00633526 0.00138826 -0.00108934 0.0038886 0.0298077 - 0.0475776 0.0481003 0.0464167 0.047818 0.042789 0.035207 - 0.0264423 0.0193959 0.0151614 0.00624257 -0.00913057 -0.0310696 - -0.0430238 0.016426 0.189762 0.49025 0.820116 1.13919 1.43549 - 1.70658 1.95183 2.17414 2.38506 2.5657 2.73958 2.97905 3.21403 - 3.43025 3.62645 3.8028 3.96002 4.09996 4.22443 4.33427 4.42886 - 4.51097 4.5817 4.64326 4.6957 4.74132 4.7797 4.81298 4.84102 - 4.86512 4.88523 4.90224 4.91649 4.92846 4.93868 4.94755 - 4.95483 4.96114 4.96682 4.97161 4.97502 4.9776 4.97944 4.98141 - 4.98319 4.98467 4.98585 4.9869 4.98796 4.98902 4.99008 4.99114 - 4.9922 4.99326 4.9938 4.99429 4.99479 4.99528 4.99578 4.99628 - 4.99677 4.99704 4.99718 4.99733 4.99747 4.99762 4.99777 - 4.99791 4.99806 4.9982 4.99835 4.9985 4.99864 4.99879 4.99893 - 4.99907 4.99916 4.99925 4.99934 4.99943 5.01473 4.92293 - 4.61974 4.0316 3.7835 3.74195 3.78344 3.87272 3.97386 4.07319 - 4.16686 4.25256 4.33126 4.40264 4.46697 4.49249 4.51807 - 4.55803 4.64055 4.78574 4.86074 4.88334 4.8999 4.91455 4.92814 - 4.93926 4.94761 4.95433 4.95907 4.9654 4.98317 5.0208 5.05134 - 4.85852 4.16041 3.00077 1.68376 0.672707 0.240838 0.0794725 - -0.0106347 -0.00879443 0.107196 0.368163 0.701424 1.03581 - 1.3601 1.6678 1.95731 2.22701 2.47544 2.69099 2.92327 3.16648 - 3.3877 3.59067 3.77344 3.93584 4.08066 4.20863 4.32065 4.41791 - 4.50211 4.57423 4.63614 4.68888 4.73377 4.7721 4.80519 4.83338 - 4.85732 4.87815 4.89514 4.90927 4.92108 4.93122 4.94014 - 4.94845 4.95601 4.96251 4.96576 4.969 4.97225 4.9755 4.97874 - 4.98087 4.98265 4.98442 4.9862 4.98797 4.98924 4.9899 4.99055 - 4.9912 4.99186 4.99251 4.99316 4.99381 4.99447 4.99512 4.99577 - 4.99609 4.99634 4.99659 4.99683 4.99708 4.99732 4.99757 - 4.99782 4.99806 4.99831 4.99853 4.99863 4.99873 4.99883 - 4.99893 4.99903 4.99913 4.99923 4.99933 + 9.73784e-10 0.0189926 0.0926769 0.206309 0.111533 0.0953491 + 0.0426966 0.0214177 0.0117943 0.00741442 0.00528816 0.00398417 + 0.0032967 0.00266499 0.00206647 0.00158788 -0.0371391 -0.0439528 + -0.0408653 -0.0188706 0.0150241 0.0126852 0.00209817 -0.000239206 + -5.31488e-05 0.000876324 -0.00451221 -0.0165223 -0.0284127 + -0.0427584 -0.0502453 -0.0257366 -0.00903938 -0.00376456 + -0.00233385 -0.00169922 -0.00130397 -0.00102542 -0.000811435 + -0.000648115 -0.000529266 -0.00043795 -0.00036574 -0.00030716 + -0.00026221 -0.000229662 -0.000205112 -0.000181038 -0.000162045 + -0.000148988 -0.000137633 -0.000126278 -0.000115562 -0.000104976 + -9.49324e-05 -9.0585e-05 -8.62375e-05 -8.18901e-05 -7.75426e-05 + -7.31952e-05 -6.93752e-05 -6.59106e-05 -6.24461e-05 -5.89815e-05 + -5.55169e-05 -5.22412e-05 -5.05263e-05 -4.88114e-05 -4.70966e-05 + -4.53817e-05 -4.36668e-05 -4.19519e-05 -4.0237e-05 -3.85222e-05 + -3.68073e-05 -3.50924e-05 -3.34782e-05 -3.25442e-05 -3.16102e-05 + -3.06763e-05 -2.97423e-05 -2.88083e-05 -2.78744e-05 -2.69404e-05 + -2.60064e-05 -2.50725e-05 -2.41385e-05 -2.32635e-05 -2.27232e-05 + -2.21829e-05 -2.16426e-05 -2.11023e-05 -2.0562e-05 -2.00217e-05 + -1.94814e-05 -1.89411e-05 -1.84007e-05 -1.78604e-05 -1.73647e-05 + -1.70853e-05 -1.68059e-05 -1.65265e-05 -1.62471e-05 -1.59677e-05 + -1.56883e-05 -1.54089e-05 -1.51295e-05 -1.48501e-05 -1.45707e-05 + -1.42913e-05 -1.40119e-05 -1.37325e-05 -1.34531e-05 -1.31737e-05 + -1.28943e-05 -1.26149e-05 -1.23355e-05 -1.20561e-05 -1.17767e-05 + -1.14973e-05 -1.10954e-05 0.0152675 0.0228237 -0.00460678 + -0.0341525 0.0232109 -0.0138039 -0.0416538 -0.0458764 -0.0201967 + -0.00878316 -0.00379173 -0.00164621 -0.000785131 -0.00037575 + -0.000352375 -0.0545586 -0.0746881 -0.0771865 -0.05386 -0.0022199 + 0.0136703 0.00633526 0.00138826 -0.00108934 0.0038886 0.0298077 + 0.0475776 0.0481003 0.0464167 0.047818 0.042789 0.035207 + 0.0264423 0.0193959 0.0151614 0.00624257 -0.00913057 -0.0310696 + -0.0430238 0.016426 0.189762 0.49025 0.820116 1.13919 1.43549 + 1.70658 1.95183 2.17414 2.38506 2.5657 2.73958 2.97905 3.21403 + 3.43025 3.62645 3.8028 3.96002 4.09996 4.22443 4.33427 4.42886 + 4.51097 4.5817 4.64326 4.6957 4.74132 4.7797 4.81298 4.84102 + 4.86512 4.88523 4.90224 4.91649 4.92846 4.93868 4.94755 + 4.95483 4.96114 4.96682 4.97161 4.97502 4.9776 4.97944 4.98141 + 4.98319 4.98467 4.98585 4.9869 4.98796 4.98902 4.99008 4.99114 + 4.9922 4.99326 4.9938 4.99429 4.99479 4.99528 4.99578 4.99628 + 4.99677 4.99704 4.99718 4.99733 4.99747 4.99762 4.99777 + 4.99791 4.99806 4.9982 4.99835 4.9985 4.99864 4.99879 4.99893 + 4.99907 4.99916 4.99925 4.99934 4.99943 5.01473 4.92293 + 4.61974 4.0316 3.7835 3.74195 3.78344 3.87272 3.97386 4.07319 + 4.16686 4.25256 4.33126 4.40264 4.46697 4.49249 4.51807 + 4.55803 4.64055 4.78574 4.86074 4.88334 4.8999 4.91455 4.92814 + 4.93926 4.94761 4.95433 4.95907 4.9654 4.98317 5.0208 5.05134 + 4.85852 4.16041 3.00077 1.68376 0.672707 0.240838 0.0794725 + -0.0106347 -0.00879443 0.107196 0.368163 0.701424 1.03581 + 1.3601 1.6678 1.95731 2.22701 2.47544 2.69099 2.92327 3.16648 + 3.3877 3.59067 3.77344 3.93584 4.08066 4.20863 4.32065 4.41791 + 4.50211 4.57423 4.63614 4.68888 4.73377 4.7721 4.80519 4.83338 + 4.85732 4.87815 4.89514 4.90927 4.92108 4.93122 4.94014 + 4.94845 4.95601 4.96251 4.96576 4.969 4.97225 4.9755 4.97874 + 4.98087 4.98265 4.98442 4.9862 4.98797 4.98924 4.9899 4.99055 + 4.9912 4.99186 4.99251 4.99316 4.99381 4.99447 4.99512 4.99577 + 4.99609 4.99634 4.99659 4.99683 4.99708 4.99732 4.99757 + 4.99782 4.99806 4.99831 4.99853 4.99863 4.99873 4.99883 + 4.99893 4.99903 4.99913 4.99923 4.99933 EOD @v[14].set(<<-'EOD') - 1.86175 2.00147 1.85141 1.0654 0.275481 0.205547 0.0712627 - 0.0313387 0.0151431 0.00864531 0.00593861 0.00438111 0.0037479 - 0.00305857 0.00221221 0.0017081 -0.0896128 -0.109079 -0.121356 - -0.0542001 0.175821 0.177442 0.0814591 0.0333042 0.0134909 - 0.00625777 0.00100092 -0.00552776 -0.00411139 -0.00150395 - -0.000564784 3.48169e-05 -0.000287014 -0.000538515 -0.000456537 - -0.000325677 -0.000275468 -0.000166452 -8.27481e-05 -8.28704e-05 - -7.47644e-05 -4.60552e-05 -2.61481e-06 2.26359e-05 2.53852e-05 - -1.39853e-06 -4.23456e-05 -4.0907e-05 -2.8501e-05 -1.5945e-05 - -9.01122e-06 -2.07747e-06 1.49328e-06 4.38398e-06 6.84248e-06 - 4.76711e-06 2.69173e-06 6.16362e-07 -1.45901e-06 -3.53438e-06 - -4.14256e-06 -3.76238e-06 -3.3822e-06 -3.00202e-06 -2.62184e-06 - -2.24878e-06 -1.93456e-06 -1.62033e-06 -1.3061e-06 -9.91867e-07 - -6.77638e-07 -3.63409e-07 -4.91792e-08 2.6505e-07 5.7928e-07 - 8.93509e-07 1.16076e-06 1.11055e-06 1.06034e-06 1.01014e-06 - 9.59927e-07 9.09719e-07 8.59511e-07 8.09302e-07 7.59094e-07 - 7.08886e-07 6.58678e-07 5.99251e-07 4.87523e-07 3.75795e-07 - 2.64068e-07 1.5234e-07 4.06119e-08 -7.1116e-08 -1.82844e-07 - -2.94572e-07 -4.063e-07 -5.18027e-07 -6.08517e-07 -5.95879e-07 - -5.83241e-07 -5.70604e-07 -5.57966e-07 -5.45328e-07 -5.3269e-07 - -5.20053e-07 -5.07415e-07 -4.94777e-07 -4.8214e-07 -4.69502e-07 - -4.56864e-07 -4.44226e-07 -4.31589e-07 -4.18951e-07 -4.06313e-07 - -3.93676e-07 -3.81038e-07 -3.684e-07 -3.55762e-07 -3.43125e-07 - 1.06736e-05 0.0797407 0.0437947 -0.0645098 -0.0877312 0.0653203 - -0.00621184 -0.0353188 -0.0491378 -0.0251957 -0.0110996 - -0.00481123 -0.0020941 -0.000998038 -0.000478747 -0.000445332 - -0.102046 -0.135753 -0.154351 -0.0827509 0.163348 0.174012 - 0.0794822 0.0310624 0.0112213 0.00249061 0.00130764 0.00181315 - 0.00163875 0.00101454 0.000497435 0.000195258 5.31901e-05 - 2.4607e-05 6.62736e-05 7.90718e-05 4.0372e-05 -0.000141184 - -0.000280623 5.5608e-05 0.000799565 0.000920189 0.000931616 - 0.000494527 0.000162303 -8.24884e-05 -0.000183938 -0.000203899 - -0.000144788 -9.87063e-05 -0.000227929 2.93932e-05 0.000208563 - 1.88958e-06 -7.6335e-05 -0.000172472 -0.000165656 -0.000145889 - -0.000177311 -0.000191058 -0.000168287 -0.00015755 -0.00013142 - -8.10488e-05 -6.36115e-05 -7.8699e-05 -8.11282e-05 -7.98625e-05 - -5.98807e-05 -3.40879e-05 -1.95464e-05 -1.79247e-05 -4.45514e-05 - -7.47995e-05 -8.7682e-05 -7.50806e-05 -3.25561e-05 -4.34114e-05 - -7.69099e-05 -0.000141101 -0.00018743 -0.000148471 -5.06546e-05 - 0.000120195 0.000177635 0.000177052 0.000146344 9.75126e-05 - 8.31233e-05 6.8734e-05 5.43447e-05 3.99554e-05 2.55661e-05 - 1.11768e-05 -3.21253e-06 -3.88937e-06 -3.56628e-06 -3.24318e-06 - -2.92008e-06 -2.59699e-06 -2.27389e-06 -1.9508e-06 -1.73227e-06 - -1.56796e-06 -1.40365e-06 -1.23934e-06 -1.07503e-06 -9.10722e-07 - -7.46412e-07 -5.82101e-07 -4.1779e-07 -2.5348e-07 -8.91694e-08 - 7.51412e-08 2.39452e-07 4.03762e-07 5.95733e-07 1.00771e-06 - 1.41969e-06 1.83167e-06 2.24365e-06 0.0828257 0.231038 0.465438 - 1.54516 2.8461 3.19221 3.40395 3.6382 3.80758 3.93848 4.04882 - 4.15428 4.247 4.32917 4.40235 4.36941 4.397 4.48862 4.64552 - 4.86595 5.03475 5.0348 5.02627 5.01967 5.01542 5.00925 4.98613 - 4.9519 4.91581 4.87357 4.82302 4.80403 4.82565 4.86102 4.89483 - 4.92253 4.94428 4.96257 4.97608 4.98373 4.98823 4.99182 - 4.99437 4.99635 4.99745 4.99802 4.99843 4.99873 4.99895 - 4.99912 4.99925 4.99931 4.99962 4.99973 4.99972 4.99971 - 4.9997 4.99969 4.9997 4.99971 4.99973 4.99974 4.99976 4.99978 - 4.9998 4.99982 4.99985 4.99987 4.99989 4.9999 4.99991 4.99991 - 4.99993 4.99994 4.99997 5.00001 5.00006 5.00008 5.00006 - 5.00002 5 4.99999 4.99998 4.99997 4.99995 4.99995 4.99995 - 4.99995 4.99995 4.99995 4.99995 4.99996 4.99997 4.99997 - 4.99998 4.99999 5 5 5.00001 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00001 - 5.00001 5.00001 5.00001 5.00001 5 5 5 4.99999 4.99999 4.99999 + 1.86175 2.00147 1.85141 1.0654 0.275481 0.205547 0.0712627 + 0.0313387 0.0151431 0.00864531 0.00593861 0.00438111 0.0037479 + 0.00305857 0.00221221 0.0017081 -0.0896128 -0.109079 -0.121356 + -0.0542001 0.175821 0.177442 0.0814591 0.0333042 0.0134909 + 0.00625777 0.00100092 -0.00552776 -0.00411139 -0.00150395 + -0.000564784 3.48169e-05 -0.000287014 -0.000538515 -0.000456537 + -0.000325677 -0.000275468 -0.000166452 -8.27481e-05 -8.28704e-05 + -7.47644e-05 -4.60552e-05 -2.61481e-06 2.26359e-05 2.53852e-05 + -1.39853e-06 -4.23456e-05 -4.0907e-05 -2.8501e-05 -1.5945e-05 + -9.01122e-06 -2.07747e-06 1.49328e-06 4.38398e-06 6.84248e-06 + 4.76711e-06 2.69173e-06 6.16362e-07 -1.45901e-06 -3.53438e-06 + -4.14256e-06 -3.76238e-06 -3.3822e-06 -3.00202e-06 -2.62184e-06 + -2.24878e-06 -1.93456e-06 -1.62033e-06 -1.3061e-06 -9.91867e-07 + -6.77638e-07 -3.63409e-07 -4.91792e-08 2.6505e-07 5.7928e-07 + 8.93509e-07 1.16076e-06 1.11055e-06 1.06034e-06 1.01014e-06 + 9.59927e-07 9.09719e-07 8.59511e-07 8.09302e-07 7.59094e-07 + 7.08886e-07 6.58678e-07 5.99251e-07 4.87523e-07 3.75795e-07 + 2.64068e-07 1.5234e-07 4.06119e-08 -7.1116e-08 -1.82844e-07 + -2.94572e-07 -4.063e-07 -5.18027e-07 -6.08517e-07 -5.95879e-07 + -5.83241e-07 -5.70604e-07 -5.57966e-07 -5.45328e-07 -5.3269e-07 + -5.20053e-07 -5.07415e-07 -4.94777e-07 -4.8214e-07 -4.69502e-07 + -4.56864e-07 -4.44226e-07 -4.31589e-07 -4.18951e-07 -4.06313e-07 + -3.93676e-07 -3.81038e-07 -3.684e-07 -3.55762e-07 -3.43125e-07 + 1.06736e-05 0.0797407 0.0437947 -0.0645098 -0.0877312 0.0653203 + -0.00621184 -0.0353188 -0.0491378 -0.0251957 -0.0110996 + -0.00481123 -0.0020941 -0.000998038 -0.000478747 -0.000445332 + -0.102046 -0.135753 -0.154351 -0.0827509 0.163348 0.174012 + 0.0794822 0.0310624 0.0112213 0.00249061 0.00130764 0.00181315 + 0.00163875 0.00101454 0.000497435 0.000195258 5.31901e-05 + 2.4607e-05 6.62736e-05 7.90718e-05 4.0372e-05 -0.000141184 + -0.000280623 5.5608e-05 0.000799565 0.000920189 0.000931616 + 0.000494527 0.000162303 -8.24884e-05 -0.000183938 -0.000203899 + -0.000144788 -9.87063e-05 -0.000227929 2.93932e-05 0.000208563 + 1.88958e-06 -7.6335e-05 -0.000172472 -0.000165656 -0.000145889 + -0.000177311 -0.000191058 -0.000168287 -0.00015755 -0.00013142 + -8.10488e-05 -6.36115e-05 -7.8699e-05 -8.11282e-05 -7.98625e-05 + -5.98807e-05 -3.40879e-05 -1.95464e-05 -1.79247e-05 -4.45514e-05 + -7.47995e-05 -8.7682e-05 -7.50806e-05 -3.25561e-05 -4.34114e-05 + -7.69099e-05 -0.000141101 -0.00018743 -0.000148471 -5.06546e-05 + 0.000120195 0.000177635 0.000177052 0.000146344 9.75126e-05 + 8.31233e-05 6.8734e-05 5.43447e-05 3.99554e-05 2.55661e-05 + 1.11768e-05 -3.21253e-06 -3.88937e-06 -3.56628e-06 -3.24318e-06 + -2.92008e-06 -2.59699e-06 -2.27389e-06 -1.9508e-06 -1.73227e-06 + -1.56796e-06 -1.40365e-06 -1.23934e-06 -1.07503e-06 -9.10722e-07 + -7.46412e-07 -5.82101e-07 -4.1779e-07 -2.5348e-07 -8.91694e-08 + 7.51412e-08 2.39452e-07 4.03762e-07 5.95733e-07 1.00771e-06 + 1.41969e-06 1.83167e-06 2.24365e-06 0.0828257 0.231038 0.465438 + 1.54516 2.8461 3.19221 3.40395 3.6382 3.80758 3.93848 4.04882 + 4.15428 4.247 4.32917 4.40235 4.36941 4.397 4.48862 4.64552 + 4.86595 5.03475 5.0348 5.02627 5.01967 5.01542 5.00925 4.98613 + 4.9519 4.91581 4.87357 4.82302 4.80403 4.82565 4.86102 4.89483 + 4.92253 4.94428 4.96257 4.97608 4.98373 4.98823 4.99182 + 4.99437 4.99635 4.99745 4.99802 4.99843 4.99873 4.99895 + 4.99912 4.99925 4.99931 4.99962 4.99973 4.99972 4.99971 + 4.9997 4.99969 4.9997 4.99971 4.99973 4.99974 4.99976 4.99978 + 4.9998 4.99982 4.99985 4.99987 4.99989 4.9999 4.99991 4.99991 + 4.99993 4.99994 4.99997 5.00001 5.00006 5.00008 5.00006 + 5.00002 5 4.99999 4.99998 4.99997 4.99995 4.99995 4.99995 + 4.99995 4.99995 4.99995 4.99995 4.99996 4.99997 4.99997 + 4.99998 4.99999 5 5 5.00001 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00001 + 5.00001 5.00001 5.00001 5.00001 5 5 5 4.99999 4.99999 4.99999 EOD @v[15].set(<<-'EOD') - 1.86175 2.00199 2.08919 1.84314 1.08254 0.214737 0.0377351 - 0.00952455 0.00232763 0.000563614 0.000263477 0.000148642 - 0.000285086 0.000242592 7.34699e-05 -1.53467e-05 -0.0161874 - -0.0157876 -0.0141194 0.0132576 0.0903272 0.109938 0.0535295 - 0.0224216 0.00940945 0.00466825 -0.000649972 -0.00654752 - -0.00333248 -0.00103671 -0.000508276 -5.8896e-05 -0.00043938 - -0.000544704 -0.00044444 -0.000307093 -0.00024517 -0.000154538 - -8.78602e-05 -7.10461e-05 -6.06485e-05 -3.91039e-05 -8.45988e-06 - 9.43442e-06 1.28351e-05 -2.16734e-06 -2.6142e-05 -2.54768e-05 - -1.88997e-05 -1.17906e-05 -7.3808e-06 -2.97101e-06 1.19146e-07 - 2.94246e-06 5.38942e-06 3.88851e-06 2.38761e-06 8.86704e-07 - -6.14201e-07 -2.11511e-06 -2.59565e-06 -2.38885e-06 -2.18205e-06 - -1.97525e-06 -1.76845e-06 -1.56241e-06 -1.36258e-06 -1.16276e-06 - -9.62939e-07 -7.63116e-07 -5.63293e-07 -3.6347e-07 -1.63647e-07 - 3.61756e-08 2.35999e-07 4.35822e-07 6.07653e-07 5.90323e-07 - 5.72994e-07 5.55665e-07 5.38336e-07 5.21007e-07 5.03678e-07 - 4.86349e-07 4.6902e-07 4.51691e-07 4.34361e-07 4.11899e-07 - 3.60315e-07 3.08731e-07 2.57146e-07 2.05562e-07 1.53977e-07 - 1.02393e-07 5.08082e-08 -7.76222e-10 -5.23607e-08 -1.03945e-07 - -1.47815e-07 -1.54225e-07 -1.60635e-07 -1.67045e-07 -1.73455e-07 - -1.79864e-07 -1.86274e-07 -1.92684e-07 -1.99094e-07 -2.05504e-07 - -2.11914e-07 -2.18324e-07 -2.24734e-07 -2.31144e-07 -2.37554e-07 - -2.43964e-07 -2.50373e-07 -2.56783e-07 -2.63193e-07 -2.69603e-07 - -2.76013e-07 -2.82423e-07 2.92534e-06 0.0446777 0.024278 - -0.0518987 -0.0636547 0.00983929 -0.000518204 -0.000265194 - 0.000154772 0.000299538 3.12715e-05 -3.18225e-05 -2.48268e-05 - -1.16701e-05 -6.05117e-06 7.61116e-06 -0.0163668 -0.0158244 - -0.0141177 0.0100085 0.0857144 0.107784 0.051862 0.0204448 - 0.00629858 0.000967736 0.00121674 0.00190276 0.00154009 - 0.000860922 0.000410386 0.000164585 3.99493e-05 1.93797e-05 - 5.67594e-05 0.000110126 2.49925e-05 -7.17815e-05 -0.000142299 - -1.63109e-05 0.000439529 0.000562489 0.000594599 0.000326164 - 0.000126423 -4.26063e-05 -0.000122927 -0.000114152 -6.72706e-05 - -6.41242e-05 -0.000135588 2.61507e-05 0.000134036 6.43734e-06 - -4.6223e-05 -0.000112047 -0.000101388 -8.67847e-05 -0.000117664 - -0.000133957 -0.000116558 -0.000100873 -7.65448e-05 -4.44964e-05 - -3.6677e-05 -5.26632e-05 -5.45172e-05 -5.13545e-05 -3.73869e-05 - -1.99732e-05 -1.0907e-05 -1.10081e-05 -3.02609e-05 -5.18517e-05 - -6.13597e-05 -5.30706e-05 -2.39572e-05 -3.24146e-05 -5.70062e-05 - -0.000103448 -0.000135376 -0.0001024 -2.39007e-05 0.000110929 - 0.000151226 0.000142044 0.000105922 5.62834e-05 4.78476e-05 - 3.94117e-05 3.09759e-05 2.25401e-05 1.41042e-05 5.66837e-06 - -2.76747e-06 -3.08639e-06 -2.81341e-06 -2.54043e-06 -2.26745e-06 - -1.99447e-06 -1.72149e-06 -1.44851e-06 -1.26226e-06 -1.12096e-06 - -9.79661e-07 -8.38363e-07 -6.97065e-07 -5.55768e-07 -4.1447e-07 - -2.73173e-07 -1.31875e-07 9.42259e-09 1.5072e-07 2.92018e-07 - 4.33315e-07 5.74613e-07 7.10363e-07 8.01984e-07 8.93604e-07 - 9.85225e-07 1.07685e-06 0.04474 0.0928765 0.141327 0.0176048 - -0.071675 -0.0124613 0.989022 2.28104 3.40619 4.21417 4.67173 - 4.87438 4.96044 4.98996 4.99858 4.96672 4.89502 4.79391 - 4.76433 4.8387 4.98612 5.0161 5.01722 5.01437 5.01256 4.99827 - 4.95807 4.9209 4.88217 4.83006 4.78461 4.80759 4.85548 4.89604 - 4.9254 4.94617 4.96126 4.97374 4.98255 4.98792 4.99126 4.99361 - 4.99554 4.99699 4.99792 4.99846 4.99881 4.99905 4.99924 - 4.99938 4.99949 4.99955 4.9997 4.9998 4.99982 4.99982 4.99982 - 4.99982 4.99982 4.99983 4.99984 4.99985 4.99986 4.99987 - 4.99988 4.99989 4.9999 4.99992 4.99993 4.99994 4.99995 4.99995 - 4.99996 4.99996 4.99998 4.99999 5.00001 5.00002 5.00002 - 5.00001 5.00001 5 4.99999 4.99999 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 1.86175 2.00199 2.08919 1.84314 1.08254 0.214737 0.0377351 + 0.00952455 0.00232763 0.000563614 0.000263477 0.000148642 + 0.000285086 0.000242592 7.34699e-05 -1.53467e-05 -0.0161874 + -0.0157876 -0.0141194 0.0132576 0.0903272 0.109938 0.0535295 + 0.0224216 0.00940945 0.00466825 -0.000649972 -0.00654752 + -0.00333248 -0.00103671 -0.000508276 -5.8896e-05 -0.00043938 + -0.000544704 -0.00044444 -0.000307093 -0.00024517 -0.000154538 + -8.78602e-05 -7.10461e-05 -6.06485e-05 -3.91039e-05 -8.45988e-06 + 9.43442e-06 1.28351e-05 -2.16734e-06 -2.6142e-05 -2.54768e-05 + -1.88997e-05 -1.17906e-05 -7.3808e-06 -2.97101e-06 1.19146e-07 + 2.94246e-06 5.38942e-06 3.88851e-06 2.38761e-06 8.86704e-07 + -6.14201e-07 -2.11511e-06 -2.59565e-06 -2.38885e-06 -2.18205e-06 + -1.97525e-06 -1.76845e-06 -1.56241e-06 -1.36258e-06 -1.16276e-06 + -9.62939e-07 -7.63116e-07 -5.63293e-07 -3.6347e-07 -1.63647e-07 + 3.61756e-08 2.35999e-07 4.35822e-07 6.07653e-07 5.90323e-07 + 5.72994e-07 5.55665e-07 5.38336e-07 5.21007e-07 5.03678e-07 + 4.86349e-07 4.6902e-07 4.51691e-07 4.34361e-07 4.11899e-07 + 3.60315e-07 3.08731e-07 2.57146e-07 2.05562e-07 1.53977e-07 + 1.02393e-07 5.08082e-08 -7.76222e-10 -5.23607e-08 -1.03945e-07 + -1.47815e-07 -1.54225e-07 -1.60635e-07 -1.67045e-07 -1.73455e-07 + -1.79864e-07 -1.86274e-07 -1.92684e-07 -1.99094e-07 -2.05504e-07 + -2.11914e-07 -2.18324e-07 -2.24734e-07 -2.31144e-07 -2.37554e-07 + -2.43964e-07 -2.50373e-07 -2.56783e-07 -2.63193e-07 -2.69603e-07 + -2.76013e-07 -2.82423e-07 2.92534e-06 0.0446777 0.024278 + -0.0518987 -0.0636547 0.00983929 -0.000518204 -0.000265194 + 0.000154772 0.000299538 3.12715e-05 -3.18225e-05 -2.48268e-05 + -1.16701e-05 -6.05117e-06 7.61116e-06 -0.0163668 -0.0158244 + -0.0141177 0.0100085 0.0857144 0.107784 0.051862 0.0204448 + 0.00629858 0.000967736 0.00121674 0.00190276 0.00154009 + 0.000860922 0.000410386 0.000164585 3.99493e-05 1.93797e-05 + 5.67594e-05 0.000110126 2.49925e-05 -7.17815e-05 -0.000142299 + -1.63109e-05 0.000439529 0.000562489 0.000594599 0.000326164 + 0.000126423 -4.26063e-05 -0.000122927 -0.000114152 -6.72706e-05 + -6.41242e-05 -0.000135588 2.61507e-05 0.000134036 6.43734e-06 + -4.6223e-05 -0.000112047 -0.000101388 -8.67847e-05 -0.000117664 + -0.000133957 -0.000116558 -0.000100873 -7.65448e-05 -4.44964e-05 + -3.6677e-05 -5.26632e-05 -5.45172e-05 -5.13545e-05 -3.73869e-05 + -1.99732e-05 -1.0907e-05 -1.10081e-05 -3.02609e-05 -5.18517e-05 + -6.13597e-05 -5.30706e-05 -2.39572e-05 -3.24146e-05 -5.70062e-05 + -0.000103448 -0.000135376 -0.0001024 -2.39007e-05 0.000110929 + 0.000151226 0.000142044 0.000105922 5.62834e-05 4.78476e-05 + 3.94117e-05 3.09759e-05 2.25401e-05 1.41042e-05 5.66837e-06 + -2.76747e-06 -3.08639e-06 -2.81341e-06 -2.54043e-06 -2.26745e-06 + -1.99447e-06 -1.72149e-06 -1.44851e-06 -1.26226e-06 -1.12096e-06 + -9.79661e-07 -8.38363e-07 -6.97065e-07 -5.55768e-07 -4.1447e-07 + -2.73173e-07 -1.31875e-07 9.42259e-09 1.5072e-07 2.92018e-07 + 4.33315e-07 5.74613e-07 7.10363e-07 8.01984e-07 8.93604e-07 + 9.85225e-07 1.07685e-06 0.04474 0.0928765 0.141327 0.0176048 + -0.071675 -0.0124613 0.989022 2.28104 3.40619 4.21417 4.67173 + 4.87438 4.96044 4.98996 4.99858 4.96672 4.89502 4.79391 + 4.76433 4.8387 4.98612 5.0161 5.01722 5.01437 5.01256 4.99827 + 4.95807 4.9209 4.88217 4.83006 4.78461 4.80759 4.85548 4.89604 + 4.9254 4.94617 4.96126 4.97374 4.98255 4.98792 4.99126 4.99361 + 4.99554 4.99699 4.99792 4.99846 4.99881 4.99905 4.99924 + 4.99938 4.99949 4.99955 4.9997 4.9998 4.99982 4.99982 4.99982 + 4.99982 4.99982 4.99983 4.99984 4.99985 4.99986 4.99987 + 4.99988 4.99989 4.9999 4.99992 4.99993 4.99994 4.99995 4.99995 + 4.99996 4.99996 4.99998 4.99999 5.00001 5.00002 5.00002 + 5.00001 5.00001 5 4.99999 4.99999 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 EOD @v[16].set(<<-'EOD') - 1.86175 1.73073 1.50572 1.89001 3.39004 4.36034 4.79012 - 4.93798 4.98305 4.99539 4.9979 4.99904 4.99772 4.9983 4.99935 - 4.99975 4.98837 4.99456 4.99728 5.01838 5.04568 5.00759 - 4.98112 4.98479 4.99197 4.99641 4.99747 4.99775 5.00043 - 5.0007 5.00035 5.00023 4.99976 5.00002 5.00007 5.0002 4.99993 - 5.00003 5.00021 5.00006 4.99993 4.99992 5.00002 5.00013 - 5.00017 5.00009 4.99992 4.99991 4.99993 4.99996 4.99998 - 4.99999 5.00001 5.00003 5.00005 5.00004 5.00004 5.00003 - 5.00002 5.00001 5 4.99999 4.99999 4.99998 4.99998 4.99997 - 4.99997 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00002 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 5 5.01498 4.99342 4.96899 5.00301 5.02627 4.9977 - 4.99548 4.99757 5.00277 5.00245 5.0014 5.00069 5.00032 5.00014 - 5.00009 4.9867 4.99262 4.99607 5.01805 5.04713 5.00927 4.98184 - 4.98483 4.9914 4.99616 4.99902 4.9999 4.99987 4.99979 4.99981 - 4.99989 4.99994 4.99998 5.0002 5.00001 5.00008 5.00008 5.0001 - 5.00021 5.00032 5.00025 5.00019 5.00006 5.00007 4.99994 - 4.99997 4.99999 5.00023 5.00008 4.99993 4.99998 4.99986 - 4.99982 5.00003 4.99985 4.99996 5.00014 5 4.99984 4.99979 - 4.99982 4.99993 5.00008 5.00011 5.00002 4.99996 4.9999 4.99994 - 5.00001 5.00007 5.00009 4.99995 4.99978 4.99971 4.99976 - 4.99997 4.99996 4.99989 4.99972 4.99955 4.99953 4.99959 - 4.99976 4.9999 5.00005 5.00023 5.00039 5.00034 5.00029 5.00024 - 5.00019 5.00014 5.00009 5.00004 5.00003 5.00002 5.00001 - 5 5 4.99999 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 - 5.00001 5.00002 5.00003 5.00004 5.01564 5.03395 5.04932 - 5.11868 3.92502 1.31888 0.163888 0.0946876 0.0789578 0.0565084 - 0.0260333 0.0156986 0.00907667 0.00613629 0.00468417 -0.00174008 - -0.0021422 0.000586962 0.0124937 0.0147977 0.00838454 0.00039383 - -0.000522021 -0.000426598 -0.000290214 -0.00173713 -0.00384132 - -0.00382945 -0.00429219 -0.00580193 -0.00393246 0.0017543 - 0.00423045 0.00408931 0.0031976 0.00245457 0.00187293 0.00159068 - 0.00105697 0.000609902 0.000358825 0.000334125 0.000212708 - 0.000168116 8.97349e-05 5.21578e-05 3.84527e-05 2.93033e-05 - 2.10067e-05 1.59954e-05 1.13917e-05 5.49738e-06 2.77217e-05 - 6.51259e-06 -6.65468e-06 2.09837e-06 -6.617e-06 -4.80187e-06 - 1.55031e-06 4.26536e-06 7.69457e-07 -1.46213e-06 -7.25202e-07 - 3.26501e-06 6.55807e-06 7.524e-06 6.07209e-06 6.00701e-06 - 5.41166e-06 3.86573e-06 1.10651e-06 -2.74603e-06 -2.18566e-06 - 2.3658e-06 8.59956e-06 8.35046e-06 2.90621e-06 -8.75982e-07 - -1.87189e-06 -2.1528e-06 -1.94875e-06 -1.74471e-06 -1.54067e-06 - -1.33662e-06 -1.13258e-06 -8.40567e-07 -5.20743e-07 -2.00918e-07 - 1.18906e-07 4.38731e-07 6.11382e-07 6.01529e-07 5.91675e-07 - 5.81822e-07 5.71968e-07 5.62115e-07 5.52261e-07 5.42407e-07 - 5.32554e-07 5.227e-07 5.12847e-07 4.72812e-07 4.26137e-07 - 3.79462e-07 3.32786e-07 2.86111e-07 2.39436e-07 1.92761e-07 - 1.46086e-07 9.94107e-08 5.27356e-08 -2.77779e-10 -7.98079e-08 - -1.59338e-07 -2.38868e-07 -3.18398e-07 -3.97928e-07 -4.77458e-07 - -5.56988e-07 -6.36519e-07 + 1.86175 1.73073 1.50572 1.89001 3.39004 4.36034 4.79012 + 4.93798 4.98305 4.99539 4.9979 4.99904 4.99772 4.9983 4.99935 + 4.99975 4.98837 4.99456 4.99728 5.01838 5.04568 5.00759 + 4.98112 4.98479 4.99197 4.99641 4.99747 4.99775 5.00043 + 5.0007 5.00035 5.00023 4.99976 5.00002 5.00007 5.0002 4.99993 + 5.00003 5.00021 5.00006 4.99993 4.99992 5.00002 5.00013 + 5.00017 5.00009 4.99992 4.99991 4.99993 4.99996 4.99998 + 4.99999 5.00001 5.00003 5.00005 5.00004 5.00004 5.00003 + 5.00002 5.00001 5 4.99999 4.99999 4.99998 4.99998 4.99997 + 4.99997 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00002 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 5 5.01498 4.99342 4.96899 5.00301 5.02627 4.9977 + 4.99548 4.99757 5.00277 5.00245 5.0014 5.00069 5.00032 5.00014 + 5.00009 4.9867 4.99262 4.99607 5.01805 5.04713 5.00927 4.98184 + 4.98483 4.9914 4.99616 4.99902 4.9999 4.99987 4.99979 4.99981 + 4.99989 4.99994 4.99998 5.0002 5.00001 5.00008 5.00008 5.0001 + 5.00021 5.00032 5.00025 5.00019 5.00006 5.00007 4.99994 + 4.99997 4.99999 5.00023 5.00008 4.99993 4.99998 4.99986 + 4.99982 5.00003 4.99985 4.99996 5.00014 5 4.99984 4.99979 + 4.99982 4.99993 5.00008 5.00011 5.00002 4.99996 4.9999 4.99994 + 5.00001 5.00007 5.00009 4.99995 4.99978 4.99971 4.99976 + 4.99997 4.99996 4.99989 4.99972 4.99955 4.99953 4.99959 + 4.99976 4.9999 5.00005 5.00023 5.00039 5.00034 5.00029 5.00024 + 5.00019 5.00014 5.00009 5.00004 5.00003 5.00002 5.00001 + 5 5 4.99999 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 + 5.00001 5.00002 5.00003 5.00004 5.01564 5.03395 5.04932 + 5.11868 3.92502 1.31888 0.163888 0.0946876 0.0789578 0.0565084 + 0.0260333 0.0156986 0.00907667 0.00613629 0.00468417 -0.00174008 + -0.0021422 0.000586962 0.0124937 0.0147977 0.00838454 0.00039383 + -0.000522021 -0.000426598 -0.000290214 -0.00173713 -0.00384132 + -0.00382945 -0.00429219 -0.00580193 -0.00393246 0.0017543 + 0.00423045 0.00408931 0.0031976 0.00245457 0.00187293 0.00159068 + 0.00105697 0.000609902 0.000358825 0.000334125 0.000212708 + 0.000168116 8.97349e-05 5.21578e-05 3.84527e-05 2.93033e-05 + 2.10067e-05 1.59954e-05 1.13917e-05 5.49738e-06 2.77217e-05 + 6.51259e-06 -6.65468e-06 2.09837e-06 -6.617e-06 -4.80187e-06 + 1.55031e-06 4.26536e-06 7.69457e-07 -1.46213e-06 -7.25202e-07 + 3.26501e-06 6.55807e-06 7.524e-06 6.07209e-06 6.00701e-06 + 5.41166e-06 3.86573e-06 1.10651e-06 -2.74603e-06 -2.18566e-06 + 2.3658e-06 8.59956e-06 8.35046e-06 2.90621e-06 -8.75982e-07 + -1.87189e-06 -2.1528e-06 -1.94875e-06 -1.74471e-06 -1.54067e-06 + -1.33662e-06 -1.13258e-06 -8.40567e-07 -5.20743e-07 -2.00918e-07 + 1.18906e-07 4.38731e-07 6.11382e-07 6.01529e-07 5.91675e-07 + 5.81822e-07 5.71968e-07 5.62115e-07 5.52261e-07 5.42407e-07 + 5.32554e-07 5.227e-07 5.12847e-07 4.72812e-07 4.26137e-07 + 3.79462e-07 3.32786e-07 2.86111e-07 2.39436e-07 1.92761e-07 + 1.46086e-07 9.94107e-08 5.27356e-08 -2.77779e-10 -7.98079e-08 + -1.59338e-07 -2.38868e-07 -3.18398e-07 -3.97928e-07 -4.77458e-07 + -5.56988e-07 -6.36519e-07 EOD @v[17].set(<<-'EOD') - 5 5.16963 4.84136 3.33754 0.316206 0.103113 0.0273341 0.0221102 - 0.0177008 0.0143758 0.0115203 0.00929231 0.00752716 0.00625439 - 0.00489872 0.00403656 -0.0657317 -0.0256467 0.165394 0.985963 - 3.05067 4.55799 4.89728 4.92464 4.8882 4.90592 4.97315 4.99241 - 4.99694 4.99845 4.99905 4.99939 4.99959 4.99971 4.9998 4.99986 - 4.9999 4.99993 4.99995 4.99996 4.99997 4.99998 4.99998 4.99999 - 4.99999 4.99999 4.99999 4.99999 5 5.00001 5.00003 5.00005 - 5.00004 5.00002 5 4.99999 4.99999 4.99998 4.99998 4.99997 - 4.99997 4.99998 4.99998 4.99999 4.99999 5 5 5 5 5 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 - 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 - 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5 5 5 5.00025 5.1657 4.69981 2.43895 - 0.0229743 0.0351406 -0.0211974 -0.0312063 -0.0160331 -0.0021718 - -0.000766597 -0.000251052 -5.49363e-05 -3.36364e-06 -2.01983e-06 - -9.70575e-06 -0.0657007 -0.0205247 0.183332 1.07163 3.11839 - 4.46213 4.84163 4.95195 4.99159 5.02084 5.04029 5.04138 - 5.0271 5.00445 4.97957 4.95702 4.95231 4.97819 4.99191 4.9963 - 4.99822 4.99878 4.99903 4.99925 4.99942 4.9995 4.99954 4.99957 - 4.99961 4.99966 4.9997 4.99974 4.99977 4.99981 4.99983 4.99986 - 4.99988 4.9999 4.99991 4.99992 4.99994 4.99995 4.99995 4.99996 - 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 - 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5 5 5 4.99999 4.99998 4.99997 4.99996 5.14239 4.76219 - 3.16574 0.299969 0.0631609 -0.00118611 -0.00026052 -5.96333e-05 - -1.44904e-05 -4.3859e-06 -2.99454e-06 1.10547e-06 4.84662e-06 - 1.30971e-05 2.23082e-05 -0.0655844 -0.0204818 0.182507 1.05954 - 3.12277 4.46735 4.83915 4.94512 4.97679 4.98654 4.9966 5.00833 - 5.00776 5.00432 5.00199 5.00086 5.00033 5.00008 5 5.00001 - 5 5.00005 5.00002 4.99981 4.99991 4.99998 4.99979 4.99979 - 4.99984 4.9998 4.9998 5.00006 5.00002 5.00001 5 5 4.99992 - 4.99998 4.99999 5.00002 5.00014 4.99999 4.99987 4.99993 - 5.00003 5.00011 5.00005 4.99996 4.99987 4.99985 4.99994 - 5.00009 5.0001 5 4.99993 4.99997 5.00008 5.00015 5.00021 - 5.00021 5.00007 4.99978 4.99965 4.99973 4.9999 4.99992 4.99995 - 4.99997 4.99999 5.00001 5.00002 5.00001 5.00001 5.00001 - 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 5.00001 5.00002 - 5.00002 5.00002 + 5 5.16963 4.84136 3.33754 0.316206 0.103113 0.0273341 0.0221102 + 0.0177008 0.0143758 0.0115203 0.00929231 0.00752716 0.00625439 + 0.00489872 0.00403656 -0.0657317 -0.0256467 0.165394 0.985963 + 3.05067 4.55799 4.89728 4.92464 4.8882 4.90592 4.97315 4.99241 + 4.99694 4.99845 4.99905 4.99939 4.99959 4.99971 4.9998 4.99986 + 4.9999 4.99993 4.99995 4.99996 4.99997 4.99998 4.99998 4.99999 + 4.99999 4.99999 4.99999 4.99999 5 5.00001 5.00003 5.00005 + 5.00004 5.00002 5 4.99999 4.99999 4.99998 4.99998 4.99997 + 4.99997 4.99998 4.99998 4.99999 4.99999 5 5 5 5 5 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 + 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 + 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5 5 5 5.00025 5.1657 4.69981 2.43895 + 0.0229743 0.0351406 -0.0211974 -0.0312063 -0.0160331 -0.0021718 + -0.000766597 -0.000251052 -5.49363e-05 -3.36364e-06 -2.01983e-06 + -9.70575e-06 -0.0657007 -0.0205247 0.183332 1.07163 3.11839 + 4.46213 4.84163 4.95195 4.99159 5.02084 5.04029 5.04138 + 5.0271 5.00445 4.97957 4.95702 4.95231 4.97819 4.99191 4.9963 + 4.99822 4.99878 4.99903 4.99925 4.99942 4.9995 4.99954 4.99957 + 4.99961 4.99966 4.9997 4.99974 4.99977 4.99981 4.99983 4.99986 + 4.99988 4.9999 4.99991 4.99992 4.99994 4.99995 4.99995 4.99996 + 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 + 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5 5 5 4.99999 4.99998 4.99997 4.99996 5.14239 4.76219 + 3.16574 0.299969 0.0631609 -0.00118611 -0.00026052 -5.96333e-05 + -1.44904e-05 -4.3859e-06 -2.99454e-06 1.10547e-06 4.84662e-06 + 1.30971e-05 2.23082e-05 -0.0655844 -0.0204818 0.182507 1.05954 + 3.12277 4.46735 4.83915 4.94512 4.97679 4.98654 4.9966 5.00833 + 5.00776 5.00432 5.00199 5.00086 5.00033 5.00008 5 5.00001 + 5 5.00005 5.00002 4.99981 4.99991 4.99998 4.99979 4.99979 + 4.99984 4.9998 4.9998 5.00006 5.00002 5.00001 5 5 4.99992 + 4.99998 4.99999 5.00002 5.00014 4.99999 4.99987 4.99993 + 5.00003 5.00011 5.00005 4.99996 4.99987 4.99985 4.99994 + 5.00009 5.0001 5 4.99993 4.99997 5.00008 5.00015 5.00021 + 5.00021 5.00007 4.99978 4.99965 4.99973 4.9999 4.99992 4.99995 + 4.99997 4.99999 5.00001 5.00002 5.00001 5.00001 5.00001 + 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 5.00001 5.00002 + 5.00002 5.00002 EOD @v[18].set(<<-'EOD') - 5 5.0333 5.02472 4.92559 4.18383 3.93923 3.9961 4.14293 - 4.28591 4.41336 4.52157 4.61101 4.68472 4.7439 4.79294 4.83239 - 4.80697 4.78808 4.79322 4.8838 5.08529 5.21863 4.88852 3.90198 - 2.14586 0.383977 0.101103 0.0525711 0.0318287 0.020895 0.0146908 - 0.010831 0.00830272 0.00656377 0.00532066 0.00440078 0.00369956 - 0.00315713 0.00272614 0.00237965 0.00209659 0.00186339 0.00167014 - 0.0015081 0.00137172 0.00125607 0.00115393 0.00106076 0.000980166 - 0.000918015 0.000862837 0.00080766 0.000763488 0.000721541 - 0.000680825 0.000653026 0.000625226 0.000597426 0.000569627 - 0.000541827 0.000519087 0.000499756 0.000480424 0.000461093 - 0.000441761 0.000423291 0.000411941 0.00040059 0.00038924 - 0.000377889 0.000366539 0.000355188 0.000343838 0.000332487 - 0.000321137 0.000309786 0.000299055 0.000292509 0.000285963 - 0.000279417 0.000272871 0.000266325 0.000259779 0.000253233 - 0.000246686 0.00024014 0.000233594 0.000227387 0.0002231 - 0.000218813 0.000214526 0.00021024 0.000205953 0.000201666 - 0.000197379 0.000193092 0.000188805 0.000184519 0.000180526 - 0.000177963 0.0001754 0.000172837 0.000170274 0.000167711 - 0.000165148 0.000162585 0.000160022 0.000157459 0.000154895 - 0.000152332 0.000149769 0.000147206 0.000144643 0.00014208 - 0.000139517 0.000136954 0.000134391 0.000131828 0.000129265 - 0.000126702 0.000132838 0.0311184 0.163151 0.34986 0.604501 - 0.357125 0.136137 0.0711304 0.0346959 0.0212674 0.00872193 - 0.00252206 0.000455269 7.59332e-05 2.91532e-05 0.000320562 - -0.0720911 -0.0840491 -0.0791345 -0.0404143 0.0182035 -0.0235871 - -0.0426072 -0.0597501 0.00824773 0.481404 1.32496 2.11949 - 2.57317 2.58202 2.15054 1.33786 0.45702 0.153772 0.0913584 - 0.0604989 0.0421591 0.0271456 0.0170021 0.0115815 0.00907886 - 0.00742466 0.00626096 0.00531127 0.00450501 0.00381927 0.00323718 - 0.00274374 0.00232494 0.00196885 0.00166686 0.00141134 0.00119437 - 0.0010109 0.000855534 0.000723378 0.000611408 0.000516704 - 0.000436769 0.000369523 0.000313026 0.00026526 0.000223976 - 0.000188972 0.000159042 0.000134148 0.000112688 9.49738e-05 - 7.97877e-05 6.721e-05 5.65115e-05 4.77194e-05 4.03591e-05 - 3.42848e-05 2.92627e-05 2.50435e-05 2.1412e-05 1.84532e-05 - 1.58624e-05 1.34673e-05 1.14461e-05 1.00935e-05 9.12375e-06 - 8.50202e-06 7.81431e-06 7.20729e-06 6.73936e-06 6.3702e-06 - 5.90049e-06 5.43077e-06 4.96105e-06 4.49133e-06 4.02162e-06 - 3.5519e-06 3.08218e-06 2.79099e-06 2.51281e-06 2.23463e-06 - 1.95645e-06 1.67827e-06 1.40009e-06 1.12191e-06 1.01376e-06 - 9.9375e-07 9.73741e-07 9.53733e-07 9.33724e-07 9.13715e-07 - 8.93707e-07 8.73698e-07 8.5369e-07 8.33681e-07 8.13673e-07 - 7.93664e-07 7.73655e-07 7.53647e-07 7.21781e-07 5.956e-07 - 4.69419e-07 3.43239e-07 2.17058e-07 0.0284032 0.0374438 - -0.0157543 -0.0680497 0.0504768 0.0100294 0.00222261 0.000528697 - 0.000132929 3.99489e-05 2.46066e-05 4.56327e-06 -6.54853e-06 - 1.33783e-05 -3.68221e-05 -0.0724498 -0.0843663 -0.0792935 - -0.0406426 0.0200019 0.0426259 0.0220753 0.00668555 -0.000968483 - 0.024662 0.0383437 0.0911513 0.087848 0.0602076 0.0390559 - 0.0260573 0.0180444 0.012974 0.00985409 0.00788132 0.0064228 - 0.005545 0.00453571 0.00364245 0.00310278 0.00270523 0.00236439 - 0.0020945 0.00186808 0.00167493 0.00151731 0.00138594 0.00126945 - 0.00116695 0.0010762 0.000996366 0.000928387 0.000864414 - 0.000808258 0.000759574 0.000713865 0.000666712 0.000632716 - 0.000601262 0.000572163 0.000543986 0.000515253 0.0004897 - 0.000468112 0.000449313 0.000432981 0.000417911 0.000401307 - 0.000382712 0.000366678 0.000355736 0.000349171 0.000335727 - 0.000317091 0.000296086 0.000283543 0.000277366 0.000272233 - 0.000267001 0.000263147 0.000256699 0.000250251 0.000243803 - 0.000237355 0.000230907 0.000225424 0.000220247 0.000215069 - 0.000209892 0.000204714 0.000200213 0.000196548 0.000192884 - 0.00018922 0.000185556 0.000181892 0.000178228 0.000174564 - 0.0001709 0.000167236 0.000163572 0.000160824 0.000158279 - 0.000155733 0.000153187 0.000150641 0.000148095 0.000145549 - 0.000143003 0.000140457 0.000137911 0.000135457 0.000133386 - 0.000131315 0.000129245 0.000127174 0.000125103 0.000123032 - 0.000120961 0.000118891 + 5 5.0333 5.02472 4.92559 4.18383 3.93923 3.9961 4.14293 + 4.28591 4.41336 4.52157 4.61101 4.68472 4.7439 4.79294 4.83239 + 4.80697 4.78808 4.79322 4.8838 5.08529 5.21863 4.88852 3.90198 + 2.14586 0.383977 0.101103 0.0525711 0.0318287 0.020895 0.0146908 + 0.010831 0.00830272 0.00656377 0.00532066 0.00440078 0.00369956 + 0.00315713 0.00272614 0.00237965 0.00209659 0.00186339 0.00167014 + 0.0015081 0.00137172 0.00125607 0.00115393 0.00106076 0.000980166 + 0.000918015 0.000862837 0.00080766 0.000763488 0.000721541 + 0.000680825 0.000653026 0.000625226 0.000597426 0.000569627 + 0.000541827 0.000519087 0.000499756 0.000480424 0.000461093 + 0.000441761 0.000423291 0.000411941 0.00040059 0.00038924 + 0.000377889 0.000366539 0.000355188 0.000343838 0.000332487 + 0.000321137 0.000309786 0.000299055 0.000292509 0.000285963 + 0.000279417 0.000272871 0.000266325 0.000259779 0.000253233 + 0.000246686 0.00024014 0.000233594 0.000227387 0.0002231 + 0.000218813 0.000214526 0.00021024 0.000205953 0.000201666 + 0.000197379 0.000193092 0.000188805 0.000184519 0.000180526 + 0.000177963 0.0001754 0.000172837 0.000170274 0.000167711 + 0.000165148 0.000162585 0.000160022 0.000157459 0.000154895 + 0.000152332 0.000149769 0.000147206 0.000144643 0.00014208 + 0.000139517 0.000136954 0.000134391 0.000131828 0.000129265 + 0.000126702 0.000132838 0.0311184 0.163151 0.34986 0.604501 + 0.357125 0.136137 0.0711304 0.0346959 0.0212674 0.00872193 + 0.00252206 0.000455269 7.59332e-05 2.91532e-05 0.000320562 + -0.0720911 -0.0840491 -0.0791345 -0.0404143 0.0182035 -0.0235871 + -0.0426072 -0.0597501 0.00824773 0.481404 1.32496 2.11949 + 2.57317 2.58202 2.15054 1.33786 0.45702 0.153772 0.0913584 + 0.0604989 0.0421591 0.0271456 0.0170021 0.0115815 0.00907886 + 0.00742466 0.00626096 0.00531127 0.00450501 0.00381927 0.00323718 + 0.00274374 0.00232494 0.00196885 0.00166686 0.00141134 0.00119437 + 0.0010109 0.000855534 0.000723378 0.000611408 0.000516704 + 0.000436769 0.000369523 0.000313026 0.00026526 0.000223976 + 0.000188972 0.000159042 0.000134148 0.000112688 9.49738e-05 + 7.97877e-05 6.721e-05 5.65115e-05 4.77194e-05 4.03591e-05 + 3.42848e-05 2.92627e-05 2.50435e-05 2.1412e-05 1.84532e-05 + 1.58624e-05 1.34673e-05 1.14461e-05 1.00935e-05 9.12375e-06 + 8.50202e-06 7.81431e-06 7.20729e-06 6.73936e-06 6.3702e-06 + 5.90049e-06 5.43077e-06 4.96105e-06 4.49133e-06 4.02162e-06 + 3.5519e-06 3.08218e-06 2.79099e-06 2.51281e-06 2.23463e-06 + 1.95645e-06 1.67827e-06 1.40009e-06 1.12191e-06 1.01376e-06 + 9.9375e-07 9.73741e-07 9.53733e-07 9.33724e-07 9.13715e-07 + 8.93707e-07 8.73698e-07 8.5369e-07 8.33681e-07 8.13673e-07 + 7.93664e-07 7.73655e-07 7.53647e-07 7.21781e-07 5.956e-07 + 4.69419e-07 3.43239e-07 2.17058e-07 0.0284032 0.0374438 + -0.0157543 -0.0680497 0.0504768 0.0100294 0.00222261 0.000528697 + 0.000132929 3.99489e-05 2.46066e-05 4.56327e-06 -6.54853e-06 + 1.33783e-05 -3.68221e-05 -0.0724498 -0.0843663 -0.0792935 + -0.0406426 0.0200019 0.0426259 0.0220753 0.00668555 -0.000968483 + 0.024662 0.0383437 0.0911513 0.087848 0.0602076 0.0390559 + 0.0260573 0.0180444 0.012974 0.00985409 0.00788132 0.0064228 + 0.005545 0.00453571 0.00364245 0.00310278 0.00270523 0.00236439 + 0.0020945 0.00186808 0.00167493 0.00151731 0.00138594 0.00126945 + 0.00116695 0.0010762 0.000996366 0.000928387 0.000864414 + 0.000808258 0.000759574 0.000713865 0.000666712 0.000632716 + 0.000601262 0.000572163 0.000543986 0.000515253 0.0004897 + 0.000468112 0.000449313 0.000432981 0.000417911 0.000401307 + 0.000382712 0.000366678 0.000355736 0.000349171 0.000335727 + 0.000317091 0.000296086 0.000283543 0.000277366 0.000272233 + 0.000267001 0.000263147 0.000256699 0.000250251 0.000243803 + 0.000237355 0.000230907 0.000225424 0.000220247 0.000215069 + 0.000209892 0.000204714 0.000200213 0.000196548 0.000192884 + 0.00018922 0.000185556 0.000181892 0.000178228 0.000174564 + 0.0001709 0.000167236 0.000163572 0.000160824 0.000158279 + 0.000155733 0.000153187 0.000150641 0.000148095 0.000145549 + 0.000143003 0.000140457 0.000137911 0.000135457 0.000133386 + 0.000131315 0.000129245 0.000127174 0.000125103 0.000123032 + 0.000120961 0.000118891 EOD @v[19].set(<<-'EOD') - 1.86175 1.99994 2.0833 2.01627 2.42503 3.25769 3.62134 3.88827 - 4.09688 4.26773 4.40529 4.51734 4.60827 4.68313 4.74346 - 4.79302 4.72815 4.68959 4.70421 4.81316 5.01375 5.14493 - 5.10305 5.0699 5.04484 5.03751 5.03348 5.02504 5.01799 5.01271 - 5.00895 5.00628 5.0044 5.00309 5.00216 5.00151 5.00105 5.00073 - 5.00051 5.00034 5.00023 5.00015 5.0001 5.00007 5.00003 4.99998 - 4.99993 4.99993 4.99995 4.99999 5.00001 5.00003 5.00002 - 5.00001 5 5 5 5 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00017 5.17398 - 4.94779 3.78508 1.52302 0.608808 0.244311 0.126053 0.0597175 - 0.038422 0.0158174 0.00481338 0.00107847 0.000301256 0.000114861 - 0.00059489 -0.118904 -0.147478 -0.158986 -0.080544 0.165361 - 0.171378 0.0776087 0.0435738 0.0428235 0.0423755 0.0347695 - 0.0225061 0.0155539 0.0121357 0.0107997 0.0103976 0.0124406 - 0.016814 0.0167556 0.0149852 0.01459 0.0141182 0.0131934 - 0.0120286 0.0108692 0.0097184 0.00855881 0.00744912 0.00643877 - 0.00554044 0.00475165 0.00406535 0.00347158 0.00295981 0.00251995 - 0.00214318 0.00182101 0.00154613 0.00131196 0.0011119 0.000941587 - 0.000796999 0.000674582 0.000571283 0.000484276 0.000410649 - 0.000347005 0.000292984 0.000246715 0.000208143 0.00017489 - 0.000147412 0.000123854 0.000104332 8.77229e-05 7.40686e-05 - 6.2637e-05 5.32e-05 4.53946e-05 3.88343e-05 3.31864e-05 - 2.85905e-05 2.45725e-05 2.08671e-05 1.77301e-05 1.55911e-05 - 1.40153e-05 1.29421e-05 1.18693e-05 1.09815e-05 1.03484e-05 - 9.87664e-06 9.14446e-06 8.41228e-06 7.68011e-06 6.94793e-06 - 6.21575e-06 5.48357e-06 4.7514e-06 4.38454e-06 4.04432e-06 - 3.7041e-06 3.36388e-06 3.02366e-06 2.68344e-06 2.34322e-06 - 2.15196e-06 2.03791e-06 1.92386e-06 1.80982e-06 1.69577e-06 - 1.58173e-06 1.46768e-06 1.35363e-06 1.23959e-06 1.12554e-06 - 1.0115e-06 8.9745e-07 7.83404e-07 6.69358e-07 4.76113e-07 - -3.47071e-07 -1.17025e-06 -1.99344e-06 -2.81662e-06 0.0783754 - 0.0500262 -0.0659563 -0.120914 0.0815957 0.0154255 0.00347177 - 0.000840357 0.000214582 6.54655e-05 3.91709e-05 8.07396e-06 - -4.44265e-07 1.74384e-05 -4.52725e-05 -0.119379 -0.147984 - -0.159247 -0.0824604 0.169014 0.177628 0.0758742 0.010558 - -0.0346506 -0.0710288 -0.0838952 -0.0599521 -0.034568 -0.0181615 - -0.00968034 -0.00547115 -0.00333511 -0.00232468 -0.00181159 - -0.00143841 -0.00116601 -0.000839755 -0.000569764 -0.000578683 - -0.000490551 -0.000411712 -0.000437859 -0.000408185 -0.000356644 - -0.000311332 -0.000269006 -0.000221396 -0.000210054 -0.0001923 - -0.000175122 -0.000161039 -0.0001428 -0.000126123 -0.000127893 - -8.14516e-05 -0.000120166 -0.000154909 -0.000112733 -8.40377e-05 - -7.11342e-05 -8.09538e-05 -9.77789e-05 -9.82402e-05 -7.73531e-05 - -5.28255e-05 -3.1096e-05 -1.87967e-05 -1.96552e-05 -4.16655e-05 - -5.77185e-05 -5.24142e-05 -2.83153e-05 -1.90012e-05 -1.54415e-05 - -2.52569e-05 -6.23747e-05 -0.000130543 -0.000149394 -0.000110886 - -4.35517e-05 -4.17084e-05 -3.98651e-05 -3.80218e-05 -3.61785e-05 - -3.43352e-05 -3.36249e-05 -3.32729e-05 -3.29208e-05 -3.25687e-05 - -3.22166e-05 -3.17143e-05 -3.10258e-05 -3.03372e-05 -2.96486e-05 - -2.89601e-05 -2.82715e-05 -2.75829e-05 -2.68944e-05 -2.62058e-05 - -2.55173e-05 -2.48287e-05 -2.43043e-05 -2.38159e-05 -2.33276e-05 - -2.28393e-05 -2.2351e-05 -2.18626e-05 -2.13743e-05 -2.0886e-05 - -2.03977e-05 -1.99093e-05 -1.945e-05 -1.91122e-05 -1.87744e-05 - -1.84366e-05 -1.80987e-05 -1.77609e-05 -1.74231e-05 -1.70853e-05 - -1.67474e-05 + 1.86175 1.99994 2.0833 2.01627 2.42503 3.25769 3.62134 3.88827 + 4.09688 4.26773 4.40529 4.51734 4.60827 4.68313 4.74346 + 4.79302 4.72815 4.68959 4.70421 4.81316 5.01375 5.14493 + 5.10305 5.0699 5.04484 5.03751 5.03348 5.02504 5.01799 5.01271 + 5.00895 5.00628 5.0044 5.00309 5.00216 5.00151 5.00105 5.00073 + 5.00051 5.00034 5.00023 5.00015 5.0001 5.00007 5.00003 4.99998 + 4.99993 4.99993 4.99995 4.99999 5.00001 5.00003 5.00002 + 5.00001 5 5 5 5 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00017 5.17398 + 4.94779 3.78508 1.52302 0.608808 0.244311 0.126053 0.0597175 + 0.038422 0.0158174 0.00481338 0.00107847 0.000301256 0.000114861 + 0.00059489 -0.118904 -0.147478 -0.158986 -0.080544 0.165361 + 0.171378 0.0776087 0.0435738 0.0428235 0.0423755 0.0347695 + 0.0225061 0.0155539 0.0121357 0.0107997 0.0103976 0.0124406 + 0.016814 0.0167556 0.0149852 0.01459 0.0141182 0.0131934 + 0.0120286 0.0108692 0.0097184 0.00855881 0.00744912 0.00643877 + 0.00554044 0.00475165 0.00406535 0.00347158 0.00295981 0.00251995 + 0.00214318 0.00182101 0.00154613 0.00131196 0.0011119 0.000941587 + 0.000796999 0.000674582 0.000571283 0.000484276 0.000410649 + 0.000347005 0.000292984 0.000246715 0.000208143 0.00017489 + 0.000147412 0.000123854 0.000104332 8.77229e-05 7.40686e-05 + 6.2637e-05 5.32e-05 4.53946e-05 3.88343e-05 3.31864e-05 + 2.85905e-05 2.45725e-05 2.08671e-05 1.77301e-05 1.55911e-05 + 1.40153e-05 1.29421e-05 1.18693e-05 1.09815e-05 1.03484e-05 + 9.87664e-06 9.14446e-06 8.41228e-06 7.68011e-06 6.94793e-06 + 6.21575e-06 5.48357e-06 4.7514e-06 4.38454e-06 4.04432e-06 + 3.7041e-06 3.36388e-06 3.02366e-06 2.68344e-06 2.34322e-06 + 2.15196e-06 2.03791e-06 1.92386e-06 1.80982e-06 1.69577e-06 + 1.58173e-06 1.46768e-06 1.35363e-06 1.23959e-06 1.12554e-06 + 1.0115e-06 8.9745e-07 7.83404e-07 6.69358e-07 4.76113e-07 + -3.47071e-07 -1.17025e-06 -1.99344e-06 -2.81662e-06 0.0783754 + 0.0500262 -0.0659563 -0.120914 0.0815957 0.0154255 0.00347177 + 0.000840357 0.000214582 6.54655e-05 3.91709e-05 8.07396e-06 + -4.44265e-07 1.74384e-05 -4.52725e-05 -0.119379 -0.147984 + -0.159247 -0.0824604 0.169014 0.177628 0.0758742 0.010558 + -0.0346506 -0.0710288 -0.0838952 -0.0599521 -0.034568 -0.0181615 + -0.00968034 -0.00547115 -0.00333511 -0.00232468 -0.00181159 + -0.00143841 -0.00116601 -0.000839755 -0.000569764 -0.000578683 + -0.000490551 -0.000411712 -0.000437859 -0.000408185 -0.000356644 + -0.000311332 -0.000269006 -0.000221396 -0.000210054 -0.0001923 + -0.000175122 -0.000161039 -0.0001428 -0.000126123 -0.000127893 + -8.14516e-05 -0.000120166 -0.000154909 -0.000112733 -8.40377e-05 + -7.11342e-05 -8.09538e-05 -9.77789e-05 -9.82402e-05 -7.73531e-05 + -5.28255e-05 -3.1096e-05 -1.87967e-05 -1.96552e-05 -4.16655e-05 + -5.77185e-05 -5.24142e-05 -2.83153e-05 -1.90012e-05 -1.54415e-05 + -2.52569e-05 -6.23747e-05 -0.000130543 -0.000149394 -0.000110886 + -4.35517e-05 -4.17084e-05 -3.98651e-05 -3.80218e-05 -3.61785e-05 + -3.43352e-05 -3.36249e-05 -3.32729e-05 -3.29208e-05 -3.25687e-05 + -3.22166e-05 -3.17143e-05 -3.10258e-05 -3.03372e-05 -2.96486e-05 + -2.89601e-05 -2.82715e-05 -2.75829e-05 -2.68944e-05 -2.62058e-05 + -2.55173e-05 -2.48287e-05 -2.43043e-05 -2.38159e-05 -2.33276e-05 + -2.28393e-05 -2.2351e-05 -2.18626e-05 -2.13743e-05 -2.0886e-05 + -2.03977e-05 -1.99093e-05 -1.945e-05 -1.91122e-05 -1.87744e-05 + -1.84366e-05 -1.80987e-05 -1.77609e-05 -1.74231e-05 -1.70853e-05 + -1.67474e-05 EOD @v[20].set(<<-'EOD') - 1.86175 1.99724 2.17266 2.48439 3.15933 3.85231 4.38091 - 4.69033 4.85034 4.92851 4.96453 4.98188 4.98736 4.991 4.99482 - 4.9973 4.96422 4.89989 4.83907 4.83151 4.90868 5.04854 5.06104 - 5.04571 5.03219 5.03025 5.02273 5.01707 5.0123 5.0087 5.00611 - 5.00429 5.00301 5.00211 5.00148 5.00103 5.00072 5.0005 5.00035 - 5.00024 5.00016 5.00011 5.00007 5.00005 5.00003 5.00001 - 4.99999 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 - 5 5 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 - 5 5 4.99981 5.10081 5.10903 4.98404 5.00999 5.14946 4.36501 - 2.23938 0.325144 0.00660272 -0.0102186 -0.0082401 -0.00556785 - -0.00374178 -0.00264763 -0.00202823 -0.0182241 -0.0169551 - -0.0150395 0.0103736 0.0877592 0.104382 0.0515938 0.0373818 - 0.0411547 0.0397009 0.0308946 0.0205793 0.0154037 0.0129191 - 0.0119327 0.011527 0.0124295 0.0161152 0.0161076 0.0145391 - 0.0144541 0.0139287 0.0129215 0.0117239 0.0105795 0.00942983 - 0.00827423 0.00718354 0.00619954 0.00532868 0.00456631 0.00390448 - 0.00333254 0.00284003 0.00241714 0.00205524 0.0017458 0.00148202 - 0.00125739 0.0010655 0.000902213 0.000763611 0.000646279 - 0.000547291 0.000463934 0.000393401 0.000332424 0.000280655 - 0.000236328 0.000199386 0.000167536 0.000141218 0.000118654 - 9.99559e-05 8.40479e-05 7.09694e-05 6.00188e-05 5.09786e-05 - 4.3502e-05 3.72191e-05 3.18114e-05 2.74071e-05 2.35539e-05 - 1.99967e-05 1.69871e-05 1.49449e-05 1.3451e-05 1.24492e-05 - 1.14256e-05 1.05669e-05 9.94487e-06 9.47514e-06 8.77318e-06 - 8.07123e-06 7.36927e-06 6.66731e-06 5.96536e-06 5.2634e-06 - 4.56144e-06 4.23044e-06 3.92649e-06 3.62254e-06 3.31858e-06 - 3.01463e-06 2.71068e-06 2.40673e-06 2.23063e-06 2.12082e-06 - 2.01102e-06 1.90121e-06 1.7914e-06 1.68159e-06 1.57178e-06 - 1.46197e-06 1.35216e-06 1.24235e-06 1.13255e-06 1.02274e-06 - 9.12929e-07 8.0312e-07 6.33171e-07 -1.51288e-08 -6.63428e-07 - -1.31173e-06 -1.96003e-06 0.0437517 0.0265689 -0.0515377 - -0.0658688 0.010727 -0.000511921 -8.36924e-05 2.13278e-05 - 1.45207e-05 4.54862e-06 -6.14726e-06 2.0062e-06 1.02709e-06 - 1.4152e-05 -3.08225e-05 -0.0166501 -0.0157139 -0.013957 - 0.0107537 0.0873717 0.111302 0.0454129 -0.00530142 -0.0468336 - -0.0790063 -0.0826944 -0.0534753 -0.0288705 -0.0149009 -0.00801592 - -0.0046342 -0.00291835 -0.00213019 -0.00170055 -0.001352 - -0.00110593 -0.000742655 -0.000532042 -0.000544742 -0.000479206 - -0.000407307 -0.000403575 -0.000366209 -0.000324161 -0.000286183 - -0.000247579 -0.000214281 -0.000203435 -0.000186896 -0.000171033 - -0.00015779 -0.000145259 -0.000128069 -0.000122647 -9.89398e-05 - -0.000114926 -0.000132195 -0.000107872 -8.91015e-05 -7.87996e-05 - -8.14061e-05 -8.9098e-05 -8.83368e-05 -7.6122e-05 -6.14668e-05 - -4.75402e-05 -3.81855e-05 -3.69696e-05 -4.78656e-05 -5.61346e-05 - -5.35007e-05 -4.1459e-05 -3.35411e-05 -2.52374e-05 -2.37479e-05 - -4.6406e-05 -9.41884e-05 -0.000109222 -8.52676e-05 -4.25166e-05 - -4.10125e-05 -3.95085e-05 -3.80045e-05 -3.65004e-05 -3.49964e-05 - -3.41627e-05 -3.3541e-05 -3.29193e-05 -3.22976e-05 -3.16758e-05 - -3.10334e-05 -3.03653e-05 -2.96971e-05 -2.9029e-05 -2.83609e-05 - -2.76928e-05 -2.70246e-05 -2.63565e-05 -2.56884e-05 -2.50203e-05 - -2.43521e-05 -2.38716e-05 -2.34324e-05 -2.29932e-05 -2.25539e-05 - -2.21147e-05 -2.16755e-05 -2.12362e-05 -2.0797e-05 -2.03578e-05 - -1.99186e-05 -1.95079e-05 -1.9217e-05 -1.8926e-05 -1.8635e-05 - -1.8344e-05 -1.8053e-05 -1.7762e-05 -1.74711e-05 -1.71801e-05 + 1.86175 1.99724 2.17266 2.48439 3.15933 3.85231 4.38091 + 4.69033 4.85034 4.92851 4.96453 4.98188 4.98736 4.991 4.99482 + 4.9973 4.96422 4.89989 4.83907 4.83151 4.90868 5.04854 5.06104 + 5.04571 5.03219 5.03025 5.02273 5.01707 5.0123 5.0087 5.00611 + 5.00429 5.00301 5.00211 5.00148 5.00103 5.00072 5.0005 5.00035 + 5.00024 5.00016 5.00011 5.00007 5.00005 5.00003 5.00001 + 4.99999 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 + 5 5 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 + 5 5 4.99981 5.10081 5.10903 4.98404 5.00999 5.14946 4.36501 + 2.23938 0.325144 0.00660272 -0.0102186 -0.0082401 -0.00556785 + -0.00374178 -0.00264763 -0.00202823 -0.0182241 -0.0169551 + -0.0150395 0.0103736 0.0877592 0.104382 0.0515938 0.0373818 + 0.0411547 0.0397009 0.0308946 0.0205793 0.0154037 0.0129191 + 0.0119327 0.011527 0.0124295 0.0161152 0.0161076 0.0145391 + 0.0144541 0.0139287 0.0129215 0.0117239 0.0105795 0.00942983 + 0.00827423 0.00718354 0.00619954 0.00532868 0.00456631 0.00390448 + 0.00333254 0.00284003 0.00241714 0.00205524 0.0017458 0.00148202 + 0.00125739 0.0010655 0.000902213 0.000763611 0.000646279 + 0.000547291 0.000463934 0.000393401 0.000332424 0.000280655 + 0.000236328 0.000199386 0.000167536 0.000141218 0.000118654 + 9.99559e-05 8.40479e-05 7.09694e-05 6.00188e-05 5.09786e-05 + 4.3502e-05 3.72191e-05 3.18114e-05 2.74071e-05 2.35539e-05 + 1.99967e-05 1.69871e-05 1.49449e-05 1.3451e-05 1.24492e-05 + 1.14256e-05 1.05669e-05 9.94487e-06 9.47514e-06 8.77318e-06 + 8.07123e-06 7.36927e-06 6.66731e-06 5.96536e-06 5.2634e-06 + 4.56144e-06 4.23044e-06 3.92649e-06 3.62254e-06 3.31858e-06 + 3.01463e-06 2.71068e-06 2.40673e-06 2.23063e-06 2.12082e-06 + 2.01102e-06 1.90121e-06 1.7914e-06 1.68159e-06 1.57178e-06 + 1.46197e-06 1.35216e-06 1.24235e-06 1.13255e-06 1.02274e-06 + 9.12929e-07 8.0312e-07 6.33171e-07 -1.51288e-08 -6.63428e-07 + -1.31173e-06 -1.96003e-06 0.0437517 0.0265689 -0.0515377 + -0.0658688 0.010727 -0.000511921 -8.36924e-05 2.13278e-05 + 1.45207e-05 4.54862e-06 -6.14726e-06 2.0062e-06 1.02709e-06 + 1.4152e-05 -3.08225e-05 -0.0166501 -0.0157139 -0.013957 + 0.0107537 0.0873717 0.111302 0.0454129 -0.00530142 -0.0468336 + -0.0790063 -0.0826944 -0.0534753 -0.0288705 -0.0149009 -0.00801592 + -0.0046342 -0.00291835 -0.00213019 -0.00170055 -0.001352 + -0.00110593 -0.000742655 -0.000532042 -0.000544742 -0.000479206 + -0.000407307 -0.000403575 -0.000366209 -0.000324161 -0.000286183 + -0.000247579 -0.000214281 -0.000203435 -0.000186896 -0.000171033 + -0.00015779 -0.000145259 -0.000128069 -0.000122647 -9.89398e-05 + -0.000114926 -0.000132195 -0.000107872 -8.91015e-05 -7.87996e-05 + -8.14061e-05 -8.9098e-05 -8.83368e-05 -7.6122e-05 -6.14668e-05 + -4.75402e-05 -3.81855e-05 -3.69696e-05 -4.78656e-05 -5.61346e-05 + -5.35007e-05 -4.1459e-05 -3.35411e-05 -2.52374e-05 -2.37479e-05 + -4.6406e-05 -9.41884e-05 -0.000109222 -8.52676e-05 -4.25166e-05 + -4.10125e-05 -3.95085e-05 -3.80045e-05 -3.65004e-05 -3.49964e-05 + -3.41627e-05 -3.3541e-05 -3.29193e-05 -3.22976e-05 -3.16758e-05 + -3.10334e-05 -3.03653e-05 -2.96971e-05 -2.9029e-05 -2.83609e-05 + -2.76928e-05 -2.70246e-05 -2.63565e-05 -2.56884e-05 -2.50203e-05 + -2.43521e-05 -2.38716e-05 -2.34324e-05 -2.29932e-05 -2.25539e-05 + -2.21147e-05 -2.16755e-05 -2.12362e-05 -2.0797e-05 -2.03578e-05 + -1.99186e-05 -1.95079e-05 -1.9217e-05 -1.8926e-05 -1.8635e-05 + -1.8344e-05 -1.8053e-05 -1.7762e-05 -1.74711e-05 -1.71801e-05 EOD @v[21].set(<<-'EOD') - 1.86175 1.73273 1.42016 1.02483 0.944013 0.274107 0.0823742 - 0.0379366 0.020816 0.0132952 0.00955525 0.00717008 0.00592286 - 0.00437379 0.00383557 0.00273694 -0.0037467 -0.0054191 -0.00131454 - 0.0112179 0.0133918 0.00519747 -0.00260113 -0.00252847 -0.00181292 - 0.000183398 -0.000667607 -0.000750747 -0.000594314 -0.000433904 - -0.000308985 -0.000217858 -0.000152926 -0.000107454 -7.54076e-05 - -5.2675e-05 -3.66299e-05 -2.54341e-05 -1.75095e-05 -1.18848e-05 - -7.97289e-06 -5.30239e-06 -3.53615e-06 -2.38504e-06 -2.40158e-06 - -3.84485e-06 -5.29435e-06 -2.57099e-06 1.95189e-06 3.55083e-06 - 2.06179e-06 5.72753e-07 3.30469e-07 3.40296e-07 3.60221e-07 - 4.86081e-07 6.1194e-07 7.37799e-07 8.63659e-07 9.89518e-07 - 9.21274e-07 7.22275e-07 5.23276e-07 3.24277e-07 1.25278e-07 - -5.59467e-08 -9.03265e-08 -1.24706e-07 -1.59086e-07 -1.93466e-07 - -2.27846e-07 -2.62226e-07 -2.96605e-07 -3.30985e-07 -3.65365e-07 - -3.99745e-07 -4.24266e-07 -3.82163e-07 -3.40061e-07 -2.97959e-07 - -2.55857e-07 -2.13755e-07 -1.71652e-07 -1.2955e-07 -8.7448e-08 - -4.53457e-08 -3.24353e-09 3.76901e-08 7.19937e-08 1.06297e-07 - 1.40601e-07 1.74904e-07 2.09208e-07 2.43512e-07 2.77815e-07 - 3.12119e-07 3.46422e-07 3.80726e-07 4.04507e-07 3.77191e-07 - 3.49876e-07 3.22561e-07 2.95246e-07 2.67931e-07 2.40616e-07 - 2.13301e-07 1.85986e-07 1.58671e-07 1.31356e-07 1.04041e-07 - 7.67256e-08 4.94105e-08 2.20955e-08 -5.21962e-09 -3.25347e-08 - -5.98498e-08 -8.71649e-08 -1.1448e-07 -1.41795e-07 -1.6911e-07 - 7.87893e-06 0.0114592 -0.0245712 -0.111637 0.0961324 1.61168 - 3.22343 4.20442 4.53535 4.83834 4.95464 4.98874 4.99746 - 4.99883 4.99948 4.99815 4.98431 4.99298 4.99718 5.01948 - 5.04749 5.008 4.98243 4.98985 4.99781 4.99887 4.99679 4.99616 - 4.99743 4.99859 4.99936 4.99972 5.00058 5.00123 5.0002 4.99945 - 4.99983 4.9998 4.99966 4.99958 4.99956 4.99956 4.99956 4.99958 - 4.99961 4.99965 4.99969 4.99973 4.99977 4.9998 4.99983 4.99985 - 4.99987 4.99989 4.99991 4.99992 4.99993 4.99994 4.99995 - 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00001 5.00001 - 5.00001 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5 5 5 4.99999 4.99998 4.99997 4.99996 5.01454 - 4.99566 4.96796 4.99819 5.03232 5.00034 4.99867 4.99937 - 4.99977 4.99992 4.99997 4.99999 5.00001 5.00021 4.99974 - 4.98462 4.99301 4.99723 5.01936 5.04807 5.00929 4.9789 4.97876 - 4.98244 4.9863 4.99575 5.0069 5.00863 5.00624 5.00357 5.0019 - 5.00098 5.00048 5.00025 5.00016 5.00011 5.00013 5.00009 - 4.99982 4.99994 5.00005 4.99994 4.99988 4.99989 4.99997 - 5.00003 5.00005 5.00002 5.00001 5.00001 5.00001 4.99993 - 4.99999 5 5.00021 4.99997 4.99981 5 5.00009 5.0001 5.00001 - 4.99991 4.9999 5 5.00011 5.00017 5.00018 5.00018 5.00014 - 5.00007 4.99999 4.9999 4.9999 5.00001 5.00016 5.00014 4.99999 - 4.99993 4.99999 5.00009 5.00007 5.00006 5.00004 5.00003 - 5.00001 5.00001 5 4.99999 4.99998 4.99997 4.99997 4.99997 - 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 - 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 - 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5 5 + 1.86175 1.73273 1.42016 1.02483 0.944013 0.274107 0.0823742 + 0.0379366 0.020816 0.0132952 0.00955525 0.00717008 0.00592286 + 0.00437379 0.00383557 0.00273694 -0.0037467 -0.0054191 -0.00131454 + 0.0112179 0.0133918 0.00519747 -0.00260113 -0.00252847 -0.00181292 + 0.000183398 -0.000667607 -0.000750747 -0.000594314 -0.000433904 + -0.000308985 -0.000217858 -0.000152926 -0.000107454 -7.54076e-05 + -5.2675e-05 -3.66299e-05 -2.54341e-05 -1.75095e-05 -1.18848e-05 + -7.97289e-06 -5.30239e-06 -3.53615e-06 -2.38504e-06 -2.40158e-06 + -3.84485e-06 -5.29435e-06 -2.57099e-06 1.95189e-06 3.55083e-06 + 2.06179e-06 5.72753e-07 3.30469e-07 3.40296e-07 3.60221e-07 + 4.86081e-07 6.1194e-07 7.37799e-07 8.63659e-07 9.89518e-07 + 9.21274e-07 7.22275e-07 5.23276e-07 3.24277e-07 1.25278e-07 + -5.59467e-08 -9.03265e-08 -1.24706e-07 -1.59086e-07 -1.93466e-07 + -2.27846e-07 -2.62226e-07 -2.96605e-07 -3.30985e-07 -3.65365e-07 + -3.99745e-07 -4.24266e-07 -3.82163e-07 -3.40061e-07 -2.97959e-07 + -2.55857e-07 -2.13755e-07 -1.71652e-07 -1.2955e-07 -8.7448e-08 + -4.53457e-08 -3.24353e-09 3.76901e-08 7.19937e-08 1.06297e-07 + 1.40601e-07 1.74904e-07 2.09208e-07 2.43512e-07 2.77815e-07 + 3.12119e-07 3.46422e-07 3.80726e-07 4.04507e-07 3.77191e-07 + 3.49876e-07 3.22561e-07 2.95246e-07 2.67931e-07 2.40616e-07 + 2.13301e-07 1.85986e-07 1.58671e-07 1.31356e-07 1.04041e-07 + 7.67256e-08 4.94105e-08 2.20955e-08 -5.21962e-09 -3.25347e-08 + -5.98498e-08 -8.71649e-08 -1.1448e-07 -1.41795e-07 -1.6911e-07 + 7.87893e-06 0.0114592 -0.0245712 -0.111637 0.0961324 1.61168 + 3.22343 4.20442 4.53535 4.83834 4.95464 4.98874 4.99746 + 4.99883 4.99948 4.99815 4.98431 4.99298 4.99718 5.01948 + 5.04749 5.008 4.98243 4.98985 4.99781 4.99887 4.99679 4.99616 + 4.99743 4.99859 4.99936 4.99972 5.00058 5.00123 5.0002 4.99945 + 4.99983 4.9998 4.99966 4.99958 4.99956 4.99956 4.99956 4.99958 + 4.99961 4.99965 4.99969 4.99973 4.99977 4.9998 4.99983 4.99985 + 4.99987 4.99989 4.99991 4.99992 4.99993 4.99994 4.99995 + 4.99996 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00001 5.00001 + 5.00001 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5 5 5 4.99999 4.99998 4.99997 4.99996 5.01454 + 4.99566 4.96796 4.99819 5.03232 5.00034 4.99867 4.99937 + 4.99977 4.99992 4.99997 4.99999 5.00001 5.00021 4.99974 + 4.98462 4.99301 4.99723 5.01936 5.04807 5.00929 4.9789 4.97876 + 4.98244 4.9863 4.99575 5.0069 5.00863 5.00624 5.00357 5.0019 + 5.00098 5.00048 5.00025 5.00016 5.00011 5.00013 5.00009 + 4.99982 4.99994 5.00005 4.99994 4.99988 4.99989 4.99997 + 5.00003 5.00005 5.00002 5.00001 5.00001 5.00001 4.99993 + 4.99999 5 5.00021 4.99997 4.99981 5 5.00009 5.0001 5.00001 + 4.99991 4.9999 5 5.00011 5.00017 5.00018 5.00018 5.00014 + 5.00007 4.99999 4.9999 4.9999 5.00001 5.00016 5.00014 4.99999 + 4.99993 4.99999 5.00009 5.00007 5.00006 5.00004 5.00003 + 5.00001 5.00001 5 4.99999 4.99998 4.99997 4.99997 4.99997 + 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 + 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 + 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5 5 EOD @v[22].set(<<-'EOD') - 7.10441e-10 0.00107105 0.000637109 -0.00236346 -0.018079 - -0.0120077 -0.00217059 0.00266679 0.00403383 0.00403836 - 0.00356705 0.00303303 0.00244716 0.00198586 0.0016855 0.00136497 - -3.96022e-05 -0.000367409 -3.77079e-05 0.00194085 0.00506964 - -0.0400214 -0.0402572 0.0524434 0.286234 0.803011 1.44795 - 2.02473 2.54768 3.02748 3.4415 3.78287 4.09667 4.35152 4.53987 - 4.67614 4.77407 4.84319 4.89227 4.92702 4.95119 4.96764 - 4.97846 4.98557 4.98982 4.99209 4.99371 4.99569 4.99727 - 4.99802 4.99834 4.99867 4.99892 4.99915 4.99936 4.99939 - 4.99943 4.99946 4.9995 4.99953 4.99957 4.9996 4.99963 4.99967 - 4.9997 4.99973 4.99974 4.99975 4.99976 4.99977 4.99978 4.9998 - 4.99981 4.99982 4.99983 4.99984 4.99985 4.99986 4.99986 - 4.99986 4.99987 4.99987 4.99988 4.99988 4.99989 4.99989 - 4.9999 4.9999 4.9999 4.9999 4.99991 4.99991 4.99991 4.99991 - 4.99992 4.99992 4.99992 4.99992 4.99993 4.99993 4.99993 - 4.99993 4.99993 4.99993 4.99993 4.99993 4.99994 4.99994 - 4.99994 4.99994 4.99994 4.99994 4.99994 4.99994 4.99995 - 4.99995 4.99995 4.99995 4.99995 4.99995 4.99995 5.00145 - 5.00659 5.01209 5.01931 5.00279 4.99273 4.99217 4.99295 - 4.99471 4.99594 4.99696 4.9978 4.99844 4.99891 4.99924 4.99635 - 4.99699 4.99813 5.00068 5.00307 5.0588 4.96365 4.54012 3.6307 - 2.35176 1.0322 0.354379 0.115986 0.0435668 0.0245112 0.020786 - 0.0164656 0.0118409 0.00849698 0.00597078 0.0040105 0.0026076 - 0.0016597 0.00118185 0.00121067 0.00153587 0.00174836 0.00136519 - -0.000189116 -0.00315555 -0.00646603 -0.00898042 -0.010203 - -0.0110896 -0.0123764 -0.00953841 -0.00225795 0.000818314 - 0.00152252 0.00150269 0.00119025 0.000767068 0.000308852 - -3.79272e-05 -0.00019691 -0.000186642 -9.73653e-05 -8.49784e-06 - 2.04147e-05 -9.91086e-06 -1.55959e-05 -1.80499e-05 -1.77097e-05 - -1.51548e-05 -1.1978e-05 -9.84916e-06 -1.29728e-05 -1.67235e-05 - -1.74153e-05 -1.39958e-05 -5.92272e-06 -8.08216e-06 -1.53077e-05 - -2.92531e-05 -3.91049e-05 -2.98935e-05 -7.32122e-06 3.18534e-05 - 4.39134e-05 4.18753e-05 3.22759e-05 1.86766e-05 1.58432e-05 - 1.30098e-05 1.01765e-05 7.34312e-06 4.50975e-06 1.67639e-06 - -1.15697e-06 -1.23877e-06 -1.11991e-06 -1.00106e-06 -8.82208e-07 - -7.63355e-07 -6.44502e-07 -5.2565e-07 -4.29318e-07 -3.44661e-07 - -2.60004e-07 -1.75347e-07 -9.06904e-08 -6.03349e-09 7.86234e-08 - 1.6328e-07 2.47937e-07 3.32594e-07 4.17251e-07 5.01908e-07 - 5.86565e-07 6.71222e-07 7.36123e-07 6.43886e-07 5.5165e-07 - 4.59414e-07 3.67178e-07 0.000334759 -4.60833e-05 -0.00106139 - -0.00166624 0.000859563 0.00102606 0.00410037 0.00419931 - 0.00518997 0.00459791 0.00503125 0.00523877 0.00452158 0.00339924 - 0.00233399 0.000876915 0.000546439 0.000444299 0.000983968 - 0.00119304 -0.0429422 -0.0403983 0.0534896 0.288013 0.807345 - 1.44247 2.03448 2.57021 3.05049 3.47332 3.8131 4.1009 4.34677 - 4.53512 4.67127 4.76531 4.82526 4.86593 4.89586 4.91904 - 4.93806 4.95348 4.96597 4.97629 4.9843 4.98983 4.99335 4.9957 - 4.99741 4.99864 4.99946 4.99994 5.00047 5.00073 5.00086 - 5.00092 5.00094 5.00091 5.00087 5.00081 5.00074 5.00067 - 5.00059 5.00052 5.00046 5.0004 5.00034 5.0003 5.00026 5.00022 - 5.00019 5.00016 5.00014 5.00012 5.0001 5.00009 5.00007 5.00006 - 5.00006 5.00005 5.00004 5.00004 5.00004 5.00003 5.00003 - 5.00003 5.00002 5.00002 5.00002 5.00002 5.00001 5.00001 - 5.00001 5.00001 5.00001 5 5 5 5 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5.00001 5.00001 - 5.00001 5.00001 5.00002 5.00002 + 7.10441e-10 0.00107105 0.000637109 -0.00236346 -0.018079 + -0.0120077 -0.00217059 0.00266679 0.00403383 0.00403836 + 0.00356705 0.00303303 0.00244716 0.00198586 0.0016855 0.00136497 + -3.96022e-05 -0.000367409 -3.77079e-05 0.00194085 0.00506964 + -0.0400214 -0.0402572 0.0524434 0.286234 0.803011 1.44795 + 2.02473 2.54768 3.02748 3.4415 3.78287 4.09667 4.35152 4.53987 + 4.67614 4.77407 4.84319 4.89227 4.92702 4.95119 4.96764 + 4.97846 4.98557 4.98982 4.99209 4.99371 4.99569 4.99727 + 4.99802 4.99834 4.99867 4.99892 4.99915 4.99936 4.99939 + 4.99943 4.99946 4.9995 4.99953 4.99957 4.9996 4.99963 4.99967 + 4.9997 4.99973 4.99974 4.99975 4.99976 4.99977 4.99978 4.9998 + 4.99981 4.99982 4.99983 4.99984 4.99985 4.99986 4.99986 + 4.99986 4.99987 4.99987 4.99988 4.99988 4.99989 4.99989 + 4.9999 4.9999 4.9999 4.9999 4.99991 4.99991 4.99991 4.99991 + 4.99992 4.99992 4.99992 4.99992 4.99993 4.99993 4.99993 + 4.99993 4.99993 4.99993 4.99993 4.99993 4.99994 4.99994 + 4.99994 4.99994 4.99994 4.99994 4.99994 4.99994 4.99995 + 4.99995 4.99995 4.99995 4.99995 4.99995 4.99995 5.00145 + 5.00659 5.01209 5.01931 5.00279 4.99273 4.99217 4.99295 + 4.99471 4.99594 4.99696 4.9978 4.99844 4.99891 4.99924 4.99635 + 4.99699 4.99813 5.00068 5.00307 5.0588 4.96365 4.54012 3.6307 + 2.35176 1.0322 0.354379 0.115986 0.0435668 0.0245112 0.020786 + 0.0164656 0.0118409 0.00849698 0.00597078 0.0040105 0.0026076 + 0.0016597 0.00118185 0.00121067 0.00153587 0.00174836 0.00136519 + -0.000189116 -0.00315555 -0.00646603 -0.00898042 -0.010203 + -0.0110896 -0.0123764 -0.00953841 -0.00225795 0.000818314 + 0.00152252 0.00150269 0.00119025 0.000767068 0.000308852 + -3.79272e-05 -0.00019691 -0.000186642 -9.73653e-05 -8.49784e-06 + 2.04147e-05 -9.91086e-06 -1.55959e-05 -1.80499e-05 -1.77097e-05 + -1.51548e-05 -1.1978e-05 -9.84916e-06 -1.29728e-05 -1.67235e-05 + -1.74153e-05 -1.39958e-05 -5.92272e-06 -8.08216e-06 -1.53077e-05 + -2.92531e-05 -3.91049e-05 -2.98935e-05 -7.32122e-06 3.18534e-05 + 4.39134e-05 4.18753e-05 3.22759e-05 1.86766e-05 1.58432e-05 + 1.30098e-05 1.01765e-05 7.34312e-06 4.50975e-06 1.67639e-06 + -1.15697e-06 -1.23877e-06 -1.11991e-06 -1.00106e-06 -8.82208e-07 + -7.63355e-07 -6.44502e-07 -5.2565e-07 -4.29318e-07 -3.44661e-07 + -2.60004e-07 -1.75347e-07 -9.06904e-08 -6.03349e-09 7.86234e-08 + 1.6328e-07 2.47937e-07 3.32594e-07 4.17251e-07 5.01908e-07 + 5.86565e-07 6.71222e-07 7.36123e-07 6.43886e-07 5.5165e-07 + 4.59414e-07 3.67178e-07 0.000334759 -4.60833e-05 -0.00106139 + -0.00166624 0.000859563 0.00102606 0.00410037 0.00419931 + 0.00518997 0.00459791 0.00503125 0.00523877 0.00452158 0.00339924 + 0.00233399 0.000876915 0.000546439 0.000444299 0.000983968 + 0.00119304 -0.0429422 -0.0403983 0.0534896 0.288013 0.807345 + 1.44247 2.03448 2.57021 3.05049 3.47332 3.8131 4.1009 4.34677 + 4.53512 4.67127 4.76531 4.82526 4.86593 4.89586 4.91904 + 4.93806 4.95348 4.96597 4.97629 4.9843 4.98983 4.99335 4.9957 + 4.99741 4.99864 4.99946 4.99994 5.00047 5.00073 5.00086 + 5.00092 5.00094 5.00091 5.00087 5.00081 5.00074 5.00067 + 5.00059 5.00052 5.00046 5.0004 5.00034 5.0003 5.00026 5.00022 + 5.00019 5.00016 5.00014 5.00012 5.0001 5.00009 5.00007 5.00006 + 5.00006 5.00005 5.00004 5.00004 5.00004 5.00003 5.00003 + 5.00003 5.00002 5.00002 5.00002 5.00002 5.00001 5.00001 + 5.00001 5.00001 5.00001 5 5 5 5 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5.00001 5.00001 + 5.00001 5.00001 5.00002 5.00002 EOD @v[23].set(<<-'EOD') - 5 5.00284 5.01266 5.01895 4.98936 4.99575 4.99217 4.99545 - 4.99775 4.99894 4.99946 4.99968 4.99975 4.99977 4.99986 - 4.9999 4.99528 4.99808 5.00039 5.00392 5.00512 4.99985 4.99863 - 4.99942 4.99992 5.00017 4.99897 4.99803 4.99784 4.99739 - 4.99883 5.00365 5.00298 5.00133 5.00048 5.00019 5.00008 - 5.00005 5.00004 5.00003 5.00002 5.00002 5.00001 5.00001 - 5.00001 5.00001 5.00001 5 5 4.99999 4.99997 4.99995 4.99996 - 4.99998 5 5.00001 5.00001 5.00002 5.00002 5.00003 5.00003 - 5.00002 5.00002 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99998 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 - 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5 5 5 5 5 5 5 5.00217 5.00108 4.99547 4.99658 5.00667 - 4.99641 4.99532 4.99938 5.00328 5.00222 5.00114 5.00052 - 5.00024 5.00011 5.00009 4.99285 4.99591 4.99897 5.00403 - 5.00786 5.00318 4.99942 4.9992 4.99949 5.001 5.00408 5.00319 - 5.00063 4.99995 5.00014 4.99982 4.99832 4.99838 4.99865 - 4.99912 4.99836 4.99735 4.99606 4.99814 5.00958 5.02973 - 5.05293 5.06103 4.99342 4.80726 4.50744 4.07509 3.41358 - 2.37924 1.03194 0.261552 0.142392 0.0904482 0.0555071 0.0322869 - 0.018289 0.0113802 0.00875182 0.00757055 0.00629906 0.00523 - 0.00403349 0.0031953 0.00280864 0.00286119 0.00250389 0.00202815 - 0.001723 0.00147312 0.0012411 0.00104401 0.000886204 0.000758277 - 0.000651915 0.00056348 0.000487966 0.000424048 0.000365613 - 0.000308178 0.000258725 0.000228061 0.000207976 0.000198491 - 0.00018518 0.000172716 0.000163197 0.000155007 0.000141734 - 0.000128461 0.000115188 0.000101915 8.86417e-05 7.53686e-05 - 6.20956e-05 5.69164e-05 5.23275e-05 4.77385e-05 4.31495e-05 - 3.85605e-05 3.39716e-05 2.93826e-05 2.69449e-05 2.56224e-05 - 2.42999e-05 2.29774e-05 2.16549e-05 2.03324e-05 1.90099e-05 - 1.76873e-05 1.63648e-05 1.50423e-05 1.37198e-05 1.23973e-05 - 1.10748e-05 9.75232e-06 8.48447e-06 7.65129e-06 6.81811e-06 - 5.98494e-06 5.15176e-06 0.00056893 -0.00787906 -0.0217381 - -0.0370066 -0.00770505 0.00659312 0.00975477 0.00949456 - 0.00777552 0.00655645 0.00568776 0.00508782 0.00458121 0.00410187 - 0.00365665 0.0015121 0.00160863 0.00263181 0.00638941 0.00772607 - 0.00225583 0.0010843 0.000882939 0.000801563 0.00075632 - 0.000554992 0.000435131 0.0003474 0.000217667 0.000491602 - 0.0012267 0.00250446 0.000212058 -0.0174972 -0.0527527 -0.0479071 - 0.194908 1.45838 3.40677 4.49242 4.86894 4.97215 5.01218 - 5.04342 5.06228 5.03069 4.87169 4.57056 4.11523 3.38264 - 2.19691 0.715839 0.172818 0.102162 0.0627162 0.0363388 0.020289 - 0.0119414 0.00826608 0.0066417 0.00549092 0.00492505 0.00439443 - 0.0037156 0.00306471 0.00247451 0.00195965 0.0014822 0.0010815 - 0.000904464 0.0010514 0.00152308 0.00120752 0.000228447 - -0.00102833 -0.00116644 -0.00042067 4.78758e-05 5.09599e-05 - -4.45756e-05 -3.22966e-06 3.81163e-05 7.94622e-05 0.000120808 - 0.000162154 0.000161895 0.000148481 0.000135068 0.000121654 - 0.000108241 9.81453e-05 9.2164e-05 8.61827e-05 8.02014e-05 - 7.42201e-05 6.82388e-05 6.22576e-05 5.62763e-05 5.0295e-05 - 4.43137e-05 3.83324e-05 3.54323e-05 3.321e-05 3.09877e-05 - 2.87654e-05 2.65431e-05 2.43209e-05 2.20986e-05 1.98763e-05 - 1.7654e-05 1.54317e-05 1.34612e-05 1.25441e-05 1.1627e-05 - 1.07099e-05 9.79276e-06 8.87564e-06 7.95851e-06 7.04139e-06 - 6.12427e-06 + 5 5.00284 5.01266 5.01895 4.98936 4.99575 4.99217 4.99545 + 4.99775 4.99894 4.99946 4.99968 4.99975 4.99977 4.99986 + 4.9999 4.99528 4.99808 5.00039 5.00392 5.00512 4.99985 4.99863 + 4.99942 4.99992 5.00017 4.99897 4.99803 4.99784 4.99739 + 4.99883 5.00365 5.00298 5.00133 5.00048 5.00019 5.00008 + 5.00005 5.00004 5.00003 5.00002 5.00002 5.00001 5.00001 + 5.00001 5.00001 5.00001 5 5 4.99999 4.99997 4.99995 4.99996 + 4.99998 5 5.00001 5.00001 5.00002 5.00002 5.00003 5.00003 + 5.00002 5.00002 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99998 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00002 + 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5 5 5 5 5 5 5 5.00217 5.00108 4.99547 4.99658 5.00667 + 4.99641 4.99532 4.99938 5.00328 5.00222 5.00114 5.00052 + 5.00024 5.00011 5.00009 4.99285 4.99591 4.99897 5.00403 + 5.00786 5.00318 4.99942 4.9992 4.99949 5.001 5.00408 5.00319 + 5.00063 4.99995 5.00014 4.99982 4.99832 4.99838 4.99865 + 4.99912 4.99836 4.99735 4.99606 4.99814 5.00958 5.02973 + 5.05293 5.06103 4.99342 4.80726 4.50744 4.07509 3.41358 + 2.37924 1.03194 0.261552 0.142392 0.0904482 0.0555071 0.0322869 + 0.018289 0.0113802 0.00875182 0.00757055 0.00629906 0.00523 + 0.00403349 0.0031953 0.00280864 0.00286119 0.00250389 0.00202815 + 0.001723 0.00147312 0.0012411 0.00104401 0.000886204 0.000758277 + 0.000651915 0.00056348 0.000487966 0.000424048 0.000365613 + 0.000308178 0.000258725 0.000228061 0.000207976 0.000198491 + 0.00018518 0.000172716 0.000163197 0.000155007 0.000141734 + 0.000128461 0.000115188 0.000101915 8.86417e-05 7.53686e-05 + 6.20956e-05 5.69164e-05 5.23275e-05 4.77385e-05 4.31495e-05 + 3.85605e-05 3.39716e-05 2.93826e-05 2.69449e-05 2.56224e-05 + 2.42999e-05 2.29774e-05 2.16549e-05 2.03324e-05 1.90099e-05 + 1.76873e-05 1.63648e-05 1.50423e-05 1.37198e-05 1.23973e-05 + 1.10748e-05 9.75232e-06 8.48447e-06 7.65129e-06 6.81811e-06 + 5.98494e-06 5.15176e-06 0.00056893 -0.00787906 -0.0217381 + -0.0370066 -0.00770505 0.00659312 0.00975477 0.00949456 + 0.00777552 0.00655645 0.00568776 0.00508782 0.00458121 0.00410187 + 0.00365665 0.0015121 0.00160863 0.00263181 0.00638941 0.00772607 + 0.00225583 0.0010843 0.000882939 0.000801563 0.00075632 + 0.000554992 0.000435131 0.0003474 0.000217667 0.000491602 + 0.0012267 0.00250446 0.000212058 -0.0174972 -0.0527527 -0.0479071 + 0.194908 1.45838 3.40677 4.49242 4.86894 4.97215 5.01218 + 5.04342 5.06228 5.03069 4.87169 4.57056 4.11523 3.38264 + 2.19691 0.715839 0.172818 0.102162 0.0627162 0.0363388 0.020289 + 0.0119414 0.00826608 0.0066417 0.00549092 0.00492505 0.00439443 + 0.0037156 0.00306471 0.00247451 0.00195965 0.0014822 0.0010815 + 0.000904464 0.0010514 0.00152308 0.00120752 0.000228447 + -0.00102833 -0.00116644 -0.00042067 4.78758e-05 5.09599e-05 + -4.45756e-05 -3.22966e-06 3.81163e-05 7.94622e-05 0.000120808 + 0.000162154 0.000161895 0.000148481 0.000135068 0.000121654 + 0.000108241 9.81453e-05 9.2164e-05 8.61827e-05 8.02014e-05 + 7.42201e-05 6.82388e-05 6.22576e-05 5.62763e-05 5.0295e-05 + 4.43137e-05 3.83324e-05 3.54323e-05 3.321e-05 3.09877e-05 + 2.87654e-05 2.65431e-05 2.43209e-05 2.20986e-05 1.98763e-05 + 1.7654e-05 1.54317e-05 1.34612e-05 1.25441e-05 1.1627e-05 + 1.07099e-05 9.79276e-06 8.87564e-06 7.95851e-06 7.04139e-06 + 6.12427e-06 EOD @v[24].set(<<-'EOD') - 5 5.01099 5.00866 4.97845 4.92369 4.9273 4.97413 4.9929 - 4.99826 4.99958 4.99978 5.00005 4.99968 4.99959 5.00014 - 4.99979 4.99914 4.99982 5.00023 5.00295 5.00664 4.99854 - 4.99647 5.00438 5.01722 5.03681 5.04766 5.04799 5.04867 - 5.04873 5.04685 5.04413 5.0367 5.02505 5.01726 5.01183 5.00806 - 5.00549 5.00371 5.00246 5.00162 5.00105 5.00069 5.00045 - 5.00031 5.00024 5.00019 5.00012 5.00007 5.00004 5.00001 - 4.99998 4.99999 4.99999 5 5.00001 5.00001 5.00002 5.00002 - 5.00003 5.00003 5.00003 5.00002 5.00002 5.00001 5.00001 - 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5.00418 4.99953 4.99152 - 4.99807 5.00497 5.00112 5.00055 5.00038 5.00018 5.00006 - 5.00006 5.00007 5.00006 5.00004 5.00004 4.99853 4.99945 - 4.99998 5.00304 5.00935 5.00742 4.99181 4.97421 4.93603 - 4.8853 4.8927 4.93984 4.97458 4.99039 4.99614 4.99801 4.99851 - 4.99869 4.99924 5.00108 5.00181 5.00119 5.00059 5.00031 - 5.00022 5.00018 5.00011 5.00001 5.00006 4.99981 4.99977 - 4.99982 5.00012 4.99993 5.00008 5.00043 5.00048 5.00024 - 5.00008 4.99984 4.99993 5.00011 4.99996 4.9998 4.99977 4.9998 - 4.99993 5.00008 5.00011 5.00002 4.99995 4.99989 4.99993 - 5 5.00007 5.00009 4.99994 4.99977 4.9997 4.99975 4.99996 - 4.99996 4.99988 4.9997 4.99952 4.9995 4.99956 4.99973 4.99988 - 5.00005 5.00025 5.00042 5.00036 5.00031 5.00025 5.0002 5.00014 - 5.00009 5.00003 5.00002 5.00001 5.00001 5 4.99999 4.99998 - 4.99998 4.99997 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5.00284 - 5.00442 5.00381 4.98997 4.99092 5.00733 5.07791 4.98237 - 4.86434 4.76835 4.74067 4.79278 4.85094 4.90068 4.93603 - 4.95698 4.96984 4.97856 4.98869 4.99904 5.0005 4.99524 5.00181 - 5.01878 5.05177 5.07986 4.98917 4.56217 3.68 2.3539 1.18541 - 0.505772 0.221044 0.115287 0.0760938 0.0589194 0.0476784 - 0.0457213 0.0412911 0.033889 0.0259741 0.0191452 0.0139018 - 0.0100235 0.00711788 0.00497657 0.00349368 0.00250021 0.00176179 - 0.00121843 0.000838368 0.000582711 0.000423458 0.000294608 - 0.000201251 0.000133748 8.6227e-05 5.44252e-05 3.30514e-05 - 1.93926e-05 1.09814e-05 5.29857e-06 1.92247e-06 3.08708e-07 - -3.74311e-07 -6.11121e-07 -7.27807e-07 -4.87604e-07 -4.80493e-07 - -9.15925e-07 -2.03774e-06 -4.01128e-06 -2.46644e-06 2.10626e-06 - 8.22422e-06 1.04922e-05 9.83047e-06 7.27106e-06 3.29654e-06 - -2.06736e-06 -2.18019e-06 -2.29303e-06 -2.40586e-06 -2.51869e-06 - -2.63153e-06 -2.24615e-06 -1.70325e-06 -1.16036e-06 -6.17468e-07 - -7.45754e-08 2.45198e-07 2.88285e-07 3.31373e-07 3.7446e-07 - 4.17548e-07 4.60635e-07 5.03723e-07 5.4681e-07 5.89898e-07 - 6.32985e-07 6.76073e-07 6.19054e-07 5.4001e-07 4.60967e-07 - 3.81923e-07 3.02879e-07 2.23836e-07 1.44792e-07 6.57488e-08 - -1.32948e-08 -9.23383e-08 -1.6698e-07 -2.23206e-07 -2.79432e-07 - -3.35658e-07 -3.91884e-07 -4.48109e-07 -5.04335e-07 -5.60561e-07 - -6.16787e-07 + 5 5.01099 5.00866 4.97845 4.92369 4.9273 4.97413 4.9929 + 4.99826 4.99958 4.99978 5.00005 4.99968 4.99959 5.00014 + 4.99979 4.99914 4.99982 5.00023 5.00295 5.00664 4.99854 + 4.99647 5.00438 5.01722 5.03681 5.04766 5.04799 5.04867 + 5.04873 5.04685 5.04413 5.0367 5.02505 5.01726 5.01183 5.00806 + 5.00549 5.00371 5.00246 5.00162 5.00105 5.00069 5.00045 + 5.00031 5.00024 5.00019 5.00012 5.00007 5.00004 5.00001 + 4.99998 4.99999 4.99999 5 5.00001 5.00001 5.00002 5.00002 + 5.00003 5.00003 5.00003 5.00002 5.00002 5.00001 5.00001 + 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 5 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5.00418 4.99953 4.99152 + 4.99807 5.00497 5.00112 5.00055 5.00038 5.00018 5.00006 + 5.00006 5.00007 5.00006 5.00004 5.00004 4.99853 4.99945 + 4.99998 5.00304 5.00935 5.00742 4.99181 4.97421 4.93603 + 4.8853 4.8927 4.93984 4.97458 4.99039 4.99614 4.99801 4.99851 + 4.99869 4.99924 5.00108 5.00181 5.00119 5.00059 5.00031 + 5.00022 5.00018 5.00011 5.00001 5.00006 4.99981 4.99977 + 4.99982 5.00012 4.99993 5.00008 5.00043 5.00048 5.00024 + 5.00008 4.99984 4.99993 5.00011 4.99996 4.9998 4.99977 4.9998 + 4.99993 5.00008 5.00011 5.00002 4.99995 4.99989 4.99993 + 5 5.00007 5.00009 4.99994 4.99977 4.9997 4.99975 4.99996 + 4.99996 4.99988 4.9997 4.99952 4.9995 4.99956 4.99973 4.99988 + 5.00005 5.00025 5.00042 5.00036 5.00031 5.00025 5.0002 5.00014 + 5.00009 5.00003 5.00002 5.00001 5.00001 5 4.99999 4.99998 + 4.99998 4.99997 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5.00284 + 5.00442 5.00381 4.98997 4.99092 5.00733 5.07791 4.98237 + 4.86434 4.76835 4.74067 4.79278 4.85094 4.90068 4.93603 + 4.95698 4.96984 4.97856 4.98869 4.99904 5.0005 4.99524 5.00181 + 5.01878 5.05177 5.07986 4.98917 4.56217 3.68 2.3539 1.18541 + 0.505772 0.221044 0.115287 0.0760938 0.0589194 0.0476784 + 0.0457213 0.0412911 0.033889 0.0259741 0.0191452 0.0139018 + 0.0100235 0.00711788 0.00497657 0.00349368 0.00250021 0.00176179 + 0.00121843 0.000838368 0.000582711 0.000423458 0.000294608 + 0.000201251 0.000133748 8.6227e-05 5.44252e-05 3.30514e-05 + 1.93926e-05 1.09814e-05 5.29857e-06 1.92247e-06 3.08708e-07 + -3.74311e-07 -6.11121e-07 -7.27807e-07 -4.87604e-07 -4.80493e-07 + -9.15925e-07 -2.03774e-06 -4.01128e-06 -2.46644e-06 2.10626e-06 + 8.22422e-06 1.04922e-05 9.83047e-06 7.27106e-06 3.29654e-06 + -2.06736e-06 -2.18019e-06 -2.29303e-06 -2.40586e-06 -2.51869e-06 + -2.63153e-06 -2.24615e-06 -1.70325e-06 -1.16036e-06 -6.17468e-07 + -7.45754e-08 2.45198e-07 2.88285e-07 3.31373e-07 3.7446e-07 + 4.17548e-07 4.60635e-07 5.03723e-07 5.4681e-07 5.89898e-07 + 6.32985e-07 6.76073e-07 6.19054e-07 5.4001e-07 4.60967e-07 + 3.81923e-07 3.02879e-07 2.23836e-07 1.44792e-07 6.57488e-08 + -1.32948e-08 -9.23383e-08 -1.6698e-07 -2.23206e-07 -2.79432e-07 + -3.35658e-07 -3.91884e-07 -4.48109e-07 -5.04335e-07 -5.60561e-07 + -6.16787e-07 EOD @v[25].set(<<-'EOD') - 1.34824 1.35838 1.36465 1.34675 1.29167 1.23161 1.2201 1.2185 - 1.2181 1.21798 1.21793 1.21788 1.21785 1.21782 1.21779 1.21776 - 1.21655 1.21656 1.21669 1.21871 1.22421 1.22247 1.21858 - 1.2228 1.23803 1.27737 1.10647 0.395248 0.0600669 0.027687 - 0.0192374 0.015425 0.0130881 0.00977445 0.00696598 0.00491122 - 0.00341952 0.00237078 0.00162339 0.00109178 0.000726647 - 0.000478886 0.00031568 0.000207902 0.000143494 0.000109768 - 8.62987e-05 5.69775e-05 3.36547e-05 2.30356e-05 1.86108e-05 - 1.41861e-05 1.08293e-05 7.68835e-06 4.79593e-06 4.51019e-06 - 4.22444e-06 3.9387e-06 3.65295e-06 3.36721e-06 3.04559e-06 - 2.69981e-06 2.35403e-06 2.00825e-06 1.66247e-06 1.34508e-06 - 1.26225e-06 1.17941e-06 1.09657e-06 1.01373e-06 9.30893e-07 - 8.48054e-07 7.65216e-07 6.82378e-07 5.9954e-07 5.16702e-07 - 4.37489e-07 3.82774e-07 3.2806e-07 2.73346e-07 2.18632e-07 - 1.63917e-07 1.09203e-07 5.4489e-08 -2.2523e-10 -5.49395e-08 - -1.09654e-07 -1.52862e-07 -1.3079e-07 -1.08718e-07 -8.6646e-08 - -6.45739e-08 -4.25019e-08 -2.04298e-08 1.64229e-09 2.37144e-08 - 4.57864e-08 6.78585e-08 8.71693e-08 9.30725e-08 9.89758e-08 - 1.04879e-07 1.10782e-07 1.16685e-07 1.22589e-07 1.28492e-07 - 1.34395e-07 1.40298e-07 1.46201e-07 1.52105e-07 1.58008e-07 - 1.63911e-07 1.69814e-07 1.75718e-07 1.81621e-07 1.87524e-07 - 1.93427e-07 1.9933e-07 2.05234e-07 2.11137e-07 2.19788e-07 - 0.000393944 -0.000218983 -0.00105784 0.00172403 -0.00027134 - -0.000204147 8.79968e-06 5.93762e-05 5.83554e-05 4.13815e-05 - 3.71369e-05 3.03372e-05 2.25336e-05 1.5986e-05 1.07284e-05 - -7.5239e-05 5.60593e-05 6.97571e-05 0.000667617 0.000960856 - 0.00131749 -0.00759564 -0.0217897 -0.0450321 -0.076646 -0.128569 - -0.186391 -0.202175 -0.206953 -0.2082 -0.208416 -0.208669 - -0.208934 -0.209111 -0.209234 -0.209329 -0.209389 -0.209416 - -0.2094 -0.209329 -0.20926 -0.209204 -0.209208 -0.209285 - -0.209454 -0.209641 -0.20977 -0.209811 -0.209833 -0.209887 - -0.209653 -0.209127 -0.208893 -0.208811 -0.208777 -0.208758 - -0.208747 -0.20874 -0.208726 -0.208697 -0.208657 -0.208611 - -0.208565 -0.208524 -0.208488 -0.208451 -0.208412 -0.208373 - -0.208333 -0.208294 -0.208256 -0.208219 -0.208183 -0.208145 - -0.208107 -0.208066 -0.208029 -0.207993 -0.207959 -0.207923 - -0.207883 -0.207838 -0.207789 -0.207747 -0.20771 -0.207675 - -0.207642 -0.207605 -0.207568 -0.207531 -0.207494 -0.207457 - -0.20742 -0.207383 -0.207346 -0.207308 -0.207271 -0.207233 - -0.207196 -0.207158 -0.207121 -0.207084 -0.207046 -0.207009 - -0.206972 -0.206935 -0.206898 -0.206861 -0.206823 -0.206786 - -0.206749 -0.206712 -0.206675 -0.206638 -0.2066 -0.206563 - -0.206526 -0.206489 -0.206452 -0.206415 -0.203384 -0.20015 - -0.196872 -0.205024 -0.210727 -0.206779 -0.0685263 0.586138 - 1.4665 2.22945 2.77554 3.076 3.24926 3.34515 3.40164 3.43006 - 3.43713 3.43075 3.42886 3.4384 3.46567 3.49025 3.51287 3.53821 - 3.57841 3.39846 2.80753 2.22947 1.7549 1.30429 0.707786 - 0.303206 0.131352 0.0671706 0.0429955 0.032461 0.0257161 - 0.0239521 0.0217397 0.0179705 0.0138745 0.0102813 0.00749643 - 0.0054328 0.00386817 0.0027004 0.00189442 0.00135552 0.000954715 - 0.000659981 0.000453435 0.000313993 0.000231347 0.000159665 - 0.000108122 7.10528e-05 4.50233e-05 2.77892e-05 1.62765e-05 - 8.9893e-06 4.5471e-06 1.54614e-06 -1.6542e-07 -8.68508e-07 - -1.04369e-06 -9.63086e-07 -8.44294e-07 -6.57339e-07 -7.35885e-07 - -9.80056e-07 -1.39772e-06 -2.10199e-06 -1.37474e-06 6.13269e-07 - 3.3028e-06 4.60941e-06 4.91053e-06 4.14186e-06 2.45258e-06 - -8.7388e-09 -3.59647e-07 -7.10554e-07 -1.06146e-06 -1.41237e-06 - -1.76328e-06 -1.63073e-06 -1.34534e-06 -1.05995e-06 -7.74561e-07 - -4.8917e-07 -2.95733e-07 -2.16326e-07 -1.3692e-07 -5.75135e-08 - 2.18929e-08 1.01299e-07 1.80706e-07 2.60112e-07 3.39519e-07 - 4.18925e-07 4.98332e-07 4.83984e-07 4.4901e-07 4.14035e-07 - 3.79061e-07 3.44087e-07 3.09112e-07 2.74138e-07 2.39163e-07 - 2.04189e-07 1.69215e-07 1.26002e-07 4.83213e-08 -2.9359e-08 - -1.07039e-07 -1.8472e-07 -2.624e-07 -3.4008e-07 -4.1776e-07 - -4.95441e-07 + 1.34824 1.35838 1.36465 1.34675 1.29167 1.23161 1.2201 1.2185 + 1.2181 1.21798 1.21793 1.21788 1.21785 1.21782 1.21779 1.21776 + 1.21655 1.21656 1.21669 1.21871 1.22421 1.22247 1.21858 + 1.2228 1.23803 1.27737 1.10647 0.395248 0.0600669 0.027687 + 0.0192374 0.015425 0.0130881 0.00977445 0.00696598 0.00491122 + 0.00341952 0.00237078 0.00162339 0.00109178 0.000726647 + 0.000478886 0.00031568 0.000207902 0.000143494 0.000109768 + 8.62987e-05 5.69775e-05 3.36547e-05 2.30356e-05 1.86108e-05 + 1.41861e-05 1.08293e-05 7.68835e-06 4.79593e-06 4.51019e-06 + 4.22444e-06 3.9387e-06 3.65295e-06 3.36721e-06 3.04559e-06 + 2.69981e-06 2.35403e-06 2.00825e-06 1.66247e-06 1.34508e-06 + 1.26225e-06 1.17941e-06 1.09657e-06 1.01373e-06 9.30893e-07 + 8.48054e-07 7.65216e-07 6.82378e-07 5.9954e-07 5.16702e-07 + 4.37489e-07 3.82774e-07 3.2806e-07 2.73346e-07 2.18632e-07 + 1.63917e-07 1.09203e-07 5.4489e-08 -2.2523e-10 -5.49395e-08 + -1.09654e-07 -1.52862e-07 -1.3079e-07 -1.08718e-07 -8.6646e-08 + -6.45739e-08 -4.25019e-08 -2.04298e-08 1.64229e-09 2.37144e-08 + 4.57864e-08 6.78585e-08 8.71693e-08 9.30725e-08 9.89758e-08 + 1.04879e-07 1.10782e-07 1.16685e-07 1.22589e-07 1.28492e-07 + 1.34395e-07 1.40298e-07 1.46201e-07 1.52105e-07 1.58008e-07 + 1.63911e-07 1.69814e-07 1.75718e-07 1.81621e-07 1.87524e-07 + 1.93427e-07 1.9933e-07 2.05234e-07 2.11137e-07 2.19788e-07 + 0.000393944 -0.000218983 -0.00105784 0.00172403 -0.00027134 + -0.000204147 8.79968e-06 5.93762e-05 5.83554e-05 4.13815e-05 + 3.71369e-05 3.03372e-05 2.25336e-05 1.5986e-05 1.07284e-05 + -7.5239e-05 5.60593e-05 6.97571e-05 0.000667617 0.000960856 + 0.00131749 -0.00759564 -0.0217897 -0.0450321 -0.076646 -0.128569 + -0.186391 -0.202175 -0.206953 -0.2082 -0.208416 -0.208669 + -0.208934 -0.209111 -0.209234 -0.209329 -0.209389 -0.209416 + -0.2094 -0.209329 -0.20926 -0.209204 -0.209208 -0.209285 + -0.209454 -0.209641 -0.20977 -0.209811 -0.209833 -0.209887 + -0.209653 -0.209127 -0.208893 -0.208811 -0.208777 -0.208758 + -0.208747 -0.20874 -0.208726 -0.208697 -0.208657 -0.208611 + -0.208565 -0.208524 -0.208488 -0.208451 -0.208412 -0.208373 + -0.208333 -0.208294 -0.208256 -0.208219 -0.208183 -0.208145 + -0.208107 -0.208066 -0.208029 -0.207993 -0.207959 -0.207923 + -0.207883 -0.207838 -0.207789 -0.207747 -0.20771 -0.207675 + -0.207642 -0.207605 -0.207568 -0.207531 -0.207494 -0.207457 + -0.20742 -0.207383 -0.207346 -0.207308 -0.207271 -0.207233 + -0.207196 -0.207158 -0.207121 -0.207084 -0.207046 -0.207009 + -0.206972 -0.206935 -0.206898 -0.206861 -0.206823 -0.206786 + -0.206749 -0.206712 -0.206675 -0.206638 -0.2066 -0.206563 + -0.206526 -0.206489 -0.206452 -0.206415 -0.203384 -0.20015 + -0.196872 -0.205024 -0.210727 -0.206779 -0.0685263 0.586138 + 1.4665 2.22945 2.77554 3.076 3.24926 3.34515 3.40164 3.43006 + 3.43713 3.43075 3.42886 3.4384 3.46567 3.49025 3.51287 3.53821 + 3.57841 3.39846 2.80753 2.22947 1.7549 1.30429 0.707786 + 0.303206 0.131352 0.0671706 0.0429955 0.032461 0.0257161 + 0.0239521 0.0217397 0.0179705 0.0138745 0.0102813 0.00749643 + 0.0054328 0.00386817 0.0027004 0.00189442 0.00135552 0.000954715 + 0.000659981 0.000453435 0.000313993 0.000231347 0.000159665 + 0.000108122 7.10528e-05 4.50233e-05 2.77892e-05 1.62765e-05 + 8.9893e-06 4.5471e-06 1.54614e-06 -1.6542e-07 -8.68508e-07 + -1.04369e-06 -9.63086e-07 -8.44294e-07 -6.57339e-07 -7.35885e-07 + -9.80056e-07 -1.39772e-06 -2.10199e-06 -1.37474e-06 6.13269e-07 + 3.3028e-06 4.60941e-06 4.91053e-06 4.14186e-06 2.45258e-06 + -8.7388e-09 -3.59647e-07 -7.10554e-07 -1.06146e-06 -1.41237e-06 + -1.76328e-06 -1.63073e-06 -1.34534e-06 -1.05995e-06 -7.74561e-07 + -4.8917e-07 -2.95733e-07 -2.16326e-07 -1.3692e-07 -5.75135e-08 + 2.18929e-08 1.01299e-07 1.80706e-07 2.60112e-07 3.39519e-07 + 4.18925e-07 4.98332e-07 4.83984e-07 4.4901e-07 4.14035e-07 + 3.79061e-07 3.44087e-07 3.09112e-07 2.74138e-07 2.39163e-07 + 2.04189e-07 1.69215e-07 1.26002e-07 4.83213e-08 -2.9359e-08 + -1.07039e-07 -1.8472e-07 -2.624e-07 -3.4008e-07 -4.1776e-07 + -4.95441e-07 EOD @v[26].set(<<-'EOD') - 7.10441e-10 0.000309731 -0.000308186 -0.001694 -0.00360784 - 8.40909e-05 0.00203175 0.0012896 0.000596548 0.000277191 - 0.000161134 0.000120439 8.4915e-05 9.49929e-05 6.18812e-05 - 1.65433e-05 1.89682e-05 3.97578e-05 4.95446e-05 0.000225325 - 0.000214579 -0.00230134 -0.000451102 0.00997237 0.0341443 - 0.0449314 0.0424411 0.0341996 0.0315315 0.0308892 0.0291614 - 0.024365 0.0190282 0.0188976 0.017238 0.0138526 0.0105645 - 0.00778548 0.00561753 0.0039871 0.00279554 0.00194075 0.0013468 - 0.000934775 0.000664723 0.000498911 0.000377384 0.000254183 - 0.000163421 0.000120773 9.65058e-05 7.22384e-05 5.60316e-05 - 4.14549e-05 2.79516e-05 2.57096e-05 2.34677e-05 2.12257e-05 - 1.89837e-05 1.67417e-05 1.46737e-05 1.27228e-05 1.07719e-05 - 8.82099e-06 6.87009e-06 5.0896e-06 4.71705e-06 4.34451e-06 - 3.97196e-06 3.59941e-06 3.22686e-06 2.85431e-06 2.48176e-06 - 2.10921e-06 1.73666e-06 1.36411e-06 1.02855e-06 9.42931e-07 - 8.57316e-07 7.71701e-07 6.86086e-07 6.00471e-07 5.14856e-07 - 4.29241e-07 3.43626e-07 2.58011e-07 1.72396e-07 9.85409e-08 - 9.14091e-08 8.42773e-08 7.71456e-08 7.00138e-08 6.2882e-08 - 5.57503e-08 4.86185e-08 4.14867e-08 3.4355e-08 2.72232e-08 - 2.05821e-08 1.63235e-08 1.2065e-08 7.80643e-09 3.54786e-09 - -7.10696e-10 -4.96926e-09 -9.22782e-09 -1.34864e-08 -1.77449e-08 - -2.20035e-08 -2.62621e-08 -3.05206e-08 -3.47792e-08 -3.90378e-08 - -4.32963e-08 -4.75549e-08 -5.18134e-08 -5.6072e-08 -6.03306e-08 - -6.45891e-08 -6.88477e-08 -8.76373e-06 0.000131607 -0.00021685 - -0.000433027 0.00047234 0.000211593 -0.000189601 3.2492e-05 - 0.000575955 7.72235e-05 -0.000285172 -0.000242061 -0.000135112 - -3.50117e-05 -2.75868e-05 5.48974e-05 1.80604e-07 5.48911e-05 - 3.97478e-05 0.000192909 0.000297932 0.00402253 -0.0122366 - -0.047853 -0.0963082 -0.108071 -0.0567275 -0.0239271 -0.0178628 - -0.0233027 -0.031853 -0.0400843 -0.0482725 -0.0576154 -0.0627218 - -0.0511236 -0.0279524 -0.0150986 -0.00931091 -0.00652876 - -0.00479286 -0.00344346 -0.00249578 -0.0019532 -0.00157977 - -0.00131848 -0.00111251 -0.000939229 -0.000797445 -0.000708384 - -0.000630452 -0.000539722 -0.000508862 -0.000480596 -0.000439484 - -0.000407217 -0.000363866 -0.000329506 -0.000318642 -0.000307362 - -0.000286511 -0.000266253 -0.000242943 -0.000218107 -0.000204661 - -0.00020241 -0.000194435 -0.000185062 -0.000173042 -0.000160549 - -0.000151407 -0.000145626 -0.000145976 -0.000147342 -0.000145288 - -0.000137979 -0.000124481 -0.000123218 -0.000127453 -0.000139006 - -0.000145486 -0.000129764 -9.82749e-05 -4.72596e-05 -3.08671e-05 - -3.28834e-05 -4.52254e-05 -6.25389e-05 -6.32516e-05 -6.39643e-05 - -6.4677e-05 -6.53897e-05 -6.61023e-05 -6.6815e-05 -6.75277e-05 - -6.61005e-05 -6.45173e-05 -6.29341e-05 -6.13509e-05 -5.97676e-05 - -5.81844e-05 -5.66012e-05 -5.54231e-05 -5.4455e-05 -5.3487e-05 - -5.25189e-05 -5.15508e-05 -5.05828e-05 -4.96147e-05 -4.86466e-05 - -4.76785e-05 -4.67105e-05 -4.57424e-05 -4.47743e-05 -4.38063e-05 - -4.28382e-05 -4.18821e-05 -4.10211e-05 -4.016e-05 -3.9299e-05 - -3.8438e-05 4.29885e-05 5.14113e-05 -0.000127986 -0.000611463 - -0.000149428 0.000882394 0.00297059 -0.00405825 -0.00591067 - -0.00546997 -0.00158744 0.00190677 0.00298403 0.00268595 - 0.00196161 0.00130289 0.000783347 0.000520683 0.000565306 - 0.00053419 -0.00224696 -0.000920818 0.0132755 0.0322504 - 0.0442808 0.0638615 0.0701007 0.0539356 0.0247771 0.056244 - 0.294266 0.831368 1.45424 2.02898 2.54559 2.9937 3.35333 - 3.72609 4.06363 4.32789 4.52413 4.66504 4.7652 4.83637 4.88631 - 4.92109 4.94464 4.96046 4.97218 4.98079 4.98679 4.99076 - 4.99361 4.99555 4.99686 4.99783 4.99853 4.99902 4.99936 - 4.99959 4.99973 4.99983 4.9999 4.99993 4.99996 4.99998 5 - 5.00001 5 4.99999 4.99997 4.99994 4.99993 4.99994 4.99996 - 4.99999 5.00004 5.00006 5.00005 5.00003 5.00002 5.00001 - 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 + 7.10441e-10 0.000309731 -0.000308186 -0.001694 -0.00360784 + 8.40909e-05 0.00203175 0.0012896 0.000596548 0.000277191 + 0.000161134 0.000120439 8.4915e-05 9.49929e-05 6.18812e-05 + 1.65433e-05 1.89682e-05 3.97578e-05 4.95446e-05 0.000225325 + 0.000214579 -0.00230134 -0.000451102 0.00997237 0.0341443 + 0.0449314 0.0424411 0.0341996 0.0315315 0.0308892 0.0291614 + 0.024365 0.0190282 0.0188976 0.017238 0.0138526 0.0105645 + 0.00778548 0.00561753 0.0039871 0.00279554 0.00194075 0.0013468 + 0.000934775 0.000664723 0.000498911 0.000377384 0.000254183 + 0.000163421 0.000120773 9.65058e-05 7.22384e-05 5.60316e-05 + 4.14549e-05 2.79516e-05 2.57096e-05 2.34677e-05 2.12257e-05 + 1.89837e-05 1.67417e-05 1.46737e-05 1.27228e-05 1.07719e-05 + 8.82099e-06 6.87009e-06 5.0896e-06 4.71705e-06 4.34451e-06 + 3.97196e-06 3.59941e-06 3.22686e-06 2.85431e-06 2.48176e-06 + 2.10921e-06 1.73666e-06 1.36411e-06 1.02855e-06 9.42931e-07 + 8.57316e-07 7.71701e-07 6.86086e-07 6.00471e-07 5.14856e-07 + 4.29241e-07 3.43626e-07 2.58011e-07 1.72396e-07 9.85409e-08 + 9.14091e-08 8.42773e-08 7.71456e-08 7.00138e-08 6.2882e-08 + 5.57503e-08 4.86185e-08 4.14867e-08 3.4355e-08 2.72232e-08 + 2.05821e-08 1.63235e-08 1.2065e-08 7.80643e-09 3.54786e-09 + -7.10696e-10 -4.96926e-09 -9.22782e-09 -1.34864e-08 -1.77449e-08 + -2.20035e-08 -2.62621e-08 -3.05206e-08 -3.47792e-08 -3.90378e-08 + -4.32963e-08 -4.75549e-08 -5.18134e-08 -5.6072e-08 -6.03306e-08 + -6.45891e-08 -6.88477e-08 -8.76373e-06 0.000131607 -0.00021685 + -0.000433027 0.00047234 0.000211593 -0.000189601 3.2492e-05 + 0.000575955 7.72235e-05 -0.000285172 -0.000242061 -0.000135112 + -3.50117e-05 -2.75868e-05 5.48974e-05 1.80604e-07 5.48911e-05 + 3.97478e-05 0.000192909 0.000297932 0.00402253 -0.0122366 + -0.047853 -0.0963082 -0.108071 -0.0567275 -0.0239271 -0.0178628 + -0.0233027 -0.031853 -0.0400843 -0.0482725 -0.0576154 -0.0627218 + -0.0511236 -0.0279524 -0.0150986 -0.00931091 -0.00652876 + -0.00479286 -0.00344346 -0.00249578 -0.0019532 -0.00157977 + -0.00131848 -0.00111251 -0.000939229 -0.000797445 -0.000708384 + -0.000630452 -0.000539722 -0.000508862 -0.000480596 -0.000439484 + -0.000407217 -0.000363866 -0.000329506 -0.000318642 -0.000307362 + -0.000286511 -0.000266253 -0.000242943 -0.000218107 -0.000204661 + -0.00020241 -0.000194435 -0.000185062 -0.000173042 -0.000160549 + -0.000151407 -0.000145626 -0.000145976 -0.000147342 -0.000145288 + -0.000137979 -0.000124481 -0.000123218 -0.000127453 -0.000139006 + -0.000145486 -0.000129764 -9.82749e-05 -4.72596e-05 -3.08671e-05 + -3.28834e-05 -4.52254e-05 -6.25389e-05 -6.32516e-05 -6.39643e-05 + -6.4677e-05 -6.53897e-05 -6.61023e-05 -6.6815e-05 -6.75277e-05 + -6.61005e-05 -6.45173e-05 -6.29341e-05 -6.13509e-05 -5.97676e-05 + -5.81844e-05 -5.66012e-05 -5.54231e-05 -5.4455e-05 -5.3487e-05 + -5.25189e-05 -5.15508e-05 -5.05828e-05 -4.96147e-05 -4.86466e-05 + -4.76785e-05 -4.67105e-05 -4.57424e-05 -4.47743e-05 -4.38063e-05 + -4.28382e-05 -4.18821e-05 -4.10211e-05 -4.016e-05 -3.9299e-05 + -3.8438e-05 4.29885e-05 5.14113e-05 -0.000127986 -0.000611463 + -0.000149428 0.000882394 0.00297059 -0.00405825 -0.00591067 + -0.00546997 -0.00158744 0.00190677 0.00298403 0.00268595 + 0.00196161 0.00130289 0.000783347 0.000520683 0.000565306 + 0.00053419 -0.00224696 -0.000920818 0.0132755 0.0322504 + 0.0442808 0.0638615 0.0701007 0.0539356 0.0247771 0.056244 + 0.294266 0.831368 1.45424 2.02898 2.54559 2.9937 3.35333 + 3.72609 4.06363 4.32789 4.52413 4.66504 4.7652 4.83637 4.88631 + 4.92109 4.94464 4.96046 4.97218 4.98079 4.98679 4.99076 + 4.99361 4.99555 4.99686 4.99783 4.99853 4.99902 4.99936 + 4.99959 4.99973 4.99983 4.9999 4.99993 4.99996 4.99998 5 + 5.00001 5 4.99999 4.99997 4.99994 4.99993 4.99994 4.99996 + 4.99999 5.00004 5.00006 5.00005 5.00003 5.00002 5.00001 + 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 5 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99998 EOD @v[27].set(<<-'EOD') - 5 4.99984 4.99796 4.99478 4.9889 4.98738 4.98896 4.99087 - 4.99262 4.99419 4.99552 4.99659 4.99743 4.99807 4.99855 - 4.9989 4.99894 4.99908 4.99935 5.00001 5.0007 5.00132 5.00032 - 4.99976 5.00134 5.00339 5.00315 5.00157 5.00091 5.00058 - 5.00012 4.99944 4.99886 4.9994 4.99934 4.99899 4.99876 4.99868 - 4.99872 4.99883 4.99898 4.99914 4.9993 4.99944 4.99956 4.99967 - 4.99976 4.99982 4.99986 4.9999 4.99993 4.99997 4.99997 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00009 5.00028 5.00015 4.99983 - 5.00036 4.99996 4.99834 4.99783 5.00383 5.00734 5.00387 - 5.00058 4.99893 4.99836 4.99832 4.99854 4.99873 4.99905 - 4.99927 4.99952 4.99969 4.99834 4.99536 4.99163 4.99073 - 5.0053 5.03631 5.03103 4.9008 4.62503 4.21887 3.70902 3.09967 - 2.35791 1.41912 0.519675 0.210458 0.131362 0.0980819 0.0708209 - 0.0471701 0.0323272 0.0253535 0.0199144 0.0152615 0.0117228 - 0.00917696 0.00738117 0.00609292 0.00512664 0.00436184 0.0037961 - 0.00331639 0.00289006 0.0025477 0.00226529 0.00202925 0.00182793 - 0.00165474 0.00150531 0.00137529 0.00125983 0.00115603 0.00106455 - 0.000982977 0.000911255 0.000846819 0.000790092 0.000738698 - 0.000692816 0.00065107 0.000613595 0.000579642 0.000548935 - 0.00052106 0.000495598 0.000472174 0.000450849 0.000431118 - 0.000412667 0.000395868 0.000381319 0.000368487 0.000357327 - 0.000344212 0.000330334 0.00031622 0.000303298 0.000295809 - 0.00028832 0.000280831 0.000273342 0.000265853 0.000258364 - 0.000250875 0.000245118 0.000239488 0.000233857 0.000228227 - 0.000222596 0.000216966 0.000211336 0.000207047 0.000203455 - 0.000199863 0.00019627 0.000192678 0.000189085 0.000185493 - 0.0001819 0.000178308 0.000174716 0.000171123 0.000167531 - 0.000163938 0.000160346 0.000156835 0.000153973 0.00015111 - 0.000148248 0.000145385 0.000296579 -3.96718e-05 -0.000449085 - 0.000323433 0.000750086 0.000268264 0.000149028 -0.000100249 - 7.00956e-05 0.00012605 0.00022592 0.000193036 0.000120453 - 8.07865e-05 7.65771e-05 -3.27828e-05 0.000116759 0.000169498 - 0.000409804 0.000414965 0.00092323 -0.00590633 -0.0175477 - -0.032433 -0.0559842 -0.0820373 0.0688484 0.626629 1.32929 - 2.01657 2.60925 3.12329 3.38952 3.14128 2.38463 1.23802 - 0.316019 0.107832 0.0694707 0.051837 0.035247 0.0209999 - 0.0116618 0.00967674 0.00789182 0.00574566 0.00386872 0.00258612 - 0.00167126 0.00104169 0.000641093 0.000401246 0.000277928 - 0.000171775 0.000102266 5.89376e-05 3.29258e-05 1.80463e-05 - 1.0057e-05 6.4571e-06 5.10093e-06 4.06791e-06 3.62716e-06 - 3.63321e-06 3.99625e-06 4.64368e-06 5.20886e-06 4.77728e-06 - 3.23919e-06 1.14113e-06 -1.29416e-06 -4.15607e-06 -1.88532e-06 - 5.24411e-06 1.38678e-05 1.28823e-05 3.6758e-06 -2.52285e-06 - -3.97133e-06 -4.03071e-06 -3.37154e-06 -2.71238e-06 -2.05321e-06 - -1.39404e-06 -7.34872e-07 -3.73325e-07 -1.05873e-07 1.61578e-07 - 4.2903e-07 6.96482e-07 8.18468e-07 7.60065e-07 7.01662e-07 - 6.43258e-07 5.84855e-07 5.26452e-07 4.68049e-07 4.09646e-07 - 3.51243e-07 2.9284e-07 2.34437e-07 1.71213e-07 1.06928e-07 - 4.2644e-08 -2.16403e-08 -8.59247e-08 -1.50209e-07 -2.14493e-07 - -2.78778e-07 -3.43062e-07 -4.07346e-07 -4.55065e-07 -4.3348e-07 - -4.11896e-07 -3.90311e-07 -3.68726e-07 -3.47141e-07 -3.25556e-07 - -3.03971e-07 -2.82386e-07 + 5 4.99984 4.99796 4.99478 4.9889 4.98738 4.98896 4.99087 + 4.99262 4.99419 4.99552 4.99659 4.99743 4.99807 4.99855 + 4.9989 4.99894 4.99908 4.99935 5.00001 5.0007 5.00132 5.00032 + 4.99976 5.00134 5.00339 5.00315 5.00157 5.00091 5.00058 + 5.00012 4.99944 4.99886 4.9994 4.99934 4.99899 4.99876 4.99868 + 4.99872 4.99883 4.99898 4.99914 4.9993 4.99944 4.99956 4.99967 + 4.99976 4.99982 4.99986 4.9999 4.99993 4.99997 4.99997 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5.00009 5.00028 5.00015 4.99983 + 5.00036 4.99996 4.99834 4.99783 5.00383 5.00734 5.00387 + 5.00058 4.99893 4.99836 4.99832 4.99854 4.99873 4.99905 + 4.99927 4.99952 4.99969 4.99834 4.99536 4.99163 4.99073 + 5.0053 5.03631 5.03103 4.9008 4.62503 4.21887 3.70902 3.09967 + 2.35791 1.41912 0.519675 0.210458 0.131362 0.0980819 0.0708209 + 0.0471701 0.0323272 0.0253535 0.0199144 0.0152615 0.0117228 + 0.00917696 0.00738117 0.00609292 0.00512664 0.00436184 0.0037961 + 0.00331639 0.00289006 0.0025477 0.00226529 0.00202925 0.00182793 + 0.00165474 0.00150531 0.00137529 0.00125983 0.00115603 0.00106455 + 0.000982977 0.000911255 0.000846819 0.000790092 0.000738698 + 0.000692816 0.00065107 0.000613595 0.000579642 0.000548935 + 0.00052106 0.000495598 0.000472174 0.000450849 0.000431118 + 0.000412667 0.000395868 0.000381319 0.000368487 0.000357327 + 0.000344212 0.000330334 0.00031622 0.000303298 0.000295809 + 0.00028832 0.000280831 0.000273342 0.000265853 0.000258364 + 0.000250875 0.000245118 0.000239488 0.000233857 0.000228227 + 0.000222596 0.000216966 0.000211336 0.000207047 0.000203455 + 0.000199863 0.00019627 0.000192678 0.000189085 0.000185493 + 0.0001819 0.000178308 0.000174716 0.000171123 0.000167531 + 0.000163938 0.000160346 0.000156835 0.000153973 0.00015111 + 0.000148248 0.000145385 0.000296579 -3.96718e-05 -0.000449085 + 0.000323433 0.000750086 0.000268264 0.000149028 -0.000100249 + 7.00956e-05 0.00012605 0.00022592 0.000193036 0.000120453 + 8.07865e-05 7.65771e-05 -3.27828e-05 0.000116759 0.000169498 + 0.000409804 0.000414965 0.00092323 -0.00590633 -0.0175477 + -0.032433 -0.0559842 -0.0820373 0.0688484 0.626629 1.32929 + 2.01657 2.60925 3.12329 3.38952 3.14128 2.38463 1.23802 + 0.316019 0.107832 0.0694707 0.051837 0.035247 0.0209999 + 0.0116618 0.00967674 0.00789182 0.00574566 0.00386872 0.00258612 + 0.00167126 0.00104169 0.000641093 0.000401246 0.000277928 + 0.000171775 0.000102266 5.89376e-05 3.29258e-05 1.80463e-05 + 1.0057e-05 6.4571e-06 5.10093e-06 4.06791e-06 3.62716e-06 + 3.63321e-06 3.99625e-06 4.64368e-06 5.20886e-06 4.77728e-06 + 3.23919e-06 1.14113e-06 -1.29416e-06 -4.15607e-06 -1.88532e-06 + 5.24411e-06 1.38678e-05 1.28823e-05 3.6758e-06 -2.52285e-06 + -3.97133e-06 -4.03071e-06 -3.37154e-06 -2.71238e-06 -2.05321e-06 + -1.39404e-06 -7.34872e-07 -3.73325e-07 -1.05873e-07 1.61578e-07 + 4.2903e-07 6.96482e-07 8.18468e-07 7.60065e-07 7.01662e-07 + 6.43258e-07 5.84855e-07 5.26452e-07 4.68049e-07 4.09646e-07 + 3.51243e-07 2.9284e-07 2.34437e-07 1.71213e-07 1.06928e-07 + 4.2644e-08 -2.16403e-08 -8.59247e-08 -1.50209e-07 -2.14493e-07 + -2.78778e-07 -3.43062e-07 -4.07346e-07 -4.55065e-07 -4.3348e-07 + -4.11896e-07 -3.90311e-07 -3.68726e-07 -3.47141e-07 -3.25556e-07 + -3.03971e-07 -2.82386e-07 EOD @v[28].set(<<-'EOD') - 0.368163 0.361756 0.327463 0.269513 0.149476 0.0805716 0.0501146 - 0.03403 0.0230886 0.0160474 0.0116071 0.00870013 0.00679614 - 0.00542384 0.00432512 0.00340653 -0.00129719 -0.00399429 - -0.00318719 0.00443085 0.0150156 0.0334147 0.0132288 -0.0189751 - -0.0508377 -0.0252174 -0.0142489 -0.00675908 -0.0038653 - -0.00243423 -0.00168891 -0.00120901 -0.000900426 -0.000685575 - -0.000557595 -0.000457268 -0.000377427 -0.000315269 -0.000266613 - -0.000228397 -0.000198283 -0.000174248 -0.000154886 -0.00013892 - -0.000125864 -0.000115189 -0.000105841 -9.66611e-05 -8.84262e-05 - -8.23872e-05 -7.74668e-05 -7.25463e-05 -6.79992e-05 -6.35276e-05 - -5.92413e-05 -5.68994e-05 -5.45574e-05 -5.22154e-05 -4.98735e-05 - -4.75315e-05 -4.54981e-05 -4.36726e-05 -4.18471e-05 -4.00216e-05 - -3.81961e-05 -3.64559e-05 -3.54209e-05 -3.43858e-05 -3.33508e-05 - -3.23157e-05 -3.12807e-05 -3.02456e-05 -2.92105e-05 -2.81755e-05 - -2.71404e-05 -2.61054e-05 -2.51232e-05 -2.44984e-05 -2.38736e-05 - -2.32487e-05 -2.26239e-05 -2.19991e-05 -2.13742e-05 -2.07494e-05 - -2.01246e-05 -1.94998e-05 -1.88749e-05 -1.82865e-05 -1.79044e-05 - -1.75224e-05 -1.71403e-05 -1.67582e-05 -1.63762e-05 -1.59941e-05 - -1.56121e-05 -1.523e-05 -1.4848e-05 -1.44659e-05 -1.41138e-05 - -1.39075e-05 -1.37011e-05 -1.34947e-05 -1.32883e-05 -1.30819e-05 - -1.28755e-05 -1.26691e-05 -1.24627e-05 -1.22563e-05 -1.205e-05 - -1.18436e-05 -1.16372e-05 -1.14308e-05 -1.12244e-05 -1.1018e-05 - -1.08116e-05 -1.06052e-05 -1.03988e-05 -1.01924e-05 -9.98605e-06 - -9.77966e-06 -2.85319e-05 0.00281092 0.00180106 -0.000981083 - 0.00551926 -0.00119763 -0.0295069 -0.0367677 0.064749 0.119022 - 0.0882007 0.0552062 0.03418 0.0223243 0.015545 0.011949 - 0.00757134 0.00667655 0.00583243 0.00644443 0.00650959 -0.0302575 - -0.0437806 -0.0355466 0.0381776 0.282109 0.674178 1.07582 - 1.45189 1.789 2.08649 2.34663 2.57245 2.81211 3.04778 3.2523 - 3.45877 3.65593 3.83396 3.9923 4.13368 4.25864 4.36719 4.46064 - 4.54086 4.60962 4.66835 4.71838 4.76094 4.79716 4.82796 - 4.85413 4.87634 4.89518 4.91116 4.92476 4.93631 4.94608 - 4.95434 4.9613 4.96715 4.97211 4.97638 4.98001 4.98312 4.98571 - 4.98795 4.98979 4.99138 4.99269 4.99381 4.99474 4.99551 - 4.99615 4.99668 4.99713 4.99752 4.99783 4.99811 4.99836 - 4.99858 4.99873 4.99884 4.99892 4.999 4.99907 4.99912 4.99916 - 4.99921 4.99926 4.99932 4.99937 4.99942 4.99948 4.99953 - 4.99956 4.99958 4.99961 4.99963 4.99966 4.99968 4.99971 - 4.99972 4.99973 4.99974 4.99975 4.99976 4.99977 4.99978 - 4.99979 4.9998 4.9998 4.99981 4.99982 4.99983 4.99984 4.99985 - 4.99986 4.99986 4.99987 4.99987 5.00498 5.00354 4.99359 - 4.98981 5.00498 5.00099 5.00041 5.00022 5.00015 5.00012 - 5.0001 5.00008 5.00005 5.00003 5 4.99431 4.99459 4.99591 - 5.00087 5.01029 5.03935 4.92784 4.51643 3.78356 2.68745 - 1.43417 0.583128 0.205094 0.0777337 0.0391566 0.02723 0.023883 - 0.018808 0.010165 0.00254623 -0.00377463 -0.0038097 0.00144145 - 0.00267231 0.00193045 0.00144538 0.00121758 0.00112893 0.00109424 - 0.0010226 0.000948072 0.000882573 0.000826996 0.000776391 - 0.000729719 0.000686499 0.000647333 0.000610108 0.000575631 - 0.000545069 0.000515485 0.000488514 0.000465316 0.000443215 - 0.000422454 0.00040292 0.00038488 0.000368472 0.000353628 - 0.000339643 0.000326197 0.000313483 0.000302884 0.000294038 - 0.000284003 0.000270941 0.000254925 0.000246511 0.000244089 - 0.000245538 0.000242099 0.000235728 0.000227482 0.000218001 - 0.000207257 0.000202127 0.000196997 0.000191868 0.000186738 - 0.000181608 0.00017758 0.000173899 0.000170219 0.000166538 - 0.000162857 0.000159576 0.00015679 0.000154005 0.000151219 - 0.000148433 0.000145647 0.000142861 0.000140076 0.00013729 - 0.000134504 0.000131718 0.000129603 0.000127635 0.000125668 - 0.0001237 0.000121732 0.000119765 0.000117797 0.000115829 - 0.000113862 0.000111894 0.000109993 0.000108372 0.000106751 - 0.00010513 0.000103509 0.000101887 0.000100266 9.86449e-05 - 9.70237e-05 + 0.368163 0.361756 0.327463 0.269513 0.149476 0.0805716 0.0501146 + 0.03403 0.0230886 0.0160474 0.0116071 0.00870013 0.00679614 + 0.00542384 0.00432512 0.00340653 -0.00129719 -0.00399429 + -0.00318719 0.00443085 0.0150156 0.0334147 0.0132288 -0.0189751 + -0.0508377 -0.0252174 -0.0142489 -0.00675908 -0.0038653 + -0.00243423 -0.00168891 -0.00120901 -0.000900426 -0.000685575 + -0.000557595 -0.000457268 -0.000377427 -0.000315269 -0.000266613 + -0.000228397 -0.000198283 -0.000174248 -0.000154886 -0.00013892 + -0.000125864 -0.000115189 -0.000105841 -9.66611e-05 -8.84262e-05 + -8.23872e-05 -7.74668e-05 -7.25463e-05 -6.79992e-05 -6.35276e-05 + -5.92413e-05 -5.68994e-05 -5.45574e-05 -5.22154e-05 -4.98735e-05 + -4.75315e-05 -4.54981e-05 -4.36726e-05 -4.18471e-05 -4.00216e-05 + -3.81961e-05 -3.64559e-05 -3.54209e-05 -3.43858e-05 -3.33508e-05 + -3.23157e-05 -3.12807e-05 -3.02456e-05 -2.92105e-05 -2.81755e-05 + -2.71404e-05 -2.61054e-05 -2.51232e-05 -2.44984e-05 -2.38736e-05 + -2.32487e-05 -2.26239e-05 -2.19991e-05 -2.13742e-05 -2.07494e-05 + -2.01246e-05 -1.94998e-05 -1.88749e-05 -1.82865e-05 -1.79044e-05 + -1.75224e-05 -1.71403e-05 -1.67582e-05 -1.63762e-05 -1.59941e-05 + -1.56121e-05 -1.523e-05 -1.4848e-05 -1.44659e-05 -1.41138e-05 + -1.39075e-05 -1.37011e-05 -1.34947e-05 -1.32883e-05 -1.30819e-05 + -1.28755e-05 -1.26691e-05 -1.24627e-05 -1.22563e-05 -1.205e-05 + -1.18436e-05 -1.16372e-05 -1.14308e-05 -1.12244e-05 -1.1018e-05 + -1.08116e-05 -1.06052e-05 -1.03988e-05 -1.01924e-05 -9.98605e-06 + -9.77966e-06 -2.85319e-05 0.00281092 0.00180106 -0.000981083 + 0.00551926 -0.00119763 -0.0295069 -0.0367677 0.064749 0.119022 + 0.0882007 0.0552062 0.03418 0.0223243 0.015545 0.011949 + 0.00757134 0.00667655 0.00583243 0.00644443 0.00650959 -0.0302575 + -0.0437806 -0.0355466 0.0381776 0.282109 0.674178 1.07582 + 1.45189 1.789 2.08649 2.34663 2.57245 2.81211 3.04778 3.2523 + 3.45877 3.65593 3.83396 3.9923 4.13368 4.25864 4.36719 4.46064 + 4.54086 4.60962 4.66835 4.71838 4.76094 4.79716 4.82796 + 4.85413 4.87634 4.89518 4.91116 4.92476 4.93631 4.94608 + 4.95434 4.9613 4.96715 4.97211 4.97638 4.98001 4.98312 4.98571 + 4.98795 4.98979 4.99138 4.99269 4.99381 4.99474 4.99551 + 4.99615 4.99668 4.99713 4.99752 4.99783 4.99811 4.99836 + 4.99858 4.99873 4.99884 4.99892 4.999 4.99907 4.99912 4.99916 + 4.99921 4.99926 4.99932 4.99937 4.99942 4.99948 4.99953 + 4.99956 4.99958 4.99961 4.99963 4.99966 4.99968 4.99971 + 4.99972 4.99973 4.99974 4.99975 4.99976 4.99977 4.99978 + 4.99979 4.9998 4.9998 4.99981 4.99982 4.99983 4.99984 4.99985 + 4.99986 4.99986 4.99987 4.99987 5.00498 5.00354 4.99359 + 4.98981 5.00498 5.00099 5.00041 5.00022 5.00015 5.00012 + 5.0001 5.00008 5.00005 5.00003 5 4.99431 4.99459 4.99591 + 5.00087 5.01029 5.03935 4.92784 4.51643 3.78356 2.68745 + 1.43417 0.583128 0.205094 0.0777337 0.0391566 0.02723 0.023883 + 0.018808 0.010165 0.00254623 -0.00377463 -0.0038097 0.00144145 + 0.00267231 0.00193045 0.00144538 0.00121758 0.00112893 0.00109424 + 0.0010226 0.000948072 0.000882573 0.000826996 0.000776391 + 0.000729719 0.000686499 0.000647333 0.000610108 0.000575631 + 0.000545069 0.000515485 0.000488514 0.000465316 0.000443215 + 0.000422454 0.00040292 0.00038488 0.000368472 0.000353628 + 0.000339643 0.000326197 0.000313483 0.000302884 0.000294038 + 0.000284003 0.000270941 0.000254925 0.000246511 0.000244089 + 0.000245538 0.000242099 0.000235728 0.000227482 0.000218001 + 0.000207257 0.000202127 0.000196997 0.000191868 0.000186738 + 0.000181608 0.00017758 0.000173899 0.000170219 0.000166538 + 0.000162857 0.000159576 0.00015679 0.000154005 0.000151219 + 0.000148433 0.000145647 0.000142861 0.000140076 0.00013729 + 0.000134504 0.000131718 0.000129603 0.000127635 0.000125668 + 0.0001237 0.000121732 0.000119765 0.000117797 0.000115829 + 0.000113862 0.000111894 0.000109993 0.000108372 0.000106751 + 0.00010513 0.000103509 0.000101887 0.000100266 9.86449e-05 + 9.70237e-05 EOD @v[29].set(<<-'EOD') - 5 4.99899 4.99654 4.99327 4.9863 4.98954 4.99212 4.99378 - 4.9951 4.99624 4.99715 4.99786 4.99839 4.99879 4.99909 4.99931 - 4.99922 4.99933 4.99971 5.00064 5.00084 5.00123 4.99865 - 4.99853 4.99983 5.00457 5.00242 5.00105 5.00062 5.00042 - 4.99971 4.9994 4.9992 4.9996 4.99955 4.99932 4.99918 4.99915 - 4.99919 4.99927 4.99937 4.99948 4.99957 4.99966 4.99974 - 4.9998 4.99985 4.99989 4.99992 4.99993 4.99994 4.99994 4.99996 - 4.99998 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 - 5.00001 5.00001 5 5 5 5 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 - 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5 5 5 5 5 5 4.9997 4.99998 4.99954 4.99963 - 5.00059 4.99945 4.99732 4.99957 5.00919 5.00558 5.00033 - 4.99851 4.9983 4.99854 4.99871 4.99928 4.99914 4.99939 4.99952 - 4.9998 4.99976 4.99744 4.99598 4.99478 4.99806 5.01911 5.04602 - 5.05469 5.01317 4.89484 4.69655 4.42036 4.06069 3.60793 - 3.12531 2.72975 2.45187 2.25081 2.09841 1.98509 1.90211 - 1.84084 1.79411 1.7574 1.72763 1.70283 1.68188 1.66389 1.64823 - 1.63438 1.62201 1.61088 1.60081 1.59163 1.58323 1.57549 - 1.56835 1.56173 1.55558 1.54985 1.54451 1.53951 1.53479 - 1.53035 1.52615 1.5222 1.51845 1.5149 1.51153 1.50834 1.50529 - 1.5024 1.49964 1.497 1.49449 1.49208 1.48977 1.48755 1.48542 - 1.48336 1.48138 1.47948 1.47765 1.4759 1.47419 1.47255 1.47096 - 1.46949 1.46823 1.46696 1.4657 1.46444 1.46317 1.46191 1.46065 - 1.45956 1.4585 1.45743 1.45636 1.45529 1.45422 1.45315 1.45226 - 1.45145 1.45064 1.44983 1.44902 1.44821 1.4474 1.44659 1.44579 - 1.44498 1.44417 1.44336 1.44255 1.44174 1.44094 1.44019 - 1.43944 1.43868 1.43793 1.43765 1.43679 1.43515 1.43405 - 1.43478 1.43387 1.43345 1.43184 1.43086 1.43021 1.43003 - 1.42988 1.42944 1.42883 1.42818 1.42702 1.42642 1.42595 - 1.42586 1.42616 1.42783 1.41733 1.38106 1.30738 1.3877 2.09819 - 3.05285 3.58059 3.77601 3.87609 4.02557 4.24887 4.4608 4.60411 - 4.72109 4.8255 4.90465 4.97379 5.01253 5.01532 5.01239 5.0092 - 5.00665 5.00474 5.00333 5.00232 5.00163 5.00117 5.00082 - 5.00057 5.00039 5.00027 5.00019 5.00013 5.00009 5.00006 - 5.00004 5.00003 5.00002 5.00001 5.00001 5 5 5 4.99998 4.99995 - 4.99992 4.99996 5.00005 5.00012 5.00008 4.99996 4.9999 4.99985 - 4.99986 4.99997 5.00021 5.0003 5.00024 5.00009 5.00007 5.00005 - 5.00003 5.00001 4.99998 4.99998 4.99998 4.99999 4.99999 - 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99998 - 4.99998 4.99998 + 5 4.99899 4.99654 4.99327 4.9863 4.98954 4.99212 4.99378 + 4.9951 4.99624 4.99715 4.99786 4.99839 4.99879 4.99909 4.99931 + 4.99922 4.99933 4.99971 5.00064 5.00084 5.00123 4.99865 + 4.99853 4.99983 5.00457 5.00242 5.00105 5.00062 5.00042 + 4.99971 4.9994 4.9992 4.9996 4.99955 4.99932 4.99918 4.99915 + 4.99919 4.99927 4.99937 4.99948 4.99957 4.99966 4.99974 + 4.9998 4.99985 4.99989 4.99992 4.99993 4.99994 4.99994 4.99996 + 4.99998 5 5 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 + 5.00001 5.00001 5 5 5 5 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 + 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5 5 5 5 5 5 4.9997 4.99998 4.99954 4.99963 + 5.00059 4.99945 4.99732 4.99957 5.00919 5.00558 5.00033 + 4.99851 4.9983 4.99854 4.99871 4.99928 4.99914 4.99939 4.99952 + 4.9998 4.99976 4.99744 4.99598 4.99478 4.99806 5.01911 5.04602 + 5.05469 5.01317 4.89484 4.69655 4.42036 4.06069 3.60793 + 3.12531 2.72975 2.45187 2.25081 2.09841 1.98509 1.90211 + 1.84084 1.79411 1.7574 1.72763 1.70283 1.68188 1.66389 1.64823 + 1.63438 1.62201 1.61088 1.60081 1.59163 1.58323 1.57549 + 1.56835 1.56173 1.55558 1.54985 1.54451 1.53951 1.53479 + 1.53035 1.52615 1.5222 1.51845 1.5149 1.51153 1.50834 1.50529 + 1.5024 1.49964 1.497 1.49449 1.49208 1.48977 1.48755 1.48542 + 1.48336 1.48138 1.47948 1.47765 1.4759 1.47419 1.47255 1.47096 + 1.46949 1.46823 1.46696 1.4657 1.46444 1.46317 1.46191 1.46065 + 1.45956 1.4585 1.45743 1.45636 1.45529 1.45422 1.45315 1.45226 + 1.45145 1.45064 1.44983 1.44902 1.44821 1.4474 1.44659 1.44579 + 1.44498 1.44417 1.44336 1.44255 1.44174 1.44094 1.44019 + 1.43944 1.43868 1.43793 1.43765 1.43679 1.43515 1.43405 + 1.43478 1.43387 1.43345 1.43184 1.43086 1.43021 1.43003 + 1.42988 1.42944 1.42883 1.42818 1.42702 1.42642 1.42595 + 1.42586 1.42616 1.42783 1.41733 1.38106 1.30738 1.3877 2.09819 + 3.05285 3.58059 3.77601 3.87609 4.02557 4.24887 4.4608 4.60411 + 4.72109 4.8255 4.90465 4.97379 5.01253 5.01532 5.01239 5.0092 + 5.00665 5.00474 5.00333 5.00232 5.00163 5.00117 5.00082 + 5.00057 5.00039 5.00027 5.00019 5.00013 5.00009 5.00006 + 5.00004 5.00003 5.00002 5.00001 5.00001 5 5 5 4.99998 4.99995 + 4.99992 4.99996 5.00005 5.00012 5.00008 4.99996 4.9999 4.99985 + 4.99986 4.99997 5.00021 5.0003 5.00024 5.00009 5.00007 5.00005 + 5.00003 5.00001 4.99998 4.99998 4.99998 4.99999 4.99999 + 5 5 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00002 5.00002 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99998 + 4.99998 4.99998 EOD @v[30].set(<<-'EOD') - 7.10441e-10 5.70385e-05 0.000226143 0.000131916 -0.000887764 - -8.01837e-05 -3.49653e-05 9.40039e-05 0.000118663 0.000108025 - 8.6059e-05 6.33268e-05 4.99295e-05 3.16843e-05 3.60692e-05 - 2.07572e-05 -8.6375e-05 3.44583e-05 8.07397e-05 0.000196296 - 0.000115615 -7.12768e-05 -0.000129812 -4.18679e-05 7.94364e-05 - 0.000182034 -5.41226e-05 -0.000451819 -0.000713937 -0.00129863 - -0.00262186 -0.00213417 -0.00133767 0.000775698 0.000969902 - 0.000549281 0.000280946 0.000140321 8.6919e-05 7.22446e-05 - 6.5631e-05 6.45263e-05 6.63087e-05 7.17391e-05 7.59042e-05 - 7.59172e-05 7.03353e-05 6.33558e-05 5.31136e-05 4.64278e-05 - 4.40594e-05 4.16909e-05 4.05674e-05 3.96957e-05 3.87875e-05 - 3.74977e-05 3.62079e-05 3.49181e-05 3.36283e-05 3.23385e-05 - 3.12427e-05 3.02775e-05 2.93124e-05 2.83472e-05 2.7382e-05 - 2.64613e-05 2.59077e-05 2.5354e-05 2.48004e-05 2.42468e-05 - 2.36931e-05 2.31395e-05 2.25859e-05 2.20322e-05 2.14786e-05 - 2.0925e-05 2.03916e-05 1.9995e-05 1.95984e-05 1.92019e-05 - 1.88053e-05 1.84087e-05 1.80122e-05 1.76156e-05 1.7219e-05 - 1.68225e-05 1.64259e-05 1.6051e-05 1.57991e-05 1.55471e-05 - 1.52952e-05 1.50433e-05 1.47913e-05 1.45394e-05 1.42875e-05 - 1.40356e-05 1.37836e-05 1.35317e-05 1.32978e-05 1.31513e-05 - 1.30048e-05 1.28583e-05 1.27118e-05 1.25653e-05 1.24188e-05 - 1.22724e-05 1.21259e-05 1.19794e-05 1.18329e-05 1.16864e-05 - 1.15399e-05 1.13934e-05 1.12469e-05 1.11005e-05 1.0954e-05 - 1.08075e-05 1.0661e-05 1.05145e-05 1.0368e-05 1.02215e-05 - 1.76447e-05 7.21516e-05 -3.59786e-05 -0.000159618 0.000156236 - 0.000135106 -0.000336402 -0.000302283 0.000699323 0.000473866 - -0.000156146 -0.000225625 -0.000123592 -3.78116e-05 8.47472e-06 - 2.43387e-06 -7.44762e-05 7.80111e-05 9.43608e-05 0.000170159 - 8.83919e-05 -0.00018802 -0.000373512 -0.000390597 0.000156875 - 0.0032343 0.00776304 -0.000566905 -0.00760695 -0.0159226 - -0.0245989 -0.0331402 -0.0100902 0.067837 0.266702 0.910818 - 1.82282 2.69714 3.43247 3.98325 4.32893 4.51529 4.67087 - 4.79288 4.87574 4.92797 4.95902 4.97655 4.98622 4.99195 - 4.99526 4.99735 4.9991 4.99974 4.99982 4.99974 4.99961 4.9995 - 4.99943 4.9994 4.9994 4.99942 4.99944 4.99948 4.99952 4.99956 - 4.99961 4.99965 4.9997 4.99974 4.99977 4.99981 4.99983 4.99986 - 4.99988 4.9999 4.99991 4.99992 4.99993 4.99994 4.99995 4.99995 - 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 4.99999 - 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5 - 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 5 5.00019 4.99888 4.99663 4.99457 4.99902 - 5.00229 5.00323 5.00302 5.0023 5.0015 5.00085 5.00041 5.00013 - 4.99993 4.99979 4.99948 4.99954 4.99983 5.00055 5.00109 - 5.00009 4.9987 4.998 4.99755 4.99676 4.99618 5.01091 5.05272 - 5.04156 4.80112 4.27692 3.42343 2.23953 0.967179 0.429813 - 0.540757 1.32991 2.32147 3.14903 3.78143 4.22325 4.47978 - 4.59448 4.69875 4.79798 4.87419 4.92339 4.95249 4.97174 - 4.98408 4.99124 4.99478 4.99729 4.99868 4.9992 4.99941 4.99947 - 4.99946 4.99943 4.9994 4.99939 4.9994 4.99942 4.99946 4.99951 - 4.99956 4.99961 4.99967 4.99973 4.99977 4.9998 4.99981 4.99983 - 4.99984 4.99987 4.99992 5.00001 5.00005 5.00001 4.99994 - 4.99995 4.99995 4.99996 4.99996 4.99996 4.99997 4.99997 - 4.99997 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 - 4.99998 4.99998 4.99998 + 7.10441e-10 5.70385e-05 0.000226143 0.000131916 -0.000887764 + -8.01837e-05 -3.49653e-05 9.40039e-05 0.000118663 0.000108025 + 8.6059e-05 6.33268e-05 4.99295e-05 3.16843e-05 3.60692e-05 + 2.07572e-05 -8.6375e-05 3.44583e-05 8.07397e-05 0.000196296 + 0.000115615 -7.12768e-05 -0.000129812 -4.18679e-05 7.94364e-05 + 0.000182034 -5.41226e-05 -0.000451819 -0.000713937 -0.00129863 + -0.00262186 -0.00213417 -0.00133767 0.000775698 0.000969902 + 0.000549281 0.000280946 0.000140321 8.6919e-05 7.22446e-05 + 6.5631e-05 6.45263e-05 6.63087e-05 7.17391e-05 7.59042e-05 + 7.59172e-05 7.03353e-05 6.33558e-05 5.31136e-05 4.64278e-05 + 4.40594e-05 4.16909e-05 4.05674e-05 3.96957e-05 3.87875e-05 + 3.74977e-05 3.62079e-05 3.49181e-05 3.36283e-05 3.23385e-05 + 3.12427e-05 3.02775e-05 2.93124e-05 2.83472e-05 2.7382e-05 + 2.64613e-05 2.59077e-05 2.5354e-05 2.48004e-05 2.42468e-05 + 2.36931e-05 2.31395e-05 2.25859e-05 2.20322e-05 2.14786e-05 + 2.0925e-05 2.03916e-05 1.9995e-05 1.95984e-05 1.92019e-05 + 1.88053e-05 1.84087e-05 1.80122e-05 1.76156e-05 1.7219e-05 + 1.68225e-05 1.64259e-05 1.6051e-05 1.57991e-05 1.55471e-05 + 1.52952e-05 1.50433e-05 1.47913e-05 1.45394e-05 1.42875e-05 + 1.40356e-05 1.37836e-05 1.35317e-05 1.32978e-05 1.31513e-05 + 1.30048e-05 1.28583e-05 1.27118e-05 1.25653e-05 1.24188e-05 + 1.22724e-05 1.21259e-05 1.19794e-05 1.18329e-05 1.16864e-05 + 1.15399e-05 1.13934e-05 1.12469e-05 1.11005e-05 1.0954e-05 + 1.08075e-05 1.0661e-05 1.05145e-05 1.0368e-05 1.02215e-05 + 1.76447e-05 7.21516e-05 -3.59786e-05 -0.000159618 0.000156236 + 0.000135106 -0.000336402 -0.000302283 0.000699323 0.000473866 + -0.000156146 -0.000225625 -0.000123592 -3.78116e-05 8.47472e-06 + 2.43387e-06 -7.44762e-05 7.80111e-05 9.43608e-05 0.000170159 + 8.83919e-05 -0.00018802 -0.000373512 -0.000390597 0.000156875 + 0.0032343 0.00776304 -0.000566905 -0.00760695 -0.0159226 + -0.0245989 -0.0331402 -0.0100902 0.067837 0.266702 0.910818 + 1.82282 2.69714 3.43247 3.98325 4.32893 4.51529 4.67087 + 4.79288 4.87574 4.92797 4.95902 4.97655 4.98622 4.99195 + 4.99526 4.99735 4.9991 4.99974 4.99982 4.99974 4.99961 4.9995 + 4.99943 4.9994 4.9994 4.99942 4.99944 4.99948 4.99952 4.99956 + 4.99961 4.99965 4.9997 4.99974 4.99977 4.99981 4.99983 4.99986 + 4.99988 4.9999 4.99991 4.99992 4.99993 4.99994 4.99995 4.99995 + 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 4.99999 + 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 5 + 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 5 5.00019 4.99888 4.99663 4.99457 4.99902 + 5.00229 5.00323 5.00302 5.0023 5.0015 5.00085 5.00041 5.00013 + 4.99993 4.99979 4.99948 4.99954 4.99983 5.00055 5.00109 + 5.00009 4.9987 4.998 4.99755 4.99676 4.99618 5.01091 5.05272 + 5.04156 4.80112 4.27692 3.42343 2.23953 0.967179 0.429813 + 0.540757 1.32991 2.32147 3.14903 3.78143 4.22325 4.47978 + 4.59448 4.69875 4.79798 4.87419 4.92339 4.95249 4.97174 + 4.98408 4.99124 4.99478 4.99729 4.99868 4.9992 4.99941 4.99947 + 4.99946 4.99943 4.9994 4.99939 4.9994 4.99942 4.99946 4.99951 + 4.99956 4.99961 4.99967 4.99973 4.99977 4.9998 4.99981 4.99983 + 4.99984 4.99987 4.99992 5.00001 5.00005 5.00001 4.99994 + 4.99995 4.99995 4.99996 4.99996 4.99996 4.99997 4.99997 + 4.99997 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 + 4.99998 4.99998 4.99998 EOD @v[31].set(<<-'EOD') - 1.8179e-09 -5.28841e-06 -1.44913e-05 -3.62932e-05 -9.75719e-05 - 0.000141781 3.73396e-05 -1.65603e-05 -1.5271e-05 -6.73884e-06 - 4.40157e-06 -4.85345e-06 -1.02964e-05 2.03126e-05 -1.89457e-05 - -8.75564e-06 7.67422e-06 4.71103e-06 1.29798e-05 6.13469e-06 - -1.14363e-05 -0.0394563 -0.0477298 -0.0622012 -0.0519225 - 0.262499 0.943611 1.67052 2.31017 2.84028 3.28467 3.61582 - 3.85887 4.13011 4.36511 4.54063 4.67013 4.76408 4.83263 - 4.8825 4.91837 4.94373 4.96117 4.97318 4.98093 4.98562 4.98906 - 4.99267 4.99539 4.99666 4.99731 4.99797 4.99844 4.99887 - 4.99927 4.99933 4.99938 4.99944 4.99949 4.99955 4.9996 4.99965 - 4.9997 4.99975 4.9998 4.99985 4.99986 4.99987 4.99989 4.9999 - 4.99991 4.99992 4.99993 4.99995 4.99996 4.99997 4.99998 - 4.99998 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5.00001 - 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99997 5.00002 5.00004 5.0001 5.0001 4.99987 5.00009 - 5.00021 5.00002 5.00004 4.99988 5.00013 4.99993 5.00026 - 4.99973 5 5.00006 5.00009 5.00004 5.00004 5.04854 4.82711 - 4.04208 2.64155 0.838902 0.19014 0.0982549 0.0723197 0.0576863 - 0.0427644 0.0301979 0.020146 0.0135728 0.00980358 0.00774482 - 0.00586604 0.0036687 0.00211511 0.00121906 0.000647581 0.000828436 - 0.00190938 0.00224254 0.00199956 0.00165488 0.00135612 0.00113715 - 0.000984181 0.000877175 0.000789973 0.000741139 0.000689338 - 0.000625676 0.000586082 0.000550152 0.000529573 0.000505606 - 0.000482117 0.000460574 0.000441649 0.000424674 0.000408398 - 0.000391914 0.000376272 0.000361487 0.000348181 0.000336045 - 0.000324466 0.000313545 0.000303046 0.000293056 0.00028356 - 0.000274586 0.000266155 0.000258279 0.000250938 0.000243789 - 0.000236912 0.000230244 0.000224186 0.000219291 0.000215346 - 0.000212468 0.000207291 0.000200862 0.00019368 0.000186767 - 0.000183515 0.000180263 0.00017701 0.000173758 0.000170506 - 0.000167253 0.000164001 0.000161164 0.000158357 0.00015555 - 0.000152743 0.000149936 0.000147129 0.000144322 0.000142066 - 0.000140096 0.000138127 0.000136157 0.000134187 0.000132218 - 0.000130248 0.000128278 0.000126308 0.000124339 0.000122369 - 0.000120399 0.000118429 0.00011646 0.000114527 0.000112892 - 0.000111258 0.000109623 0.000107988 0.000103598 6.86052e-05 - 3.337e-05 7.00783e-05 0.000218764 0.000221318 0.000118593 - -0.000113962 5.78552e-05 9.42068e-05 0.000237037 0.000171302 - 0.0001033 6.16066e-05 5.52908e-05 6.30233e-05 7.01897e-05 - 8.48573e-05 0.000106859 8.37213e-05 -0.0391541 -0.047722 - -0.0618454 -0.0169804 0.345725 1.03426 1.74825 2.37152 2.88737 - 3.32173 3.66761 3.9707 4.17762 3.98832 3.30483 2.09737 0.710892 - 0.148159 0.0707463 0.0555808 0.045618 0.0319116 0.0199589 - 0.0133357 0.00898528 0.00586075 0.00375478 0.00245443 0.00156038 - 0.000962344 0.000590953 0.000375107 0.000250243 0.00015882 - 0.000100203 6.18122e-05 3.7372e-05 2.23009e-05 1.32569e-05 - 8.29437e-06 5.72457e-06 3.96832e-06 2.98935e-06 2.59699e-06 - 2.75024e-06 3.38689e-06 4.0453e-06 3.50095e-06 1.64988e-06 - -3.84371e-07 -2.03828e-06 -3.46401e-06 -1.24301e-06 4.63458e-06 - 1.14104e-05 1.02619e-05 2.15487e-06 -2.98487e-06 -3.67221e-06 - -2.94279e-06 -2.58649e-06 -2.23019e-06 -1.87389e-06 -1.5176e-06 - -1.1613e-06 -7.92127e-07 -4.18889e-07 -4.56502e-08 3.27588e-07 - 7.00827e-07 8.79539e-07 8.17025e-07 7.5451e-07 6.91996e-07 - 6.29481e-07 5.66966e-07 5.04452e-07 4.41937e-07 3.79422e-07 - 3.16908e-07 2.54393e-07 1.90078e-07 1.25366e-07 6.0654e-08 - -4.05776e-09 -6.87696e-08 -1.33481e-07 -1.98193e-07 -2.62905e-07 - -3.27617e-07 -3.92329e-07 -4.40392e-07 -4.18802e-07 -3.97213e-07 - -3.75624e-07 -3.54035e-07 -3.32446e-07 -3.10856e-07 -2.89267e-07 - -2.67678e-07 + 1.8179e-09 -5.28841e-06 -1.44913e-05 -3.62932e-05 -9.75719e-05 + 0.000141781 3.73396e-05 -1.65603e-05 -1.5271e-05 -6.73884e-06 + 4.40157e-06 -4.85345e-06 -1.02964e-05 2.03126e-05 -1.89457e-05 + -8.75564e-06 7.67422e-06 4.71103e-06 1.29798e-05 6.13469e-06 + -1.14363e-05 -0.0394563 -0.0477298 -0.0622012 -0.0519225 + 0.262499 0.943611 1.67052 2.31017 2.84028 3.28467 3.61582 + 3.85887 4.13011 4.36511 4.54063 4.67013 4.76408 4.83263 + 4.8825 4.91837 4.94373 4.96117 4.97318 4.98093 4.98562 4.98906 + 4.99267 4.99539 4.99666 4.99731 4.99797 4.99844 4.99887 + 4.99927 4.99933 4.99938 4.99944 4.99949 4.99955 4.9996 4.99965 + 4.9997 4.99975 4.9998 4.99985 4.99986 4.99987 4.99989 4.9999 + 4.99991 4.99992 4.99993 4.99995 4.99996 4.99997 4.99998 + 4.99998 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5.00001 + 5.00001 5.00001 5 5 5 5 5 5 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99997 5.00002 5.00004 5.0001 5.0001 4.99987 5.00009 + 5.00021 5.00002 5.00004 4.99988 5.00013 4.99993 5.00026 + 4.99973 5 5.00006 5.00009 5.00004 5.00004 5.04854 4.82711 + 4.04208 2.64155 0.838902 0.19014 0.0982549 0.0723197 0.0576863 + 0.0427644 0.0301979 0.020146 0.0135728 0.00980358 0.00774482 + 0.00586604 0.0036687 0.00211511 0.00121906 0.000647581 0.000828436 + 0.00190938 0.00224254 0.00199956 0.00165488 0.00135612 0.00113715 + 0.000984181 0.000877175 0.000789973 0.000741139 0.000689338 + 0.000625676 0.000586082 0.000550152 0.000529573 0.000505606 + 0.000482117 0.000460574 0.000441649 0.000424674 0.000408398 + 0.000391914 0.000376272 0.000361487 0.000348181 0.000336045 + 0.000324466 0.000313545 0.000303046 0.000293056 0.00028356 + 0.000274586 0.000266155 0.000258279 0.000250938 0.000243789 + 0.000236912 0.000230244 0.000224186 0.000219291 0.000215346 + 0.000212468 0.000207291 0.000200862 0.00019368 0.000186767 + 0.000183515 0.000180263 0.00017701 0.000173758 0.000170506 + 0.000167253 0.000164001 0.000161164 0.000158357 0.00015555 + 0.000152743 0.000149936 0.000147129 0.000144322 0.000142066 + 0.000140096 0.000138127 0.000136157 0.000134187 0.000132218 + 0.000130248 0.000128278 0.000126308 0.000124339 0.000122369 + 0.000120399 0.000118429 0.00011646 0.000114527 0.000112892 + 0.000111258 0.000109623 0.000107988 0.000103598 6.86052e-05 + 3.337e-05 7.00783e-05 0.000218764 0.000221318 0.000118593 + -0.000113962 5.78552e-05 9.42068e-05 0.000237037 0.000171302 + 0.0001033 6.16066e-05 5.52908e-05 6.30233e-05 7.01897e-05 + 8.48573e-05 0.000106859 8.37213e-05 -0.0391541 -0.047722 + -0.0618454 -0.0169804 0.345725 1.03426 1.74825 2.37152 2.88737 + 3.32173 3.66761 3.9707 4.17762 3.98832 3.30483 2.09737 0.710892 + 0.148159 0.0707463 0.0555808 0.045618 0.0319116 0.0199589 + 0.0133357 0.00898528 0.00586075 0.00375478 0.00245443 0.00156038 + 0.000962344 0.000590953 0.000375107 0.000250243 0.00015882 + 0.000100203 6.18122e-05 3.7372e-05 2.23009e-05 1.32569e-05 + 8.29437e-06 5.72457e-06 3.96832e-06 2.98935e-06 2.59699e-06 + 2.75024e-06 3.38689e-06 4.0453e-06 3.50095e-06 1.64988e-06 + -3.84371e-07 -2.03828e-06 -3.46401e-06 -1.24301e-06 4.63458e-06 + 1.14104e-05 1.02619e-05 2.15487e-06 -2.98487e-06 -3.67221e-06 + -2.94279e-06 -2.58649e-06 -2.23019e-06 -1.87389e-06 -1.5176e-06 + -1.1613e-06 -7.92127e-07 -4.18889e-07 -4.56502e-08 3.27588e-07 + 7.00827e-07 8.79539e-07 8.17025e-07 7.5451e-07 6.91996e-07 + 6.29481e-07 5.66966e-07 5.04452e-07 4.41937e-07 3.79422e-07 + 3.16908e-07 2.54393e-07 1.90078e-07 1.25366e-07 6.0654e-08 + -4.05776e-09 -6.87696e-08 -1.33481e-07 -1.98193e-07 -2.62905e-07 + -3.27617e-07 -3.92329e-07 -4.40392e-07 -4.18802e-07 -3.97213e-07 + -3.75624e-07 -3.54035e-07 -3.32446e-07 -3.10856e-07 -2.89267e-07 + -2.67678e-07 EOD @v[32].set(<<-'EOD') - 1.10294 1.10297 1.10291 1.10277 1.10259 1.10294 1.10313 - 1.10306 1.10299 1.10296 1.10295 1.10295 1.10294 1.10294 - 1.10294 1.10294 1.10294 1.10294 1.10294 1.10296 1.10296 - 1.00547 0.998599 1.5201 2.49297 3.31258 3.73162 3.84757 - 3.92505 4.02965 4.16599 4.30294 4.41541 4.52886 4.64414 - 4.73865 4.81065 4.86391 4.90315 4.93188 4.95258 4.96726 - 4.97738 4.98436 4.98888 4.99162 4.99363 4.99573 4.99731 - 4.99804 4.99843 4.99881 4.99909 4.99934 4.99957 4.9996 4.99964 - 4.99967 4.9997 4.99973 4.99977 4.9998 4.99983 4.99986 4.99988 - 4.99991 4.99992 4.99992 4.99993 4.99994 4.99994 4.99995 - 4.99996 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 - 4.99999 4.99999 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 5.00028 4.99988 4.99968 - 5.00019 4.99987 5.00021 4.99973 4.99977 4.99996 4.99997 - 5.0002 4.99957 5.00026 4.99947 5.00074 5.00003 4.99987 4.99979 - 5.00008 4.99997 5.08794 5.05993 4.76875 3.99197 3.10174 - 2.5197 2.21771 2.04 1.92235 1.83874 1.77592 1.72665 1.686 - 1.65276 1.6286 1.61299 1.60039 1.58934 1.57954 1.57083 1.56306 - 1.55604 1.54963 1.54375 1.53832 1.53331 1.52865 1.52432 - 1.52026 1.51645 1.51287 1.50949 1.50629 1.50327 1.50039 - 1.49766 1.49505 1.49257 1.49019 1.48792 1.48574 1.48365 - 1.48164 1.47971 1.47784 1.47604 1.47431 1.47264 1.47102 - 1.46945 1.46794 1.46647 1.46505 1.46367 1.46233 1.46103 - 1.45976 1.45853 1.45733 1.45616 1.45502 1.45392 1.45284 - 1.45179 1.45076 1.44975 1.4488 1.44795 1.44711 1.44626 1.44541 - 1.44457 1.44372 1.44287 1.44212 1.44138 1.44063 1.43989 - 1.43914 1.4384 1.43766 1.43701 1.43641 1.43581 1.43522 1.43462 - 1.43402 1.43342 1.43282 1.43223 1.43163 1.43103 1.43043 - 1.42984 1.42924 1.42865 1.42808 1.42752 1.42695 1.42639 - 1.42584 1.42529 1.42472 1.42412 1.42365 1.42326 1.42304 - 1.42162 1.42082 1.42032 1.42029 1.42026 1.41995 1.41947 - 1.41894 1.41841 1.4179 1.41742 1.41699 1.41656 1.32097 1.30963 - 1.78765 2.64656 3.35764 3.747 3.86589 3.94217 4.04185 4.18453 - 4.3561 4.53439 4.68621 4.74905 4.77848 4.84629 4.91261 4.97541 - 5.01284 5.01548 5.01248 5.00924 5.00666 5.00475 5.00334 - 5.00234 5.00164 5.00118 5.00083 5.00058 5.0004 5.00028 5.00019 - 5.00013 5.00009 5.00007 5.00004 5.00003 5.00002 5.00001 - 5.00001 5.00001 5 5 4.99999 4.99995 4.99992 4.99996 5.00006 - 5.00012 5.00009 4.99997 4.9999 4.99985 4.99986 4.99997 5.00021 - 5.00031 5.00024 5.0001 5.00007 5.00005 5.00003 5.00001 4.99998 - 4.99998 4.99999 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 - 5 4.99999 4.99999 4.99999 4.99998 4.99998 4.99998 + 1.10294 1.10297 1.10291 1.10277 1.10259 1.10294 1.10313 + 1.10306 1.10299 1.10296 1.10295 1.10295 1.10294 1.10294 + 1.10294 1.10294 1.10294 1.10294 1.10294 1.10296 1.10296 + 1.00547 0.998599 1.5201 2.49297 3.31258 3.73162 3.84757 + 3.92505 4.02965 4.16599 4.30294 4.41541 4.52886 4.64414 + 4.73865 4.81065 4.86391 4.90315 4.93188 4.95258 4.96726 + 4.97738 4.98436 4.98888 4.99162 4.99363 4.99573 4.99731 + 4.99804 4.99843 4.99881 4.99909 4.99934 4.99957 4.9996 4.99964 + 4.99967 4.9997 4.99973 4.99977 4.9998 4.99983 4.99986 4.99988 + 4.99991 4.99992 4.99992 4.99993 4.99994 4.99994 4.99995 + 4.99996 4.99996 4.99997 4.99997 4.99998 4.99998 4.99999 + 4.99999 4.99999 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 5.00028 4.99988 4.99968 + 5.00019 4.99987 5.00021 4.99973 4.99977 4.99996 4.99997 + 5.0002 4.99957 5.00026 4.99947 5.00074 5.00003 4.99987 4.99979 + 5.00008 4.99997 5.08794 5.05993 4.76875 3.99197 3.10174 + 2.5197 2.21771 2.04 1.92235 1.83874 1.77592 1.72665 1.686 + 1.65276 1.6286 1.61299 1.60039 1.58934 1.57954 1.57083 1.56306 + 1.55604 1.54963 1.54375 1.53832 1.53331 1.52865 1.52432 + 1.52026 1.51645 1.51287 1.50949 1.50629 1.50327 1.50039 + 1.49766 1.49505 1.49257 1.49019 1.48792 1.48574 1.48365 + 1.48164 1.47971 1.47784 1.47604 1.47431 1.47264 1.47102 + 1.46945 1.46794 1.46647 1.46505 1.46367 1.46233 1.46103 + 1.45976 1.45853 1.45733 1.45616 1.45502 1.45392 1.45284 + 1.45179 1.45076 1.44975 1.4488 1.44795 1.44711 1.44626 1.44541 + 1.44457 1.44372 1.44287 1.44212 1.44138 1.44063 1.43989 + 1.43914 1.4384 1.43766 1.43701 1.43641 1.43581 1.43522 1.43462 + 1.43402 1.43342 1.43282 1.43223 1.43163 1.43103 1.43043 + 1.42984 1.42924 1.42865 1.42808 1.42752 1.42695 1.42639 + 1.42584 1.42529 1.42472 1.42412 1.42365 1.42326 1.42304 + 1.42162 1.42082 1.42032 1.42029 1.42026 1.41995 1.41947 + 1.41894 1.41841 1.4179 1.41742 1.41699 1.41656 1.32097 1.30963 + 1.78765 2.64656 3.35764 3.747 3.86589 3.94217 4.04185 4.18453 + 4.3561 4.53439 4.68621 4.74905 4.77848 4.84629 4.91261 4.97541 + 5.01284 5.01548 5.01248 5.00924 5.00666 5.00475 5.00334 + 5.00234 5.00164 5.00118 5.00083 5.00058 5.0004 5.00028 5.00019 + 5.00013 5.00009 5.00007 5.00004 5.00003 5.00002 5.00001 + 5.00001 5.00001 5 5 4.99999 4.99995 4.99992 4.99996 5.00006 + 5.00012 5.00009 4.99997 4.9999 4.99985 4.99986 4.99997 5.00021 + 5.00031 5.00024 5.0001 5.00007 5.00005 5.00003 5.00001 4.99998 + 4.99998 4.99999 4.99999 4.99999 5 5 5 5 5 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00002 5.00002 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 + 5 4.99999 4.99999 4.99999 4.99998 4.99998 4.99998 EOD @v[33].set(<<-'EOD') - 5 5.00012 5.00023 5.0003 4.99972 4.99988 4.99984 4.99991 - 4.99996 4.99999 5.00008 5.00009 4.99986 5.00003 5.00007 - 4.99995 4.9999 4.99997 5.00013 5.00014 5.00013 4.99701 4.99763 - 4.99742 4.99998 5.02836 5.07262 4.96856 4.57267 3.85637 - 2.79544 1.45942 0.408016 0.084885 0.0271375 0.0119294 0.00707546 - 0.0051087 0.00373035 0.00264737 0.00186477 0.00130379 0.000915857 - 0.000653121 0.000483893 0.000380852 0.000302362 0.000219498 - 0.000154435 0.000121928 0.000104026 8.61242e-05 7.48526e-05 - 6.49216e-05 5.56238e-05 5.29689e-05 5.03139e-05 4.7659e-05 - 4.5004e-05 4.23491e-05 4.00356e-05 3.79522e-05 3.58687e-05 - 3.37852e-05 3.17018e-05 2.97592e-05 2.89804e-05 2.82016e-05 - 2.74228e-05 2.66441e-05 2.58653e-05 2.50865e-05 2.43077e-05 - 2.35289e-05 2.27501e-05 2.19714e-05 2.12346e-05 2.07821e-05 - 2.03295e-05 1.98769e-05 1.94244e-05 1.89718e-05 1.85192e-05 - 1.80667e-05 1.76141e-05 1.71615e-05 1.6709e-05 1.62828e-05 - 1.60061e-05 1.57294e-05 1.54527e-05 1.5176e-05 1.48993e-05 - 1.46226e-05 1.43459e-05 1.40692e-05 1.37925e-05 1.35158e-05 - 1.3262e-05 1.31191e-05 1.29761e-05 1.28332e-05 1.26903e-05 - 1.25474e-05 1.24045e-05 1.22615e-05 1.21186e-05 1.19757e-05 - 1.18328e-05 1.16898e-05 1.15469e-05 1.1404e-05 1.12611e-05 - 1.11182e-05 1.09752e-05 1.08323e-05 1.06894e-05 1.05465e-05 - 1.04036e-05 1.02606e-05 1.00185e-05 3.8343e-05 -3.06781e-05 - -0.000111758 0.000111673 0.000130815 -0.000210491 -0.000231304 - 0.000310226 0.000265303 3.0878e-05 -4.48405e-05 -1.2852e-05 - -7.84469e-06 3.29986e-05 -1.23286e-05 -6.07871e-05 5.35082e-05 - 7.69194e-05 0.000126221 6.57178e-05 0.00223349 -0.0148854 - -0.0476636 -0.0491447 0.220125 1.11174 2.03988 2.90209 3.61069 - 4.13554 4.50679 4.71501 4.83916 4.91027 4.95284 4.98086 - 4.99151 4.98651 4.97113 4.95075 4.93102 4.93683 4.95457 - 4.97071 4.98212 4.98948 4.99386 4.99636 4.99785 4.9987 4.99927 - 4.99989 5.00014 5.00007 4.99988 4.99982 4.99976 4.99973 - 4.99972 4.99972 4.99973 4.99974 4.99975 4.99977 4.99979 - 4.99981 4.99984 4.99986 4.99988 4.99989 4.99991 4.99992 - 4.99993 4.99994 4.99995 4.99996 4.99996 4.99997 4.99997 - 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 - 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00002 5.00001 5.00001 - 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 - 4.99999 4.99999 4.99999 5 5.00012 4.99946 4.99839 4.99733 - 4.99948 5.00114 5.00158 5.00147 5.00113 5.00073 5.00043 - 5.0002 5.00006 4.99995 4.99986 4.99973 4.99976 4.9999 5.00029 - 5.00055 4.99704 4.99734 4.9972 5.00278 5.03354 5.07184 4.94057 - 4.51936 3.75638 2.60982 1.23803 0.315016 0.0796102 0.0252894 - 0.0165723 0.0827785 0.491298 1.40686 2.33436 3.1251 3.7691 - 4.22201 4.49976 4.68115 4.80513 4.88509 4.93208 4.95861 - 4.97579 4.98655 4.99268 4.99571 4.99771 4.99881 4.99929 - 4.99954 4.99965 4.9997 4.99971 4.99971 4.99971 4.99971 4.99972 - 4.99974 4.99976 4.99978 4.99981 4.99984 4.99987 4.99989 - 4.99991 4.99991 4.99992 4.99992 4.99993 4.99997 5.00003 - 5.00006 5.00004 5.00001 5 4.99999 4.99998 4.99998 4.99997 - 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 4.99999 - 4.99999 4.99999 5 5 5 5 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 4.99999 - 4.99999 4.99999 4.99999 4.99998 4.99998 + 5 5.00012 5.00023 5.0003 4.99972 4.99988 4.99984 4.99991 + 4.99996 4.99999 5.00008 5.00009 4.99986 5.00003 5.00007 + 4.99995 4.9999 4.99997 5.00013 5.00014 5.00013 4.99701 4.99763 + 4.99742 4.99998 5.02836 5.07262 4.96856 4.57267 3.85637 + 2.79544 1.45942 0.408016 0.084885 0.0271375 0.0119294 0.00707546 + 0.0051087 0.00373035 0.00264737 0.00186477 0.00130379 0.000915857 + 0.000653121 0.000483893 0.000380852 0.000302362 0.000219498 + 0.000154435 0.000121928 0.000104026 8.61242e-05 7.48526e-05 + 6.49216e-05 5.56238e-05 5.29689e-05 5.03139e-05 4.7659e-05 + 4.5004e-05 4.23491e-05 4.00356e-05 3.79522e-05 3.58687e-05 + 3.37852e-05 3.17018e-05 2.97592e-05 2.89804e-05 2.82016e-05 + 2.74228e-05 2.66441e-05 2.58653e-05 2.50865e-05 2.43077e-05 + 2.35289e-05 2.27501e-05 2.19714e-05 2.12346e-05 2.07821e-05 + 2.03295e-05 1.98769e-05 1.94244e-05 1.89718e-05 1.85192e-05 + 1.80667e-05 1.76141e-05 1.71615e-05 1.6709e-05 1.62828e-05 + 1.60061e-05 1.57294e-05 1.54527e-05 1.5176e-05 1.48993e-05 + 1.46226e-05 1.43459e-05 1.40692e-05 1.37925e-05 1.35158e-05 + 1.3262e-05 1.31191e-05 1.29761e-05 1.28332e-05 1.26903e-05 + 1.25474e-05 1.24045e-05 1.22615e-05 1.21186e-05 1.19757e-05 + 1.18328e-05 1.16898e-05 1.15469e-05 1.1404e-05 1.12611e-05 + 1.11182e-05 1.09752e-05 1.08323e-05 1.06894e-05 1.05465e-05 + 1.04036e-05 1.02606e-05 1.00185e-05 3.8343e-05 -3.06781e-05 + -0.000111758 0.000111673 0.000130815 -0.000210491 -0.000231304 + 0.000310226 0.000265303 3.0878e-05 -4.48405e-05 -1.2852e-05 + -7.84469e-06 3.29986e-05 -1.23286e-05 -6.07871e-05 5.35082e-05 + 7.69194e-05 0.000126221 6.57178e-05 0.00223349 -0.0148854 + -0.0476636 -0.0491447 0.220125 1.11174 2.03988 2.90209 3.61069 + 4.13554 4.50679 4.71501 4.83916 4.91027 4.95284 4.98086 + 4.99151 4.98651 4.97113 4.95075 4.93102 4.93683 4.95457 + 4.97071 4.98212 4.98948 4.99386 4.99636 4.99785 4.9987 4.99927 + 4.99989 5.00014 5.00007 4.99988 4.99982 4.99976 4.99973 + 4.99972 4.99972 4.99973 4.99974 4.99975 4.99977 4.99979 + 4.99981 4.99984 4.99986 4.99988 4.99989 4.99991 4.99992 + 4.99993 4.99994 4.99995 4.99996 4.99996 4.99997 4.99997 + 4.99998 4.99998 4.99998 4.99998 4.99999 4.99999 4.99999 + 4.99999 5 5 5 5.00001 5.00001 5.00001 5.00002 5.00001 5.00001 + 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 5 4.99999 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 4.99999 + 4.99999 4.99999 4.99999 5 5.00012 4.99946 4.99839 4.99733 + 4.99948 5.00114 5.00158 5.00147 5.00113 5.00073 5.00043 + 5.0002 5.00006 4.99995 4.99986 4.99973 4.99976 4.9999 5.00029 + 5.00055 4.99704 4.99734 4.9972 5.00278 5.03354 5.07184 4.94057 + 4.51936 3.75638 2.60982 1.23803 0.315016 0.0796102 0.0252894 + 0.0165723 0.0827785 0.491298 1.40686 2.33436 3.1251 3.7691 + 4.22201 4.49976 4.68115 4.80513 4.88509 4.93208 4.95861 + 4.97579 4.98655 4.99268 4.99571 4.99771 4.99881 4.99929 + 4.99954 4.99965 4.9997 4.99971 4.99971 4.99971 4.99971 4.99972 + 4.99974 4.99976 4.99978 4.99981 4.99984 4.99987 4.99989 + 4.99991 4.99991 4.99992 4.99992 4.99993 4.99997 5.00003 + 5.00006 5.00004 5.00001 5 4.99999 4.99998 4.99998 4.99997 + 4.99997 4.99997 4.99998 4.99998 4.99998 4.99999 4.99999 + 4.99999 4.99999 5 5 5 5 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5 5 5 5 5 5 5 4.99999 + 4.99999 4.99999 4.99999 4.99998 4.99998 EOD @v[34].set(<<-'EOD') - 5 5.00207 5.00813 5.01486 5.00156 5.0018 4.99861 4.99844 - 4.99888 4.9993 4.99956 4.99971 4.99979 4.99983 4.99987 4.99989 - 4.99671 4.9974 4.99864 5.00131 5.00377 5.0021 5.00039 4.99993 - 5.00004 5.0009 5.00109 4.99636 4.98617 4.96778 4.92047 4.89528 - 4.91112 4.9559 4.98286 4.99369 4.99812 4.99951 4.99994 5.00014 - 5.00008 4.99994 4.99984 4.99989 4.99998 5.00004 5.00004 - 5.00006 5.00005 5.00001 4.99997 4.99992 4.99993 4.99994 - 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 - 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 - 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 - 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 - 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 - 4.99998 4.99998 4.99998 4.99998 5.00131 5.00072 4.9977 4.99811 - 5.00325 4.99647 4.98948 4.99459 5.00262 5.00276 5.00156 - 5.00072 5.0003 5.00013 4.99995 4.99668 4.99775 4.99917 5.00173 - 5.00386 5.00188 4.99888 4.99757 4.99951 5.01712 5.0557 5.07088 - 5.07704 5.07758 5.06958 5.04223 5.03331 5.0279 5.03408 5.07611 - 5.01911 4.68594 3.99152 2.92195 1.69878 0.809 0.344091 0.154663 - 0.0788717 0.0467212 0.0336168 0.0280514 0.0254947 0.024173 - 0.0223567 0.0220555 0.0271514 0.0295872 0.0296052 0.0283971 - 0.0264726 0.0241813 0.0218244 0.0195349 0.017368 0.0152495 - 0.013295 0.0115444 0.00996982 0.00857091 0.00733891 0.00627261 - 0.0053494 0.00456316 0.00388373 0.00331073 0.00282181 0.00240991 - 0.00206389 0.00177187 0.00152283 0.00131167 0.00112558 0.000954373 - 0.000805726 0.00069326 0.000600991 0.000525743 0.00047355 - 0.00044359 0.000434815 0.000436053 0.000402511 0.000368969 - 0.000335427 0.000301886 0.000268344 0.000234802 0.00020126 - 0.000184967 0.000169932 0.000154896 0.000139861 0.000124825 - 0.00010979 9.47546e-05 8.67896e-05 8.24901e-05 7.81906e-05 - 7.38911e-05 6.95915e-05 6.5292e-05 6.09925e-05 5.66929e-05 - 5.23934e-05 4.80939e-05 4.37943e-05 3.94948e-05 3.51953e-05 - 3.08957e-05 2.67968e-05 2.42936e-05 2.17904e-05 1.92872e-05 - 1.6784e-05 0.00125927 -0.00794344 -0.0305499 -0.0621697 - -0.0463796 -0.0224608 -0.00538381 0.00546086 0.0108675 0.012883 - 0.0131787 0.0127271 0.0119702 0.0110398 0.0100635 0.00649617 - 0.00489388 0.00545863 0.0098351 0.0167428 0.0126563 0.00697542 - 0.00427027 0.00330002 0.00390774 0.00408999 -0.00259143 - -0.0160578 -0.0451849 -0.0409651 0.1301 0.597429 1.3848 - 2.63426 3.81272 4.51373 4.8412 4.98731 4.88165 4.37165 3.40034 - 2.17681 1.12217 0.505129 0.219703 0.104992 0.0622333 0.0448317 - 0.0355782 0.0311867 0.0293529 0.0274615 0.0288739 0.0307845 - 0.0304909 0.029245 0.0273602 0.0251006 0.022697 0.0202765 - 0.0179357 0.0157106 0.0136562 0.0117951 0.0101273 0.00865784 - 0.00739394 0.00634364 0.00551356 0.00480538 0.00415747 0.00356084 - 0.00297585 0.00236711 0.00181853 0.00160713 0.00169822 0.00166542 - 0.00145504 0.00120252 0.00109259 0.000982658 0.00087273 - 0.000762802 0.000652874 0.000584068 0.000528263 0.000472458 - 0.000416653 0.000360848 0.000321155 0.000301442 0.000281729 - 0.000262016 0.000242303 0.00022259 0.000202877 0.000183164 - 0.000163451 0.000143738 0.000124025 0.000114582 0.000107399 - 0.000100216 9.30332e-05 8.58502e-05 7.86672e-05 7.14841e-05 - 6.43011e-05 5.7118e-05 4.9935e-05 4.35378e-05 4.04281e-05 - 3.73184e-05 3.42088e-05 3.10991e-05 2.79894e-05 2.48798e-05 - 2.17701e-05 1.86604e-05 + 5 5.00207 5.00813 5.01486 5.00156 5.0018 4.99861 4.99844 + 4.99888 4.9993 4.99956 4.99971 4.99979 4.99983 4.99987 4.99989 + 4.99671 4.9974 4.99864 5.00131 5.00377 5.0021 5.00039 4.99993 + 5.00004 5.0009 5.00109 4.99636 4.98617 4.96778 4.92047 4.89528 + 4.91112 4.9559 4.98286 4.99369 4.99812 4.99951 4.99994 5.00014 + 5.00008 4.99994 4.99984 4.99989 4.99998 5.00004 5.00004 + 5.00006 5.00005 5.00001 4.99997 4.99992 4.99993 4.99994 + 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 + 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 4.99996 + 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 + 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 + 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 4.99997 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 + 4.99998 4.99998 4.99998 4.99998 5.00131 5.00072 4.9977 4.99811 + 5.00325 4.99647 4.98948 4.99459 5.00262 5.00276 5.00156 + 5.00072 5.0003 5.00013 4.99995 4.99668 4.99775 4.99917 5.00173 + 5.00386 5.00188 4.99888 4.99757 4.99951 5.01712 5.0557 5.07088 + 5.07704 5.07758 5.06958 5.04223 5.03331 5.0279 5.03408 5.07611 + 5.01911 4.68594 3.99152 2.92195 1.69878 0.809 0.344091 0.154663 + 0.0788717 0.0467212 0.0336168 0.0280514 0.0254947 0.024173 + 0.0223567 0.0220555 0.0271514 0.0295872 0.0296052 0.0283971 + 0.0264726 0.0241813 0.0218244 0.0195349 0.017368 0.0152495 + 0.013295 0.0115444 0.00996982 0.00857091 0.00733891 0.00627261 + 0.0053494 0.00456316 0.00388373 0.00331073 0.00282181 0.00240991 + 0.00206389 0.00177187 0.00152283 0.00131167 0.00112558 0.000954373 + 0.000805726 0.00069326 0.000600991 0.000525743 0.00047355 + 0.00044359 0.000434815 0.000436053 0.000402511 0.000368969 + 0.000335427 0.000301886 0.000268344 0.000234802 0.00020126 + 0.000184967 0.000169932 0.000154896 0.000139861 0.000124825 + 0.00010979 9.47546e-05 8.67896e-05 8.24901e-05 7.81906e-05 + 7.38911e-05 6.95915e-05 6.5292e-05 6.09925e-05 5.66929e-05 + 5.23934e-05 4.80939e-05 4.37943e-05 3.94948e-05 3.51953e-05 + 3.08957e-05 2.67968e-05 2.42936e-05 2.17904e-05 1.92872e-05 + 1.6784e-05 0.00125927 -0.00794344 -0.0305499 -0.0621697 + -0.0463796 -0.0224608 -0.00538381 0.00546086 0.0108675 0.012883 + 0.0131787 0.0127271 0.0119702 0.0110398 0.0100635 0.00649617 + 0.00489388 0.00545863 0.0098351 0.0167428 0.0126563 0.00697542 + 0.00427027 0.00330002 0.00390774 0.00408999 -0.00259143 + -0.0160578 -0.0451849 -0.0409651 0.1301 0.597429 1.3848 + 2.63426 3.81272 4.51373 4.8412 4.98731 4.88165 4.37165 3.40034 + 2.17681 1.12217 0.505129 0.219703 0.104992 0.0622333 0.0448317 + 0.0355782 0.0311867 0.0293529 0.0274615 0.0288739 0.0307845 + 0.0304909 0.029245 0.0273602 0.0251006 0.022697 0.0202765 + 0.0179357 0.0157106 0.0136562 0.0117951 0.0101273 0.00865784 + 0.00739394 0.00634364 0.00551356 0.00480538 0.00415747 0.00356084 + 0.00297585 0.00236711 0.00181853 0.00160713 0.00169822 0.00166542 + 0.00145504 0.00120252 0.00109259 0.000982658 0.00087273 + 0.000762802 0.000652874 0.000584068 0.000528263 0.000472458 + 0.000416653 0.000360848 0.000321155 0.000301442 0.000281729 + 0.000262016 0.000242303 0.00022259 0.000202877 0.000183164 + 0.000163451 0.000143738 0.000124025 0.000114582 0.000107399 + 0.000100216 9.30332e-05 8.58502e-05 7.86672e-05 7.14841e-05 + 6.43011e-05 5.7118e-05 4.9935e-05 4.35378e-05 4.04281e-05 + 3.73184e-05 3.42088e-05 3.10991e-05 2.79894e-05 2.48798e-05 + 2.17701e-05 1.86604e-05 EOD @v[35].set(<<-'EOD') - 7.24585e-12 2.21843e-05 3.20014e-05 1.25076e-05 -2.44947e-05 - 1.8425e-05 5.50546e-06 3.53025e-05 -1.07551e-05 -3.94383e-06 - -2.27848e-06 -9.04789e-05 7.44215e-05 -2.7662e-05 0.000200038 - -2.11998e-05 -2.09011e-05 2.37098e-05 2.18751e-05 -2.28422e-05 - -6.23659e-05 3.58241e-05 1.76386e-05 -4.28311e-05 0.000355626 - 0.00156903 0.00100999 -0.0085304 -0.02067 -0.0389485 -0.0651568 - -0.128475 -0.314362 -0.406837 -0.421558 -0.421277 -0.418176 - -0.414481 -0.410845 -0.407348 -0.403971 -0.400716 -0.397582 - -0.394563 -0.391658 -0.388866 -0.386178 -0.383585 -0.381094 - -0.378789 -0.376569 -0.37435 -0.372256 -0.370188 -0.36815 - -0.366422 -0.364694 -0.362967 -0.361239 -0.359511 -0.357888 - -0.356334 -0.354781 -0.353227 -0.351674 -0.350152 -0.348888 - -0.347625 -0.346361 -0.345098 -0.343834 -0.342571 -0.341307 - -0.340044 -0.33878 -0.337517 -0.336279 -0.335215 -0.334152 - -0.333088 -0.332024 -0.330961 -0.329897 -0.328833 -0.32777 - -0.326706 -0.325642 -0.324601 -0.323683 -0.322766 -0.321849 - -0.320932 -0.320014 -0.319097 -0.31818 -0.317263 -0.316345 - -0.315428 -0.314545 -0.313825 -0.313106 -0.312387 -0.311667 - -0.310948 -0.310228 -0.309509 -0.308789 -0.30807 -0.307351 - -0.306631 -0.305912 -0.305192 -0.304473 -0.303754 -0.303034 - -0.302315 -0.301595 -0.300876 -0.300157 -0.299437 -0.298716 - -0.29798 -0.297329 -0.296691 -0.295837 -0.29516 -0.294725 - -0.294044 -0.292917 -0.292351 -0.291965 -0.291365 -0.290687 - -0.290027 -0.289376 -0.288772 -0.288193 -0.287505 -0.286892 - -0.28626 -0.285714 -0.284545 -0.289246 -0.298717 -0.298492 - -0.214163 0.181451 0.0749974 0.0454707 0.0292987 0.0196837 - 0.0124119 0.00884715 0.00527181 0.00585821 0.0296361 0.169856 - 0.361207 0.538856 0.67469 0.685933 0.392802 0.17772 0.0813085 - 0.0424601 0.0246654 0.0175258 0.0144256 0.0129859 0.012205 - 0.0112846 0.010933 0.0134813 0.0147254 0.0147981 0.0142156 - 0.0132732 0.0121355 0.0109587 0.00981238 0.00872731 0.00767007 - 0.00669346 0.00581341 0.00502167 0.00431819 0.00369842 0.00316168 - 0.00269663 0.00230035 0.00195801 0.00166928 0.00142286 0.00121522 - 0.00104072 0.000893384 0.000767675 0.000661268 0.000567659 - 0.000481766 0.000407101 0.000350044 0.000302721 0.000263424 - 0.000236813 0.00022199 0.000218182 0.000219548 0.0002027 - 0.000185853 0.000169006 0.000152158 0.000135311 0.000118463 - 0.000101616 9.33782e-05 8.57685e-05 7.81588e-05 7.0549e-05 - 6.29393e-05 5.53296e-05 4.77199e-05 4.36954e-05 4.15296e-05 - 3.93637e-05 3.71978e-05 3.50319e-05 3.28661e-05 3.07002e-05 - 2.85343e-05 2.63685e-05 2.42026e-05 2.20367e-05 1.98709e-05 - 1.7705e-05 1.55391e-05 1.34772e-05 1.22416e-05 1.10061e-05 - 9.77055e-06 8.535e-06 0.000631271 -0.00362586 -0.0146235 - -0.0308486 -0.0237466 -0.0117522 -0.00304171 0.00251033 - 0.00531986 0.0063897 0.00657351 0.00636494 0.00599705 0.00553442 - 0.00505994 0.00330925 0.00246671 0.0027006 0.00473161 0.00830333 - 0.00649147 0.00356815 0.00217448 0.00187579 0.00270447 0.00219543 - -0.00546118 -0.0179576 -0.0445306 -0.0649309 0.0197935 0.473629 - 0.87268 0.269542 0.0086094 0.0844602 0.606456 1.04929 0.906014 - 0.916205 0.919425 0.872867 0.556244 0.262457 0.11838 0.0571226 - 0.0333451 0.0237133 0.0185096 0.0159617 0.0148663 0.0138683 - 0.0144081 0.0153797 0.0152551 0.0146487 0.0137192 0.0125973 - 0.0113996 0.0101903 0.00901851 0.00790495 0.00687502 0.00593994 - 0.00510092 0.00436111 0.00372439 0.0031945 0.00277537 0.00241888 - 0.002095 0.00179943 0.00150419 0.00119264 0.00090934 0.000802394 - 0.000852816 0.000838368 0.000730842 0.000601028 0.000546616 - 0.000492205 0.000437793 0.000383381 0.000328969 0.00029454 - 0.000266428 0.000238317 0.000210205 0.000182093 0.000162091 - 0.000152145 0.000142198 0.000132252 0.000122306 0.000112359 - 0.000102413 9.24665e-05 8.25201e-05 7.25738e-05 6.26274e-05 - 5.78553e-05 5.42216e-05 5.05878e-05 4.69541e-05 4.33204e-05 - 3.96867e-05 3.60529e-05 3.24192e-05 2.87855e-05 2.51518e-05 - 2.19153e-05 2.03406e-05 1.8766e-05 1.71913e-05 1.56167e-05 - 1.4042e-05 1.24674e-05 1.08927e-05 9.31806e-06 + 7.24585e-12 2.21843e-05 3.20014e-05 1.25076e-05 -2.44947e-05 + 1.8425e-05 5.50546e-06 3.53025e-05 -1.07551e-05 -3.94383e-06 + -2.27848e-06 -9.04789e-05 7.44215e-05 -2.7662e-05 0.000200038 + -2.11998e-05 -2.09011e-05 2.37098e-05 2.18751e-05 -2.28422e-05 + -6.23659e-05 3.58241e-05 1.76386e-05 -4.28311e-05 0.000355626 + 0.00156903 0.00100999 -0.0085304 -0.02067 -0.0389485 -0.0651568 + -0.128475 -0.314362 -0.406837 -0.421558 -0.421277 -0.418176 + -0.414481 -0.410845 -0.407348 -0.403971 -0.400716 -0.397582 + -0.394563 -0.391658 -0.388866 -0.386178 -0.383585 -0.381094 + -0.378789 -0.376569 -0.37435 -0.372256 -0.370188 -0.36815 + -0.366422 -0.364694 -0.362967 -0.361239 -0.359511 -0.357888 + -0.356334 -0.354781 -0.353227 -0.351674 -0.350152 -0.348888 + -0.347625 -0.346361 -0.345098 -0.343834 -0.342571 -0.341307 + -0.340044 -0.33878 -0.337517 -0.336279 -0.335215 -0.334152 + -0.333088 -0.332024 -0.330961 -0.329897 -0.328833 -0.32777 + -0.326706 -0.325642 -0.324601 -0.323683 -0.322766 -0.321849 + -0.320932 -0.320014 -0.319097 -0.31818 -0.317263 -0.316345 + -0.315428 -0.314545 -0.313825 -0.313106 -0.312387 -0.311667 + -0.310948 -0.310228 -0.309509 -0.308789 -0.30807 -0.307351 + -0.306631 -0.305912 -0.305192 -0.304473 -0.303754 -0.303034 + -0.302315 -0.301595 -0.300876 -0.300157 -0.299437 -0.298716 + -0.29798 -0.297329 -0.296691 -0.295837 -0.29516 -0.294725 + -0.294044 -0.292917 -0.292351 -0.291965 -0.291365 -0.290687 + -0.290027 -0.289376 -0.288772 -0.288193 -0.287505 -0.286892 + -0.28626 -0.285714 -0.284545 -0.289246 -0.298717 -0.298492 + -0.214163 0.181451 0.0749974 0.0454707 0.0292987 0.0196837 + 0.0124119 0.00884715 0.00527181 0.00585821 0.0296361 0.169856 + 0.361207 0.538856 0.67469 0.685933 0.392802 0.17772 0.0813085 + 0.0424601 0.0246654 0.0175258 0.0144256 0.0129859 0.012205 + 0.0112846 0.010933 0.0134813 0.0147254 0.0147981 0.0142156 + 0.0132732 0.0121355 0.0109587 0.00981238 0.00872731 0.00767007 + 0.00669346 0.00581341 0.00502167 0.00431819 0.00369842 0.00316168 + 0.00269663 0.00230035 0.00195801 0.00166928 0.00142286 0.00121522 + 0.00104072 0.000893384 0.000767675 0.000661268 0.000567659 + 0.000481766 0.000407101 0.000350044 0.000302721 0.000263424 + 0.000236813 0.00022199 0.000218182 0.000219548 0.0002027 + 0.000185853 0.000169006 0.000152158 0.000135311 0.000118463 + 0.000101616 9.33782e-05 8.57685e-05 7.81588e-05 7.0549e-05 + 6.29393e-05 5.53296e-05 4.77199e-05 4.36954e-05 4.15296e-05 + 3.93637e-05 3.71978e-05 3.50319e-05 3.28661e-05 3.07002e-05 + 2.85343e-05 2.63685e-05 2.42026e-05 2.20367e-05 1.98709e-05 + 1.7705e-05 1.55391e-05 1.34772e-05 1.22416e-05 1.10061e-05 + 9.77055e-06 8.535e-06 0.000631271 -0.00362586 -0.0146235 + -0.0308486 -0.0237466 -0.0117522 -0.00304171 0.00251033 + 0.00531986 0.0063897 0.00657351 0.00636494 0.00599705 0.00553442 + 0.00505994 0.00330925 0.00246671 0.0027006 0.00473161 0.00830333 + 0.00649147 0.00356815 0.00217448 0.00187579 0.00270447 0.00219543 + -0.00546118 -0.0179576 -0.0445306 -0.0649309 0.0197935 0.473629 + 0.87268 0.269542 0.0086094 0.0844602 0.606456 1.04929 0.906014 + 0.916205 0.919425 0.872867 0.556244 0.262457 0.11838 0.0571226 + 0.0333451 0.0237133 0.0185096 0.0159617 0.0148663 0.0138683 + 0.0144081 0.0153797 0.0152551 0.0146487 0.0137192 0.0125973 + 0.0113996 0.0101903 0.00901851 0.00790495 0.00687502 0.00593994 + 0.00510092 0.00436111 0.00372439 0.0031945 0.00277537 0.00241888 + 0.002095 0.00179943 0.00150419 0.00119264 0.00090934 0.000802394 + 0.000852816 0.000838368 0.000730842 0.000601028 0.000546616 + 0.000492205 0.000437793 0.000383381 0.000328969 0.00029454 + 0.000266428 0.000238317 0.000210205 0.000182093 0.000162091 + 0.000152145 0.000142198 0.000132252 0.000122306 0.000112359 + 0.000102413 9.24665e-05 8.25201e-05 7.25738e-05 6.26274e-05 + 5.78553e-05 5.42216e-05 5.05878e-05 4.69541e-05 4.33204e-05 + 3.96867e-05 3.60529e-05 3.24192e-05 2.87855e-05 2.51518e-05 + 2.19153e-05 2.03406e-05 1.8766e-05 1.71913e-05 1.56167e-05 + 1.4042e-05 1.24674e-05 1.08927e-05 9.31806e-06 EOD @v[36].set(<<-'EOD') - 5 5.01426 5.02852 5.01923 4.77685 4.56471 4.52338 4.56813 - 4.63122 4.693 4.74776 4.79385 4.83258 4.86358 4.88918 4.91021 - 4.90553 4.89733 4.89554 4.91953 5.00757 5.07101 5.06318 - 5.05241 5.05535 5.08042 5.07251 4.90973 4.56136 3.98637 - 3.237 2.67216 2.33678 2.13529 2.00544 1.91429 1.84638 1.79461 - 1.75338 1.71958 1.69175 1.6686 1.64918 1.63258 1.61836 1.60607 - 1.59506 1.58483 1.57575 1.56847 1.56193 1.55538 1.54968 - 1.54416 1.5388 1.53523 1.53165 1.52807 1.52449 1.52091 1.51771 - 1.51477 1.51182 1.50888 1.50593 1.50309 1.50113 1.49917 - 1.4972 1.49524 1.49328 1.49132 1.48935 1.48739 1.48543 1.48346 - 1.48157 1.48012 1.47868 1.47724 1.47579 1.47435 1.47291 - 1.47146 1.47002 1.46857 1.46713 1.46574 1.46462 1.4635 1.46238 - 1.46126 1.46014 1.45902 1.4579 1.45678 1.45567 1.45455 1.45349 - 1.45275 1.45201 1.45127 1.45053 1.44979 1.44905 1.44831 - 1.44757 1.44683 1.44609 1.44535 1.44461 1.44387 1.44313 - 1.44239 1.44165 1.44091 1.44017 1.43943 1.43869 1.43795 - 1.43721 1.43874 1.43976 1.43619 1.43182 1.43726 1.43084 - 1.42587 1.42383 1.42642 1.42728 1.42736 1.4271 1.42669 1.42621 - 1.42569 1.41703 1.41244 1.41019 1.41199 1.41833 1.42502 - 1.41504 1.37535 1.28381 1.44779 2.33713 3.25835 3.67554 - 3.84975 4.01125 4.2253 4.45433 4.62215 4.74478 4.82998 4.8868 - 4.92396 4.94768 4.96498 4.98537 5.0128 5.04467 5.06722 5.06535 - 5.01475 4.91956 4.80647 4.7242 4.7059 4.73552 4.76379 4.81684 - 4.87376 4.92276 4.96112 4.9884 5.0045 5.00999 5.00933 5.00619 - 5.00384 5.00342 5.00373 5.00362 5.00309 5.00272 5.00239 - 5.00204 5.00172 5.00146 5.00124 5.00105 5.00089 5.00076 - 5.00065 5.00057 5.00048 5.00041 5.00034 5.00028 5.00023 - 5.00019 5.00015 5.00015 5.00016 5.0002 5.00023 5.00021 5.00019 - 5.00017 5.00015 5.00012 5.0001 5.00008 5.00007 5.00006 5.00005 - 5.00004 5.00003 5.00002 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 - 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00001 - 5.00001 5.00001 5.00062 4.99506 4.9835 4.96726 4.9728 4.97877 - 4.98675 4.9966 5.00406 5.00679 5.00629 5.00561 5.00487 5.00429 - 5.00384 5.002 5.00164 5.00229 5.00484 5.00769 5.00019 5.00242 - 5.01319 5.0335 5.07265 5.10129 5.11485 5.12551 5.13953 5.16048 - 5.18862 5.22811 5.25656 5.25627 5.19975 4.9139 4.24745 3.43732 - 2.8202 2.43224 2.17409 2.01333 1.93951 1.94622 1.98861 2.02217 - 2.05383 2.08376 2.11184 2.13793 2.16191 2.18267 2.20502 - 2.22837 2.24958 2.26901 2.28648 2.302 2.31582 2.32802 2.33869 - 2.34795 2.35596 2.36282 2.3687 2.37371 2.37797 2.38161 2.38476 - 2.38743 2.3897 2.39168 2.39329 2.39463 2.39575 2.39671 2.39756 - 2.39835 2.39907 2.39968 2.39999 2.4003 2.40061 2.40091 2.40122 - 2.40142 2.40159 2.40176 2.40193 2.4021 2.40222 2.40228 2.40234 - 2.4024 2.40247 2.40253 2.40259 2.40265 2.40271 2.40277 2.40284 - 2.40287 2.40289 2.40291 2.40294 2.40296 2.40298 2.40301 - 2.40303 2.40305 2.40308 2.4031 2.40311 2.40312 2.40313 2.40314 - 2.40315 2.40316 2.40317 2.40318 + 5 5.01426 5.02852 5.01923 4.77685 4.56471 4.52338 4.56813 + 4.63122 4.693 4.74776 4.79385 4.83258 4.86358 4.88918 4.91021 + 4.90553 4.89733 4.89554 4.91953 5.00757 5.07101 5.06318 + 5.05241 5.05535 5.08042 5.07251 4.90973 4.56136 3.98637 + 3.237 2.67216 2.33678 2.13529 2.00544 1.91429 1.84638 1.79461 + 1.75338 1.71958 1.69175 1.6686 1.64918 1.63258 1.61836 1.60607 + 1.59506 1.58483 1.57575 1.56847 1.56193 1.55538 1.54968 + 1.54416 1.5388 1.53523 1.53165 1.52807 1.52449 1.52091 1.51771 + 1.51477 1.51182 1.50888 1.50593 1.50309 1.50113 1.49917 + 1.4972 1.49524 1.49328 1.49132 1.48935 1.48739 1.48543 1.48346 + 1.48157 1.48012 1.47868 1.47724 1.47579 1.47435 1.47291 + 1.47146 1.47002 1.46857 1.46713 1.46574 1.46462 1.4635 1.46238 + 1.46126 1.46014 1.45902 1.4579 1.45678 1.45567 1.45455 1.45349 + 1.45275 1.45201 1.45127 1.45053 1.44979 1.44905 1.44831 + 1.44757 1.44683 1.44609 1.44535 1.44461 1.44387 1.44313 + 1.44239 1.44165 1.44091 1.44017 1.43943 1.43869 1.43795 + 1.43721 1.43874 1.43976 1.43619 1.43182 1.43726 1.43084 + 1.42587 1.42383 1.42642 1.42728 1.42736 1.4271 1.42669 1.42621 + 1.42569 1.41703 1.41244 1.41019 1.41199 1.41833 1.42502 + 1.41504 1.37535 1.28381 1.44779 2.33713 3.25835 3.67554 + 3.84975 4.01125 4.2253 4.45433 4.62215 4.74478 4.82998 4.8868 + 4.92396 4.94768 4.96498 4.98537 5.0128 5.04467 5.06722 5.06535 + 5.01475 4.91956 4.80647 4.7242 4.7059 4.73552 4.76379 4.81684 + 4.87376 4.92276 4.96112 4.9884 5.0045 5.00999 5.00933 5.00619 + 5.00384 5.00342 5.00373 5.00362 5.00309 5.00272 5.00239 + 5.00204 5.00172 5.00146 5.00124 5.00105 5.00089 5.00076 + 5.00065 5.00057 5.00048 5.00041 5.00034 5.00028 5.00023 + 5.00019 5.00015 5.00015 5.00016 5.0002 5.00023 5.00021 5.00019 + 5.00017 5.00015 5.00012 5.0001 5.00008 5.00007 5.00006 5.00005 + 5.00004 5.00003 5.00002 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00002 5.00002 5.00002 5.00002 + 5.00002 5.00002 5.00002 5.00002 5.00002 5.00002 5.00001 + 5.00001 5.00001 5.00062 4.99506 4.9835 4.96726 4.9728 4.97877 + 4.98675 4.9966 5.00406 5.00679 5.00629 5.00561 5.00487 5.00429 + 5.00384 5.002 5.00164 5.00229 5.00484 5.00769 5.00019 5.00242 + 5.01319 5.0335 5.07265 5.10129 5.11485 5.12551 5.13953 5.16048 + 5.18862 5.22811 5.25656 5.25627 5.19975 4.9139 4.24745 3.43732 + 2.8202 2.43224 2.17409 2.01333 1.93951 1.94622 1.98861 2.02217 + 2.05383 2.08376 2.11184 2.13793 2.16191 2.18267 2.20502 + 2.22837 2.24958 2.26901 2.28648 2.302 2.31582 2.32802 2.33869 + 2.34795 2.35596 2.36282 2.3687 2.37371 2.37797 2.38161 2.38476 + 2.38743 2.3897 2.39168 2.39329 2.39463 2.39575 2.39671 2.39756 + 2.39835 2.39907 2.39968 2.39999 2.4003 2.40061 2.40091 2.40122 + 2.40142 2.40159 2.40176 2.40193 2.4021 2.40222 2.40228 2.40234 + 2.4024 2.40247 2.40253 2.40259 2.40265 2.40271 2.40277 2.40284 + 2.40287 2.40289 2.40291 2.40294 2.40296 2.40298 2.40301 + 2.40303 2.40305 2.40308 2.4031 2.40311 2.40312 2.40313 2.40314 + 2.40315 2.40316 2.40317 2.40318 EOD @v[37].set(<<-'EOD') - 5 5.01732 5.03181 5.05944 5.12686 5.20725 5.28103 5.31254 - 5.32901 5.33709 5.3408 5.34257 5.34311 5.34347 5.34386 5.34411 - 5.3406 5.33484 5.32942 5.32904 5.33644 5.34869 5.35001 5.34882 - 5.34758 5.34672 5.34599 5.34496 5.34364 5.34165 5.33712 - 5.33502 5.3366 5.34067 5.34306 5.34398 5.34434 5.34442 5.34443 - 5.34443 5.34441 5.34439 5.34437 5.34437 5.34438 5.34438 - 5.34438 5.34438 5.34438 5.34437 5.34437 5.34436 5.34436 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 - 5.34437 5.34437 5.34437 5.34437 5.34437 5.35377 5.35451 - 5.34265 5.34488 5.35861 5.28622 4.90033 4.75027 4.89731 - 4.97098 4.99293 4.99832 4.99909 4.99956 4.99858 4.99829 - 4.9998 5.00035 5.0038 5.00989 5.00251 4.99438 4.9953 4.99761 - 4.99985 5.00152 5.0011 5.00046 4.99996 4.99925 4.99862 4.99919 - 4.99961 5.00048 5.00234 4.99654 4.98235 4.95936 4.83738 - 4.53021 4.21004 4.00593 3.91207 3.88059 3.87822 3.89117 - 3.91278 3.94044 3.97376 4.01152 4.05052 4.10679 4.17908 - 4.25673 4.33414 4.40875 4.47879 4.54342 4.60258 4.65595 - 4.70291 4.74414 4.78018 4.81185 4.83915 4.86291 4.88301 - 4.90048 4.91528 4.92802 4.9387 4.94777 4.95539 4.9618 4.96725 - 4.97195 4.97588 4.97932 4.98247 4.98512 4.98697 4.98831 - 4.98919 4.99015 4.99101 4.99169 4.99222 4.99282 4.99341 - 4.994 4.9946 4.99519 4.99578 4.99638 4.99667 4.99693 4.9972 - 4.99747 4.99773 4.998 4.99827 4.99841 4.99849 4.99856 4.99864 - 4.99872 4.9988 4.99888 4.99896 4.99904 4.99911 4.99919 4.99927 - 4.99935 4.99943 4.9995 4.99955 4.9996 4.99965 4.9997 5.00736 - 4.98252 4.87516 4.66727 4.49142 4.43103 4.4301 4.4571 4.49729 - 4.5407 4.5835 4.62363 4.66114 4.69577 4.72738 4.74632 4.75971 - 4.77576 4.80671 4.87073 4.91665 4.93252 4.94418 4.95331 - 4.96094 4.96727 4.97148 4.97471 4.97612 4.98276 5.00247 - 5.04086 5.08628 5.10673 5.08887 5.0564 5.02767 5.01336 4.99685 - 4.97422 4.90866 4.67035 4.33117 4.07888 3.94432 3.89105 - 3.88174 3.89292 3.91442 3.94564 3.98708 4.0355 4.09134 4.16315 - 4.24088 4.31918 4.39527 4.46693 4.53337 4.59405 4.6486 4.69693 - 4.73938 4.77617 4.80809 4.83551 4.85895 4.87894 4.89596 - 4.91081 4.92417 4.93651 4.94552 4.95198 4.9565 4.96096 4.96523 - 4.96972 4.97428 4.97868 4.98064 4.9826 4.98455 4.98651 4.98847 - 4.98967 4.99064 4.9916 4.99257 4.99353 4.99422 4.99457 4.99493 - 4.99528 4.99563 4.99598 4.99633 4.99668 4.99703 4.99738 - 4.99773 4.9979 4.99804 4.99817 4.9983 4.99843 4.99856 4.99869 - 4.99883 4.99896 4.99909 4.99921 4.99926 4.99931 4.99937 - 4.99942 4.99948 4.99953 4.99959 4.99964 + 5 5.01732 5.03181 5.05944 5.12686 5.20725 5.28103 5.31254 + 5.32901 5.33709 5.3408 5.34257 5.34311 5.34347 5.34386 5.34411 + 5.3406 5.33484 5.32942 5.32904 5.33644 5.34869 5.35001 5.34882 + 5.34758 5.34672 5.34599 5.34496 5.34364 5.34165 5.33712 + 5.33502 5.3366 5.34067 5.34306 5.34398 5.34434 5.34442 5.34443 + 5.34443 5.34441 5.34439 5.34437 5.34437 5.34438 5.34438 + 5.34438 5.34438 5.34438 5.34437 5.34437 5.34436 5.34436 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 5.34437 + 5.34437 5.34437 5.34437 5.34437 5.34437 5.35377 5.35451 + 5.34265 5.34488 5.35861 5.28622 4.90033 4.75027 4.89731 + 4.97098 4.99293 4.99832 4.99909 4.99956 4.99858 4.99829 + 4.9998 5.00035 5.0038 5.00989 5.00251 4.99438 4.9953 4.99761 + 4.99985 5.00152 5.0011 5.00046 4.99996 4.99925 4.99862 4.99919 + 4.99961 5.00048 5.00234 4.99654 4.98235 4.95936 4.83738 + 4.53021 4.21004 4.00593 3.91207 3.88059 3.87822 3.89117 + 3.91278 3.94044 3.97376 4.01152 4.05052 4.10679 4.17908 + 4.25673 4.33414 4.40875 4.47879 4.54342 4.60258 4.65595 + 4.70291 4.74414 4.78018 4.81185 4.83915 4.86291 4.88301 + 4.90048 4.91528 4.92802 4.9387 4.94777 4.95539 4.9618 4.96725 + 4.97195 4.97588 4.97932 4.98247 4.98512 4.98697 4.98831 + 4.98919 4.99015 4.99101 4.99169 4.99222 4.99282 4.99341 + 4.994 4.9946 4.99519 4.99578 4.99638 4.99667 4.99693 4.9972 + 4.99747 4.99773 4.998 4.99827 4.99841 4.99849 4.99856 4.99864 + 4.99872 4.9988 4.99888 4.99896 4.99904 4.99911 4.99919 4.99927 + 4.99935 4.99943 4.9995 4.99955 4.9996 4.99965 4.9997 5.00736 + 4.98252 4.87516 4.66727 4.49142 4.43103 4.4301 4.4571 4.49729 + 4.5407 4.5835 4.62363 4.66114 4.69577 4.72738 4.74632 4.75971 + 4.77576 4.80671 4.87073 4.91665 4.93252 4.94418 4.95331 + 4.96094 4.96727 4.97148 4.97471 4.97612 4.98276 5.00247 + 5.04086 5.08628 5.10673 5.08887 5.0564 5.02767 5.01336 4.99685 + 4.97422 4.90866 4.67035 4.33117 4.07888 3.94432 3.89105 + 3.88174 3.89292 3.91442 3.94564 3.98708 4.0355 4.09134 4.16315 + 4.24088 4.31918 4.39527 4.46693 4.53337 4.59405 4.6486 4.69693 + 4.73938 4.77617 4.80809 4.83551 4.85895 4.87894 4.89596 + 4.91081 4.92417 4.93651 4.94552 4.95198 4.9565 4.96096 4.96523 + 4.96972 4.97428 4.97868 4.98064 4.9826 4.98455 4.98651 4.98847 + 4.98967 4.99064 4.9916 4.99257 4.99353 4.99422 4.99457 4.99493 + 4.99528 4.99563 4.99598 4.99633 4.99668 4.99703 4.99738 + 4.99773 4.9979 4.99804 4.99817 4.9983 4.99843 4.99856 4.99869 + 4.99883 4.99896 4.99909 4.99921 4.99926 4.99931 4.99937 + 4.99942 4.99948 4.99953 4.99959 4.99964 EOD @v[38].set(<<-'EOD') - 4.49849 4.53282 4.58329 4.66625 4.83345 4.97823 5.0207 5.01816 - 5.01116 5.00595 5.00296 5.00148 5.00073 5.00062 5.00033 - 5.0003 4.99864 4.99661 4.99652 4.99928 5.00361 5.12573 5.17251 - 5.22612 5.33479 5.44503 5.44432 5.44379 5.44334 5.443 5.44276 - 5.44258 5.44246 5.44238 5.44232 5.44228 5.44225 5.44223 - 5.44221 5.4422 5.44219 5.44219 5.44218 5.44218 5.44218 5.44218 - 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 - 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 - 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44216 - 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 - 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 - 5.44216 5.44216 5.44216 5.44216 5.44215 5.44215 5.44215 - 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 - 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 - 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 - 5.44214 5.44214 5.44214 5.44214 5.44214 5.44214 5.44214 - 5.44214 5.44214 5.44214 5.44214 5.44212 5.45159 5.45236 - 5.44064 5.44307 5.45616 5.38122 4.77163 3.53297 2.74466 - 2.34448 2.11802 1.9783 1.88656 1.82001 1.77389 1.72955 1.69632 - 1.66971 1.6526 1.65236 1.56034 1.53764 1.97139 2.75096 3.39212 - 3.74042 3.82345 3.85696 3.88547 3.91862 3.9585 4.00467 4.05903 - 4.1254 4.19533 4.26791 4.34517 4.42112 4.49238 4.55807 4.6179 - 4.6713 4.71815 4.75889 4.79418 4.82456 4.85062 4.87291 4.89196 - 4.90823 4.92209 4.93388 4.9439 4.95242 4.95968 4.96585 4.97108 - 4.9755 4.97923 4.98237 4.98503 4.98732 4.98927 4.99094 4.99233 - 4.99353 4.99452 4.99538 4.99608 4.99668 4.99718 4.9976 4.99794 - 4.99822 4.99847 4.99867 4.99884 4.99899 4.99913 4.99924 - 4.99932 4.99938 4.99943 4.99947 4.99951 4.99953 4.99955 - 4.99958 4.99961 4.99964 4.99967 4.99969 4.99972 4.99975 - 4.99977 4.99978 4.99979 4.99981 4.99982 4.99983 4.99985 - 4.99986 4.99986 4.99987 4.99987 4.99988 4.99988 4.99988 - 4.99989 4.99989 4.9999 4.9999 4.99991 4.99991 4.99992 4.99992 - 4.99993 4.99993 4.99993 4.99994 5.00381 5.00064 4.99246 - 4.99823 5.00349 5.00076 5.00033 5.00015 5.00009 5.00007 - 5.00005 5.00004 5.00003 5.00002 4.99988 4.99732 4.99728 - 4.9978 5.00187 5.00927 5.08712 5.07654 4.92855 4.4863 3.76162 - 3.00049 2.49834 2.20883 2.03492 1.92384 1.84676 1.79021 - 1.74716 1.7132 1.68576 1.66309 1.64406 1.62785 1.61383 1.60162 - 1.59081 1.58117 1.57253 1.56473 1.55765 1.55117 1.54527 - 1.53988 1.53485 1.53012 1.5257 1.5216 1.51773 1.51411 1.51071 - 1.50746 1.50438 1.50146 1.49868 1.49603 1.4935 1.49109 1.48878 - 1.48657 1.48445 1.48242 1.48046 1.47858 1.47677 1.47502 - 1.47333 1.4717 1.47012 1.46859 1.46711 1.46568 1.46428 1.46292 - 1.4616 1.46034 1.45923 1.45812 1.45701 1.4559 1.45479 1.45378 - 1.45279 1.45181 1.45082 1.44983 1.44893 1.44813 1.44732 - 1.44652 1.44571 1.44491 1.4441 1.4433 1.44249 1.44169 1.44089 - 1.44019 1.43951 1.43883 1.43815 1.43747 1.4368 1.43612 1.43544 - 1.43476 1.43408 1.43342 1.43283 1.43223 1.43163 1.43104 - 1.43044 1.42984 1.42924 1.42865 + 4.49849 4.53282 4.58329 4.66625 4.83345 4.97823 5.0207 5.01816 + 5.01116 5.00595 5.00296 5.00148 5.00073 5.00062 5.00033 + 5.0003 4.99864 4.99661 4.99652 4.99928 5.00361 5.12573 5.17251 + 5.22612 5.33479 5.44503 5.44432 5.44379 5.44334 5.443 5.44276 + 5.44258 5.44246 5.44238 5.44232 5.44228 5.44225 5.44223 + 5.44221 5.4422 5.44219 5.44219 5.44218 5.44218 5.44218 5.44218 + 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 + 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 + 5.44217 5.44217 5.44217 5.44217 5.44217 5.44217 5.44216 + 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 + 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 5.44216 + 5.44216 5.44216 5.44216 5.44216 5.44215 5.44215 5.44215 + 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 + 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 + 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 5.44215 + 5.44214 5.44214 5.44214 5.44214 5.44214 5.44214 5.44214 + 5.44214 5.44214 5.44214 5.44214 5.44212 5.45159 5.45236 + 5.44064 5.44307 5.45616 5.38122 4.77163 3.53297 2.74466 + 2.34448 2.11802 1.9783 1.88656 1.82001 1.77389 1.72955 1.69632 + 1.66971 1.6526 1.65236 1.56034 1.53764 1.97139 2.75096 3.39212 + 3.74042 3.82345 3.85696 3.88547 3.91862 3.9585 4.00467 4.05903 + 4.1254 4.19533 4.26791 4.34517 4.42112 4.49238 4.55807 4.6179 + 4.6713 4.71815 4.75889 4.79418 4.82456 4.85062 4.87291 4.89196 + 4.90823 4.92209 4.93388 4.9439 4.95242 4.95968 4.96585 4.97108 + 4.9755 4.97923 4.98237 4.98503 4.98732 4.98927 4.99094 4.99233 + 4.99353 4.99452 4.99538 4.99608 4.99668 4.99718 4.9976 4.99794 + 4.99822 4.99847 4.99867 4.99884 4.99899 4.99913 4.99924 + 4.99932 4.99938 4.99943 4.99947 4.99951 4.99953 4.99955 + 4.99958 4.99961 4.99964 4.99967 4.99969 4.99972 4.99975 + 4.99977 4.99978 4.99979 4.99981 4.99982 4.99983 4.99985 + 4.99986 4.99986 4.99987 4.99987 4.99988 4.99988 4.99988 + 4.99989 4.99989 4.9999 4.9999 4.99991 4.99991 4.99992 4.99992 + 4.99993 4.99993 4.99993 4.99994 5.00381 5.00064 4.99246 + 4.99823 5.00349 5.00076 5.00033 5.00015 5.00009 5.00007 + 5.00005 5.00004 5.00003 5.00002 4.99988 4.99732 4.99728 + 4.9978 5.00187 5.00927 5.08712 5.07654 4.92855 4.4863 3.76162 + 3.00049 2.49834 2.20883 2.03492 1.92384 1.84676 1.79021 + 1.74716 1.7132 1.68576 1.66309 1.64406 1.62785 1.61383 1.60162 + 1.59081 1.58117 1.57253 1.56473 1.55765 1.55117 1.54527 + 1.53988 1.53485 1.53012 1.5257 1.5216 1.51773 1.51411 1.51071 + 1.50746 1.50438 1.50146 1.49868 1.49603 1.4935 1.49109 1.48878 + 1.48657 1.48445 1.48242 1.48046 1.47858 1.47677 1.47502 + 1.47333 1.4717 1.47012 1.46859 1.46711 1.46568 1.46428 1.46292 + 1.4616 1.46034 1.45923 1.45812 1.45701 1.4559 1.45479 1.45378 + 1.45279 1.45181 1.45082 1.44983 1.44893 1.44813 1.44732 + 1.44652 1.44571 1.44491 1.4441 1.4433 1.44249 1.44169 1.44089 + 1.44019 1.43951 1.43883 1.43815 1.43747 1.4368 1.43612 1.43544 + 1.43476 1.43408 1.43342 1.43283 1.43223 1.43163 1.43104 + 1.43044 1.42984 1.42924 1.42865 EOD @v[39].set(<<-'EOD') - 5 5.01048 5.01221 4.98887 4.76261 4.54943 4.51564 4.56249 - 4.62621 4.68843 4.74374 4.79044 4.82972 4.86127 4.88724 - 4.90862 4.90791 4.89858 4.89589 4.91767 5.00405 5.16956 - 5.12391 4.7557 3.87953 3.01124 2.48482 2.20424 2.03812 1.92679 - 1.84956 1.79256 1.74907 1.71487 1.68724 1.6644 1.64513 1.6287 - 1.61446 1.60197 1.59095 1.58117 1.57245 1.5646 1.55752 1.55109 - 1.54516 1.53958 1.53444 1.53008 1.52606 1.52205 1.51843 - 1.5149 1.51146 1.50893 1.50639 1.50387 1.50133 1.4988 1.49651 - 1.49436 1.49222 1.49007 1.48793 1.48585 1.48433 1.4828 1.48128 - 1.47975 1.47823 1.4767 1.47518 1.47365 1.47213 1.4706 1.46912 - 1.46795 1.46678 1.46561 1.46444 1.46327 1.4621 1.46093 1.45976 - 1.45859 1.45741 1.45628 1.45534 1.45441 1.45347 1.45254 - 1.4516 1.45067 1.44973 1.4488 1.44786 1.44693 1.44604 1.44539 - 1.44475 1.4441 1.44345 1.44281 1.44216 1.44151 1.44086 1.44022 - 1.43957 1.43892 1.43828 1.43763 1.43698 1.43633 1.43569 - 1.43504 1.43439 1.43375 1.4331 1.43245 1.4318 1.43157 1.43089 - 1.43001 1.43042 1.42899 1.42439 1.42216 1.43447 1.44048 - 1.43705 1.43314 1.43039 1.42861 1.42739 1.42651 1.42548 - 1.42488 1.4243 1.42392 1.4235 1.32443 1.31149 1.78169 2.64844 - 3.43211 3.95252 4.20231 4.3746 4.49948 4.58929 4.65742 4.71183 - 4.77057 4.83196 4.88354 4.92894 4.96625 4.99235 5.00651 - 5.00941 5.00813 5.00689 5.00588 5.00504 5.00431 5.00368 - 5.00314 5.00268 5.00228 5.00194 5.00165 5.0014 5.00118 5.001 - 5.00085 5.00072 5.00061 5.00052 5.00044 5.00037 5.00031 - 5.00027 5.00022 5.00019 5.00016 5.00013 5.00011 5.00009 - 5.00008 5.00007 5.00006 5.00005 5.00004 5.00003 5.00003 - 5.00003 5.00002 5.00002 5.00002 5.00001 5.00001 5.00001 - 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 - 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99998 - 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 - 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5.00001 - 5.00002 5.00003 5.00004 5.00022 4.99974 4.99942 4.99997 - 5.00063 5.00002 5.00003 4.99994 4.99998 4.99999 5 5 5 5 - 5 4.99981 4.99998 5.00004 5.00036 5.00049 5.12012 5.16315 - 5.19712 5.21835 4.87874 4.10151 3.31555 2.74207 2.38075 - 2.15872 2.01614 1.91886 1.84852 1.79401 1.75052 1.71508 - 1.68672 1.66467 1.64602 1.62985 1.61576 1.60343 1.59256 - 1.58287 1.57418 1.56632 1.55922 1.55282 1.54687 1.54132 - 1.53618 1.53143 1.52698 1.52282 1.51895 1.51527 1.5118 1.50851 - 1.5054 1.50244 1.49963 1.49695 1.4944 1.49196 1.48963 1.4874 - 1.48527 1.48322 1.48124 1.47934 1.47751 1.47574 1.47403 - 1.47239 1.4708 1.46926 1.46777 1.46632 1.46491 1.46355 1.46237 - 1.4612 1.46002 1.45884 1.45766 1.45659 1.45555 1.45451 1.45346 - 1.45242 1.45147 1.45062 1.44978 1.44894 1.44809 1.44725 - 1.4464 1.44556 1.44472 1.44387 1.44303 1.4423 1.44159 1.44088 - 1.44017 1.43947 1.43876 1.43805 1.43734 1.43664 1.43593 - 1.43524 1.43462 1.434 1.43338 1.43276 1.43213 1.43151 1.43089 - 1.43027 + 5 5.01048 5.01221 4.98887 4.76261 4.54943 4.51564 4.56249 + 4.62621 4.68843 4.74374 4.79044 4.82972 4.86127 4.88724 + 4.90862 4.90791 4.89858 4.89589 4.91767 5.00405 5.16956 + 5.12391 4.7557 3.87953 3.01124 2.48482 2.20424 2.03812 1.92679 + 1.84956 1.79256 1.74907 1.71487 1.68724 1.6644 1.64513 1.6287 + 1.61446 1.60197 1.59095 1.58117 1.57245 1.5646 1.55752 1.55109 + 1.54516 1.53958 1.53444 1.53008 1.52606 1.52205 1.51843 + 1.5149 1.51146 1.50893 1.50639 1.50387 1.50133 1.4988 1.49651 + 1.49436 1.49222 1.49007 1.48793 1.48585 1.48433 1.4828 1.48128 + 1.47975 1.47823 1.4767 1.47518 1.47365 1.47213 1.4706 1.46912 + 1.46795 1.46678 1.46561 1.46444 1.46327 1.4621 1.46093 1.45976 + 1.45859 1.45741 1.45628 1.45534 1.45441 1.45347 1.45254 + 1.4516 1.45067 1.44973 1.4488 1.44786 1.44693 1.44604 1.44539 + 1.44475 1.4441 1.44345 1.44281 1.44216 1.44151 1.44086 1.44022 + 1.43957 1.43892 1.43828 1.43763 1.43698 1.43633 1.43569 + 1.43504 1.43439 1.43375 1.4331 1.43245 1.4318 1.43157 1.43089 + 1.43001 1.43042 1.42899 1.42439 1.42216 1.43447 1.44048 + 1.43705 1.43314 1.43039 1.42861 1.42739 1.42651 1.42548 + 1.42488 1.4243 1.42392 1.4235 1.32443 1.31149 1.78169 2.64844 + 3.43211 3.95252 4.20231 4.3746 4.49948 4.58929 4.65742 4.71183 + 4.77057 4.83196 4.88354 4.92894 4.96625 4.99235 5.00651 + 5.00941 5.00813 5.00689 5.00588 5.00504 5.00431 5.00368 + 5.00314 5.00268 5.00228 5.00194 5.00165 5.0014 5.00118 5.001 + 5.00085 5.00072 5.00061 5.00052 5.00044 5.00037 5.00031 + 5.00027 5.00022 5.00019 5.00016 5.00013 5.00011 5.00009 + 5.00008 5.00007 5.00006 5.00005 5.00004 5.00003 5.00003 + 5.00003 5.00002 5.00002 5.00002 5.00001 5.00001 5.00001 + 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 5.00001 + 5.00001 5.00001 5 5 5 5 5 4.99999 4.99999 4.99999 4.99998 + 4.99998 4.99998 4.99998 4.99998 4.99998 4.99998 4.99999 + 4.99999 4.99999 4.99999 4.99999 4.99999 5 5 5 5 5.00001 + 5.00002 5.00003 5.00004 5.00022 4.99974 4.99942 4.99997 + 5.00063 5.00002 5.00003 4.99994 4.99998 4.99999 5 5 5 5 + 5 4.99981 4.99998 5.00004 5.00036 5.00049 5.12012 5.16315 + 5.19712 5.21835 4.87874 4.10151 3.31555 2.74207 2.38075 + 2.15872 2.01614 1.91886 1.84852 1.79401 1.75052 1.71508 + 1.68672 1.66467 1.64602 1.62985 1.61576 1.60343 1.59256 + 1.58287 1.57418 1.56632 1.55922 1.55282 1.54687 1.54132 + 1.53618 1.53143 1.52698 1.52282 1.51895 1.51527 1.5118 1.50851 + 1.5054 1.50244 1.49963 1.49695 1.4944 1.49196 1.48963 1.4874 + 1.48527 1.48322 1.48124 1.47934 1.47751 1.47574 1.47403 + 1.47239 1.4708 1.46926 1.46777 1.46632 1.46491 1.46355 1.46237 + 1.4612 1.46002 1.45884 1.45766 1.45659 1.45555 1.45451 1.45346 + 1.45242 1.45147 1.45062 1.44978 1.44894 1.44809 1.44725 + 1.4464 1.44556 1.44472 1.44387 1.44303 1.4423 1.44159 1.44088 + 1.44017 1.43947 1.43876 1.43805 1.43734 1.43664 1.43593 + 1.43524 1.43462 1.434 1.43338 1.43276 1.43213 1.43151 1.43089 + 1.43027 EOD end diff --git a/ext/tk/sample/tkextlib/blt/graph7.rb b/ext/tk/sample/tkextlib/blt/graph7.rb index 27fbe53d97..8b31b28c91 100644 --- a/ext/tk/sample/tkextlib/blt/graph7.rb +++ b/ext/tk/sample/tkextlib/blt/graph7.rb @@ -16,10 +16,10 @@ v_x.expr("random(#{v_x})") v_y.expr("random(#{v_y})") v_x.sort(v_y) -plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, - :color=>'green4', :fill=>'green2', - :linewidth=>0, :outlinewidth=>1, - :pixels=>4, :label=>'plot', +plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, + :color=>'green4', :fill=>'green2', + :linewidth=>0, :outlinewidth=>1, + :pixels=>4, :label=>'plot', :xdata=>v_x, :ydata=>v_y) Tk.root.minsize(0, 0) diff --git a/ext/tk/sample/tkextlib/blt/graph7a.rb b/ext/tk/sample/tkextlib/blt/graph7a.rb index a014f72fc7..8def766060 100644 --- a/ext/tk/sample/tkextlib/blt/graph7a.rb +++ b/ext/tk/sample/tkextlib/blt/graph7a.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/blt' -file = File.join(File.dirname(File.expand_path(__FILE__)), +file = File.join(File.dirname(File.expand_path(__FILE__)), 'images', 'buckskin.gif') bgTexture = TkPhotoImage.new(:file=>file) @@ -39,10 +39,10 @@ v_x.expr("random(#{v_x})") v_y.expr("random(#{v_y})") v_x.sort(v_y) -plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, - :color=>'green4', :fill=>'green2', - :linewidth=>0, :outlinewidth=>1, - :pixels=>4, :label=>'plot', +plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, + :color=>'green4', :fill=>'green2', + :linewidth=>0, :outlinewidth=>1, + :pixels=>4, :label=>'plot', :xdata=>v_x, :ydata=>v_y) Tk.root.minsize(0, 0) diff --git a/ext/tk/sample/tkextlib/blt/graph7b.rb b/ext/tk/sample/tkextlib/blt/graph7b.rb index c589f18d86..8b00f154b2 100644 --- a/ext/tk/sample/tkextlib/blt/graph7b.rb +++ b/ext/tk/sample/tkextlib/blt/graph7b.rb @@ -17,10 +17,10 @@ y = Array.new(length) y[i] = rand } -plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, - :color=>'green4', :fill=>'green2', - :linewidth=>0, :outlinewidth=>1, - :pixels=>4, :label=>'plot', +plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, + :color=>'green4', :fill=>'green2', + :linewidth=>0, :outlinewidth=>1, + :pixels=>4, :label=>'plot', :xdata=>x, :ydata=>y) Tk.root.minsize(0, 0) diff --git a/ext/tk/sample/tkextlib/blt/graph7c.rb b/ext/tk/sample/tkextlib/blt/graph7c.rb index 495b66f4af..d4ed1a66ad 100644 --- a/ext/tk/sample/tkextlib/blt/graph7c.rb +++ b/ext/tk/sample/tkextlib/blt/graph7c.rb @@ -21,10 +21,10 @@ y = Array.new(length) v_x.set(x) v_y.set(y) -plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, - :color=>'green4', :fill=>'green2', - :linewidth=>0, :outlinewidth=>1, - :pixels=>4, :label=>'plot', +plot = Tk::BLT::PlotComponent::Element.new(graph, :symbol=>:square, + :color=>'green4', :fill=>'green2', + :linewidth=>0, :outlinewidth=>1, + :pixels=>4, :label=>'plot', :xdata=>v_x, :ydata=>v_y) Tk.root.minsize(0, 0) diff --git a/ext/tk/sample/tkextlib/blt/pareto.rb b/ext/tk/sample/tkextlib/blt/pareto.rb index 94d5f3f97f..bf9a1ec749 100644 --- a/ext/tk/sample/tkextlib/blt/pareto.rb +++ b/ext/tk/sample/tkextlib/blt/pareto.rb @@ -8,21 +8,21 @@ require 'tkextlib/blt' # The pareto chart mixes line and bar elements in the same graph. # Each processing operating is represented by a bar element. The # total accumulated defects is displayed with a single line element. -b = Tk::BLT::Barchart.new(:title=>'Defects Found During Inspection', - :font=>'Helvetica 12', :plotpady=>[12, 4], +b = Tk::BLT::Barchart.new(:title=>'Defects Found During Inspection', + :font=>'Helvetica 12', :plotpady=>[12, 4], :width=>'6i', :height=>'5i') Tk::BLT::Table.add(Tk.root, b, :fill=>:both) data = [ - ["Spot Weld", 82, 'yellow'], - ["Lathe", 49, 'orange'], - ["Gear Cut", 38, 'green'], - ["Drill", 24, 'blue'], - ["Grind", 17, 'red'], - ["Lapping", 12, 'brown'], - ["Press", 8, 'purple'], - ["De-burr", 4, 'pink'], - ["Packaging", 3, 'cyan'], + ["Spot Weld", 82, 'yellow'], + ["Lathe", 49, 'orange'], + ["Gear Cut", 38, 'green'], + ["Drill", 24, 'blue'], + ["Grind", 17, 'red'], + ["Lapping", 12, 'brown'], + ["Press", 8, 'purple'], + ["De-burr", 4, 'pink'], + ["Packaging", 3, 'cyan'], ["Other", 12, 'magenta'] ] @@ -41,8 +41,8 @@ labels = [] data.each{|label, value, color| count += 1 - b.element_create(label, :xdata=>count, :ydata=>value, :foreground=>color, - :relief=>:solid, :borderwidth=>1, :stipple=>pattern1, + b.element_create(label, :xdata=>count, :ydata=>value, :foreground=>color, + :relief=>:solid, :borderwidth=>1, :stipple=>pattern1, :background=>'lightblue') labels[count] = label # Get the total number of defects. @@ -51,7 +51,7 @@ data.each{|label, value, color| xdata << count } -# Configure the coordinates of the accumulated defects, +# Configure the coordinates of the accumulated defects, # now that we know what they are. b.element_configure('accum', :xdata=>xdata, :ydata=>ydata) @@ -63,19 +63,19 @@ xdata.zip(ydata){|x, y| else text = '%.1f' % percent end - b.marker_create(:text, :coords=>[x, y], :text=>text, :font=>'Helvetica 10', + b.marker_create(:text, :coords=>[x, y], :text=>text, :font=>'Helvetica 10', :foreground=>'red4', :anchor=>:center, :yoffset=>-5) } # Display an auxillary y-axis for percentages. -b.axis_configure('y2', :hide=>false, :min=>0.0, :max=>100.0, +b.axis_configure('y2', :hide=>false, :min=>0.0, :max=>100.0, :title=>'Percentage') # Title the y-axis b.axis_configure('y', :title=>'Defects') # Configure the x-axis to display the process names, instead of numbers. -b.axis_configure('x', :title=>'Process', :rotate=>90, :subdivisions=>0, +b.axis_configure('x', :title=>'Process', :rotate=>90, :subdivisions=>0, :command=>proc{|w, val| val = val.round labels[val]? labels[val]: val diff --git a/ext/tk/sample/tkextlib/blt/plot1b.rb b/ext/tk/sample/tkextlib/blt/plot1b.rb index eb41e361f9..8a3ce8216d 100644 --- a/ext/tk/sample/tkextlib/blt/plot1b.rb +++ b/ext/tk/sample/tkextlib/blt/plot1b.rb @@ -4,7 +4,7 @@ require 'tkextlib/blt' graph = Tk::BLT::Graph.new.pack plot = graph.element_create -plot.configure(:linewidth=>0, :label=>'foo', +plot.configure(:linewidth=>0, :label=>'foo', :data=>[[1.0, 3.4], [1.1, 2.8], [1.2, 3.1], [1.4, 2.9]].flatten) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/blt/winop1.rb b/ext/tk/sample/tkextlib/blt/winop1.rb index e94138cd94..97c31aa295 100644 --- a/ext/tk/sample/tkextlib/blt/winop1.rb +++ b/ext/tk/sample/tkextlib/blt/winop1.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/blt' -file = File.join(File.dirname(File.expand_path(__FILE__)), +file = File.join(File.dirname(File.expand_path(__FILE__)), 'images', 'sample.gif') if File.exist?(file) src = TkPhotoImage.new(:file=>file) @@ -30,9 +30,9 @@ Tk.root.background('white') l_hdr = TkLabel.new(:text=>"#{iw} x #{ih}") l_ftr = TkLabel.new(:text=>"#{r}%") l_img = TkLabel.new(:image=>dst) - Tk::BLT::Table.add(Tk.root, - [0,i], l_hdr, - [1,i], l_img, + Tk::BLT::Table.add(Tk.root, + [0,i], l_hdr, + [1,i], l_img, [2,i], l_ftr) Tk.update } diff --git a/ext/tk/sample/tkextlib/blt/winop2.rb b/ext/tk/sample/tkextlib/blt/winop2.rb index 1f674ee893..d59c43ba22 100644 --- a/ext/tk/sample/tkextlib/blt/winop2.rb +++ b/ext/tk/sample/tkextlib/blt/winop2.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/blt' -file = File.join(File.dirname(File.expand_path(__FILE__)), +file = File.join(File.dirname(File.expand_path(__FILE__)), 'images', 'qv100.t.gif') if File.exist?(file) src = TkPhotoImage.new(:file=>file) diff --git a/ext/tk/sample/tkextlib/bwidget/basic.rb b/ext/tk/sample/tkextlib/bwidget/basic.rb index c1521651fd..060baf8a6c 100644 --- a/ext/tk/sample/tkextlib/bwidget/basic.rb +++ b/ext/tk/sample/tkextlib/bwidget/basic.rb @@ -29,37 +29,37 @@ module DemoBasic end def self._label(parent) - lab = Tk::BWidget::Label.new(parent, :text=>'This is a Label widget', + lab = Tk::BWidget::Label.new(parent, :text=>'This is a Label widget', :helptext=>'Label widget') - chk = TkCheckbutton.new(parent, :text=>'Disabled', - :variable=>@@var.ref(lab, 'state'), - :onvalue=>'disabled', :offvalue=>'normal', + chk = TkCheckbutton.new(parent, :text=>'Disabled', + :variable=>@@var.ref(lab, 'state'), + :onvalue=>'disabled', :offvalue=>'normal', :command=>proc{lab[:state] = @@var[lab, 'state']}) lab.pack(:anchor=>:w, :pady=>4) chk.pack(:anchor=>:w) end def self._entry(parent) - ent = Tk::BWidget::Entry.new(parent, :text=>'Press enter', - :helptext=>'Entry widtet', + ent = Tk::BWidget::Entry.new(parent, :text=>'Press enter', + :helptext=>'Entry widtet', :command=>proc{ @@var['entcmd'] = 'command called' Tk.after(500, proc{@@var['entcmd'] = ''}) }) - chk1 = TkCheckbutton.new(parent, :text=>'Disabled', - :variable=>@@var.ref(ent, 'state'), - :onvalue=>'disabled', :offvalue=>'normal', + chk1 = TkCheckbutton.new(parent, :text=>'Disabled', + :variable=>@@var.ref(ent, 'state'), + :onvalue=>'disabled', :offvalue=>'normal', :command=>proc{ent.state = @@var[ent, 'state']}) - chk2 = TkCheckbutton.new(parent, :text=>'Non editable', - :variable=>@@var.ref(ent, 'editable'), - :onvalue=>false, :offvalue=>true, + chk2 = TkCheckbutton.new(parent, :text=>'Non editable', + :variable=>@@var.ref(ent, 'editable'), + :onvalue=>false, :offvalue=>true, :command=>proc{ ent.editable = @@var[ent, 'editable'] }) - lab = TkLabel.new(parent, :textvariable=>@@var.ref('entcmd'), + lab = TkLabel.new(parent, :textvariable=>@@var.ref('entcmd'), :foreground=>'red') ent.pack(:pady=>4, :anchor=>:w) @@ -69,22 +69,22 @@ module DemoBasic def self._button(parent) frame = TkFrame.new(parent) - but = Tk::BWidget::Button.new(frame, :text=>'Press me!', - :repeatdelay=>300, - :command=>proc{_butcmd('command')}, + but = Tk::BWidget::Button.new(frame, :text=>'Press me!', + :repeatdelay=>300, + :command=>proc{_butcmd('command')}, :helptext=>'This is a Button widget') sep1 = Tk::BWidget::Separator.new(frame, :orient=>:vertical) - arr1 = Tk::BWidget::ArrowButton.new(frame, :type=>:button, - :width=>25, :height=>25, :repeatdelay=>300, - :command=>proc{_butcmd('command')}, + arr1 = Tk::BWidget::ArrowButton.new(frame, :type=>:button, + :width=>25, :height=>25, :repeatdelay=>300, + :command=>proc{_butcmd('command')}, :helptext=>"This is an ArrowButton widget\nof type button") sep2 = Tk::BWidget::Separator.new(frame, :orient=>:vertical) - arr2 = Tk::BWidget::ArrowButton.new(frame, :type=>:arrow, - :width=>25, :height=>25, :relief=>:sunken, - :ipadx=>0, :ipady=>0, :repeatdelay=>300, - :command=>proc{_butcmd('command')}, + arr2 = Tk::BWidget::ArrowButton.new(frame, :type=>:arrow, + :width=>25, :height=>25, :relief=>:sunken, + :ipadx=>0, :ipady=>0, :repeatdelay=>300, + :command=>proc{_butcmd('command')}, :helptext=>"This is an ArrowButton widget\nof type arrow") but.pack(:side=>:left, :padx=>4) @@ -94,49 +94,49 @@ module DemoBasic arr2.pack(:side=>:left, :padx=>4) frame.pack - Tk::BWidget::Separator.new(parent, + Tk::BWidget::Separator.new(parent, :orient=>:horizontal).pack(:fill=>:x, :pady=>10) - labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Command', - :side=>:top, :anchor=>:w, + labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Command', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf1.get_frame - chk1 = TkCheckbutton.new(subf, :text=>'Disabled', - :variable=>@@var.ref('bstate'), - :onvalue=>'disabled', :offvalue=>'normal', - :command=>proc{_bstate(@@var['bstate'], + chk1 = TkCheckbutton.new(subf, :text=>'Disabled', + :variable=>@@var.ref('bstate'), + :onvalue=>'disabled', :offvalue=>'normal', + :command=>proc{_bstate(@@var['bstate'], but, arr1, arr2)}) - chk2 = TkCheckbutton.new(subf, :text=>"Use armcommand/\ndisarmcommand", - :variable=>@@var.ref('barmcmd'), - :command=>proc{_barmcmd(@@var['barmcmd'], + chk2 = TkCheckbutton.new(subf, :text=>"Use armcommand/\ndisarmcommand", + :variable=>@@var.ref('barmcmd'), + :command=>proc{_barmcmd(@@var['barmcmd'], but, arr1, arr2)}) Tk.pack(chk1, chk2, :anchor=>:w) - label = TkLabel.new(parent, :textvariable=>@@var.ref('butcmd'), + label = TkLabel.new(parent, :textvariable=>@@var.ref('butcmd'), :foreground=>'red').pack(:side=>:bottom, :pady=>4) - labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Direction', - :side=>:top, :anchor=>:w, + labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Direction', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf2.get_frame @@var['bside'] = :top [:top, :left, :bottom, :right].each{|dir| - TkRadiobutton.new(subf, :text=>"#{dir} arrow", - :variable=>@@var.ref('bside'), :value=>dir, + TkRadiobutton.new(subf, :text=>"#{dir} arrow", + :variable=>@@var.ref('bside'), :value=>dir, :command=>proc{_bside(@@var['bside'], arr1, arr2)} ).pack(:anchor=>:w) } - labf3 = Tk::BWidget::LabelFrame.new(parent, :text=>'Relief', - :side=>:top, :anchor=>:w, + labf3 = Tk::BWidget::LabelFrame.new(parent, :text=>'Relief', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf3.get_frame @@var['brelief'] = :raised [ %w(raised sunken ridge groove), %w(flat solid link)].each{|lrelief| f = TkFrame.new(subf) lrelief.each{|relief| - TkRadiobutton.new(f, :text=>relief, - :variable=>@@var.ref('brelief'), :value=>relief, + TkRadiobutton.new(f, :text=>relief, + :variable=>@@var.ref('brelief'), :value=>relief, :command=>proc{ _brelief(@@var['brelief'], but, arr1, arr2) }).pack(:anchor=>:w) @@ -163,19 +163,19 @@ module DemoBasic def self._barmcmd(value, but, arr1, arr2) if TkComm.bool(value) - but.configure(:armcommand=>proc{_butcmd('arm')}, - :disarmcommand=>proc{_butcmd('disarm')}, + but.configure(:armcommand=>proc{_butcmd('arm')}, + :disarmcommand=>proc{_butcmd('disarm')}, :command=>'') [arr1, arr2].each{|arr| - arr.configure(:armcommand=>proc{_butcmd('arm')}, - :disarmcommand=>proc{_butcmd('disarm')}, + arr.configure(:armcommand=>proc{_butcmd('arm')}, + :disarmcommand=>proc{_butcmd('disarm')}, :command=>'') } else - but.configure(:armcommand=>'', :disarmcommand=>'', + but.configure(:armcommand=>'', :disarmcommand=>'', :command=>proc{_butcmd('command')}) [arr1, arr2].each{|arr| - arr.configure(:armcommand=>'', :disarmcommand=>'', + arr.configure(:armcommand=>'', :disarmcommand=>'', :command=>proc{_butcmd('command')}) } end diff --git a/ext/tk/sample/tkextlib/bwidget/demo.rb b/ext/tk/sample/tkextlib/bwidget/demo.rb index 785d2681a8..3eb98818f3 100644 --- a/ext/tk/sample/tkextlib/bwidget/demo.rb +++ b/ext/tk/sample/tkextlib/bwidget/demo.rb @@ -54,21 +54,21 @@ class BWidget_Demo descmenu = [ '&File', 'all', 'file', 0, [ - ['command', 'E&xit', [], 'Exit BWidget demo', [], + ['command', 'E&xit', [], 'Exit BWidget demo', [], {:command=>proc{exit}}] - ], + ], '&Options', 'all', 'options', 0, [ - ['checkbutton', 'Toolbar &1', ['all', 'option'], - 'Show/hide toolbar 1', [], - { :variable=>DemoVar.toolbar1, + ['checkbutton', 'Toolbar &1', ['all', 'option'], + 'Show/hide toolbar 1', [], + { :variable=>DemoVar.toolbar1, :command=>proc{ DemoVar.mainframe.show_toolbar(0, DemoVar.toolbar1.value) } } - ], - ['checkbutton', 'Toolbar &2', ['all', 'option'], - 'Show/hide toolbar 2', [], - { :variable=>DemoVar.toolbar2, + ], + ['checkbutton', 'Toolbar &2', ['all', 'option'], + 'Show/hide toolbar 2', [], + { :variable=>DemoVar.toolbar2, :command=>proc{ DemoVar.mainframe.show_toolbar(1, DemoVar.toolbar2.value) } @@ -81,8 +81,8 @@ class BWidget_Demo DemoVar.prgindic.value = 0 DemoVar.mainframe = Tk::BWidget::MainFrame.new( - :menu=>descmenu, - :textvariable=>DemoVar.status, + :menu=>descmenu, + :textvariable=>DemoVar.status, :progressvar=>DemoVar.prgindic ) @@ -91,22 +91,22 @@ class BWidget_Demo DemoVar.mainframe.add_toolbar{|tb1| Tk::BWidget::ButtonBox.new(tb1, :spacing=>0, :padx=>1, :pady=>1){|bbox| - add(:image=>Tk::BWidget::Bitmap.new('new'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Create a new file" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('new'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Create a new file" icon'}, :helptext=>"Create a new file") - add(:image=>Tk::BWidget::Bitmap.new('open'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Open an existing file" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('open'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Open an existing file" icon'}, :helptext=>"Open an existing file") - add(:image=>Tk::BWidget::Bitmap.new('save'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Save file" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('save'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Save file" icon'}, :helptext=>"Save file") pack(:side=>:left, :anchor=>:w) @@ -119,22 +119,22 @@ class BWidget_Demo DemoVar.prgindic.numeric += 1 Tk::BWidget::ButtonBox.new(tb1, :spacing=>0, :padx=>1, :pady=>1){|bbox| - add(:image=>Tk::BWidget::Bitmap.new('cut'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Cut selection" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('cut'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Cut selection" icon'}, :helptext=>"Cut selection") - add(:image=>Tk::BWidget::Bitmap.new('copy'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Copy selection" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('copy'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Copy selection" icon'}, :helptext=>"Copy selection") - add(:image=>Tk::BWidget::Bitmap.new('paste'), - :highlightthickness=>0, :takefocus=>0, :relief=>:link, - :borderwidth=>1, :padx=>1, :pady=>1, - :command=>proc{puts 'select "Paste selection" icon'}, + add(:image=>Tk::BWidget::Bitmap.new('paste'), + :highlightthickness=>0, :takefocus=>0, :relief=>:link, + :borderwidth=>1, :padx=>1, :pady=>1, + :command=>proc{puts 'select "Paste selection" icon'}, :helptext=>"Paste selection") pack(:side=>:left, :anchor=>:w) @@ -145,7 +145,7 @@ class BWidget_Demo DemoVar.prgindic.numeric += 1 tb2 = DemoVar.mainframe.add_toolbar - DemoVar._wfont = Tk::BWidget::SelectFont::Toolbar.new(tb2, + DemoVar._wfont = Tk::BWidget::SelectFont::Toolbar.new(tb2, :command=>proc{update_font(DemoVar._wfont[:font])} ) DemoVar.font = DemoVar._wfont[:font] @@ -213,18 +213,18 @@ class BWidget_Demo top.withdraw top.overrideredirect(true) - ximg = TkLabel.new(top, :bitmap=>"@#{File.join(DEMODIR,'x1.xbm')}", + ximg = TkLabel.new(top, :bitmap=>"@#{File.join(DEMODIR,'x1.xbm')}", :foreground=>'grey90', :background=>'white') bwimg = TkLabel.new(ximg, :bitmap=>"@#{File.join(DEMODIR,'bwidget.xbm')}", :foreground=>'grey90', :background=>'white') frame = TkFrame.new(ximg, :background=>'white') - TkLabel.new(frame, :text=>'Loading demo', + TkLabel.new(frame, :text=>'Loading demo', :background=>'white', :font=>'times 8').pack - TkLabel.new(frame, :textvariable=>DemoVar.prgtext, + TkLabel.new(frame, :textvariable=>DemoVar.prgtext, :background=>'white', :font=>'times 8', :width=>35).pack - Tk::BWidget::ProgressBar.new(frame, :width=>50, :height=>10, - :background=>'white', - :variable=>DemoVar.prgindic, + Tk::BWidget::ProgressBar.new(frame, :width=>50, :height=>10, + :background=>'white', + :variable=>DemoVar.prgindic, :maximum=>10).pack frame.place(:x=>0, :y=>0, :anchor=>:nw) bwimg.place(:relx=>1, :rely=>1, :anchor=>:se) diff --git a/ext/tk/sample/tkextlib/bwidget/dnd.rb b/ext/tk/sample/tkextlib/bwidget/dnd.rb index 1c8b036530..b1b1cf60ff 100644 --- a/ext/tk/sample/tkextlib/bwidget/dnd.rb +++ b/ext/tk/sample/tkextlib/bwidget/dnd.rb @@ -12,19 +12,19 @@ module DemoDnD titf1 = Tk::BWidget::TitleFrame.new(frame, :text=>'Drag source') subf = titf1.get_frame - ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry', - :labelwidth=>14, :dragenabled=>true, + ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry', + :labelwidth=>14, :dragenabled=>true, :dragevent=>3) - labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (text)', + labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (text)', :width=>14) f = labf1.get_frame - lab = Tk::BWidget::Label.new(f, :text=>'Drag this text', + lab = Tk::BWidget::Label.new(f, :text=>'Drag this text', :dragenabled=>true, :dragevent=>3).pack - labf2 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (bitmap)', + labf2 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (bitmap)', :width=>14) f = labf2.get_frame - lab = Tk::BWidget::Label.new(f, :bitmap=>'info', + lab = Tk::BWidget::Label.new(f, :bitmap=>'info', :dragenabled=>true, :dragevent=>3).pack Tk.pack(ent1, labf1, labf2, :side=>:top, :fill=>:x, :pady=>4) @@ -32,11 +32,11 @@ module DemoDnD titf2 = Tk::BWidget::TitleFrame.new(frame, :text=>'Drop targets') subf = titf2.get_frame - ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry', + ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry', :labelwidth=>14, :dropenabled=>true) labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label', :width=>14) f = labf1.get_frame - lab = Tk::BWidget::Label.new(f, :dropenabled=>true, + lab = Tk::BWidget::Label.new(f, :dropenabled=>true, :highlightthickness=>1).pack(:fill=>:x) Tk.pack(ent1, labf1, :side=>:top, :fill=>:x, :pady=>4) Tk.pack(titf1, titf2, :pady=>4) diff --git a/ext/tk/sample/tkextlib/bwidget/manager.rb b/ext/tk/sample/tkextlib/bwidget/manager.rb index 776cb3065b..a59afb8b86 100644 --- a/ext/tk/sample/tkextlib/bwidget/manager.rb +++ b/ext/tk/sample/tkextlib/bwidget/manager.rb @@ -32,19 +32,19 @@ module DemoManager end def self._mainframe(parent) - labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Toolbar', - :side=>:top, :anchor=>:w, + labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Toolbar', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>2) subf = labf1.get_frame - chk1 = TkCheckbutton.new(subf, :text=>'View toolbar 1', - :variable=>DemoVar.toolbar1, + chk1 = TkCheckbutton.new(subf, :text=>'View toolbar 1', + :variable=>DemoVar.toolbar1, :command=>proc{ DemoVar.mainframe.show_toolbar( 0, DemoVar.toolbar1.value ) }) - chk2 = TkCheckbutton.new(subf, :text=>'View toolbar 2', - :variable=>DemoVar.toolbar2, + chk2 = TkCheckbutton.new(subf, :text=>'View toolbar 2', + :variable=>DemoVar.toolbar2, :command=>proc{ DemoVar.mainframe.show_toolbar( 1, DemoVar.toolbar2.value @@ -54,12 +54,12 @@ module DemoManager Tk.pack(chk1, chk2, :anchor=>:w, :fill=>:x) labf1.pack(:fill=>:both) - labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Status bar', - :side=>:top, :anchor=>:w, + labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Status bar', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>2) subf = labf2.get_frame - chk1 = TkCheckbutton.new(subf, :text=>"Show Progress\nindicator", - :justify=>:left, :variable=>@@progress, + chk1 = TkCheckbutton.new(subf, :text=>"Show Progress\nindicator", + :justify=>:left, :variable=>@@progress, :command=>proc{ _show_progress }) chk1.pack(:anchor=>:w, :fill=>:x) @@ -67,8 +67,8 @@ module DemoManager end def self._notebook(parent) - TkCheckbutton.new(parent, :text=>'Homogeneous label', - :variable=>@@homogeneous, + TkCheckbutton.new(parent, :text=>'Homogeneous label', + :variable=>@@homogeneous, :command=>proc{ DemoVar.notebook[:homogeneous] = @@homogeneous.value }).pack(:side=>:left, :anchor=>:n, :fill=>:x) @@ -92,13 +92,13 @@ module DemoManager sw.pack(:fill=>:both, :expand=>true) } - sw = Tk::BWidget::ScrolledWindow.new(pane3, :relief=>:sunken, + sw = Tk::BWidget::ScrolledWindow.new(pane3, :relief=>:sunken, :borderwidth=>2) sf = Tk::BWidget::ScrollableFrame.new(sw) sw.set_widget(sf) subf = sf.get_frame lab = TkLabel.new(subf, :text=>'This is a ScrollableFrame') - chk = TkCheckbutton.new(subf, :text=>'Constrained with', + chk = TkCheckbutton.new(subf, :text=>'Constrained with', :variable=>@@constw, :command=>proc{ sf['constrainedwidth'] = @@constw.value }) diff --git a/ext/tk/sample/tkextlib/bwidget/select.rb b/ext/tk/sample/tkextlib/bwidget/select.rb index ea24b47e2e..3a1a810e14 100644 --- a/ext/tk/sample/tkextlib/bwidget/select.rb +++ b/ext/tk/sample/tkextlib/bwidget/select.rb @@ -13,28 +13,28 @@ module DemoSelect titf1 = Tk::BWidget::TitleFrame.new(frame, :text=>'SpinBox') subf = titf1.get_frame - spin = Tk::BWidget::SpinBox.new(subf, :range=>[1, 100, 1], - :textvariable=>@@var.ref('spin', 'var'), + spin = Tk::BWidget::SpinBox.new(subf, :range=>[1, 100, 1], + :textvariable=>@@var.ref('spin', 'var'), :helptext=>'This is the SpinBox') - ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var', - :labelwidth=>10, :labelanchor=>:w, - :textvariable=>@@var.ref('spin', 'var'), - :editable=>0, + ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var', + :labelwidth=>10, :labelanchor=>:w, + :textvariable=>@@var.ref('spin', 'var'), + :editable=>0, :helptext=>"This is an Entry reflecting\nthe linked var of SpinBox") - labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', - :side=>:top, :anchor=>:w, - :relief=>:sunken, :borderwidth=>1, + labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', + :side=>:top, :anchor=>:w, + :relief=>:sunken, :borderwidth=>1, :helptext=>'Modify some options of SpinBox') subf = labf.get_frame - chk1 = TkCheckbutton.new(subf, :text=>'Non editable', - :variable=>@@var.ref('spin', 'editable'), - :onvalue=>false, :offvalue=>true, + chk1 = TkCheckbutton.new(subf, :text=>'Non editable', + :variable=>@@var.ref('spin', 'editable'), + :onvalue=>false, :offvalue=>true, :command=>proc{ spin.editable(@@var['spin', 'editable']) }) - chk2 = TkCheckbutton.new(subf, :text=>'Disabled', - :variable=>@@var.ref('spin', 'state'), - :onvalue=>'disabled', :offvalue=>'normal', + chk2 = TkCheckbutton.new(subf, :text=>'Disabled', + :variable=>@@var.ref('spin', 'state'), + :onvalue=>'disabled', :offvalue=>'normal', :command=>proc{ spin.state(@@var['spin', 'state']) }) @@ -47,28 +47,28 @@ module DemoSelect combo = Tk::BWidget::ComboBox.new(subf, :textvariable=>@@var.ref('combo', 'var'), :values=>[ - 'first value', 'second value', - 'third value', 'fourth value', + 'first value', 'second value', + 'third value', 'fourth value', 'fifth value' - ], + ], :helptext=>'This is the ComboBox') - ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var', - :labelwidth=>10, :labelanchor=>:w, + ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var', + :labelwidth=>10, :labelanchor=>:w, :textvariable=>@@var.ref('combo', 'var'), :editable=>0, :helptext=>"This is an Entry reflecting\nthe linked var of ComboBox") - labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', :side=>:top, - :anchor=>:w, :relief=>:sunken, + labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', :side=>:top, + :anchor=>:w, :relief=>:sunken, :borderwidth=>1, :helptext=>'Modify some options of ComboBox') subf = labf.get_frame - chk1 = TkCheckbutton.new(subf, :text=>'Non editable', - :variable=>@@var.ref('combo', 'editable'), - :onvalue=>false, :offvalue=>true, + chk1 = TkCheckbutton.new(subf, :text=>'Non editable', + :variable=>@@var.ref('combo', 'editable'), + :onvalue=>false, :offvalue=>true, :command=>proc{ combo.editable(@@var['combo', 'editable']) }) - chk2 = TkCheckbutton.new(subf, :text=>'Disabled', - :variable=>@@var.ref('combo', 'state'), - :onvalue=>'disabled', :offvalue=>'normal', + chk2 = TkCheckbutton.new(subf, :text=>'Disabled', + :variable=>@@var.ref('combo', 'state'), + :onvalue=>'disabled', :offvalue=>'normal', :command=>proc{ combo.state(@@var['combo', 'state']) }) diff --git a/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb b/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb index 3d19c8d092..da2c9678c0 100644 --- a/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb +++ b/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb @@ -23,14 +23,14 @@ module DemoDialog titf4 = Tk::BWidget::TitleFrame.new(frame, :text=>'Other dialog') subf = titf1.get_frame - cmd = proc{ TkOption.read_file(File.join(Tk::BWidget::LIBRARY, 'lang', + cmd = proc{ TkOption.read_file(File.join(Tk::BWidget::LIBRARY, 'lang', @@resources.value + '.rc')) } - Tk.pack(TkRadiobutton.new(subf, :text=>'English', :value=>'en', - :variable=>@@resources, :command=>cmd), - TkRadiobutton.new(subf, :text=>'French', :value=>'fr', - :variable=>@@resources, :command=>cmd), - TkRadiobutton.new(subf, :text=>'German', :value=>'de', - :variable=>@@resources, :command=>cmd), + Tk.pack(TkRadiobutton.new(subf, :text=>'English', :value=>'en', + :variable=>@@resources, :command=>cmd), + TkRadiobutton.new(subf, :text=>'French', :value=>'fr', + :variable=>@@resources, :command=>cmd), + TkRadiobutton.new(subf, :text=>'German', :value=>'de', + :variable=>@@resources, :command=>cmd), :side=>:left) _tmpldlg(titf2.get_frame) @@ -46,34 +46,34 @@ module DemoDialog @@tmpl['side'] = :bottom @@tmpl['anchor'] = :c - labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button side', - :side=>:top, :anchor=>:w, + labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button side', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf1.get_frame - Tk.pack(TkRadiobutton.new(subf, :text=>'Bottom', :value=>:bottom, - :variable=>@@tmpl.ref('side'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Left', :value=>:left, - :variable=>@@tmpl.ref('side'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Right', :value=>:right, - :variable=>@@tmpl.ref('side'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Top', :value=>:top, - :variable=>@@tmpl.ref('side'), :anchor=>:w), + Tk.pack(TkRadiobutton.new(subf, :text=>'Bottom', :value=>:bottom, + :variable=>@@tmpl.ref('side'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Left', :value=>:left, + :variable=>@@tmpl.ref('side'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Right', :value=>:right, + :variable=>@@tmpl.ref('side'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Top', :value=>:top, + :variable=>@@tmpl.ref('side'), :anchor=>:w), :fill=>:x, :anchor=>:w) - labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button anchor', - :side=>:top, :anchor=>:w, + labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button anchor', + :side=>:top, :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf2.get_frame - Tk.pack(TkRadiobutton.new(subf, :text=>'North', :value=>:n, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'West', :value=>:w, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'East', :value=>:e, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'South', :value=>:s, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Center', :value=>:c, - :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + Tk.pack(TkRadiobutton.new(subf, :text=>'North', :value=>:n, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'West', :value=>:w, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'East', :value=>:e, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'South', :value=>:s, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Center', :value=>:c, + :variable=>@@tmpl.ref('anchor'), :anchor=>:w), :fill=>:x, :anchor=>:w) sep = Tk::BWidget::Separator.new(parent, :orient=>:horizontal) @@ -88,44 +88,44 @@ module DemoDialog @@msg['type'] = 'ok' @@msg['icon'] = 'info' - labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Type', :side=>:top, - :anchor=>:w, :relief=>:sunken, + labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Type', :side=>:top, + :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf1.get_frame - Tk.pack(TkRadiobutton.new(subf, :text=>'Ok', :value=>'ok', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Ok, Cancel', :value=>'okcancel', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Retry, Cancel', - :value=>'retrycancel', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Yes, No', :value=>'yesno', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Yes, No, Cancel', - :value=>'yesnocancel', - :variable=>@@msg.ref('type'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Abort, Retry, Ignore', - :value=>'abortretryignore', - :variable=>@@msg.ref('type'), :anchor=>:w), + Tk.pack(TkRadiobutton.new(subf, :text=>'Ok', :value=>'ok', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Ok, Cancel', :value=>'okcancel', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Retry, Cancel', + :value=>'retrycancel', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Yes, No', :value=>'yesno', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Yes, No, Cancel', + :value=>'yesnocancel', + :variable=>@@msg.ref('type'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Abort, Retry, Ignore', + :value=>'abortretryignore', + :variable=>@@msg.ref('type'), :anchor=>:w), :fill=>:x, :anchor=>:w) - Tk.pack(TkRadiobutton.new(subf, :text=>'User', :value=>'user', - :variable=>@@msg.ref('type'), :anchor=>:w), + Tk.pack(TkRadiobutton.new(subf, :text=>'User', :value=>'user', + :variable=>@@msg.ref('type'), :anchor=>:w), Tk::BWidget::Entry.new(subf, :textvariable=>@@msg.ref('buttons')), :side=>:left) - labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Icon', :side=>:top, - :anchor=>:w, :relief=>:sunken, + labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Icon', :side=>:top, + :anchor=>:w, :relief=>:sunken, :borderwidth=>1) subf = labf2.get_frame - Tk.pack(TkRadiobutton.new(subf, :text=>'Information', :value=>'info', - :variable=>@@msg.ref('icon'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Question', :value=>'question', - :variable=>@@msg.ref('icon'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Warning', :value=>'warning', - :variable=>@@msg.ref('icon'), :anchor=>:w), - TkRadiobutton.new(subf, :text=>'Error', :value=>'error', - :variable=>@@msg.ref('icon'), :anchor=>:w), + Tk.pack(TkRadiobutton.new(subf, :text=>'Information', :value=>'info', + :variable=>@@msg.ref('icon'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Question', :value=>'question', + :variable=>@@msg.ref('icon'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Warning', :value=>'warning', + :variable=>@@msg.ref('icon'), :anchor=>:w), + TkRadiobutton.new(subf, :text=>'Error', :value=>'error', + :variable=>@@msg.ref('icon'), :anchor=>:w), :fill=>:x, :anchor=>:w) sep = Tk::BWidget::Separator.new(parent, :orient=>:horizontal) @@ -139,13 +139,13 @@ module DemoDialog def self._stddlg(parent) Tk.pack(TkButton.new(parent, :text=>'Select a color '){|w| command(proc{DemoDialog._show_color(w)}) - }, - TkButton.new(parent, :text=>'Font selector dialog', - :command=>proc{_show_fontdlg}), - TkButton.new(parent, :text=>'Progression dialog', - :command=>proc{_show_progdlg}), - TkButton.new(parent, :text=>'Password dialog', - :command=>proc{_show_passdlg}), + }, + TkButton.new(parent, :text=>'Font selector dialog', + :command=>proc{_show_fontdlg}), + TkButton.new(parent, :text=>'Progression dialog', + :command=>proc{_show_progdlg}), + TkButton.new(parent, :text=>'Password dialog', + :command=>proc{_show_passdlg}), :side=>:left, :padx=>5, :anchor=>:w) end @@ -158,15 +158,15 @@ module DemoDialog end def self._show_tmpldlg - dlg = Tk::BWidget::Dialog.new(:relative=>Tk.root, :modal=>:local, - :separator=>true, :title=>'Template dialog', - :side=>@@tmpl['side'], - :anchor=>@@tmpl['anchor'], + dlg = Tk::BWidget::Dialog.new(:relative=>Tk.root, :modal=>:local, + :separator=>true, :title=>'Template dialog', + :side=>@@tmpl['side'], + :anchor=>@@tmpl['anchor'], :default=>0, :cancel=>1) dlg.add('name'=>'ok') dlg.add('name'=>'cancel') - TkMessage.new(dlg.get_frame, :text=>"Template\nDialog", :justify=>:center, - :anchor=>:c, :width=>80).pack(:fill=>:both, :expand=>true, + TkMessage.new(dlg.get_frame, :text=>"Template\nDialog", :justify=>:center, + :anchor=>:c, :width=>80).pack(:fill=>:both, :expand=>true, :padx=>100, :pady=>100) dlg.draw dlg.destroy @@ -174,16 +174,16 @@ module DemoDialog def self._show_msgdlg @@msgdlg.destroy if @@msgdlg - @@msgdlg = Tk::BWidget::MessageDlg.new(:relative=>Tk.root, - :message=>'Message for MessageBox', - :type=>@@msg['type'], - :icon=>@@msg['icon'], + @@msgdlg = Tk::BWidget::MessageDlg.new(:relative=>Tk.root, + :message=>'Message for MessageBox', + :type=>@@msg['type'], + :icon=>@@msg['icon'], :buttons=>@@msg['buttons']) @@msgdlg.create end def self._show_fontdlg - font = Tk::BWidget::SelectFont.new(:relative=>Tk.root, + font = Tk::BWidget::SelectFont.new(:relative=>Tk.root, :font=>DemoVar.font).create DemoVar::Demo.update_font(font) end @@ -192,11 +192,11 @@ module DemoDialog @@progmsg.value = "Compute in progress..." @@progval.value = 0 - @@progdlg = Tk::BWidget::ProgressDlg.new(:relative=>Tk.root, - :title=>'Wait...', - :type=>'infinite', :width=>20, - :textvariable=>@@progmsg, - :variable=>@@progval, + @@progdlg = Tk::BWidget::ProgressDlg.new(:relative=>Tk.root, + :title=>'Wait...', + :type=>'infinite', :width=>20, + :textvariable=>@@progmsg, + :variable=>@@progval, :stop=>'Stop') { command(proc{self.destroy}) create diff --git a/ext/tk/sample/tkextlib/bwidget/tree.rb b/ext/tk/sample/tkextlib/bwidget/tree.rb index e1fcaa774f..9ef6569d16 100644 --- a/ext/tk/sample/tkextlib/bwidget/tree.rb +++ b/ext/tk/sample/tkextlib/bwidget/tree.rb @@ -16,28 +16,28 @@ module DemoTree pane = pw.add(:weight=>1) title = Tk::BWidget::TitleFrame.new(pane, :text=>'Directory tree') - sw = Tk::BWidget::ScrolledWindow.new(title.get_frame, + sw = Tk::BWidget::ScrolledWindow.new(title.get_frame, :relief=>:sunken, :borderwidth=>2) - tree = Tk::BWidget::Tree.new(sw, :relief=>:flat, :borderwidth=>0, - :width=>15, :highlightthickness=>0, - :redraw=>false, :dropenabled=>true, - :dragenabled=>true, :dragevent=>3, + tree = Tk::BWidget::Tree.new(sw, :relief=>:flat, :borderwidth=>0, + :width=>15, :highlightthickness=>0, + :redraw=>false, :dropenabled=>true, + :dragenabled=>true, :dragevent=>3, :droptypes=>[ 'TREE_NODE', [ - :copy, [], + :copy, [], :move, [], :link, [] - ], + ], 'LISTBOX_ITEM', [ - :copy, [], + :copy, [], :move, [], :link, [] ] - ], - :opencmd=>proc{|node| + ], + :opencmd=>proc{|node| moddir(1, tree, node) - }, - :closecmd=>proc{|node| + }, + :closecmd=>proc{|node| moddir(0, tree, node) }) sw.set_widget(tree) @@ -47,24 +47,24 @@ module DemoTree pane = pw.add(:weight=>2) lf = Tk::BWidget::TitleFrame.new(pane, :text=>'Content') - sw = Tk::BWidget::ScrolledWindow.new(lf.get_frame, - :scrollbar=>:horizontal, - :auto=>:none, :relief=>:sunken, + sw = Tk::BWidget::ScrolledWindow.new(lf.get_frame, + :scrollbar=>:horizontal, + :auto=>:none, :relief=>:sunken, :borderwidth=>2) - list = Tk::BWidget::ListBox.new(sw, :relief=>:flat, :borderwidth=>0, - :highlightthickness=>0, :width=>20, - :multicolumn=>true, :redraw=>false, - :dragevent=>3, :dropenabled=>true, - :dragenabled=>true, + list = Tk::BWidget::ListBox.new(sw, :relief=>:flat, :borderwidth=>0, + :highlightthickness=>0, :width=>20, + :multicolumn=>true, :redraw=>false, + :dragevent=>3, :dropenabled=>true, + :dragenabled=>true, :droptypes=>[ 'TREE_NODE', [ - :copy, [], + :copy, [], :move, [], :link, [] - ], + ], 'LISTBOX_ITEM', [ - :copy, [], + :copy, [], :move, [], :link, [] ] @@ -77,43 +77,43 @@ module DemoTree tree.textbind('ButtonPress-1', proc{|node, ev| select('tree', 1, tree, list, node)}) - tree.textbind('Double-ButtonPress-1', + tree.textbind('Double-ButtonPress-1', proc{|node, ev| select('tree', 2, tree, list, node)}) list.textbind('ButtonPress-1', proc{|node, ev| select('list', 1, tree, list, node)}) - list.textbind('Double-ButtonPress-1', + list.textbind('Double-ButtonPress-1', proc{|node, ev| select('list', 2, tree, list, node)}) - list.imagebind('Double-ButtonPress-1', + list.imagebind('Double-ButtonPress-1', proc{|node, ev| select('list', 2, tree, list, node)}) - nb.itemconfigure('demoTree', - :createcmd=>proc{|*args| init(tree, list, *args)}, + nb.itemconfigure('demoTree', + :createcmd=>proc{|*args| init(tree, list, *args)}, :raisecmd=>proc{ - Tk.root.geometry =~ + Tk.root.geometry =~ /\d+x\d+([+-]{1,2}\d+)([+-]{1,2}\d+)/ global_w = ($1 || 0).to_i global_h = ($2 || 0).to_i if @@top - Tk::BWidget.place(@@top, 0, 0, :at, + Tk::BWidget.place(@@top, 0, 0, :at, global_w - Tk.root.winfo_screenwidth, global_h) @@top.deiconify Tk.root.bind('Unmap', proc{@@top.withdraw}) Tk.root.bind('Map', proc{@@top.deiconify}) Tk.root.bind('Configure', proc{|w| if w == Tk.root - Tk.root.geometry =~ + Tk.root.geometry =~ /\d+x\d+([+-]{1,2}\d+)([+-]{1,2}\d+)/ global_w = ($1 || 0).to_i global_h = ($2 || 0).to_i - Tk::BWidget.place(@@top, 0, 0, :at, - global_w - Tk.root.winfo_screenwidth, + Tk::BWidget.place(@@top, 0, 0, :at, + global_w - Tk.root.winfo_screenwidth, global_h) end }, '%W') end - }, + }, :leavecmd=>proc{ @@top.withdraw if @@top Tk.root.bind_remove('Unmap') @@ -131,8 +131,8 @@ module DemoTree rootdir = 'c:' end - tree.insert('end', 'root', 'home', - :text=>rootdir, :data=>rootdir, :open=>true, + tree.insert('end', 'root', 'home', + :text=>rootdir, :data=>rootdir, :open=>true, :image=>Tk::BWidget::Bitmap.new('openfold')) getdir(tree, 'home', rootdir) select('tree', 1, tree, list, 'home') @@ -147,8 +147,8 @@ module DemoTree @@top.resizable(false, false) @@top.title('Drag rectangle to scroll directory tree') @@top.transient(Tk.root) - Tk::BWidget::ScrollView.new(@@top, :window=>tree, :fill=>'white', - :width=>300, :height=>300, :relief=>:sunken, + Tk::BWidget::ScrollView.new(@@top, :window=>tree, :fill=>'white', + :width=>300, :height=>300, :relief=>:sunken, :bd=>1).pack(:fill=>:both, :expand=>true) end @@ -156,11 +156,11 @@ module DemoTree lentries = Dir.glob(File.join(path, '*')).sort lfiles = [] lentries.each{|f| - basename = File.basename(f) + basename = File.basename(f) if File.directory?(f) - Tk::BWidget::Tree::Node.new(tree, node, - :index=>'end', :text=>basename, - :image=>Tk::BWidget::Bitmap.new('folder'), + Tk::BWidget::Tree::Node.new(tree, node, + :index=>'end', :text=>basename, + :image=>Tk::BWidget::Bitmap.new('folder'), :drawcross=>:allways, :data=>f) @@count += 1 else @@ -187,7 +187,7 @@ module DemoTree def self.select(where, num, tree, list, node) @@dblclick = true if num == 1 - if (where == 'tree' && + if (where == 'tree' && tree.selection_get.find{|x| TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) }) @@ -195,7 +195,7 @@ module DemoTree Tk.after(500, proc{edit('tree', tree, list, node)}) return end - if (where == 'list' && + if (where == 'list' && list.selection_get.find{|x| TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) }) @@ -230,13 +230,13 @@ module DemoTree end tree.nodes(node).each{|subnode| - list.insert('end', subnode, - :text=>tree.itemcget(subnode, :text), + list.insert('end', subnode, + :text=>tree.itemcget(subnode, :text), :image=>Tk::BWidget::Bitmap.new('folder')) } TkComm.simplelist(dir).each{|f| - Tk::BWidget::ListBox::Item.new(list, 'end', :text=>f, + Tk::BWidget::ListBox::Item.new(list, 'end', :text=>f, :image=>Tk::BWidget::Bitmap.new('file')) } end @@ -244,7 +244,7 @@ module DemoTree def self.edit(where, tree, list, node) return if @@dblclick - if (where == 'tree' && + if (where == 'tree' && tree.selection_get.find{|x| TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node) }) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb index 4dd929c035..bb09b4dfd3 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/calendar.rb @@ -2,9 +2,9 @@ require 'tk' require 'tkextlib/iwidgets' -Tk::Iwidgets::Calendar.new(:command=>proc{|arg| puts(arg.date)}, - :weekendbackground=>'mistyrose', - :weekdaybackground=>'ghostwhite', - :outline=>'black', :startday=>'wednesday', +Tk::Iwidgets::Calendar.new(:command=>proc{|arg| puts(arg.date)}, + :weekendbackground=>'mistyrose', + :weekdaybackground=>'ghostwhite', + :outline=>'black', :startday=>'wednesday', :days=>%w(We Th Fr Sa Su Mo Tu)).pack Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb index ec9c7a1df3..36847538d6 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/combobox.rb @@ -5,11 +5,11 @@ require 'tkextlib/iwidgets' # # Non-editable Dropdown Combobox # -cb1 = Tk::Iwidgets::Combobox.new(:labeltext=>'Month:', +cb1 = Tk::Iwidgets::Combobox.new(:labeltext=>'Month:', :selectioncommand=>proc{ puts(cb1.get_curselection) - }, - :editable=>false, :listheight=>185, + }, + :editable=>false, :listheight=>185, :popupcursor=>'hand1') cb1.insert_list('end', *%w(Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec)) @@ -18,7 +18,7 @@ cb1.insert_list('end', *%w(Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec)) # # Editable Dropdown Combobox # -cb2 = Tk::Iwidgets::Combobox.new(:labeltext=>'Operating System:', +cb2 = Tk::Iwidgets::Combobox.new(:labeltext=>'Operating System:', :selectioncommand=>proc{ puts(cb2.get_curselection) }) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb b/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb index 197521e0a4..00ee99786c 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/dialogshell.rb @@ -8,7 +8,7 @@ ds.add('OK', :text=>'OK', :command=>proc{puts 'OK'; ds.deactivate}) ds.add('Cancel', :text=>'Cancel', :command=>proc{puts 'Cancel'; ds.deactivate}) ds.default('OK') -TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, +TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, :command=>proc{puts ds.activate}).pack(:padx=>10, :pady=>10) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb index 85c5d03d17..682c853e47 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/disjointlistbox.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -djl = Tk::Iwidgets::Disjointlistbox.new.pack(:fill=>:both, :expand=>true, +djl = Tk::Iwidgets::Disjointlistbox.new.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10) djl.set_lhs(*[0,2,4,5]) djl.set_rhs(3,6) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb index 856d883a92..8563a0894d 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb @@ -11,20 +11,20 @@ TkOption.add('*textBackground', 'white') ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) -fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', +fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', :fixed=>10, :width=>12) -nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', +nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', :validate=>:numeric, :width=>12) -aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', - :validate=>:alphabetic, :width=>12, +aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', + :validate=>:alphabetic, :width=>12, :invalid=>proc{ puts "Alphabetic contents invalid" }) -pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, - :show=>Tk::UTF8_String("\267"), +pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, + :show=>Tk::UTF8_String("\267"), ## <=== utf8 character :command=>proc{puts "Return Pressed"}) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb index 4a4c2e7eb7..d8ccdf8555 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb @@ -4,7 +4,11 @@ # set $KCODE to 'utf' for a utf8 charecter # ######################################################### -$KCODE='utf' +unless defined?(::Encoding.default_external) + $KCODE='utf' +else + DEFAULT_TK_ENCODING = 'UTF-8' +end require 'tk' require 'tkextlib/iwidgets' @@ -13,19 +17,19 @@ TkOption.add('*textBackground', 'white') ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) -fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', +fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', :fixed=>10, :width=>12) -nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', +nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', :validate=>:numeric, :width=>12) -aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', - :validate=>:alphabetic, :width=>12, +aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', + :validate=>:alphabetic, :width=>12, :invalid=>proc{ puts "Alphabetic contents invalid" }) -pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, +pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, :show=>"\267", ## <=== utf8 character :command=>proc{puts "Return Pressed"}) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb index bddd542f64..327f90893c 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-3.rb @@ -13,19 +13,19 @@ TkOption.add('*textBackground', 'white') ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"}) -fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', +fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', :fixed=>10, :width=>12) -nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', +nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', :validate=>:numeric, :width=>12) -aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', - :validate=>:alphabetic, :width=>12, +aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', + :validate=>:alphabetic, :width=>12, :invalid=>proc{ puts "Alphabetic contents invalid" }) -pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, +pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, :show=>"\267", ## <=== utf8 character :command=>proc{puts "Return Pressed"}) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb index 6971052b60..4944c72ea5 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/extbutton.rb @@ -2,9 +2,9 @@ require 'tk' require 'tkextlib/iwidgets' -Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info', - :background=>'bisque', :activeforeground=>'red', - :bitmapforeground=>'blue', :defaultring=>true, +Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info', + :background=>'bisque', :activeforeground=>'red', + :bitmapforeground=>'blue', :defaultring=>true, :command=>proc{ puts "Bisque is beautiful" }).pack(:expand=>true) @@ -12,9 +12,9 @@ Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info', #img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../../../images/earthris.gif')) img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/clear.gif')) -Tk::Iwidgets::Extbutton.new(:text=>'Image example', :relief=>:ridge, - :image=>img, :imagepos=>:e, :font=>'9x15bold', - :activebackground=>'lightyellow', +Tk::Iwidgets::Extbutton.new(:text=>'Image example', :relief=>:ridge, + :image=>img, :imagepos=>:e, :font=>'9x15bold', + :activebackground=>'lightyellow', :background=>'lightgreen').pack(:expand=>true) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb index 4738084d9d..63e4be2fee 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -Tk::Iwidgets::Extfileselectionbox.new.pack(:padx=>10, :pady=>10, +Tk::Iwidgets::Extfileselectionbox.new.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb index 2ad3adb974..3a5b513bde 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/fileselectionbox.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -Tk::Iwidgets::Fileselectionbox.new.pack(:padx=>10, :pady=>10, +Tk::Iwidgets::Fileselectionbox.new.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb index ddb08d8b78..085070e652 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/hierarchy.rb @@ -10,16 +10,16 @@ def get_files(file) } end -Tk::Iwidgets::Hierarchy.new(:querycommand=>proc{|arg| get_files(arg.node)}, - :visibleitems=>'30x15', - :labeltext=>ENV['HOME']).pack(:side=>:left, - :expand=>true, +Tk::Iwidgets::Hierarchy.new(:querycommand=>proc{|arg| get_files(arg.node)}, + :visibleitems=>'30x15', + :labeltext=>ENV['HOME']).pack(:side=>:left, + :expand=>true, :fill=>:both) -# Tk::Iwidgets::Hierarchy.new(:querycommand=>[proc{|n| get_files(n)}, '%n'], -# :visibleitems=>'30x15', -# :labeltext=>ENV['HOME']).pack(:side=>:left, -# :expand=>true, +# Tk::Iwidgets::Hierarchy.new(:querycommand=>[proc{|n| get_files(n)}, '%n'], +# :visibleitems=>'30x15', +# :labeltext=>ENV['HOME']).pack(:side=>:left, +# :expand=>true, # :fill=>:both) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb b/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb index 1d2e0a98a3..577550af55 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/labeledwidget.rb @@ -2,11 +2,11 @@ require 'tk' require 'tkextlib/iwidgets' -lw = Tk::Iwidgets::Labeledwidget.new(:labeltext=>'Canvas Widget', +lw = Tk::Iwidgets::Labeledwidget.new(:labeltext=>'Canvas Widget', :labelpos=>:s) lw.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10) -cw = TkCanvas.new(lw.child_site, :relief=>:raised, :width=>200, :height=>200, +cw = TkCanvas.new(lw.child_site, :relief=>:raised, :width=>200, :height=>200, :borderwidth=>3, :background=>:white) cw.pack(:padx=>10, :pady=>10) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb b/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb index b87a6d27f9..c9677f2270 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/mainwindow.rb @@ -4,55 +4,55 @@ require 'tkextlib/iwidgets' mw = Tk::Iwidgets::Mainwindow.new -mw.menubar.add(:menubutton, 'file', :text=>'File', :underline=>0, +mw.menubar.add(:menubutton, 'file', :text=>'File', :underline=>0, :padx=>8, :pady=>2, :menu=>[ - [:options, {:tearoff=>false}], + [:options, {:tearoff=>false}], [:command, 'new', { - :label=>'New', :underline=>0, + :label=>'New', :underline=>0, :helpstr=>'Create a new file' } - ], + ], [:command, 'open', { - :label=>'Open ...', :underline=>0, + :label=>'Open ...', :underline=>0, :helpstr=>'Open an existing file' } - ], + ], [:command, 'save', { - :label=>'Save', :underline=>0, + :label=>'Save', :underline=>0, :helpstr=>'Save the current file' } - ], + ], [:command, 'saveas', { - :label=>'Save As', :underline=>5, + :label=>'Save As', :underline=>5, :helpstr=>'Save the file as a different name' } - ], + ], [:command, 'print', { - :label=>'Print', :underline=>0, + :label=>'Print', :underline=>0, :helpstr=>'Print the file' } - ], + ], - [:separator, 'sep1'], + [:separator, 'sep1'], [:command, 'close', { - :label=>'Close', :underline=>0, + :label=>'Close', :underline=>0, :helpstr=>'Close the file' } - ], + ], - [:separator, 'sep2'], + [:separator, 'sep2'], [:command, 'exit', { - :label=>'Exit', :underline=>1, + :label=>'Exit', :underline=>1, :helpstr=>'Exit this application' } - ], + ], nil ]) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb index 891761adc1..e01275217d 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/menubar.rb @@ -8,96 +8,96 @@ viewmode = TkVariable.new menu_spec = [ [:menubutton, 'file', { :text=>'File', :menu=>[ - [:options, {:tearoff=>false}], + [:options, {:tearoff=>false}], [:command, 'new', { - :label=>'New', :helpstr=>'Open new document', + :label=>'New', :helpstr=>'Open new document', :command=>proc{puts 'NEW'} } - ], + ], [:command, 'close', { - :label=>'Close', :helpstr=>'Close current document', + :label=>'Close', :helpstr=>'Close current document', :command=>proc{puts 'CLOSE'} } - ], + ], - [:separator, 'sep1'], + [:separator, 'sep1'], [:command, 'exit', { - :label=>'Exit', :helpstr=>'Exit application', + :label=>'Exit', :helpstr=>'Exit application', :command=>proc{exit} } ] ] } - ], + ], [:menubutton, 'edit', { :text=>'Edit', :menu=>[ - [:options, {:tearoff=>false}], + [:options, {:tearoff=>false}], [:command, 'undo', { - :label=>'Undo', :underline=>0, - :helpstr=>'Undo last command', + :label=>'Undo', :underline=>0, + :helpstr=>'Undo last command', :command=>proc{puts 'UNDO'} } - ], + ], - [:separator, 'sep2'], + [:separator, 'sep2'], [:command, 'cut', { - :label=>'Cut', :underline=>1, - :helpstr=>'Cut selection to clipboard', + :label=>'Cut', :underline=>1, + :helpstr=>'Cut selection to clipboard', :command=>proc{puts 'CUT'} } - ], + ], [:command, 'copy', { - :label=>'Copy', :underline=>1, - :helpstr=>'Copy selection to clipboard', + :label=>'Copy', :underline=>1, + :helpstr=>'Copy selection to clipboard', :command=>proc{puts 'COPY'} } - ], + ], [:command, 'paste', { - :label=>'Paste', :underline=>0, - :helpstr=>'Paste clipboard contents', + :label=>'Paste', :underline=>0, + :helpstr=>'Paste clipboard contents', :command=>proc{puts 'PASTE'} } ] ] } - ], + ], [:menubutton, 'options', { :text=>'Options', :menu=>[ - [:options, {:tearoff=>false, :selectcolor=>'blue'}], + [:options, {:tearoff=>false, :selectcolor=>'blue'}], [:radiobutton, 'byName', { - :variable=>viewmode, :value=>'NAME', - :label=>'by Name', :helpstr=>'View files by name order', + :variable=>viewmode, :value=>'NAME', + :label=>'by Name', :helpstr=>'View files by name order', :command=>proc{puts 'NAME'} } - ], + ], [:radiobutton, 'byDate', { - :variable=>viewmode, :value=>'DATE', - :label=>'by Date', :helpstr=>'View files by date order', + :variable=>viewmode, :value=>'DATE', + :label=>'by Date', :helpstr=>'View files by date order', :command=>proc{puts 'DATE'} } - ], + ], [:cascade, 'prefs', { :label=>'Preferences', :menu=>[ [:command, 'colors', { - :label=>'Colors...', :helpstr=>'Change text colors', + :label=>'Colors...', :helpstr=>'Change text colors', :command=>proc{puts 'COLORS'} } - ], + ], [:command, 'fonts', { - :label=>'Fonts...', :helpstr=>'Change text font', + :label=>'Fonts...', :helpstr=>'Change text font', :command=>proc{puts 'COLORS'} } ] @@ -109,7 +109,7 @@ menu_spec = [ ] ] -#mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar, +#mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar, # :menubuttons=>menu_spec) mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar) mb.configure(:menubuttons=>menu_spec) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb index d6f2292650..477c916e07 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/menubar2.rb @@ -9,13 +9,13 @@ mb = Tk::Iwidgets::Menubar.new mb.menubuttons = [ [:menubutton, 'file', { :text=>'File', :menu=>[ - [:command, 'new', {:label=>'New'}], - [:command, 'close', {:label=>'Close'}], - [:separator, 'sep1'], + [:command, 'new', {:label=>'New'}], + [:command, 'close', {:label=>'Close'}], + [:separator, 'sep1'], [:command, 'quit', {:label=>'Quit'}] ] } - ], + ], [:menubutton, 'edit', {:text=>'Edit'}] ] @@ -28,14 +28,14 @@ mb.add(:command, '.edit.paste', :label=>'Paste', :underline=>0) mb.add(:menubutton, '.options', :text=>'Options', :menu=>[ [:radiobutton, 'byName', { :variable=>viewmode, :value=>'NAME', :label=>'by Name'} - ], + ], [:radiobutton, 'byDate', { :variable=>viewmode, :value=>'DATE', :label=>'by Date'} ] ]) mb.add(:cascade, '.options.prefs', :label=>'Preferences', :menu=>[ - [:command, 'colors', {:label=>'Colors...'}], + [:command, 'colors', {:label=>'Colors...'}], [:command, 'fonts', {:label=>'Fonts...'}] ]) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb index 3221dbc30c..87b2d38907 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox1.rb @@ -2,9 +2,9 @@ require 'tk' require 'tkextlib/iwidgets' -mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, - :labeltext=>'Messages', :labelpos=>:n, - :height=>120, :width=>550, +mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, + :labeltext=>'Messages', :labelpos=>:n, + :height=>120, :width=>550, :savedir=>'/tmp', :textbackground=>'#d9d9d9') mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb index 2f0e3648a6..5278883568 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagebox2.rb @@ -2,9 +2,9 @@ require 'tk' require 'tkextlib/iwidgets' -mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, - :labeltext=>'Messages', :labelpos=>:n, - :height=>120, :width=>550, +mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic, + :labeltext=>'Messages', :labelpos=>:n, + :height=>120, :width=>550, :savedir=>'/tmp', :textbackground=>'#d9d9d9') mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb index 6c6bfbca3f..52799f206c 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/messagedialog.rb @@ -7,8 +7,8 @@ mainloop = Thread.new{Tk.mainloop} # # Standard question message dialog used for confirmation. # -md = Tk::Iwidgets::Messagedialog.new(:title=>'Message Dialog', - :text=>'Are you sure ? ', +md = Tk::Iwidgets::Messagedialog.new(:title=>'Message Dialog', + :text=>'Are you sure ? ', :bitmap=>'questhead', :modality=>:global) md.buttonconfigure('OK', :text=>'Yes') @@ -32,8 +32,8 @@ md.destroy # bmp = '@' + File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/text.xbm') -cr = Tk::Iwidgets::Messagedialog.new(:title=>'Copyright', - :bitmap=>bmp, :imagepos=>:n, +cr = Tk::Iwidgets::Messagedialog.new(:title=>'Copyright', + :bitmap=>bmp, :imagepos=>:n, :text=>"Copyright 200x XXX Corporation\nAll rights reserved") cr.hide('Cancel') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb index e33b81eb6f..055312ec96 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100) -nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, +nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, :side=>:left, :padx=>10, :pady=>10) # Add two pages to the tabnotebook, diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb index 649de4f024..41e9ce1bfc 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100) -nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, +nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true, :side=>:top, :padx=>10, :pady=>0) # Add two pages to the tabnotebook, diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb b/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb index 1fd7a5bc05..2b921ffab9 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/optionmenu.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -om = Tk::Iwidgets::Optionmenu.new(:labelmargin=>5, :labelpos=>:w, +om = Tk::Iwidgets::Optionmenu.new(:labelmargin=>5, :labelpos=>:w, :labeltext=>"Operating System :") om.insert('end', 'Unix', 'VMS', 'Linux', 'OS/2', 'Windows NT', 'DOS') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb index 6e4458e508..88fc401483 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow.rb @@ -11,7 +11,7 @@ pw.add('bottom', :margin=>10, :minimum=>10) pw.pack(:fill=>:both, :expand=>true) pw.child_site_list.each{|pane| - TkButton.new(pane, :text=>pane.path, :relief=>:raised, + TkButton.new(pane, :text=>pane.path, :relief=>:raised, :borderwidth=>2).pack(:fill=>:both, :expand=>true) } diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb index 6779cb57db..96987d529c 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/panedwindow2.rb @@ -11,7 +11,7 @@ bottom = pw.add(:margin=>10, :minimum=>10) pw.pack(:fill=>:both, :expand=>true) pw.child_site_list.each{|pane| - TkButton.new(pane, :text=>pane.path, :relief=>:raised, + TkButton.new(pane, :text=>pane.path, :relief=>:raised, :borderwidth=>2).pack(:fill=>:both, :expand=>true) } diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb index 2c643e56f7..d92a26ead9 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/promptdialog.rb @@ -6,7 +6,7 @@ mainloop = Thread.new{Tk.mainloop} TkOption.add('*textBackground', 'white') -pd = Tk::Iwidgets::Promptdialog.new(:modality=>:global, :title=>'Password', +pd = Tk::Iwidgets::Promptdialog.new(:modality=>:global, :title=>'Password', :labeltext=>'Password:', :show=>'*') pd.hide('Apply') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb b/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb index 6e1c3fffe3..e76dda88c6 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/pushbutton.rb @@ -2,8 +2,8 @@ require 'tk' require 'tkextlib/iwidgets' -Tk::Iwidgets::Pushbutton.new(:text=>'Hello', - :command=>proc{puts 'Hello World'}, +Tk::Iwidgets::Pushbutton.new(:text=>'Hello', + :command=>proc{puts 'Hello World'}, :defaultring=>true).pack(:padx=>10, :pady=>10) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb index 5219847c9c..e5bd90a1cb 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledframe.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -sf = Tk::Iwidgets::Scrolledframe.new(:width=>150, :height=>180, +sf = Tk::Iwidgets::Scrolledframe.new(:width=>150, :height=>180, :labeltext=>'scrolledframe') cs = sf.child_site diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb index 04334b8da8..2b675f802c 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledhtml.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') -sh = Tk::Iwidgets::Scrolledhtml.new(:fontname=>'helvetica', +sh = Tk::Iwidgets::Scrolledhtml.new(:fontname=>'helvetica', :linkcommand=>proc{|href| sh.import_link(href) }) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb index 0b69751911..bf2c60191f 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb @@ -4,13 +4,13 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') -slb = Tk::Iwidgets::Scrolledlistbox.new(:selectmode=>:single, +slb = Tk::Iwidgets::Scrolledlistbox.new(:selectmode=>:single, :vscrollmode=>:static, :hscrollmode=>:dynamic, - :labeltext=>'List', + :labeltext=>'List', :selectioncommand=>proc{ puts(slb.get_curselection) - }, + }, :dblclickcommand=>proc{ puts('Double Click') puts(slb.get_curselection) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb index dd1a99a829..41498e67f7 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/scrolledtext.rb @@ -2,7 +2,7 @@ require 'tk' require 'tkextlib/iwidgets' -st = Tk::Iwidgets::Scrolledtext.new(:hscrollmode=>:dynamic, :wrap=>:none, +st = Tk::Iwidgets::Scrolledtext.new(:hscrollmode=>:dynamic, :wrap=>:none, :labeltext=>'Password File') st.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb b/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb index a5d623ae80..74684974b1 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/selectionbox.rb @@ -4,12 +4,12 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') -sb = Tk::Iwidgets::Selectionbox.new.pack(:padx=>10, :pady=>10, +sb = Tk::Iwidgets::Selectionbox.new.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) sb.insert_items('end', *['Hello', 'Out There', 'World']) -TkLabel.new(sb.child_site, +TkLabel.new(sb.child_site, :text=>'Child Site is Here').pack(:fill=>:x, :padx=>10, :pady=>10) sb.insert_items(2, 'Cruel Cruel') diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb b/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb index f40b419180..d53391f2f3 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/selectiondialog.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' mainloop = Thread.new{Tk.mainloop} -TkButton.new(:text=>'QUIT', +TkButton.new(:text=>'QUIT', :command=>proc{Tk.root.destroy}).pack(:padx=>10, :pady=>10) Tk::Iwidgets::Selectiondialog.new.activate diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb b/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb index c44b5554a6..6d01280141 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/shell.rb @@ -2,16 +2,16 @@ require 'tk' require 'tkextlib/iwidgets' -sh = Tk::Iwidgets::Shell.new(:modality=>:application, +sh = Tk::Iwidgets::Shell.new(:modality=>:application, :padx=>20, :pady=>20, :title=>'Shell') -TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, +TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7, :command=>proc{puts sh.activate}).pack(:padx=>10, :pady=>10) TkLabel.new(sh.child_site, :text=>'SHELL').pack -TkButton.new(sh.child_site, :text=>'YES', +TkButton.new(sh.child_site, :text=>'YES', :command=>proc{sh.deactivate 'press YES'}).pack(:fill=>:x) -TkButton.new(sh.child_site, :text=>'NO', +TkButton.new(sh.child_site, :text=>'NO', :command=>proc{sh.deactivate 'press NO'}).pack(:fill=>:x) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb index 0bcdefb763..e2dde01b18 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/spinint.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' TkOption.add('*textBackground', 'white') -Tk::Iwidgets::Spinint.new(:labeltext=>'Temperature', :labelpos=>:w, :width=>5, +Tk::Iwidgets::Spinint.new(:labeltext=>'Temperature', :labelpos=>:w, :width=>5, :fixed=>true, :range=>[32, 212]).pack(:pady=>10) Tk.mainloop diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb b/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb index 295d38ee96..6a20b0eb87 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/spinner.rb @@ -18,10 +18,10 @@ class Spinner_demo < TkWindow end def initialize(parent=nil) - @spinner = Tk::Iwidgets::Spinner.new(parent, :labeltext=>'Month : ', - :width=>10, :fixed=>10, - :validate=>proc{|c| block_input}, - :decrement=>proc{spin_month -1}, + @spinner = Tk::Iwidgets::Spinner.new(parent, :labeltext=>'Month : ', + :width=>10, :fixed=>10, + :validate=>proc{|c| block_input}, + :decrement=>proc{spin_month -1}, :increment=>proc{spin_month 1}) @path = @spinner @spinner.insert(0, Months[0]) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb index 6f1ecc4fa4..382b34d3ce 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100) -tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, +tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, :side=>:left, :padx=>10, :pady=>10) # Add two pages to the tabnotebook, diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb index 4a5eef5a8f..2689759bde 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/tabnotebook2.rb @@ -4,7 +4,7 @@ require 'tkextlib/iwidgets' # Create the tabnotebook widget and pack it. tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100) -tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, +tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true, :side=>:top, :padx=>10, :pady=>0) # Add two pages to the tabnotebook, diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb b/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb index 355466eb1a..608efd0af1 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/toolbar.rb @@ -88,7 +88,7 @@ EOD ########################################## -bmp_dir = File.join(File.dirname(File.expand_path(__FILE__)), +bmp_dir = File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images') ########################################## @@ -102,16 +102,16 @@ tb = Tk::Iwidgets::Toolbar.new(:helpvariable=>status_var) ########################################## -tb.add(:button, :helpstr=>'Copy It', :image=>editcopy22, +tb.add(:button, :helpstr=>'Copy It', :image=>editcopy22, :balloonstr=>'Copy', :command=>proc{puts 'Copy It'}) -tb.add(:button, :helpstr=>'Cut It', :image=>editcut22, +tb.add(:button, :helpstr=>'Cut It', :image=>editcut22, :balloonstr=>'Cut', :command=>proc{puts 'Cut It'}) -tb.add(:button, :helpstr=>'Paste It', :image=>editpaste22, +tb.add(:button, :helpstr=>'Paste It', :image=>editpaste22, :balloonstr=>'Paste', :command=>proc{puts 'Paste It'}) -tb.add(:button, :helpstr=>'Delete It', :image=>editdelete22, +tb.add(:button, :helpstr=>'Delete It', :image=>editdelete22, :balloonstr=>'Delete', :command=>proc{puts 'Delete It'}) #-------------------------------- @@ -120,19 +120,19 @@ tb.add(:frame, :borderwidth=>1, :width=>10, :height=>10) #-------------------------------- -tb.add(:radiobutton, :variable=>radio_var, :value=>'Box', - :bitmap=>"@#{bmp_dir}/box.xbm", - :helpstr=>'Radio Button #1', :balloonstr=>'Radio', +tb.add(:radiobutton, :variable=>radio_var, :value=>'Box', + :bitmap=>"@#{bmp_dir}/box.xbm", + :helpstr=>'Radio Button #1', :balloonstr=>'Radio', :command=>proc{puts 'Radio Button "Box"'}) -tb.add(:radiobutton, :variable=>radio_var, :value=>'Line', - :bitmap=>"@#{bmp_dir}/line.xbm", - :helpstr=>'Radio Button #2', :balloonstr=>'Radio', +tb.add(:radiobutton, :variable=>radio_var, :value=>'Line', + :bitmap=>"@#{bmp_dir}/line.xbm", + :helpstr=>'Radio Button #2', :balloonstr=>'Radio', :command=>proc{puts 'Radio Button "Line"'}) -tb.add(:radiobutton, :variable=>radio_var, :value=>'Oval', - :bitmap=>"@#{bmp_dir}/oval.xbm", - :helpstr=>'Radio Button #3', :balloonstr=>'Radio', +tb.add(:radiobutton, :variable=>radio_var, :value=>'Oval', + :bitmap=>"@#{bmp_dir}/oval.xbm", + :helpstr=>'Radio Button #3', :balloonstr=>'Radio', :command=>proc{puts 'Radio Button "Oval"'}) #-------------------------------- @@ -141,10 +141,10 @@ tb.add(:frame, :borderwidth=>1, :width=>10, :height=>10) #-------------------------------- -tb.add(:checkbutton, :variable=>check_var1, :onvalue=>'yes', :offvalue=>'no', +tb.add(:checkbutton, :variable=>check_var1, :onvalue=>'yes', :offvalue=>'no', :image=>text22, :command=>proc{puts 'Checkbutton 1'}) -tb.add(:checkbutton, :variable=>check_var2, :onvalue=>'yes', :offvalue=>'no', +tb.add(:checkbutton, :variable=>check_var2, :onvalue=>'yes', :offvalue=>'no', :bitmap=>"@#{bmp_dir}/points.xbm", :command=>proc{puts 'Checkbutton 2'}) tb.pack(:side=>:top, :anchor=>:nw) diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb b/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb index 808c798aec..2af53ba63b 100644 --- a/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb +++ b/ext/tk/sample/tkextlib/iwidgets/sample/watch.rb @@ -8,7 +8,7 @@ Thread.new{ trap('INT', 'DEFAULT') } -Tk::Iwidgets::Watch.new(:state=>:disabled, :showampm=>:no, +Tk::Iwidgets::Watch.new(:state=>:disabled, :showampm=>:no, :width=>155, :height=>155){|w| w.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true) # TkTimer.new(1000, -1, proc{w.show; Tk.update}).start diff --git a/ext/tk/sample/tkextlib/tcllib/datefield.rb b/ext/tk/sample/tkextlib/tcllib/datefield.rb index cfeca0c6de..3550af7d23 100644 --- a/ext/tk/sample/tkextlib/tcllib/datefield.rb +++ b/ext/tk/sample/tkextlib/tcllib/datefield.rb @@ -20,8 +20,8 @@ my_date1.trace('w'){ df = Tk::Tcllib::Datefield.new(:textvariable=>my_date1) Tk.grid(TkLabel.new(:text=>'Enter a date:', :anchor=>:e), df, :sticky=>:ew) -Tk.grid(TkLabel.new(:text=>'That date ia a:', :anchor=>:e), - TkLabel.new(:textvariable=>my_date2, :relief=>:sunken, :width=>12), +Tk.grid(TkLabel.new(:text=>'That date ia a:', :anchor=>:e), + TkLabel.new(:textvariable=>my_date2, :relief=>:sunken, :width=>12), :sticky=>:ew) df.set_focus diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb index 053b0de085..7f35a3833c 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos1.rb @@ -23,7 +23,7 @@ Tk.pack(vc1,vc2,vc3, :fill=>:both, :side=>:top) ############################### -s = Tk::Tcllib::Plotchart::XYPlot.new(c1, [0.0, 100.0, 10.0], +s = Tk::Tcllib::Plotchart::XYPlot.new(c1, [0.0, 100.0, 10.0], [0.0, 100.0, 20.0]) @@ -56,7 +56,7 @@ s.save_plot "aha.ps" s = Tk::Tcllib::Plotchart::Piechart.new(c2) -s.plot([ ["Long names", 10], ["Short names", 30], +s.plot([ ["Long names", 10], ["Short names", 30], ["Average", 40], ["Ultra-short names", 5] ]) # @@ -78,7 +78,7 @@ s.title "Cardioid" ############################### -s = Tk::Tcllib::Plotchart::Barchart.new(hc1, %w(A B C D E), +s = Tk::Tcllib::Plotchart::Barchart.new(hc1, %w(A B C D E), [0.0, 10.0, 2.0], 2) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') @@ -87,7 +87,7 @@ s.title "Arbitrary data" ############################### -s = Tk::Tcllib::Plotchart::Barchart.new(hc2, %w(A B C D E), +s = Tk::Tcllib::Plotchart::Barchart.new(hc2, %w(A B C D E), [0.0, 20.0, 5.0], :stacked) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') @@ -96,7 +96,7 @@ s.title "Stacked diagram" ############################### -s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc1, [0.0, 10.0, 2.0], +s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc1, [0.0, 10.0, 2.0], %w(A B C D E), 2) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') @@ -105,7 +105,7 @@ s.title "Arbitrary data" ############################### -s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc2, [0.0, 20.0, 5.0], +s = Tk::Tcllib::Plotchart::HorizontalBarchart.new(vc2, [0.0, 20.0, 5.0], %w(A B C D E), :stacked) s.plot('series1', [1.0, 4.0, 6.0, 1.0, 7.0], 'red') @@ -114,7 +114,7 @@ s.title "Stacked diagram" ############################### -s = Tk::Tcllib::Plotchart::Timechart.new(vc3, "1 january 2004", +s = Tk::Tcllib::Plotchart::Timechart.new(vc3, "1 january 2004", "31 december 2004", 4) s.period("Spring", "1 march 2004", "1 june 2004", 'green') @@ -134,7 +134,7 @@ zc1 = TkCanvas.new(z, :background=>'white', :width=>400, :height=>300) zc2 = TkCanvas.new(z, :background=>'white', :width=>400, :height=>250) Tk.pack(zc1,zc2) -s = Tk::Tcllib::Plotchart::Plot3D.new(zc1, +s = Tk::Tcllib::Plotchart::Plot3D.new(zc1, [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) s.title "3D Plot" @@ -145,12 +145,12 @@ s.plot_function{|x, y| 3.0 * (1.0-(x1*x1+y1*y1))*(1.0-(x1*x1+y1*y1)) } -s = Tk::Tcllib::Plotchart::Plot3D.new(zc2, +s = Tk::Tcllib::Plotchart::Plot3D.new(zc2, [0, 10, 3], [-10, 10, 10], [0, 10, 2.5]) s.title "3D Plot - data " s.colour("green", "black") -s.plot_data([ [1.0, 2.0, 1.0, 0.0], - [1.1, 3.0, 1.1, -0.5], +s.plot_data([ [1.0, 2.0, 1.0, 0.0], + [1.1, 3.0, 1.1, -0.5], [3.0, 1.0, 4.0, 5.0] ]) ############################### diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb index 33a6f29940..cb657a40d8 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos2.rb @@ -12,7 +12,7 @@ Tk.pack(c1,c2, :fill=>:both, :side=>:top) ############################### # Set up a strip chart ############################### -slipchart = Tk::Tcllib::Plotchart::Stripchart.new(c1, [0.0, 100.0, 10.0], +slipchart = Tk::Tcllib::Plotchart::Stripchart.new(c1, [0.0, 100.0, 10.0], [0.0, 100.0, 20.0]) TkTimer.new(500, -1, proc{|obj| # obj --> TkTimer object @@ -34,7 +34,7 @@ slipchart.title "Aha!" ############################### # Set up an isometric plot ############################### -s = Tk::Tcllib::Plotchart::IsometricPlot.new(c2, [0.0, 100.0], [0.0, 200.0], +s = Tk::Tcllib::Plotchart::IsometricPlot.new(c2, [0.0, 100.0], [0.0, 200.0], :noaxes) s.set_zoom_pan @@ -50,8 +50,8 @@ s.plot('circle', [70.0, 70.0, 42.0]) h = TkToplevel.new(:title=>'h') c = TkCanvas.new(h, :bg=>'white', :width=>400, :height=>200).pack(:fill=>:both) -s = Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0]) +s = Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], + [0.0, 100.0, 20.0]) s.dataconfig('series1', :colour=>'red', :type=>:symbol) s.dataconfig('series2', :colour=>'green', :type=>:both) diff --git a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb index 2b5c7642bb..66b8fe706a 100644 --- a/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb +++ b/ext/tk/sample/tkextlib/tcllib/plotdemos3.rb @@ -7,9 +7,9 @@ require 'tkextlib/tcllib/plotchart' # Set up a strip chart ############################### -Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0], - [0.0, 100.0, 20.0], - :background=>'white', +Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0], + [0.0, 100.0, 20.0], + :background=>'white', :width=>400, :height=>200){|chart| title "Aha!" pack(:fill=>:both, :side=>:top) @@ -38,8 +38,8 @@ Tk::Tcllib::Plotchart::Stripchart.new([0.0, 100.0, 10.0], ############################### # Set up an isometric plot ############################### -Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes, - :background=>'white', +Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes, + :background=>'white', :width=>400, :height=>200){|chart| pack(:fill=>:both, :side=>:top) set_zoom_pan @@ -54,17 +54,17 @@ Tk::Tcllib::Plotchart::IsometricPlot.new([0.0, 100.0], [0.0, 200.0], :noaxes, # Check the symbols ############################### TkToplevel.new(:title=>'h'){|h| - Tk::Tcllib::Plotchart::XYPlot.new(h, [0.0, 100.0, 10.0], - [0.0, 100.0, 20.0], - :bg=>'white', + Tk::Tcllib::Plotchart::XYPlot.new(h, [0.0, 100.0, 10.0], + [0.0, 100.0, 20.0], + :bg=>'white', :width=>400, :height=>200){|chart| pack(:fill=>:both) yconfig(:format=>"%12.2e") - series1 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'red', + series1 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'red', :type=>:symbol) - series2 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'green', + series2 = Tk::Tcllib::Plotchart::PlotSeries.new(chart, :colour=>'green', :type=>:both) x = 5.0 diff --git a/ext/tk/sample/tkextlib/tcllib/xyplot.rb b/ext/tk/sample/tkextlib/tcllib/xyplot.rb index 8f8c3eb880..2aa101efcb 100644 --- a/ext/tk/sample/tkextlib/tcllib/xyplot.rb +++ b/ext/tk/sample/tkextlib/tcllib/xyplot.rb @@ -5,7 +5,7 @@ require 'tkextlib/tcllib/plotchart' TkCanvas.new(:background=>'white', :width=>400, :height=>200){|c| pack(:fill=>:both) - Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], + Tk::Tcllib::Plotchart::XYPlot.new(c, [0.0, 100.0, 10.0], [0.0, 100.0, 20.0]){ [ [0.0, 32.0], [10.0, 50.0], [25.0, 60.0], [78.0, 11.0] ].each{|x, y| plot('series1', x, y) diff --git a/ext/tk/sample/tkextlib/tile/demo.rb b/ext/tk/sample/tkextlib/tile/demo.rb index 633a072460..260ca00022 100644 --- a/ext/tk/sample/tkextlib/tile/demo.rb +++ b/ext/tk/sample/tkextlib/tile/demo.rb @@ -34,7 +34,7 @@ Tk.load_tclscript(File.join(demodir, 'repeater.tcl')) # This forces an update of the available packages list. It's required # for package names to find the themes in demos/themes/*.tcl ## Tk.tk_call(TkPackage.unknown_proc, 'Tcl', TkPackage.provide('Tcl')) -## --> This doesn't work. +## --> This doesn't work. ## Because, unknown_proc may be "command + some arguments". Tk.ip_eval("#{TkPackage.unknown_proc} Tcl #{TkPackage.provide('Tcl')}") @@ -45,18 +45,18 @@ TkRoot.new{ # The descriptive names of the builtin themes. $THEMELIST = [ - ['default', 'Default'], - ['classic', 'Classic'], - ['alt', 'Revitalized'], - ['winnative', 'Windows native'], - ['xpnative', 'XP Native'], - ['aqua', 'Aqua'], + ['default', 'Default'], + ['classic', 'Classic'], + ['alt', 'Revitalized'], + ['winnative', 'Windows native'], + ['xpnative', 'XP Native'], + ['aqua', 'Aqua'], ] -$V = TkVariable.new_hash(:THEME => 'default', - :COMPOUND => 'top', - :CONSOLE => false, - :MENURADIO1 => 'One', +$V = TkVariable.new_hash(:THEME => 'default', + :COMPOUND => 'top', + :CONSOLE => false, + :MENURADIO1 => 'One', :MENUCHECK1 => true, :PBMODE => 'determinate', :SELECTED => true, @@ -84,8 +84,8 @@ end def makeThemeControl(parent) c = Tk::Tile::Labelframe.new(parent, :text=>'Theme') $THEMELIST.each{|theme, name| - b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, - :variable=>$V.ref(:THEME), + b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, + :variable=>$V.ref(:THEME), :command=>proc{setTheme(theme)}) b.grid(:sticky=>:ew) unless (TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/}) @@ -93,8 +93,8 @@ def makeThemeControl(parent) end } $RUBY_THEMELIST.each{|theme, name, available| - b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, - :variable=>$V.ref(:THEME), + b = Tk::Tile::Radiobutton.new(c, :text=>name, :value=>theme, + :variable=>$V.ref(:THEME), :command=>proc{setTheme(theme)}) b.grid(:sticky=>:ew) b.ttk_state(:disabled) unless available @@ -105,14 +105,14 @@ end def makeThemeMenu(parent) m = TkMenu.new(parent) $THEMELIST.each{|theme, name| - m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), + m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), :value=>theme, :command=>proc{setTheme(theme)}) unless (TkPackage.names.find{|n| n =~ /(tile|ttk)::theme::#{theme}/}) m.entryconfigure(:end, :state=>:disabled) end } $RUBY_THEMELIST.each{|theme, name, available| - m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), + m.add(:radiobutton, :label=>name, :variable=>$V.ref(:THEME), :value=>theme, :command=>proc{setTheme(theme)}) m.entryconfigure(:end, :state=>:disabled) unless available } @@ -174,7 +174,7 @@ def sbstub(sb, cmd, num, units = 'units') current = sb.get sb.set(current[0] + delta * num, current[1] + delta * num) end -end +end # ... for debugging: TkBindTag::ALL.bind('ButtonPress-3', proc{|w| $W = w}, '%W') @@ -209,21 +209,21 @@ def makeToolbars i = 0 $BUTTONS.each{|icon| i += 1 - Tk::Tile::Button.new(tb, :text=>icon, :image=>$ICON[icon], - :compound=>$V[:COMPOUND], - :style=>:Toolbutton).grid(:row=>0, :column=>i, + Tk::Tile::Button.new(tb, :text=>icon, :image=>$ICON[icon], + :compound=>$V[:COMPOUND], + :style=>:Toolbutton).grid(:row=>0, :column=>i, :sticky=>:news) } $CHECKBOXES.each{|icon| i += 1 - Tk::Tile::Checkbutton.new(tb, :text=>icon, :image=>$ICON[icon], - :variable=>$V.ref(icon), - :compound=>$V[:COMPOUND], - :style=>:Toolbutton).grid(:row=>0, :column=>i, + Tk::Tile::Checkbutton.new(tb, :text=>icon, :image=>$ICON[icon], + :variable=>$V.ref(icon), + :compound=>$V[:COMPOUND], + :style=>:Toolbutton).grid(:row=>0, :column=>i, :sticky=>:news) } - mb = Tk::Tile::Menubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], + mb = Tk::Tile::Menubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], :compound=>$V[:COMPOUND]) mb.configure(:menu=>makeCompoundMenu(mb)) i += 1 @@ -240,21 +240,21 @@ def makeToolbars i = 0 $BUTTONS.each{|icon| i += 1 - TkButton.new(tb, :text=>icon, :image=>$ICON[icon], - :compound=>$V[:COMPOUND], :relief=>:flat, - :overrelief=>:raised).grid(:row=>0, :column=>i, + TkButton.new(tb, :text=>icon, :image=>$ICON[icon], + :compound=>$V[:COMPOUND], :relief=>:flat, + :overrelief=>:raised).grid(:row=>0, :column=>i, :sticky=>:news) } $CHECKBOXES.each{|icon| i += 1 - TkCheckbutton.new(tb, :text=>icon, :image=>$ICON[icon], - :variable=>$V.ref(icon), :compound=>$V[:COMPOUND], - :indicatoron=>false, :selectcolor=>'', :relief=>:flat, - :overrelief=>:raised).grid(:row=>0, :column=>i, + TkCheckbutton.new(tb, :text=>icon, :image=>$ICON[icon], + :variable=>$V.ref(icon), :compound=>$V[:COMPOUND], + :indicatoron=>false, :selectcolor=>'', :relief=>:flat, + :overrelief=>:raised).grid(:row=>0, :column=>i, :sticky=>:news) } - mb = TkMenubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], + mb = TkMenubutton.new(tb, :text=>'toolbar', :image=>$ICON['file'], :compound=>$V[:COMPOUND]) mb.configure(:menu=>makeCompoundMenu(mb)) i += 1 @@ -270,8 +270,8 @@ end def makeCompoundMenu(mb) menu = TkMenu.new(mb) %w(text image none top bottom left right center).each{|str| - menu.add(:radiobutton, :label=>Tk.tk_call('string', 'totitle', str), - :variable=>$V.ref(:COMPOUND), :value=>str, + menu.add(:radiobutton, :label=>Tk.tk_call('string', 'totitle', str), + :variable=>$V.ref(:COMPOUND), :value=>str, :command=>proc{ changeToolbars() }) } menu @@ -289,7 +289,7 @@ makeThemeControl(control).grid(:sticky=>:news, :padx=>6, :ipadx=>6) control.grid_rowconfigure(99, :weight=>1) def changeToolbars - foreachWidget($TOOLBARS, + foreachWidget($TOOLBARS, proc{|w| begin w.compound($V[:COMPOUND]) @@ -350,7 +350,7 @@ nb, client, scales, combo, tree, others = makeNotebook() # def fillMenu(menu) %w(above below left right flush).each{|dir| - menu.add(:command, :label=>Tk.tk_call('string', 'totitle', dir), + menu.add(:command, :label=>Tk.tk_call('string', 'totitle', dir), :command=>proc{ menu.winfo_parent.direction(dir) }) } menu.add(:cascade, :label=>'Submenu', :menu=>(submenu = TkMenu.new(menu))) @@ -366,14 +366,14 @@ l = Tk::Tile::Labelframe.new(client, :text=>'Themed', :padding=>6) r = TkLabelframe.new(client, :text=>'Standard', :padx=>6, :pady=>6) ## Styled frame -cb = Tk::Tile::Checkbutton.new(l, :text=>'Checkbutton', +cb = Tk::Tile::Checkbutton.new(l, :text=>'Checkbutton', :variable=>$V.ref(:SELECTED), :underline=>2) -rb1 = Tk::Tile::Radiobutton.new(l, :text=>'One', :variable=>$V.ref(:CHOICE), +rb1 = Tk::Tile::Radiobutton.new(l, :text=>'One', :variable=>$V.ref(:CHOICE), :value=>1, :underline=>0) -rb2 = Tk::Tile::Radiobutton.new(l, :text=>'Two', :variable=>$V.ref(:CHOICE), +rb2 = Tk::Tile::Radiobutton.new(l, :text=>'Two', :variable=>$V.ref(:CHOICE), :value=>2) -rb3 = Tk::Tile::Radiobutton.new(l, :text=>'Three', - :variable=>$V.ref(:CHOICE), +rb3 = Tk::Tile::Radiobutton.new(l, :text=>'Three', + :variable=>$V.ref(:CHOICE), :value=>3, :underline=>0) btn = Tk::Tile::Button.new(l, :text=>'Button', :underline=>0) @@ -386,9 +386,9 @@ $entryText = TkVariable.new('Entry widget') e = Tk::Tile::Entry.new(l, :textvariable=>$entryText) e.selection_range(6, :end) -ltext_f, ltext = scrolledWidget(l, TkText, true, +ltext_f, ltext = scrolledWidget(l, TkText, true, :width=>12, :height=>5, :wrap=>:none) -# NOTE TO MAINTAINERS: +# NOTE TO MAINTAINERS: # The checkbuttons are -sticky ew / -expand x on purpose: # it demonstrates one of the differences between TCheckbuttons # and standard checkbuttons. @@ -407,11 +407,11 @@ TkGrid.rowconfigure(l, 7, :weight=>1) # text widget (grid is a PITA) ## Orig frame cb = TkCheckbutton.new(r, :text=>'Checkbutton', :variable=>$V.ref(:SELECTED)) -rb1 = TkRadiobutton.new(r, :text=>'One', +rb1 = TkRadiobutton.new(r, :text=>'One', :variable=>$V.ref(:CHOICE), :value=>1) -rb2 = TkRadiobutton.new(r, :text=>'Two', :variable=>$V.ref(:CHOICE), +rb2 = TkRadiobutton.new(r, :text=>'Two', :variable=>$V.ref(:CHOICE), :value=>2, :underline=>1) -rb3 = TkRadiobutton.new(r, :text=>'Three', +rb3 = TkRadiobutton.new(r, :text=>'Three', :variable=>$V.ref(:CHOICE), :value=>3) btn = TkButton.new(r, :text=>'Button') @@ -420,14 +420,14 @@ m = TkMenu.new(mb) mb.menu(m) $V[:rmbIndicatoron] = mb.indicatoron m.add(:checkbutton, :label=>'Indicator?', #' - :variable=>$V.ref(:rmbIndicatoron), + :variable=>$V.ref(:rmbIndicatoron), :command=>proc{mb.indicatoron($V[:rmbIndicatoron])}) m.add(:separator) fillMenu(m) e = TkEntry.new(r, :textvariable=>$entryText) -rtext_f, rtext = scrolledWidget(r, TkText, false, +rtext_f, rtext = scrolledWidget(r, TkText, false, :width=>12, :height=>5, :wrap=>:none) Tk.grid(cb, :sticky=>:ew) @@ -450,9 +450,9 @@ TkGrid.columnconfigure(client, [0, 1], :weight=>1) # Add some text to the text boxes: # msgs = [ -"The cat crept into the crypt, crapped and crept out again", -"Peter Piper picked a peck of pickled peppers", -"How much wood would a woodchuck chuck if a woodchuck could chuck wood", +"The cat crept into the crypt, crapped and crept out again", +"Peter Piper picked a peck of pickled peppers", +"How much wood would a woodchuck chuck if a woodchuck could chuck wood", "He thrusts his fists against the posts and still insists he sees the ghosts", "Who put the bomb in the bom-b-bom-b-bom,", "Is this your sister's sixth zither, sir?", @@ -493,8 +493,8 @@ if version?('0.6') scale.command {|value| progress.value(value)} vscale.command {|value| progress.inverted(vprogress, value) } else - # This would also work, but the Tk scale widgets - # in the right hand pane cause some interference when + # This would also work, but the Tk scale widgets + # in the right hand pane cause some interference when # in autoincrement/indeterminate mode. # progress.variable $V.ref(:SCALE) @@ -609,10 +609,10 @@ scales.grid_rowconfigure(0, :weight=>1) # Command box: # cmd = Tk::Tile::Frame.new($BASE) -b_close = Tk::Tile::Button.new(cmd, :text=>'Close', - :underline=>0, :default=>:normal, +b_close = Tk::Tile::Button.new(cmd, :text=>'Close', + :underline=>0, :default=>:normal, :command=>proc{Tk.root.destroy}) -b_help = Tk::Tile::Button.new(cmd, :text=>'Help', :underline=>0, +b_help = Tk::Tile::Button.new(cmd, :text=>'Help', :underline=>0, :default=>:normal, :command=>proc{showHelp()}) Tk.grid('x', b_close, b_help, :pady=>[6, 4], :padx=>4) TkGrid.columnconfigure(cmd, 0, :weight=>1) @@ -639,20 +639,20 @@ menu = TkMenu.new($BASE) $ROOT.menu(menu) m_file = TkMenu.new(menu, :tearoff=>0) menu.add(:cascade, :label=>'File', :underline=>0, :menu=>m_file) -m_file.add(:command, :label=>'Open', :underline=>0, +m_file.add(:command, :label=>'Open', :underline=>0, :compound=>:left, :image=>$ICON['open']) -m_file.add(:command, :label=>'Save', :underline=>0, +m_file.add(:command, :label=>'Save', :underline=>0, :compound=>:left, :image=>$ICON['save']) m_file.add(:separator) m_f_test = TkMenu.new(menu, :tearoff=>0) m_file.add(:cascade, :label=>'Test submenu', :underline=>0, :menu=>m_f_test) -m_file.add(:checkbutton, :label=>'Text check', :underline=>5, +m_file.add(:checkbutton, :label=>'Text check', :underline=>5, :variable=>$V.ref(:MENUCHECK1)) m_file.insert(:end, :separator) if Tk.windowingsystem != 'x11' TkConsole.create - m_file.insert(:end, :checkbutton, :label=>'Console', :underline=>5, + m_file.insert(:end, :checkbutton, :label=>'Console', :underline=>5, :variable=>$V.ref(:CONSOLE), :command=>proc{toggle_console()}) def toggle_console if TkComm.bool($V[:CONSOLE]) @@ -663,7 +663,7 @@ if Tk.windowingsystem != 'x11' end end -m_file.add(:command, :label=>'Exit', :underline=>1, +m_file.add(:command, :label=>'Exit', :underline=>1, :command=>proc{Tk.event_generate(b_close, '')}) %w(One Two Three Four).each{|lbl| @@ -672,7 +672,7 @@ m_file.add(:command, :label=>'Exit', :underline=>1, # Add Theme menu. # -menu.add(:cascade, :label=>'Theme', :underline=>3, +menu.add(:cascade, :label=>'Theme', :underline=>3, :menu=>makeThemeMenu(menu)) setTheme($V[:THEME]) @@ -710,7 +710,7 @@ if version?('0.5') tree.grid_rowconfigure(0, :weight=>1) tree.grid_propagate(0) - # Add initial tree node: + # Add initial tree node: # Later nodes will be added in <> binding. treeview.insert('', 0, :id=>'.', :text=>'Main Window', :open=>false, :values=>[TkWinfo.classname('.')]) @@ -758,20 +758,20 @@ showDescription.bind('Enter', proc{|w| msg.text($Desc[w.path])}, '%W') showDescription.bind('Leave', proc{|w| msg.text('')}, '%W') [ - [ :trackStates, "Widget states...", - "Display/modify widget state bits" ], + [ :trackStates, "Widget states...", + "Display/modify widget state bits" ], - [ :scrollbarResizeDemo, "Scrollbar resize behavior...", - "Shows how Tile and standard scrollbars differ when they're sized too large" ], + [ :scrollbarResizeDemo, "Scrollbar resize behavior...", + "Shows how Tile and standard scrollbars differ when they're sized too large" ], - [ :trackFocus, "Track keyboard focus..." , + [ :trackFocus, "Track keyboard focus..." , "Display the name of the widget that currently has focus" ], [ :repeatDemo, "Repeating buttons...", "Demonstrates custom classes (see demos/repeater.tcl)" ] ].each{|demo_cmd, label, description| - b = Tk::Tile::Button.new(others, :text=>label, + b = Tk::Tile::Button.new(others, :text=>label, :command=>proc{ self.__send__(demo_cmd) }) $Desc[b.path] = description b.bindtags <<= showDescription @@ -825,16 +825,16 @@ def trackFocus $focus = TkToplevel.new(:title=>'Keyboard focus') i = 0 [ - ["Focus widget:", :Widget], - ["Class:", :WidgetClass], - ["Next:", :WidgetNext], - ["Grab:", :Grab], + ["Focus widget:", :Widget], + ["Class:", :WidgetClass], + ["Next:", :WidgetNext], + ["Grab:", :Grab], ["Status:", :GrabStatus] ].each{|label, var_index| - Tk.grid(Tk::Tile::Label.new($focus, :text=>label, :anchor=>:e), - Tk::Tile::Label.new($focus, - :textvariable=>$FocusInf.ref(var_index), - :width=>40, :anchor=>:w, :relief=>:groove), + Tk.grid(Tk::Tile::Label.new($focus, :text=>label, :anchor=>:e), + Tk::Tile::Label.new($focus, + :textvariable=>$FocusInf.ref(var_index), + :width=>40, :anchor=>:w, :relief=>:groove), :sticky=>:ew) i += 1 } @@ -857,7 +857,7 @@ def focusMonitor $FocusInf[:Grab] = grab_wins = Tk.current_grabs unless grab_wins.empty? $FocusInf[:GrabStatus] = grab_wins[0].grab_status - else + else $FocusInf[:GrabStatus] = '' end @@ -869,13 +869,13 @@ end # $Widget = TkVariable.new -TkBindTag::ALL.bind('Control-Shift-ButtonPress-1', +TkBindTag::ALL.bind('Control-Shift-ButtonPress-1', proc{|w| $Widget.value = w updateStates() Tk.callback_break }, '%W') -$states_list = %w(active disabled focus pressed selected +$states_list = %w(active disabled focus pressed selected background indeterminate invalid default) $states_btns = {} $states = nil @@ -893,17 +893,17 @@ def trackStates l_inf = Tk::Tile::Label.new($states, :text=>"Press Control-Shift-Button-1 on any widget") - l_lw = Tk::Tile::Label.new($states, :text=>'Widget:', + l_lw = Tk::Tile::Label.new($states, :text=>'Widget:', :anchor=>:e, :relief=>:groove) - l_w = Tk::Tile::Label.new($states, :textvariable=>$Widget, + l_w = Tk::Tile::Label.new($states, :textvariable=>$Widget, :anchor=>:w, :relief=>:groove) Tk.grid(l_inf, '-', :sticky=>:ew, :padx=>6, :pady=>6) Tk.grid(l_lw, l_w, :sticky=>:ew) $states_list.each{|st| - cb = Tk::Tile::Checkbutton.new($states, :text=>st, - :variable=>$State.ref(st), + cb = Tk::Tile::Checkbutton.new($states, :text=>st, + :variable=>$State.ref(st), :command=>proc{ changeState(st) }) $states_btns[st] = cb Tk.grid('x', cb, :sticky=>:nsew) @@ -914,7 +914,7 @@ def trackStates f_cmd = Tk::Tile::Frame.new($states) Tk.grid('x', f_cmd, :sticky=>:nse) - b_close = Tk::Tile::Button.new(f_cmd, :text=>'Close', + b_close = Tk::Tile::Button.new(f_cmd, :text=>'Close', :command=>proc{ $states.destroy }) Tk.grid('x', b_close, :padx=>4, :pady=>[6,4]) f_cmd.grid_columnconfigure(0, :weight=>1) diff --git a/ext/tk/sample/tkextlib/tile/themes/kroc.rb b/ext/tk/sample/tkextlib/tile/themes/kroc.rb index 27006d847f..72a7c6901d 100644 --- a/ext/tk/sample/tkextlib/tile/themes/kroc.rb +++ b/ext/tk/sample/tkextlib/tile/themes/kroc.rb @@ -1,5 +1,5 @@ # -# kroc.rb +# kroc.rb # # based on: # >> kroc.tcl - Copyright (C) 2004 David Zolli @@ -15,30 +15,30 @@ else end def kroc_rb_settings - # Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F', + # Tk::Tile::Style.default(TkRoot, :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or - # Tk::Tile::Style.default(Tk.root, :background=>'#FCB64F', + # Tk::Tile::Style.default(Tk.root, :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or - # Tk::Tile::Style.default('.', :background=>'#FCB64F', + # Tk::Tile::Style.default('.', :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or - # Tk::Tile::Style.default(nil, :background=>'#FCB64F', + # Tk::Tile::Style.default(nil, :background=>'#FCB64F', # :troughcolor=>'#F8C278', :borderwidth=>1) # or - Tk::Tile::Style.default(:background=>'#FCB64F', :troughcolor=>'#F8C278', + Tk::Tile::Style.default(:background=>'#FCB64F', :troughcolor=>'#F8C278', :borderwidth=>1) - # Tk::Tile::Style.default(TkRoot, :font=>Tk::Tile::Font::Default, + # Tk::Tile::Style.default(TkRoot, :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or - # Tk::Tile::Style.default(Tk.root, :font=>Tk::Tile::Font::Default, + # Tk::Tile::Style.default(Tk.root, :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or - # Tk::Tile::Style.default('.', :font=>Tk::Tile::Font::Default, + # Tk::Tile::Style.default('.', :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or - # Tk::Tile::Style.default(nil, :font=>Tk::Tile::Font::Default, + # Tk::Tile::Style.default(nil, :font=>Tk::Tile::Font::Default, # :borderwidth=>1) # or Tk::Tile::Style.default(:font=>Tk::Tile::Font::Default, :borderwidth=>1) @@ -57,37 +57,37 @@ def kroc_rb_settings # Tk::Tile::Style.default('TButton', :padding=>[10,4]) Tk::Tile::Style.default(Tk::Tile::TButton, :padding=>[10,4]) - # Tk::Tile::Style.default('TNotebook.Tab', - Tk::Tile::Style.default($TNotebook_Tab, + # Tk::Tile::Style.default('TNotebook.Tab', + Tk::Tile::Style.default($TNotebook_Tab, :padding=>[10, 3], :font=>Tk::Tile::Font::Default) - # Tk::Tile::Style.map('TNotebook.Tab', - Tk::Tile::Style.map($TNotebook_Tab, - :background=>[:selected, '#FCB64F', '', '#FFE6BA'], - :foreground=>['', 'black'], + # Tk::Tile::Style.map('TNotebook.Tab', + Tk::Tile::Style.map($TNotebook_Tab, + :background=>[:selected, '#FCB64F', '', '#FFE6BA'], + :foreground=>['', 'black'], :padding=>[:selected, [10, 6, 10, 3]]) - # Tk::Tile::Style.map('TScrollbar', - Tk::Tile::Style.map(Tk::Tile::TScrollbar, - :background=>[:pressed, '#694418'], - :arrowcolor=>[:pressed, '#FEF7CB'], + # Tk::Tile::Style.map('TScrollbar', + Tk::Tile::Style.map(Tk::Tile::TScrollbar, + :background=>[:pressed, '#694418'], + :arrowcolor=>[:pressed, '#FEF7CB'], :relief=>[:pressed, :sunken]) - # Tk::Tile::Style.layout('Vertical.TScrollbar', - Tk::Tile::Style.layout(Tk::Tile.style('Vertical', Tk::Tile::TScrollbar), + # Tk::Tile::Style.layout('Vertical.TScrollbar', + Tk::Tile::Style.layout(Tk::Tile.style('Vertical', Tk::Tile::TScrollbar), ['Scrollbar.trough', {:children=>[ - 'Scrollbar.uparrow', {:side=>:top}, - 'Scrollbar.downarrow', {:side=>:bottom}, - 'Scrollbar.uparrow', {:side=>:bottom}, + 'Scrollbar.uparrow', {:side=>:top}, + 'Scrollbar.downarrow', {:side=>:bottom}, + 'Scrollbar.uparrow', {:side=>:bottom}, 'Scrollbar.thumb', {:side=>:top, :expand=>true} ]} ]) - # Tk::Tile::Style.layout('Horizontal.TScrollbar', - Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', Tk::Tile::TScrollbar), + # Tk::Tile::Style.layout('Horizontal.TScrollbar', + Tk::Tile::Style.layout(Tk::Tile.style('Horizontal', Tk::Tile::TScrollbar), ['Scrollbar.trough', {:children=>[ - 'Scrollbar.leftarrow', {:side=>:left}, - 'Scrollbar.rightarrow', {:side=>:right}, - 'Scrollbar.leftarrow', {:side=>:right}, + 'Scrollbar.leftarrow', {:side=>:left}, + 'Scrollbar.rightarrow', {:side=>:right}, + 'Scrollbar.leftarrow', {:side=>:right}, 'Scrollbar.thumb', {:side=>:left, :expand=>true} ]} ]) @@ -96,15 +96,15 @@ def kroc_rb_settings # Elements: # if Tk::Tile::TILE_SPEC_VERSION_ID >= 8 - Tk::Tile::Style.element_create('Button.button', - :image, + Tk::Tile::Style.element_create('Button.button', + :image, [ $images['button-n'], - :pressed, $images['button-p'], - :active, $images['button-h'], + :pressed, $images['button-p'], + :active, $images['button-h'], ], :border=>3, :sticky=>:ew) - Tk::Tile::Style.element_create('Checkbutton.indicator', - :image, + Tk::Tile::Style.element_create('Checkbutton.indicator', + :image, [ $images['check-nu'], [:pressed, :selected],$images['check-nc'], :pressed, $images['check-nu'], @@ -113,8 +113,8 @@ def kroc_rb_settings :selected, $images['check-nc'], ], :sticky=>:w) - Tk::Tile::Style.element_create('Radiobutton.indicator', - :image, + Tk::Tile::Style.element_create('Radiobutton.indicator', + :image, [ $images['radio-nu'], [:pressed,:selected],$images['radio-nc'], :pressed, $images['radio-nu'], @@ -124,14 +124,14 @@ def kroc_rb_settings ], :sticky=>:w) elsif TkPackage.vcompare(Tk::Tile.package_version, '0.5') >= 0 - Tk::Tile::Style.element_create('Button.button', + Tk::Tile::Style.element_create('Button.button', :image, $images['button-n'], :map=>[ - :pressed, $images['button-p'], - :active, $images['button-h'], + :pressed, $images['button-p'], + :active, $images['button-h'], ], :border=>3, :sticky=>:ew) - Tk::Tile::Style.element_create('Checkbutton.indicator', + Tk::Tile::Style.element_create('Checkbutton.indicator', :image, $images['check-nu'], :map=>[ [:pressed, :selected],$images['check-nc'], @@ -141,7 +141,7 @@ def kroc_rb_settings :selected, $images['check-nc'], ], :sticky=>:w) - Tk::Tile::Style.element_create('Radiobutton.indicator', + Tk::Tile::Style.element_create('Radiobutton.indicator', :image, $images['radio-nu'], :map=>[ [:pressed, :selected],$images['radio-nc'], @@ -152,14 +152,14 @@ def kroc_rb_settings ], :sticky=>:w) else # tile 0.4 or earlier - Tk::Tile::Style.element_create('Button.button', :pixmap, + Tk::Tile::Style.element_create('Button.button', :pixmap, :images=>[ - :pressed, $images['button-p'], - :active, $images['button-h'], + :pressed, $images['button-p'], + :active, $images['button-h'], '', $images['button-n'] ], :border=>3, :tiling=>:tile) - Tk::Tile::Style.element_create('Checkbutton.indicator', :pixmap, + Tk::Tile::Style.element_create('Checkbutton.indicator', :pixmap, :images=>[ [:pressed, :selected],$images['check-nc'], :pressed, $images['check-nu'], @@ -169,7 +169,7 @@ def kroc_rb_settings '', $images['check-nu'], ], :tiling=>:fixed) - Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap, + Tk::Tile::Style.element_create('Radiobutton.indicator', :pixmap, :images=>[ [:pressed, :selected],$images['radio-nc'], :pressed, $images['radio-nu'], @@ -184,7 +184,7 @@ def kroc_rb_settings # # Settings: # - # Tk::Tile::Style.layout(Tk::Tile::TButton, + # Tk::Tile::Style.layout(Tk::Tile::TButton, Tk::Tile::Style.layout('TButton', [ 'Button.button', {:children=>[ 'Button.focus', {:children=>[ @@ -195,12 +195,12 @@ def kroc_rb_settings ]} ]) - # Tk::Tile::Style.layout(Tk::Tile::TCheckbutton, + # Tk::Tile::Style.layout(Tk::Tile::TCheckbutton, Tk::Tile::Style.layout('TCheckbutton', [ 'Checkbutton.background', # this is not needed in tile 0.5 or later 'Checkbutton.border', {:children=>[ 'Checkbutton.padding', {:children=>[ - 'Checkbutton.indicator', {:side=>:left}, + 'Checkbutton.indicator', {:side=>:left}, 'Checkbutton.focus', {:side=>:left, :children=>[ 'Checkbutton.label' ]} @@ -208,12 +208,12 @@ def kroc_rb_settings ]} ]) - # Tk::Tile::Style.layout(Tk::Tile::TRadiobutton, + # Tk::Tile::Style.layout(Tk::Tile::TRadiobutton, Tk::Tile::Style.layout('TRadiobutton', [ 'Radiobutton.background', # this is not needed in tile 0.5 or later 'Radiobutton.border', {:children=>[ 'Radiobutton.padding', {:children=>[ - 'Radiobutton.indicator', {:side=>:left}, + 'Radiobutton.indicator', {:side=>:left}, 'Radiobutton.focus', {:expand=>true, :sticky=>:w, :children=>[ 'Radiobutton.label', {:side=>:right, :expand=>true} ]} @@ -222,5 +222,5 @@ def kroc_rb_settings ]) end -Tk::Tile::Style.theme_create('kroc-rb', :parent=>'alt', +Tk::Tile::Style.theme_create('kroc-rb', :parent=>'alt', :settings=>proc{ kroc_rb_settings() }) diff --git a/ext/tk/sample/tkextlib/tkHTML/hv.rb b/ext/tk/sample/tkextlib/tkHTML/hv.rb index a4d78ea5b1..920eb15f5a 100644 --- a/ext/tk/sample/tkextlib/tkHTML/hv.rb +++ b/ext/tk/sample/tkextlib/tkHTML/hv.rb @@ -5,7 +5,7 @@ # # This application is used for testing the HTML widget. It can # also server as an example of how to use the HTML widget. -# +# require 'tk' require 'tkextlib/tkHTML' @@ -51,11 +51,11 @@ show_img = TkVariable.new(1) # html[:fontcommand] = pick_font pick_font = proc{|size, attrs| puts "FontCmd: #{size} #{attrs}" - [ ((attrs =~ /fixed/)? 'courier': 'charter'), - (12 * (1.2**(size.to_f - 4.0))).to_i, - ((attrs =~ /italic/)? 'italic': 'roman'), - ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ') -} + [ ((attrs =~ /fixed/)? 'courier': 'charter'), + (12 * (1.2**(size.to_f - 4.0))).to_i, + ((attrs =~ /italic/)? 'italic': 'roman'), + ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ') +} # # This routine is called for each form element @@ -126,7 +126,7 @@ script_cmd = proc{|*args| # This routine is called for every markup # -applet_cmd = proc{|w, arglist| +applet_cmd = proc{|w, arglist| # puts "AppletCmd: w=#{w} arglist=#{arglist}" TkLabel.new(w, :text=>"The Applet #{w}", :bd=>2, :relief=>raised) } @@ -134,12 +134,12 @@ applet_cmd = proc{|w, arglist| # # Construct the main HTML viewer # -html = Tk::HTML_Widget.new(:padx=>5, :pady=>9, - :formcommand=>form_cmd, - :imagecommand=>image_cmd, - :scriptcommand=>script_cmd, - :appletcommand=>applet_cmd, - :underlinehyperlinks=>0, +html = Tk::HTML_Widget.new(:padx=>5, :pady=>9, + :formcommand=>form_cmd, + :imagecommand=>image_cmd, + :scriptcommand=>script_cmd, + :appletcommand=>applet_cmd, + :underlinehyperlinks=>0, :bg=>'white', :tablerelief=>:raised) vscr = html.yscrollbar(TkScrollbar.new) hscr = html.xscrollbar(TkScrollbar.new) @@ -166,7 +166,7 @@ read_file = proc{|name| rescue ret = nil fp = nil - Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'", + Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'", :type=>:ok) ensure fp.close if fp @@ -221,7 +221,7 @@ html.clipping_window.bind('1', href_binding, '%x %y') html.clipping_window.bind('B1-Motion', proc{|w, x, y| w.selection_set(priv['mark'], "@#{x},#{y}") TkClipboard.clear - # avoid tkhtml0.0 errors + # avoid tkhtml0.0 errors # anyone can fix this for tkhtml0.0 begin TkClipboard.append(TkSelection.get) @@ -235,7 +235,7 @@ html.clipping_window.bind('B1-Motion', proc{|w, x, y| last_dir = Dir.pwd sel_load = proc{ filetypes = [ - ['Html Files', ['.html', '.htm']], + ['Html Files', ['.html', '.htm']], ['All Files', '*'] ] @@ -268,15 +268,15 @@ Tk::HTML_Widget::ClippingWindow.bind('Motion', proc{|w, x, y| # Setup menu # menu_spec = [ - [['File', 0], - ['Open', sel_load, 0], - ['Refresh', refresh, 0], + [['File', 0], + ['Open', sel_load, 0], + ['Refresh', refresh, 0], '---', - ['Exit', proc{exit}, 1]], + ['Exit', proc{exit}, 1]], - [['View', 0], - ['Underline Hyperlinks', ul_hyper], - ['Show Table Structure', show_tbl], + [['View', 0], + ['Underline Hyperlinks', ul_hyper], + ['Show Table Structure', show_tbl], ['Show Images', show_img]] ] @@ -285,7 +285,7 @@ mbar = Tk.root.add_menubar(menu_spec) # # Setup trace # -ul_hyper.trace('w', proc{ +ul_hyper.trace('w', proc{ html[:underlinehyperlinks] = ul_hyper.value refresh.call }) diff --git a/ext/tk/sample/tkextlib/tkHTML/ss.rb b/ext/tk/sample/tkextlib/tkHTML/ss.rb index 1c13d7ac34..45d4d87d69 100644 --- a/ext/tk/sample/tkextlib/tkHTML/ss.rb +++ b/ext/tk/sample/tkextlib/tkHTML/ss.rb @@ -2,7 +2,7 @@ # # This script implements the "ss" application. "ss" implements # a presentation slide-show based on HTML slides. -# +# require 'tk' require 'tkextlib/tkHTML' @@ -45,18 +45,18 @@ EOD @key_block = false - Tk::HTML_Widget::ClippingWindow.bind('1', - proc{|w, ksym| key_press(w, ksym)}, + Tk::HTML_Widget::ClippingWindow.bind('1', + proc{|w, ksym| key_press(w, ksym)}, '%W Down') - Tk::HTML_Widget::ClippingWindow.bind('3', - proc{|w, ksym| key_press(w, ksym)}, + Tk::HTML_Widget::ClippingWindow.bind('3', + proc{|w, ksym| key_press(w, ksym)}, '%W Up') - Tk::HTML_Widget::ClippingWindow.bind('2', - proc{|w, ksym| key_press(w, ksym)}, + Tk::HTML_Widget::ClippingWindow.bind('2', + proc{|w, ksym| key_press(w, ksym)}, '%W Down') - Tk::HTML_Widget::ClippingWindow.bind('KeyPress', - proc{|w, ksym| key_press(w, ksym)}, + Tk::HTML_Widget::ClippingWindow.bind('KeyPress', + proc{|w, ksym| key_press(w, ksym)}, '%W %K') ############################################ @@ -64,37 +64,37 @@ EOD # Build the half-size view of the page # menu_spec = [ - [['File', 0], - ['Open', proc{sel_load()}, 0], - ['Full Screen', proc{fullscreen()}, 0], - ['Refresh', proc{refresh()}, 0], + [['File', 0], + ['Open', proc{sel_load()}, 0], + ['Full Screen', proc{fullscreen()}, 0], + ['Refresh', proc{refresh()}, 0], '---', ['Exit', proc{exit}, 1]] ] mbar = @root.add_menubar(menu_spec) - @html = Tk::HTML_Widget.new(:width=>512, :height=>384, - :padx=>5, :pady=>9, + @html = Tk::HTML_Widget.new(:width=>512, :height=>384, + :padx=>5, :pady=>9, :formcommand=>proc{|*args| form_cmd(*args)}, :imagecommand=>proc{|*args| image_cmd(1, *args) - }, + }, :scriptcommand=>proc{|*args| script_cmd(*args) - }, + }, :appletcommand=>proc{|*args| applet_cmd(*args) - }, - :hyperlinkcommand=>proc{|*args| + }, + :hyperlinkcommand=>proc{|*args| hyper_cmd(*args) - }, + }, :fontcommand=>proc{|*args| pick_font(*args) - }, + }, :appletcommand=>proc{|*args| run_applet('small', *args) - }, + }, :bg=>'white', :tablerelief=>:raised) @html.token_handler('meta', proc{|*args| meta(@html, *args)}) @@ -127,9 +127,9 @@ EOD # html[:fontcommand] = pick_font def pick_font(size, attrs) # puts "FontCmd: #{size} #{attrs}" - [ ((attrs =~ /fixed/)? 'courier': 'charter'), - (12 * (1.2**(size.to_f - 4.0))).to_i, - ((attrs =~ /italic/)? 'italic': 'roman'), + [ ((attrs =~ /fixed/)? 'courier': 'charter'), + (12 * (1.2**(size.to_f - 4.0))).to_i, + ((attrs =~ /italic/)? 'italic': 'roman'), ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ') end @@ -139,9 +139,9 @@ EOD baseFontSize = 24 # puts "FontCmd: #{size} #{attrs}" - [ ((attrs =~ /fixed/)? 'courier': 'charter'), - (baseFontSize * (1.2**(size.to_f - 4.0))).to_i, - ((attrs =~ /italic/)? 'italic': 'roman'), + [ ((attrs =~ /fixed/)? 'courier': 'charter'), + (baseFontSize * (1.2**(size.to_f - 4.0))).to_i, + ((attrs =~ /italic/)? 'italic': 'roman'), ((attrs =~ /bold/)? 'bold': 'normal') ].join(' ') end @@ -244,7 +244,7 @@ EOD # def sel_load filetypes = [ - ['Html Files', ['.html', '.htm']], + ['Html Files', ['.html', '.htm']], ['All Files', '*'] ] @@ -280,7 +280,7 @@ EOD rescue ret = nil fp = nil - Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'", + Tk.messageBox(:icon=>'error', :message=>"fail to open '#{name}'", :type=>:ok) ensure fp.close if fp @@ -371,32 +371,32 @@ EOD width = @root.winfo_screenwidth height = @root.winfo_screenheight - @fswin = TkToplevel.new(:overrideredirect=>true, + @fswin = TkToplevel.new(:overrideredirect=>true, :geometry=>"#{width}x#{height}+0+0") - @html_fs = Tk::HTML_Widget.new(@fswin, :padx=>5, :pady=>9, + @html_fs = Tk::HTML_Widget.new(@fswin, :padx=>5, :pady=>9, :formcommand=>proc{|*args| form_cmd(*args) }, - :imagecommand=>proc{|*args| + :imagecommand=>proc{|*args| image_cmd(0, *args) - }, + }, :scriptcommand=>proc{|*args| script_cmd(*args) - }, + }, :appletcommand=>proc{|*args| applet_cmd(*args) - }, - :hyperlinkcommand=>proc{|*args| + }, + :hyperlinkcommand=>proc{|*args| hyper_cmd(*args) - }, + }, :appletcommand=>proc{|*args| run_applet('big', *args) - }, + }, :fontcommand=>proc{|*args| pick_font_fs(*args) - }, - :bg=>'white', :tablerelief=>:raised, + }, + :bg=>'white', :tablerelief=>:raised, :cursor=>:tcross) { pack(:fill=>:both, :expand=>true) token_handler('meta', proc{|*args| meta(self, *args)}) diff --git a/ext/tk/sample/tkextlib/tkimg/demo.rb b/ext/tk/sample/tkextlib/tkimg/demo.rb index a0c4d1b64f..d453e8ee9d 100644 --- a/ext/tk/sample/tkextlib/tkimg/demo.rb +++ b/ext/tk/sample/tkextlib/tkimg/demo.rb @@ -2,7 +2,7 @@ # # Tk::Img demo # -# -- This script is based on demo.tcl of Tcl/Tk's 'Img' extention. +# -- This script is based on demo.tcl of Tcl/Tk's 'Img' extention. # Image data in this script is those of demo.tcl. # Please read 'license_terms_of_Img_extension' file. # @@ -85,7 +85,7 @@ class TkImg_demo Tk.update_idletasks Tk.after(20, proc{update_animated_gif(w, :image, 0)}) rescue => e - w.configure(:text=>"error displaying animated gif:\n#{e.message}", + w.configure(:text=>"error displaying animated gif:\n#{e.message}", :image=>'', :relief=>:ridge) end w.pack @@ -98,15 +98,15 @@ class TkImg_demo TkLabel.new(@typeFrame[fmt], :text=>"#{fmt} : ").pack(:side=>:left) end begin - f = TkFrame.new(@typeFrame[fmt], + f = TkFrame.new(@typeFrame[fmt], :borderwidth=>2, :relief=>:ridge).pack(:side=>:left) im = TkPhotoImage.new(:data=>data) im['data'] = '' TkLabel.new(f, :image=>im).pack - TkLabel.new(f, :text=>type, :borderwidth=>0, :pady=>0, :padx=>2, + TkLabel.new(f, :text=>type, :borderwidth=>0, :pady=>0, :padx=>2, :font=>'Helvetica 8').pack rescue => e - TkMessage.new(f, :text=>"error displaying #{type} image: #{e.message}", + TkMessage.new(f, :text=>"error displaying #{type} image: #{e.message}", :aspect=>250).pack end Tk.update diff --git a/ext/tk/sample/tkextlib/tktable/basic.rb b/ext/tk/sample/tkextlib/tktable/basic.rb index 0d2d48893a..dddbb776dc 100644 --- a/ext/tk/sample/tkextlib/tktable/basic.rb +++ b/ext/tk/sample/tkextlib/tktable/basic.rb @@ -3,7 +3,7 @@ ## basic.rb ## ## This demo shows the basic use of the table widget -## +## ## ( based on 'basic.tcl' included source archive of tktable extension ) ## require 'tk' @@ -22,19 +22,19 @@ cols = 8 lbl = TkLabel.new(:text=>"TkTable v1 Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>2, - :roworigin=>-1, :colorigin=>-2, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>2, + :roworigin=>-1, :colorigin=>-2, :rowstretchmode=>:last, :colstretchmode=>:last, :rowtagcommand=>proc{|row| row = Integer(row) (row>0 && row%2 == 1)? 'OddRow': '' - }, + }, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, + }, :selectmode=>:extended, :sparsearray=>false) sx = table.xscrollbar(TkScrollbar.new) diff --git a/ext/tk/sample/tkextlib/tktable/buttons.rb b/ext/tk/sample/tkextlib/tktable/buttons.rb index b21e8673c2..e35c137a28 100644 --- a/ext/tk/sample/tkextlib/tktable/buttons.rb +++ b/ext/tk/sample/tkextlib/tktable/buttons.rb @@ -14,11 +14,11 @@ tab = TkVariable.new_hash rows = 20 cols = 20 -table = Tk::TkTable.new(:rows=>rows + 1, :cols=>cols + 1, - :variable=>tab, :titlerows=>1, :titlecols=>1, - :roworigin=>-1, :colorigin=>-1, - :colwidth=>4, :width=>8, :height=>8, - :cursor=>'top_left_arrow', :borderwidth=>2, +table = Tk::TkTable.new(:rows=>rows + 1, :cols=>cols + 1, + :variable=>tab, :titlerows=>1, :titlecols=>1, + :roworigin=>-1, :colorigin=>-1, + :colwidth=>4, :width=>8, :height=>8, + :cursor=>'top_left_arrow', :borderwidth=>2, :flashmode=>false, :state=>:disabled) sx = table.xscrollbar(TkScrollbar.new) @@ -67,7 +67,7 @@ table.bind('1', proc{|w, x, y| 0.step(cols){|j| if i == 0 tab[-1,j] = j - end + end tab[i,j] = "OFF" table.tag_cell('OFF', "#{i},#{j}") } diff --git a/ext/tk/sample/tkextlib/tktable/command.rb b/ext/tk/sample/tkextlib/tktable/command.rb index bf36159ccc..e697ccf3bf 100644 --- a/ext/tk/sample/tkextlib/tktable/command.rb +++ b/ext/tk/sample/tkextlib/tktable/command.rb @@ -27,7 +27,7 @@ current = TkLabel.new(:textvariable=>cur_var, :width=>5) ent_var = TkVariable.new entry = TkEntry.new(:textvariable=>ent_var) -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :command=>[proc{|mode, cell, val| if (mode == :w) data[cell] = val @@ -38,10 +38,10 @@ table = Tk::TkTable.new(:rows=>rows, :cols=>cols, '' # not exist end end - }, '%i %C %s'], - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>1, - :roworigin=>-1, :colorigin=>-1, + }, '%i %C %s'], + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>1, + :roworigin=>-1, :colorigin=>-1, :rowstretchmode=>:last, :colstretchmode=>:last, :rowtagcommand=>proc{|row| row = Integer(row) @@ -50,20 +50,20 @@ table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, - :selectmode=>:extended, :flashmode=>true, + }, + :selectmode=>:extended, :flashmode=>true, :rowstretch=>:unset, :colstretch=>:unset, :browsecommand=>[proc{|w, s| cur_var.value = s ent_var.value = w.get(s) - }, '%W %S'], - :validate=>true, - :validatecommand=>proc{|e| + }, '%W %S'], + :validate=>true, + :validatecommand=>proc{|e| ent_var.value = e.new_value; true }) =begin :validatecommand=>[ - proc{|s| + proc{|s| ent_var.value = s; true }, '%S']) =end diff --git a/ext/tk/sample/tkextlib/tktable/debug.rb b/ext/tk/sample/tkextlib/tktable/debug.rb index d5cd5e49ba..016d5b353e 100644 --- a/ext/tk/sample/tkextlib/tktable/debug.rb +++ b/ext/tk/sample/tkextlib/tktable/debug.rb @@ -23,15 +23,15 @@ cols = 20 lbl = TkLabel.new(:text=>"TkTable v2 Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>2, - :roworigin=>-5, :colorigin=>-2, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>2, + :roworigin=>-5, :colorigin=>-2, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, - :selectmode=>:extended, :flashmode=>true, + }, + :selectmode=>:extended, :flashmode=>true, :rowstretch=>:unset, :colstretch=>:unset, :selecttitles=>false, :drawmode=>:single) @@ -67,8 +67,8 @@ table.tag_cell('logo', [1,2], [2,3], [4,1]) table.tag_cell('dis', [2,1], [1,-1], [3,0]) table.set_width([-2,8], [-1,9], [0, 12], [4, 14]) -table.set([1,1], "multi-line\ntext\nmight be\ninteresting", - [3,2], "more\nmulti-line\nplaying\n", +table.set([1,1], "multi-line\ntext\nmight be\ninteresting", + [3,2], "more\nmulti-line\nplaying\n", [2,2], "null\0byte") # This is in the row span diff --git a/ext/tk/sample/tkextlib/tktable/dynarows.rb b/ext/tk/sample/tkextlib/tktable/dynarows.rb index d083e26559..cc72a021cf 100644 --- a/ext/tk/sample/tkextlib/tktable/dynarows.rb +++ b/ext/tk/sample/tkextlib/tktable/dynarows.rb @@ -5,7 +5,7 @@ ## This demos shows the use of the validation mechanism of the table ## and uses the table's cache (no -command or -variable) with a cute ## dynamic row routine. -## +## ## ( based on 'dynarows.tcl' included source archive of tktable extension ) ## require 'tk' @@ -24,7 +24,7 @@ def table_validate(w, idx) begin time = Tk.tk_call('clock', 'scan', val) date = [] - Tk.tk_call('clock', 'format', time, + Tk.tk_call('clock', 'format', time, :format=>'%m %d %Y').split(' ').each{|item| date << item.sub(/^\s*0*/,'') } @@ -54,12 +54,12 @@ end lbl = TkLabel.new(:text=>"Dynamic Date Validated Rows") -table = Tk::TkTable.new(:rows=>2, :cols=>3, :cache=>1, :selecttype=>:row, - :titlerows=>1, :titlecols=>1, :height=>5, - :colstretch=>:unset, :rowstretch=>:unset, - :autoclear=>true, +table = Tk::TkTable.new(:rows=>2, :cols=>3, :cache=>1, :selecttype=>:row, + :titlerows=>1, :titlecols=>1, :height=>5, + :colstretch=>:unset, :rowstretch=>:unset, + :autoclear=>true, :browsecommand=>[ - proc{|w,s| table_validate(w, s)}, + proc{|w,s| table_validate(w, s)}, '%W %s' ]) table.set([0,1], 'Begin', [0,2], 'End', [1,0], '*') diff --git a/ext/tk/sample/tkextlib/tktable/maxsize.rb b/ext/tk/sample/tkextlib/tktable/maxsize.rb index aff68ff377..74e136c49c 100644 --- a/ext/tk/sample/tkextlib/tktable/maxsize.rb +++ b/ext/tk/sample/tkextlib/tktable/maxsize.rb @@ -4,7 +4,7 @@ ## ## This demo uses a really big table. The big startup time is in ## filling the table's Tcl array var. -## +## ## ( based on 'maxsize.tcl' included source archive of tktable extension ) ## require 'tk' @@ -23,15 +23,15 @@ cols = 10 lbl = TkLabel.new(:text=>"TkTable v2 Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>8, - :titlerows=>1, :titlecols=>1, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, + :width=>6, :height=>8, + :titlerows=>1, :titlecols=>1, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, - :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, + }, + :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, :selecttitles=>false, :drawmode=>:slow) sx = table.xscrollbar(TkScrollbar.new) diff --git a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb index 9da896f5a7..2953b2e597 100644 --- a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb +++ b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb @@ -4,7 +4,7 @@ ## ## This demos shows how you can simulate a 3D table ## and has other basic features to begin a basic spreadsheet -## +## ## ( based on 'spreadsheet.tcl' included source archive of tktable extension ) ## require 'tk' @@ -67,15 +67,15 @@ optmenu = TkOptionMenubutton.new(page, *(%w(AA BB CC DD))) fill_table(table_list, page.value) fill_table(table_list, 'BB', Integer(rows/2), Integer(cols/2)) -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :width=>5, :height=>5, - :variable=>table_list[page.value], - :titlerows=>1, :titlecols=>1, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :width=>5, :height=>5, + :variable=>table_list[page.value], + :titlerows=>1, :titlecols=>1, :coltagcommand=>proc{|n| colorize(n)}, - :flashmode=>true, :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, + :flashmode=>true, :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, :browsecommand=>proc{|e| cur_var.value = e.new_index}) -page.trace(:w, proc{|var, elem, op| +page.trace(:w, proc{|var, elem, op| changepage(table_list, table, entry, color, var, elem, op) }) @@ -128,7 +128,7 @@ menu = TkMenu.new m_file = TkMenu.new(menu) Tk.root.menu(menu) menu.add(:cascade, :label=>'File', :underline=>0, :menu=>m_file) -m_file.add(:command, :label=>'Fill Array', +m_file.add(:command, :label=>'Fill Array', :command=>proc{ fill_table(table_list, page.value) }) m_file.add(:command, :label=>'Quit', :command=>proc{exit}) diff --git a/ext/tk/sample/tkextlib/tktable/valid.rb b/ext/tk/sample/tkextlib/tktable/valid.rb index e5d3f11d84..98e9c3855a 100644 --- a/ext/tk/sample/tkextlib/tktable/valid.rb +++ b/ext/tk/sample/tkextlib/tktable/valid.rb @@ -4,7 +4,7 @@ ## ## This demos shows the use of the validation mechanism of the table ## and uses the table's cache (no -command or -variable) -## +## ## ( based on 'valid.tcl' included source archive of tktable extension ) ## require 'tk' @@ -53,12 +53,12 @@ end lbl = TkLabel.new(:text=>"TkTable v1 Validated Table Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :cache=>1, - :width=>5, :height=>5, :titlerows=>1, :titlecols=>1, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :cache=>1, + :width=>5, :height=>5, :titlerows=>1, :titlecols=>1, :coltagcommand=>proc{|n| colorize(n)}, - :flashmode=>true, :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, - :validate=>true, + :flashmode=>true, :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, + :validate=>true, :validatecommand=>proc{|e| unless e.widget.tag_include?('title', e.index) validate_proc(e.column, e.new_value) diff --git a/ext/tk/sample/tkextlib/treectrl/bitmaps.rb b/ext/tk/sample/tkextlib/treectrl/bitmaps.rb index 745e6a2e5b..0d8b37b81e 100644 --- a/ext/tk/sample/tkextlib/treectrl/bitmaps.rb +++ b/ext/tk/sample/tkextlib/treectrl/bitmaps.rb @@ -4,12 +4,12 @@ def demoBitmaps(t) #if $Version_1_1_OrLater if @has_bgimg - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', :showheader=>false, :backgroundimage=>@images['sky']) else - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items', :showheader=>false) end @@ -19,15 +19,15 @@ def demoBitmaps(t) t.column_configure(0, :itembackground=>['gray90', []]) end - t.element_create('elemTxt', :text, + t.element_create('elemTxt', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('elemSelTxt', :rect, :showfocus=>true, + t.element_create('elemSelTxt', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) - t.element_create('elemSelBmp', :rect, :outlinewidth=>4, + t.element_create('elemSelBmp', :rect, :outlinewidth=>4, :outline=>[@SystemHighlight, ['selected', 'focus']]) - t.element_create('elemBmp', :bitmap, - :foreground=>[@SystemHighlight, ['selected', 'focus']], - :background=>'linen', + t.element_create('elemBmp', :bitmap, + :foreground=>[@SystemHighlight, ['selected', 'focus']], + :background=>'linen', :bitmap=>['question' ['selected']]) s = t.style_create('STYLE', :orient=>:vertical) @@ -42,7 +42,7 @@ def demoBitmaps(t) t.defaultstyle = [s] end - bitmap_names = %w(error gray75 gray50 gray25 gray12 + bitmap_names = %w(error gray75 gray50 gray25 gray12 hourglass info questhead question warning) bitmap_names.each{|name| @@ -60,15 +60,15 @@ def demoBitmaps(t) t.item_style_set(i, 0, s) t.item_text(i, 0, name) if true - t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name, - :foreground=>['brown', ''], + t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name, + :foreground=>['brown', ''], :background=>['', '']) else - t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name, + t.item_element_configure(i, 0, 'elemBmp', :bitmap=>name, :foreground=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'brown', [] - ], + ], :background=>['', []]) end t.item_lastchild(:root, i) diff --git a/ext/tk/sample/tkextlib/treectrl/demo.rb b/ext/tk/sample/tkextlib/treectrl/demo.rb index eed95d0e1c..564a005bdc 100644 --- a/ext/tk/sample/tkextlib/treectrl/demo.rb +++ b/ext/tk/sample/tkextlib/treectrl/demo.rb @@ -76,7 +76,7 @@ class TkTreeCtrl_demo #################### - @tree2.bind('ButtonPress-3', + @tree2.bind('ButtonPress-3', proc{|w, x, y, rootx, rooty| show_list_popup(w, x, y, rootx, rooty) }, '%W %x %y %X %Y') @@ -94,7 +94,7 @@ class TkTreeCtrl_demo #################### - @tree1.notify_bind(@tree1, 'Selection', + @tree1.notify_bind(@tree1, 'Selection', proc{|c, t| if c == 1 item = t.selection_get[0] @@ -102,10 +102,10 @@ class TkTreeCtrl_demo end }, '%c %T') - # When one item is selected in the demo list, display the styles in + # When one item is selected in the demo list, display the styles in # that item. # See DemoClear for why the tag "DontDelete" is used - @tree2.notify_bind('DontDelete', 'Selection', + @tree2.notify_bind('DontDelete', 'Selection', proc{|c, t| display_styles_in_item(t.selection_get[0]) if c == 1 }, '%c %T') @@ -156,15 +156,13 @@ class TkTreeCtrl_demo @src_top = TkToplevel.new f = TkFrame.new(@src_top, :borderwidth=>0) case @thisPlatform - when 'macintosh', 'macos' - font = TkFont.new(['Geneva', 9]) when 'unix' font = TkFont.new(['Courier', -12]) else font = TkFont.new(['Courier', 9]) end - @src_txt = TkText.new(f, :font=>font, :tabs=>font.measure('1234'), + @src_txt = TkText.new(f, :font=>font, :tabs=>font.measure('1234'), :wrap=>:none) xscr = @src_txt.xscrollbar(TkScrollbar.new(f)) yscr = @src_txt.yscrollbar(TkScrollbar.new(f)) @@ -198,10 +196,6 @@ class TkTreeCtrl_demo def tree_plus_scrollbars_in_a_frame(parent, h, v) f = TkFrame.new(parent, :borderwidth=>1, :relief=>:sunken) case @thisPlatform - when 'macintosh' - font = TkFont.new(['Geneva', 9]) - when 'macos' - font = TkFont.new(['Lucida Grande', 11]) when 'unix' font = TkFont.new(['Helvetica', -12]) else @@ -210,23 +204,23 @@ class TkTreeCtrl_demo font = TkFont.new(['MS Sans', 8]) end - tree = Tk::TreeCtrl.new(f, :highlightthickness=>0, + tree = Tk::TreeCtrl.new(f, :highlightthickness=>0, :borderwidth=>0, :font=>font) tree[:xscrollincrement] = 20 tree.debug_configure(:enable=>false, :display=>false) if h - h_scr = TkScrollbar.new(f, :orient=>:horizontal, + h_scr = TkScrollbar.new(f, :orient=>:horizontal, :command=>proc{|*args| tree.xview(*args)}) - tree.notify_bind(h_scr, 'Scroll-x', + tree.notify_bind(h_scr, 'Scroll-x', proc{|w, l, u| w.set(l, u)}, '%W %l %u') h_scr.bind('ButtonPress-1', proc{tree.set_focus}) end if v - v_scr = TkScrollbar.new(f, :orient=>:vertical, + v_scr = TkScrollbar.new(f, :orient=>:vertical, :command=>proc{|*args| tree.yview(*args)}) - tree.notify_bind(v_scr, 'Scroll-y', + tree.notify_bind(v_scr, 'Scroll-y', proc{|w, l, u| w.set(l, u)}, '%W %l %u') v_scr.bind('ButtonPress-1', proc{tree.set_focus}) end @@ -244,7 +238,7 @@ class TkTreeCtrl_demo Tk.root.title('Tk::TreeCtrl Demo') case @thisPlatform - when 'macintosh', 'macosx' + when 'macosx' Tk.root.geometry('+40+40') else Tk.root.geometry('+0+30') @@ -255,13 +249,13 @@ class TkTreeCtrl_demo # Tree + scrollbar: demos f1, @tree1 = tree_plus_scrollbars_in_a_frame(nil, false, true) - @tree1.configure(:showbuttons=>false, :showlines=>:false, + @tree1.configure(:showbuttons=>false, :showlines=>:false, :showroot=>false, :height=>100) if $HasColumnCreate - @tree1.column_create(:text=>'List of Demos', + @tree1.column_create(:text=>'List of Demos', :expand=>true, :button=>false) else - @tree1.column_configure(0, :text=>'List of Demos', + @tree1.column_configure(0, :text=>'List of Demos', :expand=>true, :button=>false) end @@ -269,10 +263,10 @@ class TkTreeCtrl_demo f4, @tree4 = tree_plus_scrollbars_in_a_frame(nil, false, true) @tree4.configure(:showroot=>false, :height=>140) if $HasColumnCreate - @tree4.column_create(:text=>'Elements and Styles', + @tree4.column_create(:text=>'Elements and Styles', :expand=>true, :button=>false) else - @tree4.column_configure(0, :text=>'Elements and Styles', + @tree4.column_configure(0, :text=>'Elements and Styles', :expand=>true, :button=>false) end @@ -280,10 +274,10 @@ class TkTreeCtrl_demo f3, @tree3 = tree_plus_scrollbars_in_a_frame(nil, false, true) @tree3.configure(:showroot=>false) if $HasColumnCreate - @tree3.column_create(:text=>'Styles in Item', + @tree3.column_create(:text=>'Styles in Item', :expand=>true, :button=>false) else - @tree3.column_configure(0, :text=>'Styles in Item', + @tree3.column_configure(0, :text=>'Styles in Item', :expand=>true, :button=>false) end @@ -296,7 +290,7 @@ class TkTreeCtrl_demo # Tree + scrollbars f2, @tree2 = tree_plus_scrollbars_in_a_frame(f2_base, true, true) @tree2.configure(:indent=>19) - @tree2.debug_configure(:enable=>false, :display=>true, + @tree2.debug_configure(:enable=>false, :display=>true, :erasecolor=>'pink', :displaydelay=>30) # Give it a big border to debug drawing @@ -349,7 +343,7 @@ class TkTreeCtrl_demo @popup[:show] = Hash.new{|h, k| h[k] = TkVariable.new} menuspec = [ - [ 'Collapse', [], nil, '', {:menu_config=>{:tearoff=>false}} ], + [ 'Collapse', [], nil, '', {:menu_config=>{:tearoff=>false}} ], [ 'Expand', [], nil, '', {:menu_config=>{:tearoff=>false}} ] ] @@ -357,61 +351,61 @@ class TkTreeCtrl_demo # if $Version_1_1_OrLater if @has_bgimg menuspec << \ - [ 'Background Image', + [ 'Background Image', [ - [ 'none', [@popup[:bgimg], 'none'], nil, '', - {:command=>proc{@tree2.backgroundimage = ''}} ], - [ 'sky', [@popup[:bgimg], 'sky'], nil, '', + [ 'none', [@popup[:bgimg], 'none'], nil, '', + {:command=>proc{@tree2.backgroundimage = ''}} ], + [ 'sky', [@popup[:bgimg], 'sky'], nil, '', {:command=>proc{ @tree2.backgroundimage = @images[@popup[:bgimg].value]}} ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ] end menuspec.concat([ - [ 'Background Mode', + [ 'Background Mode', %w(column index row visindex).collect{|val| - [ val, [@popup[:bgmode], val] , nil, '', + [ val, [@popup[:bgmode], val] , nil, '', {:command=>proc{@tree2.backgroundmode = @popup[:bgmode].value}} ] - }, + }, nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Debug', + [ 'Debug', [ - [ 'Data', @popup[:debug][:data], nil, '', + [ 'Data', @popup[:debug][:data], nil, '', {:command=>proc{ @tree2.debug_configure(:data=>@popup[:debug][:data].value) } - } ], - [ 'Display', @popup[:debug][:display], nil, '', + } ], + [ 'Display', @popup[:debug][:display], nil, '', {:command=>proc{ @tree2.debug_configure(:display=>@popup[:debug][:display].value) } - } ], - [ 'Enable', @popup[:debug][:enable], nil, '', + } ], + [ 'Enable', @popup[:debug][:enable], nil, '', {:command=>proc{ @tree2.debug_configure(:enable=>@popup[:debug][:enable].value) } } ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Buffering', + [ 'Buffering', [ - [ 'none', [@popup[:doublebuffer], 'none'], nil, '', + [ 'none', [@popup[:doublebuffer], 'none'], nil, '', {:command=>proc{ @tree2.doublebuffer = @popup[:doublebuffer].value } - } ], - [ 'item', [@popup[:doublebuffer], 'item'], nil, '', + } ], + [ 'item', [@popup[:doublebuffer], 'item'], nil, '', {:command=>proc{ @tree2.doublebuffer = @popup[:doublebuffer].value } - } ], - [ 'window', [@popup[:doublebuffer], 'window'], nil, '', + } ], + [ 'window', [@popup[:doublebuffer], 'window'], nil, '', {:command=>proc{ @tree2.doublebuffer = @popup[:doublebuffer].value } @@ -420,62 +414,62 @@ class TkTreeCtrl_demo nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Line style', + [ 'Line style', [ - [ 'dot', [@popup[:linestyle], 'dot'], nil, '', - {:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ], - [ 'solid', [@popup[:linestyle], 'solid'], nil, '', + [ 'dot', [@popup[:linestyle], 'dot'], nil, '', + {:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ], + [ 'solid', [@popup[:linestyle], 'solid'], nil, '', {:command=>proc{@tree2.linestyle = @popup[:linestyle].value}} ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Orient', + [ 'Orient', [ - [ 'Horizontal', [@popup[:orient], 'horizontal'], nil, '', - {:command=>proc{@tree2.orient = @popup[:orient].value}} ], - [ 'Vertical', [@popup[:orient], 'vertical'], nil, '', + [ 'Horizontal', [@popup[:orient], 'horizontal'], nil, '', + {:command=>proc{@tree2.orient = @popup[:orient].value}} ], + [ 'Vertical', [@popup[:orient], 'vertical'], nil, '', {:command=>proc{@tree2.orient = @popup[:orient].value}} ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Selectmode', + [ 'Selectmode', %w(list browse extended multiple single).collect{|val| - [ val, [@popup[:selectmode], val] , nil, '', + [ val, [@popup[:selectmode], val] , nil, '', {:command=>proc{@tree2.selectmode = @popup[:selectmode].value}} ] - }, + }, nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Show', + [ 'Show', [ - [ 'Buttons', @popup[:show][:buttons], nil, '', + [ 'Buttons', @popup[:show][:buttons], nil, '', {:command=>proc{ @tree2.showbuttons = @popup[:show][:buttons].value } - } ], - [ 'Header', @popup[:show][:header], nil, '', + } ], + [ 'Header', @popup[:show][:header], nil, '', {:command=>proc{ @tree2.showheader = @popup[:show][:header].value } - } ], - [ 'Lines', @popup[:show][:lines], nil, '', + } ], + [ 'Lines', @popup[:show][:lines], nil, '', {:command=>proc{ @tree2.showlines = @popup[:show][:lines].value } - } ], - [ 'Root', @popup[:show][:root], nil, '', + } ], + [ 'Root', @popup[:show][:root], nil, '', {:command=>proc{ @tree2.showroot = @popup[:show][:root].value } - } ], - [ 'Root Button', @popup[:show][:rootbutton], nil, '', + } ], + [ 'Root Button', @popup[:show][:rootbutton], nil, '', {:command=>proc{ @tree2.showrootbutton = @popup[:show][:rootbutton].value } } ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ], @@ -515,14 +509,14 @@ class TkTreeCtrl_demo if id[0] == 'item' item = id[1] if $Version_1_1_OrLater - m.add_command(:label=>"Item #{item}", + m.add_command(:label=>"Item #{item}", :command=>proc{w.item_collapse(item)}) - m.add_command(:label=>"Item #{item} (recurse)", + m.add_command(:label=>"Item #{item} (recurse)", :command=>proc{w.item_collapse_recurse(item)}) else - m.add_command(:label=>"Item #{item}", + m.add_command(:label=>"Item #{item}", :command=>proc{w.collapse(item)}) - m.add_command(:label=>"Item #{item} (recurse)", + m.add_command(:label=>"Item #{item} (recurse)", :command=>proc{w.collapse_recurse(item)}) end end @@ -539,14 +533,14 @@ class TkTreeCtrl_demo if id[0] == 'item' item = id[1] if $Version_1_1_OrLater - m.add_command(:label=>"Item #{item}", + m.add_command(:label=>"Item #{item}", :command=>proc{w.item_expand(item)}) - m.add_command(:label=>"Item #{item} (recurse)", + m.add_command(:label=>"Item #{item} (recurse)", :command=>proc{w.item_expand_recurse(item)}) else - m.add_command(:label=>"Item #{item}", + m.add_command(:label=>"Item #{item}", :command=>proc{w.expand(item)}) - m.add_command(:label=>"Item #{item} (recurse)", + m.add_command(:label=>"Item #{item} (recurse)", :command=>proc{w.expand_recurse(item)}) end end @@ -578,8 +572,8 @@ class TkTreeCtrl_demo txt = w.column_cget(i, :text) img_name = w.column_cget(i, :image) img_name = @images.key(img_name) if img_name.kind_of?(TkImage) - m.add_checkbutton(:variable=>@popup[:visible][i], - :label=>"Column #{i} \"#{txt}\" [#{img_name}]", + m.add_checkbutton(:variable=>@popup[:visible][i], + :label=>"Column #{i} \"#{txt}\" [#{img_name}]", :command=>proc{w.column_configure(i, :visible=>@popup[:visible][i].value)}) } @@ -596,90 +590,90 @@ class TkTreeCtrl_demo @popup[:justify] = TkVariable.new menuspec = [ - [ 'Arrow', + [ 'Arrow', [ - [ 'None', [@popup[:arrow], 'none'], nil, '', + [ 'None', [@popup[:arrow], 'none'], nil, '', {:command=>proc{ @tree2.column_configure(@popup[:column].value, :arrow=>:none) } } ], - [ 'Up', [@popup[:arrow], 'up'], nil, '', + [ 'Up', [@popup[:arrow], 'up'], nil, '', {:command=>proc{ @tree2.column_configure(@popup[:column].value, :arrow=>:up) } } ], - [ 'Down', [@popup[:arrow], 'down'], nil, '', + [ 'Down', [@popup[:arrow], 'down'], nil, '', {:command=>proc{ @tree2.column_configure(@popup[:column].value, :arrow=>:down) } } ], - '---', + '---', - [ 'Side Left', [@popup[:arrowside], 'left'], nil, '', + [ 'Side Left', [@popup[:arrowside], 'left'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :arrowside=>:left) } } ], - [ 'Side Right', [@popup[:arrowside], 'right'], nil, '', + [ 'Side Right', [@popup[:arrowside], 'right'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :arrowside=>:right) } } ], - '---', + '---', - [ 'Gravity Left', [@popup[:arrowgravity], 'left'], nil, '', + [ 'Gravity Left', [@popup[:arrowgravity], 'left'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :arrowgravity=>:left) } } ], - [ 'Gravity Right', [@popup[:arrowgravity], 'right'], nil, '', + [ 'Gravity Right', [@popup[:arrowgravity], 'right'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :arrowgravity=>:right) } } ], - ], - nil, '', {:menu_config=>{:tearoff=>false}} ], + ], + nil, '', {:menu_config=>{:tearoff=>false}} ], - [ 'Expand', @popup[:expand], nil, '', + [ 'Expand', @popup[:expand], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :expand=>@popup[:expand].value) } } ], - [ 'Squeeze', @popup[:squeeze], nil, '', + [ 'Squeeze', @popup[:squeeze], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :squeeze=>@popup[:squeeze].value) } } ], - [ 'Justify', + [ 'Justify', [ - [ 'Left', [@popup[:justify], 'left'], nil, '', + [ 'Left', [@popup[:justify], 'left'], nil, '', {:command=>proc{ @tree2.column_configure(@popup[:column].value, :justify=>:left) } } ], - [ 'Center', [@popup[:justify], 'center'], nil, '', + [ 'Center', [@popup[:justify], 'center'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :justify=>:center) } } ], - [ 'Right', [@popup[:justify], 'right'], nil, '', + [ 'Right', [@popup[:justify], 'right'], nil, '', {:command=>proc{ - @tree2.column_configure(@popup[:column].value, + @tree2.column_configure(@popup[:column].value, :justify=>:right) } } ] - ], + ], nil, '', {:menu_config=>{:tearoff=>false}} ] ] @@ -713,7 +707,7 @@ class TkTreeCtrl_demo def master._pub_display_styles_in_item(item) display_styles_in_item(item) end - proc_disp_styles_in_item = proc{|item| + proc_disp_styles_in_item = proc{|item| master._pub_display_styles_in_item(item) } @@ -777,15 +771,15 @@ class TkTreeCtrl_demo def load_demo_scripts # demo sources [ - 'bitmaps', - 'explorer', - 'help', - 'imovie', - 'layout', - 'mailwasher', - 'outlook-folders', - 'outlook-newgroup', - 'random', + 'bitmaps', + 'explorer', + 'help', + 'imovie', + 'layout', + 'mailwasher', + 'outlook-folders', + 'outlook-newgroup', + 'random', 'www-options' ].each{|f| @demo_scripts.load_demo(File.join(@ScriptDir, "#{f}.rb")) @@ -795,18 +789,18 @@ class TkTreeCtrl_demo ########################### def init_demo_list - @tree1.element_create('e1', :text, + @tree1.element_create('e1', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - @tree1.element_create('e2', :rect, :showfocus=>true, + @tree1.element_create('e2', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], - 'gray', ['selected', '!focus'], + @SystemHighlight, ['selected', 'focus'], + 'gray', ['selected', '!focus'], ]) @tree1.style_create('s1') @tree1.style_elements('s1', ['e2', 'e1']) # Tk listbox has linespace + 1 height - @tree1.style_layout('s1', 'e2', :union=>['e1'], + @tree1.style_layout('s1', 'e2', :union=>['e1'], :ipadx=>2, :ipady=>[0, 1], :iexpand=>:e) if $Version_1_1_OrLater @@ -815,19 +809,19 @@ class TkTreeCtrl_demo ### [ - ["Random #{@RandomN[0]} Items", :demoRandom, 'random.rb'], - ["Random #{@RandomN[0]} Items, Button Images", :demoRandom2, 'random.rb'], + ["Random #{@RandomN[0]} Items", :demoRandom, 'random.rb'], + ["Random #{@RandomN[0]} Items, Button Images", :demoRandom2, 'random.rb'], ["Outlook Express (Folders)", :demoOutlookFolders, 'outlook-folders.rb'], - ["Outlook Express (Newsgroup)", :demoOutlookNewsgroup, 'outlook-newgroup.rb'], - ["Explorer (Details)", :demoExplorerDetails, 'explorer.rb'], - ["Explorer (List)", :demoExplorerList, 'explorer.rb'], - ["Explorer (Large icons)", :demoExplorerLargeIcons, 'explorer.rb'], - ["Explorer (Small icons)", :demoExplorerSmallIcons, 'explorer.rb'], - ["Internet Options", :demoInternetOptions, 'www-options.rb'], - ["Help Contents", :demoHelpContents, 'help.rb'], - ["Layout", :demoLayout, 'layout.rb'], - ["MailWasher", :demoMailWasher, 'mailwasher.rb'], - ["Bitmaps", :demoBitmaps, 'bitmaps.rb'], + ["Outlook Express (Newsgroup)", :demoOutlookNewsgroup, 'outlook-newgroup.rb'], + ["Explorer (Details)", :demoExplorerDetails, 'explorer.rb'], + ["Explorer (List)", :demoExplorerList, 'explorer.rb'], + ["Explorer (Large icons)", :demoExplorerLargeIcons, 'explorer.rb'], + ["Explorer (Small icons)", :demoExplorerSmallIcons, 'explorer.rb'], + ["Internet Options", :demoInternetOptions, 'www-options.rb'], + ["Help Contents", :demoHelpContents, 'help.rb'], + ["Layout", :demoLayout, 'layout.rb'], + ["MailWasher", :demoMailWasher, 'mailwasher.rb'], + ["Bitmaps", :demoBitmaps, 'bitmaps.rb'], ["iMovie", :demoIMovie, 'imovie.rb'] ].each{|label, cmd, file| item = @tree1.item_create @@ -859,15 +853,15 @@ class TkTreeCtrl_demo def display_styles_in_list # Create elements and styles the first time this is called if @tree4.style_names.empty? - @tree4.element_create('e1', :text, + @tree4.element_create('e1', :text, :fill=>[@SystemHighlightText,['selected','focus']]) - @tree4.element_create('e2', :text, + @tree4.element_create('e2', :text, :fill=>[ - @SystemHighlightText, ['selected','focus'], - '', ['selected','!focus'], + @SystemHighlightText, ['selected','focus'], + '', ['selected','!focus'], 'blue', [] ]) - @tree4.element_create('e3', :rect, :showfocus=>true, + @tree4.element_create('e3', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected','focus'], 'gray', ['selected', '!focus'] @@ -880,13 +874,13 @@ class TkTreeCtrl_demo @tree4.style_create('s2') @tree4.style_elements('s2', ['e3', 'e1', 'e2']) @tree4.style_layout('s2', 'e1', :padx=>[0,4]) - @tree4.style_layout('s2', 'e3', :union=>['e1', 'e2'], + @tree4.style_layout('s2', 'e3', :union=>['e1', 'e2'], :ipadx=>1, :ipady=>[0,1]) end # Clear the list @tree4.item_delete(:all) - + # One item for each element in the demo list @tree2.element_names.sort.each{|elem| if $Version_1_1_OrLater @@ -898,7 +892,7 @@ class TkTreeCtrl_demo @tree4.collapse(item) end @tree4.item_style_set(item, 0, 's1') - @tree4.item_text(item, 0, + @tree4.item_text(item, 0, "Element #{elem} (#{@tree2.element_type(elem)})") # One item for each configuration option for this element @@ -913,7 +907,7 @@ class TkTreeCtrl_demo else @tree4.item_style_set(item2, 0, 's2') @tree4.item_complex(item2, [ - ['e1', {:text=>name}], + ['e1', {:text=>name}], ['e2', {:text=>current.inspect}] ]) end @@ -948,7 +942,7 @@ class TkTreeCtrl_demo @tree4.collapse(item2) end @tree4.item_style_set(item2, 0, 's1') - @tree4.item_text(item2, 0, + @tree4.item_text(item2, 0, "Element #{elem} (#{@tree2.element_type(elem)})") # One item for each layout option for this element in this style @@ -977,15 +971,15 @@ class TkTreeCtrl_demo # Create elements and styles the first time this is called if @tree3.style_names.empty? - @tree3.element_create('e1', :text, + @tree3.element_create('e1', :text, :fill=>[@SystemHighlightText,['selected','focus']]) - @tree3.element_create('e2', :text, + @tree3.element_create('e2', :text, :fill=>[ - @SystemHighlightText, ['selected','focus'], - '', ['selected','!focus'], + @SystemHighlightText, ['selected','focus'], + '', ['selected','!focus'], 'blue', [] ]) - @tree3.element_create('e3', :rect, :showfocus=>true, + @tree3.element_create('e3', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected','focus'], 'gray', ['selected', '!focus'] @@ -998,7 +992,7 @@ class TkTreeCtrl_demo @tree3.style_create('s2') @tree3.style_elements('s2', ['e3', 'e1', 'e2']) @tree3.style_layout('s2', 'e1', :padx=>[0,4]) - @tree3.style_layout('s2', 'e3', :union=>['e1', 'e2'], + @tree3.style_layout('s2', 'e3', :union=>['e1', 'e2'], :ipadx=>1, :ipady=>[0,1]) end # Clear the list @@ -1014,7 +1008,7 @@ class TkTreeCtrl_demo @tree3.collapse(item2) end @tree3.item_style_set(item2, 0, 's1') - @tree3.item_element_configure(item2, 0, 'e1', + @tree3.item_element_configure(item2, 0, 'e1', :text=>"Column #{column}: Style #{sty}") button = false @@ -1035,7 +1029,7 @@ class TkTreeCtrl_demo @tree3.collapse(item3) end @tree3.item_style_set(item3, 0, 's1') - @tree3.item_element_configure(item3, 0, 'e1', + @tree3.item_element_configure(item3, 0, 'e1', :text=>"Element #{elem} (#{@tree2.element_type(elem)})") # One item for each configuration option in this element @@ -1052,13 +1046,13 @@ class TkTreeCtrl_demo if sameAsMaster @tree3.item_style_set(item4, 0, 's1') @tree3.item_complex(item4, [ - ['e1', + ['e1', {:text=>"#{name} #{current.inspect}"}] ]) else @tree3.item_style_set(item4, 0, 's2') @tree3.item_complex(item4, [ - ['e1', {:text=>name}], + ['e1', {:text=>name}], ['e2', {:text=>current.inspect}] ]) end @@ -1118,28 +1112,28 @@ class TkTreeCtrl_demo # Restore some happy defaults to the demo list # if $Version_1_1_OrLater if @has_bgimg - @tree2.configure(:orient=>:vertical, :wrap=>'', - :xscrollincrement=>0, :yscrollincrement=>0, - :itemheight=>0, :showheader=>true, - :background=>'white', :scrollmargin=>0, - :xscrolldelay=>50, :yscrolldelay=>50, - :openbuttonimage=>'', :closedbuttonimage=>'', - :backgroundmode=>:row, :treecolumn=>0, :indent=>19, + @tree2.configure(:orient=>:vertical, :wrap=>'', + :xscrollincrement=>0, :yscrollincrement=>0, + :itemheight=>0, :showheader=>true, + :background=>'white', :scrollmargin=>0, + :xscrolldelay=>50, :yscrolldelay=>50, + :openbuttonimage=>'', :closedbuttonimage=>'', + :backgroundmode=>:row, :treecolumn=>0, :indent=>19, :defaultstyle=>'', :backgroundimage=>'') else - @tree2.configure(:orient=>:vertical, :wrap=>'', - :xscrollincrement=>0, :yscrollincrement=>0, - :itemheight=>0, :showheader=>true, - :background=>'white', :scrollmargin=>0, - :xscrolldelay=>50, :yscrolldelay=>50, - :openbuttonimage=>'', :closedbuttonimage=>'', + @tree2.configure(:orient=>:vertical, :wrap=>'', + :xscrollincrement=>0, :yscrollincrement=>0, + :itemheight=>0, :showheader=>true, + :background=>'white', :scrollmargin=>0, + :xscrolldelay=>50, :yscrolldelay=>50, + :openbuttonimage=>'', :closedbuttonimage=>'', :backgroundmode=>:row, :treecolumn=>0, :indent=>19) end # Restore default bindings to the demo list @tree2.bindtags = [ @tree2, Tk::TreeCtrl, @tree2.winfo_toplevel, :all ] - @tree2.winfo_children.each{|w| + @tree2.winfo_children.each{|w| w.destroy unless @non_clear_list.include?(w) } end @@ -1153,8 +1147,8 @@ def cursor_window(top = nil) top.destroy if top.kind_of?(TkWindow) && top.winfo_exist? top = TkToplevel.new(:title=>'Cursor Window') - c = TkCanvas.new(top, :background=>'white', - :width=>50*10, :highlightthickness=>0, + c = TkCanvas.new(top, :background=>'white', + :width=>50*10, :highlightthickness=>0, :borderwidth=>0).pack(:expand=>true, :fill=>:both) cursors = %w( X_cursor @@ -1247,7 +1241,7 @@ def cursor_window(top = nil) begin c.cursor = cur - r = TkcRectangle.new(c, x, y, x+50, y+40, + r = TkcRectangle.new(c, x, y, x+50, y+40, :fill=>'gray90', :outline=>'black', :width=>2) t = TkcText.new(c, x+50/2, y+4, :text=>cur, :anchor=>:n, :width=>42) @@ -1284,10 +1278,10 @@ if Tk::PLATFORM['platform'] == 'unix' && Tk.windowingsystem != 'aqua' loupe[:y] = 0 unless loupe[:y] loupe[:auto] = true unless loupe[:auto] loupe[:delay] = 500 unless loupe[:delay] - loupe[:image] = + loupe[:image] = TkPhotoImage.new(:width=>150, :height=>150) unless loupe[:image] - top = TkToplevel.new(:geometry=>'-0+30', + top = TkToplevel.new(:geometry=>'-0+30', :title=>'A little screen magnifier for X11') TkLabel.new(top, :image=>loupe[:image]).pack diff --git a/ext/tk/sample/tkextlib/treectrl/explorer.rb b/ext/tk/sample/tkextlib/treectrl/explorer.rb index 242777cbce..1b8c2a8287 100644 --- a/ext/tk/sample/tkextlib/treectrl/explorer.rb +++ b/ext/tk/sample/tkextlib/treectrl/explorer.rb @@ -49,44 +49,44 @@ def demoExplorerDetails(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :itemheight=>height, :selectmode=>:extended, - :xscrollincrement=>20, :scrollmargin=>16, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :itemheight=>height, :selectmode=>:extended, + :xscrollincrement=>20, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) init_pics('small-*') if $HasColumnCreate - t.column_create(:text=>'Name', :tag=>'name', + t.column_create(:text=>'Name', :tag=>'name', :width=>200, :arrow=>:up, :arrowpad=>6) - t.column_create(:text=>'Size', :tag=>'size', :justify=>:right, + t.column_create(:text=>'Size', :tag=>'size', :justify=>:right, :width=>60, :arrowside=>:left, :arrowgravity=>:right) t.column_create(:text=>'Type', :tag=>'type', :width=>120) t.column_create(:text=>'Modified', :tag=>'modified', :width=>130) else - t.column_configure(0, :text=>'Name', :tag=>'name', + t.column_configure(0, :text=>'Name', :tag=>'name', :width=>200, :arrow=>:up, :arrowpad=>6) - t.column_configure(1, :text=>'Size', :tag=>'size', :justify=>:right, + t.column_configure(1, :text=>'Size', :tag=>'size', :justify=>:right, :width=>60, :arrowside=>:left, :arrowgravity=>:right) t.column_configure(2, :text=>'Type', :tag=>'type', :width=>120) t.column_configure(3, :text=>'Modified', :tag=>'modified', :width=>130) end - t.element_create('e1', :image, + t.element_create('e1', :image, :image=>[ - @sel_images['small-folder'], ['selected'], + @sel_images['small-folder'], ['selected'], @images['small-folder'], [] ]) - t.element_create('e2', :text, :lines=>1, + t.element_create('e2', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('txtType', :text, :lines=>1) - t.element_create('txtSize', :text, :lines=>1, + t.element_create('txtSize', :text, :lines=>1, :datatype=>:integer, :format=>'%dKB') - t.element_create('txtDate', :text, :lines=>1, + t.element_create('txtDate', :text, :lines=>1, :datatype=>:time, :format=>'%d/%m/%y %I:%M %p') t.element_create('e4', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -116,23 +116,23 @@ def demoExplorerDetails(t) @Priv[:sensitive, t] = [ ['name', 'styName', 'e1', 'e2'] ] @Priv[:dragimage, t] = [ ['name', 'styName', 'e1', 'e2'] ] - t.notify_bind(t, 'Edit-accept', + t.notify_bind(t, 'Edit-accept', proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t') dir_proc = proc{|file| item = t.item_create t.item_style_set(item, 0, 'styName', 2, 'styType', 3, 'styDate') - t.item_complex(item, - [['e2', {:text=>File.basename(file)}]], - [], - [['txtType', {:text=>'Folder'}]], + t.item_complex(item, + [['e2', {:text=>File.basename(file)}]], + [], + [['txtType', {:text=>'Folder'}]], [['txtDate', {:data=>File.mtime(file).tv_sec}]]) t.item_lastchild(:root, item) } file_proc = proc{|file| item = t.item_create - t.item_style_set(item, 0, 'styName', 1, 'stySize', + t.item_style_set(item, 0, 'styName', 1, 'stySize', 2, 'styType', 3, 'styDate') ext = File.extname(file) @@ -151,14 +151,14 @@ def demoExplorerDetails(t) type = type[1..-1] << ' ' unless type.empty? type << 'File' - t.item_complex(item, - [ - ['e1', {:image=>[@sel_images[img], ['selected'], + t.item_complex(item, + [ + ['e1', {:image=>[@sel_images[img], ['selected'], @images[img], []]}], ['e2', {:text=>File.basename(file)}] - ], - [ ['txtSize', {:data=>File.size(file)/1024 + 1}] ], - [ ['txtType', {:text=>type}] ], + ], + [ ['txtSize', {:data=>File.size(file)/1024 + 1}] ], + [ ['txtType', {:text=>type}] ], [ ['txtDate', {:data=>File.mtime(file).tv_sec}] ] ) t.item_lastchild(:root, item) @@ -167,7 +167,7 @@ def demoExplorerDetails(t) demoExplorerAux(t, dir_proc, file_proc) @SortColumn = 0 - t.notify_bind(t, 'Header-invoke', + t.notify_bind(t, 'Header-invoke', proc{|w, c| explorerHeaderInvoke(t, w, c)}, '%T %C') t.bindtags = [ t, 'TreeCtrlFileList', Tk::TreeCtrl, t.winfo_toplevel, :all ] @@ -200,37 +200,37 @@ def explorerHeaderInvoke(t, w, c) case t.column_cget(c, :tag) when 'name' if dirCount > 0 - t.item_sort(:root, order, {:last=>"root child #{lastDir}"}, + t.item_sort(:root, order, {:last=>"root child #{lastDir}"}, {:column=>c, :dictionary=>true}) end if dirCount < t.numitems - 1 - t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, + t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, {:column=>c, :dictionary=>true}) end when 'size' if dirCount < t.numitems - 1 - t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, - {:column=>c, :integer=>true}, + t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, + {:column=>c, :integer=>true}, {:column=>'name', :dictionary=>true}) end when 'type' if dirCount < t.numitems - 1 - t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, - {:column=>c, :dictionary=>true}, + t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, + {:column=>c, :dictionary=>true}, {:column=>'name', :dictionary=>true}) end when 'modified' if dirCount > 0 - t.item_sort(:root, order, {:last=>"root child #{lastDir}"}, - {:column=>c, :integer=>true}, + t.item_sort(:root, order, {:last=>"root child #{lastDir}"}, + {:column=>c, :integer=>true}, {:column=>'name', :dictionary=>true}) end if dirCount < t.numitems - 1 - t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, - {:column=>c, :integer=>true}, + t.item_sort(:root, order, {:first=>"root child #{dirCount}"}, + {:column=>c, :integer=>true}, {:column=>'name', :dictionary=>true}) end @@ -241,9 +241,9 @@ def demoExplorerLargeIcons(t) # Item height is 32 for icon, 4 padding, 3 lines of text itemHeight = 32 + 4 + t.font.metrics(:linespace) * 3 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :selectmode=>:extended, :wrap=>:window, :orient=>:horizontal, - :itemheight=>itemHeight, :showheader=>false, :scrollmargin=>16, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :selectmode=>:extended, :wrap=>:window, :orient=>:horizontal, + :itemheight=>itemHeight, :showheader=>false, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) init_pics('big-*') @@ -254,17 +254,17 @@ def demoExplorerLargeIcons(t) t.column_configure(0, :width=>75) end - t.element_create('elemImg', :image, + t.element_create('elemImg', :image, :image=>[ - @sel_images['big-folder'], ['selected'], + @sel_images['big-folder'], ['selected'], @images['big-folder'], [] ]) - t.element_create('elemTxt', :text, :justify=>:center, - :lines=>1, :width=>71, :wrap=>:word, + t.element_create('elemTxt', :text, :justify=>:center, + :lines=>1, :width=>71, :wrap=>:word, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('elemSel', :rect, :showfocus=>true, + t.element_create('elemSel', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected'] ]) @@ -272,7 +272,7 @@ def demoExplorerLargeIcons(t) s = t.style_create('STYLE', :orient=>:vertical) t.style_elements(s, ['elemSel', 'elemImg', 'elemTxt']) t.style_layout(s, 'elemImg', :expand=>:we) - t.style_layout(s, 'elemTxt', + t.style_layout(s, 'elemTxt', :pady=>[4,0], :padx=>2, :squeeze=>:x, :expand=>:we) t.style_layout(s, 'elemSel', :union=>['elemTxt']) @@ -280,7 +280,7 @@ def demoExplorerLargeIcons(t) @Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] @Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] - t.notify_bind(t, 'Edit-accept', + t.notify_bind(t, 'Edit-accept', proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t') dir_proc = proc{|file| @@ -310,9 +310,9 @@ def demoExplorerLargeIcons(t) type = type[1..-1] << ' ' unless type.empty? type << 'File' - t.item_complex(item, - [ - ['elemImg', {:image=>[@sel_images[img], ['selected'], + t.item_complex(item, + [ + ['elemImg', {:image=>[@sel_images[img], ['selected'], @images[img], []]}], ['elemTxt', {:text=>File.basename(file)}] ]) @@ -323,7 +323,7 @@ def demoExplorerLargeIcons(t) t.activate(t.index('root firstchild')) - t.notify_bind(t, 'ActiveItem', + t.notify_bind(t, 'ActiveItem', proc{|w, a, c| w.item_element_configure(a, 0, 'elemTxt', :lines=>'') w.item_element_configure(c, 0, 'elemTxt', :lines=>3) @@ -346,9 +346,9 @@ def demoExplorerList(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :itemheight=>height, :selectmode=>:extended, :wrap=>:window, - :showheader=>false, :scrollmargin=>16, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :itemheight=>height, :selectmode=>:extended, :wrap=>:window, + :showheader=>false, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) init_pics('small-*') @@ -359,16 +359,16 @@ def demoExplorerList(t) t.column_configure(0, :widthhack=>true) end - t.element_create('elemImg', :image, + t.element_create('elemImg', :image, :image=>[ - @sel_images['small-folder'], ['selected'], + @sel_images['small-folder'], ['selected'], @images['small-folder'], [] ]) - t.element_create('elemTxt', :text, :lines=>1, + t.element_create('elemTxt', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('elemSel', :rect, :showfocus=>true, + t.element_create('elemSel', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -383,7 +383,7 @@ def demoExplorerList(t) @Priv[:sensitive, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] @Priv[:dragimage, t] = [ [0, 'STYLE', 'elemImg', 'elemTxt'] ] - t.notify_bind(t, 'Edit-accept', + t.notify_bind(t, 'Edit-accept', proc{|w, i, tt| w.item_text(i, 0, tt)}, '%T %I %t') dir_proc = proc{|file| @@ -413,9 +413,9 @@ def demoExplorerList(t) type = type[1..-1] << ' ' unless type.empty? type << 'File' - t.item_complex(item, - [ - ['elemImg', {:image=>[@sel_images[img], ['selected'], + t.item_complex(item, + [ + ['elemImg', {:image=>[@sel_images[img], ['selected'], @images[img], []]}], ['elemTxt', {:text=>File.basename(file)}] ]) diff --git a/ext/tk/sample/tkextlib/treectrl/help.rb b/ext/tk/sample/tkextlib/treectrl/help.rb index af026fc006..31ec9eb3f8 100644 --- a/ext/tk/sample/tkextlib/treectrl/help.rb +++ b/ext/tk/sample/tkextlib/treectrl/help.rb @@ -4,7 +4,7 @@ def demoHelpContents(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('help-*') @@ -20,16 +20,16 @@ def demoHelpContents(t) t.element_create('e1', :image, :image=>@images['help-page']) t.element_create('e2', :image, :image=>[ - @images['help-book-open'], ['open'], - @images['help-book-closed'], [], + @images['help-book-open'], ['open'], + @images['help-book-closed'], [], ]) - t.element_create('e3', :text, - :font=>[t.font.dup.underline(true), ['mouseover']], + t.element_create('e3', :text, + :font=>[t.font.dup.underline(true), ['mouseover']], :fill=>[ - @SystemHighlightText, ['selected', 'focus'], + @SystemHighlightText, ['selected', 'focus'], 'blue', ['mouseover'] ]) - t.element_create('e4', :rect, :showfocus=>true, + t.element_create('e4', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) # book @@ -49,21 +49,21 @@ def demoHelpContents(t) parentList = [:root, '', '', '', '', '', ''] parent = :root [ - [0, 's1', "Welcome to Help"], - [0, 's2', "Introducing Windows 98"], - [1, 's2', "How to Use Help"], - [2, 's1', "Find a topic"], + [0, 's1', "Welcome to Help"], + [0, 's2', "Introducing Windows 98"], + [1, 's2', "How to Use Help"], + [2, 's1', "Find a topic"], [2, 's1', "Get more out of help"], [1, 's2', "Register Your Software"], - [2, 's1', "Registering Windows 98 online"], - [1, 's2', "What's New in Windows 98"], - [2, 's1', "Innovative, easy-to-use features"], - [2, 's1', "Improved reliability"], - [2, 's1', "A faster operating system"], - [2, 's1', "True Web integration"], - [2, 's1', "More entertaining and fun"], - [1, 's2', "If You're New to Windows 98"], - [2, 's2', "Tips for Macintosh Users"], + [2, 's1', "Registering Windows 98 online"], + [1, 's2', "What's New in Windows 98"], + [2, 's1', "Innovative, easy-to-use features"], + [2, 's1', "Improved reliability"], + [2, 's1', "A faster operating system"], + [2, 's1', "True Web integration"], + [2, 's1', "More entertaining and fun"], + [1, 's2', "If You're New to Windows 98"], + [2, 's2', "Tips for Macintosh Users"], [3, 's1', "Why does the mouse have two buttons?"] ].each{|depth, style, text| item = t.item_create @@ -81,7 +81,7 @@ def demoHelpContents(t) treeCtrlHelp = TkBindTag.new - treeCtrlHelp.bind('Double-ButtonPress-1', + treeCtrlHelp.bind('Double-ButtonPress-1', proc{|w, x, y| if w.identify(x, y)[0] == 'header' Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) @@ -91,25 +91,25 @@ def demoHelpContents(t) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('ButtonPress-1', + treeCtrlHelp.bind('ButtonPress-1', proc{|w, x, y| helpButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('Button1-Motion', + treeCtrlHelp.bind('Button1-Motion', proc{|w, x, y| helpMotion1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('Button1-Leave', + treeCtrlHelp.bind('Button1-Leave', proc{|w, x, y| helpLeave1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('ButtonRelease-1', + treeCtrlHelp.bind('ButtonRelease-1', proc{|w, x, y| helpRelease1(w, x, y) Tk.callback_break @@ -119,7 +119,7 @@ def demoHelpContents(t) treeCtrlHelp.bind('Leave', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y') - treeCtrlHelp.bind('KeyPress-Return', + treeCtrlHelp.bind('KeyPress-Return', proc{|w, x, y| if w.selection_get.length == 1 if $Version_1_1_OrLater @@ -141,7 +141,7 @@ end def demoHelpContents2(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('help-*') @@ -154,19 +154,19 @@ def demoHelpContents2(t) t.element_create('e1', :image, :image=>@images['help-page']) t.element_create('e2', :image, :image=>[ - @images['help-book-open'], ['open'], - @images['help-book-closed'], [], + @images['help-book-open'], ['open'], + @images['help-book-closed'], [], ]) - t.element_create('e3', :text, + t.element_create('e3', :text, :fill=>[ - @SystemHighlightText, ['selected', 'focus'], + @SystemHighlightText, ['selected', 'focus'], 'blue', [] ]) - t.element_create('e4', :rect, :showfocus=>true, + t.element_create('e4', :rect, :showfocus=>true, :fill=>[@SystemHighligh, ['selected', 'focus']]) - t.element_create('e5', :text, :font=>t.font.dup.underline(true), + t.element_create('e5', :text, :font=>t.font.dup.underline(true), :fill=>[ - @SystemHighlightText, ['selected', 'focus'], + @SystemHighlightText, ['selected', 'focus'], 'blue', [] ]) @@ -201,21 +201,21 @@ def demoHelpContents2(t) parentList = [:root, '', '', '', '', '', ''] parent = :root [ - [0, 's1', "Welcome to Help"], - [0, 's2', "Introducing Windows 98"], - [1, 's2', "How to Use Help"], - [2, 's1' "Find a topic"], + [0, 's1', "Welcome to Help"], + [0, 's2', "Introducing Windows 98"], + [1, 's2', "How to Use Help"], + [2, 's1' "Find a topic"], [2, 's1', "Get more out of help"], [1, 's2', "Register Your Software"], - [2, 's1', "Registering Windows 98 online"], - [1, 's2', "What's New in Windows 98"], - [2, 's1', "Innovative, easy-to-use features"], - [2, 's1', "Improved reliability"], - [2, 's1', "A faster operating system"], - [2, 's1', "True Web integration"], - [2, 's1', "More entertaining and fun"], - [1, 's2', "If You're New to Windows 98"], - [2, 's2', "Tips for Macintosh Users"], + [2, 's1', "Registering Windows 98 online"], + [1, 's2', "What's New in Windows 98"], + [2, 's1', "Innovative, easy-to-use features"], + [2, 's1', "Improved reliability"], + [2, 's1', "A faster operating system"], + [2, 's1', "True Web integration"], + [2, 's1', "More entertaining and fun"], + [1, 's2', "If You're New to Windows 98"], + [2, 's2', "Tips for Macintosh Users"], [3, 's1', "Why does the mouse have two buttons?"] ].each{|depth, style, text| item = t.item_create @@ -233,7 +233,7 @@ def demoHelpContents2(t) treeCtrlHelp = TkBindTag.new - treeCtrlHelp.bind('Double-ButtonPress-1', + treeCtrlHelp.bind('Double-ButtonPress-1', proc{|w, x, y| if w.identify(x, y)[0] == 'header' Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) @@ -243,25 +243,25 @@ def demoHelpContents2(t) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('ButtonPress-1', + treeCtrlHelp.bind('ButtonPress-1', proc{|w, x, y| helpButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('Button1-Motion', + treeCtrlHelp.bind('Button1-Motion', proc{|w, x, y| helpMotion1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('Button1-Leave', + treeCtrlHelp.bind('Button1-Leave', proc{|w, x, y| helpLeave1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlHelp.bind('ButtonRelease-1', + treeCtrlHelp.bind('ButtonRelease-1', proc{|w, x, y| helpRelease1(w, x, y) Tk.callback_break @@ -271,7 +271,7 @@ def demoHelpContents2(t) treeCtrlHelp.bind('Leave', proc{|w, x, y| helpMotion(w, x, y) }, '%W %x %y') - treeCtrlHelp.bind('KeyPress-Return', + treeCtrlHelp.bind('KeyPress-Return', proc{|w, x, y| if w.selection_get.length == 1 w.item_toggle(w.selection_get[0]) diff --git a/ext/tk/sample/tkextlib/treectrl/imovie.rb b/ext/tk/sample/tkextlib/treectrl/imovie.rb index d61bf9a7c3..72134ebda6 100644 --- a/ext/tk/sample/tkextlib/treectrl/imovie.rb +++ b/ext/tk/sample/tkextlib/treectrl/imovie.rb @@ -2,8 +2,8 @@ # Demo: iMovie # def demoIMovie(t) - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, - :selectmode=>:browse, :orient=>:horizontal, :wrap=>:window, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + :selectmode=>:browse, :orient=>:horizontal, :wrap=>:window, :showheader=>false, :background=>'#dcdcdc') if $HasColumnCreate @@ -26,24 +26,24 @@ def demoIMovie(t) t.element_create('elemTime', :text, :font=>font1) t.element_create('elemName', :text, :font=>font2, :lines=>1, :width=>80) - t.element_create('elemRect', :rect, :outline=>'#827878', :outlinewidth=>1, + t.element_create('elemRect', :rect, :outline=>'#827878', :outlinewidth=>1, :fill=>['#ffdc5a', ['selected'], 'white', []]) t.element_create('elemImg', :image) - t.element_create('elemShadow', :rect, :outline=>'gray', :outlinewidth=>1, + t.element_create('elemShadow', :rect, :outline=>'gray', :outlinewidth=>1, :open=>:wn) s = t.style_create('STYLE', :orient=>:vertical) t.style_elements(s, [ - 'elemShadow', 'elemRect', 'elemTime', + 'elemShadow', 'elemRect', 'elemTime', 'elemImg', 'elemName' ]) - t.style_layout(s, 'elemShadow', :detach=>true, + t.style_layout(s, 'elemShadow', :detach=>true, :padx=>[1,2], :pady=>[1,2], :iexpand=>:es) t.style_layout(s, 'elemTime', :padx=>[2,0]) t.style_layout(s, 'elemImg', :pady=>[0,1]) - t.style_layout(s, 'elemName', :expand=>:we, :ipady=>[0,2], :padx=>[0,3], + t.style_layout(s, 'elemName', :expand=>:we, :ipady=>[0,2], :padx=>[0,3], :squeeze=>:x) - t.style_layout(s, 'elemRect', :union=>['elemTime', 'elemImg', 'elemName'], + t.style_layout(s, 'elemRect', :union=>['elemTime', 'elemImg', 'elemName'], :ipadx=>6, :padx=>[0,3], :pady=>[0,3]) # Set default item style @@ -53,12 +53,12 @@ def demoIMovie(t) (0..4).each{|i| [ - ['15:20', 'Clip 1', @images['imovie-01']], - ['19:18', 'Clip 2', @images['imovie-02']], - ['07:20', 'Clip 3', @images['imovie-03']], - ['07:20', 'Clip 4', @images['imovie-04']], - ['07:20', 'Clip 5', @images['imovie-05']], - ['07:20', 'Clip 6', @images['imovie-06']], + ['15:20', 'Clip 1', @images['imovie-01']], + ['19:18', 'Clip 2', @images['imovie-02']], + ['07:20', 'Clip 3', @images['imovie-03']], + ['07:20', 'Clip 4', @images['imovie-04']], + ['07:20', 'Clip 5', @images['imovie-05']], + ['07:20', 'Clip 6', @images['imovie-06']], ['07:20', 'Clip 7', @images['imovie-07']] ].each{|time, name, image| item = t.item_create @@ -110,7 +110,7 @@ def iMovieButton1(w, x, y) Tk::TreeCtrl::BindCallback.entryOpen(w, i, 0, e) ent = TkComm.window(w.path + '.entry') unless exists - ent.configure(:borderwidth=>0, :justify=>:center, + ent.configure(:borderwidth=>0, :justify=>:center, :background=>'#ffdc5a') x1, y1, x2, y2 = w.item_bbox(i, 0, e) ent.place(:y=>y1 - 1) diff --git a/ext/tk/sample/tkextlib/treectrl/layout.rb b/ext/tk/sample/tkextlib/treectrl/layout.rb index 745ac86f36..488abe2aa9 100644 --- a/ext/tk/sample/tkextlib/treectrl/layout.rb +++ b/ext/tk/sample/tkextlib/treectrl/layout.rb @@ -2,7 +2,7 @@ # Demo: Layout # def demoLayout(t) - t.configure(:showroot=>false, :showrootbutton=>true, :showbuttons=>true, + t.configure(:showroot=>false, :showrootbutton=>true, :showbuttons=>true, :showlines=>true, :itemheight=>0, :selectmode=>:browse) if $HasColumnCreate @@ -12,10 +12,10 @@ def demoLayout(t) end t.element_create('e1', :rect, :width=>30, :height=>30, :fill=>'gray20') - t.element_create('e2', :rect, :width=>30, :height=>30, :fill=>'gray40', + t.element_create('e2', :rect, :width=>30, :height=>30, :fill=>'gray40', :outline=>'blue', :outlinewidth=>3) t.element_create('e3', :rect, :fill=>'gray60') - t.element_create('e4', :rect, :showfocus=>true, + t.element_create('e4', :rect, :showfocus=>true, :fill=>[ @SystemHighlight, ['selected', 'focus'], 'gray80', [] ]) @@ -31,9 +31,9 @@ def demoLayout(t) t.style_layout(s, 'e3', :union=>['e1', 'e2'], :ipadx=>4, :ipady=>4, :pady=>2) t.style_layout(s, 'e4', :detach=>true, :iexpand=>:es) t.style_layout(s, 'e5', :detach=>true, :padx=>[2,0], :pady=>2, :iexpand=>:s) - t.style_layout(s, 'e6', :detach=>true, :expand=>:ws, + t.style_layout(s, 'e6', :detach=>true, :expand=>:ws, :padx=>[0,2], :pady=>[2,0]) - t.style_layout(s, 'e7', :detach=>true, :expand=>:wn, + t.style_layout(s, 'e7', :detach=>true, :expand=>:wn, :padx=>[0,2], :pady=>[0,2]) if $Version_1_1_OrLater @@ -53,7 +53,7 @@ def demoLayout(t) t.item_style_set(i, 0, s) t.item_lastchild(parent, i) - ### + ### s = t.style_create('s2') t.style_elements(s, ['e4', 'e3', 'e1']) @@ -77,7 +77,7 @@ def demoLayout(t) t.item_style_set(i2, 0, s) t.item_lastchild(i, i2) - ### + ### s = t.style_create('s3') t.style_elements(s, ['e4', 'e3', 'e1', 'e5', 'e6']) @@ -101,10 +101,10 @@ def demoLayout(t) t.item_style_set(i2, 0, s) t.item_lastchild(i, i2) - ### + ### - t.element_create('eb', :border, :background=>@SystemButtonFace, - :relief=>[:sunken, ['selected'], :raised, []], + t.element_create('eb', :border, :background=>@SystemButtonFace, + :relief=>[:sunken, ['selected'], :raised, []], :thickness=>2, :filled=>true) t.element_create('et', :text) @@ -134,11 +134,11 @@ def demoLayout(t) t.item_text(i, 0, text) t.item_lastchild(parent, i) - ### + ### styleNum = 5 - [ - [:horizontal, [:s, :ns, :n]], + [ + [:horizontal, [:s, :ns, :n]], [:vertical, [:e, :we, :w]] ].each{|orient, expandList| expandList.each{|expand| diff --git a/ext/tk/sample/tkextlib/treectrl/mailwasher.rb b/ext/tk/sample/tkextlib/treectrl/mailwasher.rb index 836e1e87de..1b51bb9b21 100644 --- a/ext/tk/sample/tkextlib/treectrl/mailwasher.rb +++ b/ext/tk/sample/tkextlib/treectrl/mailwasher.rb @@ -7,8 +7,8 @@ def demoMailWasher(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:showroot=>false, :showrootbutton=>false, :showbuttons=>false, - :showlines=>false, :itemheight=>height, :selectmode=>:browse, + t.configure(:showroot=>false, :showrootbutton=>false, :showbuttons=>false, + :showlines=>false, :itemheight=>height, :selectmode=>:browse, :xscrollincrement=>1) pad = 4 @@ -16,14 +16,14 @@ def demoMailWasher(t) if $Version_1_1_OrLater t.column_create(:text=>'Delete', :textpadx=>pad, :tag=>'delete') t.column_create(:text=>'Bounce', :textpadx=>pad, :tag=>'bounce') - t.column_create(:text=>'Status', :width=>80, :textpadx=>pad, + t.column_create(:text=>'Status', :width=>80, :textpadx=>pad, :tag=>'status') - t.column_create(:text=>'Size', :width=>40, :textpadx=>pad, + t.column_create(:text=>'Size', :width=>40, :textpadx=>pad, :justify=>:right, :tag=>'size') t.column_create(:text=>'From', :width=>140, :textpadx=>pad, :tag=>'from') - t.column_create(:text=>'Subject', :width=>240, :textpadx=>pad, + t.column_create(:text=>'Subject', :width=>240, :textpadx=>pad, :tag=>'subject') - t.column_create(:text=>'Received', :textpadx=>pad, :arrow=>:up, + t.column_create(:text=>'Received', :textpadx=>pad, :arrow=>:up, :arrowpad=>[4,0], :tag=>'received') t.column_create(:text=>'Attachments', :textpadx=>pad, :tag=>'attachments') @@ -36,38 +36,38 @@ def demoMailWasher(t) else # TreeCtrl 1.0 t.column_configure(0, :text=>'Delete', :textpadx=>pad, :tag=>'delete') t.column_configure(1, :text=>'Bounce', :textpadx=>pad, :tag=>'bounce') - t.column_configure(2, :text=>'Status', :width=>80, :textpadx=>pad, + t.column_configure(2, :text=>'Status', :width=>80, :textpadx=>pad, :tag=>'status') - t.column_configure(3, :text=>'Size', :width=>40, :textpadx=>pad, + t.column_configure(3, :text=>'Size', :width=>40, :textpadx=>pad, :justify=>:right, :tag=>'size') - t.column_configure(4, :text=>'From', :width=>140, :textpadx=>pad, + t.column_configure(4, :text=>'From', :width=>140, :textpadx=>pad, :tag=>'from') - t.column_configure(5, :text=>'Subject', :width=>240, :textpadx=>pad, + t.column_configure(5, :text=>'Subject', :width=>240, :textpadx=>pad, :tag=>'subject') - t.column_configure(6, :text=>'Received', :textpadx=>pad, :arrow=>:up, + t.column_configure(6, :text=>'Received', :textpadx=>pad, :arrow=>:up, :arrowpad=>[4,0], :tag=>'received') - t.column_configure(7, :text=>'Attachments', :textpadx=>pad, + t.column_configure(7, :text=>'Attachments', :textpadx=>pad, :tag=>'attachments') t.element_create('imgOff', :image, :image=>@images['unchecked']) t.element_create('imgOn', :image, :image=>@images['checked']) end - t.element_create('border', :rect, :open=>:nw, :outline=>'gray', + t.element_create('border', :rect, :open=>:nw, :outline=>'gray', :outlinewidth=>1, :fill=>[@SystemHighlight, ['selected']]) - t.element_create('txtAny', :text, :lines=>1, + t.element_create('txtAny', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) - t.element_create('txtNone', :text, :text=>'none', :lines=>1, + t.element_create('txtNone', :text, :text=>'none', :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) - t.element_create('txtYes', :text, :text=>'yes', :lines=>1, + t.element_create('txtYes', :text, :text=>'yes', :lines=>1, :fill=>[@SystemHighlightText, ['selected']]) - t.element_create('txtNormal', :text, :text=>'Normal', :lines=>1, + t.element_create('txtNormal', :text, :text=>'Normal', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#006800', []]) - t.element_create('txtPossSpam', :text, :text=>'Possible Spam', :lines=>1, + t.element_create('txtPossSpam', :text, :text=>'Possible Spam', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#787800', []]) - t.element_create('txtProbSpam', :text, :text=>'Probably Spam', :lines=>1, + t.element_create('txtProbSpam', :text, :text=>'Probably Spam', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#FF9000', []]) - t.element_create('txtBlacklist', :text, :text=>'Blacklisted', :lines=>1, + t.element_create('txtBlacklist', :text, :text=>'Blacklisted', :lines=>1, :fill=>[@SystemHighlightText, ['selected'], '#FF5800', []]) if $Version_1_1_OrLater @@ -96,16 +96,16 @@ def demoMailWasher(t) } [ - ['baldy@spammer.com', "Your hair is thinning"], - ['flat@spammer.com', "Your breasts are too small"], - ['tiny@spammer.com', "Your penis is too small"], - ['dumbass@spammer.com', "You are not very smart"], - ['bankrobber@spammer.com', "You need more money"], - ['loser@spammer.com', "You need better friends"], - ['gossip@spammer.com', "Find out what your coworkers think about you"], + ['baldy@spammer.com', "Your hair is thinning"], + ['flat@spammer.com', "Your breasts are too small"], + ['tiny@spammer.com', "Your penis is too small"], + ['dumbass@spammer.com', "You are not very smart"], + ['bankrobber@spammer.com', "You need more money"], + ['loser@spammer.com', "You need better friends"], + ['gossip@spammer.com', "Find out what your coworkers think about you"], ['whoami@spammer.com', "Find out what you think about yourself"], - ['downsized@spammer.com', "You need a better job"], - ['poorhouse@spammer.com', "Your mortgage is a joke"], + ['downsized@spammer.com', "You need a better job"], + ['poorhouse@spammer.com', "Your mortgage is a joke"], ['spam4ever@spammer.com', "You need more spam"] ].each{|frm, subj| item = t.item_create @@ -115,8 +115,8 @@ def demoMailWasher(t) if $Version_1_1_OrLater delete = [false, true][rand(2)] bounce = [false, true][rand(2)] - t.item_style_set(item, - 0, 'styCheck', 1, 'styCheck', 2, status, 3, 'styAny', + t.item_style_set(item, + 0, 'styCheck', 1, 'styCheck', 2, status, 3, 'styAny', 4, 'styAny', 5, 'styAny', 6, 'styAny', 7, attachments) t.item_state_forcolumn(item, 'delete', 'CHECK') if delete t.item_state_forcolumn(item, 'bounce', 'CHECK') if bounce @@ -124,8 +124,8 @@ def demoMailWasher(t) else # TreeCtrl 1.0 delete = ['styOn', 'styOff'][rand(2)] bounce = ['styOn', 'styOff'][rand(2)] - t.item_style_set(item, - 0, delete, 1, bounce, 2, status, 3, 'styAny', + t.item_style_set(item, + 0, delete, 1, bounce, 2, status, 3, 'styAny', 4, 'styAny', 5, 'styAny', 6, 'styAny', 7, attachments) end @@ -138,7 +138,7 @@ def demoMailWasher(t) } sortColumn = 6 - t.notify_bind(t, 'Header-invoke', + t.notify_bind(t, 'Header-invoke', proc{|c, w| if c == sortColumn if w.column_cget(sortColumn, :arrow) == 'down' @@ -162,35 +162,35 @@ def demoMailWasher(t) w.column_configure(c, :arrow=>arrow) case w.column_cget(c, :tag) when 'bounce', 'delete' - w.item_sort(:root, order, - { - :column=>c, + w.item_sort(:root, order, + { + :column=>c, :command=>proc{|item1, item2| compareOnOff(w, c, item1, item2) } - }, + }, { :column=>'subject', :dictionary=>true }) when 'status' - w.item_sort(:root, order, + w.item_sort(:root, order, { :column=>c, :dictionary=>true }) when 'from' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'subject' - w.item_sort(:root, order, + w.item_sort(:root, order, { :column=>c, :dictionary=>true }) when 'size' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'received' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) when 'attachments' - w.item_sort(:root, order, - { :column=>c, :dictionary=>true }, + w.item_sort(:root, order, + { :column=>c, :dictionary=>true }, { :column=>'subject', :dictionary=>true }) end }, '%C %T') @@ -198,7 +198,7 @@ def demoMailWasher(t) mailWasher = TkBindTag.new if $Version_1_1_OrLater - mailWasher.bind('ButtonPress-1', + mailWasher.bind('ButtonPress-1', proc{|w, x, y| id = w.identify(x, y) if id.empty? @@ -214,7 +214,7 @@ def demoMailWasher(t) end }, '%W %x %y') else # TreeCtrl 1.0 - mailWasher.bind('ButtonPress-1', + mailWasher.bind('ButtonPress-1', proc{|w, x, y| id = w.identify(x, y) if id.empty? diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb b/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb index c3af86868e..d966807866 100644 --- a/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb +++ b/ext/tk/sample/tkextlib/treectrl/outlook-folders.rb @@ -7,7 +7,7 @@ def demoOutlookFolders(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>true, + t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>true, :showroot=>true, :showrootbutton=>false, :showbuttons=>true) if $HasColumnCreate @@ -17,15 +17,15 @@ def demoOutlookFolders(t) end t.element_create('e1', :image) - t.element_create('e2', :text, :lines=>1, + t.element_create('e2', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('e3', :text, :lines=>1, :font=>t.font.dup.weight(:bold), + t.element_create('e3', :text, :lines=>1, :font=>t.font.dup.weight(:bold), :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('e4', :text, :fill=>'blue') t.element_create('e5', :image, :image=>@images['outlook-folder']) - t.element_create('e6', :rect, :showfocus=>true, + t.element_create('e6', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -60,28 +60,28 @@ def demoOutlookFolders(t) t.style_layout(s, 'e6', :union=>['e3'], :iexpand=>:ns, :ipadx=>2) t.item_style_set(:root, 0, 's1') - t.item_complex(:root, + t.item_complex(:root, [ - ['e1', {:image=>@images['outlook-main']}], + ['e1', {:image=>@images['outlook-main']}], ['e2', {:text=>'Outlook Express'}] ]) parentList = [:root, '', '', '', '', '', ''] parent = :root [ - [0, :local, "Local Folders", true, 0], - [1, :inbox, 'Inbox', false, 5], - [1, :outbox, 'Outbox', false, 0], - [1, :sent, "Sent Items", false, 0], - [1, :deleted, "Deleted Items", false, 50], - [1, :draft, 'Drafts', false, 0], - [1, :folder, "Messages to Dad", false, 0], - [1, :folder, "Messages to Sis", false, 0], - [1, :folder, "Messages to Me", false, 0], - [2, :folder, "2001", false, 0], - [2, :folder, "2000", false, 0], - [2, :folder, "1999", false, 0], - [0, :server, "news.gmane.org", true, 0], + [0, :local, "Local Folders", true, 0], + [1, :inbox, 'Inbox', false, 5], + [1, :outbox, 'Outbox', false, 0], + [1, :sent, "Sent Items", false, 0], + [1, :deleted, "Deleted Items", false, 50], + [1, :draft, 'Drafts', false, 0], + [1, :folder, "Messages to Dad", false, 0], + [1, :folder, "Messages to Sis", false, 0], + [1, :folder, "Messages to Me", false, 0], + [2, :folder, "2001", false, 0], + [2, :folder, "2000", false, 0], + [2, :folder, "1999", false, 0], + [0, :server, "news.gmane.org", true, 0], [1, :group, "gmane.comp.lang.lua.general", false, 498] ].each{|depth, img, text, button, unread| if $Version_1_1_OrLater @@ -93,7 +93,7 @@ def demoOutlookFolders(t) if img == :folder if unread != 0 t.item_style_set(item, 0, 's4') - t.item_complex(item, + t.item_complex(item, [['e3', {:text=>text}], ['e4', {:text=>"(#{unread})"}]]) else t.item_style_set(item, 0, 's3') @@ -102,17 +102,17 @@ def demoOutlookFolders(t) else if unread != 0 t.item_style_set(item, 0, 's2') - t.item_complex(item, + t.item_complex(item, [ - ['e1', {:image=>@images["outlook-#{img}"]}], - ['e3', {:text=>text}], + ['e1', {:image=>@images["outlook-#{img}"]}], + ['e3', {:text=>text}], ['e4', {:text=>"(#{unread})"}] ]) else t.item_style_set(item, 0, 's1') - t.item_complex(item, + t.item_complex(item, [ - ['e1', {:image=>@images["outlook-#{img}"]}], + ['e1', {:image=>@images["outlook-#{img}"]}], ['e2', {:text=>text}] ]) end diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb index d7e7f7e004..3495522e5c 100644 --- a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb +++ b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb @@ -6,7 +6,7 @@ def demoOutlookNewsgroup(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, + t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, :showroot=>false, :showrootbutton=>false, :showbuttons=>true) if $Version_1_1_OrLater @@ -24,7 +24,7 @@ def demoOutlookNewsgroup(t) t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject') t.column_configure(4, :text=>'From', :width=>150, :tag=>'from') t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent') - t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right, + t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right, :tag=>'size') end @@ -37,35 +37,35 @@ def demoOutlookNewsgroup(t) # State for a message with unread descendants t.state_define('unread') - t.element_create('elemImg', :image, + t.element_create('elemImg', :image, :image=>[ - @sel_images['outlook-read-2'], - ['selected', 'read', 'unread', '!open'], + @sel_images['outlook-read-2'], + ['selected', 'read', 'unread', '!open'], @images['outlook-read-2'], ['read', 'unread', '!open'], - @sel_images['outlook-read'], ['selected', 'read'], - @images['outlook-read'], ['read'], - @sel_images['outlook-unread'], ['selected'], + @sel_images['outlook-read'], ['selected', 'read'], + @images['outlook-read'], ['read'], + @sel_images['outlook-unread'], ['selected'], @images['outlook-unread'], [] ]) - t.element_create('elemTxt', :text, :lines=>1, - :fill=>[@SystemHighlightText, ['selected', 'focus']], + t.element_create('elemTxt', :text, :lines=>1, + :fill=>[@SystemHighlightText, ['selected', 'focus']], :font=>[ - t.font.dup.weight(:bold), ['read', 'unread', '!open'], + t.font.dup.weight(:bold), ['read', 'unread', '!open'], t.font.dup.weight(:bold), ['!read'] ]) - t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true, + t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) - t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true, + t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) - t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true, + t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -74,7 +74,7 @@ def demoOutlookNewsgroup(t) t.style_elements(s, ['sel.e', 'elemImg', 'elemTxt']) t.style_layout(s, 'elemImg', :expand=>:ns) t.style_layout(s, 'elemTxt', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) - t.style_layout(s, 'sel.e', :union=>['elemTxt'], + t.style_layout(s, 'sel.e', :union=>['elemTxt'], :iexpand=>:nes, :ipadx=>[2,0]) # Text @@ -168,12 +168,12 @@ def demoOutlookNewsgroup(t) } # Do something when the selection changes - t.notify_bind(t, 'Selection', + t.notify_bind(t, 'Selection', proc{|w| if w.selection_count == 1 # One item is selected if @Message[:afterId][:id] - Tk.after_cancel(@Message[:afterId][:id]) + Tk.after_cancel(@Message[:afterId][:id]) end @Message[:afterId][:item] = w.selection_get[0] @Message[:afterId][:id] = Tk.after(500, proc{ @@ -208,7 +208,7 @@ def demoOutlookNewsgroup2(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, + t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, :showroot=>false, :showrootbutton=>false, :showbuttons=>true) if $Version_1_1_OrLater @@ -226,7 +226,7 @@ def demoOutlookNewsgroup2(t) t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject') t.column_configure(4, :text=>'From', :width=>150, :tag=>'from') t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent') - t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right, + t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right, :tag=>'size') end @@ -235,24 +235,24 @@ def demoOutlookNewsgroup2(t) t.element_create('image.unread', :image, :image=>@images['outlook-unread']) t.element_create('image.read', :image, :image=>@images['outlook-read']) t.element_create('image.read2', :image, :image=>@images['outlook-read-2']) - t.element_create('text.read', :text, :lines=>1, + t.element_create('text.read', :text, :lines=>1, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('text.unread', :text, :lines=>1, - :fill=>[@SystemHighlightText, ['selected', 'focus']], + t.element_create('text.unread', :text, :lines=>1, + :fill=>[@SystemHighlightText, ['selected', 'focus']], :font=>t.font.dup.weight(:bold)) - t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true, + t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) - t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true, + t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) - t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true, + t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -261,7 +261,7 @@ def demoOutlookNewsgroup2(t) t.style_elements(s, ['sel.e', 'image.unread', 'text.unread']) t.style_layout(s, 'image.unread', :expand=>:ns) t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) - t.style_layout(s, 'sel.e', :union=>['text.unread'], + t.style_layout(s, 'sel.e', :union=>['text.unread'], :iexpand=>:nes, :ipadx=>[2,0]) # Image + text @@ -269,7 +269,7 @@ def demoOutlookNewsgroup2(t) t.style_elements(s, ['sel.e', 'image.read', 'text.read']) t.style_layout(s, 'image.read', :expand=>:ns) t.style_layout(s, 'text.read', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) - t.style_layout(s, 'sel.e', :union=>['text.read'], + t.style_layout(s, 'sel.e', :union=>['text.read'], :iexpand=>:nes, :ipadx=>[2,0]) # Image + text @@ -277,7 +277,7 @@ def demoOutlookNewsgroup2(t) t.style_elements(s, ['sel.e', 'image.read2', 'text.unread']) t.style_layout(s, 'image.read2', :expand=>:ns) t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns) - t.style_layout(s, 'sel.e', :union=>['text.unread'], + t.style_layout(s, 'sel.e', :union=>['text.unread'], :iexpand=>:nes, :ipadx=>[2,0]) # Text @@ -350,7 +350,7 @@ def demoOutlookNewsgroup2(t) style = 'unread' style2 = 'unread2' end - t.item_style_set(i, 3, style, 4, "#{style2}.we", 5, "#{style2}.we", + t.item_style_set(i, 3, style, 4, "#{style2}.we", 5, "#{style2}.we", 6, "#{style2}.w") t.item_text(i, 3, subject, 4, from, 5, sent, 6, size) if t.item_numchildren(i) > 0 @@ -359,24 +359,24 @@ def demoOutlookNewsgroup2(t) } # Do something when the selection changes - t.notify_bind(t, 'Selection', + t.notify_bind(t, 'Selection', proc{|w| if w.selection_count == 1 i = t.selection_get[0] unless @Message[:read][i] if t.item_isopen(i) || !anyUnreadDescendants(t, i) # unread -> read - t.item_style_map(i, 'subject', 'read', + t.item_style_map(i, 'subject', 'read', ['text.unread', 'text.read']) - t.item_style_map(i, 'from', 'read.we', + t.item_style_map(i, 'from', 'read.we', ['text.unread', 'text.read']) - t.item_style_map(i, 'sent', 'read.we', + t.item_style_map(i, 'sent', 'read.we', ['text.unread', 'text.read']) - t.item_style_map(i, 'size', 'read.w', + t.item_style_map(i, 'size', 'read.w', ['text.unread', 'text.read']) else # unread -> read2 - t.item_style_map(i, 'subject', 'read2', + t.item_style_map(i, 'subject', 'read2', ['text.unread', 'text.unread']) end @@ -386,34 +386,34 @@ def demoOutlookNewsgroup2(t) end }, '%T') - t.notify_bind(t, 'Expand-after', + t.notify_bind(t, 'Expand-after', proc{|w, i| if @Messge[:read][i] && anyUnreadDescendants(t, i) # read2 -> read - t.item_style_map(i, 'subject', 'read', + t.item_style_map(i, 'subject', 'read', ['text.unread', 'text.read']) # unread -> read - t.item_style_map(i, 'from', 'read.we', + t.item_style_map(i, 'from', 'read.we', ['text.unread', 'text.read']) - t.item_style_map(i, 'sent', 'read.we', + t.item_style_map(i, 'sent', 'read.we', ['text.unread', 'text.read']) - t.item_style_map(i, 'size', 'read.w', + t.item_style_map(i, 'size', 'read.w', ['text.unread', 'text.read']) end }, '%T %I') - t.notify_bind(t, 'Collapse-after', + t.notify_bind(t, 'Collapse-after', proc{|w, i| if @Messge[:read][i] && anyUnreadDescendants(t, i) # read -> read2 - t.item_style_map(i, 'subject', 'read2', + t.item_style_map(i, 'subject', 'read2', ['text.read', 'text.unread']) # read -> unread - t.item_style_map(i, 'from', 'unread.we', + t.item_style_map(i, 'from', 'unread.we', ['text.read', 'text.unread']) - t.item_style_map(i, 'sent', 'unread.we', + t.item_style_map(i, 'sent', 'unread.we', ['text.read', 'text.unread']) - t.item_style_map(i, 'size', 'unread.w', + t.item_style_map(i, 'size', 'unread.w', ['text.read', 'text.unread']) end }, '%T %I') diff --git a/ext/tk/sample/tkextlib/treectrl/random.rb b/ext/tk/sample/tkextlib/treectrl/random.rb index 2c9e614aa5..43aca63283 100644 --- a/ext/tk/sample/tkextlib/treectrl/random.rb +++ b/ext/tk/sample/tkextlib/treectrl/random.rb @@ -1,4 +1,4 @@ -# +# def random_N @RandomN[0] || 500 end @@ -11,39 +11,39 @@ def demoRandom(t) height = t.font.metrics(:linespace) height = 18 if height < 18 - t.configure(:itemheight=>height, :selectmode=>:extended, - :showroot=>true, :showrootbutton=>true, :showbuttons=>true, - :showlines=>true, :scrollmargin=>16, + t.configure(:itemheight=>height, :selectmode=>:extended, + :showroot=>true, :showrootbutton=>true, :showbuttons=>true, + :showlines=>true, :scrollmargin=>16, :xscrolldelay=>[500, 50], :yscrolldelay=>[500, 50]) if $Version_1_1_OrLater - t.column_create(:expand=>true, :text=>'Item', + t.column_create(:expand=>true, :text=>'Item', :itembackground=>['#e0e8f0', []], :tag=>'item') - t.column_create(:text=>'Parent', :justify=>:center, + t.column_create(:text=>'Parent', :justify=>:center, :itembackground=>['gray90', []], :tag=>'parent') - t.column_create(:text=>'Depth', :justify=>:center, + t.column_create(:text=>'Depth', :justify=>:center, :itembackground=>['linen', []], :tag=>'depth') else # TreeCtrl 1.0 - t.column_configure(0, :expand=>true, :text=>'Item', + t.column_configure(0, :expand=>true, :text=>'Item', :itembackground=>['#e0e8f0', []], :tag=>'item') - t.column_configure(1, :text=>'Parent', :justify=>:center, + t.column_configure(1, :text=>'Parent', :justify=>:center, :itembackground=>['gray90', []], :tag=>'parent') - t.column_configure(2, :text=>'Depth', :justify=>:center, + t.column_configure(2, :text=>'Depth', :justify=>:center, :itembackground=>['linen', []], :tag=>'depth') end t.element_create('e1', :image, :image=>[ - @images['folder-open'], ['open'], + @images['folder-open'], ['open'], @images['folder-closed'], [] ]) t.element_create('e2', :image, :image=>@images['small-file']) - t.element_create('e3', :text, + t.element_create('e3', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) t.element_create('e4', :text, :fill=>'blue') t.element_create('e6', :text) - t.element_create('e5', :rect, :showfocus=>true, + t.element_create('e5', :rect, :showfocus=>true, :fill=>[ - @SystemHighlight, ['selected', 'focus'], + @SystemHighlight, ['selected', 'focus'], 'gray', ['selected', '!focus'] ]) @@ -65,11 +65,11 @@ def demoRandom(t) t.style_layout(s, 'e6', :padx=>6, :expand=>:ns) @Priv[:sensitive, t] = [ - [:item, 's1', 'e5', 'e1', 'e3'], + [:item, 's1', 'e5', 'e1', 'e3'], [:item, 's2', 'e5', 'e2', 'e3'] ] @Priv[:dragimage, t] = [ - [:item, 's1', 'e1', 'e3'], + [:item, 's1', 'e1', 'e3'], [:item, 's2', 'e2', 'e3'] ] @@ -108,16 +108,16 @@ def demoRandom(t) t.item_hasbutton(item_i, true) end t.item_style_set(item_i, 0, 's1', 1, 's3', 2, 's3') - t.item_complex(item_i, - [ ['e3', {:text=>"Item #{i}"}], - ['e4', {:text=>"(#{numChildren})"}] ], - [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ], + t.item_complex(item_i, + [ ['e3', {:text=>"Item #{i}"}], + ['e4', {:text=>"(#{numChildren})"}] ], + [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ], [ ['e6', {:text=>"#{t.depth(item_i)}"}] ]) else t.item_style_set(item_i, 1, 's3', 2, 's3', 0, 's2') - t.item_complex(item_i, - [ ['e3', {:text=>"Item #{i}"}] ], - [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ], + t.item_complex(item_i, + [ ['e3', {:text=>"Item #{i}"}] ], + [ ['e6', {:text=>"#{t.item_parent(item_i)}"}] ], [ ['e6', {:text=>"#{t.depth(item_i)}"}] ]) end } @@ -125,46 +125,46 @@ def demoRandom(t) treeCtrlRandom = TkBindTag.new - treeCtrlRandom.bind('Double-ButtonPress-1', + treeCtrlRandom.bind('Double-ButtonPress-1', proc{|w, x, y| Tk::TreeCtrl::BindCallback.doubleButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('Control-ButtonPress-1', + treeCtrlRandom.bind('Control-ButtonPress-1', proc{|w, x, y| @Priv['selectMode'] = :toggle randomButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('Shift-ButtonPress-1', + treeCtrlRandom.bind('Shift-ButtonPress-1', proc{|w, x, y| @Priv['selectMode'] = :add randomButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('ButtonPress-1', + treeCtrlRandom.bind('ButtonPress-1', proc{|w, x, y| @Priv['selectMode'] = :set randomButton1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('Button1-Motion', + treeCtrlRandom.bind('Button1-Motion', proc{|w, x, y| randomMotion1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('Button1-Leave', + treeCtrlRandom.bind('Button1-Leave', proc{|w, x, y| randomLeave1(w, x, y) Tk.callback_break }, '%W %x %y') - treeCtrlRandom.bind('ButtonRelease-1', + treeCtrlRandom.bind('ButtonRelease-1', proc{|w, x, y| randomRelease1(w, x, y) Tk.callback_break @@ -363,7 +363,7 @@ def randomRelease1(t, x, y) t.selection_modify('', @Priv[:drop]) t[:cursor] = '' if @Priv[:drop] != '' - randomDrop(t, @Priv[:drop], @Priv.list_element(:selection), + randomDrop(t, @Priv[:drop], @Priv.list_element(:selection), @Priv[:drop, :pos]) end end @@ -479,7 +479,7 @@ def randomAutoScanCheck(t, x, y) when 'drag', 'marquee' randomMotion(t, x, y) end - @Priv[:autoscan, :afterId, t] = + @Priv[:autoscan, :afterId, t] = Tk.after(delay, proc{ randomAutoScanCheckAux(t) }) end return @@ -502,7 +502,7 @@ def demoRandom2(t) init_pics('mac-*') - t.configure(:openbuttonimage=>@images['mac-collapse'], - :closedbuttonimage=>@images['mac-expand'], + t.configure(:openbuttonimage=>@images['mac-collapse'], + :closedbuttonimage=>@images['mac-expand'], :showlines=>false) end diff --git a/ext/tk/sample/tkextlib/treectrl/www-options.rb b/ext/tk/sample/tkextlib/treectrl/www-options.rb index efa55ca06c..6a3e9c2201 100644 --- a/ext/tk/sample/tkextlib/treectrl/www-options.rb +++ b/ext/tk/sample/tkextlib/treectrl/www-options.rb @@ -3,7 +3,7 @@ def demoInternetOptions (t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('internet-*') @@ -19,14 +19,14 @@ def demoInternetOptions (t) t.state_define('on') t.element_create('e1', :image, :image=>[ - @images['internet-check-on'], ['check', 'on'], - @images['internet-check-off'], ['check'], - @images['internet-radio-on'], ['radio', 'on'], + @images['internet-check-on'], ['check', 'on'], + @images['internet-check-off'], ['check'], + @images['internet-radio-on'], ['radio', 'on'], @images['internet-radio-off'], ['radio'] ]) - t.element_create('e2', :text, + t.element_create('e2', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('e3', :rect, :showfocus=>true, + t.element_create('e3', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) s = t.style_create('s1') @@ -38,18 +38,18 @@ def demoInternetOptions (t) parentList = [:root, '', '', '', '', '', ''] parent = :root [ - [0, :print, "Printing", "", ""], - [1, :off, "Print background colors and images", "o1", ""], - [0, :search, "Search from Address bar", "", ""], - [1, :search, "When searching", "", ""], - [2, :off, "Display results, and go to the most likely sites", - "o2", "r1"], - [2, :off, "Do not search from the Address bar", "o3", "r1"], - [2, :off, "Just display the results in the main window", + [0, :print, "Printing", "", ""], + [1, :off, "Print background colors and images", "o1", ""], + [0, :search, "Search from Address bar", "", ""], + [1, :search, "When searching", "", ""], + [2, :off, "Display results, and go to the most likely sites", + "o2", "r1"], + [2, :off, "Do not search from the Address bar", "o3", "r1"], + [2, :off, "Just display the results in the main window", "o4", "r1"], - [2, :on, "Just go to the most likely site", "o5", "r1"], - [0, :security, "Security", "", ""], - [1, :on, "Check for publisher's certificate revocation", "o5", ""], + [2, :on, "Just go to the most likely site", "o5", "r1"], + [0, :security, "Security", "", ""], + [1, :on, "Check for publisher's certificate revocation", "o5", ""], [1, :off, "Check for server certificate revocation (requires restart)", "o6", ""] ].each{|depth, setting, text, option, group| @@ -73,7 +73,7 @@ def demoInternetOptions (t) t.item_state_set(item, 'radio') end else - t.item_element_configure(item, 0, 'e1', + t.item_element_configure(item, 0, 'e1', :image=>@images["internet-#{setting}"]) end t.item_lastchild(parentList[depth], item) @@ -146,7 +146,7 @@ end def demoInternetOptions_2(t) height = t.font.metrics(:linespace) + 2 height = 18 if height < 18 - t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, + t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) init_pics('internet-*') @@ -154,9 +154,9 @@ def demoInternetOptions_2(t) t.column_configure(0, :text=>'Internet Options') t.element_create('e1', :image) - t.element_create('e2', :text, + t.element_create('e2', :text, :fill=>[@SystemHighlightText, ['selected', 'focus']]) - t.element_create('e3', :rect, :showfocus=>true, + t.element_create('e3', :rect, :showfocus=>true, :fill=>[@SystemHighlight, ['selected', 'focus']]) s = t.style_create('s1') @@ -168,18 +168,18 @@ def demoInternetOptions_2(t) parentList = [:root, '', '', '', '', '', ''] parent = :root [ - [0, :print, "Printing", "", ""], - [1, :off, "Print background colors and images", "o1", ""], - [0, :search, "Search from Address bar", "", ""], - [1, :search, "When searching", "", ""], - [2, :off, "Display results, and go to the most likely sites", - "o2", "r1"], - [2, :off, "Do not search from the Address bar", "o3", "r1"], - [2, :off, "Just display the results in the main window", + [0, :print, "Printing", "", ""], + [1, :off, "Print background colors and images", "o1", ""], + [0, :search, "Search from Address bar", "", ""], + [1, :search, "When searching", "", ""], + [2, :off, "Display results, and go to the most likely sites", + "o2", "r1"], + [2, :off, "Do not search from the Address bar", "o3", "r1"], + [2, :off, "Just display the results in the main window", "o4", "r1"], - [2, :on, "Just go to the most likely site", "o5", "r1"], - [0, :security, "Security", "", ""], - [1, :on, "Check for publisher's certificate revocation", "o5", ""], + [2, :on, "Just go to the most likely site", "o5", "r1"], + [0, :security, "Security", "", ""], + [1, :on, "Check for publisher's certificate revocation", "o5", ""], [1, :off, "Check for server certificate revocation (requires restart)", "o6", ""] ].each{|depth, setting, text, option, group| @@ -201,7 +201,7 @@ def demoInternetOptions_2(t) t.item_element_configure(item, 0, 'e1', :image=>img) end else - t.item_element_configure(item, 0, 'e1', + t.item_element_configure(item, 0, 'e1', :image=>@images["internet-#{setting}"]) end t.item_lastchild(parentList[depth], item) @@ -256,16 +256,16 @@ def optionButton1_2(w, x, y) else setting = :on end - w.item_element_configure(item, 0, 'e1', + w.item_element_configure(item, 0, 'e1', :image=>@images["internet-check-#{setting}"]) @Option[:setting, item] = setting else # a radiobutton current = @Option[:current, group] return if current == item.to_s - w.item_element_configure(current, 0, 'e1', + w.item_element_configure(current, 0, 'e1', :image=>@images["internet-radio-off"]) - w.item_element_configure(item, 0, 'e1', + w.item_element_configure(item, 0, 'e1', :image=>@images["internet-radio-on"]) @Option[:setting, item] = :on @Option[:current, group] = item diff --git a/ext/tk/sample/tkextlib/vu/canvItems.rb b/ext/tk/sample/tkextlib/vu/canvItems.rb index 33acf4f7e7..364f87613b 100644 --- a/ext/tk/sample/tkextlib/vu/canvItems.rb +++ b/ext/tk/sample/tkextlib/vu/canvItems.rb @@ -9,63 +9,63 @@ xbm = File.join(File.dirname(File.expand_path(__FILE__)), 'm128_000.xbm') sval = [ 11, 22, 33, 44, 55, 66, 77, 88, 99 ] -l0 = TkLabel.new(:width=>128, :height=>128, +l0 = TkLabel.new(:width=>128, :height=>128, :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) -c0 = TkCanvas.new(:width=>80, :height=>80, - :insertwidth=>0, :highlightthickness=>0, - :selectborderwidth=>0, :borderwidth=>2, - :relief=>:ridge).place(:in=>l0, :relx=>0.5, :rely=>0.5, +c0 = TkCanvas.new(:width=>80, :height=>80, + :insertwidth=>0, :highlightthickness=>0, + :selectborderwidth=>0, :borderwidth=>2, + :relief=>:ridge).place(:in=>l0, :relx=>0.5, :rely=>0.5, :anchor=>:c) -st = Tk::Vu::TkcStripchart.new(c0, 3, 3, 80, 80, - :background=>"#b7c0d7", :fill=>'slategray3', - :jumpscroll=>1, :outline=>'black', - :scaleline=>'blue', :stripline=>'red', +st = Tk::Vu::TkcStripchart.new(c0, 3, 3, 80, 80, + :background=>"#b7c0d7", :fill=>'slategray3', + :jumpscroll=>1, :outline=>'black', + :scaleline=>'blue', :stripline=>'red', :selected=>1, :values=>sval) -TkcText.create(c0, 40, 40, +TkcText.create(c0, 40, 40, :text=>Tk::TCL_PATCHLEVEL, :fill=>'cyan', :tags=>'text') -l1 = TkLabel.new(:width=>128, :height=>128, +l1 = TkLabel.new(:width=>128, :height=>128, :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) -c1 = TkCanvas.new(:width=>80, :height=>80, - :insertwidth=>0, :highlightthickness=>0, - :selectborderwidth=>0, :borderwidth=>2, - :relief=>:ridge).place(:in=>l1, :relx=>0.5, :rely=>0.5, +c1 = TkCanvas.new(:width=>80, :height=>80, + :insertwidth=>0, :highlightthickness=>0, + :selectborderwidth=>0, :borderwidth=>2, + :relief=>:ridge).place(:in=>l1, :relx=>0.5, :rely=>0.5, :anchor=>:c) -bar1 = Tk::Vu::TkcBarchart.new(c1, 3, 3, 80, 80, - :background=>"#b7c0d7", :scalevalue=>10.0, - :autocolor=>true, :selected=>1, - :outline=>'black', :barline=>'yellow', +bar1 = Tk::Vu::TkcBarchart.new(c1, 3, 3, 80, 80, + :background=>"#b7c0d7", :scalevalue=>10.0, + :autocolor=>true, :selected=>1, + :outline=>'black', :barline=>'yellow', :scalelinestyle=>0) -bar2 = Tk::Vu::TkcBarchart.new(c1, 53, 3, 80, 80, - :background=>"#b7c0d7", :scalevalue=>10.0, - :autocolor=>true, :selected=>1, - :outline=>'black', :fill=>"#b7c0d7", +bar2 = Tk::Vu::TkcBarchart.new(c1, 53, 3, 80, 80, + :background=>"#b7c0d7", :scalevalue=>10.0, + :autocolor=>true, :selected=>1, + :outline=>'black', :fill=>"#b7c0d7", :barline=>'red', :scalelinestyle=>22) -l2 = TkLabel.new(:width=>128, :height=>128, +l2 = TkLabel.new(:width=>128, :height=>128, :bitmap=>"@#{xbm}", :relief=>:groove).pack(:side=>:left) -c2 = TkCanvas.new(:width=>80, :height=>80, - :insertwidth=>0, :highlightthickness=>0, - :selectborderwidth=>0, :borderwidth=>2, - :relief=>:ridge).place(:in=>l2, :relx=>0.5, :rely=>0.5, +c2 = TkCanvas.new(:width=>80, :height=>80, + :insertwidth=>0, :highlightthickness=>0, + :selectborderwidth=>0, :borderwidth=>2, + :relief=>:ridge).place(:in=>l2, :relx=>0.5, :rely=>0.5, :anchor=>:c) begin - stick = Tk::Vu::TkcSticker.new(c2, 3, 3, 80, 80, - :text=>"Tcl/Tk", :space=>0, :color=>'red', - :outline=>'red', :font=>'Helvetica 14 bold', - :fill=>'', :stipple=>'', :bar=>'blue', - :orient=>:vertical, :anchor=>:s, - :relheight=>1.0, :relwidth=>0.15, + stick = Tk::Vu::TkcSticker.new(c2, 3, 3, 80, 80, + :text=>"Tcl/Tk", :space=>0, :color=>'red', + :outline=>'red', :font=>'Helvetica 14 bold', + :fill=>'', :stipple=>'', :bar=>'blue', + :orient=>:vertical, :anchor=>:s, + :relheight=>1.0, :relwidth=>0.15, :relx=>0.1, :rely=>0.0) rescue stick = nil diff --git a/ext/tk/sample/tkextlib/vu/canvSticker.rb b/ext/tk/sample/tkextlib/vu/canvSticker.rb index e2cd604975..85713ebcf3 100644 --- a/ext/tk/sample/tkextlib/vu/canvSticker.rb +++ b/ext/tk/sample/tkextlib/vu/canvSticker.rb @@ -14,7 +14,7 @@ c = TkCanvas.new.pack begin st = Tk::Vu::TkcSticker.new(c, 0, 0, 10, 10) rescue - Tk.messageBox(:type=>'ok', :title=>"No sticker Item", + Tk.messageBox(:type=>'ok', :title=>"No sticker Item", :message=>"This build of vu does not include the sticker item") exit end @@ -56,7 +56,7 @@ steps << proc{ steps << proc{ puts 'A vertical bar appears in the lower right region and text jumps to the left.' - st.configure(:anchor=>:n, :relw=>0.3, :relh=>0.7, + st.configure(:anchor=>:n, :relw=>0.3, :relh=>0.7, :relx=>0.6, :rely=>0.3, :bar=>'red') } diff --git a/ext/tk/sample/tkextlib/vu/canvSticker2.rb b/ext/tk/sample/tkextlib/vu/canvSticker2.rb index 548a72c2cb..3d9495ffb0 100644 --- a/ext/tk/sample/tkextlib/vu/canvSticker2.rb +++ b/ext/tk/sample/tkextlib/vu/canvSticker2.rb @@ -10,7 +10,7 @@ c = TkCanvas.new.pack begin st = Tk::Vu::TkcSticker.new(c, 0, 0, 10, 10) rescue - Tk.messageBox(:type=>'ok', :title=>"No sticker Item", + Tk.messageBox(:type=>'ok', :title=>"No sticker Item", :message=>"This build of vu does not include the sticker item") exit end @@ -22,7 +22,7 @@ c.destroy #sti_conf = [ [10, 10, 180, 180], "Sticker äöüß@²³¼½¾", :center ] #txt_conf = [ [210, 210], "Text äöüß@²³¼½¾", :center ] -sti_conf = [ [10, 10, 350, 350], +sti_conf = [ [10, 10, 350, 350], Tk::UTF8_String('Sticker \u00E4\u00F6\u00FC\u00DF\u0040\u00B2\u00B3\u00BC\u00BD\u00BE'), :center ] txt_conf = [ [250, 250], diff --git a/ext/tk/sample/tkextlib/vu/dial_demo.rb b/ext/tk/sample/tkextlib/vu/dial_demo.rb index 09bd3e9186..f1f2f110b1 100644 --- a/ext/tk/sample/tkextlib/vu/dial_demo.rb +++ b/ext/tk/sample/tkextlib/vu/dial_demo.rb @@ -12,61 +12,61 @@ v_rot = TkVariable.new v_linked = TkVariable.new v_needle = TkVariable.new -volume = Tk::Vu::Dial.new(:label=>"Volume", :from=>-0.1, :to=>0.1, - :resolution=>0.001, :minortickinterval=>0.01, - :tickinterval=>0.1, :beginangle=>-20, +volume = Tk::Vu::Dial.new(:label=>"Volume", :from=>-0.1, :to=>0.1, + :resolution=>0.001, :minortickinterval=>0.01, + :tickinterval=>0.1, :beginangle=>-20, :endangle=>260, :variable=>v_volume) -speed = Tk::Vu::Dial.new(:label=>"Speed", :from=>2000, :to=>100, - :resolution=>10, :tickinterval=>100, - :minortickinterval=>0, :variable=>v_speed, +speed = Tk::Vu::Dial.new(:label=>"Speed", :from=>2000, :to=>100, + :resolution=>10, :tickinterval=>100, + :minortickinterval=>0, :variable=>v_speed, :showtags=>:label, :showvalue=>false) speed.set_tag_constrain(100, 'Fast', 2000, 'Slow') -fwd = Tk::Vu::Dial.new(:from=>-10.0, :to=>-20.0, :resolution=>0.1, - :tickinterval=>5.0, :minortickinterval=>1.0, +fwd = Tk::Vu::Dial.new(:from=>-10.0, :to=>-20.0, :resolution=>0.1, + :tickinterval=>5.0, :minortickinterval=>1.0, :variable=>v_dir) -rev = Tk::Vu::Dial.new(:from=>-20.0, :to=>-10.0, :resolution=>0.1, - :tickinterval=>5.0, :minortickinterval=>1.0, +rev = Tk::Vu::Dial.new(:from=>-20.0, :to=>-10.0, :resolution=>0.1, + :tickinterval=>5.0, :minortickinterval=>1.0, :variable=>v_dir) -small = Tk::Vu::Dial.new(:font=>"Helvetica -10", :from=>0, :to=>10, +small = Tk::Vu::Dial.new(:font=>"Helvetica -10", :from=>0, :to=>10, :resolution=>0.05, :tickinterval=>2, - :minortickinterval=>0.5, :radius=>20, - :dialcolor=>'red2', :activebackground=>'red', + :minortickinterval=>0.5, :radius=>20, + :dialcolor=>'red2', :activebackground=>'red', :variable=>v_rot) -large = Tk::Vu::Dial.new(:font=>"Helvetica -8", :from=>0, :to=>10, +large = Tk::Vu::Dial.new(:font=>"Helvetica -8", :from=>0, :to=>10, :resolution=>0.05, :tickinterval=>1, - :minortickinterval=>0.25, :radius=>40, - :dialcolor=>'red2', :activebackground=>'red', + :minortickinterval=>0.25, :radius=>40, + :dialcolor=>'red2', :activebackground=>'red', :variable=>v_rot) -turn = Tk::Vu::Dial.new(:needlecolor=>'red', :label=>"Linked", +turn = Tk::Vu::Dial.new(:needlecolor=>'red', :label=>"Linked", :variable=>v_linked) scale = TkScale.new(:label=>"Linked", :variable=>v_linked) -d1 = Tk::Vu::Dial.new(:resolution=>0.0001, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>30, :label=>"Dial", - :beginangle=>-20, :endangle=>260, :variable=>v_needle, +d1 = Tk::Vu::Dial.new(:resolution=>0.0001, :from=>-0.1, :to=>0.1, + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>30, :label=>"Dial", + :beginangle=>-20, :endangle=>260, :variable=>v_needle, :relief=>:raised) -d2 = Tk::Vu::Dial.new(:resolution=>0.01, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>30, :label=>"Dial 2", - :beginangle=>-20, :endangle=>260, :variable=>v_needle, - :dialrelief=>:flat, :needlecolor=>'red', +d2 = Tk::Vu::Dial.new(:resolution=>0.01, :from=>-0.1, :to=>0.1, + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>30, :label=>"Dial 2", + :beginangle=>-20, :endangle=>260, :variable=>v_needle, + :dialrelief=>:flat, :needlecolor=>'red', :needletype=>:triangle, :relief=>:sunken) -d3 = Tk::Vu::Dial.new(:resolution=>0.001, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>30, :label=>"Dial 3", - :beginangle=>-20, :endangle=>260, :variable=>v_needle, - :dialrelief=>:flat, :needlecolor=>'blue', +d3 = Tk::Vu::Dial.new(:resolution=>0.001, :from=>-0.1, :to=>0.1, + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>30, :label=>"Dial 3", + :beginangle=>-20, :endangle=>260, :variable=>v_needle, + :dialrelief=>:flat, :needlecolor=>'blue', :needletype=>:arc, :relief=>:ridge) f_btns = TkFrame.new diff --git a/ext/tk/sample/tkextlib/vu/oscilloscope.rb b/ext/tk/sample/tkextlib/vu/oscilloscope.rb index 2015e46645..1efe13ce01 100644 --- a/ext/tk/sample/tkextlib/vu/oscilloscope.rb +++ b/ext/tk/sample/tkextlib/vu/oscilloscope.rb @@ -22,26 +22,26 @@ geo_t1 = [15, 88] c = TkCanvas.new(:width=>220, :height=>190).pack(:fill=>:both, :expand=>true) #---background -TkcRectangle.new(c, geo_fr, :width=>4, :fill=>'aquamarine3', +TkcRectangle.new(c, geo_fr, :width=>4, :fill=>'aquamarine3', :tags=>['osc', 'frbg']) #---channel 0 -ch0 = Tk::Vu::TkcStripchart.new(c, geo_ch0, - :fill=>'', :jumpscroll=>false, - :outline=>'', :scaleline=>'', +ch0 = Tk::Vu::TkcStripchart.new(c, geo_ch0, + :fill=>'', :jumpscroll=>false, + :outline=>'', :scaleline=>'', :stripline=>'cyan', :tags=>['osc', 'ch0']) #---channel 1 -ch1 = Tk::Vu::TkcStripchart.new(c, geo_ch1, - :fill=>'', :jumpscroll=>0, - :outline=>'', :scaleline=>'', +ch1 = Tk::Vu::TkcStripchart.new(c, geo_ch1, + :fill=>'', :jumpscroll=>0, + :outline=>'', :scaleline=>'', :stripline=>'red', :tags=>['osc', 'ch1']) #---frame TkcRectangle.new(c, geo_fr, :width=>4, :tags=>['osc', 'frfg']) #---position -txt1 = TkcText.new(c, geo_t1, :text=>"B1-Motion: X:%X\tY:%Y", +txt1 = TkcText.new(c, geo_t1, :text=>"B1-Motion: X:%X\tY:%Y", :anchor=>:nw, :tags=>['osc', 'txt1']) #---BINDINGS diff --git a/ext/tk/sample/tkextlib/vu/pie.rb b/ext/tk/sample/tkextlib/vu/pie.rb index ed598d6233..c8f9276e4e 100644 --- a/ext/tk/sample/tkextlib/vu/pie.rb +++ b/ext/tk/sample/tkextlib/vu/pie.rb @@ -26,13 +26,13 @@ quit_btn = TkButton.new(f, :text=>"Exit", :command=>proc{exit}) Tk.grid(pie, :sticky=>:news) Tk.grid(f, :sticky=>:ew) -Tk.pack(fast_btn, slow_btn, quit_btn, +Tk.pack(fast_btn, slow_btn, quit_btn, :in=>f, :side=>:left, :fill=>:both, :expand=>true, :padx=>6, :pady=>4) Tk.root.grid_columnconfigure(0, :weight=>1) Tk.root.grid_rowconfigure(0, :weight=>1) -priv = { +priv = { :x=>0, :y=>0, :pie_in=>false, :angle=>pie[:angle], :origin=>pie[:origin] } @@ -46,9 +46,9 @@ pie.bind('ButtonPress-1', proc{|w, x, y| pie.bind('B1-Motion', proc{|w, x, y| if priv[:pie_in] - w.configure(:angle=>priv[:angle] + (priv[:y] - y)/3, - :origin=>(priv[:origin] + - ((w.winfo_height/2.2 > y)? -1: 1) * + w.configure(:angle=>priv[:angle] + (priv[:y] - y)/3, + :origin=>(priv[:origin] + + ((w.winfo_height/2.2 > y)? -1: 1) * (priv[:x] - x)/3) % 360) end }, '%W %x %y') diff --git a/ext/tk/sample/tkextlib/vu/vu_demo.rb b/ext/tk/sample/tkextlib/vu/vu_demo.rb index d078ae16f2..358d32495f 100644 --- a/ext/tk/sample/tkextlib/vu/vu_demo.rb +++ b/ext/tk/sample/tkextlib/vu/vu_demo.rb @@ -9,13 +9,13 @@ puts "Show off barchart and dial widgets" speed = TkVariable.new(0) -dial = Tk::Vu::Dial.new(:resolution=>0.001, :from=>-0.1, :to=>0.1, - :showvalue=>true, :minortickinterval=>0.01, - :tickinterval=>0.1, :radius=>50, :label=>"Dial", - :beginangle=>-20, :endangle=>260, :dialcolor=>'red3', +dial = Tk::Vu::Dial.new(:resolution=>0.001, :from=>-0.1, :to=>0.1, + :showvalue=>true, :minortickinterval=>0.01, + :tickinterval=>0.1, :radius=>50, :label=>"Dial", + :beginangle=>-20, :endangle=>260, :dialcolor=>'red3', :active=>'red2', :variable=>speed) -bar = Tk::Vu::Bargraph.new(:from=>0, :to=>100, :relief=>:groove, +bar = Tk::Vu::Bargraph.new(:from=>0, :to=>100, :relief=>:groove, :border=>2, :label=>"Bar Chart") ####################################### @@ -26,7 +26,7 @@ purple = 75 current = 50 def rand_bool - + end update = TkTimer.new(200, -1, proc{ @@ -61,7 +61,7 @@ Tk.grid('x', nobar, :sticky=>:ew, :padx=>4, :pady=>4) Tk.grid(quit, '-', '-', :sticky=>:ew, :padx=>4, :pady=>4) Tk.root.grid_columnconfigure(2, :weight=>1) Tk.root.grid_rowconfigure(1, :weight=>1) - + ####################################### Tk.mainloop diff --git a/ext/tk/sample/tkfrom.rb b/ext/tk/sample/tkfrom.rb index 2cece7337e..f51f7f5d85 100644 --- a/ext/tk/sample/tkfrom.rb +++ b/ext/tk/sample/tkfrom.rb @@ -22,7 +22,7 @@ class Mail @body = [] while line = f.gets() $_.chop! - next if /^From / =~ line # skip From-line + next if /^From / =~ line # skip From-line break if /^$/ =~ line # end of header if /^(\S+):\s*(.*)/ =~ line @header[attr = $1.capitalize] = $2 diff --git a/ext/tk/sample/tkhello.rb b/ext/tk/sample/tkhello.rb index 3b505f4983..597c1f6242 100644 --- a/ext/tk/sample/tkhello.rb +++ b/ext/tk/sample/tkhello.rb @@ -1,6 +1,6 @@ require "tk" -TkButton.new(nil, +TkButton.new(nil, :text => 'hello', :command => proc{print "hello\n"}).pack(:fill=>'x') TkButton.new(nil, diff --git a/ext/tk/sample/tkmenubutton.rb b/ext/tk/sample/tkmenubutton.rb index 37f6128fd9..8ae1359425 100644 --- a/ext/tk/sample/tkmenubutton.rb +++ b/ext/tk/sample/tkmenubutton.rb @@ -7,56 +7,56 @@ require 'tk' TkLabel.new(:text=>'Sample of TkMenubutton').pack(:side=>:top) TkFrame.new{|f| - pack(:side=>:top) + pack(:side=>:top) - TkMenubutton.new(:parent=>f, :text=>'Right', :underline=>0, + TkMenubutton.new(:parent=>f, :text=>'Right', :underline=>0, :direction=>:right, :relief=>:raised){|mb| menu TkMenu.new(:parent=>mb, :tearoff=>0){ - add(:command, :label=>'Right menu: first item', - :command=>proc{print 'You have selected the first item' + + add(:command, :label=>'Right menu: first item', + :command=>proc{print 'You have selected the first item' + " from the Right menu.\n"}) - add(:command, :label=>'Right menu: second item', - :command=>proc{print 'You have selected the second item' + + add(:command, :label=>'Right menu: second item', + :command=>proc{print 'You have selected the second item' + " from the Right menu.\n"}) } pack(:side=>:left, :padx=>25, :pady=>25) } - TkMenubutton.new(:parent=>f, :text=>'Below', :underline=>0, + TkMenubutton.new(:parent=>f, :text=>'Below', :underline=>0, :direction=>:below, :relief=>:raised){|mb| menu(TkMenu.new(:parent=>mb, :tearoff=>0){ - add(:command, :label=>'Below menu: first item', - :command=>proc{print 'You have selected the first item' + + add(:command, :label=>'Below menu: first item', + :command=>proc{print 'You have selected the first item' + " from the Below menu.\n"}) - add(:command, :label=>'Below menu: second item', - :command=>proc{print 'You have selected the second item' + + add(:command, :label=>'Below menu: second item', + :command=>proc{print 'You have selected the second item' + " from the Below menu.\n"}) }) pack(:side=>:left, :padx=>25, :pady=>25) } - TkMenubutton.new(:parent=>f, :text=>'Above', :underline=>0, + TkMenubutton.new(:parent=>f, :text=>'Above', :underline=>0, :direction=>:above, :relief=>:raised){|mb| menu TkMenu.new(:parent=>mb, :tearoff=>0){ - add(:command, :label=>'Above menu: first item', - :command=>proc{print 'You have selected the first item' + + add(:command, :label=>'Above menu: first item', + :command=>proc{print 'You have selected the first item' + " from the Above menu.\n"}) - add(:command, :label=>'Above menu: second item', - :command=>proc{print 'You have selected the second item' + + add(:command, :label=>'Above menu: second item', + :command=>proc{print 'You have selected the second item' + " from the Above menu.\n"}) } pack(:side=>:left, :padx=>25, :pady=>25) } - TkMenubutton.new(:parent=>f, :text=>'Left', :underline=>0, + TkMenubutton.new(:parent=>f, :text=>'Left', :underline=>0, :direction=>:left, :relief=>:raised){|mb| menu(TkMenu.new(:parent=>mb, :tearoff=>0){ - add(:command, :label=>'Left menu: first item', - :command=>proc{print 'You have selected the first item' + + add(:command, :label=>'Left menu: first item', + :command=>proc{print 'You have selected the first item' + " from the Left menu.\n"}) - add(:command, :label=>'Left menu: second item', - :command=>proc{print 'You have selected the second item' + + add(:command, :label=>'Left menu: second item', + :command=>proc{print 'You have selected the second item' + " from the Left menu.\n"}) }) pack(:side=>:left, :padx=>25, :pady=>25) @@ -64,20 +64,20 @@ TkFrame.new{|f| } ############################ -TkFrame.new(:borderwidth=>2, :relief=>:sunken, +TkFrame.new(:borderwidth=>2, :relief=>:sunken, :height=>5).pack(:side=>:top, :fill=>:x, :padx=>20) ############################ TkLabel.new(:text=>'Sample of TkOptionMenu').pack(:side=>:top) -colors = %w(Black red4 DarkGreen NavyBlue gray75 Red Green Blue gray50 +colors = %w(Black red4 DarkGreen NavyBlue gray75 Red Green Blue gray50 Yellow Cyan Magenta White Brown DarkSeaGreen DarkViolet) TkFrame.new{|f| - pack(:side=>:top) + pack(:side=>:top) - b1 = TkOptionMenubutton . - new(:parent=>f, :values=>%w(one two three)) . + b1 = TkOptionMenubutton . + new(:parent=>f, :values=>%w(one two three)) . pack(:side=>:left, :padx=>25, :pady=>25) b2 = TkOptionMenubutton.new(:parent=>f, :values=>colors) {|optMB| @@ -96,7 +96,7 @@ TkFrame.new{|f| put 'Black', *[14, 2, 16, 14] put color, *[ 2, 2, 14, 14] } - optMB.entryconfigure(color, :hidemargin=>1, + optMB.entryconfigure(color, :hidemargin=>1, :image=>no_sel, :selectimage=>sel) } optMB.menuconfigure(:tearoff, 1) @@ -114,7 +114,7 @@ TkFrame.new{|f| } ############################ -TkFrame.new(:borderwidth=>2, :relief=>:sunken, +TkFrame.new(:borderwidth=>2, :relief=>:sunken, :height=>5).pack(:side=>:top, :fill=>:x, :padx=>20) ############################ diff --git a/ext/tk/sample/tkmsgcat-load_rb.rb b/ext/tk/sample/tkmsgcat-load_rb.rb index 5373e0086f..98a91fadf4 100644 --- a/ext/tk/sample/tkmsgcat-load_rb.rb +++ b/ext/tk/sample/tkmsgcat-load_rb.rb @@ -15,7 +15,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| TkComm.window(frame).background(color) Tk.update TkComm.window(label).text( - msgcat["%1$s:: %2$s", 'Color', + msgcat["%1$s:: %2$s", 'Color', color.capitalize]) w.flash; w.flash Tk.callback_break; @@ -23,7 +23,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| del_proc = TkComm.install_cmd(proc{top_win.destroy; top_win = nil}) -err_proc = TkComm.install_cmd(proc{fail(RuntimeError, +err_proc = TkComm.install_cmd(proc{fail(RuntimeError, msgcat['Application Error'])}) show_sample = proc{|loc| @@ -38,10 +38,10 @@ show_sample = proc{|loc| pack(:pady=>10, :padx=>10) } - lbl = TkLabel.new(top_win, :text=>msgcat["%1$s:: %2$s", + lbl = TkLabel.new(top_win, :text=>msgcat["%1$s:: %2$s", 'Color', '']).pack(:anchor=>'w') - bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, + bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, :expand=>true, :fill=>:both) TkFrame.new(bg){|f| @@ -53,9 +53,9 @@ show_sample = proc{|loc| }.pack(:anchor=>'center', :pady=>15) TkFrame.new(top_win){|f| - TkButton.new(f, :text=>msgcat['Delete'], + TkButton.new(f, :text=>msgcat['Delete'], :command=>del_proc).pack(:side=>:right, :padx=>5) - TkButton.new(f, :text=>msgcat['Error'], + TkButton.new(f, :text=>msgcat['Error'], :command=>err_proc).pack(:side=>:left, :padx=>5) }.pack(:side=>:bottom, :fill=>:x) @@ -67,7 +67,7 @@ show_sample = proc{|loc| TkLabel.new(:text=>"Please click a locale.").pack(:padx=>5, :pady=>3) TkFrame.new{|f| - TkButton.new(f, :text=>msgcat['Exit'], + TkButton.new(f, :text=>msgcat['Exit'], :command=>proc{exit}).pack(:side=>:right, :padx=>5) }.pack(:side=>:bottom, :fill=>:x) @@ -90,7 +90,7 @@ lbox.bind('ButtonRelease-1'){|ev| lbox.insert('end', 'default') -Dir.entries(msgcat_dir).sort.each{|f| +Dir.entries(msgcat_dir).sort.each{|f| if f =~ /^(.*).msg$/ lbox.insert('end', $1) end diff --git a/ext/tk/sample/tkmsgcat-load_rb2.rb b/ext/tk/sample/tkmsgcat-load_rb2.rb index 55246545c8..05512a3131 100644 --- a/ext/tk/sample/tkmsgcat-load_rb2.rb +++ b/ext/tk/sample/tkmsgcat-load_rb2.rb @@ -15,7 +15,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| TkComm.window(frame).background(color) Tk.update TkComm.window(label).text( - msgcat["%1$s:: %2$s", 'Color', + msgcat["%1$s:: %2$s", 'Color', color.capitalize]) w.flash; w.flash Tk.callback_break; @@ -23,7 +23,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| del_proc = TkComm.install_cmd(proc{top_win.destroy; top_win = nil}) -err_proc = TkComm.install_cmd(proc{fail(RuntimeError, +err_proc = TkComm.install_cmd(proc{fail(RuntimeError, msgcat['Application Error'])}) show_sample = proc{|loc| @@ -38,10 +38,10 @@ show_sample = proc{|loc| pack(:pady=>10, :padx=>10) } - lbl = TkLabel.new(top_win, :text=>msgcat["%1$s:: %2$s", + lbl = TkLabel.new(top_win, :text=>msgcat["%1$s:: %2$s", 'Color', '']).pack(:anchor=>'w') - bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, + bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, :expand=>true, :fill=>:both) TkFrame.new(bg){|f| @@ -53,9 +53,9 @@ show_sample = proc{|loc| }.pack(:anchor=>'center', :pady=>15) TkFrame.new(top_win){|f| - TkButton.new(f, :text=>msgcat['Delete'], + TkButton.new(f, :text=>msgcat['Delete'], :command=>del_proc).pack(:side=>:right, :padx=>5) - TkButton.new(f, :text=>msgcat['Error'], + TkButton.new(f, :text=>msgcat['Error'], :command=>err_proc).pack(:side=>:left, :padx=>5) }.pack(:side=>:bottom, :fill=>:x) @@ -67,7 +67,7 @@ show_sample = proc{|loc| TkLabel.new(:text=>"Please click a locale.").pack(:padx=>5, :pady=>3) TkFrame.new{|f| - TkButton.new(f, :text=>msgcat['Exit'], + TkButton.new(f, :text=>msgcat['Exit'], :command=>proc{exit}).pack(:side=>:right, :padx=>5) }.pack(:side=>:bottom, :fill=>:x) @@ -90,7 +90,7 @@ lbox.bind('ButtonRelease-1'){|ev| lbox.insert('end', 'default') -Dir.entries(msgcat_dir).sort.each{|f| +Dir.entries(msgcat_dir).sort.each{|f| if f =~ /^(.*).msg$/ lbox.insert('end', $1) end diff --git a/ext/tk/sample/tkmsgcat-load_tk.rb b/ext/tk/sample/tkmsgcat-load_tk.rb index 45d68e4e0b..703f471e19 100644 --- a/ext/tk/sample/tkmsgcat-load_tk.rb +++ b/ext/tk/sample/tkmsgcat-load_tk.rb @@ -14,7 +14,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| TkComm.window(frame).background(color) Tk.update TkComm.window(label).text( - msgcat.mc("%1$s:: %2$s", 'Color', + msgcat.mc("%1$s:: %2$s", 'Color', color.capitalize)) w.flash; w.flash Tk.callback_break; @@ -22,7 +22,7 @@ col_proc = TkComm.install_bind(proc{|w, color, frame, label| del_proc = TkComm.install_cmd(proc{top_win.destroy; top_win = nil}) -err_proc = TkComm.install_cmd(proc{fail(RuntimeError, +err_proc = TkComm.install_cmd(proc{fail(RuntimeError, msgcat.mc('Application Error'))}) show_sample = proc{|loc| @@ -36,10 +36,10 @@ show_sample = proc{|loc| pack(:pady=>10, :padx=>10) } - lbl = TkLabel.new(top_win, :text=>msgcat.mc("%1$s:: %2$s", + lbl = TkLabel.new(top_win, :text=>msgcat.mc("%1$s:: %2$s", 'Color', '')).pack(:anchor=>'w') - bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, + bg = TkFrame.new(top_win).pack(:ipadx=>20, :ipady=>10, :expand=>true, :fill=>:both) TkFrame.new(bg){|f| @@ -48,7 +48,7 @@ show_sample = proc{|loc| bind('ButtonRelease-1', col_proc, "#{col} #{bg.path} #{lbl.path}") }.pack(:fill=>:x) =begin - TkButton.new(f, :text=>msgcat.mc(col), + TkButton.new(f, :text=>msgcat.mc(col), :command=>proc{ bg.background col lbl.text msgcat.mc("%1$s:: %2$s", 'Color', col.capitalize) @@ -58,17 +58,17 @@ show_sample = proc{|loc| }.pack(:anchor=>'center', :pady=>15) TkFrame.new(top_win){|f| - TkButton.new(f, :text=>msgcat.mc('Delete'), + TkButton.new(f, :text=>msgcat.mc('Delete'), :command=>del_proc).pack(:side=>:right, :padx=>5) - TkButton.new(f, :text=>msgcat.mc('Error'), + TkButton.new(f, :text=>msgcat.mc('Error'), :command=>err_proc).pack(:side=>:left, :padx=>5) =begin - TkButton.new(f, :text=>msgcat.mc('Delete'), + TkButton.new(f, :text=>msgcat.mc('Delete'), :command=>proc{ top_win.destroy top_win = nil }).pack(:side=>:right, :padx=>5) - TkButton.new(f, :text=>msgcat.mc('Error'), + TkButton.new(f, :text=>msgcat.mc('Error'), :command=>proc{ fail RuntimeError, msgcat.mc('Application Error') }).pack(:side=>:left, :padx=>5) @@ -83,7 +83,7 @@ show_sample = proc{|loc| TkLabel.new(:text=>"Please click a locale.").pack(:padx=>5, :pady=>3) TkFrame.new{|f| - TkButton.new(f, :text=>msgcat.mc('Exit'), + TkButton.new(f, :text=>msgcat.mc('Exit'), :command=>proc{exit}).pack(:side=>:right, :padx=>5) }.pack(:side=>:bottom, :fill=>:x) @@ -106,7 +106,7 @@ lbox.bind('ButtonRelease-1'){|ev| lbox.insert('end', 'default') -Dir.entries(msgcat_dir).sort.each{|f| +Dir.entries(msgcat_dir).sort.each{|f| if f =~ /^(.*).msg$/ lbox.insert('end', $1) end diff --git a/ext/tk/sample/tkmulticolumnlist.rb b/ext/tk/sample/tkmulticolumnlist.rb index 255eb691e5..a1b3a1a2fa 100644 --- a/ext/tk/sample/tkmulticolumnlist.rb +++ b/ext/tk/sample/tkmulticolumnlist.rb @@ -32,7 +32,7 @@ class TkMultiColumnList < TkText # decide total width @lbox_total = title_info.size @width_total = 0 - title_info.each{|title, width, cmd| + title_info.each{|title, width, cmd| @width_total += width.to_f @title_cmd << cmd } @@ -54,28 +54,28 @@ class TkMultiColumnList < TkText @command = nil # virtical scrollbar - @v_scroll = TkYScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @v_scroll = TkYScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'width'=>@scrbar_width) # horizontal scrollbar - @h_scroll = TkXScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @h_scroll = TkXScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'width'=>@scrbar_width) # create base flames - @c_title = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_title = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_title = TkFrame.new(@c_title, 'width'=>@width_total) - @w_title = TkcWindow.new(@c_title, 0, 0, + @w_title = TkcWindow.new(@c_title, 0, 0, 'window'=>@f_title, 'anchor'=>'nw') - @c_lbox = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_lbox = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_lbox = TkFrame.new(@c_lbox, 'width'=>@width_total) @w_lbox = TkcWindow.new(@c_lbox, 0, 0, 'window'=>@f_lbox, 'anchor'=>'nw') - @c_hscr = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_hscr = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_hscr = TkFrame.new(@c_hscr, 'width'=>@width_total) @w_hscr = TkcWindow.new(@c_hscr, 0, 0, 'window'=>@f_hscr, 'anchor'=>'nw') @@ -99,28 +99,28 @@ class TkMultiColumnList < TkText f = TkFrame.new(@f_title, 'width'=>width) base = [f] - title = TkLabel.new(f, 'text'=>label, 'borderwidth'=>@title_border, + title = TkLabel.new(f, 'text'=>label, 'borderwidth'=>@title_border, 'relief'=>'raised', 'highlightthickness'=>@h_l_thick) title_binding(title, idx) title.pack('fill'=>'x') @title_list << title - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, - 'relheight'=>1.0, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + 'relheight'=>1.0, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) # listbox field f = TkFrame.new(@f_lbox, 'width'=>width) base << f - @lbox_list << TkText.new(f, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@lbox_border, - 'takefocus'=>false, + @lbox_list << TkText.new(f, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@lbox_border, + 'takefocus'=>false, 'wrap'=>'none') { bindtags(bindtags - [TkText]) - @seltag = TkTextTag.new(self, 'background'=>'#b3b3b3', + @seltag = TkTextTag.new(self, 'background'=>'#b3b3b3', 'borderwidth'=>1, 'relief'=>'raised') def self.nearest(y) self.index("@1,#{y}").split('.')[0].to_i @@ -151,17 +151,17 @@ class TkMultiColumnList < TkText pack('fill'=>'both', 'expand'=>true) } - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) # scrollbar field f = TkFrame.new(@f_hscr, 'width'=>width) base << f - @hscr_list << TkXScrollbar.new(f, 'width'=>@scrbar_width, - 'borderwidth'=>@scrbar_border, + @hscr_list << TkXScrollbar.new(f, 'width'=>@scrbar_width, + 'borderwidth'=>@scrbar_border, 'highlightthickness'=>@h_l_thick ).pack('fill'=>'x', 'anchor'=>'w') - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) @lbox_list[idx].xscrollbar(@hscr_list[idx]) @@ -171,23 +171,23 @@ class TkMultiColumnList < TkText } # pad - @f_title_pad = TkFrame.new(@frame, 'relief'=>'raised', - 'borderwidth'=>@title_border, + @f_title_pad = TkFrame.new(@frame, 'relief'=>'raised', + 'borderwidth'=>@title_border, 'highlightthickness'=>@h_l_thick) - @f_scr_pad = TkFrame.new(@frame, 'relief'=>'sunken', - 'borderwidth'=>1, + @f_scr_pad = TkFrame.new(@frame, 'relief'=>'sunken', + 'borderwidth'=>1, 'highlightthickness'=>@h_l_thick) # height check title_height = 0 - @title_list.each{|w| + @title_list.each{|w| h = w.winfo_reqheight title_height = h if title_height < h } hscr_height = 0 - @hscr_list.each{|w| + @hscr_list.each{|w| h = w.winfo_reqheight hscr_height = h if hscr_height < h } @@ -203,12 +203,12 @@ class TkMultiColumnList < TkText @h_scroll.assign(@c_title, @c_lbox, @c_hscr) # binding for listboxes - @lbox_list.each_with_index{|l, idx| - l.bind('Button-1', proc{|w, y| + @lbox_list.each_with_index{|l, idx| + l.bind('Button-1', proc{|w, y| @frame.focus select_line(w, w.nearest(y)) }, '%W %y') - l.bind('B1-Motion', proc{|w, y| + l.bind('B1-Motion', proc{|w, y| select_line(w, w.nearest(y)) }, '%W %y') l.bind('Double-Button-1', proc{ @@ -218,11 +218,11 @@ class TkMultiColumnList < TkText l.bind('Control-Home', proc{|w| select_line(w, 0)}, '%W') l.bind('Control-End', proc{|w| select_line(w, 'end')}, '%W') - l.bind('Button-2', proc{|x, y| + l.bind('Button-2', proc{|x, y| @lbox_mark_x = x @lbox_list.each{|lbox| lbox.scan_mark(x, y)} }, '%x %y') - l.bind('B2-Motion', proc{|x, y| + l.bind('B2-Motion', proc{|x, y| @lbox_list.each{|lbox| lbox.scan_dragto(@lbox_mark_x, y)} l.scan_dragto(x, y) }, '%x %y') @@ -265,8 +265,8 @@ class TkMultiColumnList < TkText @f_scr_pad.grid('row'=>2, 'rowspan'=>2, 'column'=>2, 'sticky'=>'news') # binding for 'Configure' event - @c_lbox.bind('Configure', - proc{|height, width| reconstruct(height, width)}, + @c_lbox.bind('Configure', + proc{|height, width| reconstruct(height, width)}, '%h %w') # set default receiver of method calls @@ -386,7 +386,7 @@ class TkMultiColumnList < TkText def titlefont(font) @title_list.each{|label| label['font'] = font} title_height = 0 - @title_list.each{|w| + @title_list.each{|w| h = w.winfo_reqheight title_height = h if title_height < h } @@ -523,7 +523,7 @@ class TkMultiColumnList < TkText array[indices[0]] = line[label] else if line[label].kind_of? Array - indices.each_with_index{|index, num| + indices.each_with_index{|index, num| array[index] = line[label][num] } else @@ -541,9 +541,9 @@ class TkMultiColumnList < TkText indices.each{|index| lbox_ins[index] << line[index]} end } - } + } - @lbox_list.each_with_index{|lbox, index| + @lbox_list.each_with_index{|lbox, index| lbox.insert(idx, cr + lbox_ins[index].join("\n")) if lbox_ins[index] } end @@ -581,7 +581,7 @@ class TkMultiColumnList < TkText (0..(@rel_list.size - 2)).each{|idx| title, lbox, hscr = @base_list[idx] title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) } @@ -608,11 +608,11 @@ class TkMultiColumnList < TkText # adjustment of rightside widget of the sash title, lbox, hscr = @base_list[idx] - title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx], 'relheight'=>1.0) - hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) # update reference position @@ -636,34 +636,34 @@ class TkMultiColumnList < TkText end def title_binding(title, index) - title.bind('Motion', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, + title.bind('Motion', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, "%W %x #{index}") - title.bind('Enter', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, + title.bind('Enter', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, "%W %x #{index}") title.bind('Leave', proc{|w| w.cursor ""}, "%W") - title.bind('Button-1', - proc{|w, x| + title.bind('Button-1', + proc{|w, x| if @mode == :sash @x = x @frame_width = TkWinfo.width(@f_title).to_f else title.relief 'sunken' end - }, + }, '%W %X') - title.bind('ButtonRelease-1', - proc{|w, x, idx| + title.bind('ButtonRelease-1', + proc{|w, x, idx| i = idx.to_i if @mode == :title && @title_cmd[i].kind_of?(Proc) @title_cmd[i].call end title.relief 'raised' motion_cb(w,x,i) - }, + }, "%W %x #{index}") title.bind('B1-Motion', proc{|x| resize(x) if @mode == :sash}, "%X") @@ -705,13 +705,13 @@ end # test ################################################ if __FILE__ == $0 - l = TkMultiColumnList.new(nil, 200, - [ ['L1', 200, proc{p 'click L1'}], - ['L2', 100], - ['L3', 200] ], - 'width'=>350, - #'titleforeground'=>'yellow', - 'titleforeground'=>'white', + l = TkMultiColumnList.new(nil, 200, + [ ['L1', 200, proc{p 'click L1'}], + ['L2', 100], + ['L3', 200] ], + 'width'=>350, + #'titleforeground'=>'yellow', + 'titleforeground'=>'white', #'titlebackground'=>'navy', 'titlebackground'=>'blue', 'titlefont'=>'courier' @@ -719,7 +719,7 @@ if __FILE__ == $0 l.insert('end', [1,2,3]) l.insert('end', [4,5,6]) l.insert('end', [4,5,6], [4,5,6]) - l.insert('end', ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + l.insert('end', ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', 'cccccccccccccccccccccccccccccccccccccccccccccccccccc']) l.insert('end', [1,2,3]) diff --git a/ext/tk/sample/tkmultilistbox.rb b/ext/tk/sample/tkmultilistbox.rb index 6f956d0edb..7791649c4b 100644 --- a/ext/tk/sample/tkmultilistbox.rb +++ b/ext/tk/sample/tkmultilistbox.rb @@ -35,10 +35,10 @@ class TkMultiListbox < TkListbox # create base flames @f_title = TkFrame.new(@frame, 'width'=>@width_total) - @f_lbox = TkFrame.new(@frame, + @f_lbox = TkFrame.new(@frame, 'width'=>@width_total, 'height'=>lbox_height) - @f_hscr = TkFrame.new(@frame, 'width'=>@width_total, - 'height'=>@v_scroll.cget('width') + + @f_hscr = TkFrame.new(@frame, 'width'=>@width_total, + 'height'=>@v_scroll.cget('width') + 2 * @v_scroll.cget('borderwidth')) # dummy label to keep the hight of title space @@ -63,25 +63,25 @@ class TkMultiListbox < TkListbox f = TkFrame.new(@f_title, 'width'=>width) base = [f] @title_list << TkLabel.new(f, 'text'=>label).pack('fill'=>'x') - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-6, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-6, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) # listbox field f = TkFrame.new(@f_lbox, 'width'=>width) base << f @lbox_list << TkListbox.new(f).pack('fill'=>'both', 'expand'=>true) - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-4, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-4, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) # scrollbar field f = TkFrame.new(@f_hscr, 'width'=>width) base << f - @hscr_list << TkScrollbar.new(f, 'orient'=>'horizontal') . + @hscr_list << TkScrollbar.new(f, 'orient'=>'horizontal') . pack('fill'=>'x', 'anchor'=>'w') - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-4, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>-4, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) - @lbox_list[idx].xscrollcommand proc{|first, last| + @lbox_list[idx].xscrollcommand proc{|first, last| @hscr_list[idx].set first, last } @hscr_list[idx].command proc{|*args| @lbox_list[idx].xview *args} @@ -93,19 +93,19 @@ class TkMultiListbox < TkListbox # create tab @tab_list = [nil] (1..(@rel_list.size - 2)).each{|idx| - tab = TkFrame.new(@f_title, 'cursor'=>'sb_h_double_arrow', + tab = TkFrame.new(@f_title, 'cursor'=>'sb_h_double_arrow', 'width'=>6, 'borderwidth'=>2, 'relief'=>'raised') @tab_list << tab tab.place('relx'=>@rel_list[idx], 'anchor'=>'ne', 'relheight'=>0.95) - tab.bind('Button-1', - proc{|x| @x = x; @frame_width = TkWinfo.width(@f_title).to_f}, + tab.bind('Button-1', + proc{|x| @x = x; @frame_width = TkWinfo.width(@f_title).to_f}, '%X') tab.bind('B1-Motion', proc{|x, idx| resize(x, idx.to_i)}, "%X #{idx}") } # set control procedure for virtical scroll @lbox_list.each{|lbox| - lbox.yscrollcommand proc{|first, last| + lbox.yscrollcommand proc{|first, last| @v_scroll.set first, last } } @@ -118,17 +118,17 @@ class TkMultiListbox < TkListbox @mode['extended'] = extended_mode_bindtag @mode['multiple'] = multiple_mode_bindtag @current_mode = 'browse' - @lbox_list.each{|l| - l.bind('Shift-Key-Left', + @lbox_list.each{|l| + l.bind('Shift-Key-Left', proc{|w| focus_shift(w, -1); Tk.callback_break}, '%W') - l.bind('Shift-Key-Right', + l.bind('Shift-Key-Right', proc{|w| focus_shift(w, 1); Tk.callback_break}, '%W') - l.bind('Button-2', proc{|x, y| + l.bind('Button-2', proc{|x, y| @lbox_mark_x = x @lbox_list.each{|lbox| lbox.scan_mark(x, y)} }, '%x %y') - l.bind('B2-Motion', proc{|x, y| + l.bind('B2-Motion', proc{|x, y| @lbox_list.each{|lbox| lbox.scan_dragto(@lbox_mark_x, y)} l.scan_dragto(x, y) }, '%x %y') @@ -189,7 +189,7 @@ class TkMultiListbox < TkListbox # set 'mode' option of listboxes def mode(sel_mode) - @lbox_list.each{|l| + @lbox_list.each{|l| tags = l.bindtags tags = tags - [ @mode[@current_mode] ] l.bindtags(tags.unshift(@mode[sel_mode])) @@ -282,7 +282,7 @@ class TkMultiListbox < TkListbox array[indices[0]] = line[label] else if line[label].kind_of? Array - indices.each_with_index{|index, num| + indices.each_with_index{|index, num| array[index] = line[label][num] } else @@ -300,9 +300,9 @@ class TkMultiListbox < TkListbox indices.each{|index| lbox_ins[index] << line[index]} end } - } + } - @lbox_list.each_with_index{|lbox, index| + @lbox_list.each_with_index{|lbox, index| lbox.insert(idx, *lbox_ins[index]) if lbox_ins[index] } end @@ -326,7 +326,7 @@ class TkMultiListbox < TkListbox (0..(@rel_list.size - 2)).each{|idx| title, lbox, hscr = @base_list[idx] title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) @@ -356,11 +356,11 @@ class TkMultiListbox < TkListbox # adjustment of rightside widget of the tab title, lbox, hscr = @base_list[idx] - title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx], 'relheight'=>1.0) - hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) # update reference position @@ -370,11 +370,11 @@ class TkMultiListbox < TkListbox ################################# def browse_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_line(w, w.nearest(y))}, '%W %y') t.bind('B1-Motion', proc{|w, y| select_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| select_shift(w, -1)}, '%W') @@ -385,7 +385,7 @@ class TkMultiListbox < TkListbox t.bind('space', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t.bind('Select', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-slash', + t.bind('Control-slash', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t @@ -394,12 +394,12 @@ class TkMultiListbox < TkListbox ######################## def single_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_only(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| select_shift(w, -1)}, '%W') @@ -410,9 +410,9 @@ class TkMultiListbox < TkListbox t.bind('space', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t.bind('Select', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-slash', + t.bind('Control-slash', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-backslash', + t.bind('Control-backslash', proc{@lbox_list.each{|l| l.selection_clear(0, 'end')}}) t @@ -421,22 +421,22 @@ class TkMultiListbox < TkListbox ######################## def extended_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_only(w, w.nearest(y))}, '%W %y') t.bind('B1-Motion', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('Shift-B1-Motion', + t.bind('Shift-B1-Motion', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('Control-Button-1', + t.bind('Control-Button-1', proc{|w, y| select_toggle(w, w.nearest(y))}, '%W %y') - t.bind('Control-B1-Motion', + t.bind('Control-B1-Motion', proc{|w, y| select_drag(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| active_shift(w, -1)}, '%W') @@ -462,9 +462,9 @@ class TkMultiListbox < TkListbox ######################## def multiple_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_line3(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| active_shift(w, -1)}, '%W') @@ -624,15 +624,15 @@ end # test ################################################ if __FILE__ == $0 - f = TkFrame.new(nil, 'width'=>300, + f = TkFrame.new(nil, 'width'=>300, 'height'=>200).pack('fill'=>'both', 'expand'=>'true') #f = TkFrame.new.pack('fill'=>'both', 'expand'=>'true') - l = TkMultiListbox.new(f, 150, - [ ['L1', 100], - ['L2', 200], - ['L3', 50] ], - 'titlefont'=>'courier', - 'titleforeground'=>'yellow', + l = TkMultiListbox.new(f, 150, + [ ['L1', 100], + ['L2', 200], + ['L3', 50] ], + 'titlefont'=>'courier', + 'titleforeground'=>'yellow', 'titlebackground'=>'navy' ).pack('fill'=>'both', 'expand'=>true) l.insert('end', [1,2,3]) diff --git a/ext/tk/sample/tkmultilistframe.rb b/ext/tk/sample/tkmultilistframe.rb index ef1a0a824d..7c0aac9a9e 100644 --- a/ext/tk/sample/tkmultilistframe.rb +++ b/ext/tk/sample/tkmultilistframe.rb @@ -32,7 +32,7 @@ class TkMultiListFrame < TkListbox # decide total width @lbox_total = title_info.size @width_total = 0 - title_info.each{|title, width, cmd| + title_info.each{|title, width, cmd| @width_total += width.to_f @title_cmd << cmd } @@ -54,37 +54,37 @@ class TkMultiListFrame < TkListbox # virtical scrollbar =begin - @v_scroll = TkScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @v_scroll = TkScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'orient'=>'vertical', 'width'=>@scrbar_width) =end - @v_scroll = TkYScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @v_scroll = TkYScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'width'=>@scrbar_width) # horizontal scrollbar =begin - @h_scroll = TkScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @h_scroll = TkScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'orient'=>'horizontal', 'width'=>@scrbar_width) =end - @h_scroll = TkXScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, - 'borderwidth'=>@scrbar_border, + @h_scroll = TkXScrollbar.new(@frame, 'highlightthickness'=>@h_l_thick, + 'borderwidth'=>@scrbar_border, 'width'=>@scrbar_width) # create base flames - @c_title = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_title = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_title = TkFrame.new(@c_title, 'width'=>@width_total) - @w_title = TkcWindow.new(@c_title, 0, 0, + @w_title = TkcWindow.new(@c_title, 0, 0, 'window'=>@f_title, 'anchor'=>'nw') - @c_lbox = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_lbox = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_lbox = TkFrame.new(@c_lbox, 'width'=>@width_total) @w_lbox = TkcWindow.new(@c_lbox, 0, 0, 'window'=>@f_lbox, 'anchor'=>'nw') - @c_hscr = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, + @c_hscr = TkCanvas.new(@frame, 'highlightthickness'=>@h_l_thick, 'width'=>@window_width) @f_hscr = TkFrame.new(@c_hscr, 'width'=>@width_total) @w_hscr = TkcWindow.new(@c_hscr, 0, 0, 'window'=>@f_hscr, 'anchor'=>'nw') @@ -108,45 +108,45 @@ class TkMultiListFrame < TkListbox f = TkFrame.new(@f_title, 'width'=>width) base = [f] - title = TkLabel.new(f, 'text'=>label, 'borderwidth'=>@title_border, + title = TkLabel.new(f, 'text'=>label, 'borderwidth'=>@title_border, 'relief'=>'raised', 'highlightthickness'=>@h_l_thick) title_binding(title, idx) title.pack('fill'=>'x') @title_list << title - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, - 'relheight'=>1.0, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + 'relheight'=>1.0, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) # listbox field f = TkFrame.new(@f_lbox, 'width'=>width) base << f - @lbox_list << TkListbox.new(f, 'highlightthickness'=>@h_l_thick, + @lbox_list << TkListbox.new(f, 'highlightthickness'=>@h_l_thick, 'borderwidth'=>@lbox_border ).pack('fill'=>'both', 'expand'=>true) - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) # scrollbar field f = TkFrame.new(@f_hscr, 'width'=>width) base << f =begin - @hscr_list << TkScrollbar.new(f, 'orient'=>'horizontal', - 'width'=>@scrbar_width, - 'borderwidth'=>@scrbar_border, + @hscr_list << TkScrollbar.new(f, 'orient'=>'horizontal', + 'width'=>@scrbar_width, + 'borderwidth'=>@scrbar_border, 'highlightthickness'=>@h_l_thick ).pack('fill'=>'x', 'anchor'=>'w') =end - @hscr_list << TkXScrollbar.new(f, 'width'=>@scrbar_width, - 'borderwidth'=>@scrbar_border, + @hscr_list << TkXScrollbar.new(f, 'width'=>@scrbar_width, + 'borderwidth'=>@scrbar_border, 'highlightthickness'=>@h_l_thick ).pack('fill'=>'x', 'anchor'=>'w') - f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, + f.place('relx'=>@rel_list[idx], 'y'=>0, 'anchor'=>'nw', 'width'=>1, 'relwidth'=>@rel_list[idx+1] - @rel_list[idx]) =begin - @lbox_list[idx].xscrollcommand proc{|first, last| + @lbox_list[idx].xscrollcommand proc{|first, last| @hscr_list[idx].set first, last } @hscr_list[idx].command proc{|*args| @lbox_list[idx].xview *args} @@ -159,23 +159,23 @@ class TkMultiListFrame < TkListbox # pad # @f_title_pad = TkFrame.new(@frame) - @f_title_pad = TkFrame.new(@frame, 'relief'=>'raised', - 'borderwidth'=>@title_border, + @f_title_pad = TkFrame.new(@frame, 'relief'=>'raised', + 'borderwidth'=>@title_border, 'highlightthickness'=>@h_l_thick) - @f_scr_pad = TkFrame.new(@frame, 'relief'=>'sunken', - 'borderwidth'=>1, + @f_scr_pad = TkFrame.new(@frame, 'relief'=>'sunken', + 'borderwidth'=>1, 'highlightthickness'=>@h_l_thick) # height check title_height = 0 - @title_list.each{|w| + @title_list.each{|w| h = w.winfo_reqheight title_height = h if title_height < h } hscr_height = 0 - @hscr_list.each{|w| + @hscr_list.each{|w| h = w.winfo_reqheight hscr_height = h if hscr_height < h } @@ -187,7 +187,7 @@ class TkMultiListFrame < TkListbox # set control procedure for virtical scroll =begin @lbox_list.each{|lbox| - lbox.yscrollcommand proc{|first, last| + lbox.yscrollcommand proc{|first, last| @v_scroll.set first, last } } @@ -197,16 +197,16 @@ class TkMultiListFrame < TkListbox # set control procedure for horizoncal scroll =begin - @c_title.xscrollcommand proc{|first, last| + @c_title.xscrollcommand proc{|first, last| @h_scroll.set first, last } - @c_lbox.xscrollcommand proc{|first, last| + @c_lbox.xscrollcommand proc{|first, last| @h_scroll.set first, last } - @c_hscr.xscrollcommand proc{|first, last| + @c_hscr.xscrollcommand proc{|first, last| @h_scroll.set first, last } - @h_scroll.command proc{|*args| + @h_scroll.command proc{|*args| @c_title.xview *args @c_lbox.xview *args @c_hscr.xview *args if @show_each_hscr @@ -221,17 +221,17 @@ class TkMultiListFrame < TkListbox @lbox_mode['extended'] = extended_mode_bindtag @lbox_mode['multiple'] = multiple_mode_bindtag @current_mode = 'browse' - @lbox_list.each_with_index{|l, idx| - l.bind('Shift-Key-Left', + @lbox_list.each_with_index{|l, idx| + l.bind('Shift-Key-Left', proc{|w| focus_shift(w, -1); Tk.callback_break}, '%W') - l.bind('Shift-Key-Right', + l.bind('Shift-Key-Right', proc{|w| focus_shift(w, 1); Tk.callback_break}, '%W') - l.bind('Button-2', proc{|x, y| + l.bind('Button-2', proc{|x, y| @lbox_mark_x = x @lbox_list.each{|lbox| lbox.scan_mark(x, y)} }, '%x %y') - l.bind('B2-Motion', proc{|x, y| + l.bind('B2-Motion', proc{|x, y| @lbox_list.each{|lbox| lbox.scan_dragto(@lbox_mark_x, y)} l.scan_dragto(x, y) }, '%x %y') @@ -270,8 +270,8 @@ class TkMultiListFrame < TkListbox @f_scr_pad.grid('row'=>2, 'rowspan'=>2, 'column'=>2, 'sticky'=>'news') # binding for 'Configure' event - @c_lbox.bind('Configure', - proc{|height, width| reconstruct(height, width)}, + @c_lbox.bind('Configure', + proc{|height, width| reconstruct(height, width)}, '%h %w') # set default receiver of method calls @@ -316,7 +316,7 @@ class TkMultiListFrame < TkListbox # set 'mode' option of listboxes def mode(sel_mode) - @lbox_list.each{|l| + @lbox_list.each{|l| tags = l.bindtags tags = tags - [ @lbox_mode[@current_mode] ] l.bindtags(tags.unshift(@lbox_mode[sel_mode])) @@ -395,7 +395,7 @@ class TkMultiListFrame < TkListbox def titlefont(font) @title_list.each{|label| label['font'] = font} title_height = 0 - @title_list.each{|w| + @title_list.each{|w| h = w.winfo_reqheight title_height = h if title_height < h } @@ -498,7 +498,7 @@ class TkMultiListFrame < TkListbox array[indices[0]] = line[label] else if line[label].kind_of? Array - indices.each_with_index{|index, num| + indices.each_with_index{|index, num| array[index] = line[label][num] } else @@ -516,9 +516,9 @@ class TkMultiListFrame < TkListbox indices.each{|index| lbox_ins[index] << line[index]} end } - } + } - @lbox_list.each_with_index{|lbox, index| + @lbox_list.each_with_index{|lbox, index| lbox.insert(idx, *lbox_ins[index]) if lbox_ins[index] } end @@ -560,7 +560,7 @@ class TkMultiListFrame < TkListbox (0..(@rel_list.size - 2)).each{|idx| title, lbox, hscr = @base_list[idx] title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relheight'=>1.0) hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx]) } @@ -587,11 +587,11 @@ class TkMultiListFrame < TkListbox # adjustment of rightside widget of the sash title, lbox, hscr = @base_list[idx] - title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + title.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) - lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + lbox.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx], 'relheight'=>1.0) - hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], + hscr.place('relwidth'=>@rel_list[idx+1] - @rel_list[idx], 'relx'=>@rel_list[idx]) # update reference position @@ -615,34 +615,34 @@ class TkMultiListFrame < TkListbox end def title_binding(title, index) - title.bind('Motion', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, + title.bind('Motion', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, "%W %x #{index}") - title.bind('Enter', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, + title.bind('Enter', proc{|w, x, idx| motion_cb(w, x, idx.to_i)}, "%W %x #{index}") title.bind('Leave', proc{|w| w.cursor ""}, "%W") - title.bind('Button-1', - proc{|w, x| + title.bind('Button-1', + proc{|w, x| if @mode == :sash @x = x @frame_width = TkWinfo.width(@f_title).to_f else title.relief 'sunken' end - }, + }, '%W %X') - title.bind('ButtonRelease-1', - proc{|w, x, idx| + title.bind('ButtonRelease-1', + proc{|w, x, idx| i = idx.to_i if @mode == :title && @title_cmd[i].kind_of?(Proc) @title_cmd[i].call end title.relief 'raised' motion_cb(w,x,i) - }, + }, "%W %x #{index}") title.bind('B1-Motion', proc{|x| resize(x) if @mode == :sash}, "%X") @@ -651,11 +651,11 @@ class TkMultiListFrame < TkListbox ################################# def browse_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_line(w, w.nearest(y))}, '%W %y') t.bind('B1-Motion', proc{|w, y| select_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| select_shift(w, -1)}, '%W') @@ -666,7 +666,7 @@ class TkMultiListFrame < TkListbox t.bind('space', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t.bind('Select', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-slash', + t.bind('Control-slash', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t @@ -675,12 +675,12 @@ class TkMultiListFrame < TkListbox ######################## def single_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_only(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| select_shift(w, -1)}, '%W') @@ -691,9 +691,9 @@ class TkMultiListFrame < TkListbox t.bind('space', proc{|w| select_line(w, w.index('active').to_i)}, '%W') t.bind('Select', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-slash', + t.bind('Control-slash', proc{|w| select_line(w, w.index('active').to_i)}, '%W') - t.bind('Control-backslash', + t.bind('Control-backslash', proc{@lbox_list.each{|l| l.selection_clear(0, 'end')}}) t @@ -702,22 +702,22 @@ class TkMultiListFrame < TkListbox ######################## def extended_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_only(w, w.nearest(y))}, '%W %y') t.bind('B1-Motion', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') - t.bind('Shift-Button-1', + t.bind('Shift-Button-1', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('Shift-B1-Motion', + t.bind('Shift-B1-Motion', proc{|w, y| select_range(w, w.nearest(y))}, '%W %y') - t.bind('Control-Button-1', + t.bind('Control-Button-1', proc{|w, y| select_toggle(w, w.nearest(y))}, '%W %y') - t.bind('Control-B1-Motion', + t.bind('Control-B1-Motion', proc{|w, y| select_drag(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| active_shift(w, -1)}, '%W') @@ -743,9 +743,9 @@ class TkMultiListFrame < TkListbox ######################## def multiple_mode_bindtag t = TkBindTag.new - t.bind('Button-1', + t.bind('Button-1', proc{|w, y| w.focus; select_line3(w, w.nearest(y))}, '%W %y') - t.bind('ButtonRelease-1', + t.bind('ButtonRelease-1', proc{|w, y| active_line(w, w.nearest(y))}, '%W %y') t.bind('Key-Up', proc{|w| active_shift(w, -1)}, '%W') @@ -905,13 +905,13 @@ end # test ################################################ if __FILE__ == $0 - l = TkMultiListFrame.new(nil, 200, - [ ['L1', 200, proc{p 'click L1'}], - ['L2', 100], - ['L3', 200] ], - 'width'=>350, - #'titleforeground'=>'yellow', - 'titleforeground'=>'white', + l = TkMultiListFrame.new(nil, 200, + [ ['L1', 200, proc{p 'click L1'}], + ['L2', 100], + ['L3', 200] ], + 'width'=>350, + #'titleforeground'=>'yellow', + 'titleforeground'=>'white', #'titlebackground'=>'navy', 'titlebackground'=>'blue', 'titlefont'=>'courier' @@ -919,7 +919,7 @@ if __FILE__ == $0 l.insert('end', [1,2,3]) l.insert('end', [4,5,6]) l.insert('end', [4,5,6], [4,5,6]) - l.insert('end', ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + l.insert('end', ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', 'cccccccccccccccccccccccccccccccccccccccccccccccccccc']) l.insert('end', [1,2,3]) diff --git a/ext/tk/sample/tkoptdb-safeTk.rb b/ext/tk/sample/tkoptdb-safeTk.rb index a06098323f..3972577b0f 100644 --- a/ext/tk/sample/tkoptdb-safeTk.rb +++ b/ext/tk/sample/tkoptdb-safeTk.rb @@ -18,19 +18,19 @@ EOM if ENV['LANG'] =~ /^ja/ # read Japanese resource - ent = TkOptionDB.read_entries(File.expand_path('resource.ja', + ent = TkOptionDB.read_entries(File.expand_path('resource.ja', File.dirname(__FILE__)), 'euc-jp') else # read English resource - ent = TkOptionDB.read_entries(File.expand_path('resource.en', + ent = TkOptionDB.read_entries(File.expand_path('resource.en', File.dirname(__FILE__))) end file = File.expand_path('tkoptdb.rb', File.dirname(__FILE__)) ip = MultiTkIp.new_safeTk{ - # When a block is given to 'new_safeTk' method, + # When a block is given to 'new_safeTk' method, # the block is evaluated on $SAFE==4. ent.each{|pat, val| Tk.tk_call('option', 'add', pat, val)} } @@ -38,22 +38,22 @@ ip = MultiTkIp.new_safeTk{ print "ip.eval_proc{$SAFE} ==> ", ip.eval_proc{$SAFE}, "\n" print "\ncall 'ip.wait_on_mainloop = false'\n" -print "If 'ip.wait_on_mainloop? == true', ", - "when 'mainloop' is called on 'ip.eval_proc', ", - "'ip.eval_proc' does't return while the root window exists.\n", - "If you want to avoid that, set wait_on_mainloop to false. ", - "Then the mainloop in the eval_proc returns soon ", - "and the following steps are evaluated. \n", - "If you hate the both of them, use 'ip.bg_eval_proc' or ", +print "If 'ip.wait_on_mainloop? == true', ", + "when 'mainloop' is called on 'ip.eval_proc', ", + "'ip.eval_proc' does't return while the root window exists.\n", + "If you want to avoid that, set wait_on_mainloop to false. ", + "Then the mainloop in the eval_proc returns soon ", + "and the following steps are evaluated. \n", + "If you hate the both of them, use 'ip.bg_eval_proc' or ", "wrap 'ip.eval_proc' by a thread.\n" ip.wait_on_mainloop = false ret = ip.eval_proc{ - # When a block is given to 'eval_proc' method, + # When a block is given to 'eval_proc' method, # the block is evaluated on the IP's current safe level. - # So, the followings raises an exception. - # An Exception object of the exception is returned as a + # So, the followings raises an exception. + # An Exception object of the exception is returned as a # return value of this method. load file @@ -64,7 +64,7 @@ print "If a proc object is given, the proc is evaluated on the safe-level which safe0_cmd = Proc.new{ print 'safe0_cmd safe-level == ', $SAFE, "\n" - # This proc object keeps current safe-level ($SAFE==0). + # This proc object keeps current safe-level ($SAFE==0). load file } ip.eval_proc{safe0_cmd.call} diff --git a/ext/tk/sample/tkoptdb.rb b/ext/tk/sample/tkoptdb.rb index 47784ea238..75c21e7e47 100644 --- a/ext/tk/sample/tkoptdb.rb +++ b/ext/tk/sample/tkoptdb.rb @@ -2,21 +2,21 @@ # # sample script of TkOptionDB # -# If 'LANG' environment variable's value is started by 'ja', -# then read Japanese resource data and display Japanese button text. -# In other case, read English resource data and display English text. +# If 'LANG' environment variable's value is started by 'ja', +# then read Japanese resource data and display Japanese button text. +# In other case, read English resource data and display English text. # require "tk" if __FILE__ == $0 || !TkCore::INTERP.safe? if ENV['LANG'] =~ /^ja/ # read Japanese resource - TkOptionDB.read_with_encoding(File.expand_path('resource.ja', - File.dirname(__FILE__)), + TkOptionDB.read_with_encoding(File.expand_path('resource.ja', + File.dirname(__FILE__)), 'euc-jp') else # read English resource - TkOptionDB.readfile(File.expand_path('resource.en', + TkOptionDB.readfile(File.expand_path('resource.en', File.dirname(__FILE__))) end end @@ -24,7 +24,7 @@ end # 'show_msg' and 'bye_msg' procedures can be defined on BTN_CMD resource. # Those procedures are called under $SAFE==2 cmd = TkOptionDB.new_proc_class(:BTN_CMD, [:show_msg, :bye_msg], 3) { - # If you want to check resource string (str), + # If you want to check resource string (str), # please define __check_proc_string__(str) like this. class << self def __check_proc_string__(str) @@ -40,12 +40,12 @@ cmd = TkOptionDB.new_proc_class(:BTN_CMD, [:show_msg, :bye_msg], 3) { # following two frame widgets use same database entry TkFrame.new(:class=>'BtnFrame'){|f| pack(:padx=>5, :pady=>5) - TkButton.new(:parent=>f, :widgetname=>'hello'){ + TkButton.new(:parent=>f, :widgetname=>'hello'){ command proc{ print "($SAFE=#{$SAFE} >>>) : " cmd.show_msg(TkOptionDB.inspect) print "(<<< $SAFE=#{$SAFE})" - } + } pack(:fill=>:x, :padx=>10, :pady=>10) } TkButton.new(:command=>proc{ @@ -53,7 +53,7 @@ TkFrame.new(:class=>'BtnFrame'){|f| cmd.bye_msg print "(<<< $SAFE=#{$SAFE} ) : " exit - }, + }, :parent=>f, :widgetname=>'quit'){ pack(:fill=>:x, :padx=>10, :pady=>10) } @@ -62,12 +62,12 @@ TkFrame.new(:class=>'BtnFrame'){|f| class BtnFrame < TkFrame; end BtnFrame.new{|f| pack(:padx=>5, :pady=>5) - TkButton.new(:parent=>f, :widgetname=>'hello'){ + TkButton.new(:parent=>f, :widgetname=>'hello'){ command proc{ print "($SAFE=#{$SAFE} >>>) : " cmd.show_msg(TkOptionDB.inspect) print "(<<< $SAFE=#{$SAFE})" - } + } pack(:fill=>:x, :padx=>10, :pady=>10) } TkButton.new(:command=>proc{ @@ -75,7 +75,7 @@ BtnFrame.new{|f| cmd.bye_msg print "(<<< $SAFE=#{$SAFE})" exit - }, + }, :parent=>f, :widgetname=>'quit'){ pack(:fill=>:x, :padx=>10, :pady=>10) } @@ -84,12 +84,12 @@ BtnFrame.new{|f| # if unknown class, use default option values TkFrame.new(:class=>'BtnFrame2'){|f| pack(:padx=>5, :pady=>5) - TkButton.new(:parent=>f, :widgetname=>'hello'){ + TkButton.new(:parent=>f, :widgetname=>'hello'){ command proc{ print "($SAFE=#{$SAFE} >>>) : " cmd.show_msg(TkOptionDB.inspect) print "(<<< $SAFE=#{$SAFE})" - } + } pack(:fill=>:x, :padx=>10, :pady=>10) } TkButton.new(:command=>proc{ @@ -97,7 +97,7 @@ TkFrame.new(:class=>'BtnFrame2'){|f| cmd.bye_msg print "(<<< $SAFE=#{$SAFE})" exit - }, + }, :parent=>f, :widgetname=>'quit'){ pack(:fill=>:x, :padx=>10, :pady=>10) } diff --git a/ext/tk/sample/tkrttimer.rb b/ext/tk/sample/tkrttimer.rb index 0abd4ecbd2..1f9cbd9eb5 100644 --- a/ext/tk/sample/tkrttimer.rb +++ b/ext/tk/sample/tkrttimer.rb @@ -8,24 +8,24 @@ root = TkRoot.new(:title=>'realtime timer sample') f1 = TkFrame.new(:borderwidth=>2, :relief=>:ridge) f1.pack(:side=>:bottom, :fill=>:both) TkLabel.new(f1, :text=>'use TkTimer (TkAfter) class').pack(:anchor=>:center) -label1 = TkLabel.new(:parent=>f1, :relief=>:raised, +label1 = TkLabel.new(:parent=>f1, :relief=>:raised, :width=>10).pack(:fill=>:both) f2 = TkFrame.new(:borderwidth=>2, :relief=>:ridge) f2.pack(:side=>:bottom, :fill=>:both) TkLabel.new(f2, :text=>'use TkRTTimer class').pack -label2 = TkLabel.new(:parent=>f2, :relief=>:raised, +label2 = TkLabel.new(:parent=>f2, :relief=>:raised, :width=>10).pack(:fill=>:both) TkLabel.new(:padx=>10, :pady=>5, :justify=>'left', :text=><'vertical') @h_scroll = TkScrollbar.new(@frame, 'orient'=>'horizontal') - # create a text widget - @text = TkText.new(@frame, 'wrap'=>'none') + # create a component + construct_keys = {} + ((component_construct_keys.map{|k| k.to_s}) & keys.keys).each{|k| + construct_keys[k] = keys.delete(k) + } + + # create a component (the component must be scrollable) + @component = create_component(construct_keys) # set default receiver of method calls - @path = @text.path + @path = @component.path # assign scrollbars - @text.xscrollbar(@h_scroll) - @text.yscrollbar(@v_scroll) + @component.xscrollbar(@h_scroll) + @component.yscrollbar(@v_scroll) # allignment TkGrid.rowconfigure(@frame, 0, 'weight'=>1, 'minsize'=>0) TkGrid.columnconfigure(@frame, 0, 'weight'=>1, 'minsize'=>0) - @text.grid('row'=>0, 'column'=>0, 'sticky'=>'news') + @component.grid('row'=>0, 'column'=>0, 'sticky'=>'news') # scrollbars ON - vscroll(keys.delete('vscroll'){true}) - hscroll(keys.delete('hscroll'){true}) + vscroll(keys.delete('vscroll'){self.class::DEFAULT_VSCROLL}) + hscroll(keys.delete('hscroll'){self.class::DEFAULT_HSCROLL}) - # set background of the text widget -=begin - color = keys.delete('textbackground') - textbackground(color) if color -=end - # please check the differences of the following definitions - option_methods( - [:scrollbarwidth, :get_scrollbarwidth], - [:textbackground, nil, :textbg_info], - :textborderwidth, - :textrelief - ) - - # set receiver widgets for configure methods (with alias) - delegate_alias('scrollbarrelief', 'relief', @h_scroll, @v_scroll) - - # set receiver widgets for configure methods - delegate('DEFAULT', @text) - delegate('background', @frame, @h_scroll, @v_scroll) - delegate('activebackground', @h_scroll, @v_scroll) - delegate('troughcolor', @h_scroll, @v_scroll) - delegate('repeatdelay', @h_scroll, @v_scroll) - delegate('repeatinterval', @h_scroll, @v_scroll) - delegate('borderwidth', @frame) - delegate('relief', @frame) + # do configure + define_delegates # do configure configure keys unless keys.empty? end private :initialize_composite + # get/set width of scrollbar + def get_scrollbarwidth + @v_scroll.width + end + def set_scrollbarwidth(width) + @v_scroll.width(width) + @h_scroll.width(width) + end + alias :scrollbarwidth :set_scrollbarwidth + + def hook_vscroll_on(*args); end + def hook_vscroll_off(*args); end + def hook_hscroll_on(*args); end + def hook_hscroll_off(*args); end + private :hook_vscroll_on,:hook_vscroll_off,:hook_hscroll_on,:hook_hscroll_off + + # vertical scrollbar : ON/OFF + def vscroll(mode, *args) + st = TkGrid.info(@v_scroll) + if mode && st.size == 0 then + @v_scroll.grid('row'=>0, 'column'=>1, 'sticky'=>'ns') + hook_vscroll_on(*args) + elsif !mode && st.size != 0 then + @v_scroll.ungrid + hook_vscroll_off(*args) + end + self + end + + # horizontal scrollbar : ON/OFF + def hscroll(mode, *args) + st = TkGrid.info(@h_scroll) + if mode && st.size == 0 then + @h_scroll.grid('row'=>1, 'column'=>0, 'sticky'=>'ew') + hook_hscroll_on(*args) + elsif !mode && st.size != 0 then + @h_scroll.ungrid + hook_hscroll_off(*args) + end + self + end +end + +################################################ + +class TkTextFrame < TkText + include Tk::ScrollbarComposite + + # def component_construct_keys; []; end + # private :component_construct_keys + + def create_component(keys={}) + # keys has options which are listed by component_construct_keys method. + @text = TkText.new(@frame, 'wrap'=>'none') + @text.configure(keys) unless keys.empty? + + # option methods for component + option_methods( + [:textbackground, nil, :textbg_info], + :textborderwidth, + :textrelief + ) + + # return the created componet + @text + end + private :create_component + + # def component_delegates; end + # private :component_delegates + + def hook_hscroll_on(wrap_mode=nil) + if wrap_mode + wrap wrap_mode + else + wrap 'none' # => self.wrap('none') + end + end + def hook_hscroll_off(wrap_mode) + wrap wrap_mode # => self.wrap(wrap_mode) + end + def hscroll(mode, wrap_mode="char") + super + end + # set background color of text widget def textbackground(color = nil) if color @@ -103,60 +215,67 @@ class TkTextFrame < TkText def textrelief(type) @text.relief(type) end - - # get/set width of scrollbar - def get_scrollbarwidth - @v_scroll.width - end - def set_scrollbarwidth(width) - @v_scroll.width(width) - @h_scroll.width(width) - end - alias :scrollbarwidth :set_scrollbarwidth - - # vertical scrollbar : ON/OFF - def vscroll(mode) - st = TkGrid.info(@v_scroll) - if mode && st.size == 0 then - @v_scroll.grid('row'=>0, 'column'=>1, 'sticky'=>'ns') - elsif !mode && st.size != 0 then - @v_scroll.ungrid - end - self - end - - # horizontal scrollbar : ON/OFF - def hscroll(mode, wrap_mode="char") - st = TkGrid.info(@h_scroll) - if mode && st.size == 0 then - @h_scroll.grid('row'=>1, 'column'=>0, 'sticky'=>'ew') - wrap 'none' # => self.wrap('none') - elsif !mode && st.size != 0 then - @h_scroll.ungrid - wrap wrap_mode # => self.wrap(wrap_mode) - end - self - end end - ################################################ # test ################################################ if __FILE__ == $0 + TkLabel.new(:text=>'TkTextFrame is an example of Tk::ScrollbarComposite module.').pack f = TkFrame.new.pack('fill'=>'x') #t = TkTextFrame.new.pack - t = TkTextFrame.new(:textborderwidth=>3, - :textrelief=>:ridge, + t = TkTextFrame.new(:textborderwidth=>3, + :textrelief=>:ridge, :scrollbarrelief=>:ridge).pack p t.configinfo - TkButton.new(f, 'text'=>'vscr OFF', + TkButton.new(f, 'text'=>'vscr OFF', 'command'=>proc{t.vscroll(false)}).pack('side'=>'right') - TkButton.new(f, 'text'=>'vscr ON', + TkButton.new(f, 'text'=>'vscr ON', 'command'=>proc{t.vscroll(true)}).pack('side'=>'right') - TkButton.new(f, 'text'=>'hscr ON', + TkButton.new(f, 'text'=>'hscr ON', 'command'=>proc{t.hscroll(true)}).pack('side'=>'left') - TkButton.new(f, 'text'=>'hscr OFF', + TkButton.new(f, 'text'=>'hscr OFF', 'command'=>proc{t.hscroll(false)}).pack('side'=>'left') + + ############################################ + + # Tk.default_widget_set = :Ttk + + TkFrame.new.pack(:pady=>10) + TkLabel.new(:text=>'The following is another example of Tk::ScrollbarComposite module.').pack + + #---------------------------------- + class ScrListbox < TkListbox + include Tk::ScrollbarComposite + + DEFAULT_HSCROLL = false + + def create_component(keys={}) + TkListbox.new(@frame, keys) + end + private :create_component + end + #---------------------------------- + + f = TkFrame.new.pack(:pady=>5) + lbox = ScrListbox.new(f).pack(:side=>:left) + lbox.value = %w(aa bb cc dd eeeeeeeeeeeeeeeeeeeeeeeeee ffffffffff gg hh ii jj kk ll mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm nn oo pp qq) + fb = TkFrame.new(f).pack(:expand=>true, :fill=>:y, :padx=>5) + TkButton.new(fb, 'text'=>'lbox hscr OFF', + 'command'=>proc{lbox.hscroll(false)}).pack(:side=>:bottom, + :fill=>:x) + TkButton.new(fb, 'text'=>'lbox hscr ON', + 'command'=>proc{lbox.hscroll(true)}).pack(:side=>:bottom, + :fill=>:x) + TkFrame.new(fb).pack(:pady=>5, :side=>:bottom) + TkButton.new(fb, 'text'=>'lbox vscr OFF', + 'command'=>proc{lbox.vscroll(false)}).pack(:side=>:bottom, + :fill=>:x) + TkButton.new(fb, 'text'=>'lbox vscr ON', + 'command'=>proc{lbox.vscroll(true)}).pack(:side=>:bottom, + :fill=>:x) + + ############################################ + Tk.mainloop end diff --git a/ext/tk/sample/tktextio.rb b/ext/tk/sample/tktextio.rb index 9f012feada..679a2b7142 100644 --- a/ext/tk/sample/tktextio.rb +++ b/ext/tk/sample/tktextio.rb @@ -3,15 +3,15 @@ # TkTextIO class :: handling I/O stream on a TkText widget # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # -# NOTE: TkTextIO supports 'character' (not 'byte') access only. -# So, for example, TkTextIO#getc returns a character, TkTextIO#pos -# means the character position, TkTextIO#read(size) counts by +# NOTE: TkTextIO supports 'character' (not 'byte') access only. +# So, for example, TkTextIO#getc returns a character, TkTextIO#pos +# means the character position, TkTextIO#read(size) counts by # characters, and so on. -# Of course, it is available to make TkTextIO class to suuport -# 'byte' access. However, it may break multi-byte characters. +# Of course, it is available to make TkTextIO class to suuport +# 'byte' access. However, it may break multi-byte characters. # and then, displayed string on the text widget may be garbled. -# I think that it is not good on the supposed situation of using -# TkTextIO. +# I think that it is not good on the supposed situation of using +# TkTextIO. # require 'tk' require 'tk/text' @@ -24,14 +24,14 @@ class TkTextIO < TkText OPT_DEFAULTS = { 'mode' => nil, - 'overwrite' => false, - 'text' => nil, - 'show' => :pos, - 'wrap' => 'char', - 'sync' => true, - 'prompt' => nil, - 'prompt_cmd' => nil, - 'hist_size' => 1000, + 'overwrite' => false, + 'text' => nil, + 'show' => :pos, + 'wrap' => 'char', + 'sync' => true, + 'prompt' => nil, + 'prompt_cmd' => nil, + 'hist_size' => 1000, } def create_self(keys) @@ -46,7 +46,7 @@ class TkTextIO < TkText @buf_size = 0 @buf_max = 1024 - @write_buf_queue, @write_buf_mutex, + @write_buf_queue, @write_buf_mutex, @read_buf_queue, @read_buf_mutex = @@create_queues.call @idle_flush = TkTimer.new(:idle, 1, proc{ @flusher.run rescue nil }) @@ -87,7 +87,7 @@ class TkTextIO < TkText def _get_io_params(keys) opts = {} - self.class.const_get(:OPT_DEFAULTS).each{|k, v| + self.class.const_get(:OPT_DEFAULTS).each{|k, v| if keys.has_key?(k) opts[k] = keys.delete(k) else @@ -261,7 +261,7 @@ class TkTextIO < TkText Tk.callback_break end end - private :_cb_up, :_cb_down, :_cb_left, :_cb_backspace, + private :_cb_up, :_cb_down, :_cb_left, :_cb_backspace, :_cb_ctrl_a, :_cb_ctrl_u def _setup_console_bindings @@ -484,7 +484,7 @@ class TkTextIO < TkText Thread.pass if @open[:w] || ! @write_buffer.empty? @write_buf_mutex.synchronize { - _sync_write_buf(@write_buffer) + _sync_write_buf(@write_buffer) @write_buffer[0..-1] = '' } end @@ -666,7 +666,7 @@ class TkTextIO < TkText @txtpos.set('end - 1 char') elsif rs == '' @count_var.value # make it global - idx = tksearch_with_count([:regexp], @count_var, + idx = tksearch_with_count([:regexp], @count_var, "\n(\n)+", @txtpos, 'end - 1 char') if idx s = get(@txtpos, idx) << "\n" @@ -779,9 +779,9 @@ class TkTextIO < TkText end def show_mode=(mode) - # define show mode when file position is changed. - # mode == :pos or "pos" or true :: see current file position. - # mode == :insert or "insert" :: see insert cursor position. + # define show mode when file position is changed. + # mode == :pos or "pos" or true :: see current file position. + # mode == :insert or "insert" :: see insert cursor position. # mode == nil or false :: do nothing # else see 'mode' position ('mode' should be text index or mark) case mode @@ -921,9 +921,9 @@ if __FILE__ == $0 ev_loop = Thread.new{Tk.mainloop} f = TkFrame.new.pack - #tio = TkTextIO.new(f, :show=>:nil, - #tio = TkTextIO.new(f, :show=>:pos, - tio = TkTextIO.new(f, :show=>:insert, + #tio = TkTextIO.new(f, :show=>:nil, + #tio = TkTextIO.new(f, :show=>:pos, + tio = TkTextIO.new(f, :show=>:insert, :text=>">>> This is an initial text line. <<<\n\n"){ # yscrollbar(TkScrollbar.new(f).pack(:side=>:right, :fill=>:y)) pack(:side=>:left, :fill=>:both, :expand=>true) @@ -1045,12 +1045,12 @@ if __FILE__ == $0 num = 0 # io = TkTextIO.new(:mode=>:console, :prompt=>'').pack #=begin - io = TkTextIO.new(:mode=>:console, + io = TkTextIO.new(:mode=>:console, :prompt_cmd=>proc{ s = "[#{num}]" num += 1 s - }, + }, :prompt=>'-> ').pack #=end Thread.new{loop{sleep 2; io.puts 'hoge'}} diff --git a/ext/tk/sample/tktimer2.rb b/ext/tk/sample/tktimer2.rb index dd31bb098e..125115e863 100644 --- a/ext/tk/sample/tktimer2.rb +++ b/ext/tk/sample/tktimer2.rb @@ -5,7 +5,7 @@ require "tk" # new notation : # * symbols are acceptable as keys or values of the option hash -# * the parent widget can be given by :parent key on the option hash +# * the parent widget can be given by :parent key on the option hash root = TkRoot.new(:title=>'timer sample') label = TkLabel.new(:parent=>root, :relief=>:raised, :width=>10) \ .pack(:side=>:bottom, :fill=>:both) @@ -19,11 +19,11 @@ tick = proc{|aobj| #<== TkTimer object } timer = TkTimer.new(50, -1, tick).start(0, proc{ label.text('0.00'); 0 }) - # ==> repeat-interval : (about) 50 ms, - # repeat : infinite (-1) times, + # ==> repeat-interval : (about) 50 ms, + # repeat : infinite (-1) times, # repeat-procedure : tick (only one, in this case) # - # ==> wait-before-call-init-proc : 0 ms, + # ==> wait-before-call-init-proc : 0 ms, # init_proc : proc{ label.text('0.00'); 0 } # # (0ms)-> init_proc ->(50ms)-> tick ->(50ms)-> tick ->.... diff --git a/ext/tk/sample/tktimer3.rb b/ext/tk/sample/tktimer3.rb index e3bb4c3e4a..08e8a3cad4 100644 --- a/ext/tk/sample/tktimer3.rb +++ b/ext/tk/sample/tktimer3.rb @@ -5,7 +5,7 @@ require "tk" # new notation : # * symbols are acceptable as keys or values of the option hash -# * the parent widget can be given by :parent key on the option hash +# * the parent widget can be given by :parent key on the option hash root = TkRoot.new(:title=>'timer sample') label = TkLabel.new(:parent=>root, :relief=>:raised, :width=>10) \ .pack(:side=>:bottom, :fill=>:both) @@ -19,11 +19,11 @@ tick = proc{|aobj| #<== TkTimer object } timer = TkTimer.new(50, -1, tick).start(0, proc{ label.text('0.00'); 0 }) - # ==> repeat-interval : (about) 50 ms, - # repeat : infinite (-1) times, + # ==> repeat-interval : (about) 50 ms, + # repeat : infinite (-1) times, # repeat-procedure : tick (only one, in this case) # - # ==> wait-before-call-init-proc : 0 ms, + # ==> wait-before-call-init-proc : 0 ms, # init_proc : proc{ label.text('0.00'); 0 } # # (0ms)-> init_proc ->(50ms)-> tick ->(50ms)-> tick ->.... diff --git a/ext/tk/sample/tktree.rb b/ext/tk/sample/tktree.rb index 56b7211c88..4eb7f60627 100644 --- a/ext/tk/sample/tktree.rb +++ b/ext/tk/sample/tktree.rb @@ -3,10 +3,10 @@ # # see # -# Note: optional argument '-font' of the Tcl library is changed to -# 'itemfont' on this Ruby library, because of avoiding font -# operation trouble in 'initialize' method ( see the following -# test script ). +# Note: optional argument '-font' of the Tcl library is changed to +# 'itemfont' on this Ruby library, because of avoiding font +# operation trouble in 'initialize' method ( see the following +# test script ). # ########################################################################## require 'tk' @@ -68,9 +68,9 @@ end if __FILE__ == $0 TkLabel.new(:text=><:ridge, :justify=>:left).pack - This is a sample to use a Tcl library script on Ruby/Tk. - This sample loads tktree.tcl (see ) - and calls functions of the Tcl script. + This is a sample to use a Tcl library script on Ruby/Tk. + This sample loads tktree.tcl (see ) + and calls functions of the Tcl script. EOL items = %w(/group1/item1 /group1/item2 /group1/subgroup/item1 /group2/item1 /item1) @@ -79,14 +79,14 @@ EOL tr1.focus items.each{|item| - tr1.newitem(item, + tr1.newitem(item, :command=>proc{Tk.messageBox(:message=>"#{item} executed")}) } f = TkFrame.new.pack(:expand=>true, :fill=>:both) - tr2 = TkTree.new(f, :bg=>'black', #:itemfont=>{:family=>'Times', :size=>14}, - :textcolor=>'red', :bd=>4, :relief=>:ridge, - :selectbackground=>'darkBlue', :selectforeground=>'yellow', + tr2 = TkTree.new(f, :bg=>'black', #:itemfont=>{:family=>'Times', :size=>14}, + :textcolor=>'red', :bd=>4, :relief=>:ridge, + :selectbackground=>'darkBlue', :selectforeground=>'yellow', :selectborderwidth=>3, :linecolor=>'yellow') { yscrollbar(TkScrollbar.new(f, :width=>10).pack(:side=>:right, :fill=>:y)) xscrollbar(TkScrollbar.new(f, :width=>10).pack(:side=>:bottom, :fill=>:x)) @@ -94,8 +94,8 @@ EOL } items.each{|item| - tr2.newitem(item, :textcolor=>'green', :image=>'', - :itemfont=>{:family=>'Times', :size=>10}, + tr2.newitem(item, :textcolor=>'green', :image=>'', + :itemfont=>{:family=>'Times', :size=>10}, :command=>proc{Tk.messageBox(:message=>"#{item} executed")}) } diff --git a/ext/tk/sample/ttk_wrapper.rb b/ext/tk/sample/ttk_wrapper.rb index 1580668994..e4eb9c7964 100644 --- a/ext/tk/sample/ttk_wrapper.rb +++ b/ext/tk/sample/ttk_wrapper.rb @@ -10,7 +10,7 @@ version = '0.1.3' # parse commandline arguments ########################################################################## require 'optparse' -opt = OptionParser.new("Usage: #{$0} [options] rubytk_script" << "\n " << +opt = OptionParser.new("Usage: #{$0} [options] rubytk_script" << "\n " << "Ruby/Tk script wrapper. Use Ttk widgets as default.") opt.version = version @@ -21,7 +21,7 @@ OPTS[:theme] = 'default' opt.on('-l', '--list', 'list available theme names'){|v| OPTS[:list] = true} opt.on('-t', '--theme theme', 'theme name'){|v| OPTS[:theme] = v} -opt.on('-d', '--themedir themes_dir', 'directory of theme definitions'){|v| +opt.on('-d', '--themedir themes_dir', 'directory of theme definitions'){|v| OPTS[:themedir] << v } opt.on('-r', '--rubytheme rb_theme', 'theme definition file (ruby script)'){|v| @@ -42,7 +42,7 @@ begin Tk.default_widget_set = :Ttk rescue LoadError if OPTS[:verbose] - print "warning: fail to load 'Ttk' extension. use standard widgets.\n" + print "warning: fail to load 'Ttk' extension. use standard widgets.\n" end end @@ -53,7 +53,7 @@ end ########################################################################## # define Tcl/Tk procedures for compatibility. -# those are required when want to use themes included +# those are required when want to use themes included # in "sample/tkextlib/tile/demo.rb". ########################################################################## Tk::Tile.__define_LoadImages_proc_for_compatibility__! @@ -111,7 +111,7 @@ TkItemConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__! true # set theme of widget style ########################################################################## if OPTS[:list] || OPTS[:verbose] - print "supported theme names: #{Tk::Tile.themes.inspect}\n" + print "supported theme names: #{Tk::Tile.themes.inspect}\n" exit if OPTS[:list] && ARGV.empty? end print "use theme: \"#{OPTS[:theme]}\"\n" if OPTS[:theme] && OPTS[:verbose] @@ -122,7 +122,7 @@ Tk::Tile.set_theme(OPTS[:theme]) if OPTS[:theme] ########################################################################## # replace $0 and $RPAGRAM_NAME ########################################################################## -# When the expand_path of the target script is long, ruby sometimes +# When the expand_path of the target script is long, ruby sometimes # fails to set the path to $0 (the path string is trimmed). # The following replaces $0 and $PROGNAME to avoid such trouble. progname_obj = $0.dup diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c index 037031841b..cc3c0e9b8d 100644 --- a/ext/tk/tcltklib.c +++ b/ext/tk/tcltklib.c @@ -4,15 +4,10 @@ * Oct. 24, 1997 Y. Matsumoto */ -#define TCLTKLIB_RELEASE_DATE "2008-05-23" +#define TCLTKLIB_RELEASE_DATE "2009-07-12" #include "ruby.h" -#ifdef HAVE_RUBY_SIGNAL_H -#include "ruby/signal.h" -#else -#include "rubysig.h" -#endif #ifdef HAVE_RUBY_ENCODING_H #include "ruby/encoding.h" #endif @@ -20,6 +15,25 @@ #include "version.h" #endif +#ifdef RUBY_VM +static VALUE rb_thread_critical; /* dummy */ +int rb_thread_check_trap_pending(); +#else +/* use rb_thread_critical on Ruby 1.8.x */ +#include "rubysig.h" +#endif + +#ifdef OBJ_UNTRUST +#define RbTk_OBJ_UNTRUST(x) do {OBJ_TAINT(x); OBJ_UNTRUST(x);} while (0) +#else +#define RbTk_OBJ_UNTRUST(x) OBJ_TAINT(x) +#endif + +#if defined(HAVE_RB_PROC_NEW) && !defined(RUBY_VM) +/* Ruby 1.8 :: rb_proc_new() was hidden from intern.h at 2008/04/22 */ +extern VALUE rb_proc_new _((VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE)); +#endif + #undef EXTERN /* avoid conflict with tcl.h of tcl8.2 or before */ #include #ifdef HAVE_STDARG_PROTOTYPES @@ -39,6 +53,7 @@ #else #define RUBY_USE_NATIVE_THREAD 1 #endif + #ifndef HAVE_RB_ERRINFO #define rb_errinfo() (ruby_errinfo+0) /* cannot be l-value */ #endif @@ -49,16 +64,16 @@ #include "stubs.h" #ifndef TCL_ALPHA_RELEASE -#define TCL_ALPHA_RELEASE 0 -#define TCL_BETA_RELEASE 1 -#define TCL_FINAL_RELEASE 2 +#define TCL_ALPHA_RELEASE 0 /* "alpha" */ +#define TCL_BETA_RELEASE 1 /* "beta" */ +#define TCL_FINAL_RELEASE 2 /* "final" */ #endif static struct { int major; int minor; + int type; /* ALPHA==0, BETA==1, FINAL==2 */ int patchlevel; - int type; } tcltk_version = {0, 0, 0, 0}; static void @@ -93,6 +108,14 @@ set_tcltk_version() # endif #endif +#ifndef CONST86 +# if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION <= 5 /* Tcl8.0.x -- 8.5.x */ +# define CONST86 +# else +# define CONST86 CONST84 +# endif +#endif + /* copied from eval.c */ #define TAG_RETURN 0x1 #define TAG_BREAK 0x2 @@ -116,7 +139,7 @@ fprintf(stderr, ARG1, ARG2, ARG3); fprintf(stderr, "\n"); fflush(stderr); } */ /* release date */ -const char tcltklib_release_date[] = TCLTKLIB_RELEASE_DATE; +static const char tcltklib_release_date[] = TCLTKLIB_RELEASE_DATE; /* finalize_proc_name */ static const char finalize_hook_name[] = "INTERP_FINALIZE_HOOK"; @@ -193,10 +216,10 @@ static VALUE callq_safelevel_handler _((VALUE, VALUE)); /* Tcl's object type */ #if TCL_MAJOR_VERSION >= 8 static const char Tcl_ObjTypeName_ByteArray[] = "bytearray"; -static Tcl_ObjType *Tcl_ObjType_ByteArray; +static CONST86 Tcl_ObjType *Tcl_ObjType_ByteArray; static const char Tcl_ObjTypeName_String[] = "string"; -static Tcl_ObjType *Tcl_ObjType_String; +static CONST86 Tcl_ObjType *Tcl_ObjType_String; #if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1) #define IS_TCL_BYTEARRAY(obj) ((obj)->typePtr == Tcl_ObjType_ByteArray) @@ -409,11 +432,12 @@ call_queue_mark(struct call_queue *q) static VALUE eventloop_thread; +static Tcl_Interp *eventloop_interp; #ifdef RUBY_USE_NATIVE_THREAD Tcl_ThreadId tk_eventloop_thread_id; /* native thread ID of Tcl interpreter */ #endif static VALUE eventloop_stack; -static int window_event_mode = ( ~ TCL_IDLE_EVENTS | TCL_WINDOW_EVENTS ); +static int window_event_mode = ~0; static VALUE watchdog_thread; @@ -425,9 +449,15 @@ Tcl_Interp *current_interp; : USE_TOGGLE_WINDOW_MODE_FOR_IDLE 0 : DO_THREAD_SCHEDULE_AT_CALLBACK_DONE 0 */ +#ifdef RUBY_USE_NATIVE_THREAD +#define CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE 1 +#define USE_TOGGLE_WINDOW_MODE_FOR_IDLE 0 +#define DO_THREAD_SCHEDULE_AT_CALLBACK_DONE 1 +#else /* ! RUBY_USE_NATIVE_THREAD */ #define CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE 1 #define USE_TOGGLE_WINDOW_MODE_FOR_IDLE 0 #define DO_THREAD_SCHEDULE_AT_CALLBACK_DONE 0 +#endif #if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE static int have_rb_thread_waiting_for_value = 0; @@ -443,7 +473,7 @@ static int have_rb_thread_waiting_for_value = 0; #ifdef RUBY_USE_NATIVE_THREAD #define DEFAULT_EVENT_LOOP_MAX 800/*counts*/ #define DEFAULT_NO_EVENT_TICK 10/*counts*/ -#define DEFAULT_NO_EVENT_WAIT 10/*milliseconds ( 1 -- 999 ) */ +#define DEFAULT_NO_EVENT_WAIT 1/*milliseconds ( 1 -- 999 ) */ #define WATCHDOG_INTERVAL 10/*milliseconds ( 1 -- 999 ) */ #define DEFAULT_TIMER_TICK 0/*milliseconds ( 0 -- 999 ) */ #define NO_THREAD_INTERRUPT_TIME 100/*milliseconds ( 1 -- 999 ) */ @@ -456,6 +486,8 @@ static int have_rb_thread_waiting_for_value = 0; #define NO_THREAD_INTERRUPT_TIME 100/*milliseconds ( 1 -- 999 ) */ #endif +#define EVENT_HANDLER_TIMEOUT 100/*milliseconds*/ + static int event_loop_max = DEFAULT_EVENT_LOOP_MAX; static int no_event_tick = DEFAULT_NO_EVENT_TICK; static int no_event_wait = DEFAULT_NO_EVENT_WAIT; @@ -1183,7 +1215,7 @@ set_eventloop_window_mode(self, mode) if (RTEST(mode)) { window_event_mode = ~0; } else { - window_event_mode = ~(TCL_WINDOW_EVENTS | TCL_IDLE_EVENTS); + window_event_mode = ~TCL_WINDOW_EVENTS; } return mode; @@ -1549,6 +1581,10 @@ eventloop_sleep(dummy) { struct timeval t; + if (no_event_wait <= 0) { + return Qnil; + } + t.tv_sec = (time_t)0; t.tv_usec = (long)(no_event_wait*1000.0); @@ -1613,6 +1649,53 @@ get_thread_alone_check_flag() } #endif +#define TRAP_CHECK() do { \ + if (trap_check(check_var) == 0) return 0; \ +} while (0) + +static int +trap_check(int *check_var) +{ + DUMP1("trap check"); + +#ifdef RUBY_VM + if (rb_thread_check_trap_pending()) { + if (check_var != (int*)NULL) { + /* wait command */ + return 0; + } + else { + rb_thread_check_ints(); + } + } +#else + if (rb_trap_pending) { + run_timer_flag = 0; + if (rb_prohibit_interrupt || check_var != (int*)NULL) { + /* pending or on wait command */ + return 0; + } else { + rb_trap_exec(); + } + } +#endif + + return 1; +} + +static int +check_eventloop_interp() +{ + DUMP1("check eventloop_interp"); + if (eventloop_interp != (Tcl_Interp*)NULL + && Tcl_InterpDeleted(eventloop_interp)) { + DUMP2("eventloop_interp(%p) was deleted", eventloop_interp); + return 1; + } + + return 0; +} + static int lib_eventloop_core(check_root, update_flag, check_var, interp) int check_root; @@ -1654,6 +1737,8 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) #endif for(;;) { + if (check_eventloop_interp()) return 0; + #if USE_EVLOOP_THREAD_ALONE_CHECK_FLAG if (thread_alone_check_flag && rb_thread_alone()) { #else @@ -1745,28 +1830,13 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) } } - DUMP1("trap check"); - if (rb_trap_pending) { - run_timer_flag = 0; - if (rb_prohibit_interrupt || check_var != (int*)NULL) { - /* pending or on wait command */ - return 0; - } else { - rb_trap_exec(); - } - } + TRAP_CHECK(); + if (check_eventloop_interp()) return 0; - DUMP1("check Root Widget"); + DUMP1("check Root Widget"); if (check_root && tk_stubs_init_p() && Tk_GetNumMainWindows() == 0) { run_timer_flag = 0; - if (rb_trap_pending) { - if (rb_prohibit_interrupt || check_var != (int*)NULL) { - /* pending or on wait command */ - return 0; - } else { - rb_trap_exec(); - } - } + TRAP_CHECK(); return 1; } @@ -1876,16 +1946,7 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) return 0; } - DUMP1("trap check"); - if (rb_trap_pending) { - run_timer_flag = 0; - if (rb_prohibit_interrupt || check_var != (int*)NULL) { - /* pending or on wait command */ - return 0; - } else { - rb_trap_exec(); - } - } + TRAP_CHECK(); if (check_var != (int*)NULL && !NIL_P(rbtk_pending_exception)) { @@ -1956,28 +2017,13 @@ lib_eventloop_core(check_root, update_flag, check_var, interp) return 1; } - DUMP1("trap check"); - if (rb_trap_pending) { - run_timer_flag = 0; - if (rb_prohibit_interrupt || check_var != (int*)NULL) { - /* pending or on wait command */ - return 0; - } else { - rb_trap_exec(); - } - } + TRAP_CHECK(); + if (check_eventloop_interp()) return 0; DUMP1("check Root Widget"); if (check_root && tk_stubs_init_p() && Tk_GetNumMainWindows() == 0) { run_timer_flag = 0; - if (rb_trap_pending) { - if (rb_prohibit_interrupt || check_var != (int*)NULL) { - /* pending or on wait command */ - return 0; - } else { - rb_trap_exec(); - } - } + TRAP_CHECK(); return 1; } @@ -2109,8 +2155,11 @@ lib_eventloop_ensure(args) break; } - /* if (RTEST(rb_funcall(eventloop_thread, ID_alive_p, 0, 0))) { */ +#ifdef RUBY_VM + if (RTEST(rb_funcall(eventloop_thread, ID_alive_p, 0, 0))) { +#else if (RTEST(rb_thread_alive_p(eventloop_thread))) { +#endif DUMP2("eventloop-enshure: wake up parent %lx", eventloop_thread); rb_thread_wakeup(eventloop_thread); @@ -2213,6 +2262,7 @@ ip_mainloop(argc, argv, self) VALUE *argv; VALUE self; { + volatile VALUE ret; struct tcltkip *ptr = get_ip(self); /* ip is deleted? */ @@ -2224,7 +2274,11 @@ ip_mainloop(argc, argv, self) /* slave IP */ return Qnil; } - return lib_mainloop(argc, argv, self); + + eventloop_interp = ptr->ip; + ret = lib_mainloop(argc, argv, self); + eventloop_interp = (Tcl_Interp*)NULL; + return ret; } @@ -2314,7 +2368,7 @@ lib_mainloop_watchdog(argc, argv, self) { VALUE check_rootwidget; -#ifdef RUBY_USE_NATIVE_THREAD +#ifdef RUBY_VM rb_raise(rb_eNotImpError, "eventloop_watchdog is not implemented on Ruby VM."); #endif @@ -2428,8 +2482,11 @@ lib_thread_callback(argc, argv, self) foundEvent = RTEST(lib_eventloop_launcher(/* not check root-widget */0, 0, q->done, (Tcl_Interp*)NULL)); - /* if (RTEST(rb_funcall(th, ID_alive_p, 0))) { */ +#ifdef RUBY_VM + if (RTEST(rb_funcall(th, ID_alive_p, 0))) { +#else if (RTEST(rb_thread_alive_p(th))) { +#endif rb_funcall(th, ID_kill, 0); ret = Qnil; } else { @@ -2807,7 +2864,6 @@ tcl_protect(interp, proc, data) VALUE (*proc)(); VALUE data; { - int old_trapflag = rb_trap_immediate; int code; #ifdef HAVE_NATIVETHREAD @@ -2818,9 +2874,16 @@ tcl_protect(interp, proc, data) #endif #endif - rb_trap_immediate = 0; +#ifdef RUBY_VM code = tcl_protect_core(interp, proc, data); - rb_trap_immediate = old_trapflag; +#else + do { + int old_trapflag = rb_trap_immediate; + rb_trap_immediate = 0; + code = tcl_protect_core(interp, proc, data); + rb_trap_immediate = old_trapflag; + } while (0); +#endif return code; } @@ -2915,6 +2978,7 @@ ip_ruby_cmd_core(arg) thr_crit_bup = rb_thread_critical; rb_thread_critical = Qfalse; ret = rb_apply(arg->receiver, arg->method, arg->args); + DUMP2("rb_apply return:%lx", ret); rb_thread_critical = thr_crit_bup; DUMP1("finish ip_ruby_cmd_core"); @@ -3098,25 +3162,20 @@ ip_ruby_cmd(clientData, interp, argc, argv) /* get args */ args = rb_ary_new2(argc - 2); -#ifdef HAVE_STRUCT_RARRAY_LEN - RARRAY(args)->len = 0; -#endif for(i = 3; i < argc; i++) { + VALUE s; #if TCL_MAJOR_VERSION >= 8 str = Tcl_GetStringFromObj(argv[i], &len); + s = rb_tainted_str_new(str, len); +#else /* TCL_MAJOR_VERSION < 8 */ + str = argv[i]; + s = rb_tainted_str_new2(str); +#endif DUMP2("arg:%s",str); #ifndef HAVE_STRUCT_RARRAY_LEN - rb_ary_push(args, rb_tainted_str_new(str, len)); + rb_ary_push(args, s); #else - RARRAY(args)->ptr[RARRAY(args)->len++] = rb_tainted_str_new(str, len); -#endif -#else /* TCL_MAJOR_VERSION < 8 */ - DUMP2("arg:%s",argv[i]); -#ifndef HAVE_STRUCT_RARRAY_LEN - rb_ary_push(args, rb_tainted_str_new2(argv[i])); -#else - RARRAY(args)->ptr[RARRAY(args)->len++] = rb_tainted_str_new2(argv[i]); -#endif + RARRAY(args)->ptr[RARRAY(args)->len++] = s; #endif } @@ -3388,7 +3447,11 @@ ip_rbUpdateCommand(clientData, interp, objc, objv) } /* trap check */ +#ifdef RUBY_VM + if (rb_thread_check_trap_pending()) { +#else if (rb_trap_pending) { +#endif Tcl_Release(interp); return TCL_RETURN; @@ -3456,6 +3519,7 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv) static CONST char *updateOptions[] = {"idletasks", (char *) NULL}; enum updateOptions {REGEXP_IDLETASKS}; volatile VALUE current_thread = rb_thread_current(); + struct timeval t; DUMP1("Ruby's 'thread_update' is called"); if (interp == (Tcl_Interp*)NULL) { @@ -3543,10 +3607,17 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv) DUMP1("set idle proc"); Tcl_DoWhenIdle(rb_threadUpdateProc, (ClientData) param); + t.tv_sec = (time_t)0; + t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0); + while(!param->done) { - DUMP1("wait for complete idle proc"); - /* rb_thread_stop(); */ - rb_thread_sleep_forever(); + DUMP1("wait for complete idle proc"); + /* rb_thread_stop(); */ + /* rb_thread_sleep_forever(); */ + rb_thread_wait_for(t); + if (NIL_P(eventloop_thread)) { + break; + } } #if 0 /* use Tcl_EventuallyFree */ @@ -3754,7 +3825,11 @@ ip_rbVwaitCommand(clientData, interp, objc, objv) } /* trap check */ +#ifdef RUBY_VM + if (rb_thread_check_trap_pending()) { +#else if (rb_trap_pending) { +#endif #if TCL_MAJOR_VERSION >= 8 Tcl_DecrRefCount(objv[1]); #endif @@ -4043,7 +4118,11 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv) } /* trap check */ - if (rb_trap_pending) { +#ifdef RUBY_VM + if (rb_thread_check_trap_pending()) { +#else + if (rb_trap_pending) { +#endif Tcl_Release(interp); return TCL_RETURN; @@ -4103,7 +4182,11 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv) } /* trap check */ - if (rb_trap_pending) { +#ifdef RUBY_VM + if (rb_thread_check_trap_pending()) { +#else + if (rb_trap_pending) { +#endif #if TCL_MAJOR_VERSION >= 8 Tcl_DecrRefCount(objv[2]); #endif @@ -4198,7 +4281,11 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv) } /* trap check */ - if (rb_trap_pending) { +#ifdef RUBY_VM + if (rb_thread_check_trap_pending()) { +#else + if (rb_trap_pending) { +#endif Tcl_Release(interp); return TCL_RETURN; @@ -4318,6 +4405,7 @@ ip_rb_threadVwaitCommand(clientData, interp, objc, objv) int ret, dummy; int thr_crit_bup; volatile VALUE current_thread = rb_thread_current(); + struct timeval t; DUMP1("Ruby's 'thread_vwait' is called"); if (interp == (Tcl_Interp*)NULL) { @@ -4412,9 +4500,16 @@ ip_rb_threadVwaitCommand(clientData, interp, objc, objv) return TCL_ERROR; } + t.tv_sec = (time_t)0; + t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0); + while(!param->done) { - /* rb_thread_stop(); */ - rb_thread_sleep_forever(); + /* rb_thread_stop(); */ + /* rb_thread_sleep_forever(); */ + rb_thread_wait_for(t); + if (NIL_P(eventloop_thread)) { + break; + } } thr_crit_bup = rb_thread_critical; @@ -4473,6 +4568,7 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) int ret, dummy; int thr_crit_bup; volatile VALUE current_thread = rb_thread_current(); + struct timeval t; DUMP1("Ruby's 'thread_tkwait' is called"); if (interp == (Tcl_Interp*)NULL) { @@ -4626,9 +4722,16 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) return TCL_ERROR; } + t.tv_sec = (time_t)0; + t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0); + while(!param->done) { - /* rb_thread_stop(); */ - rb_thread_sleep_forever(); + /* rb_thread_stop(); */ + /* rb_thread_sleep_forever(); */ + rb_thread_wait_for(t); + if (NIL_P(eventloop_thread)) { + break; + } } thr_crit_bup = rb_thread_critical; @@ -4705,10 +4808,17 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) rb_thread_critical = thr_crit_bup; + t.tv_sec = (time_t)0; + t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0); + while(param->done != TKWAIT_MODE_VISIBILITY) { - if (param->done == TKWAIT_MODE_DESTROY) break; - /* rb_thread_stop(); */ - rb_thread_sleep_forever(); + if (param->done == TKWAIT_MODE_DESTROY) break; + /* rb_thread_stop(); */ + /* rb_thread_sleep_forever(); */ + rb_thread_wait_for(t); + if (NIL_P(eventloop_thread)) { + break; + } } thr_crit_bup = rb_thread_critical; @@ -4820,9 +4930,16 @@ ip_rb_threadTkWaitCommand(clientData, interp, objc, objv) rb_thread_critical = thr_crit_bup; + t.tv_sec = (time_t)0; + t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0); + while(param->done != TKWAIT_MODE_DESTROY) { - /* rb_thread_stop(); */ - rb_thread_sleep_forever(); + /* rb_thread_stop(); */ + /* rb_thread_sleep_forever(); */ + rb_thread_wait_for(t); + if (NIL_P(eventloop_thread)) { + break; + } } Tcl_Release(window); @@ -5087,7 +5204,9 @@ ip_finalize(ip) } /* delete root widget */ -#if 1 +#ifdef RUBY_VM + /* cause SEGV on Ruby 1.9 */ +#else DUMP1("check `destroy'"); if (Tcl_GetCommandInfo(ip, "destroy", &info)) { DUMP1("call `destroy .'"); @@ -5306,7 +5425,7 @@ ip_rbNamespaceObjCmd(clientData, interp, objc, objv) } rbtk_eventloop_depth++; - DUMP2("namespace wrapper enter depth == %d", rbtk_eventloop_depth); + /* DUMP2("namespace wrapper enter depth == %d", rbtk_eventloop_depth); */ if (info.isNativeObjectProc) { ret = (*(info.objProc))(info.objClientData, interp, objc, objv); @@ -5342,7 +5461,7 @@ ip_rbNamespaceObjCmd(clientData, interp, objc, objv) #endif } - DUMP2("namespace wrapper exit depth == %d", rbtk_eventloop_depth); + /* DUMP2("namespace wrapper exit depth == %d", rbtk_eventloop_depth); */ rbtk_eventloop_depth--; return ret; @@ -5504,6 +5623,7 @@ ip_init(argc, argv, self) ; } + st = ruby_tcl_stubs_init(); /* from Tcl_AppInit() */ if (with_tk) { DUMP1("Tk_Init"); @@ -6146,7 +6266,7 @@ get_obj_from_str(str) /* binary string */ return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LEN(str)); #endif - } else if (strlen(s) != RSTRING_LEN(str)) { + } else if (memchr(s, 0, RSTRING_LEN(str))) { /* probably binary string */ return Tcl_NewByteArrayObj((const unsigned char *)s, RSTRING_LEN(str)); } else { @@ -6168,7 +6288,7 @@ ip_get_result_string_obj(interp) retObj = Tcl_GetObjResult(interp); Tcl_IncrRefCount(retObj); strval = get_str_from_obj(retObj); - OBJ_TAINT(strval); + RbTk_OBJ_UNTRUST(strval); Tcl_ResetResult(interp); Tcl_DecrRefCount(retObj); return strval; @@ -6214,8 +6334,13 @@ call_queue_handler(evPtr, flags) DUMP1("process it on current event-loop"); } +#ifdef RUBY_VM + if (RTEST(rb_funcall(thread, ID_alive_p, 0)) + && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { +#else if (RTEST(rb_thread_alive_p(thread)) && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { +#endif DUMP1("caller is not yet ready to receive the result -> pending"); return 0; } @@ -6264,8 +6389,11 @@ call_queue_handler(evPtr, flags) q->thread = (VALUE)NULL; /* back to caller */ - /* if (RTEST(rb_funcall(thread, ID_alive_p, 0, 0))) { */ +#ifdef RUBY_VM + if (RTEST(rb_funcall(thread, ID_alive_p, 0, 0))) { +#else if (RTEST(rb_thread_alive_p(thread))) { +#endif DUMP2("back to caller (caller thread:%lx)", thread); DUMP2(" (current thread:%lx)", rb_thread_current()); #if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE @@ -6303,6 +6431,7 @@ tk_funcall(func, argc, argv, obj) volatile VALUE ip_obj = obj; volatile VALUE result; volatile VALUE ret; + struct timeval t; if (!NIL_P(ip_obj) && rb_obj_is_kind_of(ip_obj, tcltkip_class)) { ptr = get_ip(ip_obj); @@ -6412,12 +6541,21 @@ tk_funcall(func, argc, argv, obj) rb_thread_critical = thr_crit_bup; /* wait for the handler to be processed */ - DUMP2("wait for handler (current thread:%lx)", current); + t.tv_sec = (time_t)0; + t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0); + + DUMP2("callq wait for handler (current thread:%lx)", current); while(*alloc_done >= 0) { - DUMP2("*** wait for handler (current thread:%lx)", current); + DUMP2("*** callq wait for handler (current thread:%lx)", current); /* rb_thread_stop(); */ - rb_thread_sleep_forever(); - DUMP2("*** wakeup (current thread:%lx)", current); + /* rb_thread_sleep_forever(); */ + rb_thread_wait_for(t); + DUMP2("*** callq wakeup (current thread:%lx)", current); + DUMP2("*** (eventloop thread:%lx)", eventloop_thread); + if (NIL_P(eventloop_thread)) { + DUMP1("*** callq lost eventloop thread"); + break; + } } DUMP2("back from handler (current thread:%lx)", current); @@ -6688,8 +6826,13 @@ eval_queue_handler(evPtr, flags) DUMP1("process it on current event-loop"); } +#ifdef RUBY_VM + if (RTEST(rb_funcall(thread, ID_alive_p, 0)) + && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { +#else if (RTEST(rb_thread_alive_p(thread)) && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { +#endif DUMP1("caller is not yet ready to receive the result -> pending"); return 0; } @@ -6742,8 +6885,11 @@ eval_queue_handler(evPtr, flags) q->thread = (VALUE)NULL; /* back to caller */ - /* if (RTEST(rb_funcall(thread, ID_alive_p, 0, 0))) { */ +#ifdef RUBY_VM + if (RTEST(rb_funcall(thread, ID_alive_p, 0, 0))) { +#else if (RTEST(rb_thread_alive_p(thread))) { +#endif DUMP2("back to caller (caller thread:%lx)", thread); DUMP2(" (current thread:%lx)", rb_thread_current()); #if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE @@ -6782,6 +6928,7 @@ ip_eval(self, str) volatile VALUE result; volatile VALUE ret; Tcl_QueuePosition position; + struct timeval t; thr_crit_bup = rb_thread_critical; rb_thread_critical = Qtrue; @@ -6790,7 +6937,12 @@ ip_eval(self, str) #ifdef RUBY_USE_NATIVE_THREAD ptr = get_ip(ip_obj); + DUMP2("eval status: ptr->tk_thread_id %p", ptr->tk_thread_id); + DUMP2("eval status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread()); +#else + DUMP2("status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread()); #endif + DUMP2("status: eventloopt_thread %lx", eventloop_thread); if ( #ifdef RUBY_USE_NATIVE_THREAD @@ -6878,12 +7030,21 @@ ip_eval(self, str) rb_thread_critical = thr_crit_bup; /* wait for the handler to be processed */ - DUMP2("wait for handler (current thread:%lx)", current); + t.tv_sec = (time_t)0; + t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0); + + DUMP2("evq wait for handler (current thread:%lx)", current); while(*alloc_done >= 0) { - DUMP2("*** wait for handler (current thread:%lx)", current); + DUMP2("*** evq wait for handler (current thread:%lx)", current); /* rb_thread_stop(); */ - rb_thread_sleep_forever(); - DUMP2("*** wakeup (current thread:%lx)", current); + /* rb_thread_sleep_forever(); */ + rb_thread_wait_for(t); + DUMP2("*** evq wakeup (current thread:%lx)", current); + DUMP2("*** (eventloop thread:%lx)", eventloop_thread); + if (NIL_P(eventloop_thread)) { + DUMP1("*** evq lost eventloop thread"); + break; + } } DUMP2("back from handler (current thread:%lx)", current); @@ -6929,6 +7090,71 @@ ip_eval(self, str) } +static int +ip_cancel_eval_core(interp, msg, flag) + Tcl_Interp *interp; + VALUE msg; + int flag; +{ +#if TCL_MAJOR_VERSION < 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 6) + rb_raise(rb_eNotImpError, + "cancel_eval is supported Tcl/Tk8.6 or later."); +#else + Tcl_Obj *msg_obj; + + if (NIL_P(msg)) { + msg_obj = NULL; + } else { + msg_obj = Tcl_NewStringObj(RSTRING_PTR(msg), RSTRING_LEN(msg)); + Tcl_IncrRefCount(msg_obj); + } + + return Tcl_CancelEval(interp, msg_obj, 0, flag); +#endif +} + +static VALUE +ip_cancel_eval(argc, argv, self) + int argc; + VALUE *argv; + VALUE self; +{ + VALUE retval; + + if (rb_scan_args(argc, argv, "01", &retval) == 0) { + retval = Qnil; + } + if (ip_cancel_eval_core(get_ip(self)->ip, retval, 0) == TCL_OK) { + return Qtrue; + } else { + return Qfalse; + } +} + +#ifndef TCL_CANCEL_UNWIND +#define TCL_CANCEL_UNWIND 0x100000 +#endif +static VALUE +ip_cancel_eval_unwind(argc, argv, self) + int argc; + VALUE *argv; + VALUE self; +{ + int flag = 0; + VALUE retval; + + if (rb_scan_args(argc, argv, "01", &retval) == 0) { + retval = Qnil; + } + + flag |= TCL_CANCEL_UNWIND; + if (ip_cancel_eval_core(get_ip(self)->ip, retval, flag) == TCL_OK) { + return Qtrue; + } else { + return Qfalse; + } +} + /* restart Tk */ static VALUE lib_restart_core(interp, argc, argv) @@ -7168,8 +7394,8 @@ lib_toUTF8_core(ip_obj, src, encodename) #ifdef HAVE_RUBY_ENCODING_H rb_enc_associate_index(str, ENCODING_INDEX_UTF8); #endif + if (taint_flag) RbTk_OBJ_UNTRUST(str); rb_ivar_set(str, ID_at_enc, ENCODING_NAME_UTF8); - if (taint_flag) OBJ_TAINT(str); /* if (encoding != (Tcl_Encoding)NULL) { @@ -7369,9 +7595,9 @@ lib_fromUTF8_core(ip_obj, src, encodename) rb_enc_associate_index(str, rb_enc_find_index(RSTRING_PTR(encodename))); } #endif - rb_ivar_set(str, ID_at_enc, encodename); - if (taint_flag) OBJ_TAINT(str); + if (taint_flag) RbTk_OBJ_UNTRUST(str); + rb_ivar_set(str, ID_at_enc, encodename); /* if (encoding != (Tcl_Encoding)NULL) { @@ -7464,7 +7690,7 @@ lib_UTF_backslash_core(self, str, all_bs) } str = rb_str_new(dst_buf, dst_len); - if (taint_flag) OBJ_TAINT(str); + if (taint_flag) RbTk_OBJ_UNTRUST(str); #ifdef HAVE_RUBY_ENCODING_H rb_enc_associate_index(str, ENCODING_INDEX_UTF8); #endif @@ -8086,8 +8312,13 @@ invoke_queue_handler(evPtr, flags) DUMP1("process it on current event-loop"); } +#ifdef RUBY_VM + if (RTEST(rb_funcall(thread, ID_alive_p, 0)) + && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { +#else if (RTEST(rb_thread_alive_p(thread)) && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) { +#endif DUMP1("caller is not yet ready to receive the result -> pending"); return 0; } @@ -8135,8 +8366,11 @@ invoke_queue_handler(evPtr, flags) q->thread = (VALUE)NULL; /* back to caller */ - /* if (RTEST(rb_funcall(thread, ID_alive_p, 0, 0))) { */ +#ifdef RUBY_VM + if (RTEST(rb_funcall(thread, ID_alive_p, 0, 0))) { +#else if (RTEST(rb_thread_alive_p(thread))) { +#endif DUMP2("back to caller (caller thread:%lx)", thread); DUMP2(" (current thread:%lx)", rb_thread_current()); #if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE @@ -8175,6 +8409,7 @@ ip_invoke_with_position(argc, argv, obj, position) volatile VALUE ip_obj = obj; volatile VALUE result; volatile VALUE ret; + struct timeval t; #if TCL_MAJOR_VERSION >= 8 Tcl_Obj **av = (Tcl_Obj **)NULL; @@ -8188,9 +8423,11 @@ ip_invoke_with_position(argc, argv, obj, position) #ifdef RUBY_USE_NATIVE_THREAD ptr = get_ip(ip_obj); - DUMP2("status: ptr->tk_thread_id %p", ptr->tk_thread_id); -#endif + DUMP2("invoke status: ptr->tk_thread_id %p", ptr->tk_thread_id); + DUMP2("invoke status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread()); +#else DUMP2("status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread()); +#endif DUMP2("status: eventloopt_thread %lx", eventloop_thread); if ( @@ -8273,15 +8510,25 @@ ip_invoke_with_position(argc, argv, obj, position) rb_thread_critical = thr_crit_bup; /* wait for the handler to be processed */ - DUMP2("wait for handler (current thread:%lx)", current); + t.tv_sec = (time_t)0; + t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0); + + DUMP2("ivq wait for handler (current thread:%lx)", current); while(*alloc_done >= 0) { - /* rb_thread_stop(); */ - rb_thread_sleep_forever(); + /* rb_thread_stop(); */ + /* rb_thread_sleep_forever(); */ + rb_thread_wait_for(t); + DUMP2("*** ivq wakeup (current thread:%lx)", current); + DUMP2("*** (eventloop thread:%lx)", eventloop_thread); + if (NIL_P(eventloop_thread)) { + DUMP1("*** ivq lost eventloop thread"); + break; + } } DUMP2("back from handler (current thread:%lx)", current); /* get result & free allocated memory */ - ret = RARRAY(result)->ptr[0]; + ret = RARRAY_PTR(result)[0]; #if 0 /* use Tcl_EventuallyFree */ Tcl_EventuallyFree((ClientData)alloc_done, TCL_DYNAMIC); /* XXXXXXXX */ #else @@ -8414,7 +8661,7 @@ ip_get_variable2_core(interp, argc, argv) Tcl_IncrRefCount(ret); strval = get_str_from_obj(ret); - OBJ_TAINT(strval); + RbTk_OBJ_UNTRUST(strval); Tcl_DecrRefCount(ret); /* Tcl_Release(ptr->ip); */ @@ -8553,7 +8800,7 @@ ip_set_variable2_core(interp, argc, argv) Tcl_IncrRefCount(ret); strval = get_str_from_obj(ret); - OBJ_TAINT(strval); + RbTk_OBJ_UNTRUST(strval); Tcl_DecrRefCount(ret); /* Tcl_Release(ptr->ip); */ @@ -8830,12 +9077,14 @@ lib_split_tklist_core(ip_obj, list_str) rb_thread_critical = Qtrue; ary = rb_ary_new2(objc); - if (taint_flag) OBJ_TAINT(ary); + if (taint_flag) RbTk_OBJ_UNTRUST(ary); old_gc = rb_gc_disable(); for(idx = 0; idx < objc; idx++) { elem = get_str_from_obj(objv[idx]); + if (taint_flag) RbTk_OBJ_UNTRUST(elem); + #ifdef HAVE_RUBY_ENCODING_H if (rb_enc_get_index(elem) == ENCODING_INDEX_BINARY) { rb_enc_associate_index(elem, ENCODING_INDEX_BINARY); @@ -8845,7 +9094,6 @@ lib_split_tklist_core(ip_obj, list_str) rb_ivar_set(elem, ID_at_enc, list_ivar_enc); } #endif - if (taint_flag) OBJ_TAINT(elem); /* RARRAY(ary)->ptr[idx] = elem; */ rb_ary_push(ary, elem); } @@ -8877,7 +9125,7 @@ lib_split_tklist_core(ip_obj, list_str) } ary = rb_ary_new2(argc); - if (taint_flag) OBJ_TAINT(ary); + if (taint_flag) RbTk_OBJ_UNTRUST(ary); old_gc = rb_gc_disable(); @@ -8997,7 +9245,7 @@ lib_merge_tklist(argc, argv, obj) /* create object */ str = rb_str_new(result, dst - result - 1); - if (taint_flag) OBJ_TAINT(str); + if (taint_flag) RbTk_OBJ_UNTRUST(str); #if 0 /* use Tcl_EventuallyFree */ Tcl_EventuallyFree((ClientData)result, TCL_DYNAMIC); /* XXXXXXXX */ #else @@ -9045,7 +9293,7 @@ lib_conv_listelement(self, src) #endif rb_str_resize(dst, len); - if (taint_flag) OBJ_TAINT(dst); + if (taint_flag) RbTk_OBJ_UNTRUST(dst); rb_thread_critical = thr_crit_bup; @@ -9056,28 +9304,30 @@ static VALUE lib_getversion(self) VALUE self; { - volatile VALUE type_name; + set_tcltk_version(); + return rb_ary_new3(4, INT2NUM(tcltk_version.major), + INT2NUM(tcltk_version.minor), + INT2NUM(tcltk_version.type), + INT2NUM(tcltk_version.patchlevel)); +} + +static VALUE +lib_get_reltype_name(self) + VALUE self; +{ set_tcltk_version(); switch(tcltk_version.type) { case TCL_ALPHA_RELEASE: - type_name = rb_str_new2("alpha"); - break; + return rb_str_new2("alpha"); case TCL_BETA_RELEASE: - type_name = rb_str_new2("beta"); - break; + return rb_str_new2("beta"); case TCL_FINAL_RELEASE: - type_name = rb_str_new2("final"); - break; + return rb_str_new2("final"); default: - type_name = rb_str_new2("unknown"); + rb_raise(rb_eRuntimeError, "tcltklib has invalid release type number"); } - - return rb_ary_new3(5, INT2NUM(tcltk_version.major), - INT2NUM(tcltk_version.minor), - INT2NUM(tcltk_version.type), type_name, - INT2NUM(tcltk_version.patchlevel)); } @@ -9280,14 +9530,22 @@ encoding_table_get_name_core(table, enc_arg, error_mode) enc = rb_funcall(interp, ID_encoding_name, 0, 0); } } - /* 2nd: encoding system of Tcl/Tk */ + /* 2nd: Encoding.default_internal */ + if (NIL_P(enc)) { + enc = rb_enc_default_internal(); + } + /* 3rd: encoding system of Tcl/Tk */ if (NIL_P(enc)) { enc = rb_str_new2(Tcl_GetEncodingName((Tcl_Encoding)NULL)); } - /* 3rd: Encoding.default_external */ + /* 4th: Encoding.default_external */ if (NIL_P(enc)) { enc = rb_enc_default_external(); } + /* 5th: Encoding.locale_charmap */ + if (NIL_P(enc)) { + enc = rb_locale_charmap(rb_cEncoding); + } if (RTEST(rb_obj_is_kind_of(enc, cRubyEncoding))) { /* Ruby's Encoding object */ @@ -9495,7 +9753,8 @@ encoding_table_get_obj(table, enc) #ifdef HAVE_RUBY_ENCODING_H static VALUE -create_encoding_table(interp) +create_encoding_table_core(arg, interp) + VALUE arg; VALUE interp; { struct tcltkip *ptr = get_ip(interp); @@ -9506,7 +9765,11 @@ create_encoding_table(interp) Tcl_Obj **objv; Tcl_Obj *enc_list; - rb_secure(4); +#ifdef HAVE_RB_SET_SAFE_LEVEL_FORCE + rb_set_safe_level_force(0); +#else + rb_set_safe_level(0); +#endif /* set 'binary' encoding */ encobj = rb_enc_from_encoding(rb_enc_from_index(ENCODING_INDEX_BINARY)); @@ -9586,7 +9849,8 @@ create_encoding_table(interp) #else /* ! HAVE_RUBY_ENCODING_H */ #if TCL_MAJOR_VERSION > 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1) static VALUE -create_encoding_table(interp) +create_encoding_table_core(arg, interp) + VALUE arg; VALUE interp; { struct tcltkip *ptr = get_ip(interp); @@ -9627,7 +9891,8 @@ create_encoding_table(interp) #else /* Tcl/Tk 7.x or 8.0 */ static VALUE -create_encoding_table(interp) +create_encoding_table_core(arg, interp) + VALUE arg; VALUE interp; { volatile VALUE table = rb_hash_new(); @@ -9638,6 +9903,14 @@ create_encoding_table(interp) #endif #endif +static VALUE +create_encoding_table(interp) + VALUE interp; +{ + return rb_funcall(rb_proc_new(create_encoding_table_core, interp), + ID_call, 0); +} + static VALUE ip_get_encoding_table(interp) VALUE interp; @@ -9854,6 +10127,24 @@ Init_tcltklib() /* --------------------------------------------------------------- */ +#ifdef __WIN32__ +#define TK_WINDOWING_SYSTEM "win32" +#else +#ifdef MAC_TCL +#define TK_WINDOWING_SYSTEM "classic" +#else +#ifdef MAC_OSX_TK +#define TK_WINDOWING_SYSTEM "aqua" +#else +#define TK_WINDOWING_SYSTEM "x11" +#endif +#endif +#endif + rb_define_const(lib, "WINDOWING_SYSTEM", + rb_obj_freeze(rb_str_new2(TK_WINDOWING_SYSTEM))); + + /* --------------------------------------------------------------- */ + rb_define_const(ev_flag, "NONE", INT2FIX(0)); rb_define_const(ev_flag, "WINDOW", INT2FIX(TCL_WINDOW_EVENTS)); rb_define_const(ev_flag, "FILE", INT2FIX(TCL_FILE_EVENTS)); @@ -9883,6 +10174,8 @@ Init_tcltklib() /* --------------------------------------------------------------- */ rb_define_module_function(lib, "get_version", lib_getversion, -1); + rb_define_module_function(lib, "get_release_type_name", + lib_get_reltype_name, -1); rb_define_const(release_type, "ALPHA", INT2FIX(TCL_ALPHA_RELEASE)); rb_define_const(release_type, "BETA", INT2FIX(TCL_BETA_RELEASE)); @@ -9997,6 +10290,8 @@ Init_tcltklib() rb_define_method(ip, "has_mainwindow?", ip_has_mainwindow_p, 0); rb_define_method(ip, "invalid_namespace?", ip_has_invalid_namespace_p, 0); rb_define_method(ip, "_eval", ip_eval, 1); + rb_define_method(ip, "_cancel_eval", ip_cancel_eval, -1); + rb_define_method(ip, "_cancel_eval_unwind", ip_cancel_eval_unwind, -1); rb_define_method(ip, "_toUTF8", ip_toUTF8, -1); rb_define_method(ip, "_fromUTF8", ip_fromUTF8, -1); rb_define_method(ip, "_thread_vwait", ip_thread_vwait, 1); @@ -10059,12 +10354,13 @@ Init_tcltklib() /* --------------------------------------------------------------- */ eventloop_thread = Qnil; + eventloop_interp = (Tcl_Interp*)NULL; #ifndef DEFAULT_EVENTLOOP_DEPTH #define DEFAULT_EVENTLOOP_DEPTH 7 #endif eventloop_stack = rb_ary_new2(DEFAULT_EVENTLOOP_DEPTH); - OBJ_TAINT(eventloop_stack); + RbTk_OBJ_UNTRUST(eventloop_stack); watchdog_thread = Qnil; diff --git a/ext/tk/tkutil/extconf.rb b/ext/tk/tkutil/extconf.rb index 34b91632eb..57de973c0a 100644 --- a/ext/tk/tkutil/extconf.rb +++ b/ext/tk/tkutil/extconf.rb @@ -7,8 +7,12 @@ end if has_tk require 'mkmf' + have_func("rb_obj_instance_exec", "ruby.h") + have_func("rb_obj_untrust", "ruby.h") + have_func("rb_obj_taint", "ruby.h") have_func("rb_sym_to_s", "ruby.h") have_func("strndup", "string.h") + create_makefile('tkutil') end diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c index 8155bff5ce..25011bb473 100644 --- a/ext/tk/tkutil/tkutil.c +++ b/ext/tk/tkutil/tkutil.c @@ -7,13 +7,14 @@ ************************************************/ -#define TKUTIL_RELEASE_DATE "2008-05-23" +#define TKUTIL_RELEASE_DATE "2009-07-12" #include "ruby.h" -#ifdef HAVE_RUBY_SIGNAL_H -#include "ruby/signal.h" +#ifdef RUBY_VM +static VALUE rb_thread_critical; /* dummy */ #else +/* On Ruby 1.8.x, use rb_thread_critical (defined at rubysig.h) */ #include "rubysig.h" #endif #ifdef HAVE_RUBY_ST_H @@ -59,6 +60,9 @@ static unsigned long CALLBACK_ID_NUM = 0; /*************************************/ +#if defined(HAVE_RB_OBJ_INSTANCE_EXEC) && !defined(RUBY_VM) +extern VALUE rb_obj_instance_exec _((int, VALUE*, VALUE)); +#endif static VALUE tk_s_new(argc, argv, klass) int argc; @@ -82,12 +86,34 @@ tk_s_new(argc, argv, klass) static VALUE tkNone_to_s(self) VALUE self; +{ + return rb_str_new2(""); +} + +static VALUE +tkNone_inspect(self) + VALUE self; { return rb_str_new2("None"); } /*************************************/ +static VALUE +tk_obj_untrust(self, obj) + VALUE self; + VALUE obj; +{ +#ifdef HAVE_RB_OBJ_TAINT + rb_obj_taint(obj); +#endif +#ifdef HAVE_RB_OBJ_UNTRUST + rb_obj_untrust(obj); +#endif + + return obj; +} + static VALUE tk_eval_cmd(argc, argv, self) int argc; @@ -1074,6 +1100,18 @@ tcl2rb_num_or_str(self, value) rb_eArgError, 0); } +static VALUE +tcl2rb_num_or_nil(self, value) + VALUE self; + VALUE value; +{ + rb_check_type(value, T_STRING); + + if (RSTRING_LEN(value) == 0) return Qnil; + + return tkstr_to_number(value); +} + /*************************************/ @@ -1757,7 +1795,7 @@ Init_tkutil() TK_None = rb_obj_alloc(rb_cObject); rb_define_const(mTK, "None", TK_None); rb_define_singleton_method(TK_None, "to_s", tkNone_to_s, 0); - rb_define_singleton_method(TK_None, "inspect", tkNone_to_s, 0); + rb_define_singleton_method(TK_None, "inspect", tkNone_inspect, 0); OBJ_FREEZE(TK_None); /* --------------------- */ @@ -1765,6 +1803,8 @@ Init_tkutil() CALLBACK_TABLE = rb_hash_new(); /* --------------------- */ + rb_define_singleton_method(mTK, "untrust", tk_obj_untrust, 1); + rb_define_singleton_method(mTK, "eval_cmd", tk_eval_cmd, -1); rb_define_singleton_method(mTK, "callback", tk_do_callback, -1); rb_define_singleton_method(mTK, "install_cmd", tk_install_cmd, -1); @@ -1781,6 +1821,7 @@ Init_tkutil() rb_define_singleton_method(mTK, "number", tcl2rb_number, 1); rb_define_singleton_method(mTK, "string", tcl2rb_string, 1); rb_define_singleton_method(mTK, "num_or_str", tcl2rb_num_or_str, 1); + rb_define_singleton_method(mTK, "num_or_nil", tcl2rb_num_or_nil, 1); rb_define_method(mTK, "_toUTF8", tk_toUTF8, -1); rb_define_method(mTK, "_fromUTF8", tk_fromUTF8, -1); @@ -1794,6 +1835,7 @@ Init_tkutil() rb_define_method(mTK, "number", tcl2rb_number, 1); rb_define_method(mTK, "string", tcl2rb_string, 1); rb_define_method(mTK, "num_or_str", tcl2rb_num_or_str, 1); + rb_define_method(mTK, "num_or_nil", tcl2rb_num_or_nil, 1); /* --------------------- */ rb_global_variable(&ENCODING_NAME_UTF8);