mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/lib/tk.rb: forgot to update RELEASE_DATE
* ext/tk/lib/tk/variable.rb: fix namespace trouble when autoloading * ext/tk/lib/tk/palette.rb: define Tcl variable 'tkPalette' as global * ext/tk/lib/tk/dialog.rb: use array2tk_list method when calling Tk.ip_eval. * ext/tk/lib/tk/autoload.rb: add autoload entry 'TkDialogObj' and 'TkWarningObj' * ext/tk/lib/tkextlib/treectrl/tktreectrl.rb: support TreeCtrl's cvs head. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
373282f665
commit
21df665098
9 changed files with 126 additions and 23 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
Sat Apr 2 16:59:46 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* ext/tk/lib/tk.rb: forgot to update RELEASE_DATE
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/variable.rb: fix namespace trouble when autoloading
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/palette.rb: define Tcl variable 'tkPalette' as global
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/dialog.rb: use array2tk_list method when calling
|
||||||
|
Tk.ip_eval.
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/autoload.rb: add autoload entry 'TkDialogObj' and
|
||||||
|
'TkWarningObj'
|
||||||
|
|
||||||
Sat Apr 2 13:23:17 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
Sat Apr 2 13:23:17 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
* hash.c (env_key): ENV.index is deprecated as well as Hash#index.
|
* hash.c (env_key): ENV.index is deprecated as well as Hash#index.
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2005-04-02 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* lib/tkextlib/treectrl/tktreectrl.rb: support TreeCtrl's cvs head.
|
||||||
|
|
||||||
2005-04-02 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
2005-04-02 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
* lib/tkextlib/blt/component.rb: add TreeCtrl#legend_window_create().
|
* lib/tkextlib/blt/component.rb: add TreeCtrl#legend_window_create().
|
||||||
|
|
|
@ -4024,7 +4024,7 @@ end
|
||||||
#Tk.freeze
|
#Tk.freeze
|
||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
RELEASE_DATE = '2005-03-30'.freeze
|
RELEASE_DATE = '2005-04-02'.freeze
|
||||||
|
|
||||||
autoload :AUTO_PATH, 'tk/variable'
|
autoload :AUTO_PATH, 'tk/variable'
|
||||||
autoload :TCL_PACKAGE_PATH, 'tk/variable'
|
autoload :TCL_PACKAGE_PATH, 'tk/variable'
|
||||||
|
|
|
@ -47,8 +47,10 @@ autoload :TkConsole, 'tk/console'
|
||||||
|
|
||||||
autoload :TkDialog, 'tk/dialog'
|
autoload :TkDialog, 'tk/dialog'
|
||||||
autoload :TkDialog2, 'tk/dialog'
|
autoload :TkDialog2, 'tk/dialog'
|
||||||
|
autoload :TkDialogObj, 'tk/dialog'
|
||||||
autoload :TkWarning, 'tk/dialog'
|
autoload :TkWarning, 'tk/dialog'
|
||||||
autoload :TkWarning2, 'tk/dialog'
|
autoload :TkWarning2, 'tk/dialog'
|
||||||
|
autoload :TkWarningObj, 'tk/dialog'
|
||||||
|
|
||||||
autoload :TkEntry, 'tk/entry'
|
autoload :TkEntry, 'tk/entry'
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# tk/dialog.rb : create dialog boxes
|
# tk/dialog.rb : create dialog boxes
|
||||||
#
|
#
|
||||||
require 'tk'
|
require 'tk'
|
||||||
|
require 'tk/variable.rb'
|
||||||
|
|
||||||
class TkDialogObj < TkWindow
|
class TkDialogObj < TkWindow
|
||||||
extend Tk
|
extend Tk
|
||||||
|
@ -49,7 +50,8 @@ class TkDialogObj < TkWindow
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@config = 'after idle {' + @config + '};' if @config != ""
|
# @config = 'after idle {' + @config + '};' if @config != ""
|
||||||
|
@config = array2tk_list['after', 'idle', @config] << ';' if @config != ""
|
||||||
end
|
end
|
||||||
private :_set_button_config
|
private :_set_button_config
|
||||||
|
|
||||||
|
@ -82,7 +84,8 @@ class TkDialogObj < TkWindow
|
||||||
@title = keys['title'] if keys.key? 'title'
|
@title = keys['title'] if keys.key? 'title'
|
||||||
@message = keys['message'] if keys.key? 'message'
|
@message = keys['message'] if keys.key? 'message'
|
||||||
@bitmap = keys['bitmap'] if keys.key? 'bitmap'
|
@bitmap = keys['bitmap'] if keys.key? 'bitmap'
|
||||||
@bitmap = '{}' if @bitmap == nil || @bitmap == ""
|
# @bitmap = '{}' if @bitmap == nil || @bitmap == ""
|
||||||
|
@bitmap = '' unless @bitmap
|
||||||
@default_button = keys['default'] if keys.key? 'default'
|
@default_button = keys['default'] if keys.key? 'default'
|
||||||
@buttons = keys['buttons'] if keys.key? 'buttons'
|
@buttons = keys['buttons'] if keys.key? 'buttons'
|
||||||
|
|
||||||
|
@ -95,9 +98,9 @@ class TkDialogObj < TkWindow
|
||||||
@btnframe_config = keys['btnframe_config'] if keys.key? 'btnframe_config'
|
@btnframe_config = keys['btnframe_config'] if keys.key? 'btnframe_config'
|
||||||
end
|
end
|
||||||
|
|
||||||
if @title.include? ?\s
|
#if @title.include? ?\s
|
||||||
@title = '{' + @title + '}'
|
# @title = '{' + @title + '}'
|
||||||
end
|
#end
|
||||||
|
|
||||||
if @buttons.kind_of?(Array)
|
if @buttons.kind_of?(Array)
|
||||||
_set_button_config(@buttons.collect{|cfg|
|
_set_button_config(@buttons.collect{|cfg|
|
||||||
|
@ -109,6 +112,8 @@ class TkDialogObj < TkWindow
|
||||||
@buttons = @buttons.keys
|
@buttons = @buttons.keys
|
||||||
end
|
end
|
||||||
@buttons = tk_split_simplelist(@buttons) if @buttons.kind_of?(String)
|
@buttons = tk_split_simplelist(@buttons) if @buttons.kind_of?(String)
|
||||||
|
@buttons = [] unless @buttons
|
||||||
|
=begin
|
||||||
@buttons = @buttons.collect{|s|
|
@buttons = @buttons.collect{|s|
|
||||||
if s.kind_of?(Array)
|
if s.kind_of?(Array)
|
||||||
s = s.join(' ')
|
s = s.join(' ')
|
||||||
|
@ -119,6 +124,7 @@ class TkDialogObj < TkWindow
|
||||||
s
|
s
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
=end
|
||||||
|
|
||||||
if @message_config.kind_of?(Hash)
|
if @message_config.kind_of?(Hash)
|
||||||
# @config << Kernel.format("%s.msg configure %s;",
|
# @config << Kernel.format("%s.msg configure %s;",
|
||||||
|
@ -167,7 +173,8 @@ class TkDialogObj < TkWindow
|
||||||
else
|
else
|
||||||
default_button = @default_button
|
default_button = @default_button
|
||||||
end
|
end
|
||||||
default_button = '{}' if default_button == nil
|
# default_button = '{}' if default_button == nil
|
||||||
|
default_button = '' if default_button == nil
|
||||||
#Tk.ip_eval('eval {global '+@var.id+';'+@config+
|
#Tk.ip_eval('eval {global '+@var.id+';'+@config+
|
||||||
# 'set '+@var.id+' [tk_dialog '+
|
# 'set '+@var.id+' [tk_dialog '+
|
||||||
# @path+" "+@title+" {#{@message}} "+@bitmap+" "+
|
# @path+" "+@title+" {#{@message}} "+@bitmap+" "+
|
||||||
|
@ -176,9 +183,14 @@ class TkDialogObj < TkWindow
|
||||||
# @val = Tk.ip_eval('tk_dialog ' + @path + ' ' + @title +
|
# @val = Tk.ip_eval('tk_dialog ' + @path + ' ' + @title +
|
||||||
# ' {' + @message + '} ' + @bitmap + ' ' +
|
# ' {' + @message + '} ' + @bitmap + ' ' +
|
||||||
# String(default_button) + ' ' + @buttons.join(' ')).to_i
|
# String(default_button) + ' ' + @buttons.join(' ')).to_i
|
||||||
@val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' +
|
# @val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' +
|
||||||
@title + ' {' + @message + '} ' + @bitmap + ' ' +
|
# @title + ' {' + @message + '} ' + @bitmap + ' ' +
|
||||||
String(default_button) + ' ' + @buttons.join(' ')).to_i
|
# String(default_button) + ' ' + @buttons.join(' ')).to_i
|
||||||
|
@val = Tk.ip_eval(array2tk_list([
|
||||||
|
self.class::TkCommandNames[0],
|
||||||
|
@path, @title, @message, @bitmap,
|
||||||
|
String(default_button)
|
||||||
|
].concat(@buttons))).to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def value
|
def value
|
||||||
|
|
|
@ -35,6 +35,7 @@ module TkPalette
|
||||||
fail "2nd arg need to be Hash"
|
fail "2nd arg need to be Hash"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tk_call('global', "tkPalette")
|
||||||
colors.each{|key, value|
|
colors.each{|key, value|
|
||||||
begin
|
begin
|
||||||
if win.cget(key) == tk_call('set', "tkPalette(#{key})")
|
if win.cget(key) == tk_call('set', "tkPalette(#{key})")
|
||||||
|
|
|
@ -1545,14 +1545,15 @@ class TkVarAccess<TkVariable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
module Tk
|
module Tk
|
||||||
begin
|
begin
|
||||||
|
INTERP._invoke_without_enc('global', 'auto_path')
|
||||||
auto_path = INTERP._invoke('set', 'auto_path')
|
auto_path = INTERP._invoke('set', 'auto_path')
|
||||||
rescue
|
rescue => e
|
||||||
begin
|
begin
|
||||||
|
INTERP._invoke_without_enc('global', 'env')
|
||||||
auto_path = INTERP._invoke('set', 'env(TCLLIBPATH)')
|
auto_path = INTERP._invoke('set', 'env(TCLLIBPATH)')
|
||||||
rescue
|
rescue => e
|
||||||
auto_path = Tk::LIBRARY
|
auto_path = Tk::LIBRARY
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -78,7 +78,8 @@ BLT 2.4z http://sourceforge.net/projects/blt
|
||||||
(http://raa.ruby-lang.org/)
|
(http://raa.ruby-lang.org/)
|
||||||
==> blt
|
==> blt
|
||||||
|
|
||||||
TkTreeCtrl 1.1 http://tktreectrl.sourceforge.net/ ==> treectrl
|
TkTreeCtrl CVS/Hd(2005-03-25)
|
||||||
|
http://tktreectrl.sourceforge.net/ ==> treectrl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,10 +78,12 @@ class Tk::TreeCtrl::NotifyEvent
|
||||||
[ ?I, ?n, :id ],
|
[ ?I, ?n, :id ],
|
||||||
[ ?l, ?n, :lower_bound ],
|
[ ?l, ?n, :lower_bound ],
|
||||||
[ ?p, ?n, :active_id ],
|
[ ?p, ?n, :active_id ],
|
||||||
|
[ ?P, ?e, :pattern ],
|
||||||
[ ?S, ?l, :sel_items ],
|
[ ?S, ?l, :sel_items ],
|
||||||
[ ?T, ?w, :widget ],
|
[ ?T, ?w, :widget ],
|
||||||
[ ?u, ?n, :upper_bound ],
|
[ ?u, ?n, :upper_bound ],
|
||||||
[ ?W, ?o, :object ],
|
[ ?W, ?o, :object ],
|
||||||
|
[ ??, ?x, :parm_info ],
|
||||||
nil
|
nil
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -106,6 +108,27 @@ class Tk::TreeCtrl::NotifyEvent
|
||||||
|
|
||||||
[ ?o, proc{|val| TkComm.tk_tcl2ruby(val)} ],
|
[ ?o, proc{|val| TkComm.tk_tcl2ruby(val)} ],
|
||||||
|
|
||||||
|
[ ?x, proc{|val|
|
||||||
|
begin
|
||||||
|
inf = {}
|
||||||
|
Hash[*(TkComm.list(val))].each{|k, v|
|
||||||
|
if keyinfo = KEY_TBL.assoc(k[0])
|
||||||
|
if cmd = PROC_TBL.assoc(keyinfo[1])
|
||||||
|
begin
|
||||||
|
new_v = cmd.call(v)
|
||||||
|
v = new_v
|
||||||
|
rescue
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
inf[k] = v
|
||||||
|
}
|
||||||
|
inf
|
||||||
|
rescue
|
||||||
|
val
|
||||||
|
end
|
||||||
|
} ],
|
||||||
|
|
||||||
nil
|
nil
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -434,12 +457,15 @@ module Tk::TreeCtrl::ConfigMethod
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_cget(win, pattern, option)
|
def notify_cget(win, pattern, option)
|
||||||
|
pattern = "<#{pattern}>"
|
||||||
itemconfigure(['notify', [win, pattern]], option)
|
itemconfigure(['notify', [win, pattern]], option)
|
||||||
end
|
end
|
||||||
def notify_configure(win, pattern, slot, value=None)
|
def notify_configure(win, pattern, slot, value=None)
|
||||||
|
pattern = "<#{pattern}>"
|
||||||
itemconfigure(['notify', [win, pattern]], slot, value)
|
itemconfigure(['notify', [win, pattern]], slot, value)
|
||||||
end
|
end
|
||||||
def notify_configinfo(win, pattern, slot=nil)
|
def notify_configinfo(win, pattern, slot=nil)
|
||||||
|
pattern = "<#{pattern}>"
|
||||||
itemconfiginfo(['notify', [win, pattern]], slot)
|
itemconfiginfo(['notify', [win, pattern]], slot)
|
||||||
end
|
end
|
||||||
alias current_notify_configinfo notify_configinfo
|
alias current_notify_configinfo notify_configinfo
|
||||||
|
@ -485,7 +511,7 @@ class Tk::TreeCtrl
|
||||||
def __boolval_optkeys
|
def __boolval_optkeys
|
||||||
[
|
[
|
||||||
'showbuttons', 'showheader', 'showlines', 'showroot',
|
'showbuttons', 'showheader', 'showlines', 'showroot',
|
||||||
'showrootbutton',
|
'showrootbutton', 'showrootlines',
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
private :__boolval_optkeys
|
private :__boolval_optkeys
|
||||||
|
@ -1089,7 +1115,7 @@ class Tk::TreeCtrl
|
||||||
end
|
end
|
||||||
|
|
||||||
#def notify_bind_append(obj, event, cmd=Proc.new, *args)
|
#def notify_bind_append(obj, event, cmd=Proc.new, *args)
|
||||||
# _bind([@path, 'notify', 'bind', obj], event, cmd, *args)
|
# _bind_append([@path, 'notify', 'bind', obj], event, cmd, *args)
|
||||||
# self
|
# self
|
||||||
#end
|
#end
|
||||||
def notify_bind_append(obj, event, *args)
|
def notify_bind_append(obj, event, *args)
|
||||||
|
@ -1099,7 +1125,7 @@ class Tk::TreeCtrl
|
||||||
else
|
else
|
||||||
cmd = Proc.new
|
cmd = Proc.new
|
||||||
end
|
end
|
||||||
_bind([@path, 'notify', 'bind', obj], event, cmd, *args)
|
_bind_append([@path, 'notify', 'bind', obj], event, cmd, *args)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1120,11 +1146,22 @@ class Tk::TreeCtrl
|
||||||
list(tk_send('notify', 'eventnames'))
|
list(tk_send('notify', 'eventnames'))
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_generate(pattern, char_map=None)
|
def notify_generate(pattern, char_map=None, percents_cmd=None)
|
||||||
tk_send('notify', 'generate', pattern, char_map)
|
pattern = "<#{pattern}>"
|
||||||
|
tk_send('notify', 'generate', pattern, char_map, percents_cmd)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def notify_install(pattern, percents_cmd=nil, &b)
|
||||||
|
pattern = "<#{pattern}>"
|
||||||
|
percents_cmd = Proc.new(&b) if !percents_cmd && b
|
||||||
|
if percents_cmd
|
||||||
|
procedure(tk_send('notify', 'install', pattern, percents_cmd))
|
||||||
|
else
|
||||||
|
procedure(tk_send('notify', 'install', pattern))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def notify_install_detail(event, detail, percents_cmd=nil, &b)
|
def notify_install_detail(event, detail, percents_cmd=nil, &b)
|
||||||
percents_cmd = Proc.new(&b) if !percents_cmd && b
|
percents_cmd = Proc.new(&b) if !percents_cmd && b
|
||||||
if percents_cmd
|
if percents_cmd
|
||||||
|
@ -1143,8 +1180,36 @@ class Tk::TreeCtrl
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_linkage(event, detail=None)
|
def notify_linkage(pattern, detail=None)
|
||||||
tk_send('notify', 'linkage', event, detail)
|
if detail != None
|
||||||
|
tk_send('notify', 'linkage', pattern, detail)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if pattern.to_s.index(?-)
|
||||||
|
# TreeCtrl 1.1 format?
|
||||||
|
begin
|
||||||
|
tk_send('notify', 'linkage', "<#{pattern}>")
|
||||||
|
rescue
|
||||||
|
# TreeCtrl 1.0?
|
||||||
|
tk_send('notify', 'linkage', pattern)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# TreeCtrl 1.0 format?
|
||||||
|
begin
|
||||||
|
tk_send('notify', 'linkage', pattern)
|
||||||
|
rescue
|
||||||
|
# TreeCtrl 1.1?
|
||||||
|
tk_send('notify', 'linkage', "<#{pattern}>")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def notify_uninstall(pattern)
|
||||||
|
pattern = "<#{pattern}>"
|
||||||
|
tk_send('notify', 'uninstall', pattern)
|
||||||
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
def notify_uninstall_detail(event, detail)
|
def notify_uninstall_detail(event, detail)
|
||||||
|
@ -1884,6 +1949,9 @@ module Tk::TreeCtrl::BindCallback
|
||||||
end
|
end
|
||||||
|
|
||||||
class << Tk::TreeCtrl::BindCallback
|
class << Tk::TreeCtrl::BindCallback
|
||||||
|
def percentsCmd(*args)
|
||||||
|
tk_call('::TreeCtrl::PercentsCmd', *args)
|
||||||
|
end
|
||||||
def cursorCheck(w, x, y)
|
def cursorCheck(w, x, y)
|
||||||
tk_call('::TreeCtrl::CursorCheck', w, x, y)
|
tk_call('::TreeCtrl::CursorCheck', w, x, y)
|
||||||
end
|
end
|
||||||
|
@ -1999,7 +2067,7 @@ class << Tk::TreeCtrl::BindCallback
|
||||||
end
|
end
|
||||||
|
|
||||||
def entryOpen(w, item, col, elem)
|
def entryOpen(w, item, col, elem)
|
||||||
tk_call('::::TreeCtrl::EntryOpen', w, item, col, elem)
|
tk_call('::TreeCtrl::EntryOpen', w, item, col, elem)
|
||||||
end
|
end
|
||||||
def entryExpanderOpen(w, item, col, elem)
|
def entryExpanderOpen(w, item, col, elem)
|
||||||
tk_call('::TreeCtrl::EntryExpanderOpen', w, item, col, elem)
|
tk_call('::TreeCtrl::EntryExpanderOpen', w, item, col, elem)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue