1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* sample/tkextlib/iwidgets/sample/hierarchy.rb: show basename

only [ruby-dev:25970]
* sample/tkextlib/treectrl/demo.rb: add check for existence of
  'backgroundimage' option.
* sample/tkextlib/treectrl/bitmaps.rb: ditto.
* sample/tkextlib/treectrl/outlook-newgroup.rb: lack of '%I'
  event callback argument.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2005-03-31 05:55:35 +00:00
parent 0a57886cca
commit 78711606b3
5 changed files with 63 additions and 10 deletions

View file

@ -1,3 +1,16 @@
2005-03-31 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* sample/tkextlib/iwidgets/sample/hierarchy.rb: show basename
only [ruby-dev:25970]
* sample/tkextlib/treectrl/demo.rb: add check for existence of
'backgroundimage' option.
* sample/tkextlib/treectrl/bitmaps.rb: ditto.
* sample/tkextlib/treectrl/outlook-newgroup.rb: lack of '%I'
event callback argument.
2005-03-31 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* sample/tkextlib/iwidgets/sample/hierarchy.rb: fail to treat

View file

@ -6,7 +6,7 @@ def get_files(file)
dir = (file.empty?)? ENV['HOME'] : TkComm._fromUTF8(file)
Dir.chdir(dir) rescue return ''
Dir['*'].sort.collect{|f|
TkCore::INTERP._merge_tklist(TkComm._toUTF8(File.join(dir, f)))
[TkComm._toUTF8(File.join(dir, f)), TkComm._toUTF8(f)]
}
end

View file

@ -2,7 +2,8 @@
# Demo: Bitmaps
#
def demoBitmaps(t)
if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
#if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
if @has_bgimg
t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false,
:selectmode=>:browse, :orient=>:horizontal, :wrap=>'5 items',
:showheader=>false, :backgroundimage=>@images['sky'])

View file

@ -42,6 +42,20 @@ class TkTreeCtrl_demo
make_source_window()
make_menubar()
make_main_window()
if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
begin
@tree2[:backgroundimage]
@has_bgimg = true
rescue
@has_bgimg = false
end
else
@has_bgimg = false
end
####################
make_list_popup()
make_header_popup()
@ -328,7 +342,8 @@ class TkTreeCtrl_demo
[ 'Expand', [], nil, '', {:menu_config=>{:tearoff=>false}} ]
]
if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
# if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
if @has_bgimg
menuspec << \
[ 'Background Image',
[
@ -528,7 +543,8 @@ class TkTreeCtrl_demo
[:data, :display, :enable].each{|k|
@popup[:debug][k].value = w.debug_cget(k)
}
if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
# if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
if @has_bgimg
@popup[:bgimg].value = @images.key(w[:backgroundimage])
end
@popup[:bgmode].value = w[:backgroundmode]
@ -667,6 +683,8 @@ class TkTreeCtrl_demo
master = self
has_bgimg = @has_bgimg
scriptDir = @ScriptDir
thisPlatform = @thisPlatform
@ -687,6 +705,8 @@ class TkTreeCtrl_demo
@demo_scripts.instance_eval{
@master = master
@has_bgimg = has_bgimg
@display_styles_in_item = proc_disp_styles_in_item
@Priv = TkVarAccess.new('::TreeCtrl::Priv')
@ -712,7 +732,25 @@ class TkTreeCtrl_demo
private :_get_binding
def load_demo(file)
eval(IO.readlines(file).join, _get_binding())
puts "load \"#{file}\"" if $DEBUG
begin
eval(IO.readlines(file).join, _get_binding())
rescue Exception => e
bt = e.backtrace
if bt[0] =~ /^([^:]+):(\d+):/
errline = $2.to_i
else
raise e
end
if bt[1] =~ /^([^:]+):(\d+):/
bt.unshift("#{file}:#{errline - $2.to_i + 1}")
raise e
else
raise e
end
end
end
def init_pics(*args)
@ -1063,7 +1101,8 @@ class TkTreeCtrl_demo
end
# Restore some happy defaults to the demo list
if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
# if (TkPackage.vcompare(Tk::TreeCtrl.package_version, '1.1') >= 0)
if @has_bgimg
@tree2.configure(:orient=>:vertical, :wrap=>'',
:xscrollincrement=>0, :yscrollincrement=>0,
:itemheight=>0, :showheader=>true,

View file

@ -387,7 +387,7 @@ def demoOutlookNewsgroup2(t)
}, '%T')
t.notify_bind(t, 'Expand-after',
proc{|w|
proc{|w, i|
if @Messge[:read][i] && anyUnreadDescendants(t, i)
# read2 -> read
t.item_style_map(i, 'subject', 'read',
@ -400,10 +400,10 @@ def demoOutlookNewsgroup2(t)
t.item_style_map(i, 'size', 'read.w',
['text.unread', 'text.read'])
end
}, '%T')
}, '%T %I')
t.notify_bind(t, 'Collapse-after',
proc{|w|
proc{|w, i|
if @Messge[:read][i] && anyUnreadDescendants(t, i)
# read -> read2
t.item_style_map(i, 'subject', 'read2',
@ -416,7 +416,7 @@ def demoOutlookNewsgroup2(t)
t.item_style_map(i, 'size', 'unread.w',
['text.read', 'text.unread'])
end
}, '%T')
}, '%T %I')
(1...(msgCnt)).each{|i|
if rand(2) == 0