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>
|
||||
|
||||
* 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>
|
||||
|
||||
* lib/tkextlib/blt/component.rb: add TreeCtrl#legend_window_create().
|
||||
|
|
|
@ -4024,7 +4024,7 @@ end
|
|||
#Tk.freeze
|
||||
|
||||
module Tk
|
||||
RELEASE_DATE = '2005-03-30'.freeze
|
||||
RELEASE_DATE = '2005-04-02'.freeze
|
||||
|
||||
autoload :AUTO_PATH, 'tk/variable'
|
||||
autoload :TCL_PACKAGE_PATH, 'tk/variable'
|
||||
|
|
|
@ -47,8 +47,10 @@ autoload :TkConsole, 'tk/console'
|
|||
|
||||
autoload :TkDialog, 'tk/dialog'
|
||||
autoload :TkDialog2, 'tk/dialog'
|
||||
autoload :TkDialogObj, 'tk/dialog'
|
||||
autoload :TkWarning, 'tk/dialog'
|
||||
autoload :TkWarning2, 'tk/dialog'
|
||||
autoload :TkWarningObj, 'tk/dialog'
|
||||
|
||||
autoload :TkEntry, 'tk/entry'
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# tk/dialog.rb : create dialog boxes
|
||||
#
|
||||
require 'tk'
|
||||
require 'tk/variable.rb'
|
||||
|
||||
class TkDialogObj < TkWindow
|
||||
extend Tk
|
||||
|
@ -49,13 +50,14 @@ class TkDialogObj < TkWindow
|
|||
end
|
||||
}
|
||||
end
|
||||
@config = 'after idle {' + @config + '};' if @config != ""
|
||||
# @config = 'after idle {' + @config + '};' if @config != ""
|
||||
@config = array2tk_list['after', 'idle', @config] << ';' if @config != ""
|
||||
end
|
||||
private :_set_button_config
|
||||
|
||||
# initialize tk_dialog
|
||||
def create_self(keys)
|
||||
#@var = TkVariable.new
|
||||
# @var = TkVariable.new
|
||||
@val = nil
|
||||
|
||||
@title = title
|
||||
|
@ -82,7 +84,8 @@ class TkDialogObj < TkWindow
|
|||
@title = keys['title'] if keys.key? 'title'
|
||||
@message = keys['message'] if keys.key? 'message'
|
||||
@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'
|
||||
@buttons = keys['buttons'] if keys.key? 'buttons'
|
||||
|
||||
|
@ -95,9 +98,9 @@ class TkDialogObj < TkWindow
|
|||
@btnframe_config = keys['btnframe_config'] if keys.key? 'btnframe_config'
|
||||
end
|
||||
|
||||
if @title.include? ?\s
|
||||
@title = '{' + @title + '}'
|
||||
end
|
||||
#if @title.include? ?\s
|
||||
# @title = '{' + @title + '}'
|
||||
#end
|
||||
|
||||
if @buttons.kind_of?(Array)
|
||||
_set_button_config(@buttons.collect{|cfg|
|
||||
|
@ -109,6 +112,8 @@ class TkDialogObj < TkWindow
|
|||
@buttons = @buttons.keys
|
||||
end
|
||||
@buttons = tk_split_simplelist(@buttons) if @buttons.kind_of?(String)
|
||||
@buttons = [] unless @buttons
|
||||
=begin
|
||||
@buttons = @buttons.collect{|s|
|
||||
if s.kind_of?(Array)
|
||||
s = s.join(' ')
|
||||
|
@ -119,6 +124,7 @@ class TkDialogObj < TkWindow
|
|||
s
|
||||
end
|
||||
}
|
||||
=end
|
||||
|
||||
if @message_config.kind_of?(Hash)
|
||||
# @config << Kernel.format("%s.msg configure %s;",
|
||||
|
@ -167,7 +173,8 @@ class TkDialogObj < TkWindow
|
|||
else
|
||||
default_button = @default_button
|
||||
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+
|
||||
# 'set '+@var.id+' [tk_dialog '+
|
||||
# @path+" "+@title+" {#{@message}} "+@bitmap+" "+
|
||||
|
@ -176,9 +183,14 @@ class TkDialogObj < TkWindow
|
|||
# @val = Tk.ip_eval('tk_dialog ' + @path + ' ' + @title +
|
||||
# ' {' + @message + '} ' + @bitmap + ' ' +
|
||||
# String(default_button) + ' ' + @buttons.join(' ')).to_i
|
||||
@val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' +
|
||||
@title + ' {' + @message + '} ' + @bitmap + ' ' +
|
||||
String(default_button) + ' ' + @buttons.join(' ')).to_i
|
||||
# @val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' +
|
||||
# @title + ' {' + @message + '} ' + @bitmap + ' ' +
|
||||
# String(default_button) + ' ' + @buttons.join(' ')).to_i
|
||||
@val = Tk.ip_eval(array2tk_list([
|
||||
self.class::TkCommandNames[0],
|
||||
@path, @title, @message, @bitmap,
|
||||
String(default_button)
|
||||
].concat(@buttons))).to_i
|
||||
end
|
||||
|
||||
def value
|
||||
|
|
|
@ -35,6 +35,7 @@ module TkPalette
|
|||
fail "2nd arg need to be Hash"
|
||||
end
|
||||
|
||||
tk_call('global', "tkPalette")
|
||||
colors.each{|key, value|
|
||||
begin
|
||||
if win.cget(key) == tk_call('set', "tkPalette(#{key})")
|
||||
|
|
|
@ -1545,14 +1545,15 @@ class TkVarAccess<TkVariable
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
module Tk
|
||||
begin
|
||||
INTERP._invoke_without_enc('global', 'auto_path')
|
||||
auto_path = INTERP._invoke('set', 'auto_path')
|
||||
rescue
|
||||
rescue => e
|
||||
begin
|
||||
INTERP._invoke_without_enc('global', 'env')
|
||||
auto_path = INTERP._invoke('set', 'env(TCLLIBPATH)')
|
||||
rescue
|
||||
rescue => e
|
||||
auto_path = Tk::LIBRARY
|
||||
end
|
||||
end
|
||||
|
|
|
@ -78,7 +78,8 @@ BLT 2.4z http://sourceforge.net/projects/blt
|
|||
(http://raa.ruby-lang.org/)
|
||||
==> 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 ],
|
||||
[ ?l, ?n, :lower_bound ],
|
||||
[ ?p, ?n, :active_id ],
|
||||
[ ?P, ?e, :pattern ],
|
||||
[ ?S, ?l, :sel_items ],
|
||||
[ ?T, ?w, :widget ],
|
||||
[ ?u, ?n, :upper_bound ],
|
||||
[ ?W, ?o, :object ],
|
||||
[ ??, ?x, :parm_info ],
|
||||
nil
|
||||
]
|
||||
|
||||
|
@ -106,6 +108,27 @@ class Tk::TreeCtrl::NotifyEvent
|
|||
|
||||
[ ?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
|
||||
]
|
||||
|
||||
|
@ -434,12 +457,15 @@ module Tk::TreeCtrl::ConfigMethod
|
|||
end
|
||||
|
||||
def notify_cget(win, pattern, option)
|
||||
pattern = "<#{pattern}>"
|
||||
itemconfigure(['notify', [win, pattern]], option)
|
||||
end
|
||||
def notify_configure(win, pattern, slot, value=None)
|
||||
pattern = "<#{pattern}>"
|
||||
itemconfigure(['notify', [win, pattern]], slot, value)
|
||||
end
|
||||
def notify_configinfo(win, pattern, slot=nil)
|
||||
pattern = "<#{pattern}>"
|
||||
itemconfiginfo(['notify', [win, pattern]], slot)
|
||||
end
|
||||
alias current_notify_configinfo notify_configinfo
|
||||
|
@ -485,7 +511,7 @@ class Tk::TreeCtrl
|
|||
def __boolval_optkeys
|
||||
[
|
||||
'showbuttons', 'showheader', 'showlines', 'showroot',
|
||||
'showrootbutton',
|
||||
'showrootbutton', 'showrootlines',
|
||||
]
|
||||
end
|
||||
private :__boolval_optkeys
|
||||
|
@ -1089,7 +1115,7 @@ class Tk::TreeCtrl
|
|||
end
|
||||
|
||||
#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
|
||||
#end
|
||||
def notify_bind_append(obj, event, *args)
|
||||
|
@ -1099,7 +1125,7 @@ class Tk::TreeCtrl
|
|||
else
|
||||
cmd = Proc.new
|
||||
end
|
||||
_bind([@path, 'notify', 'bind', obj], event, cmd, *args)
|
||||
_bind_append([@path, 'notify', 'bind', obj], event, cmd, *args)
|
||||
self
|
||||
end
|
||||
|
||||
|
@ -1120,11 +1146,22 @@ class Tk::TreeCtrl
|
|||
list(tk_send('notify', 'eventnames'))
|
||||
end
|
||||
|
||||
def notify_generate(pattern, char_map=None)
|
||||
tk_send('notify', 'generate', pattern, char_map)
|
||||
def notify_generate(pattern, char_map=None, percents_cmd=None)
|
||||
pattern = "<#{pattern}>"
|
||||
tk_send('notify', 'generate', pattern, char_map, percents_cmd)
|
||||
self
|
||||
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)
|
||||
percents_cmd = Proc.new(&b) if !percents_cmd && b
|
||||
if percents_cmd
|
||||
|
@ -1143,8 +1180,36 @@ class Tk::TreeCtrl
|
|||
end
|
||||
end
|
||||
|
||||
def notify_linkage(event, detail=None)
|
||||
tk_send('notify', 'linkage', event, detail)
|
||||
def notify_linkage(pattern, detail=None)
|
||||
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
|
||||
|
||||
def notify_uninstall_detail(event, detail)
|
||||
|
@ -1884,6 +1949,9 @@ module Tk::TreeCtrl::BindCallback
|
|||
end
|
||||
|
||||
class << Tk::TreeCtrl::BindCallback
|
||||
def percentsCmd(*args)
|
||||
tk_call('::TreeCtrl::PercentsCmd', *args)
|
||||
end
|
||||
def cursorCheck(w, x, y)
|
||||
tk_call('::TreeCtrl::CursorCheck', w, x, y)
|
||||
end
|
||||
|
@ -1999,7 +2067,7 @@ class << Tk::TreeCtrl::BindCallback
|
|||
end
|
||||
|
||||
def entryOpen(w, item, col, elem)
|
||||
tk_call('::::TreeCtrl::EntryOpen', w, item, col, elem)
|
||||
tk_call('::TreeCtrl::EntryOpen', w, item, col, elem)
|
||||
end
|
||||
def entryExpanderOpen(w, item, col, elem)
|
||||
tk_call('::TreeCtrl::EntryExpanderOpen', w, item, col, elem)
|
||||
|
|
Loading…
Reference in a new issue