diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-18 22:37:53 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-18 22:37:53 +0000 |
commit | cd30677dab443c79750b46c29c69e5b865f9240b (patch) | |
tree | fe0d91b955fc034d76297380f5a152d05531ee5d /ext/tk/lib | |
parent | 63fe6ca5a08c371bac75d5a40ad008b61d99c6b5 (diff) |
* ext/tk/lib/tk/font.rb: remove dependency on Ruby's version (1.8 or 1.9).
* ext/tk/lib/tkextlib/ICONS/icons.rb: ditto.
* ext/tk/sample/tkextlib/treectrl/demo.rb: ditto.
* ext/tk/lib/tk.rb: update RELEASE_DATE
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib')
-rw-r--r-- | ext/tk/lib/tk.rb | 2 | ||||
-rw-r--r-- | ext/tk/lib/tk/font.rb | 27 | ||||
-rw-r--r-- | ext/tk/lib/tkextlib/ICONS/icons.rb | 22 |
3 files changed, 32 insertions, 19 deletions
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 3e6c0c0a04..0d18882d8c 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -4499,7 +4499,7 @@ end #Tk.freeze module Tk - RELEASE_DATE = '2005-11-18'.freeze + RELEASE_DATE = '2005-11-19'.freeze autoload :AUTO_PATH, 'tk/variable' autoload :TCL_PACKAGE_PATH, 'tk/variable' diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb index 8e63558cae..f7ea973a71 100644 --- a/ext/tk/lib/tk/font.rb +++ b/ext/tk/lib/tk/font.rb @@ -488,6 +488,19 @@ class TkFont create_compoundfont(ltn, knj, keys) end + def initialize_copy(font) + unless font.kind_of?(TkFont) + fail TypeError, '"initialize_copy should take same class object' + end + if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY + keys = {} + font.configinfo.each{|key,value| keys[key] = value } + initialize(font.latin_font_id, font.kanji_font_id, keys) + else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY + initialize(font.latin_font_id, font.kanji_font_id, font.configinfo) + end + end + def _get_font_info_from_hash(font) font = _symbolkey2str(font) foundry = (info = font['foundry'] .to_s)? info: '*' @@ -1184,24 +1197,12 @@ class TkFont ################################### =begin def dup - src = self - obj = super() - obj.instance_eval{ initialize(src) } - obj - end - def clone - src = self - obj = super() - obj.instance_eval{ initialize(src) } - obj - end -=end - def dup TkFont.new(self) end def clone TkFont.new(self) end +=end end module TkFont::CoreMethods diff --git a/ext/tk/lib/tkextlib/ICONS/icons.rb b/ext/tk/lib/tkextlib/ICONS/icons.rb index 8a37e35ebf..b430bae55d 100644 --- a/ext/tk/lib/tkextlib/ICONS/icons.rb +++ b/ext/tk/lib/tkextlib/ICONS/icons.rb @@ -75,14 +75,26 @@ module Tk ########################################## - def self.new(name, keys=nil) - unless obj = Tk_IMGTBL["::icon::#{name}"] - obj = allocate() - obj.instance_eval{initialize(name, keys)} + class << self + alias _new new + + def new(name, keys=nil) + if obj = Tk_IMGTBL["::icon::#{name}"] + if keys + keys = _symbolkey2str(keys) + unless keys.delete('without_creating') + tk_call('::icons::icons', 'create', *(hash_kv(keys) << obj.name)) + end + end + else + obj = _new(name, keys) + end + obj end - obj end + ########################################## + def initialize(name, keys=nil) if name.kind_of?(String) && name =~ /^::icon::(.+)$/ @name = $1 |