summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-02 08:02:39 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-04-02 08:02:39 +0000
commitcdd3e130f2acd8a35a0e1c684b0b51352a2541bc (patch)
treeed5762187fc6b916ab199c087366980738b8edf2 /ext/tk/lib/tk
parentd4d182578c2a6669f144a1fea1aff63f34a42172 (diff)
* 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/branches/ruby_1_8@8239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk')
-rw-r--r--ext/tk/lib/tk/autoload.rb2
-rw-r--r--ext/tk/lib/tk/dialog.rb32
-rw-r--r--ext/tk/lib/tk/palette.rb1
-rw-r--r--ext/tk/lib/tk/variable.rb7
4 files changed, 29 insertions, 13 deletions
diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb
index df884a0a30..73544e1d23 100644
--- a/ext/tk/lib/tk/autoload.rb
+++ b/ext/tk/lib/tk/autoload.rb
@@ -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'
diff --git a/ext/tk/lib/tk/dialog.rb b/ext/tk/lib/tk/dialog.rb
index 5b627d7c03..212226b4d4 100644
--- a/ext/tk/lib/tk/dialog.rb
+++ b/ext/tk/lib/tk/dialog.rb
@@ -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
diff --git a/ext/tk/lib/tk/palette.rb b/ext/tk/lib/tk/palette.rb
index f419822e4c..2b6fdf5d90 100644
--- a/ext/tk/lib/tk/palette.rb
+++ b/ext/tk/lib/tk/palette.rb
@@ -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})")
diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb
index 982182c2a8..cdf6441b6d 100644
--- a/ext/tk/lib/tk/variable.rb
+++ b/ext/tk/lib/tk/variable.rb
@@ -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