tk_as_gem 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +22 -0
- data/Rakefile +11 -0
- data/VERSION +1 -0
- data/ext/ChangeLog.tkextlib +935 -0
- data/ext/MANUAL_tcltklib.eng +469 -0
- data/ext/MANUAL_tcltklib.eucj +579 -0
- data/ext/README.1st +19 -0
- data/ext/README.ActiveTcl +49 -0
- data/ext/README.fork +34 -0
- data/ext/README.macosx-aqua +67 -0
- data/ext/README.tcltklib +85 -0
- data/ext/depend +2 -0
- data/ext/extconf.rb +451 -0
- data/ext/lib/README +30 -0
- data/ext/lib/multi-tk.rb +3491 -0
- data/ext/lib/remote-tk.rb +530 -0
- data/ext/lib/tcltk.rb +367 -0
- data/ext/lib/tk.rb +5584 -0
- data/ext/lib/tk/after.rb +6 -0
- data/ext/lib/tk/autoload.rb +414 -0
- data/ext/lib/tk/bgerror.rb +29 -0
- data/ext/lib/tk/bindtag.rb +138 -0
- data/ext/lib/tk/button.rb +30 -0
- data/ext/lib/tk/canvas.rb +789 -0
- data/ext/lib/tk/canvastag.rb +434 -0
- data/ext/lib/tk/checkbutton.rb +30 -0
- data/ext/lib/tk/clipboard.rb +75 -0
- data/ext/lib/tk/clock.rb +71 -0
- data/ext/lib/tk/composite.rb +458 -0
- data/ext/lib/tk/console.rb +52 -0
- data/ext/lib/tk/dialog.rb +326 -0
- data/ext/lib/tk/encodedstr.rb +187 -0
- data/ext/lib/tk/entry.rb +119 -0
- data/ext/lib/tk/event.rb +542 -0
- data/ext/lib/tk/font.rb +2344 -0
- data/ext/lib/tk/frame.rb +131 -0
- data/ext/lib/tk/grid.rb +279 -0
- data/ext/lib/tk/image.rb +275 -0
- data/ext/lib/tk/itemconfig.rb +1215 -0
- data/ext/lib/tk/itemfont.rb +327 -0
- data/ext/lib/tk/kinput.rb +71 -0
- data/ext/lib/tk/label.rb +21 -0
- data/ext/lib/tk/labelframe.rb +29 -0
- data/ext/lib/tk/listbox.rb +282 -0
- data/ext/lib/tk/macpkg.rb +78 -0
- data/ext/lib/tk/menu.rb +681 -0
- data/ext/lib/tk/menubar.rb +131 -0
- data/ext/lib/tk/menuspec.rb +275 -0
- data/ext/lib/tk/message.rb +22 -0
- data/ext/lib/tk/mngfocus.rb +33 -0
- data/ext/lib/tk/msgcat.rb +296 -0
- data/ext/lib/tk/namespace.rb +551 -0
- data/ext/lib/tk/optiondb.rb +377 -0
- data/ext/lib/tk/optionobj.rb +212 -0
- data/ext/lib/tk/pack.rb +107 -0
- data/ext/lib/tk/package.rb +143 -0
- data/ext/lib/tk/palette.rb +55 -0
- data/ext/lib/tk/panedwindow.rb +258 -0
- data/ext/lib/tk/place.rb +128 -0
- data/ext/lib/tk/radiobutton.rb +71 -0
- data/ext/lib/tk/root.rb +95 -0
- data/ext/lib/tk/scale.rb +111 -0
- data/ext/lib/tk/scrollable.rb +82 -0
- data/ext/lib/tk/scrollbar.rb +177 -0
- data/ext/lib/tk/scrollbox.rb +39 -0
- data/ext/lib/tk/selection.rb +86 -0
- data/ext/lib/tk/spinbox.rb +119 -0
- data/ext/lib/tk/tagfont.rb +43 -0
- data/ext/lib/tk/text.rb +1596 -0
- data/ext/lib/tk/textimage.rb +88 -0
- data/ext/lib/tk/textmark.rb +204 -0
- data/ext/lib/tk/texttag.rb +318 -0
- data/ext/lib/tk/textwindow.rb +154 -0
- data/ext/lib/tk/timer.rb +669 -0
- data/ext/lib/tk/toplevel.rb +262 -0
- data/ext/lib/tk/ttk_selector.rb +76 -0
- data/ext/lib/tk/txtwin_abst.rb +39 -0
- data/ext/lib/tk/validation.rb +397 -0
- data/ext/lib/tk/variable.rb +1765 -0
- data/ext/lib/tk/virtevent.rb +139 -0
- data/ext/lib/tk/winfo.rb +392 -0
- data/ext/lib/tk/winpkg.rb +153 -0
- data/ext/lib/tk/wm.rb +552 -0
- data/ext/lib/tk/xim.rb +122 -0
- data/ext/lib/tkafter.rb +4 -0
- data/ext/lib/tkbgerror.rb +4 -0
- data/ext/lib/tkcanvas.rb +4 -0
- data/ext/lib/tkclass.rb +47 -0
- data/ext/lib/tkconsole.rb +4 -0
- data/ext/lib/tkdialog.rb +4 -0
- data/ext/lib/tkentry.rb +4 -0
- data/ext/lib/tkextlib/ICONS.rb +13 -0
- data/ext/lib/tkextlib/ICONS/icons.rb +129 -0
- data/ext/lib/tkextlib/ICONS/setup.rb +8 -0
- data/ext/lib/tkextlib/SUPPORT_STATUS +196 -0
- data/ext/lib/tkextlib/blt.rb +187 -0
- data/ext/lib/tkextlib/blt/barchart.rb +79 -0
- data/ext/lib/tkextlib/blt/bitmap.rb +112 -0
- data/ext/lib/tkextlib/blt/busy.rb +82 -0
- data/ext/lib/tkextlib/blt/component.rb +2145 -0
- data/ext/lib/tkextlib/blt/container.rb +28 -0
- data/ext/lib/tkextlib/blt/cutbuffer.rb +23 -0
- data/ext/lib/tkextlib/blt/dragdrop.rb +268 -0
- data/ext/lib/tkextlib/blt/eps.rb +32 -0
- data/ext/lib/tkextlib/blt/graph.rb +67 -0
- data/ext/lib/tkextlib/blt/htext.rb +111 -0
- data/ext/lib/tkextlib/blt/setup.rb +8 -0
- data/ext/lib/tkextlib/blt/spline.rb +23 -0
- data/ext/lib/tkextlib/blt/stripchart.rb +74 -0
- data/ext/lib/tkextlib/blt/table.rb +399 -0
- data/ext/lib/tkextlib/blt/tabnotebook.rb +110 -0
- data/ext/lib/tkextlib/blt/tabset.rb +500 -0
- data/ext/lib/tkextlib/blt/ted.rb +65 -0
- data/ext/lib/tkextlib/blt/tile.rb +21 -0
- data/ext/lib/tkextlib/blt/tile/button.rb +16 -0
- data/ext/lib/tkextlib/blt/tile/checkbutton.rb +17 -0
- data/ext/lib/tkextlib/blt/tile/frame.rb +16 -0
- data/ext/lib/tkextlib/blt/tile/label.rb +16 -0
- data/ext/lib/tkextlib/blt/tile/radiobutton.rb +17 -0
- data/ext/lib/tkextlib/blt/tile/scrollbar.rb +16 -0
- data/ext/lib/tkextlib/blt/tile/toplevel.rb +16 -0
- data/ext/lib/tkextlib/blt/tree.rb +1058 -0
- data/ext/lib/tkextlib/blt/treeview.rb +1272 -0
- data/ext/lib/tkextlib/blt/unix_dnd.rb +135 -0
- data/ext/lib/tkextlib/blt/vector.rb +256 -0
- data/ext/lib/tkextlib/blt/watch.rb +175 -0
- data/ext/lib/tkextlib/blt/win_printer.rb +61 -0
- data/ext/lib/tkextlib/blt/winop.rb +107 -0
- data/ext/lib/tkextlib/bwidget.rb +151 -0
- data/ext/lib/tkextlib/bwidget/arrowbutton.rb +21 -0
- data/ext/lib/tkextlib/bwidget/bitmap.rb +21 -0
- data/ext/lib/tkextlib/bwidget/button.rb +31 -0
- data/ext/lib/tkextlib/bwidget/buttonbox.rb +90 -0
- data/ext/lib/tkextlib/bwidget/combobox.rb +51 -0
- data/ext/lib/tkextlib/bwidget/dialog.rb +182 -0
- data/ext/lib/tkextlib/bwidget/dragsite.rb +31 -0
- data/ext/lib/tkextlib/bwidget/dropsite.rb +39 -0
- data/ext/lib/tkextlib/bwidget/dynamichelp.rb +63 -0
- data/ext/lib/tkextlib/bwidget/entry.rb +43 -0
- data/ext/lib/tkextlib/bwidget/label.rb +41 -0
- data/ext/lib/tkextlib/bwidget/labelentry.rb +80 -0
- data/ext/lib/tkextlib/bwidget/labelframe.rb +52 -0
- data/ext/lib/tkextlib/bwidget/listbox.rb +358 -0
- data/ext/lib/tkextlib/bwidget/mainframe.rb +128 -0
- data/ext/lib/tkextlib/bwidget/messagedlg.rb +192 -0
- data/ext/lib/tkextlib/bwidget/notebook.rb +166 -0
- data/ext/lib/tkextlib/bwidget/pagesmanager.rb +73 -0
- data/ext/lib/tkextlib/bwidget/panedwindow.rb +37 -0
- data/ext/lib/tkextlib/bwidget/panelframe.rb +57 -0
- data/ext/lib/tkextlib/bwidget/passwddlg.rb +44 -0
- data/ext/lib/tkextlib/bwidget/progressbar.rb +20 -0
- data/ext/lib/tkextlib/bwidget/progressdlg.rb +58 -0
- data/ext/lib/tkextlib/bwidget/scrollableframe.rb +40 -0
- data/ext/lib/tkextlib/bwidget/scrolledwindow.rb +38 -0
- data/ext/lib/tkextlib/bwidget/scrollview.rb +25 -0
- data/ext/lib/tkextlib/bwidget/selectcolor.rb +73 -0
- data/ext/lib/tkextlib/bwidget/selectfont.rb +86 -0
- data/ext/lib/tkextlib/bwidget/separator.rb +20 -0
- data/ext/lib/tkextlib/bwidget/setup.rb +8 -0
- data/ext/lib/tkextlib/bwidget/spinbox.rb +98 -0
- data/ext/lib/tkextlib/bwidget/statusbar.rb +52 -0
- data/ext/lib/tkextlib/bwidget/titleframe.rb +33 -0
- data/ext/lib/tkextlib/bwidget/tree.rb +453 -0
- data/ext/lib/tkextlib/bwidget/widget.rb +129 -0
- data/ext/lib/tkextlib/itcl.rb +13 -0
- data/ext/lib/tkextlib/itcl/incr_tcl.rb +178 -0
- data/ext/lib/tkextlib/itcl/setup.rb +13 -0
- data/ext/lib/tkextlib/itk.rb +13 -0
- data/ext/lib/tkextlib/itk/incr_tk.rb +446 -0
- data/ext/lib/tkextlib/itk/setup.rb +13 -0
- data/ext/lib/tkextlib/iwidgets.rb +94 -0
- data/ext/lib/tkextlib/iwidgets/buttonbox.rb +120 -0
- data/ext/lib/tkextlib/iwidgets/calendar.rb +125 -0
- data/ext/lib/tkextlib/iwidgets/canvasprintbox.rb +53 -0
- data/ext/lib/tkextlib/iwidgets/canvasprintdialog.rb +38 -0
- data/ext/lib/tkextlib/iwidgets/checkbox.rb +129 -0
- data/ext/lib/tkextlib/iwidgets/combobox.rb +104 -0
- data/ext/lib/tkextlib/iwidgets/dateentry.rb +20 -0
- data/ext/lib/tkextlib/iwidgets/datefield.rb +58 -0
- data/ext/lib/tkextlib/iwidgets/dialog.rb +20 -0
- data/ext/lib/tkextlib/iwidgets/dialogshell.rb +120 -0
- data/ext/lib/tkextlib/iwidgets/disjointlistbox.rb +50 -0
- data/ext/lib/tkextlib/iwidgets/entryfield.rb +185 -0
- data/ext/lib/tkextlib/iwidgets/extbutton.rb +40 -0
- data/ext/lib/tkextlib/iwidgets/extfileselectionbox.rb +46 -0
- data/ext/lib/tkextlib/iwidgets/extfileselectiondialog.rb +33 -0
- data/ext/lib/tkextlib/iwidgets/feedback.rb +35 -0
- data/ext/lib/tkextlib/iwidgets/fileselectionbox.rb +46 -0
- data/ext/lib/tkextlib/iwidgets/fileselectiondialog.rb +33 -0
- data/ext/lib/tkextlib/iwidgets/finddialog.rb +42 -0
- data/ext/lib/tkextlib/iwidgets/hierarchy.rb +365 -0
- data/ext/lib/tkextlib/iwidgets/hyperhelp.rb +50 -0
- data/ext/lib/tkextlib/iwidgets/labeledframe.rb +39 -0
- data/ext/lib/tkextlib/iwidgets/labeledwidget.rb +45 -0
- data/ext/lib/tkextlib/iwidgets/mainwindow.rb +67 -0
- data/ext/lib/tkextlib/iwidgets/menubar.rb +211 -0
- data/ext/lib/tkextlib/iwidgets/messagebox.rb +92 -0
- data/ext/lib/tkextlib/iwidgets/messagedialog.rb +20 -0
- data/ext/lib/tkextlib/iwidgets/notebook.rb +174 -0
- data/ext/lib/tkextlib/iwidgets/optionmenu.rb +92 -0
- data/ext/lib/tkextlib/iwidgets/panedwindow.rb +133 -0
- data/ext/lib/tkextlib/iwidgets/promptdialog.rb +131 -0
- data/ext/lib/tkextlib/iwidgets/pushbutton.rb +35 -0
- data/ext/lib/tkextlib/iwidgets/radiobox.rb +120 -0
- data/ext/lib/tkextlib/iwidgets/scopedobject.rb +24 -0
- data/ext/lib/tkextlib/iwidgets/scrolledcanvas.rb +353 -0
- data/ext/lib/tkextlib/iwidgets/scrolledframe.rb +59 -0
- data/ext/lib/tkextlib/iwidgets/scrolledhtml.rb +58 -0
- data/ext/lib/tkextlib/iwidgets/scrolledlistbox.rb +207 -0
- data/ext/lib/tkextlib/iwidgets/scrolledtext.rb +564 -0
- data/ext/lib/tkextlib/iwidgets/scrolledwidget.rb +20 -0
- data/ext/lib/tkextlib/iwidgets/selectionbox.rb +102 -0
- data/ext/lib/tkextlib/iwidgets/selectiondialog.rb +92 -0
- data/ext/lib/tkextlib/iwidgets/setup.rb +8 -0
- data/ext/lib/tkextlib/iwidgets/shell.rb +38 -0
- data/ext/lib/tkextlib/iwidgets/spindate.rb +48 -0
- data/ext/lib/tkextlib/iwidgets/spinint.rb +30 -0
- data/ext/lib/tkextlib/iwidgets/spinner.rb +169 -0
- data/ext/lib/tkextlib/iwidgets/spintime.rb +48 -0
- data/ext/lib/tkextlib/iwidgets/tabnotebook.rb +180 -0
- data/ext/lib/tkextlib/iwidgets/tabset.rb +144 -0
- data/ext/lib/tkextlib/iwidgets/timeentry.rb +25 -0
- data/ext/lib/tkextlib/iwidgets/timefield.rb +58 -0
- data/ext/lib/tkextlib/iwidgets/toolbar.rb +112 -0
- data/ext/lib/tkextlib/iwidgets/watch.rb +56 -0
- data/ext/lib/tkextlib/pkg_checker.rb +184 -0
- data/ext/lib/tkextlib/setup.rb +8 -0
- data/ext/lib/tkextlib/tcllib.rb +90 -0
- data/ext/lib/tkextlib/tcllib/README +135 -0
- data/ext/lib/tkextlib/tcllib/autoscroll.rb +158 -0
- data/ext/lib/tkextlib/tcllib/ctext.rb +160 -0
- data/ext/lib/tkextlib/tcllib/cursor.rb +97 -0
- data/ext/lib/tkextlib/tcllib/datefield.rb +57 -0
- data/ext/lib/tkextlib/tcllib/dialog.rb +84 -0
- data/ext/lib/tkextlib/tcllib/getstring.rb +134 -0
- data/ext/lib/tkextlib/tcllib/history.rb +73 -0
- data/ext/lib/tkextlib/tcllib/ico.rb +116 -0
- data/ext/lib/tkextlib/tcllib/ip_entry.rb +66 -0
- data/ext/lib/tkextlib/tcllib/panelframe.rb +72 -0
- data/ext/lib/tkextlib/tcllib/plotchart.rb +886 -0
- data/ext/lib/tkextlib/tcllib/ruler.rb +65 -0
- data/ext/lib/tkextlib/tcllib/screenruler.rb +68 -0
- data/ext/lib/tkextlib/tcllib/scrollwin.rb +61 -0
- data/ext/lib/tkextlib/tcllib/setup.rb +8 -0
- data/ext/lib/tkextlib/tcllib/style.rb +61 -0
- data/ext/lib/tkextlib/tcllib/superframe.rb +51 -0
- data/ext/lib/tkextlib/tcllib/swaplist.rb +150 -0
- data/ext/lib/tkextlib/tcllib/tablelist.rb +27 -0
- data/ext/lib/tkextlib/tcllib/tablelist_core.rb +782 -0
- data/ext/lib/tkextlib/tcllib/tablelist_tile.rb +25 -0
- data/ext/lib/tkextlib/tcllib/tkpiechart.rb +314 -0
- data/ext/lib/tkextlib/tcllib/tooltip.rb +95 -0
- data/ext/lib/tkextlib/tcllib/widget.rb +48 -0
- data/ext/lib/tkextlib/tclx.rb +13 -0
- data/ext/lib/tkextlib/tclx/setup.rb +8 -0
- data/ext/lib/tkextlib/tclx/tclx.rb +74 -0
- data/ext/lib/tkextlib/tile.rb +419 -0
- data/ext/lib/tkextlib/tile/dialog.rb +96 -0
- data/ext/lib/tkextlib/tile/setup.rb +8 -0
- data/ext/lib/tkextlib/tile/sizegrip.rb +29 -0
- data/ext/lib/tkextlib/tile/style.rb +316 -0
- data/ext/lib/tkextlib/tile/tbutton.rb +33 -0
- data/ext/lib/tkextlib/tile/tcheckbutton.rb +36 -0
- data/ext/lib/tkextlib/tile/tcombobox.rb +54 -0
- data/ext/lib/tkextlib/tile/tentry.rb +48 -0
- data/ext/lib/tkextlib/tile/tframe.rb +33 -0
- data/ext/lib/tkextlib/tile/tlabel.rb +33 -0
- data/ext/lib/tkextlib/tile/tlabelframe.rb +36 -0
- data/ext/lib/tkextlib/tile/tmenubutton.rb +36 -0
- data/ext/lib/tkextlib/tile/tnotebook.rb +139 -0
- data/ext/lib/tkextlib/tile/tpaned.rb +231 -0
- data/ext/lib/tkextlib/tile/tprogressbar.rb +56 -0
- data/ext/lib/tkextlib/tile/tradiobutton.rb +36 -0
- data/ext/lib/tkextlib/tile/treeview.rb +1239 -0
- data/ext/lib/tkextlib/tile/tscale.rb +53 -0
- data/ext/lib/tkextlib/tile/tscrollbar.rb +54 -0
- data/ext/lib/tkextlib/tile/tseparator.rb +33 -0
- data/ext/lib/tkextlib/tile/tsquare.rb +30 -0
- data/ext/lib/tkextlib/tkDND.rb +18 -0
- data/ext/lib/tkextlib/tkDND/setup.rb +8 -0
- data/ext/lib/tkextlib/tkDND/shape.rb +125 -0
- data/ext/lib/tkextlib/tkDND/tkdnd.rb +182 -0
- data/ext/lib/tkextlib/tkHTML.rb +13 -0
- data/ext/lib/tkextlib/tkHTML/htmlwidget.rb +453 -0
- data/ext/lib/tkextlib/tkHTML/setup.rb +8 -0
- data/ext/lib/tkextlib/tkimg.rb +36 -0
- data/ext/lib/tkextlib/tkimg/README +26 -0
- data/ext/lib/tkextlib/tkimg/bmp.rb +33 -0
- data/ext/lib/tkextlib/tkimg/gif.rb +33 -0
- data/ext/lib/tkextlib/tkimg/ico.rb +33 -0
- data/ext/lib/tkextlib/tkimg/jpeg.rb +33 -0
- data/ext/lib/tkextlib/tkimg/pcx.rb +33 -0
- data/ext/lib/tkextlib/tkimg/pixmap.rb +44 -0
- data/ext/lib/tkextlib/tkimg/png.rb +33 -0
- data/ext/lib/tkextlib/tkimg/ppm.rb +33 -0
- data/ext/lib/tkextlib/tkimg/ps.rb +33 -0
- data/ext/lib/tkextlib/tkimg/setup.rb +8 -0
- data/ext/lib/tkextlib/tkimg/sgi.rb +33 -0
- data/ext/lib/tkextlib/tkimg/sun.rb +33 -0
- data/ext/lib/tkextlib/tkimg/tga.rb +33 -0
- data/ext/lib/tkextlib/tkimg/tiff.rb +33 -0
- data/ext/lib/tkextlib/tkimg/window.rb +33 -0
- data/ext/lib/tkextlib/tkimg/xbm.rb +33 -0
- data/ext/lib/tkextlib/tkimg/xpm.rb +33 -0
- data/ext/lib/tkextlib/tktable.rb +14 -0
- data/ext/lib/tkextlib/tktable/setup.rb +8 -0
- data/ext/lib/tkextlib/tktable/tktable.rb +957 -0
- data/ext/lib/tkextlib/tktrans.rb +14 -0
- data/ext/lib/tkextlib/tktrans/setup.rb +8 -0
- data/ext/lib/tkextlib/tktrans/tktrans.rb +64 -0
- data/ext/lib/tkextlib/treectrl.rb +13 -0
- data/ext/lib/tkextlib/treectrl/setup.rb +8 -0
- data/ext/lib/tkextlib/treectrl/tktreectrl.rb +2461 -0
- data/ext/lib/tkextlib/trofs.rb +13 -0
- data/ext/lib/tkextlib/trofs/setup.rb +8 -0
- data/ext/lib/tkextlib/trofs/trofs.rb +51 -0
- data/ext/lib/tkextlib/version.rb +6 -0
- data/ext/lib/tkextlib/vu.rb +48 -0
- data/ext/lib/tkextlib/vu/bargraph.rb +61 -0
- data/ext/lib/tkextlib/vu/charts.rb +53 -0
- data/ext/lib/tkextlib/vu/dial.rb +102 -0
- data/ext/lib/tkextlib/vu/pie.rb +282 -0
- data/ext/lib/tkextlib/vu/setup.rb +8 -0
- data/ext/lib/tkextlib/vu/spinbox.rb +22 -0
- data/ext/lib/tkextlib/winico.rb +14 -0
- data/ext/lib/tkextlib/winico/setup.rb +8 -0
- data/ext/lib/tkextlib/winico/winico.rb +224 -0
- data/ext/lib/tkfont.rb +4 -0
- data/ext/lib/tkmacpkg.rb +4 -0
- data/ext/lib/tkmenubar.rb +4 -0
- data/ext/lib/tkmngfocus.rb +4 -0
- data/ext/lib/tkpalette.rb +4 -0
- data/ext/lib/tkscrollbox.rb +4 -0
- data/ext/lib/tktext.rb +4 -0
- data/ext/lib/tkvirtevent.rb +4 -0
- data/ext/lib/tkwinpkg.rb +4 -0
- data/ext/old-README.tcltklib.eucj +159 -0
- data/ext/stubs.c +531 -0
- data/ext/stubs.h +33 -0
- data/ext/tcltklib.c +10155 -0
- data/ext/tkutil/.cvsignore +3 -0
- data/ext/tkutil/depend +1 -0
- data/ext/tkutil/extconf.rb +14 -0
- data/ext/tkutil/tkutil.c +1789 -0
- metadata +418 -0
@@ -0,0 +1,2145 @@
|
|
1
|
+
#
|
2
|
+
# tkextlib/blt/component.rb
|
3
|
+
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
4
|
+
#
|
5
|
+
|
6
|
+
require 'tk'
|
7
|
+
require 'tkextlib/blt.rb'
|
8
|
+
|
9
|
+
module Tk::BLT
|
10
|
+
module PlotComponent
|
11
|
+
include TkItemConfigMethod
|
12
|
+
|
13
|
+
module OptKeys
|
14
|
+
def __item_font_optkeys(id)
|
15
|
+
['font', 'tickfont', 'titlefont']
|
16
|
+
end
|
17
|
+
private :__item_font_optkeys
|
18
|
+
|
19
|
+
def __item_numstrval_optkeys(id)
|
20
|
+
['xoffset', 'yoffset']
|
21
|
+
end
|
22
|
+
private :__item_numstrval_optkeys
|
23
|
+
|
24
|
+
def __item_boolval_optkeys(id)
|
25
|
+
['hide', 'under', 'descending', 'logscale', 'loose', 'showticks',
|
26
|
+
'titlealternate', 'scalesymbols', 'minor', 'raised',
|
27
|
+
'center', 'decoration', 'landscape', 'maxpect']
|
28
|
+
end
|
29
|
+
private :__item_boolval_optkeys
|
30
|
+
|
31
|
+
def __item_strval_optkeys(id)
|
32
|
+
['text', 'label', 'limits', 'title',
|
33
|
+
'show', 'file', 'maskdata', 'maskfile',
|
34
|
+
'color', 'titlecolor', 'fill', 'outline', 'offdash']
|
35
|
+
end
|
36
|
+
private :__item_strval_optkeys
|
37
|
+
|
38
|
+
def __item_listval_optkeys(id)
|
39
|
+
['bindtags']
|
40
|
+
end
|
41
|
+
private :__item_listval_optkeys
|
42
|
+
|
43
|
+
def __item_numlistval_optkeys(id)
|
44
|
+
['dashes', 'majorticks', 'minorticks']
|
45
|
+
end
|
46
|
+
private :__item_numlistval_optkeys
|
47
|
+
|
48
|
+
def __item_tkvariable_optkeys(id)
|
49
|
+
['variable', 'textvariable', 'colormap', 'fontmap']
|
50
|
+
end
|
51
|
+
private :__item_tkvariable_optkeys
|
52
|
+
end
|
53
|
+
|
54
|
+
include OptKeys
|
55
|
+
|
56
|
+
def __item_cget_cmd(id)
|
57
|
+
if id.kind_of?(Array)
|
58
|
+
# id := [ type, name ]
|
59
|
+
[self.path, id[0], 'cget', id[1]]
|
60
|
+
else
|
61
|
+
[self.path, id, 'cget']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
private :__item_cget_cmd
|
65
|
+
|
66
|
+
def __item_config_cmd(id)
|
67
|
+
if id.kind_of?(Array)
|
68
|
+
# id := [ type, name, ... ]
|
69
|
+
type, *names = id
|
70
|
+
[self.path, type, 'configure'].concat(names)
|
71
|
+
else
|
72
|
+
[self.path, id, 'configure']
|
73
|
+
end
|
74
|
+
end
|
75
|
+
private :__item_config_cmd
|
76
|
+
|
77
|
+
def __item_pathname(id)
|
78
|
+
if id.kind_of?(Array)
|
79
|
+
id = tagid(id[1])
|
80
|
+
end
|
81
|
+
[self.path, id].join(';')
|
82
|
+
end
|
83
|
+
private :__item_pathname
|
84
|
+
|
85
|
+
def axis_cget(id, option)
|
86
|
+
ret = itemcget(['axis', tagid(id)], option)
|
87
|
+
end
|
88
|
+
def axis_cget_strict(id, option)
|
89
|
+
ret = itemcget_strict(['axis', tagid(id)], option)
|
90
|
+
end
|
91
|
+
def axis_configure(*args)
|
92
|
+
slot = args.pop
|
93
|
+
if slot.kind_of?(Hash)
|
94
|
+
value = None
|
95
|
+
slot = _symbolkey2str(slot)
|
96
|
+
if cmd = slot.delete('command')
|
97
|
+
slot['command'] = proc{|w, tick|
|
98
|
+
cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
|
99
|
+
}
|
100
|
+
end
|
101
|
+
else
|
102
|
+
value = slot
|
103
|
+
slot = args.pop
|
104
|
+
if slot == :command || slot == 'command'
|
105
|
+
cmd = value
|
106
|
+
value = proc{|w, tick|
|
107
|
+
cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
|
108
|
+
}
|
109
|
+
end
|
110
|
+
end
|
111
|
+
id_list = args.flatten.collect!{|id| tagid(id)}.unshift('axis')
|
112
|
+
itemconfigure(id_list, slot, value)
|
113
|
+
end
|
114
|
+
def axis_configinfo(id, slot=nil)
|
115
|
+
itemconfiginfo(['axis', tagid(id)], slot)
|
116
|
+
end
|
117
|
+
def current_axis_configinfo(id, slot=nil)
|
118
|
+
current_itemconfiginfo(['axis', tagid(id)], slot)
|
119
|
+
end
|
120
|
+
|
121
|
+
def crosshairs_cget(option)
|
122
|
+
itemcget('crosshairs', option)
|
123
|
+
end
|
124
|
+
def crosshairs_cget_strict(option)
|
125
|
+
itemcget_strict('crosshairs', option)
|
126
|
+
end
|
127
|
+
def crosshairs_configure(slot, value=None)
|
128
|
+
itemconfigure('crosshairs', slot, value)
|
129
|
+
end
|
130
|
+
def crosshairs_configinfo(slot=nil)
|
131
|
+
itemconfiginfo('crosshairs', slot)
|
132
|
+
end
|
133
|
+
def current_crosshairs_configinfo(slot=nil)
|
134
|
+
current_itemconfiginfo('crosshairs', slot)
|
135
|
+
end
|
136
|
+
|
137
|
+
def element_cget(id, option)
|
138
|
+
itemcget(['element', tagid(id)], option)
|
139
|
+
end
|
140
|
+
def element_cget_strict(id, option)
|
141
|
+
itemcget_strict(['element', tagid(id)], option)
|
142
|
+
end
|
143
|
+
def element_configure(*args)
|
144
|
+
slot = args.pop
|
145
|
+
if slot.kind_of?(Hash)
|
146
|
+
value = None
|
147
|
+
else
|
148
|
+
value = slot
|
149
|
+
slot = args.pop
|
150
|
+
end
|
151
|
+
id_list = args.flatten.collect!{|id| tagid(id)}.unshift('element')
|
152
|
+
itemconfigure(id_list, slot, value)
|
153
|
+
end
|
154
|
+
def element_configinfo(id, slot=nil)
|
155
|
+
itemconfiginfo(['element', tagid(id)], slot)
|
156
|
+
end
|
157
|
+
def current_element_configinfo(id, slot=nil)
|
158
|
+
current_itemconfiginfo(['element', tagid(id)], slot)
|
159
|
+
end
|
160
|
+
|
161
|
+
def bar_cget(id, option)
|
162
|
+
itemcget(['bar', tagid(id)], option)
|
163
|
+
end
|
164
|
+
def bar_cget_strict(id, option)
|
165
|
+
itemcget_strict(['bar', tagid(id)], option)
|
166
|
+
end
|
167
|
+
def bar_configure(*args)
|
168
|
+
slot = args.pop
|
169
|
+
if slot.kind_of?(Hash)
|
170
|
+
value = None
|
171
|
+
else
|
172
|
+
value = slot
|
173
|
+
slot = args.pop
|
174
|
+
end
|
175
|
+
id_list = args.flatten.collect!{|id| tagid(id)}.unshift('bar')
|
176
|
+
itemconfigure(id_list, slot, value)
|
177
|
+
end
|
178
|
+
def bar_configinfo(id, slot=nil)
|
179
|
+
itemconfiginfo(['bar', tagid(id)], slot)
|
180
|
+
end
|
181
|
+
def current_bar_configinfo(id, slot=nil)
|
182
|
+
current_itemconfiginfo(['bar', tagid(id)], slot)
|
183
|
+
end
|
184
|
+
|
185
|
+
def line_cget(id, option)
|
186
|
+
itemcget(['line', tagid(id)], option)
|
187
|
+
end
|
188
|
+
def line_cget_strict(id, option)
|
189
|
+
itemcget_strict(['line', tagid(id)], option)
|
190
|
+
end
|
191
|
+
def line_configure(*args)
|
192
|
+
slot = args.pop
|
193
|
+
if slot.kind_of?(Hash)
|
194
|
+
value = None
|
195
|
+
else
|
196
|
+
value = slot
|
197
|
+
slot = args.pop
|
198
|
+
end
|
199
|
+
id_list = args.flatten.collect!{|id| tagid(id)}.unshift('line')
|
200
|
+
itemconfigure(id_list, slot, value)
|
201
|
+
end
|
202
|
+
def line_configinfo(id, slot=nil)
|
203
|
+
itemconfiginfo(['line', tagid(id)], slot)
|
204
|
+
end
|
205
|
+
def current_line_configinfo(id, slot=nil)
|
206
|
+
current_itemconfiginfo(['line', tagid(id)], slot)
|
207
|
+
end
|
208
|
+
|
209
|
+
def gridline_cget(option)
|
210
|
+
itemcget('grid', option)
|
211
|
+
end
|
212
|
+
def gridline_cget_strict(option)
|
213
|
+
itemcget_strict('grid', option)
|
214
|
+
end
|
215
|
+
def gridline_configure(slot, value=None)
|
216
|
+
itemconfigure('grid', slot, value)
|
217
|
+
end
|
218
|
+
def gridline_configinfo(slot=nil)
|
219
|
+
itemconfiginfo('grid', slot)
|
220
|
+
end
|
221
|
+
def current_gridline_configinfo(slot=nil)
|
222
|
+
current_itemconfiginfo('grid', slot)
|
223
|
+
end
|
224
|
+
|
225
|
+
def legend_cget(option)
|
226
|
+
itemcget('legend', option)
|
227
|
+
end
|
228
|
+
def legend_cget_strict(option)
|
229
|
+
itemcget_strict('legend', option)
|
230
|
+
end
|
231
|
+
def legend_configure(slot, value=None)
|
232
|
+
itemconfigure('legend', slot, value)
|
233
|
+
end
|
234
|
+
def legend_configinfo(slot=nil)
|
235
|
+
itemconfiginfo('legend', slot)
|
236
|
+
end
|
237
|
+
def current_legend_configinfo(slot=nil)
|
238
|
+
current_itemconfiginfo('legend', slot)
|
239
|
+
end
|
240
|
+
|
241
|
+
def pen_cget(id, option)
|
242
|
+
itemcget(['pen', tagid(id)], option)
|
243
|
+
end
|
244
|
+
def pen_cget_strict(id, option)
|
245
|
+
itemcget_strict(['pen', tagid(id)], option)
|
246
|
+
end
|
247
|
+
def pen_configure(*args)
|
248
|
+
slot = args.pop
|
249
|
+
if slot.kind_of?(Hash)
|
250
|
+
value = None
|
251
|
+
else
|
252
|
+
value = slot
|
253
|
+
slot = args.pop
|
254
|
+
end
|
255
|
+
id_list = args.flatten.collect!{|id| tagid(id)}.unshift('pen')
|
256
|
+
itemconfigure(id_list, slot, value)
|
257
|
+
end
|
258
|
+
def pen_configinfo(id, slot=nil)
|
259
|
+
itemconfiginfo(['pen', tagid(id)], slot)
|
260
|
+
end
|
261
|
+
def current_pen_configinfo(id, slot=nil)
|
262
|
+
current_itemconfiginfo(['pen', tagid(id)], slot)
|
263
|
+
end
|
264
|
+
|
265
|
+
def postscript_cget(option)
|
266
|
+
itemcget('postscript', option)
|
267
|
+
end
|
268
|
+
def postscript_cget_strict(option)
|
269
|
+
itemcget_strict('postscript', option)
|
270
|
+
end
|
271
|
+
def postscript_configure(slot, value=None)
|
272
|
+
itemconfigure('postscript', slot, value)
|
273
|
+
end
|
274
|
+
def postscript_configinfo(slot=nil)
|
275
|
+
itemconfiginfo('postscript', slot)
|
276
|
+
end
|
277
|
+
def current_postscript_configinfo(slot=nil)
|
278
|
+
current_itemconfiginfo('postscript', slot)
|
279
|
+
end
|
280
|
+
|
281
|
+
def marker_cget(id, option)
|
282
|
+
itemcget(['marker', tagid(id)], option)
|
283
|
+
end
|
284
|
+
def marker_cget_strict(id, option)
|
285
|
+
itemcget_strict(['marker', tagid(id)], option)
|
286
|
+
end
|
287
|
+
def marker_configure(*args)
|
288
|
+
slot = args.pop
|
289
|
+
if slot.kind_of?(Hash)
|
290
|
+
value = None
|
291
|
+
else
|
292
|
+
value = slot
|
293
|
+
slot = args.pop
|
294
|
+
end
|
295
|
+
id_list = args.flatten.collect!{|id| tagid(id)}.unshift('marker')
|
296
|
+
itemconfigure(id_list, slot, value)
|
297
|
+
end
|
298
|
+
def marker_configinfo(id, slot=nil)
|
299
|
+
itemconfiginfo(['marker', tagid(id)], slot)
|
300
|
+
end
|
301
|
+
def current_marker_configinfo(id, slot=nil)
|
302
|
+
current_itemconfiginfo(['marker', tagid(id)], slot)
|
303
|
+
end
|
304
|
+
|
305
|
+
alias __itemcget itemcget
|
306
|
+
alias __itemcget_strict itemcget_strict
|
307
|
+
alias __itemconfiginfo itemconfiginfo
|
308
|
+
alias __current_itemconfiginfo current_itemconfiginfo
|
309
|
+
private :__itemcget, :__itemconfiginfo, :__current_itemconfiginfo
|
310
|
+
|
311
|
+
def itemcget_strict(tagOrId, option)
|
312
|
+
ret = __itemcget(tagid(tagOrId), option)
|
313
|
+
if option == 'bindtags' || option == :bindtags
|
314
|
+
ret.collect{|tag| TkBindTag.id2obj(tag)}
|
315
|
+
else
|
316
|
+
ret
|
317
|
+
end
|
318
|
+
end
|
319
|
+
def itemcget(tagOrId, option)
|
320
|
+
unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
|
321
|
+
itemcget_strict(tagOrId, option)
|
322
|
+
else
|
323
|
+
begin
|
324
|
+
itemcget_strict(tagOrId, option)
|
325
|
+
rescue => e
|
326
|
+
begin
|
327
|
+
if current_itemconfiginfo(tagOrId).has_key?(option.to_s)
|
328
|
+
# error on known option
|
329
|
+
fail e
|
330
|
+
else
|
331
|
+
# unknown option
|
332
|
+
nil
|
333
|
+
end
|
334
|
+
rescue
|
335
|
+
fail e # tag error
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
def itemconfiginfo(tagOrId, slot = nil)
|
341
|
+
ret = __itemconfiginfo(tagid(tagOrId), slot)
|
342
|
+
|
343
|
+
if TkComm::GET_CONFIGINFO_AS_ARRAY
|
344
|
+
if slot
|
345
|
+
if slot == 'bindtags' || slot == :bindtags
|
346
|
+
ret[-2] = ret[-2].collect{|tag| TkBindTag.id2obj(tag)}
|
347
|
+
ret[-1] = ret[-1].collect{|tag| TkBindTag.id2obj(tag)}
|
348
|
+
end
|
349
|
+
else
|
350
|
+
if (inf = ret.assoc('bindtags'))
|
351
|
+
inf[-2] = inf[-2].collect{|tag| TkBindTag.id2obj(tag)}
|
352
|
+
inf[-1] = inf[-1].collect{|tag| TkBindTag.id2obj(tag)}
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
|
357
|
+
if (inf = ret['bindtags'])
|
358
|
+
inf[-2] = inf[-2].collect{|tag| TkBindTag.id2obj(tag)}
|
359
|
+
inf[-1] = inf[-1].collect{|tag| TkBindTag.id2obj(tag)}
|
360
|
+
ret['bindtags'] = inf
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
ret
|
365
|
+
end
|
366
|
+
def current_itemconfiginfo(tagOrId, slot = nil)
|
367
|
+
ret = __current_itemconfiginfo(tagid(tagOrId), slot)
|
368
|
+
|
369
|
+
if (val = ret['bindtags'])
|
370
|
+
ret['bindtags'] = val.collect{|tag| TkBindTag.id2obj(tag)}
|
371
|
+
end
|
372
|
+
|
373
|
+
ret
|
374
|
+
end
|
375
|
+
|
376
|
+
private :itemcget, :itemcget_strict
|
377
|
+
private :itemconfigure, :itemconfiginfo, :current_itemconfiginfo
|
378
|
+
|
379
|
+
#################
|
380
|
+
|
381
|
+
class Axis < TkObject
|
382
|
+
(OBJ_ID = ['blt_chart_axis'.freeze, '00000'.taint]).instance_eval{
|
383
|
+
@mutex = Mutex.new
|
384
|
+
def mutex; @mutex; end
|
385
|
+
freeze
|
386
|
+
}
|
387
|
+
|
388
|
+
AxisID_TBL = TkCore::INTERP.create_table
|
389
|
+
|
390
|
+
TkCore::INTERP.init_ip_env{
|
391
|
+
AxisID_TBL.mutex.synchronize{ AxisID_TBL.clear }
|
392
|
+
}
|
393
|
+
|
394
|
+
def self.id2obj(chart, id)
|
395
|
+
cpath = chart.path
|
396
|
+
AxisID_TBL.mutex.synchronize{
|
397
|
+
return id unless AxisID_TBL[cpath]
|
398
|
+
AxisID_TBL[cpath][id]? AxisID_TBL[cpath][id]: id
|
399
|
+
}
|
400
|
+
end
|
401
|
+
|
402
|
+
def self.new(chart, axis=nil, keys={})
|
403
|
+
if axis.kind_of?(Hash)
|
404
|
+
keys = axis
|
405
|
+
axis = nil
|
406
|
+
end
|
407
|
+
if keys
|
408
|
+
keys = _symbolkey2str(keys)
|
409
|
+
not_create = keys.delete('without_creating')
|
410
|
+
else
|
411
|
+
not_create = false
|
412
|
+
end
|
413
|
+
|
414
|
+
obj = nil
|
415
|
+
AxisID_TBL.mutex.synchronize{
|
416
|
+
chart_path = chart.path
|
417
|
+
AxisID_TBL[chart_path] ||= {}
|
418
|
+
if axis && AxisID_TBL[chart_path][axis]
|
419
|
+
obj = AxisID_TBL[chart_path][axis]
|
420
|
+
else
|
421
|
+
(obj = self.allocate).instance_eval{
|
422
|
+
if axis
|
423
|
+
@axis = @id = axis.to_s
|
424
|
+
else
|
425
|
+
OBJ_ID.mutex.synchronize{
|
426
|
+
@axis = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
|
427
|
+
OBJ_ID[1].succ!
|
428
|
+
}
|
429
|
+
end
|
430
|
+
@path = @id
|
431
|
+
@parent = @chart = chart
|
432
|
+
@cpath = @chart.path
|
433
|
+
Axis::AxisID_TBL[@cpath][@axis] = self
|
434
|
+
unless not_create
|
435
|
+
tk_call(@chart, 'axis', 'create', @axis, keys)
|
436
|
+
return obj
|
437
|
+
end
|
438
|
+
}
|
439
|
+
end
|
440
|
+
}
|
441
|
+
|
442
|
+
obj.configure(keys) if obj && ! keys.empty?
|
443
|
+
obj
|
444
|
+
end
|
445
|
+
|
446
|
+
def initialize(chart, axis=nil, keys={})
|
447
|
+
# dummy:: not called by 'new' method
|
448
|
+
|
449
|
+
if axis.kind_of?(Hash)
|
450
|
+
keys = axis
|
451
|
+
axis = nil
|
452
|
+
end
|
453
|
+
if axis
|
454
|
+
@axis = @id = axis.to_s
|
455
|
+
else
|
456
|
+
OBJ_ID.mutex.synchronize{
|
457
|
+
@axis = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
|
458
|
+
OBJ_ID[1].succ!
|
459
|
+
}
|
460
|
+
end
|
461
|
+
@path = @id
|
462
|
+
@parent = @chart = chart
|
463
|
+
@cpath = @chart.path
|
464
|
+
# Axis::AxisID_TBL[@cpath][@axis] = self
|
465
|
+
keys = _symbolkey2str(keys)
|
466
|
+
unless keys.delete('without_creating')
|
467
|
+
# @chart.axis_create(@axis, keys)
|
468
|
+
tk_call(@chart, 'axis', 'create', @axis, keys)
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
472
|
+
def id
|
473
|
+
@id
|
474
|
+
end
|
475
|
+
|
476
|
+
def to_eval
|
477
|
+
@id
|
478
|
+
end
|
479
|
+
|
480
|
+
def cget(option)
|
481
|
+
@chart.axis_cget(@id, option)
|
482
|
+
end
|
483
|
+
def cget_strict(option)
|
484
|
+
@chart.axis_cget_strict(@id, option)
|
485
|
+
end
|
486
|
+
def configure(key, value=None)
|
487
|
+
@chart.axis_configure(@id, key, value)
|
488
|
+
self
|
489
|
+
end
|
490
|
+
def configinfo(key=nil)
|
491
|
+
@chart.axis_configinfo(@id, key)
|
492
|
+
end
|
493
|
+
def current_configinfo(key=nil)
|
494
|
+
@chart.current_axis_configinfo(@id, key)
|
495
|
+
end
|
496
|
+
|
497
|
+
def command(cmd=nil, &b)
|
498
|
+
if cmd
|
499
|
+
configure('command', cmd)
|
500
|
+
elsif b
|
501
|
+
configure('command', Proc.new(&b))
|
502
|
+
else
|
503
|
+
cget('command')
|
504
|
+
end
|
505
|
+
end
|
506
|
+
|
507
|
+
def delete
|
508
|
+
@chart.axis_delete(@id)
|
509
|
+
self
|
510
|
+
end
|
511
|
+
|
512
|
+
def invtransform(val)
|
513
|
+
@chart.axis_invtransform(@id, val)
|
514
|
+
end
|
515
|
+
|
516
|
+
def limits
|
517
|
+
@chart.axis_limits(@id)
|
518
|
+
end
|
519
|
+
|
520
|
+
def name
|
521
|
+
@axis
|
522
|
+
end
|
523
|
+
|
524
|
+
def transform(val)
|
525
|
+
@chart.axis_transform(@id, val)
|
526
|
+
end
|
527
|
+
|
528
|
+
def view
|
529
|
+
@chart.axis_view(@id)
|
530
|
+
self
|
531
|
+
end
|
532
|
+
|
533
|
+
def use(name=None) # if @id == xaxis | x2axis | yaxis | y2axis
|
534
|
+
@chart.axis_use(@id, name)
|
535
|
+
end
|
536
|
+
|
537
|
+
def use_as(axis) # axis := xaxis | x2axis | yaxis | y2axis
|
538
|
+
@chart.axis_use(axis, @id)
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
#################
|
543
|
+
|
544
|
+
class Crosshairs < TkObject
|
545
|
+
CrosshairsID_TBL = TkCore::INTERP.create_table
|
546
|
+
|
547
|
+
TkCore::INTERP.init_ip_env{
|
548
|
+
CrosshairsID_TBL.mutex.synchronize{ CrosshairsID_TBL.clear }
|
549
|
+
}
|
550
|
+
|
551
|
+
def self.new(chart, keys={})
|
552
|
+
obj = nil
|
553
|
+
CrosshairsID_TBL.mutex.synchronize{
|
554
|
+
unless (obj = CrosshairsID_TBL[chart.path])
|
555
|
+
(obj = self.allocate).instance_eval{
|
556
|
+
@parent = @chart = chart
|
557
|
+
@cpath = @chart.path
|
558
|
+
@path = @id = 'crosshairs'
|
559
|
+
Crosshairs::CrosshairsID_TBL[@cpath] = self
|
560
|
+
}
|
561
|
+
end
|
562
|
+
}
|
563
|
+
chart.crosshair_configure(keys) if obj && ! keys.empty?
|
564
|
+
obj
|
565
|
+
end
|
566
|
+
|
567
|
+
def initialize(chart, keys={})
|
568
|
+
# dummy:: not called by 'new' method
|
569
|
+
|
570
|
+
@parent = @chart = chart
|
571
|
+
@cpath = @chart.path
|
572
|
+
# Crosshairs::CrosshairsID_TBL[@cpath] = self
|
573
|
+
@chart.crosshair_configure(keys) unless keys.empty?
|
574
|
+
@path = @id = 'crosshairs'
|
575
|
+
end
|
576
|
+
|
577
|
+
def id
|
578
|
+
@id
|
579
|
+
end
|
580
|
+
|
581
|
+
def to_eval
|
582
|
+
@id
|
583
|
+
end
|
584
|
+
|
585
|
+
def cget(option)
|
586
|
+
@chart.crosshair_cget(option)
|
587
|
+
end
|
588
|
+
def cget_strict(option)
|
589
|
+
@chart.crosshair_cget_strict(option)
|
590
|
+
end
|
591
|
+
def configure(key, value=None)
|
592
|
+
@chart.crosshair_configure(key, value)
|
593
|
+
self
|
594
|
+
end
|
595
|
+
def configinfo(key=nil)
|
596
|
+
@chart.crosshair_configinfo(key)
|
597
|
+
end
|
598
|
+
def current_configinfo(key=nil)
|
599
|
+
@chart.current_crosshair_configinfo(key)
|
600
|
+
end
|
601
|
+
|
602
|
+
def off
|
603
|
+
@chart.crosshair_off
|
604
|
+
self
|
605
|
+
end
|
606
|
+
def on
|
607
|
+
@chart.crosshair_on
|
608
|
+
self
|
609
|
+
end
|
610
|
+
def toggle
|
611
|
+
@chart.crosshair_toggle
|
612
|
+
self
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
#################
|
617
|
+
|
618
|
+
class Element < TkObject
|
619
|
+
extend Tk
|
620
|
+
extend TkItemFontOptkeys
|
621
|
+
extend TkItemConfigOptkeys
|
622
|
+
|
623
|
+
extend Tk::BLT::PlotComponent::OptKeys
|
624
|
+
|
625
|
+
ElementTypeName = 'element'
|
626
|
+
ElementTypeToClass = { ElementTypeName=>self }
|
627
|
+
|
628
|
+
ElementID_TBL = TkCore::INTERP.create_table
|
629
|
+
|
630
|
+
TkCore::INTERP.init_ip_env{
|
631
|
+
ElementID_TBL.mutex.synchronize{ ElementID_TBL.clear }
|
632
|
+
}
|
633
|
+
|
634
|
+
(OBJ_ID = ['blt_chart_element'.freeze, '00000'.taint]).instance_eval{
|
635
|
+
@mutex = Mutex.new
|
636
|
+
def mutex; @mutex; end
|
637
|
+
freeze
|
638
|
+
}
|
639
|
+
|
640
|
+
def Element.type2class(type)
|
641
|
+
ElementTypeToClass[type]
|
642
|
+
end
|
643
|
+
|
644
|
+
def Element.id2obj(chart, id)
|
645
|
+
cpath = chart.path
|
646
|
+
ElementID_TBL.mutex.synchronize{
|
647
|
+
return id unless ElementID_TBL[cpath]
|
648
|
+
ElementID_TBL[cpath][id]? ElementID_TBL[cpath][id]: id
|
649
|
+
}
|
650
|
+
end
|
651
|
+
|
652
|
+
def self.new(chart, element=nil, keys={})
|
653
|
+
if element.kind_of?(Hash)
|
654
|
+
keys = element
|
655
|
+
element = nil
|
656
|
+
end
|
657
|
+
if keys
|
658
|
+
keys = _symbolkey2str(keys)
|
659
|
+
not_create = keys.delete('without_creating')
|
660
|
+
else
|
661
|
+
not_create = false
|
662
|
+
end
|
663
|
+
|
664
|
+
obj = nil
|
665
|
+
ElementID_TBL.mutex.synchronize{
|
666
|
+
chart_path = chart.path
|
667
|
+
ElementID_TBL[chart_path] ||= {}
|
668
|
+
if element && ElementID_TBL[chart_path][element]
|
669
|
+
obj = ElementID_TBL[chart_path][element]
|
670
|
+
else
|
671
|
+
(obj = self.allocate).instance_eval{
|
672
|
+
if element
|
673
|
+
@element = @id = element.to_s
|
674
|
+
else
|
675
|
+
OBJ_ID.mutex.synchronize{
|
676
|
+
@element = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
|
677
|
+
OBJ_ID[1].succ!
|
678
|
+
}
|
679
|
+
end
|
680
|
+
@path = @id
|
681
|
+
@parent = @chart = chart
|
682
|
+
@cpath = @chart.path
|
683
|
+
@typename = self.class::ElementTypeName
|
684
|
+
Element::ElementID_TBL[@cpath][@element] = self
|
685
|
+
unless not_create
|
686
|
+
tk_call(@chart, @typename, 'create', @element, keys)
|
687
|
+
return obj
|
688
|
+
end
|
689
|
+
}
|
690
|
+
end
|
691
|
+
}
|
692
|
+
|
693
|
+
obj.configure(keys) if obj && ! keys.empty?
|
694
|
+
obj
|
695
|
+
end
|
696
|
+
|
697
|
+
def initialize(chart, element=nil, keys={})
|
698
|
+
# dummy:: not called by 'new' method
|
699
|
+
|
700
|
+
if element.kind_of?(Hash)
|
701
|
+
keys = element
|
702
|
+
element = nil
|
703
|
+
end
|
704
|
+
if element
|
705
|
+
@element = @id = element.to_s
|
706
|
+
else
|
707
|
+
OBJ_ID.mutex.synchronize{
|
708
|
+
@element = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
|
709
|
+
OBJ_ID[1].succ!
|
710
|
+
}
|
711
|
+
end
|
712
|
+
@path = @id
|
713
|
+
@parent = @chart = chart
|
714
|
+
@cpath = @chart.path
|
715
|
+
@typename = self.class::ElementTypeName
|
716
|
+
# Element::ElementID_TBL[@cpath][@element] = self
|
717
|
+
keys = _symbolkey2str(keys)
|
718
|
+
unless keys.delete('without_creating')
|
719
|
+
# @chart.element_create(@element, keys)
|
720
|
+
tk_call(@chart, @typename, 'create', @element, keys)
|
721
|
+
end
|
722
|
+
end
|
723
|
+
|
724
|
+
def id
|
725
|
+
@id
|
726
|
+
end
|
727
|
+
|
728
|
+
def to_eval
|
729
|
+
@id
|
730
|
+
end
|
731
|
+
|
732
|
+
def cget(option)
|
733
|
+
# @chart.element_cget(@id, option)
|
734
|
+
@chart.__send__(@typename + '_cget', @id, option)
|
735
|
+
end
|
736
|
+
def cget_strict(option)
|
737
|
+
@chart.__send__(@typename + '_cget_strict', @id, option)
|
738
|
+
end
|
739
|
+
def configure(key, value=None)
|
740
|
+
# @chart.element_configure(@id, key, value)
|
741
|
+
@chart.__send__(@typename + '_configure', @id, key, value)
|
742
|
+
self
|
743
|
+
end
|
744
|
+
def configinfo(key=nil)
|
745
|
+
# @chart.element_configinfo(@id, key)
|
746
|
+
@chart.__send__(@typename + '_configinfo', @id, key)
|
747
|
+
end
|
748
|
+
def current_configinfo(key=nil)
|
749
|
+
# @chart.current_element_configinfo(@id, key)
|
750
|
+
@chart.__send__('current_' << @typename << '_configinfo', @id, key)
|
751
|
+
end
|
752
|
+
|
753
|
+
def activate(*args)
|
754
|
+
@chart.element_activate(@id, *args)
|
755
|
+
end
|
756
|
+
|
757
|
+
def closest(x, y, var, keys={})
|
758
|
+
# @chart.element_closest(x, y, var, @id, keys)
|
759
|
+
@chart.__send__(@typename + '_closest', x, y, var, @id, keys)
|
760
|
+
end
|
761
|
+
|
762
|
+
def deactivate
|
763
|
+
@chart.element_deactivate(@id)
|
764
|
+
self
|
765
|
+
end
|
766
|
+
|
767
|
+
def delete
|
768
|
+
@chart.element_delete(@id)
|
769
|
+
self
|
770
|
+
end
|
771
|
+
|
772
|
+
def exist?
|
773
|
+
@chart.element_exist?(@id)
|
774
|
+
end
|
775
|
+
|
776
|
+
def name
|
777
|
+
@element
|
778
|
+
end
|
779
|
+
|
780
|
+
def type
|
781
|
+
@chart.element_type(@id)
|
782
|
+
end
|
783
|
+
end
|
784
|
+
|
785
|
+
class Bar < Element
|
786
|
+
ElementTypeName = 'bar'.freeze
|
787
|
+
ElementTypeToClass[ElementTypeName] = self
|
788
|
+
end
|
789
|
+
class Line < Element
|
790
|
+
ElementTypeName = 'line'.freeze
|
791
|
+
ElementTypeToClass[ElementTypeName] = self
|
792
|
+
end
|
793
|
+
|
794
|
+
#################
|
795
|
+
|
796
|
+
class GridLine < TkObject
|
797
|
+
GridLineID_TBL = TkCore::INTERP.create_table
|
798
|
+
TkCore::INTERP.init_ip_env{
|
799
|
+
GridLineID_TBL.mutex.synchronize{ GridLineID_TBL.clear }
|
800
|
+
}
|
801
|
+
|
802
|
+
def self.new(chart, keys={})
|
803
|
+
obj = nil
|
804
|
+
GridLineID_TBL.mutex.synchronize{
|
805
|
+
unless (obj = GridLineID_TBL[chart.path])
|
806
|
+
(obj = self.allocate).instance_eval{
|
807
|
+
@parent = @chart = chart
|
808
|
+
@cpath = @chart.path
|
809
|
+
@path = @id = 'grid'
|
810
|
+
GridLine::GridLineID_TBL[@cpath] = self
|
811
|
+
}
|
812
|
+
end
|
813
|
+
}
|
814
|
+
chart.gridline_configure(keys) if obj && ! keys.empty?
|
815
|
+
obj
|
816
|
+
end
|
817
|
+
|
818
|
+
def initialize(chart, keys={})
|
819
|
+
# dummy:: not called by 'new' method
|
820
|
+
|
821
|
+
@parent = @chart = chart
|
822
|
+
@cpath = @chart.path
|
823
|
+
# GridLine::GridLineID_TBL[@cpath] = self
|
824
|
+
@chart.gridline_configure(keys) unless keys.empty?
|
825
|
+
@path = @id = 'grid'
|
826
|
+
end
|
827
|
+
|
828
|
+
def id
|
829
|
+
@id
|
830
|
+
end
|
831
|
+
|
832
|
+
def to_eval
|
833
|
+
@id
|
834
|
+
end
|
835
|
+
|
836
|
+
def cget(option)
|
837
|
+
@chart.gridline_cget(option)
|
838
|
+
end
|
839
|
+
def cget_strict(option)
|
840
|
+
@chart.gridline_cget_strict(option)
|
841
|
+
end
|
842
|
+
def configure(key, value=None)
|
843
|
+
@chart.gridline_configure(key, value)
|
844
|
+
self
|
845
|
+
end
|
846
|
+
def configinfo(key=nil)
|
847
|
+
@chart.gridline_configinfo(key)
|
848
|
+
end
|
849
|
+
def current_configinfo(key=nil)
|
850
|
+
@chart.current_gridline_configinfo(key)
|
851
|
+
end
|
852
|
+
|
853
|
+
def off
|
854
|
+
@chart.gridline_off
|
855
|
+
self
|
856
|
+
end
|
857
|
+
def on
|
858
|
+
@chart.gridline_on
|
859
|
+
self
|
860
|
+
end
|
861
|
+
def toggle
|
862
|
+
@chart.gridline_toggle
|
863
|
+
self
|
864
|
+
end
|
865
|
+
end
|
866
|
+
|
867
|
+
#################
|
868
|
+
|
869
|
+
class Legend < TkObject
|
870
|
+
LegendID_TBL = TkCore::INTERP.create_table
|
871
|
+
|
872
|
+
TkCore::INTERP.init_ip_env{
|
873
|
+
LegendID_TBL.mutex.synchronize{ LegendID_TBL.clear }
|
874
|
+
}
|
875
|
+
|
876
|
+
def self.new(chart, keys={})
|
877
|
+
obj = nil
|
878
|
+
LegenedID_TBL.mutex.synchronize{
|
879
|
+
unless (obj = LegenedID_TBL[chart.path])
|
880
|
+
(obj = self.allocate).instance_eval{
|
881
|
+
@parent = @chart = chart
|
882
|
+
@cpath = @chart.path
|
883
|
+
@path = @id = 'crosshairs'
|
884
|
+
Legend::LegenedID_TBL[@cpath] = self
|
885
|
+
}
|
886
|
+
end
|
887
|
+
}
|
888
|
+
chart.legend_configure(keys) if obj && ! keys.empty?
|
889
|
+
obj
|
890
|
+
end
|
891
|
+
|
892
|
+
def initialize(chart, keys={})
|
893
|
+
# dummy:: not called by 'new' method
|
894
|
+
|
895
|
+
@parent = @chart = chart
|
896
|
+
@cpath = @chart.path
|
897
|
+
# Legend::LegendID_TBL[@cpath] = self
|
898
|
+
@chart.legend_configure(keys) unless keys.empty?
|
899
|
+
@path = @id = 'legend'
|
900
|
+
end
|
901
|
+
|
902
|
+
def id
|
903
|
+
@id
|
904
|
+
end
|
905
|
+
|
906
|
+
def to_eval
|
907
|
+
@id
|
908
|
+
end
|
909
|
+
|
910
|
+
def cget(option)
|
911
|
+
@chart.legend_cget(option)
|
912
|
+
end
|
913
|
+
def cget_strict(option)
|
914
|
+
@chart.legend_cget_strict(option)
|
915
|
+
end
|
916
|
+
def configure(key, value=None)
|
917
|
+
@chart.legend_configure(key, value)
|
918
|
+
self
|
919
|
+
end
|
920
|
+
def configinfo(key=nil)
|
921
|
+
@chart.legend_configinfo(key)
|
922
|
+
end
|
923
|
+
def current_configinfo(key=nil)
|
924
|
+
@chart.current_legend_configinfo(key)
|
925
|
+
end
|
926
|
+
|
927
|
+
def activate(*args)
|
928
|
+
@chart.legend_activate(*args)
|
929
|
+
end
|
930
|
+
|
931
|
+
def deactivate(*args)
|
932
|
+
@chart.legend_deactivate(*args)
|
933
|
+
end
|
934
|
+
|
935
|
+
def get(pos, y=nil)
|
936
|
+
@chart.legend_get(pos, y)
|
937
|
+
end
|
938
|
+
end
|
939
|
+
|
940
|
+
#################
|
941
|
+
|
942
|
+
class Pen < TkObject
|
943
|
+
(OBJ_ID = ['blt_chart_pen'.freeze, '00000'.taint]).instance_eval{
|
944
|
+
@mutex = Mutex.new
|
945
|
+
def mutex; @mutex; end
|
946
|
+
freeze
|
947
|
+
}
|
948
|
+
|
949
|
+
PenID_TBL = TkCore::INTERP.create_table
|
950
|
+
|
951
|
+
TkCore::INTERP.init_ip_env{
|
952
|
+
PenID_TBL.mutex.synchronize{ PenID_TBL.clear }
|
953
|
+
}
|
954
|
+
|
955
|
+
def self.id2obj(chart, id)
|
956
|
+
cpath = chart.path
|
957
|
+
PenID_TBL.mutex.synchronize{
|
958
|
+
return id unless PenID_TBL[cpath]
|
959
|
+
PenID_TBL[cpath][id]? PenID_TBL[cpath][id]: id
|
960
|
+
}
|
961
|
+
end
|
962
|
+
|
963
|
+
def self.new(chart, pen=nil, keys={})
|
964
|
+
if pen.kind_of?(Hash)
|
965
|
+
keys = pen
|
966
|
+
pen = nil
|
967
|
+
end
|
968
|
+
if keys
|
969
|
+
keys = _symbolkey2str(keys)
|
970
|
+
not_create = keys.delete('without_creating')
|
971
|
+
else
|
972
|
+
not_create = false
|
973
|
+
end
|
974
|
+
|
975
|
+
obj = nil
|
976
|
+
PenID_TBL.mutex.synchronize{
|
977
|
+
chart_path = chart.path
|
978
|
+
PenID_TBL[chart_path] ||= {}
|
979
|
+
if pen && PenID_TBL[chart_path][pen]
|
980
|
+
obj = PenID_TBL[chart_path][pen]
|
981
|
+
else
|
982
|
+
(obj = self.allocate).instance_eval{
|
983
|
+
if pen
|
984
|
+
@pen = @id = pen.to_s
|
985
|
+
else
|
986
|
+
OBJ_ID.mutex.synchronize{
|
987
|
+
@pen = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
|
988
|
+
OBJ_ID[1].succ!
|
989
|
+
}
|
990
|
+
end
|
991
|
+
@path = @id
|
992
|
+
@parent = @chart = chart
|
993
|
+
@cpath = @chart.path
|
994
|
+
Pen::PenID_TBL[@cpath][@pen] = self
|
995
|
+
unless not_create
|
996
|
+
tk_call(@chart, 'pen', 'create', @pen, keys)
|
997
|
+
return obj
|
998
|
+
end
|
999
|
+
}
|
1000
|
+
end
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
obj.configure(keys) if obj && ! keys.empty?
|
1004
|
+
obj
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
def initialize(chart, pen=nil, keys={})
|
1008
|
+
if pen.kind_of?(Hash)
|
1009
|
+
keys = pen
|
1010
|
+
pen = nil
|
1011
|
+
end
|
1012
|
+
if pen
|
1013
|
+
@pen = @id = pen.to_s
|
1014
|
+
else
|
1015
|
+
OBJ_ID.mutex.synchronize{
|
1016
|
+
@pen = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
|
1017
|
+
OBJ_ID[1].succ!
|
1018
|
+
}
|
1019
|
+
end
|
1020
|
+
@path = @id
|
1021
|
+
@parent = @chart = chart
|
1022
|
+
@cpath = @chart.path
|
1023
|
+
Pen::PenID_TBL[@cpath][@pen] = self
|
1024
|
+
keys = _symbolkey2str(keys)
|
1025
|
+
unless keys.delete('without_creating')
|
1026
|
+
# @chart.pen_create(@pen, keys)
|
1027
|
+
tk_call(@chart, 'pen', 'create', @pen, keys)
|
1028
|
+
end
|
1029
|
+
end
|
1030
|
+
|
1031
|
+
def id
|
1032
|
+
@id
|
1033
|
+
end
|
1034
|
+
|
1035
|
+
def to_eval
|
1036
|
+
@id
|
1037
|
+
end
|
1038
|
+
|
1039
|
+
def cget(option)
|
1040
|
+
@chart.pen_cget(@id, option)
|
1041
|
+
end
|
1042
|
+
def cget_strict(option)
|
1043
|
+
@chart.pen_cget_strict(@id, option)
|
1044
|
+
end
|
1045
|
+
def configure(key, value=None)
|
1046
|
+
@chart.pen_configure(@id, key, value)
|
1047
|
+
self
|
1048
|
+
end
|
1049
|
+
def configinfo(key=nil)
|
1050
|
+
@chart.pen_configinfo(@id, key)
|
1051
|
+
end
|
1052
|
+
def current_configinfo(key=nil)
|
1053
|
+
@chart.current_pen_configinfo(@id, key)
|
1054
|
+
end
|
1055
|
+
|
1056
|
+
def delete
|
1057
|
+
@chart.pen_delete(@id)
|
1058
|
+
self
|
1059
|
+
end
|
1060
|
+
|
1061
|
+
def name
|
1062
|
+
@pen
|
1063
|
+
end
|
1064
|
+
end
|
1065
|
+
|
1066
|
+
#################
|
1067
|
+
|
1068
|
+
class Postscript < TkObject
|
1069
|
+
PostscriptID_TBL = TkCore::INTERP.create_table
|
1070
|
+
|
1071
|
+
TkCore::INTERP.init_ip_env{
|
1072
|
+
PostscriptID_TBL.mutex.synchronize{ PostscriptID_TBL.clear }
|
1073
|
+
}
|
1074
|
+
|
1075
|
+
def self.new(chart, keys={})
|
1076
|
+
obj = nil
|
1077
|
+
PostscriptID_TBL.mutex.synchronize{
|
1078
|
+
unless (obj = PostscriptID_TBL[chart.path])
|
1079
|
+
(obj = self.allocate).instance_eval{
|
1080
|
+
@parent = @chart = chart
|
1081
|
+
@cpath = @chart.path
|
1082
|
+
@path = @id = 'postscript'
|
1083
|
+
Postscript::PostscriptID_TBL[@cpath] = self
|
1084
|
+
}
|
1085
|
+
end
|
1086
|
+
}
|
1087
|
+
chart.postscript_configure(keys) if obj && ! keys.empty?
|
1088
|
+
obj
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
def initialize(chart, keys={})
|
1092
|
+
# dummy:: not called by 'new' method
|
1093
|
+
|
1094
|
+
@parent = @chart = chart
|
1095
|
+
@cpath = @chart.path
|
1096
|
+
# Postscript::PostscriptID_TBL[@cpath] = self
|
1097
|
+
@chart.postscript_configure(keys) unless keys.empty?
|
1098
|
+
@path = @id = 'postscript'
|
1099
|
+
end
|
1100
|
+
|
1101
|
+
def id
|
1102
|
+
@id
|
1103
|
+
end
|
1104
|
+
|
1105
|
+
def to_eval
|
1106
|
+
@id
|
1107
|
+
end
|
1108
|
+
|
1109
|
+
def cget(option)
|
1110
|
+
@chart.postscript_cget(option)
|
1111
|
+
end
|
1112
|
+
def cget_strict(option)
|
1113
|
+
@chart.postscript_cget_strict(option)
|
1114
|
+
end
|
1115
|
+
def configure(key, value=None)
|
1116
|
+
@chart.postscript_configure(key, value)
|
1117
|
+
self
|
1118
|
+
end
|
1119
|
+
def configinfo(key=nil)
|
1120
|
+
@chart.postscript_configinfo(key)
|
1121
|
+
end
|
1122
|
+
def current_configinfo(key=nil)
|
1123
|
+
@chart.current_postscript_configinfo(key)
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
def output(file=nil, keys={})
|
1127
|
+
if file.kind_of?(Hash)
|
1128
|
+
keys = file
|
1129
|
+
file = nil
|
1130
|
+
end
|
1131
|
+
|
1132
|
+
ret = @chart.postscript_output(file, keys)
|
1133
|
+
|
1134
|
+
if file
|
1135
|
+
self
|
1136
|
+
else
|
1137
|
+
ret
|
1138
|
+
end
|
1139
|
+
end
|
1140
|
+
end
|
1141
|
+
|
1142
|
+
#################
|
1143
|
+
class Marker < TkObject
|
1144
|
+
extend Tk
|
1145
|
+
extend TkItemFontOptkeys
|
1146
|
+
extend TkItemConfigOptkeys
|
1147
|
+
|
1148
|
+
extend Tk::BLT::PlotComponent::OptKeys
|
1149
|
+
|
1150
|
+
MarkerTypeName = nil
|
1151
|
+
MarkerTypeToClass = {}
|
1152
|
+
MarkerID_TBL = TkCore::INTERP.create_table
|
1153
|
+
|
1154
|
+
TkCore::INTERP.init_ip_env{
|
1155
|
+
MarkerID_TBL.mutex.synchronize{ MarkerID_TBL.clear }
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
def Marker.type2class(type)
|
1159
|
+
MarkerTypeToClass[type]
|
1160
|
+
end
|
1161
|
+
|
1162
|
+
def Marker.id2obj(chart, id)
|
1163
|
+
cpath = chart.path
|
1164
|
+
MarkerID_TBL.mutex.synchronize{
|
1165
|
+
if MarkerID_TBL[cpath]
|
1166
|
+
MarkerID_TBL[cpath][id]? MarkerID_TBL[cpath][id]: id
|
1167
|
+
else
|
1168
|
+
id
|
1169
|
+
end
|
1170
|
+
}
|
1171
|
+
end
|
1172
|
+
|
1173
|
+
def self._parse_create_args(keys)
|
1174
|
+
fontkeys = {}
|
1175
|
+
methodkeys = {}
|
1176
|
+
if keys.kind_of? Hash
|
1177
|
+
keys = _symbolkey2str(keys)
|
1178
|
+
|
1179
|
+
__item_font_optkeys(nil).each{|key|
|
1180
|
+
fkey = key.to_s
|
1181
|
+
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
|
1182
|
+
|
1183
|
+
fkey = "kanji#{key}"
|
1184
|
+
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
|
1185
|
+
|
1186
|
+
fkey = "latin#{key}"
|
1187
|
+
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
|
1188
|
+
|
1189
|
+
fkey = "ascii#{key}"
|
1190
|
+
fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
__item_optkey_aliases(nil).each{|alias_name, real_name|
|
1194
|
+
alias_name = alias_name.to_s
|
1195
|
+
if keys.has_key?(alias_name)
|
1196
|
+
keys[real_name.to_s] = keys.delete(alias_name)
|
1197
|
+
end
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
__item_methodcall_optkeys(nil).each{|key|
|
1201
|
+
key = key.to_s
|
1202
|
+
methodkeys[key] = keys.delete(key) if keys.key?(key)
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
__item_ruby2val_optkeys(nil).each{|key, method|
|
1206
|
+
key = key.to_s
|
1207
|
+
keys[key] = method.call(keys[key]) if keys.has_key?(key)
|
1208
|
+
}
|
1209
|
+
|
1210
|
+
args = itemconfig_hash_kv(nil, keys)
|
1211
|
+
else
|
1212
|
+
args = []
|
1213
|
+
end
|
1214
|
+
|
1215
|
+
[args, fontkeys]
|
1216
|
+
end
|
1217
|
+
private_class_method :_parse_create_args
|
1218
|
+
|
1219
|
+
def self.create(chart, keys={})
|
1220
|
+
unless self::MarkerTypeName
|
1221
|
+
fail RuntimeError, "#{self} is an abstract class"
|
1222
|
+
end
|
1223
|
+
args, fontkeys = _parse_create_args(keys)
|
1224
|
+
idnum = tk_call_without_enc(chart.path, 'marker', 'create',
|
1225
|
+
self::MarkerTypeName, *args)
|
1226
|
+
chart.marker_configure(idnum, fontkeys) unless fontkeys.empty?
|
1227
|
+
idnum.to_i # 'item id' is an integer number
|
1228
|
+
end
|
1229
|
+
|
1230
|
+
def self.create_type(chart, type, keys={})
|
1231
|
+
args, fontkeys = _parse_create_args(keys)
|
1232
|
+
idnum = tk_call_without_enc(chart.path, 'marker', 'create',
|
1233
|
+
type, *args)
|
1234
|
+
chart.marker_configure(idnum, fontkeys) unless fontkeys.empty?
|
1235
|
+
id = idnum.to_i # 'item id' is an integer number
|
1236
|
+
obj = self.allocate
|
1237
|
+
obj.instance_eval{
|
1238
|
+
@parent = @chart = chart
|
1239
|
+
@cpath = chart.path
|
1240
|
+
@id = id
|
1241
|
+
Tk::BLT::PlotComponent::Marker::MarkerID_TBL.mutex.synchronize{
|
1242
|
+
Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath] ||= {}
|
1243
|
+
Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath][@id] = self
|
1244
|
+
}
|
1245
|
+
}
|
1246
|
+
obj
|
1247
|
+
end
|
1248
|
+
|
1249
|
+
def initialize(parent, *args)
|
1250
|
+
@parent = @chart = parent
|
1251
|
+
@cpath = parent.path
|
1252
|
+
|
1253
|
+
@path = @id = create_self(*args) # an integer number as 'item id'
|
1254
|
+
Tk::BLT::PlotComponent::Marker::MarkerID_TBL.mutex.synchronize{
|
1255
|
+
Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath] ||= {}
|
1256
|
+
Tk::BLT::PlotComponent::Marker::MarkerID_TBL[@cpath][@id] = self
|
1257
|
+
}
|
1258
|
+
end
|
1259
|
+
def create_self(*args)
|
1260
|
+
self.class.create(@chart, *args) # return an integer as 'item id'
|
1261
|
+
end
|
1262
|
+
private :create_self
|
1263
|
+
|
1264
|
+
def id
|
1265
|
+
@id
|
1266
|
+
end
|
1267
|
+
|
1268
|
+
def to_eval
|
1269
|
+
@id
|
1270
|
+
end
|
1271
|
+
|
1272
|
+
def cget(option)
|
1273
|
+
@chart.marker_cget(@id, option)
|
1274
|
+
end
|
1275
|
+
def cget_strict(option)
|
1276
|
+
@chart.marker_cget_strict(@id, option)
|
1277
|
+
end
|
1278
|
+
def configure(key, value=None)
|
1279
|
+
@chart.marker_configure(@id, key, value)
|
1280
|
+
self
|
1281
|
+
end
|
1282
|
+
def configinfo(key=nil)
|
1283
|
+
@chart.marker_configinfo(@id, key)
|
1284
|
+
end
|
1285
|
+
def current_configinfo(key=nil)
|
1286
|
+
@chart.current_marker_configinfo(@id, key)
|
1287
|
+
end
|
1288
|
+
|
1289
|
+
def after(target=None)
|
1290
|
+
@chart.marker_after(@id, target)
|
1291
|
+
end
|
1292
|
+
|
1293
|
+
def before(target=None)
|
1294
|
+
@chart.marker_before(@id, target)
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
def delete
|
1298
|
+
@chart.marker_delete(@id)
|
1299
|
+
end
|
1300
|
+
|
1301
|
+
def exist?
|
1302
|
+
@chart.marker_exist(@id)
|
1303
|
+
end
|
1304
|
+
|
1305
|
+
def type
|
1306
|
+
@chart.marker_type(@id)
|
1307
|
+
end
|
1308
|
+
end
|
1309
|
+
|
1310
|
+
class TextMarker < Marker
|
1311
|
+
MarkerTypeName = 'text'.freeze
|
1312
|
+
MarkerTypeToClass[MarkerTypeName] = self
|
1313
|
+
end
|
1314
|
+
class LineMarker < Marker
|
1315
|
+
MarkerTypeName = 'line'.freeze
|
1316
|
+
MarkerTypeToClass[MarkerTypeName] = self
|
1317
|
+
end
|
1318
|
+
class BitmapMarker < Marker
|
1319
|
+
MarkerTypeName = 'bitmap'.freeze
|
1320
|
+
MarkerTypeToClass[MarkerTypeName] = self
|
1321
|
+
end
|
1322
|
+
class ImageMarker < Marker
|
1323
|
+
MarkerTypeName = 'image'.freeze
|
1324
|
+
MarkerTypeToClass[MarkerTypeName] = self
|
1325
|
+
end
|
1326
|
+
class PolygonMarker < Marker
|
1327
|
+
MarkerTypeName = 'polygon'.freeze
|
1328
|
+
MarkerTypeToClass[MarkerTypeName] = self
|
1329
|
+
end
|
1330
|
+
class WindowMarker < Marker
|
1331
|
+
MarkerTypeName = 'window'.freeze
|
1332
|
+
MarkerTypeToClass[MarkerTypeName] = self
|
1333
|
+
end
|
1334
|
+
|
1335
|
+
#################
|
1336
|
+
|
1337
|
+
def __destroy_hook__
|
1338
|
+
Axis::AxisID_TBL.delete(@path)
|
1339
|
+
Crosshairs::CrosshairsID_TBL.delete(@path)
|
1340
|
+
Element::ElementID_TBL.delete(@path)
|
1341
|
+
GridLine::GridLineID_TBL.delete(@path)
|
1342
|
+
Legend::LegendID_TBL.delete(@path)
|
1343
|
+
Pen::PenID_TBL.delete(@path)
|
1344
|
+
Postscript::PostscriptID_TBL.delete(@path)
|
1345
|
+
Marker::MarkerID_TBL.delete(@path)
|
1346
|
+
super()
|
1347
|
+
end
|
1348
|
+
|
1349
|
+
#################
|
1350
|
+
|
1351
|
+
def tagid(tag)
|
1352
|
+
if tag.kind_of?(Axis) ||
|
1353
|
+
tag.kind_of?(Crosshairs) ||
|
1354
|
+
tag.kind_of?(Element) ||
|
1355
|
+
tag.kind_of?(GridLine) ||
|
1356
|
+
tag.kind_of?(Legend) ||
|
1357
|
+
tag.kind_of?(Pen) ||
|
1358
|
+
tag.kind_of?(Postscript) ||
|
1359
|
+
tag.kind_of?(Marker)
|
1360
|
+
tag.id
|
1361
|
+
else
|
1362
|
+
tag # maybe an Array of configure paramters
|
1363
|
+
end
|
1364
|
+
end
|
1365
|
+
|
1366
|
+
def _component_bind(target, tag, context, *args)
|
1367
|
+
if TkComm._callback_entry?(args[0]) || !block_given?
|
1368
|
+
cmd = args.shift
|
1369
|
+
else
|
1370
|
+
cmd = Proc.new
|
1371
|
+
end
|
1372
|
+
_bind([path, target, 'bind', tagid(tag)], context, cmd, *args)
|
1373
|
+
self
|
1374
|
+
end
|
1375
|
+
def _component_bind_append(target, tag, context, *args)
|
1376
|
+
if TkComm._callback_entry?(args[0]) || !block_given?
|
1377
|
+
cmd = args.shift
|
1378
|
+
else
|
1379
|
+
cmd = Proc.new
|
1380
|
+
end
|
1381
|
+
_bind_append([path, target, 'bind', tagid(tag)], context, cmd, *args)
|
1382
|
+
self
|
1383
|
+
end
|
1384
|
+
def _component_bind_remove(target, tag, context)
|
1385
|
+
_bind_remove([path, target, 'bind', tagid(tag)], context)
|
1386
|
+
self
|
1387
|
+
end
|
1388
|
+
def _component_bindinfo(target, tag, context=nil)
|
1389
|
+
_bindinfo([path, target, 'bind', tagid(tag)], context)
|
1390
|
+
end
|
1391
|
+
private :_component_bind, :_component_bind_append
|
1392
|
+
private :_component_bind_remove, :_component_bindinfo
|
1393
|
+
|
1394
|
+
def axis_bind(tag, context, *args)
|
1395
|
+
_component_bind('axis', tag, context, *args)
|
1396
|
+
end
|
1397
|
+
def axis_bind_append(tag, context, *args)
|
1398
|
+
_component_bind_append('axis', tag, context, *args)
|
1399
|
+
end
|
1400
|
+
def axis_bind_remove(tag, context)
|
1401
|
+
_component_bind_remove('axis', tag, context)
|
1402
|
+
end
|
1403
|
+
def axis_bindinfo(tag, context=nil)
|
1404
|
+
_component_bindinfo('axis', tag, context)
|
1405
|
+
end
|
1406
|
+
|
1407
|
+
def element_bind(tag, context, *args)
|
1408
|
+
_component_bind('element', tag, context, *args)
|
1409
|
+
end
|
1410
|
+
def element_bind_append(tag, context, *args)
|
1411
|
+
_component_bind_append('element', tag, context, *args)
|
1412
|
+
end
|
1413
|
+
def element_bind_remove(tag, context)
|
1414
|
+
_component_bind_remove('element', tag, context)
|
1415
|
+
end
|
1416
|
+
def element_bindinfo(tag, context=nil)
|
1417
|
+
_component_bindinfo('element', tag, context)
|
1418
|
+
end
|
1419
|
+
|
1420
|
+
def bar_bind(tag, context, *args)
|
1421
|
+
_component_bind('bar', tag, context, *args)
|
1422
|
+
end
|
1423
|
+
def bar_bind_append(tag, context, *args)
|
1424
|
+
_component_bind_append('bar', tag, context, *args)
|
1425
|
+
end
|
1426
|
+
def bar_bind_remove(tag, context)
|
1427
|
+
_component_bind_remove('bar', tag, context)
|
1428
|
+
end
|
1429
|
+
def bar_bindinfo(tag, context=nil)
|
1430
|
+
_component_bindinfo('bar', tag, context)
|
1431
|
+
end
|
1432
|
+
|
1433
|
+
def line_bind(tag, context, *args)
|
1434
|
+
_component_bind('line', tag, context, *args)
|
1435
|
+
end
|
1436
|
+
def line_bind_append(tag, context, *args)
|
1437
|
+
_component_bind_append('line', tag, context, *args)
|
1438
|
+
end
|
1439
|
+
def line_bind_remove(tag, context)
|
1440
|
+
_component_bind_remove('line', tag, context)
|
1441
|
+
end
|
1442
|
+
def line_bindinfo(tag, context=nil)
|
1443
|
+
_component_bindinfo('line', tag, context)
|
1444
|
+
end
|
1445
|
+
|
1446
|
+
def legend_bind(tag, context, *args)
|
1447
|
+
_component_bind('legend', tag, context, *args)
|
1448
|
+
end
|
1449
|
+
def legend_bind_append(tag, context, *args)
|
1450
|
+
_component_bind_append('legend', tag, context, *args)
|
1451
|
+
end
|
1452
|
+
def legend_bind_remove(tag, context)
|
1453
|
+
_component_bind_remove('legend', tag, context)
|
1454
|
+
end
|
1455
|
+
def legend_bindinfo(tag, context=nil)
|
1456
|
+
_component_bindinfo('legend', tag, context)
|
1457
|
+
end
|
1458
|
+
|
1459
|
+
def marker_bind(tag, context, *args)
|
1460
|
+
_component_bind('marker', tag, context, *args)
|
1461
|
+
end
|
1462
|
+
def marker_bind_append(tag, context, *args)
|
1463
|
+
_component_bind_append('marker', tag, context, *args)
|
1464
|
+
end
|
1465
|
+
def marker_bind_remove(tag, context)
|
1466
|
+
_component_bind_remove('marker', tag, context)
|
1467
|
+
end
|
1468
|
+
def marker_bindinfo(tag, context=nil)
|
1469
|
+
_component_bindinfo('marker', tag, context)
|
1470
|
+
end
|
1471
|
+
|
1472
|
+
###################
|
1473
|
+
|
1474
|
+
def axis_create(id=nil, keys={})
|
1475
|
+
# tk_send('axis', 'create', tagid(id), keys)
|
1476
|
+
Tk::BLT::PlotComponent::Axis.new(self, tagid(id), keys)
|
1477
|
+
end
|
1478
|
+
def axis_delete(*ids)
|
1479
|
+
tk_send('axis', 'delete', *(ids.collect{|id| tagid(id)}))
|
1480
|
+
self
|
1481
|
+
end
|
1482
|
+
def axis_invtransform(id, val)
|
1483
|
+
list(tk_send('axis', 'invtransform', tagid(id), val))
|
1484
|
+
end
|
1485
|
+
def axis_limits(id)
|
1486
|
+
list(tk_send('axis', 'limits', tagid(id)))
|
1487
|
+
end
|
1488
|
+
def axis_names(*pats)
|
1489
|
+
simplelist(tk_send('axis', 'names',
|
1490
|
+
*(pats.collect{|pat| tagid(pat)}))).collect{|axis|
|
1491
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self, axis)
|
1492
|
+
}
|
1493
|
+
end
|
1494
|
+
def axis_transform(id, val)
|
1495
|
+
list(tk_send('axis', 'transform', tagid(id), val))
|
1496
|
+
end
|
1497
|
+
def axis_view(id)
|
1498
|
+
tk_send('axis', 'view', tagid(id))
|
1499
|
+
self
|
1500
|
+
end
|
1501
|
+
def axis_use(id, target=nil)
|
1502
|
+
if target
|
1503
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self,
|
1504
|
+
tk_send('axis', 'use',
|
1505
|
+
tagid(id), tagid(target)))
|
1506
|
+
else
|
1507
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self,
|
1508
|
+
tk_send('axis', 'use', tagid(id)))
|
1509
|
+
end
|
1510
|
+
end
|
1511
|
+
|
1512
|
+
###################
|
1513
|
+
|
1514
|
+
def crosshairs_off
|
1515
|
+
tk_send_without_enc('crosshairs', 'off')
|
1516
|
+
self
|
1517
|
+
end
|
1518
|
+
def crosshairs_on
|
1519
|
+
tk_send_without_enc('crosshairs', 'on')
|
1520
|
+
self
|
1521
|
+
end
|
1522
|
+
def crosshairs_toggle
|
1523
|
+
tk_send_without_enc('crosshairs', 'toggle')
|
1524
|
+
self
|
1525
|
+
end
|
1526
|
+
|
1527
|
+
###################
|
1528
|
+
|
1529
|
+
def element_create(id=nil, keys={})
|
1530
|
+
# tk_send('element', 'create', tagid(id), keys)
|
1531
|
+
Tk::BLT::PlotComponent::Element.new(self, tagid(id), keys)
|
1532
|
+
end
|
1533
|
+
def element_activate(*args)
|
1534
|
+
if args.empty?
|
1535
|
+
list(tk_send('element', 'activate')).collect{|elem|
|
1536
|
+
Tk::BLT::PlotComponent::Element.id2obj(self, elem)
|
1537
|
+
}
|
1538
|
+
else
|
1539
|
+
# id, *indices
|
1540
|
+
id = args.shift
|
1541
|
+
tk_send('element', 'activate', tagid(id), *args)
|
1542
|
+
end
|
1543
|
+
end
|
1544
|
+
def element_closest(x, y, var, *args)
|
1545
|
+
if args[-1].kind_of?(Hash)
|
1546
|
+
keys = args.pop
|
1547
|
+
bool(tk_send('element', 'closest', x, y, var,
|
1548
|
+
*(hash_kv(keys).concat(args.collect{|id| tagid(id)}))))
|
1549
|
+
else
|
1550
|
+
bool(tk_send('element', 'closest', x, y, var,
|
1551
|
+
*(args.collect{|id| tagid(id)})))
|
1552
|
+
end
|
1553
|
+
end
|
1554
|
+
def element_deactivate(*ids)
|
1555
|
+
tk_send('element', 'deactivate', *(ids.collect{|id| tagid(id)}))
|
1556
|
+
self
|
1557
|
+
end
|
1558
|
+
def element_delete(*ids)
|
1559
|
+
tk_send('element', 'delete', *(ids.collect{|id| tagid(id)}))
|
1560
|
+
self
|
1561
|
+
end
|
1562
|
+
def element_exist?(id)
|
1563
|
+
bool(tk_send('element', 'exists', tagid(id)))
|
1564
|
+
end
|
1565
|
+
def element_names(*pats)
|
1566
|
+
simplelist(tk_send('element', 'names',
|
1567
|
+
*(pats.collect{|pat| tagid(pat)}))).collect{|elem|
|
1568
|
+
Tk::BLT::PlotComponent::Element.id2obj(self, elem)
|
1569
|
+
}
|
1570
|
+
end
|
1571
|
+
def element_show(*names)
|
1572
|
+
if names.empty?
|
1573
|
+
simplelist(tk_send('element', 'show'))
|
1574
|
+
else
|
1575
|
+
tk_send('element', 'show', *(names.collect{|n| tagid(n)}))
|
1576
|
+
self
|
1577
|
+
end
|
1578
|
+
end
|
1579
|
+
def element_type(id)
|
1580
|
+
tk_send('element', 'type', tagid(id))
|
1581
|
+
end
|
1582
|
+
|
1583
|
+
###################
|
1584
|
+
|
1585
|
+
def bar_create(id=nil, keys={})
|
1586
|
+
# tk_send('bar', 'create', tagid(id), keys)
|
1587
|
+
Tk::BLT::PlotComponent::Bar.new(self, tagid(id), keys)
|
1588
|
+
end
|
1589
|
+
alias bar bar_create
|
1590
|
+
def bar_activate(*args)
|
1591
|
+
if args.empty?
|
1592
|
+
list(tk_send('bar', 'activate')).collect{|elem|
|
1593
|
+
Tk::BLT::PlotComponent::Element.id2obj(self, elem)
|
1594
|
+
}
|
1595
|
+
else
|
1596
|
+
# id, *indices
|
1597
|
+
id = args.shift
|
1598
|
+
tk_send('bar', 'activate', tagid(id), *args)
|
1599
|
+
end
|
1600
|
+
end
|
1601
|
+
def bar_closest(x, y, var, *args)
|
1602
|
+
if args[-1].kind_of?(Hash)
|
1603
|
+
keys = args.pop
|
1604
|
+
bool(tk_send('bar', 'closest', x, y, var,
|
1605
|
+
*(hash_kv(keys).concat(args.collect{|id| tagid(id)}))))
|
1606
|
+
else
|
1607
|
+
bool(tk_send('bar', 'closest', x, y, var,
|
1608
|
+
*(args.collect{|id| tagid(id)})))
|
1609
|
+
end
|
1610
|
+
end
|
1611
|
+
def bar_deactivate(*ids)
|
1612
|
+
tk_send('bar', 'deactivate', *(ids.collect{|id| tagid(id)}))
|
1613
|
+
self
|
1614
|
+
end
|
1615
|
+
def bar_delete(*ids)
|
1616
|
+
tk_send('bar', 'delete', *(ids.collect{|id| tagid(id)}))
|
1617
|
+
self
|
1618
|
+
end
|
1619
|
+
def bar_exist?(id)
|
1620
|
+
bool(tk_send('bar', 'exists', tagid(id)))
|
1621
|
+
end
|
1622
|
+
def bar_names(*pats)
|
1623
|
+
simplelist(tk_send('bar', 'names',
|
1624
|
+
*(pats.collect{|pat| tagid(pat)}))).collect{|elem|
|
1625
|
+
Tk::BLT::PlotComponent::Element.id2obj(self, elem)
|
1626
|
+
}
|
1627
|
+
end
|
1628
|
+
def bar_show(*names)
|
1629
|
+
if names.empty?
|
1630
|
+
simplelist(tk_send('bar', 'show'))
|
1631
|
+
else
|
1632
|
+
tk_send('bar', 'show', *(names.collect{|n| tagid(n)}))
|
1633
|
+
self
|
1634
|
+
end
|
1635
|
+
end
|
1636
|
+
def bar_type(id)
|
1637
|
+
tk_send('bar', 'type', tagid(id))
|
1638
|
+
end
|
1639
|
+
|
1640
|
+
###################
|
1641
|
+
|
1642
|
+
def line_create(id=nil, keys={})
|
1643
|
+
# tk_send('line', 'create', tagid(id), keys)
|
1644
|
+
Tk::BLT::PlotComponent::Line.new(self, tagid(id), keys)
|
1645
|
+
end
|
1646
|
+
alias bar line_create
|
1647
|
+
def line_activate(*args)
|
1648
|
+
if args.empty?
|
1649
|
+
list(tk_send('line', 'activate')).collect{|elem|
|
1650
|
+
Tk::BLT::PlotComponent::Element.id2obj(self, elem)
|
1651
|
+
}
|
1652
|
+
else
|
1653
|
+
# id, *indices
|
1654
|
+
id = args.shift
|
1655
|
+
tk_send('line', 'activate', tagid(id), *args)
|
1656
|
+
end
|
1657
|
+
end
|
1658
|
+
def line_closest(x, y, var, *args)
|
1659
|
+
if args[-1].kind_of?(Hash)
|
1660
|
+
keys = args.pop
|
1661
|
+
bool(tk_send('line', 'closest', x, y, var,
|
1662
|
+
*(hash_kv(keys).concat(args.collect{|id| tagid(id)}))))
|
1663
|
+
else
|
1664
|
+
bool(tk_send('line', 'closest', x, y, var,
|
1665
|
+
*(args.collect{|id| tagid(id)})))
|
1666
|
+
end
|
1667
|
+
end
|
1668
|
+
def line_deactivate(*ids)
|
1669
|
+
tk_send('line', 'deactivate', *(ids.collect{|id| tagid(id)}))
|
1670
|
+
self
|
1671
|
+
end
|
1672
|
+
def line_delete(*ids)
|
1673
|
+
tk_send('line', 'delete', *(ids.collect{|id| tagid(id)}))
|
1674
|
+
self
|
1675
|
+
end
|
1676
|
+
def line_exist?(id)
|
1677
|
+
bool(tk_send('line', 'exists', tagid(id)))
|
1678
|
+
end
|
1679
|
+
def line_names(*pats)
|
1680
|
+
simplelist(tk_send('line', 'names',
|
1681
|
+
*(pats.collect{|pat| tagid(pat)}))).collect{|elem|
|
1682
|
+
Tk::BLT::PlotComponent::Element.id2obj(self, elem)
|
1683
|
+
}
|
1684
|
+
end
|
1685
|
+
def line_show(*names)
|
1686
|
+
if names.empty?
|
1687
|
+
simplelist(tk_send('line', 'show'))
|
1688
|
+
else
|
1689
|
+
tk_send('line', 'show', *(names.collect{|n| tagid(n)}))
|
1690
|
+
self
|
1691
|
+
end
|
1692
|
+
end
|
1693
|
+
def line_type(id)
|
1694
|
+
tk_send('line', 'type', tagid(id))
|
1695
|
+
end
|
1696
|
+
|
1697
|
+
###################
|
1698
|
+
|
1699
|
+
def gridline_off
|
1700
|
+
tk_send_without_enc('grid', 'off')
|
1701
|
+
self
|
1702
|
+
end
|
1703
|
+
def gridline_on
|
1704
|
+
tk_send_without_enc('grid', 'on')
|
1705
|
+
self
|
1706
|
+
end
|
1707
|
+
def gridline_toggle
|
1708
|
+
tk_send_without_enc('grid', 'toggle')
|
1709
|
+
self
|
1710
|
+
end
|
1711
|
+
|
1712
|
+
###################
|
1713
|
+
|
1714
|
+
def legend_window_create(parent=nil, keys=nil)
|
1715
|
+
if parent.kind_of?(Hash)
|
1716
|
+
keys = _symbolkey2str(parent)
|
1717
|
+
parent = keys.delete('parent')
|
1718
|
+
widgetname = keys.delete('widgetname')
|
1719
|
+
keys.delete('without_creating')
|
1720
|
+
elsif keys
|
1721
|
+
keys = _symbolkey2str(keys)
|
1722
|
+
widgetname = keys.delete('widgetname')
|
1723
|
+
keys.delete('without_creating')
|
1724
|
+
end
|
1725
|
+
|
1726
|
+
legend = self.class.new(parent, :without_creating=>true,
|
1727
|
+
:widgetname=>widgetname)
|
1728
|
+
class << legend
|
1729
|
+
def __destroy_hook__
|
1730
|
+
TkCore::INTERP.tk_windows.delete(@path)
|
1731
|
+
end
|
1732
|
+
end
|
1733
|
+
|
1734
|
+
if keys
|
1735
|
+
self.legend_configure(keys.update('position'=>legend))
|
1736
|
+
else
|
1737
|
+
self.legend_configure('position'=>legend)
|
1738
|
+
end
|
1739
|
+
legend
|
1740
|
+
end
|
1741
|
+
|
1742
|
+
def legend_activate(*pats)
|
1743
|
+
list(tk_send('legend', 'activate',
|
1744
|
+
*(pats.collect{|pat| tagid(pat)}))).collect{|elem|
|
1745
|
+
Tk::BLT::PlotComponent::Element.id2obj(self, elem)
|
1746
|
+
}
|
1747
|
+
end
|
1748
|
+
def legend_deactivate(*pats)
|
1749
|
+
list(tk_send('legend', 'deactivate',
|
1750
|
+
*(pats.collect{|pat| tagid(pat)}))).collect{|elem|
|
1751
|
+
Tk::BLT::PlotComponent::Element.id2obj(self, elem)
|
1752
|
+
}
|
1753
|
+
end
|
1754
|
+
def legend_get(pos, y=nil)
|
1755
|
+
if y
|
1756
|
+
Tk::BLT::PlotComponent::Element.id2obj(self,
|
1757
|
+
tk_send('legend', 'get',
|
1758
|
+
_at(pos, y)))
|
1759
|
+
else
|
1760
|
+
Tk::BLT::PlotComponent::Element.id2obj(self,
|
1761
|
+
tk_send('legend', 'get', pos))
|
1762
|
+
end
|
1763
|
+
end
|
1764
|
+
|
1765
|
+
###################
|
1766
|
+
|
1767
|
+
def pen_create(id=nil, keys={})
|
1768
|
+
# tk_send('pen', 'create', tagid(id), keys)
|
1769
|
+
Tk::BLT::PlotComponent::Pen.new(self, tagid(id), keys)
|
1770
|
+
end
|
1771
|
+
def pen_delete(*ids)
|
1772
|
+
tk_send('pen', 'delete', *(ids.collect{|id| tagid(id)}))
|
1773
|
+
self
|
1774
|
+
end
|
1775
|
+
def pen_names(*pats)
|
1776
|
+
simplelist(tk_send('pen', 'names',
|
1777
|
+
*(pats.collect{|pat| tagid(pat)}))).collect{|pen|
|
1778
|
+
Tk::BLT::PlotComponent::Pen.id2obj(self, pen)
|
1779
|
+
}
|
1780
|
+
end
|
1781
|
+
|
1782
|
+
###################
|
1783
|
+
|
1784
|
+
def postscript_output(file=nil, keys={})
|
1785
|
+
if file.kind_of?(Hash)
|
1786
|
+
keys = file
|
1787
|
+
file = nil
|
1788
|
+
end
|
1789
|
+
|
1790
|
+
if file
|
1791
|
+
tk_send('postscript', 'output', file, keys)
|
1792
|
+
self
|
1793
|
+
else
|
1794
|
+
tk_send('postscript', 'output', keys)
|
1795
|
+
end
|
1796
|
+
end
|
1797
|
+
|
1798
|
+
###################
|
1799
|
+
|
1800
|
+
def marker_create(type, keys={})
|
1801
|
+
case type
|
1802
|
+
when :text, 'text'
|
1803
|
+
Tk::BLT::PlotComponent::TextMarker.new(self, keys)
|
1804
|
+
when :line, 'line'
|
1805
|
+
Tk::BLT::PlotComponent::LineMarker.new(self, keys)
|
1806
|
+
when :bitmap, 'bitmap'
|
1807
|
+
Tk::BLT::PlotComponent::BitmapMarker.new(self, keys)
|
1808
|
+
when :image, 'image'
|
1809
|
+
Tk::BLT::PlotComponent::ImageMarker.new(self, keys)
|
1810
|
+
when :polygon, 'polygon'
|
1811
|
+
Tk::BLT::PlotComponent::PolygonMarker.new(self, keys)
|
1812
|
+
when :window, 'window'
|
1813
|
+
Tk::BLT::PlotComponent::WindowMarker.new(self, keys)
|
1814
|
+
else
|
1815
|
+
if type.kind_of?(Tk::BLT::PlotComponent::Marker)
|
1816
|
+
type.new(self, keys)
|
1817
|
+
else
|
1818
|
+
Tk::BLT::PlotComponent::Marker.create_type(self, type, keys)
|
1819
|
+
end
|
1820
|
+
end
|
1821
|
+
end
|
1822
|
+
def marker_after(id, target=nil)
|
1823
|
+
if target
|
1824
|
+
tk_send_without_enc('marker', 'after', tagid(id), tagid(target))
|
1825
|
+
else
|
1826
|
+
tk_send_without_enc('marker', 'after', tagid(id))
|
1827
|
+
end
|
1828
|
+
self
|
1829
|
+
end
|
1830
|
+
def marker_before(id, target=None)
|
1831
|
+
if target
|
1832
|
+
tk_send_without_enc('marker', 'before', tagid(id), tagid(target))
|
1833
|
+
else
|
1834
|
+
tk_send_without_enc('marker', 'before', tagid(id))
|
1835
|
+
end
|
1836
|
+
self
|
1837
|
+
end
|
1838
|
+
def marker_delete(*ids)
|
1839
|
+
tk_send('marker', 'delete', *(ids.collect{|id| tagid(id)}))
|
1840
|
+
self
|
1841
|
+
end
|
1842
|
+
def marker_exist?(id)
|
1843
|
+
bool(tk_send('marker', 'exists', tagid(id)))
|
1844
|
+
end
|
1845
|
+
def marker_names(*pats)
|
1846
|
+
simplelist(tk_send('marker', 'names',
|
1847
|
+
*(pats.collect{|pat| tagid(pat)}))).collect{|id|
|
1848
|
+
Tk::BLT::PlotComponent::Marker.id2obj(self, id)
|
1849
|
+
}
|
1850
|
+
end
|
1851
|
+
def marker_type(id)
|
1852
|
+
tk_send('marker', 'type', tagid(id))
|
1853
|
+
end
|
1854
|
+
|
1855
|
+
###################
|
1856
|
+
|
1857
|
+
def xaxis_cget(option)
|
1858
|
+
itemcget('xaxis', option)
|
1859
|
+
end
|
1860
|
+
def xaxis_cget_strict(option)
|
1861
|
+
itemcget_strict('xaxis', option)
|
1862
|
+
end
|
1863
|
+
def xaxis_configure(slot, value=None)
|
1864
|
+
if slot.kind_of?(Hash)
|
1865
|
+
slot = _symbolkey2str(slot)
|
1866
|
+
if cmd = slot.delete('command')
|
1867
|
+
slot['command'] = proc{|w, tick|
|
1868
|
+
cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
|
1869
|
+
}
|
1870
|
+
end
|
1871
|
+
elsif slot == :command || slot == 'command'
|
1872
|
+
cmd = value
|
1873
|
+
value = proc{|w, tick|
|
1874
|
+
cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
|
1875
|
+
}
|
1876
|
+
end
|
1877
|
+
itemconfigure('xaxis', slot, value)
|
1878
|
+
end
|
1879
|
+
def xaxis_configinfo(slot=nil)
|
1880
|
+
itemconfiginfo('xaxis', slot)
|
1881
|
+
end
|
1882
|
+
def current_xaxis_configinfo(slot=nil)
|
1883
|
+
current_itemconfiginfo('xaxis', slot)
|
1884
|
+
end
|
1885
|
+
def xaxis_bind(context, *args)
|
1886
|
+
if TkComm._callback_entry?(args[0]) || !block_given?
|
1887
|
+
cmd = args.shift
|
1888
|
+
else
|
1889
|
+
cmd = Proc.new
|
1890
|
+
end
|
1891
|
+
_bind([path, 'xaxis', 'bind'], context, cmd, *args)
|
1892
|
+
self
|
1893
|
+
end
|
1894
|
+
def xaxis_bind_append(context, *args)
|
1895
|
+
if TkComm._callback_entry?(args[0]) || !block_given?
|
1896
|
+
cmd = args.shift
|
1897
|
+
else
|
1898
|
+
cmd = Proc.new
|
1899
|
+
end
|
1900
|
+
_bind_append([path, 'xaxis', 'bind'], context, cmd, *args)
|
1901
|
+
self
|
1902
|
+
end
|
1903
|
+
def xaxis_bind_remove(context)
|
1904
|
+
_bind_remove([path, 'xaxis', 'bind'], context)
|
1905
|
+
self
|
1906
|
+
end
|
1907
|
+
def xaxis_bindinfo(context=nil)
|
1908
|
+
_bindinfo([path, 'xaxis', 'bind'], context)
|
1909
|
+
end
|
1910
|
+
def xaxis_invtransform(val)
|
1911
|
+
list(tk_send('xaxis', 'invtransform', val))
|
1912
|
+
end
|
1913
|
+
def xaxis_limits
|
1914
|
+
list(tk_send('xaxis', 'limits'))
|
1915
|
+
end
|
1916
|
+
def xaxis_transform(val)
|
1917
|
+
list(tk_send('xaxis', 'transform', val))
|
1918
|
+
end
|
1919
|
+
def xaxis_use(target=nil)
|
1920
|
+
if target
|
1921
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self,
|
1922
|
+
tk_send('xaxis', 'use',
|
1923
|
+
tagid(target)))
|
1924
|
+
else
|
1925
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('xaxis', 'use'))
|
1926
|
+
end
|
1927
|
+
end
|
1928
|
+
|
1929
|
+
def x2axis_cget(option)
|
1930
|
+
itemcget('x2axis', option)
|
1931
|
+
end
|
1932
|
+
def x2axis_cget_strict(option)
|
1933
|
+
itemcget_strict('x2axis', option)
|
1934
|
+
end
|
1935
|
+
def x2axis_configure(slot, value=None)
|
1936
|
+
if slot.kind_of?(Hash)
|
1937
|
+
slot = _symbolkey2str(slot)
|
1938
|
+
if cmd = slot.delete('command')
|
1939
|
+
slot['command'] = proc{|w, tick|
|
1940
|
+
cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
|
1941
|
+
}
|
1942
|
+
end
|
1943
|
+
elsif slot == :command || slot == 'command'
|
1944
|
+
cmd = value
|
1945
|
+
value = proc{|w, tick|
|
1946
|
+
cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
|
1947
|
+
}
|
1948
|
+
end
|
1949
|
+
itemconfigure('x2axis', slot, value)
|
1950
|
+
end
|
1951
|
+
def x2axis_configinfo(slot=nil)
|
1952
|
+
itemconfiginfo('x2axis', slot)
|
1953
|
+
end
|
1954
|
+
def current_x2axis_configinfo(slot=nil)
|
1955
|
+
current_itemconfiginfo('x2axis', slot)
|
1956
|
+
end
|
1957
|
+
def x2axis_bind(context, *args)
|
1958
|
+
if TkComm._callback_entry?(args[0]) || !block_given?
|
1959
|
+
cmd = args.shift
|
1960
|
+
else
|
1961
|
+
cmd = Proc.new
|
1962
|
+
end
|
1963
|
+
_bind([path, 'x2axis', 'bind'], context, cmd, *args)
|
1964
|
+
self
|
1965
|
+
end
|
1966
|
+
def x2axis_bind_append(context, *args)
|
1967
|
+
if TkComm._callback_entry?(args[0]) || !block_given?
|
1968
|
+
cmd = args.shift
|
1969
|
+
else
|
1970
|
+
cmd = Proc.new
|
1971
|
+
end
|
1972
|
+
_bind_append([path, 'x2axis', 'bind'], context, cmd, *args)
|
1973
|
+
self
|
1974
|
+
end
|
1975
|
+
def x2axis_bind_remove(context)
|
1976
|
+
_bind_remove([path, 'x2axis', 'bind'], context)
|
1977
|
+
self
|
1978
|
+
end
|
1979
|
+
def x2axis_bindinfo(context=nil)
|
1980
|
+
_bindinfo([path, 'x2axis', 'bind'], context)
|
1981
|
+
end
|
1982
|
+
def x2axis_invtransform(val)
|
1983
|
+
list(tk_send('x2axis', 'invtransform', val))
|
1984
|
+
end
|
1985
|
+
def x2axis_limits
|
1986
|
+
list(tk_send('x2axis', 'limits'))
|
1987
|
+
end
|
1988
|
+
def x2axis_transform(val)
|
1989
|
+
list(tk_send('x2axis', 'transform', val))
|
1990
|
+
end
|
1991
|
+
def x2axis_use(target=nil)
|
1992
|
+
if target
|
1993
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self,
|
1994
|
+
tk_send('x2axis', 'use',
|
1995
|
+
tagid(target)))
|
1996
|
+
else
|
1997
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('x2axis', 'use'))
|
1998
|
+
end
|
1999
|
+
end
|
2000
|
+
|
2001
|
+
def yaxis_cget(option)
|
2002
|
+
itemcget('yaxis', option)
|
2003
|
+
end
|
2004
|
+
def yaxis_cget_strict(option)
|
2005
|
+
itemcget_strict('yaxis', option)
|
2006
|
+
end
|
2007
|
+
def yaxis_configure(slot, value=None)
|
2008
|
+
if slot.kind_of?(Hash)
|
2009
|
+
slot = _symbolkey2str(slot)
|
2010
|
+
if cmd = slot.delete('command')
|
2011
|
+
slot['command'] = proc{|w, tick|
|
2012
|
+
cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
|
2013
|
+
}
|
2014
|
+
end
|
2015
|
+
elsif slot == :command || slot == 'command'
|
2016
|
+
cmd = value
|
2017
|
+
value = proc{|w, tick|
|
2018
|
+
cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
|
2019
|
+
}
|
2020
|
+
end
|
2021
|
+
itemconfigure('yaxis', slot, value)
|
2022
|
+
end
|
2023
|
+
def yaxis_configinfo(slot=nil)
|
2024
|
+
itemconfiginfo('yaxis', slot)
|
2025
|
+
end
|
2026
|
+
def current_yaxis_configinfo(slot=nil)
|
2027
|
+
current_itemconfiginfo('yaxis', slot)
|
2028
|
+
end
|
2029
|
+
def yaxis_bind(context, *args)
|
2030
|
+
if TkComm._callback_entry?(args[0]) || !block_given?
|
2031
|
+
cmd = args.shift
|
2032
|
+
else
|
2033
|
+
cmd = Proc.new
|
2034
|
+
end
|
2035
|
+
_bind([path, 'yaxis', 'bind'], context, cmd, *args)
|
2036
|
+
self
|
2037
|
+
end
|
2038
|
+
def yaxis_bind_append(context, *args)
|
2039
|
+
if TkComm._callback_entry?(args[0]) || !block_given?
|
2040
|
+
cmd = args.shift
|
2041
|
+
else
|
2042
|
+
cmd = Proc.new
|
2043
|
+
end
|
2044
|
+
_bind_append([path, 'yaxis', 'bind'], context, cmd, *args)
|
2045
|
+
self
|
2046
|
+
end
|
2047
|
+
def yaxis_bind_remove(context)
|
2048
|
+
_bind_remove([path, 'yaxis', 'bind'], context)
|
2049
|
+
self
|
2050
|
+
end
|
2051
|
+
def yaxis_bindinfo(context=nil)
|
2052
|
+
_bindinfo([path, 'yaxis', 'bind'], context)
|
2053
|
+
end
|
2054
|
+
def yaxis_invtransform(val)
|
2055
|
+
list(tk_send('yaxis', 'invtransform', val))
|
2056
|
+
end
|
2057
|
+
def yaxis_limits
|
2058
|
+
list(tk_send('yaxis', 'limits'))
|
2059
|
+
end
|
2060
|
+
def yaxis_transform(val)
|
2061
|
+
list(tk_send('yaxis', 'transform', val))
|
2062
|
+
end
|
2063
|
+
def yaxis_use(target=nil)
|
2064
|
+
if target
|
2065
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self,
|
2066
|
+
tk_send('yaxis', 'use',
|
2067
|
+
tagid(target)))
|
2068
|
+
else
|
2069
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('yaxis', 'use'))
|
2070
|
+
end
|
2071
|
+
end
|
2072
|
+
|
2073
|
+
def y2axis_cget(option)
|
2074
|
+
itemcget('y2axis', option)
|
2075
|
+
end
|
2076
|
+
def y2axis_cget_strict(option)
|
2077
|
+
itemcget_strict('y2axis', option)
|
2078
|
+
end
|
2079
|
+
def y2axis_configure(slot, value=None)
|
2080
|
+
if slot.kind_of?(Hash)
|
2081
|
+
slot = _symbolkey2str(slot)
|
2082
|
+
if cmd = slot.delete('command')
|
2083
|
+
slot['command'] = proc{|w, tick|
|
2084
|
+
cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
|
2085
|
+
}
|
2086
|
+
end
|
2087
|
+
elsif slot == :command || slot == 'command'
|
2088
|
+
cmd = value
|
2089
|
+
value = proc{|w, tick|
|
2090
|
+
cmd.call(TkComm.window(w), TkComm.num_or_str(tick))
|
2091
|
+
}
|
2092
|
+
end
|
2093
|
+
itemconfigure('y2axis', slot, value)
|
2094
|
+
end
|
2095
|
+
def y2axis_configinfo(slot=nil)
|
2096
|
+
axis_configinfo('y2axis', slot)
|
2097
|
+
end
|
2098
|
+
def current_y2axis_configinfo(slot=nil)
|
2099
|
+
current_itemconfiginfo('y2axis', slot)
|
2100
|
+
end
|
2101
|
+
def y2axis_bind(context, *args)
|
2102
|
+
if TkComm._callback_entry?(args[0]) || !block_given?
|
2103
|
+
cmd = args.shift
|
2104
|
+
else
|
2105
|
+
cmd = Proc.new
|
2106
|
+
end
|
2107
|
+
_bind([path, 'y2axis', 'bind'], context, cmd, *args)
|
2108
|
+
self
|
2109
|
+
end
|
2110
|
+
def y2axis_bind_append(context, *args)
|
2111
|
+
if TkComm._callback_entry?(args[0]) || !block_given?
|
2112
|
+
cmd = args.shift
|
2113
|
+
else
|
2114
|
+
cmd = Proc.new
|
2115
|
+
end
|
2116
|
+
_bind_append([path, 'y2axis', 'bind'], context, cmd, *args)
|
2117
|
+
self
|
2118
|
+
end
|
2119
|
+
def y2axis_bind_remove(context)
|
2120
|
+
_bind_remove([path, 'y2axis', 'bind'], context)
|
2121
|
+
self
|
2122
|
+
end
|
2123
|
+
def y2axis_bindinfo(context=nil)
|
2124
|
+
_bindinfo([path, 'y2axis', 'bind'], context)
|
2125
|
+
end
|
2126
|
+
def y2axis_invtransform(val)
|
2127
|
+
list(tk_send('y2axis', 'invtransform', val))
|
2128
|
+
end
|
2129
|
+
def y2axis_limits
|
2130
|
+
list(tk_send('y2axis', 'limits'))
|
2131
|
+
end
|
2132
|
+
def y2axis_transform(val)
|
2133
|
+
list(tk_send('y2axis', 'transform', val))
|
2134
|
+
end
|
2135
|
+
def y2axis_use(target=nil)
|
2136
|
+
if target
|
2137
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self,
|
2138
|
+
tk_send('y2axis', 'use',
|
2139
|
+
tagid(target)))
|
2140
|
+
else
|
2141
|
+
Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('y2axis', 'use'))
|
2142
|
+
end
|
2143
|
+
end
|
2144
|
+
end
|
2145
|
+
end
|