mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ed6ce8b43b
* ext/tk/*: Support new features of Tcl/Tk8.6b1 and minor bug fixes. ( [KNOWN BUG] Ruby/Tk on Ruby 1.9 will not work on Cygwin. ) * ext/tk/*: Unify sources between Ruby 1.8 & 1.9. Improve default_widget_set handling. * ext/tk/*: Multi-TkInterpreter (multi-tk.rb) works on Ruby 1.8 & 1.9. ( [KNOWN BUG] On Ruby 1.8, join to a long term Thread on Tk callbacks may freeze. On Ruby 1.9, cannot create a second master interpreter (creating slaves are OK); supported master interpreter is the default master interpreter only. ) * ext/tk/lib/tkextlib/*: Update supported versions of Tk extensions. Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5 BWidgets 1.7 ==> BWidgets 1.8 TkTable 2.9 ==> TkTable 2.10 TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9 Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1 IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15 TclX 2005-02-07 ==> TclX 2008-12-15 Trofs 0.4.3 ==> Trofs 0.4.4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
189 lines
4.9 KiB
Ruby
189 lines
4.9 KiB
Ruby
#
|
|
# BLT support
|
|
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
|
|
#
|
|
|
|
require 'tk'
|
|
require 'tk/variable'
|
|
|
|
# call setup script for general 'tkextlib' libraries
|
|
require 'tkextlib/setup.rb'
|
|
|
|
# call setup script
|
|
require 'tkextlib/blt/setup.rb'
|
|
|
|
# load all image format handlers
|
|
#TkPackage.require('BLT', '2.4')
|
|
TkPackage.require('BLT')
|
|
|
|
module Tk
|
|
module BLT
|
|
TkComm::TkExtlibAutoloadModule.unshift(self)
|
|
# Require autoload-symbols which is a same name as widget classname.
|
|
# Those are used at TkComm._genobj_for_tkwidget method.
|
|
|
|
extend TkCore
|
|
|
|
VERSION = tk_call('set', 'blt_version')
|
|
PATCH_LEVEL = tk_call('set', 'blt_patchLevel')
|
|
|
|
begin
|
|
lib = TkCore::INTERP._invoke('set', 'blt_library')
|
|
rescue
|
|
lib = ''
|
|
end
|
|
LIBRARY = TkVarAccess.new('blt_library', lib)
|
|
|
|
begin
|
|
lib = TkCore::INTERP._invoke('set', 'blt_libPath')
|
|
rescue
|
|
lib = ''
|
|
end
|
|
LIB_PATH = TkVarAccess.new('blt_libPath', lib)
|
|
|
|
PACKAGE_NAME = 'BLT'.freeze
|
|
def self.package_name
|
|
PACKAGE_NAME
|
|
end
|
|
|
|
def self.package_version
|
|
begin
|
|
TkPackage.require('BLT')
|
|
rescue
|
|
''
|
|
end
|
|
end
|
|
|
|
####################################################
|
|
|
|
def self.beep(percent = 50)
|
|
tk_call('::blt::beep', percent)
|
|
end
|
|
|
|
def self.bgexec(*args)
|
|
if args[0].kind_of?(TkVariable)
|
|
var = args.shift
|
|
else
|
|
var = TkVariable.new
|
|
end
|
|
params = [var]
|
|
|
|
params.concat(hash_kv(args.shift, true)) if args[0].kind_of?(Hash)
|
|
|
|
params << '--' if args[0] =~ /^\s*-[^-]/
|
|
params.concat(args)
|
|
|
|
tk_call('::blt::bgexec', *params)
|
|
var
|
|
end
|
|
|
|
def self.detach_bgexec(*args)
|
|
if args[0].kind_of?(TkVariable)
|
|
var = args.shift
|
|
else
|
|
var = TkVariable.new
|
|
end
|
|
params = [var]
|
|
|
|
params.concat(hash_kv(args.shift, true)) if args[0].kind_of?(Hash)
|
|
|
|
params << '--' if args[0] =~ /^\s*-[^-]/
|
|
params.concat(args)
|
|
params << '&'
|
|
|
|
[var, tk_split_list(tk_call('::blt::bgexec', *params))]
|
|
end
|
|
|
|
def self.bltdebug(lvl = nil)
|
|
if lvl
|
|
tk_call('::blt::bltdebug', lvl)
|
|
else
|
|
number(tk_call('::blt::bltdebug'))
|
|
end
|
|
end
|
|
|
|
def self.crc32_file(name)
|
|
tk_call_without_enc('::blt::crc32', name)
|
|
end
|
|
def self.crc32_data(dat)
|
|
tk_call_without_enc('::blt::crc32', '-data', dat)
|
|
end
|
|
|
|
####################################################
|
|
|
|
def self.active_legend(graph)
|
|
tk_call_without_enc('Blt_ActiveLegend', graph)
|
|
end
|
|
def self.crosshairs(graph)
|
|
tk_call_without_enc('Blt_Crosshairs', graph)
|
|
end
|
|
def self.zoom_stack(graph)
|
|
tk_call_without_enc('Blt_ZoomStack', graph)
|
|
end
|
|
def self.print_key(graph)
|
|
tk_call_without_enc('Blt_PrintKey', graph)
|
|
end
|
|
def self.closest_point(graph)
|
|
tk_call_without_enc('Blt_ClosestPoint', graph)
|
|
end
|
|
|
|
module GraphCommand
|
|
def active_legend
|
|
tk_call_without_enc('Blt_ActiveLegend', @path)
|
|
self
|
|
end
|
|
def crosshairs
|
|
tk_call_without_enc('Blt_Crosshairs', @path)
|
|
self
|
|
end
|
|
def zoom_stack
|
|
tk_call_without_enc('Blt_ZoomStack', @path)
|
|
self
|
|
end
|
|
def print_key
|
|
tk_call_without_enc('Blt_PrintKey', @path)
|
|
self
|
|
end
|
|
def closest_point
|
|
tk_call_without_enc('Blt_ClosestPoint', @path)
|
|
self
|
|
end
|
|
end
|
|
|
|
####################################################
|
|
|
|
autoload :PlotComponent,'tkextlib/blt/component.rb'
|
|
|
|
autoload :Barchart, 'tkextlib/blt/barchart.rb'
|
|
autoload :Bitmap, 'tkextlib/blt/bitmap.rb'
|
|
autoload :Busy, 'tkextlib/blt/busy.rb'
|
|
autoload :Container, 'tkextlib/blt/container.rb'
|
|
autoload :CutBuffer, 'tkextlib/blt/cutbuffer.rb'
|
|
autoload :DragDrop, 'tkextlib/blt/dragdrop.rb'
|
|
autoload :EPS, 'tkextlib/blt/eps.rb'
|
|
autoload :Htext, 'tkextlib/blt/htext.rb'
|
|
autoload :Graph, 'tkextlib/blt/graph.rb'
|
|
autoload :Spline, 'tkextlib/blt/spline.rb'
|
|
autoload :Stripchart, 'tkextlib/blt/stripchart.rb'
|
|
autoload :Table, 'tkextlib/blt/table.rb'
|
|
autoload :Tabnotebook, 'tkextlib/blt/tabnotebook.rb'
|
|
autoload :Tabset, 'tkextlib/blt/tabset.rb'
|
|
autoload :Ted, 'tkextlib/blt/ted.rb'
|
|
autoload :Tile, 'tkextlib/blt/tile.rb'
|
|
autoload :Tree, 'tkextlib/blt/tree.rb'
|
|
autoload :TreeView, 'tkextlib/blt/treeview.rb'
|
|
autoload :Hiertable, 'tkextlib/blt/treeview.rb'
|
|
# Hierbox is obsolete
|
|
autoload :Vector, 'tkextlib/blt/vector.rb'
|
|
autoload :VectorAccess, 'tkextlib/blt/vector.rb'
|
|
autoload :Watch, 'tkextlib/blt/watch.rb'
|
|
autoload :Winop, 'tkextlib/blt/winop.rb'
|
|
autoload :WinOp, 'tkextlib/blt/winop.rb'
|
|
|
|
# Unix only
|
|
autoload :DnD, 'tkextlib/blt/unix_dnd.rb'
|
|
|
|
# Windows only
|
|
autoload :Printer, 'tkextlib/blt/win_printer.rb'
|
|
end
|
|
end
|