diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib index 2a8eefac09..5f1acaae0d 100644 --- a/ext/tk/ChangeLog.tkextlib +++ b/ext/tk/ChangeLog.tkextlib @@ -1,13 +1,21 @@ -2005-04-07 Hidetoshi NAGAI +2005-04-08 ocean - * lib/treectrl/tktreectrl.rb: performance tuning. (call tk_send_without_enc - if possible) + * sample/tkextlib/treectrl/*.rb: fixed typo. (wrong itemheight) + +2005-04-08 Hidetoshi NAGAI + + * sample/demos-{en,jp}/goldberg.rb: reduced canvas size. [ruby-dev:25992] 2005-04-07 ocean * sample/tkextlib/treectrl/*.rb: some speed up... cache the result of version checking. +2005-04-07 Hidetoshi NAGAI + + * lib/treectrl/tktreectrl.rb: performance tuning. (call tk_send_without_enc + if possible) [ruby-dev:25997] + 2005-04-04 ocean * lib/tkextlib/tktable/tktable.rb: added Tk::TkTable#selection_present. diff --git a/ext/tk/sample/demos-en/goldberg.rb b/ext/tk/sample/demos-en/goldberg.rb index dd1d979025..8d3f6d14f7 100644 --- a/ext/tk/sample/demos-en/goldberg.rb +++ b/ext/tk/sample/demos-en/goldberg.rb @@ -54,6 +54,7 @@ $goldberg_demo = TkToplevel.new {|w| # positionWindow(w) } +=begin # label msg = TkLabel.new($goldberg_demo) { font 'Arial 10' @@ -62,7 +63,9 @@ msg = TkLabel.new($goldberg_demo) { text "This is a demonstration of just how complex you can make your animations become. Click the ball to start things moving!\n\n\"Man will always find a difficult means to perform a simple task\"\n - Rube Goldberg" } msg.pack('side'=>'top') +=end +=begin # frame TkFrame.new($goldberg_demo) {|frame| TkButton.new(frame) { @@ -80,6 +83,7 @@ TkFrame.new($goldberg_demo) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') +=end ######################################### @@ -159,7 +163,7 @@ class TkGoldberg_Demo :relief=>:raised).pack(:side=>:left, :fill=>:both, :expand=>true) - @canvas = TkCanvas.new(@parent, :width=>860, :height=>730, + @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, :bg=>@C['bg'], :highlightthickness=>0){ scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up yview_moveto(0.05) @@ -171,9 +175,34 @@ class TkGoldberg_Demo do_ctrl_frame do_detail_frame - @show = TkButton.new(@parent, :text=>'>>', :command=>proc{show_ctrl}, + msg = TkLabel.new(@parent, :bg=>@C['bg'], :fg=>'white') { + font 'Arial 10' + wraplength 600 + justify 'left' + text "This is a demonstration of just how complex you can make your animations become. Click the ball to start things moving!\n\"Man will always find a difficult means to perform a simple task\" - Rube Goldberg" + } + msg.place(:in=>@canvas, :relx=>0, :rely=>0, :anchor=>:nw) + + frame = TkFrame.new(@parent, :bg=>@C['bg']) + + TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) { + text 'Dismiss' + command proc{ + tmppath = $goldberg_demo + $goldberg_demo = nil + tmppath.destroy + } + }.pack('side'=>'left') + + TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) { + text 'See Code' + command proc{showCode 'goldberg'} + }.pack('side'=>'left', 'padx'=>5) + + @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, :bg=>@C['bg'], :activebackground=>@C['bg']) - @show.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) + @show.pack('side'=>'left') + frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) Tk.update end @@ -364,7 +393,9 @@ class TkGoldberg_Demo end def about - msg = "#{@S['title']}\nby Keith Vetter, March 2003\n(Reproduced by kind permission of the author)\n\n" + msg = "Ruby/Tk Version ::\nby Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)\n\n" + msg += "Original Version ::\n" + msg += "#{@S['title']}\nby Keith Vetter, March 2003\n(Reproduced by kind permission of the author)\n\n" msg += "Man will always find a difficult means to perform a simple task" msg += "\nRube Goldberg" Tk.messageBox(:message=>msg, :title=>'About') @@ -1748,7 +1779,7 @@ class TkGoldberg_Demo if step >= 3 @canvas.delete('I24', 'I26') - TkcText.new(@canvas, 430, 755, :anchor=>:s, :tag=>'I26', + TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26', :text=>'click to continue', :font=>['Times Roman', 24, :bold]) @canvas.bind('1', proc{reset}) diff --git a/ext/tk/sample/demos-jp/goldberg.rb b/ext/tk/sample/demos-jp/goldberg.rb index 4f4dfc222d..d42d8ea583 100644 --- a/ext/tk/sample/demos-jp/goldberg.rb +++ b/ext/tk/sample/demos-jp/goldberg.rb @@ -54,6 +54,7 @@ $goldberg_demo = TkToplevel.new {|w| # positionWindow(w) } +=begin # label msg = TkLabel.new($goldberg_demo) { font 'Arial 10' @@ -62,7 +63,9 @@ msg = TkLabel.new($goldberg_demo) { text "これは、あなたが自分のアニメーションをいかに入り組んだものにできるかを示すというだけのためのデモです。ボールをクリックすれば物が動き始めます!\n\n\"Man will always find a difficult means to perform a simple task\"\n - Rube Goldberg" } msg.pack('side'=>'top') +=end +=begin # frame TkFrame.new($goldberg_demo) {|frame| TkButton.new(frame) { @@ -80,6 +83,7 @@ TkFrame.new($goldberg_demo) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') +=end ######################################### @@ -160,7 +164,7 @@ class TkGoldberg_Demo :relief=>:raised).pack(:side=>:left, :fill=>:both, :expand=>true) - @canvas = TkCanvas.new(@parent, :width=>860, :height=>730, + @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, :bg=>@C['bg'], :highlightthickness=>0){ scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up yview_moveto(0.05) @@ -172,9 +176,34 @@ class TkGoldberg_Demo do_ctrl_frame do_detail_frame - @show = TkButton.new(@parent, :text=>'>>', :command=>proc{show_ctrl}, + msg = TkLabel.new(@parent, :bg=>@C['bg'], :fg=>'white') { + font 'Arial 10' + wraplength 600 + justify 'left' + text "これは、あなたが自分のアニメーションをいかに入り組んだものにできるかを示すというだけのためのデモです。ボールをクリックすれば物が動き始めます!\n\"Man will always find a difficult means to perform a simple task\" - Rube Goldberg" + } + msg.place(:in=>@canvas, :relx=>0, :rely=>0, :anchor=>:nw) + + frame = TkFrame.new(@parent, :bg=>@C['bg']) + + TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) { + text '閉じる' + command proc{ + tmppath = $goldberg_demo + $goldberg_demo = nil + tmppath.destroy + } + }.pack('side'=>'left') + + TkButton.new(frame, :bg=>@C['bg'], :activebackground=>@C['bg']) { + text 'コード参照' + command proc{showCode 'goldberg'} + }.pack('side'=>'left', 'padx'=>5) + + @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, :bg=>@C['bg'], :activebackground=>@C['bg']) - @show.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) + @show.pack('side'=>'left') + frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) Tk.update end @@ -1753,7 +1782,7 @@ class TkGoldberg_Demo if step >= 3 @canvas.delete('I24', 'I26') - TkcText.new(@canvas, 430, 755, :anchor=>:s, :tag=>'I26', + TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26', #:text=>'click to continue', :text=>'クリックでリセットします', :font=>['Times Roman', 24, :bold]) diff --git a/ext/tk/sample/tkextlib/treectrl/explorer.rb b/ext/tk/sample/tkextlib/treectrl/explorer.rb index 8ee002ef9e..8398cac199 100644 --- a/ext/tk/sample/tkextlib/treectrl/explorer.rb +++ b/ext/tk/sample/tkextlib/treectrl/explorer.rb @@ -46,8 +46,8 @@ end # Demo: explorer files # def demoExplorerDetails(t) - height = t.font.metrics(:linespace) + 2 - hehght = 18 if height < 18 + height = t.font.metrics(:linespace) + height = 18 if height < 18 t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:extended, diff --git a/ext/tk/sample/tkextlib/treectrl/help.rb b/ext/tk/sample/tkextlib/treectrl/help.rb index 7962a384cc..4acd9c7382 100644 --- a/ext/tk/sample/tkextlib/treectrl/help.rb +++ b/ext/tk/sample/tkextlib/treectrl/help.rb @@ -2,8 +2,8 @@ # Demo: Help contents # def demoHelpContents(t) - height = t.font.metrics(:linespace) + 2 - hehght = 18 if height < 18 + height = t.font.metrics(:linespace) + height = 18 if height < 18 t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) @@ -140,8 +140,8 @@ end # This is an alternate implementation that does not define a new item state # to change the appearance of the item under the cursor. def demoHelpContents2(t) - height = t.font.metrics(:linespace) + 2 - hehght = 18 if height < 18 + height = t.font.metrics(:linespace) + height = 18 if height < 18 t.configure(:showroot=>false, :showbuttons=>false, :showlines=>false, :itemheight=>height, :selectmode=>:browse) diff --git a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb index 615c9b2b36..b2f5f45759 100644 --- a/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb +++ b/ext/tk/sample/tkextlib/treectrl/outlook-newgroup.rb @@ -4,8 +4,8 @@ def demoOutlookNewsgroup(t) init_pics('outlook-*') - height = t.font.metrics(:linespace) + 2 - hehght = 18 if height < 18 + height = t.font.metrics(:linespace) + height = 18 if height < 18 t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, :showroot=>false, :showrootbutton=>false, :showbuttons=>true) @@ -206,8 +206,8 @@ end def demoOutlookNewsgroup2(t) init_pics('outlook-*') - height = t.font.metrics(:linespace) + 2 - hehght = 18 if height < 18 + height = t.font.metrics(:linespace) + height = 18 if height < 18 t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false, :showroot=>false, :showrootbutton=>false, :showbuttons=>true) diff --git a/ext/tk/sample/tkextlib/treectrl/random.rb b/ext/tk/sample/tkextlib/treectrl/random.rb index d952d476b2..f9a38b0d8b 100644 --- a/ext/tk/sample/tkextlib/treectrl/random.rb +++ b/ext/tk/sample/tkextlib/treectrl/random.rb @@ -9,8 +9,8 @@ end def demoRandom(t) init_pics('folder-*', 'small-*') - height = t.font.metrics(:linespace) + 2 - hehght = 18 if height < 18 + height = t.font.metrics(:linespace) + height = 18 if height < 18 t.configure(:itemheight=>height, :selectmode=>:extended, :showroot=>true, :showrootbutton=>true, :showbuttons=>true, :showlines=>true, :scrollmargin=>16,