tk 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +6 -0
- data/BSDL +22 -0
- data/ChangeLog.tkextlib +949 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +56 -0
- data/MANUAL_tcltklib.eng +467 -0
- data/MANUAL_tcltklib.ja +578 -0
- data/README.1st +19 -0
- data/README.ActiveTcl +62 -0
- data/README.fork +34 -0
- data/README.macosx-aqua +67 -0
- data/README.md +33 -0
- data/README.tcltklib +152 -0
- data/Rakefile +16 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ext/tk/config_list.in +41 -0
- data/ext/tk/extconf.rb +2098 -0
- data/ext/tk/old-extconf.rb +441 -0
- data/ext/tk/stubs.c +592 -0
- data/ext/tk/stubs.h +33 -0
- data/ext/tk/tcltklib.c +11066 -0
- data/ext/tk/tkutil/extconf.rb +14 -0
- data/ext/tk/tkutil/tkutil.c +1900 -0
- data/lib/README +30 -0
- data/lib/multi-tk.rb +3743 -0
- data/lib/remote-tk.rb +527 -0
- data/lib/tcltk.rb +369 -0
- data/lib/tk.rb +5758 -0
- data/lib/tk/after.rb +7 -0
- data/lib/tk/autoload.rb +763 -0
- data/lib/tk/bgerror.rb +30 -0
- data/lib/tk/bindtag.rb +139 -0
- data/lib/tk/busy.rb +119 -0
- data/lib/tk/button.rb +32 -0
- data/lib/tk/canvas.rb +847 -0
- data/lib/tk/canvastag.rb +460 -0
- data/lib/tk/checkbutton.rb +33 -0
- data/lib/tk/clipboard.rb +76 -0
- data/lib/tk/clock.rb +72 -0
- data/lib/tk/composite.rb +485 -0
- data/lib/tk/console.rb +53 -0
- data/lib/tk/dialog.rb +327 -0
- data/lib/tk/encodedstr.rb +188 -0
- data/lib/tk/entry.rb +121 -0
- data/lib/tk/event.rb +563 -0
- data/lib/tk/font.rb +2352 -0
- data/lib/tk/fontchooser.rb +181 -0
- data/lib/tk/frame.rb +133 -0
- data/lib/tk/grid.rb +280 -0
- data/lib/tk/image.rb +396 -0
- data/lib/tk/itemconfig.rb +1222 -0
- data/lib/tk/itemfont.rb +328 -0
- data/lib/tk/kinput.rb +72 -0
- data/lib/tk/label.rb +23 -0
- data/lib/tk/labelframe.rb +32 -0
- data/lib/tk/listbox.rb +285 -0
- data/lib/tk/macpkg.rb +81 -0
- data/lib/tk/menu.rb +719 -0
- data/lib/tk/menubar.rb +138 -0
- data/lib/tk/menuspec.rb +457 -0
- data/lib/tk/message.rb +25 -0
- data/lib/tk/mngfocus.rb +34 -0
- data/lib/tk/msgcat.rb +300 -0
- data/lib/tk/namespace.rb +547 -0
- data/lib/tk/optiondb.rb +372 -0
- data/lib/tk/optionobj.rb +213 -0
- data/lib/tk/pack.rb +108 -0
- data/lib/tk/package.rb +144 -0
- data/lib/tk/palette.rb +56 -0
- data/lib/tk/panedwindow.rb +261 -0
- data/lib/tk/place.rb +129 -0
- data/lib/tk/radiobutton.rb +74 -0
- data/lib/tk/root.rb +96 -0
- data/lib/tk/scale.rb +113 -0
- data/lib/tk/scrollable.rb +83 -0
- data/lib/tk/scrollbar.rb +184 -0
- data/lib/tk/scrollbox.rb +40 -0
- data/lib/tk/selection.rb +87 -0
- data/lib/tk/spinbox.rb +145 -0
- data/lib/tk/tagfont.rb +44 -0
- data/lib/tk/text.rb +1605 -0
- data/lib/tk/textimage.rb +89 -0
- data/lib/tk/textmark.rb +205 -0
- data/lib/tk/texttag.rb +322 -0
- data/lib/tk/textwindow.rb +155 -0
- data/lib/tk/timer.rb +666 -0
- data/lib/tk/tk_mac.rb +159 -0
- data/lib/tk/toplevel.rb +265 -0
- data/lib/tk/ttk_selector.rb +99 -0
- data/lib/tk/txtwin_abst.rb +40 -0
- data/lib/tk/validation.rb +398 -0
- data/lib/tk/variable.rb +1797 -0
- data/lib/tk/virtevent.rb +140 -0
- data/lib/tk/winfo.rb +393 -0
- data/lib/tk/winpkg.rb +157 -0
- data/lib/tk/wm.rb +553 -0
- data/lib/tk/xim.rb +123 -0
- data/lib/tkafter.rb +5 -0
- data/lib/tkbgerror.rb +5 -0
- data/lib/tkcanvas.rb +5 -0
- data/lib/tkclass.rb +48 -0
- data/lib/tkconsole.rb +5 -0
- data/lib/tkdialog.rb +5 -0
- data/lib/tkentry.rb +5 -0
- data/lib/tkextlib/ICONS.rb +14 -0
- data/lib/tkextlib/ICONS/icons.rb +130 -0
- data/lib/tkextlib/ICONS/setup.rb +9 -0
- data/lib/tkextlib/SUPPORT_STATUS +193 -0
- data/lib/tkextlib/blt.rb +190 -0
- data/lib/tkextlib/blt/barchart.rb +80 -0
- data/lib/tkextlib/blt/bitmap.rb +113 -0
- data/lib/tkextlib/blt/busy.rb +84 -0
- data/lib/tkextlib/blt/component.rb +2219 -0
- data/lib/tkextlib/blt/container.rb +29 -0
- data/lib/tkextlib/blt/cutbuffer.rb +24 -0
- data/lib/tkextlib/blt/dragdrop.rb +270 -0
- data/lib/tkextlib/blt/eps.rb +33 -0
- data/lib/tkextlib/blt/graph.rb +68 -0
- data/lib/tkextlib/blt/htext.rb +113 -0
- data/lib/tkextlib/blt/setup.rb +9 -0
- data/lib/tkextlib/blt/spline.rb +24 -0
- data/lib/tkextlib/blt/stripchart.rb +75 -0
- data/lib/tkextlib/blt/table.rb +413 -0
- data/lib/tkextlib/blt/tabnotebook.rb +111 -0
- data/lib/tkextlib/blt/tabset.rb +505 -0
- data/lib/tkextlib/blt/ted.rb +69 -0
- data/lib/tkextlib/blt/tile.rb +26 -0
- data/lib/tkextlib/blt/tile/button.rb +17 -0
- data/lib/tkextlib/blt/tile/checkbutton.rb +18 -0
- data/lib/tkextlib/blt/tile/frame.rb +17 -0
- data/lib/tkextlib/blt/tile/label.rb +17 -0
- data/lib/tkextlib/blt/tile/radiobutton.rb +18 -0
- data/lib/tkextlib/blt/tile/scrollbar.rb +17 -0
- data/lib/tkextlib/blt/tile/toplevel.rb +17 -0
- data/lib/tkextlib/blt/tree.rb +1059 -0
- data/lib/tkextlib/blt/treeview.rb +1288 -0
- data/lib/tkextlib/blt/unix_dnd.rb +142 -0
- data/lib/tkextlib/blt/vector.rb +257 -0
- data/lib/tkextlib/blt/watch.rb +176 -0
- data/lib/tkextlib/blt/win_printer.rb +62 -0
- data/lib/tkextlib/blt/winop.rb +108 -0
- data/lib/tkextlib/bwidget.rb +154 -0
- data/lib/tkextlib/bwidget/arrowbutton.rb +22 -0
- data/lib/tkextlib/bwidget/bitmap.rb +22 -0
- data/lib/tkextlib/bwidget/button.rb +32 -0
- data/lib/tkextlib/bwidget/buttonbox.rb +91 -0
- data/lib/tkextlib/bwidget/combobox.rb +63 -0
- data/lib/tkextlib/bwidget/dialog.rb +195 -0
- data/lib/tkextlib/bwidget/dragsite.rb +32 -0
- data/lib/tkextlib/bwidget/dropsite.rb +40 -0
- data/lib/tkextlib/bwidget/dynamichelp.rb +64 -0
- data/lib/tkextlib/bwidget/entry.rb +44 -0
- data/lib/tkextlib/bwidget/label.rb +42 -0
- data/lib/tkextlib/bwidget/labelentry.rb +81 -0
- data/lib/tkextlib/bwidget/labelframe.rb +53 -0
- data/lib/tkextlib/bwidget/listbox.rb +362 -0
- data/lib/tkextlib/bwidget/mainframe.rb +133 -0
- data/lib/tkextlib/bwidget/messagedlg.rb +193 -0
- data/lib/tkextlib/bwidget/notebook.rb +167 -0
- data/lib/tkextlib/bwidget/pagesmanager.rb +74 -0
- data/lib/tkextlib/bwidget/panedwindow.rb +43 -0
- data/lib/tkextlib/bwidget/panelframe.rb +68 -0
- data/lib/tkextlib/bwidget/passwddlg.rb +45 -0
- data/lib/tkextlib/bwidget/progressbar.rb +21 -0
- data/lib/tkextlib/bwidget/progressdlg.rb +59 -0
- data/lib/tkextlib/bwidget/scrollableframe.rb +41 -0
- data/lib/tkextlib/bwidget/scrolledwindow.rb +49 -0
- data/lib/tkextlib/bwidget/scrollview.rb +26 -0
- data/lib/tkextlib/bwidget/selectcolor.rb +74 -0
- data/lib/tkextlib/bwidget/selectfont.rb +92 -0
- data/lib/tkextlib/bwidget/separator.rb +21 -0
- data/lib/tkextlib/bwidget/setup.rb +9 -0
- data/lib/tkextlib/bwidget/spinbox.rb +99 -0
- data/lib/tkextlib/bwidget/statusbar.rb +63 -0
- data/lib/tkextlib/bwidget/titleframe.rb +34 -0
- data/lib/tkextlib/bwidget/tree.rb +501 -0
- data/lib/tkextlib/bwidget/widget.rb +130 -0
- data/lib/tkextlib/itcl.rb +14 -0
- data/lib/tkextlib/itcl/incr_tcl.rb +179 -0
- data/lib/tkextlib/itcl/setup.rb +14 -0
- data/lib/tkextlib/itk.rb +14 -0
- data/lib/tkextlib/itk/incr_tk.rb +447 -0
- data/lib/tkextlib/itk/setup.rb +14 -0
- data/lib/tkextlib/iwidgets.rb +95 -0
- data/lib/tkextlib/iwidgets/buttonbox.rb +122 -0
- data/lib/tkextlib/iwidgets/calendar.rb +126 -0
- data/lib/tkextlib/iwidgets/canvasprintbox.rb +54 -0
- data/lib/tkextlib/iwidgets/canvasprintdialog.rb +39 -0
- data/lib/tkextlib/iwidgets/checkbox.rb +131 -0
- data/lib/tkextlib/iwidgets/combobox.rb +105 -0
- data/lib/tkextlib/iwidgets/dateentry.rb +21 -0
- data/lib/tkextlib/iwidgets/datefield.rb +59 -0
- data/lib/tkextlib/iwidgets/dialog.rb +21 -0
- data/lib/tkextlib/iwidgets/dialogshell.rb +122 -0
- data/lib/tkextlib/iwidgets/disjointlistbox.rb +51 -0
- data/lib/tkextlib/iwidgets/entryfield.rb +186 -0
- data/lib/tkextlib/iwidgets/extbutton.rb +41 -0
- data/lib/tkextlib/iwidgets/extfileselectionbox.rb +47 -0
- data/lib/tkextlib/iwidgets/extfileselectiondialog.rb +34 -0
- data/lib/tkextlib/iwidgets/feedback.rb +36 -0
- data/lib/tkextlib/iwidgets/fileselectionbox.rb +47 -0
- data/lib/tkextlib/iwidgets/fileselectiondialog.rb +34 -0
- data/lib/tkextlib/iwidgets/finddialog.rb +43 -0
- data/lib/tkextlib/iwidgets/hierarchy.rb +366 -0
- data/lib/tkextlib/iwidgets/hyperhelp.rb +51 -0
- data/lib/tkextlib/iwidgets/labeledframe.rb +40 -0
- data/lib/tkextlib/iwidgets/labeledwidget.rb +46 -0
- data/lib/tkextlib/iwidgets/mainwindow.rb +68 -0
- data/lib/tkextlib/iwidgets/menubar.rb +213 -0
- data/lib/tkextlib/iwidgets/messagebox.rb +94 -0
- data/lib/tkextlib/iwidgets/messagedialog.rb +21 -0
- data/lib/tkextlib/iwidgets/notebook.rb +176 -0
- data/lib/tkextlib/iwidgets/optionmenu.rb +93 -0
- data/lib/tkextlib/iwidgets/panedwindow.rb +135 -0
- data/lib/tkextlib/iwidgets/promptdialog.rb +132 -0
- data/lib/tkextlib/iwidgets/pushbutton.rb +36 -0
- data/lib/tkextlib/iwidgets/radiobox.rb +122 -0
- data/lib/tkextlib/iwidgets/scopedobject.rb +25 -0
- data/lib/tkextlib/iwidgets/scrolledcanvas.rb +354 -0
- data/lib/tkextlib/iwidgets/scrolledframe.rb +60 -0
- data/lib/tkextlib/iwidgets/scrolledhtml.rb +59 -0
- data/lib/tkextlib/iwidgets/scrolledlistbox.rb +208 -0
- data/lib/tkextlib/iwidgets/scrolledtext.rb +569 -0
- data/lib/tkextlib/iwidgets/scrolledwidget.rb +21 -0
- data/lib/tkextlib/iwidgets/selectionbox.rb +103 -0
- data/lib/tkextlib/iwidgets/selectiondialog.rb +93 -0
- data/lib/tkextlib/iwidgets/setup.rb +9 -0
- data/lib/tkextlib/iwidgets/shell.rb +39 -0
- data/lib/tkextlib/iwidgets/spindate.rb +49 -0
- data/lib/tkextlib/iwidgets/spinint.rb +31 -0
- data/lib/tkextlib/iwidgets/spinner.rb +170 -0
- data/lib/tkextlib/iwidgets/spintime.rb +49 -0
- data/lib/tkextlib/iwidgets/tabnotebook.rb +182 -0
- data/lib/tkextlib/iwidgets/tabset.rb +146 -0
- data/lib/tkextlib/iwidgets/timeentry.rb +26 -0
- data/lib/tkextlib/iwidgets/timefield.rb +59 -0
- data/lib/tkextlib/iwidgets/toolbar.rb +113 -0
- data/lib/tkextlib/iwidgets/watch.rb +57 -0
- data/lib/tkextlib/pkg_checker.rb +185 -0
- data/lib/tkextlib/setup.rb +9 -0
- data/lib/tkextlib/tcllib.rb +106 -0
- data/lib/tkextlib/tcllib/README +135 -0
- data/lib/tkextlib/tcllib/autoscroll.rb +159 -0
- data/lib/tkextlib/tcllib/calendar.rb +56 -0
- data/lib/tkextlib/tcllib/canvas_sqmap.rb +37 -0
- data/lib/tkextlib/tcllib/canvas_zoom.rb +22 -0
- data/lib/tkextlib/tcllib/chatwidget.rb +152 -0
- data/lib/tkextlib/tcllib/crosshair.rb +118 -0
- data/lib/tkextlib/tcllib/ctext.rb +161 -0
- data/lib/tkextlib/tcllib/cursor.rb +98 -0
- data/lib/tkextlib/tcllib/dateentry.rb +63 -0
- data/lib/tkextlib/tcllib/datefield.rb +58 -0
- data/lib/tkextlib/tcllib/diagrams.rb +225 -0
- data/lib/tkextlib/tcllib/dialog.rb +85 -0
- data/lib/tkextlib/tcllib/getstring.rb +135 -0
- data/lib/tkextlib/tcllib/history.rb +74 -0
- data/lib/tkextlib/tcllib/ico.rb +147 -0
- data/lib/tkextlib/tcllib/ip_entry.rb +76 -0
- data/lib/tkextlib/tcllib/khim.rb +69 -0
- data/lib/tkextlib/tcllib/menuentry.rb +48 -0
- data/lib/tkextlib/tcllib/ntext.rb +147 -0
- data/lib/tkextlib/tcllib/panelframe.rb +79 -0
- data/lib/tkextlib/tcllib/plotchart.rb +1405 -0
- data/lib/tkextlib/tcllib/ruler.rb +66 -0
- data/lib/tkextlib/tcllib/screenruler.rb +69 -0
- data/lib/tkextlib/tcllib/scrolledwindow.rb +58 -0
- data/lib/tkextlib/tcllib/scrollwin.rb +62 -0
- data/lib/tkextlib/tcllib/setup.rb +9 -0
- data/lib/tkextlib/tcllib/statusbar.rb +80 -0
- data/lib/tkextlib/tcllib/style.rb +62 -0
- data/lib/tkextlib/tcllib/superframe.rb +52 -0
- data/lib/tkextlib/tcllib/swaplist.rb +151 -0
- data/lib/tkextlib/tcllib/tablelist.rb +29 -0
- data/lib/tkextlib/tcllib/tablelist_core.rb +1073 -0
- data/lib/tkextlib/tcllib/tablelist_tile.rb +44 -0
- data/lib/tkextlib/tcllib/tkpiechart.rb +315 -0
- data/lib/tkextlib/tcllib/toolbar.rb +176 -0
- data/lib/tkextlib/tcllib/tooltip.rb +105 -0
- data/lib/tkextlib/tcllib/validator.rb +66 -0
- data/lib/tkextlib/tcllib/widget.rb +83 -0
- data/lib/tkextlib/tclx.rb +14 -0
- data/lib/tkextlib/tclx/setup.rb +9 -0
- data/lib/tkextlib/tclx/tclx.rb +75 -0
- data/lib/tkextlib/tile.rb +450 -0
- data/lib/tkextlib/tile/dialog.rb +103 -0
- data/lib/tkextlib/tile/setup.rb +9 -0
- data/lib/tkextlib/tile/sizegrip.rb +33 -0
- data/lib/tkextlib/tile/style.rb +337 -0
- data/lib/tkextlib/tile/tbutton.rb +35 -0
- data/lib/tkextlib/tile/tcheckbutton.rb +39 -0
- data/lib/tkextlib/tile/tcombobox.rb +56 -0
- data/lib/tkextlib/tile/tentry.rb +50 -0
- data/lib/tkextlib/tile/tframe.rb +35 -0
- data/lib/tkextlib/tile/tlabel.rb +35 -0
- data/lib/tkextlib/tile/tlabelframe.rb +39 -0
- data/lib/tkextlib/tile/tmenubutton.rb +39 -0
- data/lib/tkextlib/tile/tnotebook.rb +148 -0
- data/lib/tkextlib/tile/tpaned.rb +246 -0
- data/lib/tkextlib/tile/tprogressbar.rb +58 -0
- data/lib/tkextlib/tile/tradiobutton.rb +39 -0
- data/lib/tkextlib/tile/treeview.rb +1337 -0
- data/lib/tkextlib/tile/tscale.rb +57 -0
- data/lib/tkextlib/tile/tscrollbar.rb +64 -0
- data/lib/tkextlib/tile/tseparator.rb +35 -0
- data/lib/tkextlib/tile/tspinbox.rb +108 -0
- data/lib/tkextlib/tile/tsquare.rb +31 -0
- data/lib/tkextlib/tkDND.rb +19 -0
- data/lib/tkextlib/tkDND/setup.rb +9 -0
- data/lib/tkextlib/tkDND/shape.rb +126 -0
- data/lib/tkextlib/tkDND/tkdnd.rb +183 -0
- data/lib/tkextlib/tkHTML.rb +14 -0
- data/lib/tkextlib/tkHTML/htmlwidget.rb +454 -0
- data/lib/tkextlib/tkHTML/setup.rb +9 -0
- data/lib/tkextlib/tkimg.rb +37 -0
- data/lib/tkextlib/tkimg/README +26 -0
- data/lib/tkextlib/tkimg/bmp.rb +34 -0
- data/lib/tkextlib/tkimg/dted.rb +34 -0
- data/lib/tkextlib/tkimg/gif.rb +34 -0
- data/lib/tkextlib/tkimg/ico.rb +34 -0
- data/lib/tkextlib/tkimg/jpeg.rb +34 -0
- data/lib/tkextlib/tkimg/pcx.rb +34 -0
- data/lib/tkextlib/tkimg/pixmap.rb +45 -0
- data/lib/tkextlib/tkimg/png.rb +34 -0
- data/lib/tkextlib/tkimg/ppm.rb +34 -0
- data/lib/tkextlib/tkimg/ps.rb +34 -0
- data/lib/tkextlib/tkimg/raw.rb +34 -0
- data/lib/tkextlib/tkimg/setup.rb +9 -0
- data/lib/tkextlib/tkimg/sgi.rb +34 -0
- data/lib/tkextlib/tkimg/sun.rb +34 -0
- data/lib/tkextlib/tkimg/tga.rb +34 -0
- data/lib/tkextlib/tkimg/tiff.rb +34 -0
- data/lib/tkextlib/tkimg/window.rb +34 -0
- data/lib/tkextlib/tkimg/xbm.rb +34 -0
- data/lib/tkextlib/tkimg/xpm.rb +34 -0
- data/lib/tkextlib/tktable.rb +15 -0
- data/lib/tkextlib/tktable/setup.rb +9 -0
- data/lib/tkextlib/tktable/tktable.rb +967 -0
- data/lib/tkextlib/tktrans.rb +15 -0
- data/lib/tkextlib/tktrans/setup.rb +9 -0
- data/lib/tkextlib/tktrans/tktrans.rb +65 -0
- data/lib/tkextlib/treectrl.rb +14 -0
- data/lib/tkextlib/treectrl/setup.rb +9 -0
- data/lib/tkextlib/treectrl/tktreectrl.rb +2523 -0
- data/lib/tkextlib/trofs.rb +14 -0
- data/lib/tkextlib/trofs/setup.rb +9 -0
- data/lib/tkextlib/trofs/trofs.rb +52 -0
- data/lib/tkextlib/version.rb +7 -0
- data/lib/tkextlib/vu.rb +49 -0
- data/lib/tkextlib/vu/bargraph.rb +62 -0
- data/lib/tkextlib/vu/charts.rb +54 -0
- data/lib/tkextlib/vu/dial.rb +103 -0
- data/lib/tkextlib/vu/pie.rb +287 -0
- data/lib/tkextlib/vu/setup.rb +9 -0
- data/lib/tkextlib/vu/spinbox.rb +23 -0
- data/lib/tkextlib/winico.rb +15 -0
- data/lib/tkextlib/winico/setup.rb +9 -0
- data/lib/tkextlib/winico/winico.rb +225 -0
- data/lib/tkfont.rb +5 -0
- data/lib/tkmacpkg.rb +5 -0
- data/lib/tkmenubar.rb +5 -0
- data/lib/tkmngfocus.rb +5 -0
- data/lib/tkpalette.rb +5 -0
- data/lib/tkscrollbox.rb +5 -0
- data/lib/tktext.rb +5 -0
- data/lib/tkvirtevent.rb +5 -0
- data/lib/tkwinpkg.rb +5 -0
- data/old-README.tcltklib.ja +159 -0
- data/sample/24hr_clock.rb +287 -0
- data/sample/binding_sample.rb +88 -0
- data/sample/bindtag_sample.rb +128 -0
- data/sample/binstr_usage.rb +46 -0
- data/sample/btn_with_frame.rb +21 -0
- data/sample/cd_timer.rb +82 -0
- data/sample/cmd_res_test.rb +18 -0
- data/sample/cmd_resource +5 -0
- data/sample/demos-en/ChangeLog +64 -0
- data/sample/demos-en/ChangeLog.prev +9 -0
- data/sample/demos-en/README +138 -0
- data/sample/demos-en/README.1st +18 -0
- data/sample/demos-en/README.tkencoding +29 -0
- data/sample/demos-en/anilabel.rb +175 -0
- data/sample/demos-en/aniwave.rb +119 -0
- data/sample/demos-en/arrow.rb +250 -0
- data/sample/demos-en/bind.rb +128 -0
- data/sample/demos-en/bitmap.rb +76 -0
- data/sample/demos-en/browse1 +63 -0
- data/sample/demos-en/browse2 +82 -0
- data/sample/demos-en/button.rb +85 -0
- data/sample/demos-en/check.rb +73 -0
- data/sample/demos-en/check2.rb +110 -0
- data/sample/demos-en/clrpick.rb +88 -0
- data/sample/demos-en/colors.rb +159 -0
- data/sample/demos-en/combo.rb +97 -0
- data/sample/demos-en/cscroll.rb +137 -0
- data/sample/demos-en/ctext.rb +208 -0
- data/sample/demos-en/dialog1.rb +39 -0
- data/sample/demos-en/dialog2.rb +42 -0
- data/sample/demos-en/doc.org/README +7 -0
- data/sample/demos-en/doc.org/README.JP +14 -0
- data/sample/demos-en/doc.org/README.tk80 +46 -0
- data/sample/demos-en/doc.org/license.terms +39 -0
- data/sample/demos-en/doc.org/license.terms.tk80 +39 -0
- data/sample/demos-en/entry1.rb +59 -0
- data/sample/demos-en/entry2.rb +94 -0
- data/sample/demos-en/entry3.rb +221 -0
- data/sample/demos-en/filebox.rb +103 -0
- data/sample/demos-en/floor.rb +1724 -0
- data/sample/demos-en/floor2.rb +1723 -0
- data/sample/demos-en/form.rb +65 -0
- data/sample/demos-en/goldberg.rb +2007 -0
- data/sample/demos-en/hello +14 -0
- data/sample/demos-en/hscale.rb +76 -0
- data/sample/demos-en/icon.rb +106 -0
- data/sample/demos-en/image1.rb +66 -0
- data/sample/demos-en/image2.rb +108 -0
- data/sample/demos-en/image3.rb +126 -0
- data/sample/demos-en/items.rb +382 -0
- data/sample/demos-en/ixset +333 -0
- data/sample/demos-en/ixset2 +367 -0
- data/sample/demos-en/knightstour.rb +272 -0
- data/sample/demos-en/label.rb +73 -0
- data/sample/demos-en/labelframe.rb +96 -0
- data/sample/demos-en/mclist.rb +118 -0
- data/sample/demos-en/menu.rb +197 -0
- data/sample/demos-en/menu84.rb +216 -0
- data/sample/demos-en/menubu.rb +238 -0
- data/sample/demos-en/msgbox.rb +91 -0
- data/sample/demos-en/msgbox2.rb +92 -0
- data/sample/demos-en/paned1.rb +48 -0
- data/sample/demos-en/paned2.rb +95 -0
- data/sample/demos-en/pendulum.rb +241 -0
- data/sample/demos-en/plot.rb +125 -0
- data/sample/demos-en/puzzle.rb +135 -0
- data/sample/demos-en/radio.rb +87 -0
- data/sample/demos-en/radio2.rb +110 -0
- data/sample/demos-en/radio3.rb +118 -0
- data/sample/demos-en/rmt +268 -0
- data/sample/demos-en/rolodex +320 -0
- data/sample/demos-en/ruler.rb +206 -0
- data/sample/demos-en/sayings.rb +107 -0
- data/sample/demos-en/search.rb +188 -0
- data/sample/demos-en/spin.rb +66 -0
- data/sample/demos-en/square +81 -0
- data/sample/demos-en/states.rb +81 -0
- data/sample/demos-en/style.rb +232 -0
- data/sample/demos-en/tcolor +526 -0
- data/sample/demos-en/text.rb +129 -0
- data/sample/demos-en/textpeer.rb +77 -0
- data/sample/demos-en/timer +136 -0
- data/sample/demos-en/tkencoding.rb +43 -0
- data/sample/demos-en/toolbar.rb +131 -0
- data/sample/demos-en/tree.rb +120 -0
- data/sample/demos-en/ttkbut.rb +140 -0
- data/sample/demos-en/ttkmenu.rb +86 -0
- data/sample/demos-en/ttknote.rb +90 -0
- data/sample/demos-en/ttkpane.rb +214 -0
- data/sample/demos-en/ttkprogress.rb +67 -0
- data/sample/demos-en/twind.rb +292 -0
- data/sample/demos-en/twind2.rb +385 -0
- data/sample/demos-en/unicodeout.rb +115 -0
- data/sample/demos-en/vscale.rb +80 -0
- data/sample/demos-en/widget +1087 -0
- data/sample/demos-jp/README +54 -0
- data/sample/demos-jp/README.1st +20 -0
- data/sample/demos-jp/anilabel.rb +178 -0
- data/sample/demos-jp/aniwave.rb +121 -0
- data/sample/demos-jp/arrow.rb +248 -0
- data/sample/demos-jp/bind.rb +126 -0
- data/sample/demos-jp/bitmap.rb +75 -0
- data/sample/demos-jp/browse1 +63 -0
- data/sample/demos-jp/browse2 +82 -0
- data/sample/demos-jp/button.rb +84 -0
- data/sample/demos-jp/check.rb +71 -0
- data/sample/demos-jp/check2.rb +111 -0
- data/sample/demos-jp/clrpick.rb +85 -0
- data/sample/demos-jp/colors.rb +156 -0
- data/sample/demos-jp/combo.rb +99 -0
- data/sample/demos-jp/cscroll.rb +135 -0
- data/sample/demos-jp/ctext.rb +205 -0
- data/sample/demos-jp/dialog1.rb +40 -0
- data/sample/demos-jp/dialog2.rb +44 -0
- data/sample/demos-jp/doc.org/README +7 -0
- data/sample/demos-jp/doc.org/README.JP +14 -0
- data/sample/demos-jp/doc.org/README.tk80 +46 -0
- data/sample/demos-jp/doc.org/license.terms +39 -0
- data/sample/demos-jp/doc.org/license.terms.tk80 +39 -0
- data/sample/demos-jp/entry1.rb +61 -0
- data/sample/demos-jp/entry2.rb +92 -0
- data/sample/demos-jp/entry3.rb +226 -0
- data/sample/demos-jp/filebox.rb +103 -0
- data/sample/demos-jp/floor.rb +1722 -0
- data/sample/demos-jp/floor2.rb +1720 -0
- data/sample/demos-jp/form.rb +67 -0
- data/sample/demos-jp/goldberg.rb +2012 -0
- data/sample/demos-jp/hello +10 -0
- data/sample/demos-jp/hscale.rb +79 -0
- data/sample/demos-jp/icon.rb +104 -0
- data/sample/demos-jp/image1.rb +65 -0
- data/sample/demos-jp/image2.rb +107 -0
- data/sample/demos-jp/image3.rb +128 -0
- data/sample/demos-jp/items.rb +380 -0
- data/sample/demos-jp/ixset +333 -0
- data/sample/demos-jp/ixset2 +369 -0
- data/sample/demos-jp/knightstour.rb +274 -0
- data/sample/demos-jp/label.rb +70 -0
- data/sample/demos-jp/labelframe.rb +103 -0
- data/sample/demos-jp/mclist.rb +122 -0
- data/sample/demos-jp/menu.rb +202 -0
- data/sample/demos-jp/menu84.rb +214 -0
- data/sample/demos-jp/menu8x.rb +234 -0
- data/sample/demos-jp/menubu.rb +239 -0
- data/sample/demos-jp/msgbox.rb +90 -0
- data/sample/demos-jp/msgbox2.rb +91 -0
- data/sample/demos-jp/paned1.rb +53 -0
- data/sample/demos-jp/paned2.rb +101 -0
- data/sample/demos-jp/pendulum.rb +243 -0
- data/sample/demos-jp/plot.rb +127 -0
- data/sample/demos-jp/puzzle.rb +132 -0
- data/sample/demos-jp/radio.rb +85 -0
- data/sample/demos-jp/radio2.rb +113 -0
- data/sample/demos-jp/radio3.rb +120 -0
- data/sample/demos-jp/rmt +268 -0
- data/sample/demos-jp/rolodex +320 -0
- data/sample/demos-jp/rolodex-j +300 -0
- data/sample/demos-jp/ruler.rb +204 -0
- data/sample/demos-jp/sayings.rb +104 -0
- data/sample/demos-jp/search.rb +185 -0
- data/sample/demos-jp/spin.rb +72 -0
- data/sample/demos-jp/square +81 -0
- data/sample/demos-jp/states.rb +75 -0
- data/sample/demos-jp/style.rb +271 -0
- data/sample/demos-jp/tcolor +534 -0
- data/sample/demos-jp/text.rb +121 -0
- data/sample/demos-jp/textpeer.rb +83 -0
- data/sample/demos-jp/timer +136 -0
- data/sample/demos-jp/toolbar.rb +137 -0
- data/sample/demos-jp/tree.rb +121 -0
- data/sample/demos-jp/ttkbut.rb +146 -0
- data/sample/demos-jp/ttkmenu.rb +92 -0
- data/sample/demos-jp/ttknote.rb +98 -0
- data/sample/demos-jp/ttkpane.rb +217 -0
- data/sample/demos-jp/ttkprogress.rb +72 -0
- data/sample/demos-jp/twind.rb +293 -0
- data/sample/demos-jp/twind2.rb +385 -0
- data/sample/demos-jp/unicodeout.rb +120 -0
- data/sample/demos-jp/vscale.rb +81 -0
- data/sample/demos-jp/widget +1122 -0
- data/sample/editable_listbox.rb +149 -0
- data/sample/encstr_usage.rb +31 -0
- data/sample/figmemo_sample.rb +457 -0
- data/sample/images/earth.gif +0 -0
- data/sample/images/earthris.gif +0 -0
- data/sample/images/face.xbm +173 -0
- data/sample/images/flagdown.xbm +27 -0
- data/sample/images/flagup.xbm +27 -0
- data/sample/images/gray25.xbm +6 -0
- data/sample/images/grey.25 +6 -0
- data/sample/images/grey.5 +6 -0
- data/sample/images/letters.xbm +27 -0
- data/sample/images/noletter.xbm +27 -0
- data/sample/images/pattern.xbm +6 -0
- data/sample/images/tcllogo.gif +0 -0
- data/sample/images/teapot.ppm +31 -0
- data/sample/irbtk.rb +31 -0
- data/sample/irbtkw.rbw +156 -0
- data/sample/iso2022-kr.txt +2 -0
- data/sample/menubar1.rb +52 -0
- data/sample/menubar2.rb +57 -0
- data/sample/menubar3.rb +73 -0
- data/sample/msgs_rb/README +3 -0
- data/sample/msgs_rb/cs.msg +84 -0
- data/sample/msgs_rb/de.msg +88 -0
- data/sample/msgs_rb/el.msg +98 -0
- data/sample/msgs_rb/en.msg +83 -0
- data/sample/msgs_rb/en_gb.msg +7 -0
- data/sample/msgs_rb/eo.msg +87 -0
- data/sample/msgs_rb/es.msg +84 -0
- data/sample/msgs_rb/fr.msg +84 -0
- data/sample/msgs_rb/it.msg +84 -0
- data/sample/msgs_rb/ja.msg +13 -0
- data/sample/msgs_rb/nl.msg +123 -0
- data/sample/msgs_rb/pl.msg +87 -0
- data/sample/msgs_rb/ru.msg +87 -0
- data/sample/msgs_rb2/README +5 -0
- data/sample/msgs_rb2/de.msg +88 -0
- data/sample/msgs_rb2/ja.msg +85 -0
- data/sample/msgs_tk/README +4 -0
- data/sample/msgs_tk/cs.msg +84 -0
- data/sample/msgs_tk/de.msg +88 -0
- data/sample/msgs_tk/el.msg +103 -0
- data/sample/msgs_tk/en.msg +83 -0
- data/sample/msgs_tk/en_gb.msg +7 -0
- data/sample/msgs_tk/eo.msg +87 -0
- data/sample/msgs_tk/es.msg +84 -0
- data/sample/msgs_tk/fr.msg +84 -0
- data/sample/msgs_tk/it.msg +84 -0
- data/sample/msgs_tk/ja.msg +13 -0
- data/sample/msgs_tk/license.terms +39 -0
- data/sample/msgs_tk/nl.msg +123 -0
- data/sample/msgs_tk/pl.msg +87 -0
- data/sample/msgs_tk/ru.msg +87 -0
- data/sample/multi-ip_sample.rb +104 -0
- data/sample/multi-ip_sample2.rb +30 -0
- data/sample/optobj_sample.rb +68 -0
- data/sample/propagate.rb +31 -0
- data/sample/remote-ip_sample.rb +34 -0
- data/sample/remote-ip_sample2.rb +57 -0
- data/sample/resource.en +13 -0
- data/sample/resource.ja +13 -0
- data/sample/safe-tk.rb +132 -0
- data/sample/scrollframe.rb +250 -0
- data/sample/tcltklib/batsu.gif +0 -0
- data/sample/tcltklib/lines0.tcl +42 -0
- data/sample/tcltklib/lines1.rb +51 -0
- data/sample/tcltklib/lines2.rb +55 -0
- data/sample/tcltklib/lines3.rb +55 -0
- data/sample/tcltklib/lines4.rb +55 -0
- data/sample/tcltklib/maru.gif +0 -0
- data/sample/tcltklib/safeTk.rb +23 -0
- data/sample/tcltklib/sample0.rb +40 -0
- data/sample/tcltklib/sample1.rb +635 -0
- data/sample/tcltklib/sample2.rb +452 -0
- data/sample/tkalignbox.rb +236 -0
- data/sample/tkballoonhelp.rb +221 -0
- data/sample/tkbiff.rb +156 -0
- data/sample/tkbrowse.rb +80 -0
- data/sample/tkcombobox.rb +498 -0
- data/sample/tkdialog.rb +62 -0
- data/sample/tkextlib/ICONS/Orig_LICENSE.txt +61 -0
- data/sample/tkextlib/ICONS/tkIcons +195 -0
- data/sample/tkextlib/ICONS/tkIcons-sample.kde +658 -0
- data/sample/tkextlib/ICONS/tkIcons.kde +195 -0
- data/sample/tkextlib/ICONS/viewIcons.rb +330 -0
- data/sample/tkextlib/blt/barchart5.rb +102 -0
- data/sample/tkextlib/blt/calendar.rb +118 -0
- data/sample/tkextlib/blt/graph6.rb +2223 -0
- data/sample/tkextlib/blt/graph7.rb +41 -0
- data/sample/tkextlib/blt/graph7a.rb +64 -0
- data/sample/tkextlib/blt/graph7b.rb +42 -0
- data/sample/tkextlib/blt/graph7c.rb +46 -0
- data/sample/tkextlib/blt/images/buckskin.gif +0 -0
- data/sample/tkextlib/blt/images/chalk.gif +0 -0
- data/sample/tkextlib/blt/images/qv100.t.gif +0 -0
- data/sample/tkextlib/blt/images/rain.gif +0 -0
- data/sample/tkextlib/blt/images/sample.gif +0 -0
- data/sample/tkextlib/blt/pareto.rb +91 -0
- data/sample/tkextlib/blt/plot1.rb +10 -0
- data/sample/tkextlib/blt/plot1b.rb +11 -0
- data/sample/tkextlib/blt/readme.txt +2 -0
- data/sample/tkextlib/blt/scripts/stipples.rb +157 -0
- data/sample/tkextlib/blt/winop1.rb +41 -0
- data/sample/tkextlib/blt/winop2.rb +29 -0
- data/sample/tkextlib/bwidget/Orig_LICENSE.txt +53 -0
- data/sample/tkextlib/bwidget/basic.rb +199 -0
- data/sample/tkextlib/bwidget/bwidget.xbm +46 -0
- data/sample/tkextlib/bwidget/demo.rb +244 -0
- data/sample/tkextlib/bwidget/dnd.rb +47 -0
- data/sample/tkextlib/bwidget/manager.rb +151 -0
- data/sample/tkextlib/bwidget/select.rb +83 -0
- data/sample/tkextlib/bwidget/tmpldlg.rb +222 -0
- data/sample/tkextlib/bwidget/tree.rb +290 -0
- data/sample/tkextlib/bwidget/x1.xbm +2258 -0
- data/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt +42 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/box.xbm +14 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/clear.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/close.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/copy.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/cut.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/exit.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/find.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/help.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/line.xbm +14 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/mag.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/new.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/open.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/oval.xbm +14 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/paste.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/points.xbm +14 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/poly.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/print.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/ruler.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/save.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/select.gif +0 -0
- data/sample/tkextlib/iwidgets/catalog_demo/images/text.xbm +14 -0
- data/sample/tkextlib/iwidgets/sample/buttonbox.rb +23 -0
- data/sample/tkextlib/iwidgets/sample/calendar.rb +11 -0
- data/sample/tkextlib/iwidgets/sample/canvasprintbox.rb +9 -0
- data/sample/tkextlib/iwidgets/sample/canvasprintdialog.rb +9 -0
- data/sample/tkextlib/iwidgets/sample/checkbox.rb +13 -0
- data/sample/tkextlib/iwidgets/sample/combobox.rb +33 -0
- data/sample/tkextlib/iwidgets/sample/dateentry.rb +8 -0
- data/sample/tkextlib/iwidgets/sample/datefield.rb +9 -0
- data/sample/tkextlib/iwidgets/sample/dialog.rb +21 -0
- data/sample/tkextlib/iwidgets/sample/dialogshell.rb +15 -0
- data/sample/tkextlib/iwidgets/sample/disjointlistbox.rb +17 -0
- data/sample/tkextlib/iwidgets/sample/entryfield-1.rb +40 -0
- data/sample/tkextlib/iwidgets/sample/entryfield-2.rb +45 -0
- data/sample/tkextlib/iwidgets/sample/entryfield-3.rb +41 -0
- data/sample/tkextlib/iwidgets/sample/extbutton.rb +21 -0
- data/sample/tkextlib/iwidgets/sample/extfileselectionbox.rb +9 -0
- data/sample/tkextlib/iwidgets/sample/extfileselectiondialog.rb +30 -0
- data/sample/tkextlib/iwidgets/sample/feedback.rb +11 -0
- data/sample/tkextlib/iwidgets/sample/fileselectionbox.rb +9 -0
- data/sample/tkextlib/iwidgets/sample/fileselectiondialog.rb +29 -0
- data/sample/tkextlib/iwidgets/sample/finddialog.rb +16 -0
- data/sample/tkextlib/iwidgets/sample/hierarchy.rb +26 -0
- data/sample/tkextlib/iwidgets/sample/hyperhelp.rb +15 -0
- data/sample/tkextlib/iwidgets/sample/labeledframe.rb +15 -0
- data/sample/tkextlib/iwidgets/sample/labeledwidget.rb +14 -0
- data/sample/tkextlib/iwidgets/sample/mainwindow.rb +65 -0
- data/sample/tkextlib/iwidgets/sample/menubar.rb +125 -0
- data/sample/tkextlib/iwidgets/sample/menubar2.rb +45 -0
- data/sample/tkextlib/iwidgets/sample/messagebox1.rb +20 -0
- data/sample/tkextlib/iwidgets/sample/messagebox2.rb +20 -0
- data/sample/tkextlib/iwidgets/sample/messagedialog.rb +45 -0
- data/sample/tkextlib/iwidgets/sample/notebook.rb +31 -0
- data/sample/tkextlib/iwidgets/sample/notebook2.rb +31 -0
- data/sample/tkextlib/iwidgets/sample/optionmenu.rb +15 -0
- data/sample/tkextlib/iwidgets/sample/panedwindow.rb +23 -0
- data/sample/tkextlib/iwidgets/sample/panedwindow2.rb +23 -0
- data/sample/tkextlib/iwidgets/sample/promptdialog.rb +18 -0
- data/sample/tkextlib/iwidgets/sample/pushbutton.rb +10 -0
- data/sample/tkextlib/iwidgets/sample/radiobox.rb +14 -0
- data/sample/tkextlib/iwidgets/sample/scrolledcanvas.rb +14 -0
- data/sample/tkextlib/iwidgets/sample/scrolledframe.rb +19 -0
- data/sample/tkextlib/iwidgets/sample/scrolledhtml.rb +16 -0
- data/sample/tkextlib/iwidgets/sample/scrolledlistbox.rb +23 -0
- data/sample/tkextlib/iwidgets/sample/scrolledtext.rb +12 -0
- data/sample/tkextlib/iwidgets/sample/selectionbox.rb +20 -0
- data/sample/tkextlib/iwidgets/sample/selectiondialog.rb +13 -0
- data/sample/tkextlib/iwidgets/sample/shell.rb +18 -0
- data/sample/tkextlib/iwidgets/sample/spindate.rb +8 -0
- data/sample/tkextlib/iwidgets/sample/spinint.rb +11 -0
- data/sample/tkextlib/iwidgets/sample/spinner.rb +34 -0
- data/sample/tkextlib/iwidgets/sample/spintime.rb +8 -0
- data/sample/tkextlib/iwidgets/sample/tabnotebook.rb +27 -0
- data/sample/tkextlib/iwidgets/sample/tabnotebook2.rb +31 -0
- data/sample/tkextlib/iwidgets/sample/tabset.rb +35 -0
- data/sample/tkextlib/iwidgets/sample/timeentry.rb +8 -0
- data/sample/tkextlib/iwidgets/sample/timefield.rb +9 -0
- data/sample/tkextlib/iwidgets/sample/toolbar.rb +153 -0
- data/sample/tkextlib/iwidgets/sample/watch.rb +19 -0
- data/sample/tkextlib/tcllib/Orig_LICENSE.txt +46 -0
- data/sample/tkextlib/tcllib/datefield.rb +30 -0
- data/sample/tkextlib/tcllib/plotdemos1.rb +159 -0
- data/sample/tkextlib/tcllib/plotdemos2.rb +72 -0
- data/sample/tkextlib/tcllib/plotdemos3.rb +84 -0
- data/sample/tkextlib/tcllib/xyplot.rb +18 -0
- data/sample/tkextlib/tile/Orig_LICENSE.txt +30 -0
- data/sample/tkextlib/tile/demo.rb +984 -0
- data/sample/tkextlib/tile/iconlib.tcl +110 -0
- data/sample/tkextlib/tile/readme.txt +2 -0
- data/sample/tkextlib/tile/repeater.tcl +117 -0
- data/sample/tkextlib/tile/themes/blue/blue.tcl +149 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowdown-h.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowdown-p.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowdown.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowleft-h.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowleft-p.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowleft.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowright-h.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowright-p.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowright.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowup-h.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowup-p.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/arrowup.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/button-h.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/button-n.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/button-n.xcf +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/button-p.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/check-hc.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/check-hu.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/check-nc.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/check-nu.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/radio-hc.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/radio-hu.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/radio-nc.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/radio-nu.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/sb-thumb-p.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/sb-thumb.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/sb-vthumb-p.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/sb-vthumb.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/slider-p.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/slider.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/vslider-p.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/blue/vslider.gif +0 -0
- data/sample/tkextlib/tile/themes/blue/pkgIndex.tcl +6 -0
- data/sample/tkextlib/tile/themes/keramik/keramik.tcl +194 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/arrowdown-p.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/arrowleft-p.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/arrowright-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/arrowright-p.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/arrowup-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/arrowup-p.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/button-d.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/button-h.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/button-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/button-p.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/button-s.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/check-c.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/check-u.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/hsb-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/hsb-p.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/hslider-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/mbut-a.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/mbut-arrow-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/mbut-d.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/mbut-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/radio-c.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/radio-u.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/tab-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/tab-p.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/tbar-a.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/tbar-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/tbar-p.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/vsb-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/vsb-p.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/keramik/vslider-n.gif +0 -0
- data/sample/tkextlib/tile/themes/keramik/pkgIndex.tcl +15 -0
- data/sample/tkextlib/tile/themes/kroc.rb +227 -0
- data/sample/tkextlib/tile/themes/kroc/kroc.tcl +163 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/button-h.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/button-n.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/button-p.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/check-hc.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/check-hu.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/check-nc.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/check-nu.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/radio-hc.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/radio-hu.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/radio-nc.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/kroc/radio-nu.gif +0 -0
- data/sample/tkextlib/tile/themes/kroc/pkgIndex.tcl +15 -0
- data/sample/tkextlib/tile/themes/plastik/pkgIndex.tcl +16 -0
- data/sample/tkextlib/tile/themes/plastik/plastik.tcl +125 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-n.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/arrowdown-p.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-n.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/arrowleft-p.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/arrowright-n.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/arrowright-p.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/arrowup-n.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/arrowup-p.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/button-h.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/button-n.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/button-p.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/check-hc.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/check-hu.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/check-nc.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/check-nu.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/check-pc.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/hsb-n.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/hslider-n.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/radio-hc.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/radio-hu.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/radio-nc.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/radio-nu.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/radio-pc.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/vsb-n.gif +0 -0
- data/sample/tkextlib/tile/themes/plastik/plastik/vslider-n.gif +0 -0
- data/sample/tkextlib/tile/toolbutton.tcl +152 -0
- data/sample/tkextlib/tkHTML/Orig_COPYRIGHT.txt +12 -0
- data/sample/tkextlib/tkHTML/README +12 -0
- data/sample/tkextlib/tkHTML/hv.rb +314 -0
- data/sample/tkextlib/tkHTML/page1/image1 +0 -0
- data/sample/tkextlib/tkHTML/page1/image10 +0 -0
- data/sample/tkextlib/tkHTML/page1/image11 +0 -0
- data/sample/tkextlib/tkHTML/page1/image12 +0 -0
- data/sample/tkextlib/tkHTML/page1/image13 +0 -0
- data/sample/tkextlib/tkHTML/page1/image14 +0 -0
- data/sample/tkextlib/tkHTML/page1/image2 +0 -0
- data/sample/tkextlib/tkHTML/page1/image3 +0 -0
- data/sample/tkextlib/tkHTML/page1/image4 +0 -0
- data/sample/tkextlib/tkHTML/page1/image5 +0 -0
- data/sample/tkextlib/tkHTML/page1/image6 +0 -0
- data/sample/tkextlib/tkHTML/page1/image7 +0 -0
- data/sample/tkextlib/tkHTML/page1/image8 +0 -0
- data/sample/tkextlib/tkHTML/page1/image9 +0 -0
- data/sample/tkextlib/tkHTML/page1/index.html +115 -0
- data/sample/tkextlib/tkHTML/page2/image1 +0 -0
- data/sample/tkextlib/tkHTML/page2/image10 +0 -0
- data/sample/tkextlib/tkHTML/page2/image11 +0 -0
- data/sample/tkextlib/tkHTML/page2/image12 +0 -0
- data/sample/tkextlib/tkHTML/page2/image13 +0 -0
- data/sample/tkextlib/tkHTML/page2/image14 +0 -0
- data/sample/tkextlib/tkHTML/page2/image15 +0 -0
- data/sample/tkextlib/tkHTML/page2/image16 +0 -0
- data/sample/tkextlib/tkHTML/page2/image17 +0 -0
- data/sample/tkextlib/tkHTML/page2/image18 +0 -0
- data/sample/tkextlib/tkHTML/page2/image19 +0 -0
- data/sample/tkextlib/tkHTML/page2/image2 +0 -0
- data/sample/tkextlib/tkHTML/page2/image20 +0 -0
- data/sample/tkextlib/tkHTML/page2/image21 +0 -0
- data/sample/tkextlib/tkHTML/page2/image22 +0 -0
- data/sample/tkextlib/tkHTML/page2/image23 +0 -0
- data/sample/tkextlib/tkHTML/page2/image24 +0 -0
- data/sample/tkextlib/tkHTML/page2/image25 +0 -0
- data/sample/tkextlib/tkHTML/page2/image26 +0 -0
- data/sample/tkextlib/tkHTML/page2/image27 +0 -0
- data/sample/tkextlib/tkHTML/page2/image28 +0 -0
- data/sample/tkextlib/tkHTML/page2/image29 +0 -0
- data/sample/tkextlib/tkHTML/page2/image3 +0 -0
- data/sample/tkextlib/tkHTML/page2/image30 +0 -0
- data/sample/tkextlib/tkHTML/page2/image31 +0 -0
- data/sample/tkextlib/tkHTML/page2/image32 +0 -0
- data/sample/tkextlib/tkHTML/page2/image33 +0 -0
- data/sample/tkextlib/tkHTML/page2/image34 +0 -0
- data/sample/tkextlib/tkHTML/page2/image35 +0 -0
- data/sample/tkextlib/tkHTML/page2/image36 +0 -0
- data/sample/tkextlib/tkHTML/page2/image37 +0 -0
- data/sample/tkextlib/tkHTML/page2/image38 +0 -0
- data/sample/tkextlib/tkHTML/page2/image39 +0 -0
- data/sample/tkextlib/tkHTML/page2/image4 +0 -0
- data/sample/tkextlib/tkHTML/page2/image5 +0 -0
- data/sample/tkextlib/tkHTML/page2/image6 +0 -0
- data/sample/tkextlib/tkHTML/page2/image7 +0 -0
- data/sample/tkextlib/tkHTML/page2/image8 +0 -0
- data/sample/tkextlib/tkHTML/page2/image9 +0 -0
- data/sample/tkextlib/tkHTML/page2/index.html +433 -0
- data/sample/tkextlib/tkHTML/page3/image1 +0 -0
- data/sample/tkextlib/tkHTML/page3/image10 +0 -0
- data/sample/tkextlib/tkHTML/page3/image11 +0 -0
- data/sample/tkextlib/tkHTML/page3/image12 +0 -0
- data/sample/tkextlib/tkHTML/page3/image13 +0 -0
- data/sample/tkextlib/tkHTML/page3/image14 +0 -0
- data/sample/tkextlib/tkHTML/page3/image2 +0 -0
- data/sample/tkextlib/tkHTML/page3/image3 +0 -0
- data/sample/tkextlib/tkHTML/page3/image4 +0 -0
- data/sample/tkextlib/tkHTML/page3/image5 +0 -0
- data/sample/tkextlib/tkHTML/page3/image6 +0 -0
- data/sample/tkextlib/tkHTML/page3/image7 +0 -0
- data/sample/tkextlib/tkHTML/page3/image8 +0 -0
- data/sample/tkextlib/tkHTML/page3/image9 +0 -0
- data/sample/tkextlib/tkHTML/page3/index.html +2787 -0
- data/sample/tkextlib/tkHTML/page4/image1 +0 -0
- data/sample/tkextlib/tkHTML/page4/image2 +0 -0
- data/sample/tkextlib/tkHTML/page4/image3 +0 -0
- data/sample/tkextlib/tkHTML/page4/image4 +0 -0
- data/sample/tkextlib/tkHTML/page4/image5 +0 -0
- data/sample/tkextlib/tkHTML/page4/image6 +0 -0
- data/sample/tkextlib/tkHTML/page4/image7 +0 -0
- data/sample/tkextlib/tkHTML/page4/image8 +0 -0
- data/sample/tkextlib/tkHTML/page4/image9 +0 -0
- data/sample/tkextlib/tkHTML/page4/index.html +768 -0
- data/sample/tkextlib/tkHTML/ss.rb +437 -0
- data/sample/tkextlib/tkimg/demo.rb +1479 -0
- data/sample/tkextlib/tkimg/license_terms_of_Img_extension +41 -0
- data/sample/tkextlib/tkimg/readme.txt +3 -0
- data/sample/tkextlib/tktable/Orig_LICENSE.txt +52 -0
- data/sample/tkextlib/tktable/basic.rb +61 -0
- data/sample/tkextlib/tktable/buttons.rb +77 -0
- data/sample/tkextlib/tktable/command.rb +90 -0
- data/sample/tkextlib/tktable/debug.rb +102 -0
- data/sample/tkextlib/tktable/dynarows.rb +100 -0
- data/sample/tkextlib/tktable/maxsize.rb +68 -0
- data/sample/tkextlib/tktable/spreadsheet.rb +138 -0
- data/sample/tkextlib/tktable/tcllogo.gif +0 -0
- data/sample/tkextlib/tktable/valid.rb +89 -0
- data/sample/tkextlib/treectrl/bitmaps.rb +77 -0
- data/sample/tkextlib/treectrl/demo.rb +1306 -0
- data/sample/tkextlib/treectrl/explorer.rb +431 -0
- data/sample/tkextlib/treectrl/help.rb +405 -0
- data/sample/tkextlib/treectrl/imovie.rb +131 -0
- data/sample/tkextlib/treectrl/layout.rb +160 -0
- data/sample/tkextlib/treectrl/mailwasher.rb +270 -0
- data/sample/tkextlib/treectrl/outlook-folders.rb +125 -0
- data/sample/tkextlib/treectrl/outlook-newgroup.rb +449 -0
- data/sample/tkextlib/treectrl/pics/big-dll.gif +0 -0
- data/sample/tkextlib/treectrl/pics/big-exe.gif +0 -0
- data/sample/tkextlib/treectrl/pics/big-file.gif +0 -0
- data/sample/tkextlib/treectrl/pics/big-folder.gif +0 -0
- data/sample/tkextlib/treectrl/pics/big-txt.gif +0 -0
- data/sample/tkextlib/treectrl/pics/checked.gif +0 -0
- data/sample/tkextlib/treectrl/pics/file.gif +0 -0
- data/sample/tkextlib/treectrl/pics/folder-closed.gif +0 -0
- data/sample/tkextlib/treectrl/pics/folder-open.gif +0 -0
- data/sample/tkextlib/treectrl/pics/help-book-closed.gif +0 -0
- data/sample/tkextlib/treectrl/pics/help-book-open.gif +0 -0
- data/sample/tkextlib/treectrl/pics/help-page.gif +0 -0
- data/sample/tkextlib/treectrl/pics/imovie-01.gif +0 -0
- data/sample/tkextlib/treectrl/pics/imovie-02.gif +0 -0
- data/sample/tkextlib/treectrl/pics/imovie-03.gif +0 -0
- data/sample/tkextlib/treectrl/pics/imovie-04.gif +0 -0
- data/sample/tkextlib/treectrl/pics/imovie-05.gif +0 -0
- data/sample/tkextlib/treectrl/pics/imovie-06.gif +0 -0
- data/sample/tkextlib/treectrl/pics/imovie-07.gif +0 -0
- data/sample/tkextlib/treectrl/pics/internet-check-off.gif +0 -0
- data/sample/tkextlib/treectrl/pics/internet-check-on.gif +0 -0
- data/sample/tkextlib/treectrl/pics/internet-print.gif +0 -0
- data/sample/tkextlib/treectrl/pics/internet-radio-off.gif +0 -0
- data/sample/tkextlib/treectrl/pics/internet-radio-on.gif +0 -0
- data/sample/tkextlib/treectrl/pics/internet-search.gif +0 -0
- data/sample/tkextlib/treectrl/pics/internet-security.gif +0 -0
- data/sample/tkextlib/treectrl/pics/mac-collapse.gif +0 -0
- data/sample/tkextlib/treectrl/pics/mac-expand.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-arrow.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-clip.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-deleted.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-draft.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-folder.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-group.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-inbox.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-local.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-main.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-outbox.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-read-2.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-read.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-sent.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-server.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-unread.gif +0 -0
- data/sample/tkextlib/treectrl/pics/outlook-watch.gif +0 -0
- data/sample/tkextlib/treectrl/pics/sky.gif +0 -0
- data/sample/tkextlib/treectrl/pics/small-dll.gif +0 -0
- data/sample/tkextlib/treectrl/pics/small-exe.gif +0 -0
- data/sample/tkextlib/treectrl/pics/small-file.gif +0 -0
- data/sample/tkextlib/treectrl/pics/small-folder.gif +0 -0
- data/sample/tkextlib/treectrl/pics/small-txt.gif +0 -0
- data/sample/tkextlib/treectrl/pics/unchecked.gif +0 -0
- data/sample/tkextlib/treectrl/random.rb +509 -0
- data/sample/tkextlib/treectrl/readme.txt +2 -0
- data/sample/tkextlib/treectrl/www-options.rb +304 -0
- data/sample/tkextlib/vu/Orig_LICENSE.txt +51 -0
- data/sample/tkextlib/vu/README.txt +50 -0
- data/sample/tkextlib/vu/canvItems.rb +91 -0
- data/sample/tkextlib/vu/canvSticker.rb +83 -0
- data/sample/tkextlib/vu/canvSticker2.rb +102 -0
- data/sample/tkextlib/vu/dial_demo.rb +114 -0
- data/sample/tkextlib/vu/m128_000.xbm +174 -0
- data/sample/tkextlib/vu/oscilloscope.rb +69 -0
- data/sample/tkextlib/vu/pie.rb +57 -0
- data/sample/tkextlib/vu/vu_demo.rb +68 -0
- data/sample/tkfrom.rb +133 -0
- data/sample/tkhello.rb +11 -0
- data/sample/tkline.rb +48 -0
- data/sample/tkmenubutton.rb +136 -0
- data/sample/tkmsgcat-load_rb.rb +103 -0
- data/sample/tkmsgcat-load_rb2.rb +103 -0
- data/sample/tkmsgcat-load_tk.rb +119 -0
- data/sample/tkmulticolumnlist.rb +744 -0
- data/sample/tkmultilistbox.rb +655 -0
- data/sample/tkmultilistframe.rb +941 -0
- data/sample/tkoptdb-safeTk.rb +74 -0
- data/sample/tkoptdb.rb +107 -0
- data/sample/tkrttimer.rb +78 -0
- data/sample/tksleep_sample.rb +30 -0
- data/sample/tktextframe.rb +282 -0
- data/sample/tktextio.rb +1061 -0
- data/sample/tktimer.rb +51 -0
- data/sample/tktimer2.rb +48 -0
- data/sample/tktimer3.rb +60 -0
- data/sample/tktree.rb +104 -0
- data/sample/tktree.tcl +305 -0
- data/sample/ttk_wrapper.rb +155 -0
- data/tk.gemspec +24 -0
- metadata +1144 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
#
|
3
|
+
# form widget demo (called by 'widget')
|
4
|
+
#
|
5
|
+
|
6
|
+
# toplevel widget
|
7
|
+
if defined?($form_demo) && $form_demo
|
8
|
+
$form_demo.destroy
|
9
|
+
$form_demo = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
# demo toplevel widget
|
13
|
+
$form_demo = TkToplevel.new {|w|
|
14
|
+
title("Form Demonstration")
|
15
|
+
iconname("form")
|
16
|
+
positionWindow(w)
|
17
|
+
}
|
18
|
+
|
19
|
+
base_frame = TkFrame.new($form_demo).pack(:fill=>:both, :expand=>true)
|
20
|
+
|
21
|
+
# label
|
22
|
+
msg = TkLabel.new(base_frame) {
|
23
|
+
font $font
|
24
|
+
wraplength '4i'
|
25
|
+
justify 'left'
|
26
|
+
text "This window contains a simple form where you can type in the various entries and use tabs to move circularly between the entries."
|
27
|
+
}
|
28
|
+
msg.pack('side'=>'top', 'fill'=>'x')
|
29
|
+
|
30
|
+
# frame
|
31
|
+
TkFrame.new(base_frame) {|frame|
|
32
|
+
TkButton.new(frame) {
|
33
|
+
text 'Dismiss'
|
34
|
+
command proc{
|
35
|
+
tmppath = $form_demo
|
36
|
+
$form_demo = nil
|
37
|
+
tmppath.destroy
|
38
|
+
}
|
39
|
+
}.pack('side'=>'left', 'expand'=>'yes')
|
40
|
+
|
41
|
+
TkButton.new(frame) {
|
42
|
+
text 'Show Code'
|
43
|
+
command proc{showCode 'form'}
|
44
|
+
}.pack('side'=>'left', 'expand'=>'yes')
|
45
|
+
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
|
46
|
+
|
47
|
+
# entry
|
48
|
+
form_data = []
|
49
|
+
(1..5).each{|i|
|
50
|
+
f = TkFrame.new(base_frame, 'bd'=>2)
|
51
|
+
e = TkEntry.new(f, 'relief'=>'sunken', 'width'=>40)
|
52
|
+
l = TkLabel.new(f)
|
53
|
+
e.pack('side'=>'right')
|
54
|
+
l.pack('side'=>'left')
|
55
|
+
form_data[i] = {'frame'=>f, 'entry'=>e, 'label'=>l}
|
56
|
+
}
|
57
|
+
|
58
|
+
#
|
59
|
+
form_data[1]['label'].text('Name:')
|
60
|
+
form_data[2]['label'].text('Address:')
|
61
|
+
form_data[5]['label'].text('Phone:')
|
62
|
+
|
63
|
+
# pack
|
64
|
+
(1..5).each{|i| form_data[i]['frame'].pack('side'=>'top', 'fill'=>'x')}
|
65
|
+
|
@@ -0,0 +1,2007 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
#
|
3
|
+
# Ruby/Tk Goldverg demo (called by 'widget')
|
4
|
+
#
|
5
|
+
# Based on Tcl/Tk8.5a2 widget demos.
|
6
|
+
# The following is the original comment of TkGoldberg.tcl.
|
7
|
+
#
|
8
|
+
#>>##+#################################################################
|
9
|
+
#>>#
|
10
|
+
#>># TkGoldberg.tcl
|
11
|
+
#>># by Keith Vetter, March 13, 2003
|
12
|
+
#>>#
|
13
|
+
#>># "Man will always find a difficult means to perform a simple task"
|
14
|
+
#>># Rube Goldberg
|
15
|
+
#>>#
|
16
|
+
#>># Reproduced here with permission.
|
17
|
+
#>>#
|
18
|
+
#>>##+#################################################################
|
19
|
+
#>>#
|
20
|
+
#>># Keith Vetter 2003-03-21: this started out as a simple little program
|
21
|
+
#>># but was so much fun that it grew and grew. So I apologize about the
|
22
|
+
#>># size but I just couldn't resist sharing it.
|
23
|
+
#>>#
|
24
|
+
#>># This is a whizzlet that does a Rube Goldberg type animation, the
|
25
|
+
#>># design of which comes from an New Years e-card from IncrediMail.
|
26
|
+
#>># That version had nice sound effects which I eschewed. On the other
|
27
|
+
#>># hand, that version was in black and white (actually dark blue and
|
28
|
+
#>># light blue) and this one is fully colorized.
|
29
|
+
#>>#
|
30
|
+
#>># One thing I learned from this project is that drawing filled complex
|
31
|
+
#>># objects on a canvas is really hard. More often than not I had to
|
32
|
+
#>># draw each item twice--once with the desired fill color but no
|
33
|
+
#>># outline, and once with no fill but with the outline. Another trick
|
34
|
+
#>># is erasing by drawing with the background color. Having a flood fill
|
35
|
+
#>># command would have been extremely helpful.
|
36
|
+
#>>#
|
37
|
+
#>># Two wiki pages were extremely helpful: Drawing rounded rectangles
|
38
|
+
#>># which I generalized into Drawing rounded polygons, and regular
|
39
|
+
#>># polygons which allowed me to convert ovals and arcs into polygons
|
40
|
+
#>># which could then be rotated (see Canvas Rotation). I also wrote
|
41
|
+
#>># Named Colors to aid in the color selection.
|
42
|
+
#>>#
|
43
|
+
#>># I could comment on the code, but it's just 26 state machines with
|
44
|
+
#>># lots of canvas create and move calls.
|
45
|
+
|
46
|
+
if defined?($goldberg_demo) && $goldberg_demo
|
47
|
+
$goldberg_demo.destroy
|
48
|
+
$goldberg_demo = nil
|
49
|
+
end
|
50
|
+
|
51
|
+
# demo toplevel widget
|
52
|
+
$goldberg_demo = TkToplevel.new {|w|
|
53
|
+
title("Tk Goldberg (demonstration)")
|
54
|
+
iconname("goldberg")
|
55
|
+
# positionWindow(w)
|
56
|
+
}
|
57
|
+
|
58
|
+
base_frame = TkFrame.new($goldberg_demo).pack(:fill=>:both, :expand=>true)
|
59
|
+
|
60
|
+
=begin
|
61
|
+
# label
|
62
|
+
msg = TkLabel.new($goldberg_demo) {
|
63
|
+
font 'Arial 10'
|
64
|
+
wraplength '4i'
|
65
|
+
justify 'left'
|
66
|
+
text "This is a demonstration of just how complex you can make your animations become. Click the ball to start things moving!\n\n\"Man will always find a difficult means to perform a simple task\"\n - Rube Goldberg"
|
67
|
+
}
|
68
|
+
msg.pack('side'=>'top')
|
69
|
+
=end
|
70
|
+
|
71
|
+
=begin
|
72
|
+
# frame
|
73
|
+
TkFrame.new($goldberg_demo) {|frame|
|
74
|
+
TkButton.new(frame) {
|
75
|
+
text 'Dismiss'
|
76
|
+
command proc{
|
77
|
+
tmppath = $goldberg_demo
|
78
|
+
$goldberg_demo = nil
|
79
|
+
tmppath.destroy
|
80
|
+
}
|
81
|
+
}.pack('side'=>'left', 'expand'=>'yes')
|
82
|
+
|
83
|
+
TkButton.new(frame) {
|
84
|
+
text 'See Code'
|
85
|
+
command proc{showCode 'goldberg'}
|
86
|
+
}.pack('side'=>'left', 'expand'=>'yes')
|
87
|
+
|
88
|
+
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
|
89
|
+
=end
|
90
|
+
|
91
|
+
#########################################
|
92
|
+
|
93
|
+
class TkGoldberg_Demo
|
94
|
+
def initialize(parent)
|
95
|
+
@parent = parent
|
96
|
+
|
97
|
+
@S = {}
|
98
|
+
@S['title'] = 'Tk Goldberg'
|
99
|
+
@S['speed'] = TkVariable.new(5)
|
100
|
+
@S['cnt'] = TkVariable.new(0)
|
101
|
+
@S['message'] = TkVariable.new("\\nWelcome\\nto\\nRuby/Tk")
|
102
|
+
@S['pause'] = TkVariable.new
|
103
|
+
@S['details'] = TkVariable.new(true)
|
104
|
+
|
105
|
+
@S['mode'] = TkVariable.new(:MSTART, :symbol)
|
106
|
+
# :MSTART, :MGO, :MPAUSE, :MSSTEP, :MBSTEP, :MDONE, :MDEBUG
|
107
|
+
|
108
|
+
# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
|
109
|
+
@speed = [1, 10, 20, 50, 80, 100, 150, 200, 300, 400, 500]
|
110
|
+
|
111
|
+
# colors
|
112
|
+
@C = {}
|
113
|
+
@C['fg'] = 'black'
|
114
|
+
# @C['bg'] = 'gray75'
|
115
|
+
@C['bg'] = 'cornflowerblue'
|
116
|
+
|
117
|
+
@C['0'] = 'white'; @C['1a'] = 'darkgreen'; @C['1b'] = 'yellow'
|
118
|
+
@C['2'] = 'red'; @C['3a'] = 'green'; @C['3b'] = 'darkblue'
|
119
|
+
@C['4'] = @C['fg']; @C['5a'] = 'brown'; @C['5b'] = 'white'
|
120
|
+
@C['6'] = 'magenta'; @C['7'] = 'green'; @C['8'] = @C['fg']
|
121
|
+
@C['9'] = 'blue4'; @C['10a'] = 'white'; @C['10b'] = 'cyan'
|
122
|
+
@C['11a'] = 'yellow'; @C['11b'] = 'mediumblue'; @C['12'] = 'tan2'
|
123
|
+
@C['13a'] = 'yellow'; @C['13b'] = 'red'; @C['14'] = 'white'
|
124
|
+
@C['15a'] = 'green'; @C['15b'] = 'yellow'; @C['16'] = 'gray65'
|
125
|
+
@C['17'] = '#A65353'; @C['18'] = @C['fg']; @C['19'] = 'gray50'
|
126
|
+
@C['20'] = 'cyan'; @C['21'] = 'gray65'; @C['22'] = @C['20']
|
127
|
+
@C['23a'] = 'blue'; @C['23b'] = 'red'; @C['23c'] = 'yellow'
|
128
|
+
@C['24a'] = 'red'; @C['24b'] = 'white';
|
129
|
+
|
130
|
+
@STEP = TkVariable.new_hash
|
131
|
+
@STEP.default_value_type = :numeric
|
132
|
+
|
133
|
+
@XY = {}
|
134
|
+
|
135
|
+
@XY6 = {
|
136
|
+
'-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192],
|
137
|
+
'-5'=>[340, 190], '-6'=>[349, 177], '-7'=>[366, 177], '-8'=>[380, 176],
|
138
|
+
'-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164],
|
139
|
+
'-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151],
|
140
|
+
'-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219],
|
141
|
+
'1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324],
|
142
|
+
'5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346],
|
143
|
+
'9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391],
|
144
|
+
'13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456],
|
145
|
+
'13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443],
|
146
|
+
'13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437],
|
147
|
+
'13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424],
|
148
|
+
'13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412],
|
149
|
+
'13,15'=>[376, 410], '13,16'=>[360, 403]
|
150
|
+
}
|
151
|
+
|
152
|
+
@timer = TkTimer.new(@speed[@S['speed'].numeric]){|timer|
|
153
|
+
timer.set_interval(go)
|
154
|
+
}
|
155
|
+
|
156
|
+
do_display
|
157
|
+
reset
|
158
|
+
|
159
|
+
# Start everything going
|
160
|
+
@timer.start
|
161
|
+
end
|
162
|
+
|
163
|
+
def do_display()
|
164
|
+
@ctrl = TkFrame.new(@parent, :relief=>:ridge, :bd=>2, :padx=>5, :pady=>5)
|
165
|
+
@screen = TkFrame.new(@parent, :bd=>2,
|
166
|
+
:relief=>:raised).pack(:side=>:left, :fill=>:both,
|
167
|
+
:expand=>true)
|
168
|
+
|
169
|
+
@canvas = TkCanvas.new(@parent, :width=>850, :height=>700,
|
170
|
+
:bg=>@C['bg'], :highlightthickness=>0){
|
171
|
+
scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up
|
172
|
+
yview_moveto(0.05)
|
173
|
+
}.pack(:in=>@screen, :side=>:top, :fill=>:both, :expand=>true)
|
174
|
+
|
175
|
+
@canvas.bind('3'){ @pause.invoke }
|
176
|
+
@canvas.bind('Destroy'){ @timer.stop }
|
177
|
+
|
178
|
+
do_ctrl_frame
|
179
|
+
do_detail_frame
|
180
|
+
|
181
|
+
# msg = TkLabel.new(@parent, :bg=>@C['bg'], :fg=>'white') {
|
182
|
+
msg = Tk::Label.new(@parent, :bg=>@C['bg'], :fg=>'white') {
|
183
|
+
font 'Arial 10'
|
184
|
+
wraplength 600
|
185
|
+
justify 'left'
|
186
|
+
text "This is a demonstration of just how complex you can make your animations become. Click the ball to start things moving!\n\"Man will always find a difficult means to perform a simple task\" - Rube Goldberg"
|
187
|
+
}
|
188
|
+
msg.place(:in=>@canvas, :relx=>0, :rely=>0, :anchor=>:nw)
|
189
|
+
|
190
|
+
frame = TkFrame.new(@parent, :bg=>@C['bg'])
|
191
|
+
|
192
|
+
# TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
|
193
|
+
Tk::Button.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
|
194
|
+
text 'Dismiss'
|
195
|
+
command proc{
|
196
|
+
tmppath = $goldberg_demo
|
197
|
+
$goldberg_demo = nil
|
198
|
+
tmppath.destroy
|
199
|
+
}
|
200
|
+
}.pack('side'=>'left')
|
201
|
+
|
202
|
+
# TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
|
203
|
+
Tk::Button.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) {
|
204
|
+
text 'See Code'
|
205
|
+
command proc{showCode 'goldberg'}
|
206
|
+
}.pack('side'=>'left', 'padx'=>5)
|
207
|
+
|
208
|
+
# @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl},
|
209
|
+
@show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl},
|
210
|
+
:bg=>@C['bg'], :activebackground=>@C['bg'])
|
211
|
+
@show.pack('side'=>'left')
|
212
|
+
frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne)
|
213
|
+
|
214
|
+
Tk.update
|
215
|
+
end
|
216
|
+
|
217
|
+
def do_ctrl_frame
|
218
|
+
@start = Tk::Button.new(@parent, :text=>'Start', :bd=>6,
|
219
|
+
:command=>proc{do_button(0)})
|
220
|
+
if font = @start['font']
|
221
|
+
@start.font(font.weight('bold'))
|
222
|
+
end
|
223
|
+
|
224
|
+
@pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font,
|
225
|
+
:command=>proc{do_button(1)}, :relief=>:raised,
|
226
|
+
:variable=>@S['pause'])
|
227
|
+
|
228
|
+
@step = TkButton.new(@parent, :text=>'Single Step', :font=>font,
|
229
|
+
:command=>proc{do_button(2)})
|
230
|
+
@bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font,
|
231
|
+
:command=>proc{do_button(4)})
|
232
|
+
@reset = TkButton.new(@parent, :text=>'Reset', :font=>font,
|
233
|
+
:command=>proc{do_button(3)})
|
234
|
+
|
235
|
+
@details = TkFrame.new(@parent, :bd=>2, :relief=>:ridge)
|
236
|
+
@detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font,
|
237
|
+
:relief=>:raised, :variable=>@S['details'])
|
238
|
+
|
239
|
+
@msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'],
|
240
|
+
:justify=>:center)
|
241
|
+
@speed_scale = TkScale.new(@parent, :orient=>:horizontal,
|
242
|
+
:from=>1, :to=>10, :font=>font,
|
243
|
+
:variable=>@S['speed'], :bd=>2,
|
244
|
+
:relief=>:ridge, :showvalue=>false)
|
245
|
+
@about = TkButton.new(@parent, :text=>'About',
|
246
|
+
:command=>proc{about}, :font=>font)
|
247
|
+
|
248
|
+
Tk.grid(@start, :in=>@ctrl, :row=>0, :sticky=>:ew)
|
249
|
+
@ctrl.grid_rowconfigure(1, :minsize=>10)
|
250
|
+
Tk.grid(@pause, :in=>@ctrl, :row=>2, :sticky=>:ew)
|
251
|
+
Tk.grid(@step, :in=>@ctrl, :sticky=>:ew)
|
252
|
+
Tk.grid(@bstep, :in=>@ctrl, :sticky=>:ew)
|
253
|
+
Tk.grid(@reset, :in=>@ctrl, :sticky=>:ew)
|
254
|
+
@ctrl.grid_rowconfigure(10, :minsize=>20)
|
255
|
+
Tk.grid(@details, :in=>@ctrl, :row=>11, :sticky=>:ew)
|
256
|
+
Tk.grid(@detail, :in=>@details, :row=>0, :sticky=>:ew)
|
257
|
+
@ctrl.grid_rowconfigure(50, :weight=>1)
|
258
|
+
|
259
|
+
@S['mode'].trace('w', proc{|*args| active_GUI(*args)})
|
260
|
+
@S['details'].trace('w', proc{|*args| active_GUI(*args)})
|
261
|
+
@S['speed'].trace('w', proc{|*args| active_GUI(*args)})
|
262
|
+
|
263
|
+
Tk.grid(@msg_entry, :in=>@ctrl, :row=>98, :sticky=>:ew, :pady=>5)
|
264
|
+
Tk.grid(@speed_scale, :in=>@ctrl, :row=>99, :sticky=>:ew)
|
265
|
+
Tk.grid(@about, :in=>@ctrl, :row=>100, :sticky=>:ew)
|
266
|
+
|
267
|
+
@reset.bind('3'){@S['mode'].value = -1} # Debugging
|
268
|
+
end
|
269
|
+
|
270
|
+
def do_detail_frame
|
271
|
+
@f_details = TkFrame.new(@details)
|
272
|
+
|
273
|
+
@label = TkLabel.new(@f_details, :textvariable=>@S['cnt'],
|
274
|
+
:bd=>1, :relief=>:solid, :bg=>'white')
|
275
|
+
Tk.grid(@label, '-', '-', '-', :sticky=>:ew, :row=>0)
|
276
|
+
|
277
|
+
idx = 1
|
278
|
+
loop {
|
279
|
+
break unless respond_to?("move#{idx}")
|
280
|
+
l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e,
|
281
|
+
:width=>2, :bd=>1, :relief=>:solid, :bg=>'white')
|
282
|
+
@STEP[idx] = 0
|
283
|
+
ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx),
|
284
|
+
:width=>5, :bd=>1, :relief=>:solid, :bg=>'white')
|
285
|
+
row = (idx + 1)/2
|
286
|
+
col = ((idx + 1) & 1) * 2
|
287
|
+
Tk.grid(l, :sticky=>:ew, :row=>row, :column=>col)
|
288
|
+
Tk.grid(ll, :sticky=>:ew, :row=>row, :column=>(col + 1))
|
289
|
+
idx += 1
|
290
|
+
}
|
291
|
+
@f_details.grid_columnconfigure(1, :weight=>1)
|
292
|
+
end
|
293
|
+
|
294
|
+
def show_ctrl
|
295
|
+
if @ctrl.winfo_mapped?
|
296
|
+
@ctrl.pack_forget
|
297
|
+
@show.text('>>')
|
298
|
+
else
|
299
|
+
@ctrl.pack(:side=>:right, :fill=>:both, :ipady=>5)
|
300
|
+
@show.text('<<')
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
def draw_all
|
305
|
+
reset_step
|
306
|
+
@canvas.delete(:all)
|
307
|
+
idx = 0
|
308
|
+
loop{
|
309
|
+
m = "draw#{idx}"
|
310
|
+
break unless respond_to?(m)
|
311
|
+
send(m)
|
312
|
+
idx += 1
|
313
|
+
}
|
314
|
+
end
|
315
|
+
|
316
|
+
def active_GUI(var1, var2, op)
|
317
|
+
st = {false=>:disabled, true=>:normal}
|
318
|
+
|
319
|
+
m = @S['mode'].to_sym
|
320
|
+
@S['pause'].value = (m == :MPAUSE)
|
321
|
+
@start.state(st[m != :MGO])
|
322
|
+
@pause.state(st[m != :MSTART && m != :MDONE])
|
323
|
+
@step.state(st[m != :MGO && m != :MDONE])
|
324
|
+
@bstep.state(st[m != :MGO && m != :MDONE])
|
325
|
+
@reset.state(st[m != :MSTART])
|
326
|
+
|
327
|
+
if @S['details'].bool
|
328
|
+
Tk.grid(@f_details, :in=>@details, :row=>2, :sticky=>:ew)
|
329
|
+
else
|
330
|
+
Tk.grid_forget(@f_details)
|
331
|
+
end
|
332
|
+
@speed_scale.label("Speed: #{@S['speed'].value}")
|
333
|
+
end
|
334
|
+
|
335
|
+
def start
|
336
|
+
@S['mode'].value = :MGO
|
337
|
+
end
|
338
|
+
|
339
|
+
def do_button(what)
|
340
|
+
case what
|
341
|
+
when 0 # Start
|
342
|
+
reset if @S['mode'].to_sym == :MDONE
|
343
|
+
@S['mode'].value = :MGO
|
344
|
+
|
345
|
+
when 1 # Pause
|
346
|
+
@S['mode'].value = ((@S['pause'].bool)? :MPAUSE: :MGO)
|
347
|
+
|
348
|
+
when 2 # Step
|
349
|
+
@S['mode'].value = :MSSTEP
|
350
|
+
|
351
|
+
when 3 # Reset
|
352
|
+
reset
|
353
|
+
|
354
|
+
when 4 # Big step
|
355
|
+
@S['mode'].value = :MBSTEP
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
def go(who = nil)
|
360
|
+
now = Tk::Clock.clicks(:milliseconds)
|
361
|
+
if who # Start here for debugging
|
362
|
+
@S['active'] = [who]
|
363
|
+
@S['mode'].value = :MGO
|
364
|
+
end
|
365
|
+
return if @S['mode'].to_sym == :MDEBUG # Debugging
|
366
|
+
# If not paused, do the next move
|
367
|
+
n = next_step if @S['mode'].to_sym != :MPAUSE
|
368
|
+
@S['mode'].value = :MPAUSE if @S['mode'].to_sym == :MSSTEP # Single step
|
369
|
+
@S['mode'].value = :MSSTEP if @S['mode'].to_sym == :MBSTEP && n # big step
|
370
|
+
elapsed = Tk::Clock.clicks(:milliseconds) - now
|
371
|
+
delay = @speed[@S['speed'].to_i] - elapsed
|
372
|
+
delay = 1 if delay <= 0
|
373
|
+
return delay
|
374
|
+
end
|
375
|
+
|
376
|
+
def next_step
|
377
|
+
retval = false # Return value
|
378
|
+
|
379
|
+
if @S['mode'].to_sym != :MSTART && @S['mode'].to_sym != :MDONE
|
380
|
+
@S['cnt'].numeric += 1
|
381
|
+
end
|
382
|
+
alive = []
|
383
|
+
@S['active'].each{|who|
|
384
|
+
who = who.to_i
|
385
|
+
n = send("move#{who}")
|
386
|
+
if (n & 1).nonzero? # This guy still alive
|
387
|
+
alive << who
|
388
|
+
end
|
389
|
+
if (n & 2).nonzero? # Next guy is active
|
390
|
+
alive << (who + 1)
|
391
|
+
retval = true
|
392
|
+
end
|
393
|
+
if (n & 4).nonzero? # End of puzzle flag
|
394
|
+
@S['mode'].value = :MDONE # Done mode
|
395
|
+
@S['active'] = [] # No more animation
|
396
|
+
return true
|
397
|
+
end
|
398
|
+
}
|
399
|
+
@S['active'] = alive
|
400
|
+
return retval
|
401
|
+
end
|
402
|
+
|
403
|
+
def about
|
404
|
+
msg = "Ruby/Tk Version ::\nby Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)\n\n"
|
405
|
+
msg += "Original Version ::\n"
|
406
|
+
msg += "#{@S['title']}\nby Keith Vetter, March 2003\n(Reproduced by kind permission of the author)\n\n"
|
407
|
+
msg += "Man will always find a difficult means to perform a simple task"
|
408
|
+
msg += "\nRube Goldberg"
|
409
|
+
Tk.messageBox(:message=>msg, :title=>'About')
|
410
|
+
end
|
411
|
+
|
412
|
+
################################################################
|
413
|
+
#
|
414
|
+
# All the drawing and moving routines
|
415
|
+
#
|
416
|
+
|
417
|
+
# START HERE! banner
|
418
|
+
def draw0
|
419
|
+
color = @C['0']
|
420
|
+
TkcText.new(@canvas, [579, 119], :text=>'START HERE!',
|
421
|
+
:fill=>color, :anchor=>:w,
|
422
|
+
:tag=>'I0', :font=>['Times Roman', 12, :italic, :bold])
|
423
|
+
TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color,
|
424
|
+
:width=>5, :arrow=>:last, :arrowshape=>[18, 18, 5])
|
425
|
+
@canvas.itembind('I0', '1'){ start }
|
426
|
+
end
|
427
|
+
|
428
|
+
def move0(step = nil)
|
429
|
+
step = get_step(0, step)
|
430
|
+
|
431
|
+
if @S['mode'].to_sym != :MSTART # Start the ball rolling
|
432
|
+
move_abs('I0', [-100, -100]) # Hide the banner
|
433
|
+
return 2
|
434
|
+
end
|
435
|
+
|
436
|
+
pos = [
|
437
|
+
[673, 119], [678, 119], [683, 119], [688, 119],
|
438
|
+
[693, 119], [688, 119], [683, 119], [678, 119]
|
439
|
+
]
|
440
|
+
step = step % pos.length
|
441
|
+
move_abs('I0', pos[step])
|
442
|
+
return 1
|
443
|
+
end
|
444
|
+
|
445
|
+
# Dropping ball
|
446
|
+
def draw1
|
447
|
+
color = @C['1a']
|
448
|
+
color2 = @C['1b']
|
449
|
+
TkcPolygon.new(@canvas,
|
450
|
+
[ 844, 133, 800, 133, 800, 346, 820, 346,
|
451
|
+
820, 168, 844, 168, 844, 133 ],
|
452
|
+
:width=>3, :fill=>color, :outline=>'')
|
453
|
+
TkcPolygon.new(@canvas,
|
454
|
+
[ 771, 133, 685, 133, 685, 168, 751, 168,
|
455
|
+
751, 346, 771, 346, 771, 133 ],
|
456
|
+
:width=>3, :fill=>color, :outline=>'')
|
457
|
+
TkcOval.new(@canvas, box(812, 122, 9),
|
458
|
+
:tag=>'I1', :fill=>color2, :outline=>'')
|
459
|
+
|
460
|
+
@canvas.itembind('I1', '1'){ start }
|
461
|
+
end
|
462
|
+
|
463
|
+
def move1(step = nil)
|
464
|
+
step = get_step(1, step)
|
465
|
+
pos = [
|
466
|
+
[807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153],
|
467
|
+
[785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438],
|
468
|
+
[821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601],
|
469
|
+
[-100, -100]
|
470
|
+
]
|
471
|
+
return 0 if step >= pos.length
|
472
|
+
where = pos[step]
|
473
|
+
move_abs('I1', where)
|
474
|
+
move15a if where[2] == :y
|
475
|
+
return 3 if where[2] == :x
|
476
|
+
return 1
|
477
|
+
end
|
478
|
+
|
479
|
+
# Lighting the match
|
480
|
+
def draw2
|
481
|
+
color = @C['2']
|
482
|
+
|
483
|
+
# Fulcrum
|
484
|
+
TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392],
|
485
|
+
:fill=>@C['fg'], :outline=>@C['fg'])
|
486
|
+
|
487
|
+
# Strike box
|
488
|
+
TkcRectangle.new(@canvas, [628, 335, 660, 383],
|
489
|
+
:fill=>'', :outline=>@C['fg'])
|
490
|
+
(0..2).each{|y|
|
491
|
+
yy = 335 + y*16
|
492
|
+
TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25',
|
493
|
+
:anchor=>:nw, :foreground=>@C['fg'])
|
494
|
+
TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25',
|
495
|
+
:anchor=>:nw, :foreground=>@C['fg'])
|
496
|
+
}
|
497
|
+
|
498
|
+
# Lever
|
499
|
+
TkcLine.new(@canvas, [702, 366, 798, 366],
|
500
|
+
:fill=>@C['fg'], :width=>6, :tag=>'I2_0')
|
501
|
+
|
502
|
+
# R strap
|
503
|
+
TkcLine.new(@canvas, [712, 363, 712, 355],
|
504
|
+
:fill=>@C['fg'], :width=>3, :tag=>'I2_1')
|
505
|
+
|
506
|
+
# L strap
|
507
|
+
TkcLine.new(@canvas, [705, 363, 705, 355],
|
508
|
+
:fill=>@C['fg'], :width=>3, :tag=>'I2_2')
|
509
|
+
|
510
|
+
# Match stick
|
511
|
+
TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356],
|
512
|
+
:fill=>@C['fg'], :width=>3, :tag=>'I2_3')
|
513
|
+
|
514
|
+
# Match head
|
515
|
+
TkcPolygon.new(@canvas,
|
516
|
+
[ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1,
|
517
|
+
671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ],
|
518
|
+
:fill=>color, :outline=>color, :tag=>'I2_4')
|
519
|
+
end
|
520
|
+
|
521
|
+
def move2(step = nil)
|
522
|
+
step = get_step(2, step)
|
523
|
+
|
524
|
+
stages = [0, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 1]
|
525
|
+
xy = []
|
526
|
+
xy[0] = [
|
527
|
+
686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307,
|
528
|
+
662, 318, 662, 328, 671, 336
|
529
|
+
]
|
530
|
+
xy[1] = [
|
531
|
+
687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311,
|
532
|
+
661, 327, 671, 335
|
533
|
+
]
|
534
|
+
xy[2] = [
|
535
|
+
686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298,
|
536
|
+
666, 309, 660, 324, 672, 336
|
537
|
+
]
|
538
|
+
|
539
|
+
if step >= stages.length
|
540
|
+
@canvas.delete('I2')
|
541
|
+
return 0
|
542
|
+
end
|
543
|
+
|
544
|
+
if step == 0 # Rotate the match
|
545
|
+
beta = 20
|
546
|
+
|
547
|
+
ox, oy = anchor('I2_0', :s) # Where to pivot
|
548
|
+
|
549
|
+
i = 0
|
550
|
+
until @canvas.find_withtag("I2_#{i}").empty?
|
551
|
+
rotate_item("I2_#{i}", ox, oy, beta)
|
552
|
+
i += 1
|
553
|
+
end
|
554
|
+
|
555
|
+
# For the flame
|
556
|
+
TkcPolygon.new(@canvas, [], :tag=>'I2', :smooth=>true, :fill=>@C['2'])
|
557
|
+
|
558
|
+
return 1
|
559
|
+
end
|
560
|
+
@canvas.coords('I2', xy[stages[step]])
|
561
|
+
return ((step == 7)? 3: 1)
|
562
|
+
end
|
563
|
+
|
564
|
+
# Weight and pulleys
|
565
|
+
def draw3
|
566
|
+
color = @C['3a']
|
567
|
+
color2 = @C['3b']
|
568
|
+
|
569
|
+
xy = [ [602, 296], [577, 174], [518, 174] ]
|
570
|
+
xy.each{|x, y| # 3 Pulleys
|
571
|
+
TkcOval.new(@canvas, box(x, y, 13),
|
572
|
+
:fill=>color, :outline=>@C['fg'], :width=>3)
|
573
|
+
TkcOval.new(@canvas, box(x, y, 2), :fill=>@C['fg'], :outline=>@C['fg'])
|
574
|
+
}
|
575
|
+
|
576
|
+
# Wall to flame
|
577
|
+
TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s',
|
578
|
+
:width=>3, :fill=>@C['fg'], :smooth=>true)
|
579
|
+
|
580
|
+
# Flame to pulley 1
|
581
|
+
TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0',
|
582
|
+
:width=>3, :fill=>@C['fg'], :smooth=>true)
|
583
|
+
TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1',
|
584
|
+
:width=>3, :fill=>@C['fg'], :smooth=>true)
|
585
|
+
|
586
|
+
# Pulley 1 half way to 2
|
587
|
+
TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2',
|
588
|
+
:width=>3, :fill=>@C['fg'])
|
589
|
+
|
590
|
+
# Pulley 1 other half to 2
|
591
|
+
TkcLine.new(@canvas, [589, 235, 589, 174], :width=>3, :fill=>@C['fg'])
|
592
|
+
|
593
|
+
# Across the top
|
594
|
+
TkcLine.new(@canvas, [577, 161, 518, 161], :width=>3, :fill=>@C['fg'])
|
595
|
+
|
596
|
+
# Down to weight
|
597
|
+
TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w',
|
598
|
+
:width=>3, :fill=>@C['fg'])
|
599
|
+
|
600
|
+
# Draw the weight as 2 circles, two rectangles and 1 rounded rectangle
|
601
|
+
x1, y1, x2, y2 = [515, 207, 495, 207]
|
602
|
+
TkcOval.new(@canvas, box(x1, y1, 6),
|
603
|
+
:tag=>'I3_', :fill=>color2, :outline=>color2)
|
604
|
+
TkcOval.new(@canvas, box(x2, y2, 6),
|
605
|
+
:tag=>'I3_', :fill=>color2, :outline=>color2)
|
606
|
+
TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6,
|
607
|
+
:tag=>'I3_', :fill=>color2, :outline=>color2)
|
608
|
+
|
609
|
+
TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15),
|
610
|
+
:smooth=>true, :tag=>'I3_', :fill=>color2, :outline=>color2)
|
611
|
+
|
612
|
+
TkcLine.new(@canvas, [500, 217, 511, 217],
|
613
|
+
:tag=>'I3_', :fill=>color2, :width=>10)
|
614
|
+
|
615
|
+
# Bottom weight target
|
616
|
+
TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465],
|
617
|
+
:tag=>'I3__', :fill=>@C['fg'], :joinstyle=>:miter, :width=>10)
|
618
|
+
end
|
619
|
+
|
620
|
+
def move3(step = nil)
|
621
|
+
step = get_step(3, step)
|
622
|
+
|
623
|
+
pos = [ [505, 247], [505, 297], [505, 386.5], [505, 386.5] ]
|
624
|
+
rope = []
|
625
|
+
rope[0] = [750, 309, 729, 301, 711, 324, 690, 300]
|
626
|
+
rope[1] = [750, 309, 737, 292, 736, 335, 717, 315, 712, 320]
|
627
|
+
rope[2] = [750, 309, 737, 309, 740, 343, 736, 351, 725, 340]
|
628
|
+
rope[3] = [750, 309, 738, 321, 746, 345, 742, 356]
|
629
|
+
|
630
|
+
return 0 if step >= pos.length
|
631
|
+
|
632
|
+
@canvas.delete("I3_#{step}") # Delete part of the rope
|
633
|
+
move_abs('I3_', pos[step]) # Move weight down
|
634
|
+
@canvas.coords('I3_s', rope[step]) # Flapping rope end
|
635
|
+
@canvas.coords('I3_w', [505, 174].concat(pos[step]))
|
636
|
+
if step == 2
|
637
|
+
@canvas.move('I3__', 0, 30)
|
638
|
+
return 2
|
639
|
+
end
|
640
|
+
return 1
|
641
|
+
end
|
642
|
+
|
643
|
+
# Cage and door
|
644
|
+
def draw4
|
645
|
+
color = @C['4']
|
646
|
+
x0, y0, x1, y1 = [527, 356, 611, 464]
|
647
|
+
|
648
|
+
# Horizontal bars
|
649
|
+
y0.step(y1, 12){|y|
|
650
|
+
TkcLine.new(@canvas, [x0, y, x1, y], :fill=>color, :width=>1)
|
651
|
+
}
|
652
|
+
|
653
|
+
# Vertical bars
|
654
|
+
x0.step(x1, 12){|x|
|
655
|
+
TkcLine.new(@canvas, [x, y0, x, y1], :fill=>color, :width=>1)
|
656
|
+
}
|
657
|
+
|
658
|
+
# Swing gate
|
659
|
+
TkcLine.new(@canvas, [518, 464, 518, 428],
|
660
|
+
:tag=>'I4', :fill=>color, :width=>1)
|
661
|
+
end
|
662
|
+
|
663
|
+
def move4(step = nil)
|
664
|
+
step = get_step(4, step)
|
665
|
+
|
666
|
+
angles = [-10, -20, -30, -30]
|
667
|
+
return 0 if step >= angles.length
|
668
|
+
|
669
|
+
rotate_item('I4', 518, 464, angles[step])
|
670
|
+
@canvas.raise('I4')
|
671
|
+
|
672
|
+
return((step == 3)? 3: 1)
|
673
|
+
end
|
674
|
+
|
675
|
+
# Mouse
|
676
|
+
def draw5
|
677
|
+
color = @C['5a']
|
678
|
+
color2 = @C['5b']
|
679
|
+
|
680
|
+
xy = [377, 248, 410, 248, 410, 465, 518, 465] # Mouse course
|
681
|
+
xy.concat [518, 428, 451, 428, 451, 212, 377, 212]
|
682
|
+
|
683
|
+
TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3)
|
684
|
+
|
685
|
+
xy = [
|
686
|
+
534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446,
|
687
|
+
575, 452, 574, 454, 566, 456, 554, 456, 545, 456, 537, 454, 530, 452
|
688
|
+
]
|
689
|
+
TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_0'], :fill=>color)
|
690
|
+
|
691
|
+
TkcLine.new(@canvas, [573, 452, 592, 458, 601, 460, 613, 456], # Tail
|
692
|
+
:tag=>['I5', 'I5_1'], :fill=>color, :smooth=>true, :width=>3)
|
693
|
+
|
694
|
+
xy = box(540, 446, 2) # Eye
|
695
|
+
xy = [540, 444, 541, 445, 541, 447, 540, 448, 538, 447, 538, 445]
|
696
|
+
TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'],
|
697
|
+
:outline=>'', :smooth=>true)
|
698
|
+
|
699
|
+
xy = [538, 454, 535, 461] # Front leg
|
700
|
+
TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_3'], :fill=>color, :width=>2)
|
701
|
+
|
702
|
+
xy = [566, 455, 569, 462] # Back leg
|
703
|
+
TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_4'], :fill=>color, :width=>2)
|
704
|
+
|
705
|
+
xy = [544, 455, 545, 460] # 2nd front leg
|
706
|
+
TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_5'], :fill=>color, :width=>2)
|
707
|
+
|
708
|
+
xy = [560, 455, 558, 460] # 2nd back leg
|
709
|
+
TkcLine.new(@canvas, xy, :tag=>['I5', 'I5_6'], :fill=>color, :width=>2)
|
710
|
+
end
|
711
|
+
|
712
|
+
def move5(step = nil)
|
713
|
+
step = get_step(5, step)
|
714
|
+
|
715
|
+
pos = [
|
716
|
+
[553, 452], [533, 452], [513, 452], [493, 452], [473, 452],
|
717
|
+
[463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414],
|
718
|
+
[422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294],
|
719
|
+
[422, 274, -30], [422, 260.5, -30, :x], [422.5, 248.5, -28], [425, 237]
|
720
|
+
]
|
721
|
+
|
722
|
+
return 0 if step >= pos.length
|
723
|
+
|
724
|
+
x, y, beta, nxt = pos[step]
|
725
|
+
move_abs('I5', [x, y])
|
726
|
+
if beta
|
727
|
+
ox, oy = centroid('I5_0')
|
728
|
+
(0..6).each{|id| rotate_item("I5_#{id}", ox, oy, beta) }
|
729
|
+
end
|
730
|
+
return 3 if nxt == :x
|
731
|
+
return 1
|
732
|
+
end
|
733
|
+
|
734
|
+
# Dropping gumballs
|
735
|
+
def draw6
|
736
|
+
color = @C['6']
|
737
|
+
xy = [324, 130, 391, 204] # Ball holder
|
738
|
+
xy = round_rect(xy, 10)
|
739
|
+
TkcPolygon.new(@canvas, xy, :smooth=>true,
|
740
|
+
:outline=>@C['fg'], :width=>3, :fill=>color)
|
741
|
+
xy = [339, 204, 376, 253] # Below the ball holder
|
742
|
+
TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3,
|
743
|
+
:fill=>color, :tag=>'I6c')
|
744
|
+
xy = box(346, 339, 28)
|
745
|
+
TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') # Roter
|
746
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc,
|
747
|
+
:start=>80, :extent=>205)
|
748
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc,
|
749
|
+
:start=>-41, :extent=>85)
|
750
|
+
|
751
|
+
xy = box(346, 339, 15) # Center of rotor
|
752
|
+
TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['fg'], :tag=>'I6m')
|
753
|
+
xy = [352, 312, 352, 254, 368, 254, 368, 322] # Top drop to rotor
|
754
|
+
TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'')
|
755
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2)
|
756
|
+
|
757
|
+
xy = [353, 240, 367, 300] # Poke bottom hole
|
758
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'')
|
759
|
+
xy = [341, 190, 375, 210] # Poke another hole
|
760
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'')
|
761
|
+
|
762
|
+
xy = [
|
763
|
+
368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403,
|
764
|
+
352, 403, 352, 366
|
765
|
+
]
|
766
|
+
TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'',
|
767
|
+
:width=>2) # Below rotor
|
768
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2)
|
769
|
+
xy = box(275, 342, 7) # On/off rotor
|
770
|
+
TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['fg'])
|
771
|
+
xy = [276, 334, 342, 325] # Fan belt top
|
772
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
|
773
|
+
xy = [276, 349, 342, 353] # Fan belt bottom
|
774
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
|
775
|
+
|
776
|
+
xy = [337, 212, 337, 247] # What the mouse pushes
|
777
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I6_')
|
778
|
+
xy = [392, 212, 392, 247]
|
779
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I6_')
|
780
|
+
xy = [337, 230, 392, 230]
|
781
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>7, :tag=>'I6_')
|
782
|
+
|
783
|
+
who = -1 # All the balls
|
784
|
+
colors = %w(red cyan orange green blue darkblue)
|
785
|
+
colors *= 3
|
786
|
+
|
787
|
+
(0..16).each{|i|
|
788
|
+
loc = -i
|
789
|
+
color = colors[i]
|
790
|
+
x, y = @XY6["#{loc}"]
|
791
|
+
TkcOval.new(@canvas, box(x, y, 5),
|
792
|
+
:fill=>color, :outline=>color, :tag=>"I6_b#{i}")
|
793
|
+
}
|
794
|
+
draw6a(12) # The wheel
|
795
|
+
end
|
796
|
+
|
797
|
+
def draw6a(beta)
|
798
|
+
@canvas.delete('I6_0')
|
799
|
+
ox, oy = [346, 339]
|
800
|
+
(0..3).each{|i|
|
801
|
+
b = beta + i * 45
|
802
|
+
x, y = rotate_c(28, 0, 0, 0, b)
|
803
|
+
xy = [ox + x, oy + y, ox - x, oy - y]
|
804
|
+
TkcLine.new(@canvas, xy, :tag=>'I6_0', :fill=>@C['fg'], :width=>2)
|
805
|
+
}
|
806
|
+
end
|
807
|
+
|
808
|
+
def move6(step = nil)
|
809
|
+
step = get_step(6, step)
|
810
|
+
|
811
|
+
return 0 if step > 62
|
812
|
+
|
813
|
+
if step < 2 # Open gate for balls to drop
|
814
|
+
@canvas.move('I6_', -7, 0)
|
815
|
+
if step == 1 # Poke a hole
|
816
|
+
xy = [348, 226, 365, 240]
|
817
|
+
TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill),
|
818
|
+
:outline=>'')
|
819
|
+
end
|
820
|
+
return 1
|
821
|
+
end
|
822
|
+
|
823
|
+
s = step - 1 # Do the gumball drop dance
|
824
|
+
(0..(((s - 1)/3).to_i)).each{|i|
|
825
|
+
tag = "I6_b#{i}"
|
826
|
+
break if @canvas.find_withtag(tag).empty?
|
827
|
+
loc = s - 3*i
|
828
|
+
|
829
|
+
if @XY6["#{loc},#{i}"]
|
830
|
+
move_abs(tag, @XY6["#{loc},#{i}"])
|
831
|
+
elsif @XY6["#{loc}"]
|
832
|
+
move_abs(tag, @XY6["#{loc}"])
|
833
|
+
end
|
834
|
+
}
|
835
|
+
if s % 3 == 1
|
836
|
+
first = (s + 2)/3
|
837
|
+
i = first
|
838
|
+
loop {
|
839
|
+
tag = "I6_b#{i}"
|
840
|
+
break if @canvas.find_withtag(tag).empty?
|
841
|
+
loc = first - i
|
842
|
+
move_abs(tag, @XY6["#{loc}"])
|
843
|
+
i += 1
|
844
|
+
}
|
845
|
+
end
|
846
|
+
if s >= 3 # Rotate the motor
|
847
|
+
idx = s % 3
|
848
|
+
draw6a(12 + s * 15)
|
849
|
+
end
|
850
|
+
return((s == 3)? 3 : 1)
|
851
|
+
end
|
852
|
+
|
853
|
+
# On/off switch
|
854
|
+
def draw7
|
855
|
+
color = @C['7']
|
856
|
+
xy = [198, 306, 277, 374] # Box
|
857
|
+
TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2,
|
858
|
+
:fill=>color, :tag=>'I7z')
|
859
|
+
@canvas.lower('I7z')
|
860
|
+
xy = [275, 343, 230, 349]
|
861
|
+
TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last,
|
862
|
+
:arrowshape=>[23, 23, 8], :width=>6)
|
863
|
+
xy = [225, 324] # On button
|
864
|
+
x, y = xy
|
865
|
+
TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg'])
|
866
|
+
xy = [218, 323] # On text
|
867
|
+
font = ['Times Roman', 8]
|
868
|
+
TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e,
|
869
|
+
:fill=>@C['fg'], :font=>font)
|
870
|
+
xy = [225, 350] # Off button
|
871
|
+
x, y = xy
|
872
|
+
TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg'])
|
873
|
+
xy = [218, 349] # Off text
|
874
|
+
TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e,
|
875
|
+
:fill=>@C['fg'], :font=>font)
|
876
|
+
end
|
877
|
+
|
878
|
+
def move7(step = nil)
|
879
|
+
step = get_step(7, step)
|
880
|
+
|
881
|
+
numsteps = 30
|
882
|
+
return 0 if step > numsteps
|
883
|
+
beta = 30.0 / numsteps
|
884
|
+
rotate_item('I7', 275, 343, beta)
|
885
|
+
|
886
|
+
return((step == numsteps)? 3: 1)
|
887
|
+
end
|
888
|
+
|
889
|
+
# Electricity to the fan
|
890
|
+
def draw8
|
891
|
+
sine([271, 248, 271, 306], 5, 8, :tag=>'I8_s', :fill=>@C['8'], :width=>3)
|
892
|
+
end
|
893
|
+
|
894
|
+
def move8(step = nil)
|
895
|
+
step = get_step(8, step)
|
896
|
+
|
897
|
+
return 0 if step > 3
|
898
|
+
if step == 0
|
899
|
+
sparkle(anchor('I8_s', :s), 'I8')
|
900
|
+
return 1
|
901
|
+
elsif step == 1
|
902
|
+
move_abs('I8', anchor('I8_s', :c))
|
903
|
+
elsif step == 2
|
904
|
+
move_abs('I8', anchor('I8_s', :n))
|
905
|
+
else
|
906
|
+
@canvas.delete('I8')
|
907
|
+
end
|
908
|
+
return((step == 2)? 3: 1)
|
909
|
+
end
|
910
|
+
|
911
|
+
# Fan
|
912
|
+
def draw9
|
913
|
+
color = @C['9']
|
914
|
+
xy = [266, 194, 310, 220]
|
915
|
+
TkcOval.new(@canvas, xy, :outline=>color, :fill=>color)
|
916
|
+
xy = [280, 209, 296, 248]
|
917
|
+
TkcOval.new(@canvas, xy, :outline=>color, :fill=>color)
|
918
|
+
xy = [
|
919
|
+
288, 249, 252, 249, 260, 240, 280, 234,
|
920
|
+
296, 234, 316, 240, 324, 249, 288, 249
|
921
|
+
]
|
922
|
+
TkcPolygon.new(@canvas, xy, :fill=>color, :smooth=>true)
|
923
|
+
|
924
|
+
xy = [248, 205, 265, 214, 264, 205, 265, 196] # Spinner
|
925
|
+
TkcPolygon.new(@canvas, xy, :fill=>color)
|
926
|
+
|
927
|
+
xy = [255, 206, 265, 234] # Fan blades
|
928
|
+
TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
|
929
|
+
:width=>3, :tag=>'I9_0')
|
930
|
+
xy = [255, 176, 265, 204]
|
931
|
+
TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
|
932
|
+
:width=>3, :tag=>'I9_0')
|
933
|
+
xy = [255, 206, 265, 220]
|
934
|
+
TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
|
935
|
+
:width=>1, :tag=>'I9_1')
|
936
|
+
xy = [255, 190, 265, 204]
|
937
|
+
TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
|
938
|
+
:width=>1, :tag=>'I9_1')
|
939
|
+
end
|
940
|
+
|
941
|
+
def move9(step = nil)
|
942
|
+
step = get_step(9, step)
|
943
|
+
|
944
|
+
if (step & 1).nonzero?
|
945
|
+
@canvas.itemconfigure('I9_0', :width=>4)
|
946
|
+
@canvas.itemconfigure('I9_1', :width=>1)
|
947
|
+
@canvas.lower('I9_1', 'I9_0')
|
948
|
+
else
|
949
|
+
@canvas.itemconfigure('I9_0', :width=>1)
|
950
|
+
@canvas.itemconfigure('I9_1', :width=>4)
|
951
|
+
@canvas.lower('I9_0', 'I9_1')
|
952
|
+
end
|
953
|
+
return 3 if step == 0
|
954
|
+
return 1
|
955
|
+
end
|
956
|
+
|
957
|
+
# Boat
|
958
|
+
def draw10
|
959
|
+
color = @C['10a']
|
960
|
+
color2 = @C['10b']
|
961
|
+
xy = [191, 230, 233, 230, 233, 178, 191, 178] # Sail
|
962
|
+
TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'],
|
963
|
+
:tag=>'I10')
|
964
|
+
xy = box(209, 204, 31) # Front
|
965
|
+
TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie,
|
966
|
+
:start=>120, :extent=>120, :tag=>'I10')
|
967
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
|
968
|
+
:start=>120, :extent=>120, :tag=>'I10')
|
969
|
+
xy = box(249, 204, 31) # Back
|
970
|
+
TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3,
|
971
|
+
:style=>:pie, :start=>120, :extent=>120, :tag=>'I10')
|
972
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
|
973
|
+
:start=>120, :extent=>120, :tag=>'I10')
|
974
|
+
|
975
|
+
xy = [200, 171, 200, 249] # Mast
|
976
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I10')
|
977
|
+
xy = [159, 234, 182, 234] # Bow sprit
|
978
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I10')
|
979
|
+
xy = [180, 234, 180, 251, 220, 251] # Hull
|
980
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>6, :tag=>'I10')
|
981
|
+
|
982
|
+
xy = [92, 255, 221, 255] # Waves
|
983
|
+
sine(xy, 2, 25, :fill=>color2, :width=>1, :tag=>'I10w')
|
984
|
+
|
985
|
+
xy = @canvas.coords('I10w')[4..-5] # Water
|
986
|
+
xy.concat([222, 266, 222, 277, 99, 277])
|
987
|
+
TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>color2)
|
988
|
+
xy = [222, 266, 222, 277, 97, 277, 97, 266] # Water bottom
|
989
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
|
990
|
+
|
991
|
+
xy = box(239, 262, 17)
|
992
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
|
993
|
+
:start=>95, :extent=>103)
|
994
|
+
xy = box(76, 266, 21)
|
995
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
|
996
|
+
:extent=>190)
|
997
|
+
end
|
998
|
+
|
999
|
+
def move10(step = nil)
|
1000
|
+
step = get_step(10, step)
|
1001
|
+
|
1002
|
+
pos = [
|
1003
|
+
[195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212],
|
1004
|
+
[171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212],
|
1005
|
+
[142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212],
|
1006
|
+
[116, 212], [111, 212]
|
1007
|
+
]
|
1008
|
+
|
1009
|
+
return 0 if step >= pos.length
|
1010
|
+
|
1011
|
+
where = pos[step]
|
1012
|
+
move_abs('I10', where)
|
1013
|
+
|
1014
|
+
return 3 if where[2] == :x
|
1015
|
+
return 1
|
1016
|
+
end
|
1017
|
+
|
1018
|
+
# 2nd ball drop
|
1019
|
+
def draw11
|
1020
|
+
color = @C['11a']
|
1021
|
+
color2 = @C['11b']
|
1022
|
+
xy = [23, 264, 55, 591] # Color the down tube
|
1023
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'')
|
1024
|
+
xy = box(71, 460, 48) # Color the outer loop
|
1025
|
+
TkcOval.new(@canvas, xy, :fill=>color, :outline=>'')
|
1026
|
+
|
1027
|
+
xy = [55, 264, 55, 458] # Top right side
|
1028
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
|
1029
|
+
xy = [55, 504, 55, 591] # Bottom right side
|
1030
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
|
1031
|
+
xy = box(71, 460, 48) # Outer loop
|
1032
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
|
1033
|
+
:start=>110, :extent=>-290, :tag=>'I11i')
|
1034
|
+
xy = box(71, 460, 16) # Inner loop
|
1035
|
+
TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'',
|
1036
|
+
:width=>3, :tag=>'I11i')
|
1037
|
+
TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['bg'], :width=>3)
|
1038
|
+
|
1039
|
+
xy = [23, 264, 23, 591] # Left side
|
1040
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
|
1041
|
+
xy = box(1, 266, 23) # Top left curve
|
1042
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3,
|
1043
|
+
:style=>:arc, :extent=>90)
|
1044
|
+
|
1045
|
+
xy = box(75, 235, 9) # The ball
|
1046
|
+
TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'',
|
1047
|
+
:width=>3, :tag=>'I11')
|
1048
|
+
end
|
1049
|
+
|
1050
|
+
def move11(step = nil)
|
1051
|
+
step = get_step(11, step)
|
1052
|
+
|
1053
|
+
pos = [
|
1054
|
+
[75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266],
|
1055
|
+
[38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472],
|
1056
|
+
[100, 437], [65, 423], [-100, -100], [38, 505], [38, 527, :x], [38, 591]
|
1057
|
+
]
|
1058
|
+
|
1059
|
+
return 0 if step >= pos.length
|
1060
|
+
where = pos[step]
|
1061
|
+
move_abs('I11', where)
|
1062
|
+
return 3 if where[2] == :x
|
1063
|
+
return 1
|
1064
|
+
end
|
1065
|
+
|
1066
|
+
# Hand
|
1067
|
+
def draw12
|
1068
|
+
xy = [
|
1069
|
+
20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590,
|
1070
|
+
60, 590, 60, 610, 60, 610
|
1071
|
+
]
|
1072
|
+
xy.concat([60, 610, 65, 620, 60, 631]) # Thumb
|
1073
|
+
xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669,
|
1074
|
+
56, 669, 50, 669, 50, 662, 50, 637])
|
1075
|
+
|
1076
|
+
y0 = 637 # Bumps for fingers
|
1077
|
+
y1 = 645
|
1078
|
+
50.step(21, -10){|x|
|
1079
|
+
x1 = x - 5
|
1080
|
+
x2 = x - 10
|
1081
|
+
xy << x << y0 << x1 << y1 << x2 << y0
|
1082
|
+
}
|
1083
|
+
TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'],
|
1084
|
+
:smooth=>true, :tag=>'I12', :width=>3)
|
1085
|
+
end
|
1086
|
+
|
1087
|
+
def move12(step = nil)
|
1088
|
+
step = get_step(12, step)
|
1089
|
+
|
1090
|
+
pos = [[42.5, 641, :x]]
|
1091
|
+
return 0 if step >= pos.length
|
1092
|
+
where = pos[step]
|
1093
|
+
move_abs('I12', where)
|
1094
|
+
return 3 if where[2] == :x
|
1095
|
+
return 1
|
1096
|
+
end
|
1097
|
+
|
1098
|
+
# Fax
|
1099
|
+
def draw13
|
1100
|
+
color = @C['13a']
|
1101
|
+
xy = [86, 663, 149, 663, 149, 704, 50, 704, 50, 681, 64, 681, 86, 671]
|
1102
|
+
xy2 = [
|
1103
|
+
784, 663, 721, 663, 721, 704, 820, 704, 820, 681, 806, 681, 784, 671
|
1104
|
+
]
|
1105
|
+
radii = [2, 9, 9, 8, 5, 5, 2]
|
1106
|
+
|
1107
|
+
round_poly(@canvas, xy, radii, :width=>3,
|
1108
|
+
:outline=>@C['fg'], :fill=>color)
|
1109
|
+
round_poly(@canvas, xy2, radii, :width=>3,
|
1110
|
+
:outline=>@C['fg'], :fill=>color)
|
1111
|
+
|
1112
|
+
xy = [56, 677]
|
1113
|
+
x, y = xy
|
1114
|
+
TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'],
|
1115
|
+
:width=>3, :tag=>'I13')
|
1116
|
+
xy = [809, 677]
|
1117
|
+
x, y = xy
|
1118
|
+
TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'],
|
1119
|
+
:width=>3, :tag=>'I13R')
|
1120
|
+
|
1121
|
+
xy = [112, 687] # Label
|
1122
|
+
TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'],
|
1123
|
+
:font=>['Times Roman', 12, :bold])
|
1124
|
+
xy = [762, 687]
|
1125
|
+
TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'],
|
1126
|
+
:font=>['Times Roman', 12, :bold])
|
1127
|
+
|
1128
|
+
xy = [138, 663, 148, 636, 178, 636] # Paper guide
|
1129
|
+
TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3)
|
1130
|
+
xy = [732, 663, 722, 636, 692, 636]
|
1131
|
+
TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3)
|
1132
|
+
|
1133
|
+
sine([149, 688, 720, 688], 5, 15,
|
1134
|
+
:tag=>'I13_s', :fill=>@C['fg'], :width=>3)
|
1135
|
+
end
|
1136
|
+
|
1137
|
+
def move13(step = nil)
|
1138
|
+
step = get_step(13, step)
|
1139
|
+
|
1140
|
+
numsteps = 7
|
1141
|
+
|
1142
|
+
if step == numsteps + 2
|
1143
|
+
move_abs('I13_star', [-100, -100])
|
1144
|
+
@canvas.itemconfigure('I13R', :fill=>@C['13b'], :width=>2)
|
1145
|
+
return 2
|
1146
|
+
end
|
1147
|
+
if step == 0 # Button down
|
1148
|
+
@canvas.delete('I13')
|
1149
|
+
sparkle([-100, -100], 'I13_star') # Create off screen
|
1150
|
+
return 1
|
1151
|
+
end
|
1152
|
+
x0, y0 = anchor('I13_s', :w)
|
1153
|
+
x1, y1 = anchor('I13_s', :e)
|
1154
|
+
x = x0 + (x1 - x0) * (step - 1) / numsteps.to_f
|
1155
|
+
move_abs('I13_star', [x, y0])
|
1156
|
+
return 1
|
1157
|
+
end
|
1158
|
+
|
1159
|
+
# Paper in fax
|
1160
|
+
def draw14
|
1161
|
+
color = @C['14']
|
1162
|
+
xy = [102, 661, 113, 632, 130, 618] # Left paper edge
|
1163
|
+
TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
|
1164
|
+
:width=>3, :tag=>'I14L_0')
|
1165
|
+
xy = [148, 629, 125, 640, 124, 662] # Right paper edge
|
1166
|
+
TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
|
1167
|
+
:width=>3, :tag=>'I14L_1')
|
1168
|
+
draw14a('L')
|
1169
|
+
|
1170
|
+
xy = [
|
1171
|
+
768.0, 662.5, 767.991316225, 662.433786215, 767.926187912, 662.396880171
|
1172
|
+
]
|
1173
|
+
TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
|
1174
|
+
:width=>3, :tag=>'I14R_0')
|
1175
|
+
@canvas.lower('I14R_0')
|
1176
|
+
# NB. these numbers are VERY sensitive, you must start with final size
|
1177
|
+
# and shrink down to get the values
|
1178
|
+
xy = [
|
1179
|
+
745.947897349, 662.428358855, 745.997829056, 662.452239237, 746.0, 662.5
|
1180
|
+
]
|
1181
|
+
TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
|
1182
|
+
:width=>3, :tag=>'I14R_1')
|
1183
|
+
@canvas.lower('I14R_1')
|
1184
|
+
end
|
1185
|
+
|
1186
|
+
def draw14a(side)
|
1187
|
+
color = @C['14']
|
1188
|
+
xy = @canvas.coords("I14#{side}_0")
|
1189
|
+
xy2 = @canvas.coords("I14#{side}_1")
|
1190
|
+
x0, y0, x1, y1, x2, y2 = xy
|
1191
|
+
x3, y3, x4, y4, x5, y5 = xy2
|
1192
|
+
|
1193
|
+
zz = [
|
1194
|
+
x0, y0, x0, y0, xy, x2, y2, x2, y2,
|
1195
|
+
x3, y3, x3, y3, xy2, x5, y5, x5, y5
|
1196
|
+
].flatten
|
1197
|
+
@canvas.delete("I14#{side}")
|
1198
|
+
TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true,
|
1199
|
+
:fill=>color, :outline=>color, :width=>3)
|
1200
|
+
@canvas.lower("I14#{side}")
|
1201
|
+
end
|
1202
|
+
|
1203
|
+
def move14(step = nil)
|
1204
|
+
step = get_step(14, step)
|
1205
|
+
|
1206
|
+
# Paper going down
|
1207
|
+
sc = 0.9 - 0.05*step
|
1208
|
+
if sc < 0.3
|
1209
|
+
@canvas.delete('I14L')
|
1210
|
+
return 0
|
1211
|
+
end
|
1212
|
+
|
1213
|
+
ox, oy = @canvas.coords('I14L_0')
|
1214
|
+
@canvas.scale('I14L_0', ox, oy, sc, sc)
|
1215
|
+
ox, oy = @canvas.coords('I14L_1')[-2..-1]
|
1216
|
+
@canvas.scale('I14L_1', ox, oy, sc, sc)
|
1217
|
+
draw14a('L')
|
1218
|
+
|
1219
|
+
# Paper going up
|
1220
|
+
sc = 0.35 + 0.05*step
|
1221
|
+
sc = 1/sc
|
1222
|
+
|
1223
|
+
ox, oy = @canvas.coords('I14R_0')
|
1224
|
+
@canvas.scale('I14R_0', ox, oy, sc, sc)
|
1225
|
+
ox, oy = @canvas.coords('I14R_1')[-2..-1]
|
1226
|
+
@canvas.scale('I14R_1', ox, oy, sc, sc)
|
1227
|
+
draw14a('R')
|
1228
|
+
|
1229
|
+
return((step == 10)? 3: 1)
|
1230
|
+
end
|
1231
|
+
|
1232
|
+
# Light beam
|
1233
|
+
def draw15
|
1234
|
+
color = @C['15a']
|
1235
|
+
xy = [824, 599, 824, 585, 820, 585, 829, 585]
|
1236
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I15a')
|
1237
|
+
xy = [789, 599, 836, 643]
|
1238
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
|
1239
|
+
xy = [778, 610, 788, 632]
|
1240
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
|
1241
|
+
xy = [766, 617, 776, 625]
|
1242
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
|
1243
|
+
|
1244
|
+
xy = [633, 600, 681, 640]
|
1245
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3)
|
1246
|
+
xy = [635, 567, 657, 599]
|
1247
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2)
|
1248
|
+
xy = [765, 557, 784, 583]
|
1249
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2)
|
1250
|
+
|
1251
|
+
sine([658, 580, 765, 580], 3, 15,
|
1252
|
+
:tag=>'I15_s', :fill=>@C['fg'], :width=>3)
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
def move15a
|
1256
|
+
color = @C['15b']
|
1257
|
+
@canvas.scale('I15a', 824, 599, 1, 0.3) # Button down
|
1258
|
+
xy = [765, 621, 681, 621]
|
1259
|
+
TkcLine.new(@canvas, xy, :dash=>'-', :width=>3, :fill=>color, :tag=>'I15')
|
1260
|
+
end
|
1261
|
+
|
1262
|
+
def move15(step = nil)
|
1263
|
+
step = get_step(15, step)
|
1264
|
+
|
1265
|
+
numsteps = 6
|
1266
|
+
|
1267
|
+
if step == numsteps + 2
|
1268
|
+
move_abs('I15_star', [-100, -100])
|
1269
|
+
return 2
|
1270
|
+
end
|
1271
|
+
if step == 0 # Break the light beam
|
1272
|
+
sparkle([-100, -100], 'I15_star')
|
1273
|
+
xy = [765, 621, 745, 621]
|
1274
|
+
@canvas.coords('I15', xy)
|
1275
|
+
return 1
|
1276
|
+
end
|
1277
|
+
x0, y0 = anchor('I15_s', :w)
|
1278
|
+
x1, y1 = anchor('I15_s', :e)
|
1279
|
+
x = x0 + (x1 - x0) * (step - 1) / numsteps.to_f
|
1280
|
+
move_abs('I15_star', [x, y0])
|
1281
|
+
return 1
|
1282
|
+
end
|
1283
|
+
|
1284
|
+
# Bell
|
1285
|
+
def draw16
|
1286
|
+
color = @C['16']
|
1287
|
+
xy = [722, 485, 791, 556]
|
1288
|
+
TkcRectangle.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3)
|
1289
|
+
xy = box(752, 515, 25) # Bell
|
1290
|
+
TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black',
|
1291
|
+
:tag=>'I16b', :width=>2)
|
1292
|
+
xy = box(752, 515, 5) # Bell button
|
1293
|
+
TkcOval.new(@canvas, xy, :fill=>'black', :outline=>'black', :tag=>'I16b')
|
1294
|
+
|
1295
|
+
xy = [784, 523, 764, 549] # Clapper
|
1296
|
+
TkcLine.new(@canvas, xy, :width=>3, :tag=>'I16c', :fill=>@C['fg'])
|
1297
|
+
xy = box(784, 523, 4)
|
1298
|
+
TkcOval.new(@canvas, xy, :fill=>@C['fg'], :outline=>@C['fg'], :tag=>'I16d')
|
1299
|
+
end
|
1300
|
+
|
1301
|
+
def move16(step = nil)
|
1302
|
+
step = get_step(16, step)
|
1303
|
+
|
1304
|
+
# Note: we never stop
|
1305
|
+
ox, oy = [760, 553]
|
1306
|
+
if (step & 1).nonzero?
|
1307
|
+
beta = 12
|
1308
|
+
@canvas.move('I16b', 3, 0)
|
1309
|
+
else
|
1310
|
+
beta = -12
|
1311
|
+
@canvas.move('I16b', -3, 0)
|
1312
|
+
end
|
1313
|
+
rotate_item('I16c', ox, oy, beta)
|
1314
|
+
rotate_item('I16d', ox, oy, beta)
|
1315
|
+
|
1316
|
+
return ((step == 1)? 3: 1)
|
1317
|
+
end
|
1318
|
+
|
1319
|
+
# Cat
|
1320
|
+
def draw17
|
1321
|
+
color = @C['17']
|
1322
|
+
|
1323
|
+
xy = [584, 556, 722, 556]
|
1324
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
|
1325
|
+
xy = [584, 485, 722, 485]
|
1326
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
|
1327
|
+
|
1328
|
+
xy = [664, 523, 717, 549] # Body
|
1329
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3,
|
1330
|
+
:style=>:chord, :start=>128, :extent=>260, :tag=>'I17')
|
1331
|
+
|
1332
|
+
xy = [709, 554, 690, 543] # Paw
|
1333
|
+
TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color,
|
1334
|
+
:width=>3, :tag=>'I17')
|
1335
|
+
xy = [657, 544, 676, 555]
|
1336
|
+
TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color,
|
1337
|
+
:width=>3, :tag=>'I17')
|
1338
|
+
|
1339
|
+
xy = box(660, 535, 15) # Lower face
|
1340
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
|
1341
|
+
:start=>150, :extent=>240, :tag=>'I17_')
|
1342
|
+
TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
|
1343
|
+
:style=>:chord, :start=>150, :extent=>240, :tag=>'I17_')
|
1344
|
+
xy = [674, 529, 670, 513, 662, 521, 658, 521, 650, 513, 647, 529] # Ears
|
1345
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
|
1346
|
+
TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1,
|
1347
|
+
:tag=>['I17_', 'I17_c'])
|
1348
|
+
xy = [652, 542, 628, 539] # Whiskers
|
1349
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
|
1350
|
+
xy = [652, 543, 632, 545]
|
1351
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
|
1352
|
+
xy = [652, 546, 632, 552]
|
1353
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
|
1354
|
+
|
1355
|
+
xy = [668, 543, 687, 538]
|
1356
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
|
1357
|
+
:tag=>['I17_', 'I17_w'])
|
1358
|
+
xy = [668, 544, 688, 546]
|
1359
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
|
1360
|
+
:tag=>['I17_', 'I17_w'])
|
1361
|
+
xy = [668, 547, 688, 553]
|
1362
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
|
1363
|
+
:tag=>['I17_', 'I17_w'])
|
1364
|
+
|
1365
|
+
xy = [649, 530, 654, 538, 659, 530] # Left eye
|
1366
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
|
1367
|
+
:smooth=>true, :tag=>'I17')
|
1368
|
+
xy = [671, 530, 666, 538, 661, 530] # Right eye
|
1369
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
|
1370
|
+
:smooth=>true, :tag=>'I17')
|
1371
|
+
xy = [655, 543, 660, 551, 665, 543] # Mouth
|
1372
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
|
1373
|
+
:smooth=>true, :tag=>'I17')
|
1374
|
+
end
|
1375
|
+
|
1376
|
+
def move17(step = nil)
|
1377
|
+
step = get_step(17, step)
|
1378
|
+
|
1379
|
+
if step == 0
|
1380
|
+
@canvas.delete('I17') # Delete most of the cat
|
1381
|
+
xy = [655, 543, 660, 535, 665, 543] # Mouth
|
1382
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
|
1383
|
+
:smooth=>true, :tag=>'I17_')
|
1384
|
+
xy = box(654, 530, 4) # Left eye
|
1385
|
+
TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'',
|
1386
|
+
:tag=>'I17_')
|
1387
|
+
xy = box(666, 530, 4) # Right eye
|
1388
|
+
TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'',
|
1389
|
+
:tag=>'I17_')
|
1390
|
+
|
1391
|
+
@canvas.move('I17_', 0, -20) # Move face up
|
1392
|
+
xy = [652, 528, 652, 554] # Front leg
|
1393
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
|
1394
|
+
xy = [670, 528, 670, 554] # 2nd front leg
|
1395
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
|
1396
|
+
|
1397
|
+
xy = [ # Body
|
1398
|
+
675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525,
|
1399
|
+
716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527,
|
1400
|
+
668, 527, 668, 527, 675, 522, 676, 517, 677, 512
|
1401
|
+
]
|
1402
|
+
TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill),
|
1403
|
+
:outline=>@C['fg'], :width=>3, :smooth=>true,
|
1404
|
+
:tag=>'I17_')
|
1405
|
+
xy = [716, 514, 716, 554] # Back leg
|
1406
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
|
1407
|
+
xy = [694, 532, 694, 554] # 2nd back leg
|
1408
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
|
1409
|
+
xy = [715, 514, 718, 506, 719, 495, 716, 488] # Tail
|
1410
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
|
1411
|
+
:smooth=>true, :tag=>'I17_')
|
1412
|
+
|
1413
|
+
@canvas.raise('I17w') # Make whiskers visible
|
1414
|
+
@canvas.move('I17_', -5, 0) # Move away from the wall a bit
|
1415
|
+
return 2
|
1416
|
+
end
|
1417
|
+
return 0
|
1418
|
+
end
|
1419
|
+
|
1420
|
+
# Sling shot
|
1421
|
+
def draw18
|
1422
|
+
color = @C['18']
|
1423
|
+
xy = [721, 506, 627, 506] # Sling hold
|
1424
|
+
TkcLine.new(@canvas, xy, :width=>4, :fill=>@C['fg'], :tag=>'I18')
|
1425
|
+
|
1426
|
+
xy = [607, 500, 628, 513] # Sling rock
|
1427
|
+
TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :tag=>'I18a')
|
1428
|
+
|
1429
|
+
xy = [526, 513, 606, 507, 494, 502] # Sling band
|
1430
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>4, :tag=>'I18b')
|
1431
|
+
xy = [485, 490, 510, 540, 510, 575, 510, 540, 535, 491] # Sling
|
1432
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>6)
|
1433
|
+
end
|
1434
|
+
|
1435
|
+
def move18(step = nil)
|
1436
|
+
step = get_step(18, step)
|
1437
|
+
|
1438
|
+
pos = [
|
1439
|
+
[587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x],
|
1440
|
+
[136, 506], [16, 506], [-100, -100]
|
1441
|
+
]
|
1442
|
+
|
1443
|
+
b = []
|
1444
|
+
b[0] = [490, 502, 719, 507, 524, 512] # Band collapsing
|
1445
|
+
b[1] = [
|
1446
|
+
491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525,
|
1447
|
+
553, 536, 538, 534, 532, 519, 529, 499
|
1448
|
+
]
|
1449
|
+
b[2] = [
|
1450
|
+
491, 503, 508, 563, 542, 533, 551, 526, 561, 539, 549, 550, 530, 500
|
1451
|
+
]
|
1452
|
+
b[3] = [
|
1453
|
+
491, 503, 508, 563, 530, 554, 541, 562, 525, 568, 519, 544, 530, 501
|
1454
|
+
]
|
1455
|
+
|
1456
|
+
return 0 if step >= pos.length
|
1457
|
+
|
1458
|
+
if step == 0
|
1459
|
+
@canvas.delete('I18')
|
1460
|
+
@canvas.itemconfigure('I18b', :smooth=>true)
|
1461
|
+
end
|
1462
|
+
if b[step]
|
1463
|
+
@canvas.coords('I18b', b[step])
|
1464
|
+
end
|
1465
|
+
|
1466
|
+
where = pos[step]
|
1467
|
+
move_abs('I18a', where)
|
1468
|
+
return 3 if where[2] == :x
|
1469
|
+
return 1
|
1470
|
+
end
|
1471
|
+
|
1472
|
+
# Water pipe
|
1473
|
+
def draw19
|
1474
|
+
color = @C['19']
|
1475
|
+
xx = [[249, 181], [155, 118], [86, 55], [22, 0]]
|
1476
|
+
xx.each{|x1, x2|
|
1477
|
+
TkcRectangle.new(@canvas, x1, 453, x2, 467,
|
1478
|
+
:fill=>color, :outline=>'', :tag=>'I19')
|
1479
|
+
TkcLine.new(@canvas, x1, 453, x2, 453,
|
1480
|
+
:fill=>@C['fg'], :width=>1) # Pipe top
|
1481
|
+
TkcLine.new(@canvas, x1, 467, x2, 467,
|
1482
|
+
:fill=>@C['fg'], :width=>1) # Pipe bottom
|
1483
|
+
}
|
1484
|
+
@canvas.raise('I11i')
|
1485
|
+
|
1486
|
+
xy = box(168, 460, 16) # Bulge by the joint
|
1487
|
+
TkcOval.new(@canvas, xy, :fill=>color, :outline=>'')
|
1488
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc,
|
1489
|
+
:start=>21, :extent=>136)
|
1490
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc,
|
1491
|
+
:start=>-21, :extent=>-130)
|
1492
|
+
|
1493
|
+
xy = [249, 447, 255, 473] # First joint 26x6
|
1494
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
|
1495
|
+
|
1496
|
+
xy = box(257, 433, 34) # Bend up
|
1497
|
+
TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
|
1498
|
+
:style=>:pie, :start=>0, :extent=>-91)
|
1499
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
|
1500
|
+
:style=>:arc, :start=>0, :extent=>-90)
|
1501
|
+
xy = box(257, 433, 20)
|
1502
|
+
TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
|
1503
|
+
:style=>:pie, :start=>0, :extent=>-92)
|
1504
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
|
1505
|
+
:style=>:arc, :start=>0, :extent=>-90)
|
1506
|
+
xy = box(257, 421, 34) # Bend left
|
1507
|
+
TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
|
1508
|
+
:style=>:pie, :start=>0, :extent=>91)
|
1509
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
|
1510
|
+
:style=>:arc, :start=>0, :extent=>90)
|
1511
|
+
xy = box(257, 421, 20)
|
1512
|
+
TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
|
1513
|
+
:style=>:pie, :start=>0, :extent=>90)
|
1514
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
|
1515
|
+
:style=>:arc, :start=>0, :extent=>90)
|
1516
|
+
xy = box(243, 421, 34) # Bend down
|
1517
|
+
TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
|
1518
|
+
:style=>:pie, :start=>90, :extent=>90)
|
1519
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
|
1520
|
+
:style=>:arc, :start=>90, :extent=>90)
|
1521
|
+
xy = box(243, 421, 20)
|
1522
|
+
TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
|
1523
|
+
:style=>:pie, :start=>90, :extent=>90)
|
1524
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
|
1525
|
+
:style=>:arc, :start=>90, :extent=>90)
|
1526
|
+
|
1527
|
+
xy = [270, 427, 296, 433] # 2nd joint bottom
|
1528
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
|
1529
|
+
xy = [270, 421, 296, 427] # 2nd joint top
|
1530
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
|
1531
|
+
xy = [249, 382, 255, 408] # Third joint right
|
1532
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
|
1533
|
+
xy = [243, 382, 249, 408] # Third joint left
|
1534
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
|
1535
|
+
xy = [203, 420, 229, 426] # Last joint
|
1536
|
+
TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
|
1537
|
+
|
1538
|
+
xy = box(168, 460, 6) # Handle joint
|
1539
|
+
TkcOval.new(@canvas, xy, :fill=>@C['fg'], :outline=>'', :tag=>'I19a')
|
1540
|
+
xy = [168, 460, 168, 512] # Handle bar
|
1541
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>5, :tag=>'I19b')
|
1542
|
+
end
|
1543
|
+
|
1544
|
+
def move19(step = nil)
|
1545
|
+
step = get_step(19, step)
|
1546
|
+
|
1547
|
+
angles = [30, 30, 30]
|
1548
|
+
return 2 if step == angles.length
|
1549
|
+
ox, oy = centroid('I19a')
|
1550
|
+
rotate_item('I19b', ox, oy, angles[step])
|
1551
|
+
|
1552
|
+
return 1
|
1553
|
+
end
|
1554
|
+
|
1555
|
+
# Water pouring
|
1556
|
+
def draw20
|
1557
|
+
# do nothing
|
1558
|
+
end
|
1559
|
+
|
1560
|
+
def move20(step = nil)
|
1561
|
+
step = get_step(20, step)
|
1562
|
+
|
1563
|
+
pos = [451, 462, 473, 484, 496, 504, 513, 523, 532]
|
1564
|
+
freq = [20, 40, 40, 40, 40, 40, 40, 40, 40]
|
1565
|
+
pos = [
|
1566
|
+
[451, 20], [462, 40], [473, 40], [484, 40], [496, 40],
|
1567
|
+
[504, 40], [513, 40], [523, 40], [532, 40, :x]
|
1568
|
+
]
|
1569
|
+
return 0 if step >= pos.length
|
1570
|
+
|
1571
|
+
@canvas.delete('I20')
|
1572
|
+
where = pos[step]
|
1573
|
+
y, f = where
|
1574
|
+
h20(y, f)
|
1575
|
+
return 3 if where[2] == :x
|
1576
|
+
return 1
|
1577
|
+
end
|
1578
|
+
|
1579
|
+
def h20(y, f)
|
1580
|
+
color = @C['20']
|
1581
|
+
@canvas.delete('I20')
|
1582
|
+
|
1583
|
+
sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'],
|
1584
|
+
:width=>3, :fill=>color, :smooth=>true)
|
1585
|
+
TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3,
|
1586
|
+
:fill=>color, :smooth=>1, :tag=>['I20', 'I20a'])
|
1587
|
+
TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3,
|
1588
|
+
:fill=>color, :smooth=>1, :tag=>['I20', 'I20b'])
|
1589
|
+
@canvas.move('I20a', 8, 0)
|
1590
|
+
@canvas.move('I20b', 16, 0)
|
1591
|
+
end
|
1592
|
+
|
1593
|
+
# Bucket
|
1594
|
+
def draw21
|
1595
|
+
color = @C['21']
|
1596
|
+
xy = [217, 451, 244, 490] # Right handle
|
1597
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21_a')
|
1598
|
+
xy = [201, 467, 182, 490] # Left handle
|
1599
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21_a')
|
1600
|
+
|
1601
|
+
xy = [245, 490, 237, 535] # Right side
|
1602
|
+
xy2 = [189, 535, 181, 490] # Left side
|
1603
|
+
TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'',
|
1604
|
+
:tag=>['I21', 'I21f'])
|
1605
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21')
|
1606
|
+
TkcLine.new(@canvas, xy2, :fill=>@C['fg'], :width=>2, :tag=>'I21')
|
1607
|
+
|
1608
|
+
xy = [182, 486, 244, 498] # Top
|
1609
|
+
TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2,
|
1610
|
+
:tag=>['I21', 'I21f'])
|
1611
|
+
TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2,
|
1612
|
+
:tag=>['I21', 'I21t'])
|
1613
|
+
xy = [189, 532, 237, 540] # Bottom
|
1614
|
+
TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2,
|
1615
|
+
:tag=>['I21', 'I21b'])
|
1616
|
+
end
|
1617
|
+
|
1618
|
+
def move21(step = nil)
|
1619
|
+
step = get_step(21, step)
|
1620
|
+
|
1621
|
+
numsteps = 30
|
1622
|
+
return 0 if step >= numsteps
|
1623
|
+
|
1624
|
+
x1, y1, x2, y2 = @canvas.coords('I21b')
|
1625
|
+
# lx1, ly1, lx2, ly2 = @canvas.coords('I21t')
|
1626
|
+
lx1, ly1, lx2, ly2 = [183, 492, 243, 504]
|
1627
|
+
|
1628
|
+
f = step / numsteps.to_f
|
1629
|
+
y2 = y2 - 3
|
1630
|
+
xx1 = x1 + (lx1 - x1) * f
|
1631
|
+
yy1 = y1 + (ly1 - y1) * f
|
1632
|
+
xx2 = x2 + (lx2 - x2) * f
|
1633
|
+
yy2 = y2 + (ly2 - y2) * f
|
1634
|
+
|
1635
|
+
@canvas.itemconfigure('I21b', :fill=>@C['20'])
|
1636
|
+
@canvas.delete('I21w')
|
1637
|
+
TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1,
|
1638
|
+
:tag=>['I21', 'I21w'], :outline=>'', :fill=>@C['20'])
|
1639
|
+
@canvas.lower('I21w', 'I21')
|
1640
|
+
@canvas.raise('I21b')
|
1641
|
+
@canvas.lower('I21f')
|
1642
|
+
|
1643
|
+
return((step == numsteps - 1)? 3: 1)
|
1644
|
+
end
|
1645
|
+
|
1646
|
+
# Bucket drop
|
1647
|
+
def draw22
|
1648
|
+
# do nothing
|
1649
|
+
end
|
1650
|
+
|
1651
|
+
def move22(step = nil)
|
1652
|
+
step = get_step(22, step)
|
1653
|
+
pos = [[213, 513], [213, 523], [213, 543, :x], [213, 583], [213, 593]]
|
1654
|
+
|
1655
|
+
@canvas.itemconfigure('I21f', :fill=>@C['22']) if step == 0
|
1656
|
+
return 0 if step >= pos.length
|
1657
|
+
where = pos[step]
|
1658
|
+
move_abs('I21', where)
|
1659
|
+
h20(where[1], 40)
|
1660
|
+
@canvas.delete('I21_a') # Delete handles
|
1661
|
+
|
1662
|
+
return 3 if where[2] == :x
|
1663
|
+
return 1
|
1664
|
+
end
|
1665
|
+
|
1666
|
+
# Blow dart
|
1667
|
+
def draw23
|
1668
|
+
color = @C['23a']
|
1669
|
+
color2 = @C['23b']
|
1670
|
+
color3 = @C['23c']
|
1671
|
+
|
1672
|
+
xy = [185, 623, 253, 650] # Block
|
1673
|
+
TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'],
|
1674
|
+
:width=>2, :tag=>'I23a')
|
1675
|
+
xy = [187, 592, 241, 623] # Balloon
|
1676
|
+
TkcOval.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b')
|
1677
|
+
TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b',
|
1678
|
+
:style=>:arc, :start=>12, :extent=>336)
|
1679
|
+
xy = [239, 604, 258, 589, 258, 625, 239, 610] # Balloon nozzle
|
1680
|
+
TkcPolygon.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b')
|
1681
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23b')
|
1682
|
+
|
1683
|
+
xy = [285, 611, 250, 603] # Dart body
|
1684
|
+
TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'],
|
1685
|
+
:width=>3, :tag=>'I23d')
|
1686
|
+
xy = [249, 596, 249, 618, 264, 607, 249, 596] # Dart tail
|
1687
|
+
TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'],
|
1688
|
+
:width=>3, :tag=>'I23d')
|
1689
|
+
xy = [249, 607, 268, 607] # Dart detail
|
1690
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d')
|
1691
|
+
xy = [285, 607, 305, 607] # Dart needle
|
1692
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d')
|
1693
|
+
end
|
1694
|
+
|
1695
|
+
def move23(step = nil)
|
1696
|
+
step = get_step(23, step)
|
1697
|
+
|
1698
|
+
pos = [
|
1699
|
+
[277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607],
|
1700
|
+
[487, 607], [587, 607], [687, 607], [787, 607], [-100, -100]
|
1701
|
+
]
|
1702
|
+
|
1703
|
+
return 0 if step >= pos.length
|
1704
|
+
if step <= 1
|
1705
|
+
ox, oy = anchor('I23a', :n)
|
1706
|
+
@canvas.scale('I23b', ox, oy, 0.9, 0.5)
|
1707
|
+
end
|
1708
|
+
where = pos[step]
|
1709
|
+
move_abs('I23d', where)
|
1710
|
+
|
1711
|
+
return 3 if where[2] == :x
|
1712
|
+
return 1
|
1713
|
+
end
|
1714
|
+
|
1715
|
+
# Balloon
|
1716
|
+
def draw24
|
1717
|
+
color = @C['24a']
|
1718
|
+
xy = [366, 518, 462, 665] # Balloon
|
1719
|
+
TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'],
|
1720
|
+
:width=>3, :tag=>'I24')
|
1721
|
+
xy = [414, 666, 414, 729] # String
|
1722
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I24')
|
1723
|
+
xy = [410, 666, 404, 673, 422, 673, 418, 666] # Nozzle
|
1724
|
+
TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>@C['fg'],
|
1725
|
+
:width=>3, :tag=>'I24')
|
1726
|
+
|
1727
|
+
xy = [387, 567, 390, 549, 404, 542] # Reflections
|
1728
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
|
1729
|
+
:width=>2, :tag=>'I24')
|
1730
|
+
xy = [395, 568, 399, 554, 413, 547]
|
1731
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
|
1732
|
+
:width=>2, :tag=>'I24')
|
1733
|
+
xy = [403, 570, 396, 555, 381, 553]
|
1734
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
|
1735
|
+
:width=>2, :tag=>'I24')
|
1736
|
+
xy = [408, 564, 402, 547, 386, 545]
|
1737
|
+
TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
|
1738
|
+
:width=>2, :tag=>'I24')
|
1739
|
+
end
|
1740
|
+
|
1741
|
+
def move24(step = nil)
|
1742
|
+
step = get_step(24, step)
|
1743
|
+
|
1744
|
+
return 0 if step > 4
|
1745
|
+
return 2 if step == 4
|
1746
|
+
|
1747
|
+
if step == 0
|
1748
|
+
@canvas.delete('I24') # Exploding balloon
|
1749
|
+
xy = [
|
1750
|
+
347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594,
|
1751
|
+
259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738,
|
1752
|
+
436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613,
|
1753
|
+
548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508,
|
1754
|
+
431, 441, 431, 440, 400, 502, 347, 465, 347, 465
|
1755
|
+
]
|
1756
|
+
TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'],
|
1757
|
+
:outline=>@C['24a'], :width=>10, :smooth=>true)
|
1758
|
+
msg = Tk.subst(@S['message'].value)
|
1759
|
+
TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'],
|
1760
|
+
:justify=>:center, :font=>['Times Roman', 18, :bold])
|
1761
|
+
return 1
|
1762
|
+
end
|
1763
|
+
|
1764
|
+
@canvas.itemconfigure('I24t', :font=>['Times Roman', 18 + 6*step, :bold])
|
1765
|
+
@canvas.move('I24', 0, -60)
|
1766
|
+
ox, oy = centroid('I24')
|
1767
|
+
@canvas.scale('I24', ox, oy, 1.25, 1.25)
|
1768
|
+
return 1
|
1769
|
+
end
|
1770
|
+
|
1771
|
+
# Displaying the message
|
1772
|
+
def move25(step = nil)
|
1773
|
+
step = get_step(25, step)
|
1774
|
+
|
1775
|
+
if step == 0
|
1776
|
+
@XY['25'] = Tk::Clock.clicks(:milliseconds)
|
1777
|
+
return 1
|
1778
|
+
end
|
1779
|
+
elapsed = Tk::Clock.clicks(:milliseconds) - @XY['25']
|
1780
|
+
return 1 if elapsed < 5000
|
1781
|
+
return 2
|
1782
|
+
end
|
1783
|
+
|
1784
|
+
# Collapsing balloon
|
1785
|
+
def move26(step = nil)
|
1786
|
+
step = get_step(26, step)
|
1787
|
+
|
1788
|
+
if step >= 3
|
1789
|
+
@canvas.delete('I24', 'I26')
|
1790
|
+
TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26',
|
1791
|
+
:text=>'click to continue',
|
1792
|
+
:font=>['Times Roman', 24, :bold])
|
1793
|
+
@canvas.bind('1', proc{reset})
|
1794
|
+
return 4
|
1795
|
+
end
|
1796
|
+
|
1797
|
+
ox, oy = centroid('I24')
|
1798
|
+
@canvas.scale('I24', ox, oy, 0.8, 0.8)
|
1799
|
+
@canvas.move('I24', 0, 60)
|
1800
|
+
@canvas.itemconfigure('I24t', :font=>['Times Roman', 30 - 6*step, :bold])
|
1801
|
+
return 1
|
1802
|
+
end
|
1803
|
+
|
1804
|
+
################################################################
|
1805
|
+
#
|
1806
|
+
# Helper functions
|
1807
|
+
#
|
1808
|
+
def box(x, y, r)
|
1809
|
+
[x - r, y - r, x + r, y + r]
|
1810
|
+
end
|
1811
|
+
|
1812
|
+
def move_abs(item, xy)
|
1813
|
+
x, y = xy
|
1814
|
+
ox, oy = centroid(item)
|
1815
|
+
dx = x - ox
|
1816
|
+
dy = y - oy
|
1817
|
+
@canvas.move(item, dx, dy)
|
1818
|
+
end
|
1819
|
+
|
1820
|
+
def rotate_item(item, ox, oy, beta)
|
1821
|
+
xy = @canvas.coords(item)
|
1822
|
+
xy2 = []
|
1823
|
+
0.step(xy.length - 1, 2){|idx|
|
1824
|
+
x, y = xy[idx, 2]
|
1825
|
+
xy2.concat(rotate_c(x, y, ox, oy, beta))
|
1826
|
+
}
|
1827
|
+
@canvas.coords(item, xy2)
|
1828
|
+
end
|
1829
|
+
|
1830
|
+
def rotate_c(x, y, ox, oy, beta)
|
1831
|
+
# rotates vector (ox,oy)->(x,y) by beta degrees clockwise
|
1832
|
+
|
1833
|
+
x -= ox # Shift to origin
|
1834
|
+
y -= oy
|
1835
|
+
|
1836
|
+
beta = beta * Math.atan(1) * 4 / 180.0 # Radians
|
1837
|
+
xx = x * Math.cos(beta) - y * Math.sin(beta) # Rotate
|
1838
|
+
yy = x * Math.sin(beta) + y * Math.cos(beta)
|
1839
|
+
|
1840
|
+
xx += ox # Shift back
|
1841
|
+
yy += oy
|
1842
|
+
|
1843
|
+
[xx, yy]
|
1844
|
+
end
|
1845
|
+
|
1846
|
+
def reset
|
1847
|
+
draw_all
|
1848
|
+
@canvas.bind_remove('1')
|
1849
|
+
@S['mode'].value = :MSTART
|
1850
|
+
@S['active'] = [0]
|
1851
|
+
end
|
1852
|
+
|
1853
|
+
# Each Move## keeps its state info in STEP, this retrieves and increments it
|
1854
|
+
def get_step(who, step)
|
1855
|
+
if step
|
1856
|
+
@STEP[who] = step
|
1857
|
+
else
|
1858
|
+
if !@STEP.exist?(who) || @STEP[who] == ""
|
1859
|
+
@STEP[who] = 0
|
1860
|
+
else
|
1861
|
+
@STEP[who] += 1
|
1862
|
+
end
|
1863
|
+
end
|
1864
|
+
@STEP[who]
|
1865
|
+
end
|
1866
|
+
|
1867
|
+
def reset_step
|
1868
|
+
@S['cnt'].value = 0
|
1869
|
+
@STEP.keys.each{|k| @STEP[k] = ''}
|
1870
|
+
end
|
1871
|
+
|
1872
|
+
def sine(xy0, amp, freq, opts = {})
|
1873
|
+
x0, y0, x1, y1 = xy0
|
1874
|
+
step = 2
|
1875
|
+
xy = []
|
1876
|
+
if y0 == y1 # Horizontal
|
1877
|
+
x0.step(x1, step){|x|
|
1878
|
+
beta = (x - x0) * 2 * Math::PI / freq
|
1879
|
+
y = y0 + amp * Math.sin(beta)
|
1880
|
+
xy << x << y
|
1881
|
+
}
|
1882
|
+
else
|
1883
|
+
y0.step(y1, step){|y|
|
1884
|
+
beta = (y - y0) * 2 * Math::PI / freq
|
1885
|
+
x = x0 + amp * Math.sin(beta)
|
1886
|
+
xy << x << y
|
1887
|
+
}
|
1888
|
+
end
|
1889
|
+
TkcLine.new(@canvas, xy, opts)
|
1890
|
+
end
|
1891
|
+
|
1892
|
+
def round_rect(xy, radius, opts={})
|
1893
|
+
x0, y0, x3, y3 = xy
|
1894
|
+
r = @canvas.winfo_pixels(radius)
|
1895
|
+
d = 2 * r
|
1896
|
+
|
1897
|
+
# Make sure that the radius of the curve is less than 3/8 size of the box!
|
1898
|
+
maxr = 0.75
|
1899
|
+
if d > maxr * (x3 - x0)
|
1900
|
+
d = maxr * (x3 - x0)
|
1901
|
+
end
|
1902
|
+
if d > maxr * (y3 - y0)
|
1903
|
+
d = maxr * (y3 - y0)
|
1904
|
+
end
|
1905
|
+
|
1906
|
+
x1 = x0 + d
|
1907
|
+
x2 = x3 - d
|
1908
|
+
y1 = y0 + d
|
1909
|
+
y2 = y3 - d
|
1910
|
+
|
1911
|
+
xy = [x0, y0, x1, y0, x2, y0, x3, y0, x3, y1, x3, y2]
|
1912
|
+
xy.concat([x3, y3, x2, y3, x1, y3, x0, y3, x0, y2, x0, y1])
|
1913
|
+
return xy
|
1914
|
+
end
|
1915
|
+
|
1916
|
+
def round_poly(canv, xy, radii, opts)
|
1917
|
+
lenXY = xy.length
|
1918
|
+
lenR = radii.length
|
1919
|
+
if lenXY != 2*lenR
|
1920
|
+
raise "wrong number of vertices and radii"
|
1921
|
+
end
|
1922
|
+
|
1923
|
+
knots = []
|
1924
|
+
x0 = xy[-2]; y0 = xy[-1]
|
1925
|
+
x1 = xy[0]; y1 = xy[1]
|
1926
|
+
xy << xy[0] << xy[1]
|
1927
|
+
|
1928
|
+
0.step(lenXY - 1, 2){|i|
|
1929
|
+
radius = radii[i/2]
|
1930
|
+
r = canv.winfo_pixels(radius)
|
1931
|
+
|
1932
|
+
x2 = xy[i+2]; y2 = xy[i+3]
|
1933
|
+
z = _round_poly2(x0, y0, x1, y1, x2, y2, r)
|
1934
|
+
knots.concat(z)
|
1935
|
+
|
1936
|
+
x0 = x1; y0 = y1
|
1937
|
+
x1 = x2; y1 = y2
|
1938
|
+
}
|
1939
|
+
TkcPolygon.new(canv, knots, {:smooth=>true}.update(opts))
|
1940
|
+
end
|
1941
|
+
|
1942
|
+
def _round_poly2(x0, y0, x1, y1, x2, y2, radius)
|
1943
|
+
d = 2 * radius
|
1944
|
+
maxr = 0.75
|
1945
|
+
|
1946
|
+
v1x = x0 - x1
|
1947
|
+
v1y = y0 - y1
|
1948
|
+
v2x = x2 - x1
|
1949
|
+
v2y = y2 - y1
|
1950
|
+
|
1951
|
+
vlen1 = Math.sqrt(v1x*v1x + v1y*v1y)
|
1952
|
+
vlen2 = Math.sqrt(v2x*v2x + v2y*v2y)
|
1953
|
+
|
1954
|
+
if d > maxr * vlen1
|
1955
|
+
d = maxr * vlen1
|
1956
|
+
end
|
1957
|
+
if d > maxr * vlen2
|
1958
|
+
d = maxr * vlen2
|
1959
|
+
end
|
1960
|
+
|
1961
|
+
xy = []
|
1962
|
+
xy << (x1 + d * v1x / vlen1) << (y1 + d * v1y / vlen1)
|
1963
|
+
xy << x1 << y1
|
1964
|
+
xy << (x1 + d * v2x / vlen2) << (y1 + d * v2y / vlen2)
|
1965
|
+
|
1966
|
+
return xy
|
1967
|
+
end
|
1968
|
+
|
1969
|
+
def sparkle(oxy, tag)
|
1970
|
+
xy = [
|
1971
|
+
[299, 283], [298, 302], [295, 314], [271, 331],
|
1972
|
+
[239, 310], [242, 292], [256, 274], [281, 273]
|
1973
|
+
]
|
1974
|
+
xy.each{|x, y|
|
1975
|
+
TkcLine.new(@canvas, 271, 304, x, y,
|
1976
|
+
:fill=>'white', :width=>3, :tag=>tag)
|
1977
|
+
}
|
1978
|
+
move_abs(tag, oxy)
|
1979
|
+
end
|
1980
|
+
|
1981
|
+
def centroid(item)
|
1982
|
+
anchor(item, :c)
|
1983
|
+
end
|
1984
|
+
|
1985
|
+
def anchor(item, where)
|
1986
|
+
x1, y1, x2, y2 = @canvas.bbox(item)
|
1987
|
+
case(where)
|
1988
|
+
when :n
|
1989
|
+
y = y1
|
1990
|
+
when :s
|
1991
|
+
y = y2
|
1992
|
+
else
|
1993
|
+
y = (y1 + y2) / 2.0
|
1994
|
+
end
|
1995
|
+
case(where)
|
1996
|
+
when :w
|
1997
|
+
x = x1
|
1998
|
+
when :e
|
1999
|
+
x = x2
|
2000
|
+
else
|
2001
|
+
x = (x1 + x2) / 2.0
|
2002
|
+
end
|
2003
|
+
return [x, y]
|
2004
|
+
end
|
2005
|
+
end
|
2006
|
+
|
2007
|
+
TkGoldberg_Demo.new(base_frame)
|