* sample/tkextlib/treectrl/*.rb: fixed typo. (wrong itemheight)

* sample/demos-{en,jp}/goldberg.rb: reduced canvas size. [ruby-dev:25992]
   (written by Hidetoshi NAGAI)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ocean 2005-04-07 16:53:56 +00:00
parent 051399c46f
commit 231e7ac939
7 changed files with 92 additions and 24 deletions

View File

@ -1,13 +1,21 @@
2005-04-07 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
2005-04-08 ocean <ocean@ruby-lang.org>
* 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 <nagai@ai.kyutech.ac.jp>
* sample/demos-{en,jp}/goldberg.rb: reduced canvas size. [ruby-dev:25992]
2005-04-07 ocean <ocean@ruby-lang.org>
* sample/tkextlib/treectrl/*.rb: some speed up... cache the result of
version checking.
2005-04-07 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* lib/treectrl/tktreectrl.rb: performance tuning. (call tk_send_without_enc
if possible) [ruby-dev:25997]
2005-04-04 ocean <ocean@ruby-lang.org>
* lib/tkextlib/tktable/tktable.rb: added Tk::TkTable#selection_present.

View File

@ -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})

View File

@ -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])

View File

@ -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,

View File

@ -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)

View File

@ -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)

View File

@ -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,