diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
commit | 287a34ae0dfc23e4158f67cb7783d239f202c368 (patch) | |
tree | 5e35d5b41aae961b37cf6632f60c42f51c7aa775 /ext/tk/sample/demos-jp/goldberg.rb | |
parent | 9b52ae2e6491bb5d6c59e1799449f6268baf6f89 (diff) | |
download | ruby-287a34ae0dfc23e4158f67cb7783d239f202c368.tar.gz |
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/demos-jp/goldberg.rb')
-rw-r--r-- | ext/tk/sample/demos-jp/goldberg.rb | 408 |
1 files changed, 204 insertions, 204 deletions
diff --git a/ext/tk/sample/demos-jp/goldberg.rb b/ext/tk/sample/demos-jp/goldberg.rb index a81c7ec70c..ea521b82ec 100644 --- a/ext/tk/sample/demos-jp/goldberg.rb +++ b/ext/tk/sample/demos-jp/goldberg.rb @@ -44,7 +44,7 @@ #>># lots of canvas create and move calls. if defined?($goldberg_demo) && $goldberg_demo - $goldberg_demo.destroy + $goldberg_demo.destroy $goldberg_demo = nil end @@ -103,7 +103,7 @@ class TkGoldberg_Demo @S['pause'] = TkVariable.new @S['details'] = TkVariable.new(true) - @S['mode'] = TkVariable.new(:MSTART, :symbol) + @S['mode'] = TkVariable.new(:MSTART, :symbol) # :MSTART, :MGO, :MPAUSE, :MSSTEP, :MBSTEP, :MDONE, :MDEBUG # 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 @@ -134,19 +134,19 @@ class TkGoldberg_Demo @XY = {} @XY6 = { - '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], + '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], '-5'=>[340, 190], '-6'=>[349, 177], '-7'=>[366, 177], '-8'=>[380, 176], - '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], - '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], - '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], - '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], - '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], - '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], - '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], - '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], - '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], - '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], - '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], + '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], + '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], + '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], + '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], + '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], + '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], + '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], + '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], + '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], + '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], + '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], '13,15'=>[376, 410], '13,16'=>[360, 403] } @@ -163,11 +163,11 @@ class TkGoldberg_Demo def do_display() @ctrl = TkFrame.new(@parent, :relief=>:ridge, :bd=>2, :padx=>5, :pady=>5) - @screen = TkFrame.new(@parent, :bd=>2, - :relief=>:raised).pack(:side=>:left, :fill=>:both, + @screen = TkFrame.new(@parent, :bd=>2, + :relief=>:raised).pack(:side=>:left, :fill=>:both, :expand=>true) - @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, + @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) @@ -206,8 +206,8 @@ class TkGoldberg_Demo command proc{showCode 'goldberg'} }.pack('side'=>'left', 'padx'=>5) - # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, - @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, + @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, :bg=>@C['bg'], :activebackground=>@C['bg']) @show.pack('side'=>'left') frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne) @@ -216,34 +216,34 @@ class TkGoldberg_Demo end def do_ctrl_frame - @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, + @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, :command=>proc{do_button(0)}) if font = @start['font'] @start.font(font.weight('bold')) end - @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, - :command=>proc{do_button(1)}, :relief=>:raised, + @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, + :command=>proc{do_button(1)}, :relief=>:raised, :variable=>@S['pause']) - @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, + @step = TkButton.new(@parent, :text=>'Single Step', :font=>font, :command=>proc{do_button(2)}) - @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, + @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, :command=>proc{do_button(4)}) - @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, + @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, :command=>proc{do_button(3)}) @details = TkFrame.new(@parent, :bd=>2, :relief=>:ridge) - @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, + @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, :relief=>:raised, :variable=>@S['details']) - @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], + @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], :justify=>:center) - @speed_scale = TkScale.new(@parent, :orient=>:horizontal, - :from=>1, :to=>10, :font=>font, - :variable=>@S['speed'], :bd=>2, + @speed_scale = TkScale.new(@parent, :orient=>:horizontal, + :from=>1, :to=>10, :font=>font, + :variable=>@S['speed'], :bd=>2, :relief=>:ridge, :showvalue=>false) - @about = TkButton.new(@parent, :text=>'About', + @about = TkButton.new(@parent, :text=>'About', :command=>proc{about}, :font=>font) Tk.grid(@start, :in=>@ctrl, :row=>0, :sticky=>:ew) @@ -271,17 +271,17 @@ class TkGoldberg_Demo def do_detail_frame @f_details = TkFrame.new(@details) - @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], + @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], :bd=>1, :relief=>:solid, :bg=>'white') Tk.grid(@label, '-', '-', '-', :sticky=>:ew, :row=>0) idx = 1 loop { break unless respond_to?("move#{idx}") - l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, + l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, :width=>2, :bd=>1, :relief=>:solid, :bg=>'white') @STEP[idx] = 0 - ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), + ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), :width=>5, :bd=>1, :relief=>:solid, :bg=>'white') row = (idx + 1)/2 col = ((idx + 1) & 1) * 2 @@ -385,7 +385,7 @@ class TkGoldberg_Demo who = who.to_i n = send("move#{who}") if (n & 1).nonzero? # This guy still alive - alive << who + alive << who end if (n & 2).nonzero? # Next guy is active alive << (who + 1) @@ -418,12 +418,12 @@ class TkGoldberg_Demo # START HERE! banner def draw0 color = @C['0'] - TkcText.new(@canvas, - # [579, 119], :text=>'START HERE!', - [558, 119], :text=>'ここからスタート!', - :fill=>color, :anchor=>:w, + TkcText.new(@canvas, + # [579, 119], :text=>'START HERE!', + [558, 119], :text=>'ここからスタート!', + :fill=>color, :anchor=>:w, :tag=>'I0', :font=>['Times Roman', 12, :italic, :bold]) - TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, + TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, :width=>5, :arrow=>:last, :arrowshape=>[18, 18, 5]) @canvas.itembind('I0', '1'){ start } end @@ -437,7 +437,7 @@ class TkGoldberg_Demo end pos = [ - [673, 119], [678, 119], [683, 119], [688, 119], + [673, 119], [678, 119], [683, 119], [688, 119], [693, 119], [688, 119], [683, 119], [678, 119] ] step = step % pos.length @@ -449,15 +449,15 @@ class TkGoldberg_Demo def draw1 color = @C['1a'] color2 = @C['1b'] - TkcPolygon.new(@canvas, - [ 844, 133, 800, 133, 800, 346, 820, 346, - 820, 168, 844, 168, 844, 133 ], + TkcPolygon.new(@canvas, + [ 844, 133, 800, 133, 800, 346, 820, 346, + 820, 168, 844, 168, 844, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcPolygon.new(@canvas, - [ 771, 133, 685, 133, 685, 168, 751, 168, - 751, 346, 771, 346, 771, 133 ], + TkcPolygon.new(@canvas, + [ 771, 133, 685, 133, 685, 168, 751, 168, + 751, 346, 771, 346, 771, 133 ], :width=>3, :fill=>color, :outline=>'') - TkcOval.new(@canvas, box(812, 122, 9), + TkcOval.new(@canvas, box(812, 122, 9), :tag=>'I1', :fill=>color2, :outline=>'') @canvas.itembind('I1', '1'){ start } @@ -466,9 +466,9 @@ class TkGoldberg_Demo def move1(step = nil) step = get_step(1, step) pos = [ - [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], - [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], - [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], + [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], + [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], + [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], [-100, -100] ] return 0 if step >= pos.length @@ -484,40 +484,40 @@ class TkGoldberg_Demo color = @C['2'] # Fulcrum - TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], + TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], :fill=>@C['fg'], :outline=>@C['fg']) # Strike box - TkcRectangle.new(@canvas, [628, 335, 660, 383], + TkcRectangle.new(@canvas, [628, 335, 660, 383], :fill=>'', :outline=>@C['fg']) (0..2).each{|y| yy = 335 + y*16 - TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) - TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', + TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', :anchor=>:nw, :foreground=>@C['fg']) } # Lever - TkcLine.new(@canvas, [702, 366, 798, 366], + TkcLine.new(@canvas, [702, 366, 798, 366], :fill=>@C['fg'], :width=>6, :tag=>'I2_0') # R strap - TkcLine.new(@canvas, [712, 363, 712, 355], + TkcLine.new(@canvas, [712, 363, 712, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_1') # L strap - TkcLine.new(@canvas, [705, 363, 705, 355], + TkcLine.new(@canvas, [705, 363, 705, 355], :fill=>@C['fg'], :width=>3, :tag=>'I2_2') # Match stick - TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], + TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], :fill=>@C['fg'], :width=>3, :tag=>'I2_3') # Match head - TkcPolygon.new(@canvas, - [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, - 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], + TkcPolygon.new(@canvas, + [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, + 671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], :fill=>color, :outline=>color, :tag=>'I2_4') end @@ -527,15 +527,15 @@ class TkGoldberg_Demo stages = [0, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 1] xy = [] xy[0] = [ - 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, + 686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, 662, 318, 662, 328, 671, 336 ] xy[1] = [ - 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, + 687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, 661, 327, 671, 335 ] xy[2] = [ - 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, + 686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, 666, 309, 660, 324, 672, 336 ] @@ -546,7 +546,7 @@ class TkGoldberg_Demo if step == 0 # Rotate the match beta = 20 - + ox, oy = anchor('I2_0', :s) # Where to pivot i = 0 @@ -571,23 +571,23 @@ class TkGoldberg_Demo xy = [ [602, 296], [577, 174], [518, 174] ] xy.each{|x, y| # 3 Pulleys - TkcOval.new(@canvas, box(x, y, 13), + TkcOval.new(@canvas, box(x, y, 13), :fill=>color, :outline=>@C['fg'], :width=>3) TkcOval.new(@canvas, box(x, y, 2), :fill=>@C['fg'], :outline=>@C['fg']) } # Wall to flame - TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', + TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', :width=>3, :fill=>@C['fg'], :smooth=>true) # Flame to pulley 1 - TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', + TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', :width=>3, :fill=>@C['fg'], :smooth=>true) - TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', + TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', :width=>3, :fill=>@C['fg'], :smooth=>true) # Pulley 1 half way to 2 - TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', + TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', :width=>3, :fill=>@C['fg']) # Pulley 1 other half to 2 @@ -597,26 +597,26 @@ class TkGoldberg_Demo TkcLine.new(@canvas, [577, 161, 518, 161], :width=>3, :fill=>@C['fg']) # Down to weight - TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', + TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', :width=>3, :fill=>@C['fg']) # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle x1, y1, x2, y2 = [515, 207, 495, 207] - TkcOval.new(@canvas, box(x1, y1, 6), + TkcOval.new(@canvas, box(x1, y1, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcOval.new(@canvas, box(x2, y2, 6), + TkcOval.new(@canvas, box(x2, y2, 6), :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, + TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, :tag=>'I3_', :fill=>color2, :outline=>color2) - - TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), + + TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), :smooth=>true, :tag=>'I3_', :fill=>color2, :outline=>color2) - TkcLine.new(@canvas, [500, 217, 511, 217], + TkcLine.new(@canvas, [500, 217, 511, 217], :tag=>'I3_', :fill=>color2, :width=>10) # Bottom weight target - TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], + TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], :tag=>'I3__', :fill=>@C['fg'], :joinstyle=>:miter, :width=>10) end @@ -659,7 +659,7 @@ class TkGoldberg_Demo } # Swing gate - TkcLine.new(@canvas, [518, 464, 518, 428], + TkcLine.new(@canvas, [518, 464, 518, 428], :tag=>'I4', :fill=>color, :width=>1) end @@ -686,7 +686,7 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3) xy = [ - 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, + 534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, 575, 452, 574, 454, 566, 456, 554, 456, 545, 456, 537, 454, 530, 452 ] TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_0'], :fill=>color) @@ -696,7 +696,7 @@ class TkGoldberg_Demo xy = box(540, 446, 2) # Eye xy = [540, 444, 541, 445, 541, 447, 540, 448, 538, 447, 538, 445] - TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], + TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], :outline=>'', :smooth=>true) xy = [538, 454, 535, 461] # Front leg @@ -716,9 +716,9 @@ class TkGoldberg_Demo step = get_step(5, step) pos = [ - [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], - [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], - [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], + [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], + [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], + [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], [422, 274, -30], [422, 260.5, -30, :x], [422.5, 248.5, -28], [425, 237] ] @@ -739,16 +739,16 @@ class TkGoldberg_Demo color = @C['6'] xy = [324, 130, 391, 204] # Ball holder xy = round_rect(xy, 10) - TkcPolygon.new(@canvas, xy, :smooth=>true, + TkcPolygon.new(@canvas, xy, :smooth=>true, :outline=>@C['fg'], :width=>3, :fill=>color) xy = [339, 204, 376, 253] # Below the ball holder - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>color, :tag=>'I6c') xy = box(346, 339, 28) TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') # Roter - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>80, :extent=>205) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, :start=>-41, :extent=>85) xy = box(346, 339, 15) # Center of rotor @@ -763,10 +763,10 @@ class TkGoldberg_Demo TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'') xy = [ - 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, + 368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, 352, 403, 352, 366 ] - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2) # Below rotor TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2) xy = box(275, 342, 7) # On/off rotor @@ -791,7 +791,7 @@ class TkGoldberg_Demo loc = -i color = colors[i] x, y = @XY6["#{loc}"] - TkcOval.new(@canvas, box(x, y, 5), + TkcOval.new(@canvas, box(x, y, 5), :fill=>color, :outline=>color, :tag=>"I6_b#{i}") } draw6a(12) # The wheel @@ -817,7 +817,7 @@ class TkGoldberg_Demo @canvas.move('I6_', -7, 0) if step == 1 # Poke a hole xy = [348, 226, 365, 240] - TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), + TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), :outline=>'') end return 1 @@ -857,24 +857,24 @@ class TkGoldberg_Demo def draw7 color = @C['7'] xy = [198, 306, 277, 374] # Box - TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, + TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :fill=>color, :tag=>'I7z') @canvas.lower('I7z') xy = [275, 343, 230, 349] - TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, + TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, :arrowshape=>[23, 23, 8], :width=>6) xy = [225, 324] # On button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 323] # On text font = ['Times Roman', 8] - TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, :fill=>@C['fg'], :font=>font) xy = [225, 350] # Off button x, y = xy TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg']) xy = [218, 349] # Off text - TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, + TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, :fill=>@C['fg'], :font=>font) end @@ -919,7 +919,7 @@ class TkGoldberg_Demo xy = [280, 209, 296, 248] TkcOval.new(@canvas, xy, :outline=>color, :fill=>color) xy = [ - 288, 249, 252, 249, 260, 240, 280, 234, + 288, 249, 252, 249, 260, 240, 280, 234, 296, 234, 316, 240, 324, 249, 288, 249 ] TkcPolygon.new(@canvas, xy, :fill=>color, :smooth=>true) @@ -928,16 +928,16 @@ class TkGoldberg_Demo TkcPolygon.new(@canvas, xy, :fill=>color) xy = [255, 206, 265, 234] # Fan blades - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 176, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I9_0') xy = [255, 206, 265, 220] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') xy = [255, 190, 265, 204] - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>1, :tag=>'I9_1') end @@ -962,17 +962,17 @@ class TkGoldberg_Demo color = @C['10a'] color2 = @C['10b'] xy = [191, 230, 233, 230, 233, 178, 191, 178] # Sail - TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], :tag=>'I10') xy = box(209, 204, 31) # Front - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = box(249, 204, 31) # Back - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, :style=>:pie, :start=>120, :extent=>120, :tag=>'I10') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>120, :extent=>120, :tag=>'I10') xy = [200, 171, 200, 249] # Mast @@ -992,10 +992,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(239, 262, 17) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>95, :extent=>103) xy = box(76, 266, 21) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>190) end @@ -1003,9 +1003,9 @@ class TkGoldberg_Demo step = get_step(10, step) pos = [ - [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], - [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], - [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], + [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], + [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], + [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], [116, 212], [111, 212] ] @@ -1032,21 +1032,21 @@ class TkGoldberg_Demo xy = [55, 504, 55, 591] # Bottom right side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(71, 460, 48) # Outer loop - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>110, :extent=>-290, :tag=>'I11i') xy = box(71, 460, 16) # Inner loop - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', :width=>3, :tag=>'I11i') TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['bg'], :width=>3) xy = [23, 264, 23, 591] # Left side TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = box(1, 266, 23) # Top left curve - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :extent=>90) xy = box(75, 235, 9) # The ball - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', :width=>3, :tag=>'I11') end @@ -1054,8 +1054,8 @@ class TkGoldberg_Demo step = get_step(11, step) pos = [ - [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], - [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], + [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], + [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], [100, 437], [65, 423], [-100, -100], [38, 505], [38, 527, :x], [38, 591] ] @@ -1069,11 +1069,11 @@ class TkGoldberg_Demo # Hand def draw12 xy = [ - 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, + 20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, 60, 590, 60, 610, 60, 610 ] xy.concat([60, 610, 65, 620, 60, 631]) # Thumb - xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, + xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, 56, 669, 50, 669, 50, 662, 50, 637]) y0 = 637 # Bumps for fingers @@ -1083,7 +1083,7 @@ class TkGoldberg_Demo x2 = x - 10 xy << x << y0 << x1 << y1 << x2 << y0 } - TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], :smooth=>true, :tag=>'I12', :width=>3) end @@ -1107,25 +1107,25 @@ class TkGoldberg_Demo ] radii = [2, 9, 9, 8, 5, 5, 2] - round_poly(@canvas, xy, radii, :width=>3, + round_poly(@canvas, xy, radii, :width=>3, :outline=>@C['fg'], :fill=>color) - round_poly(@canvas, xy2, radii, :width=>3, + round_poly(@canvas, xy2, radii, :width=>3, :outline=>@C['fg'], :fill=>color) xy = [56, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13') xy = [809, 677] x, y = xy - TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], + TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], :width=>3, :tag=>'I13R') xy = [112, 687] # Label - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [762, 687] - TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], + TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], :font=>['Times Roman', 12, :bold]) xy = [138, 663, 148, 636, 178, 636] # Paper guide @@ -1133,7 +1133,7 @@ class TkGoldberg_Demo xy = [732, 663, 722, 636, 692, 636] TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3) - sine([149, 688, 720, 688], 5, 15, + sine([149, 688, 720, 688], 5, 15, :tag=>'I13_s', :fill=>@C['fg'], :width=>3) end @@ -1163,17 +1163,17 @@ class TkGoldberg_Demo def draw14 color = @C['14'] xy = [102, 661, 113, 632, 130, 618] # Left paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_0') xy = [148, 629, 125, 640, 124, 662] # Right paper edge - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14L_1') draw14a('L') xy = [ 768.0, 662.5, 767.991316225, 662.433786215, 767.926187912, 662.396880171 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_0') @canvas.lower('I14R_0') # NB. these numbers are VERY sensitive, you must start with final size @@ -1181,7 +1181,7 @@ class TkGoldberg_Demo xy = [ 745.947897349, 662.428358855, 745.997829056, 662.452239237, 746.0, 662.5 ] - TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, + TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, :width=>3, :tag=>'I14R_1') @canvas.lower('I14R_1') end @@ -1194,11 +1194,11 @@ class TkGoldberg_Demo x3, y3, x4, y4, x5, y5 = xy2 zz = [ - x0, y0, x0, y0, xy, x2, y2, x2, y2, + x0, y0, x0, y0, xy, x2, y2, x2, y2, x3, y3, x3, y3, xy2, x5, y5, x5, y5 ].flatten @canvas.delete("I14#{side}") - TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, + TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, :fill=>color, :outline=>color, :width=>3) @canvas.lower("I14#{side}") end @@ -1251,7 +1251,7 @@ class TkGoldberg_Demo xy = [765, 557, 784, 583] TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2) - sine([658, 580, 765, 580], 3, 15, + sine([658, 580, 765, 580], 3, 15, :tag=>'I15_s', :fill=>@C['fg'], :width=>3) end @@ -1290,7 +1290,7 @@ class TkGoldberg_Demo xy = [722, 485, 791, 556] TkcRectangle.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3) xy = box(752, 515, 25) # Bell - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', :tag=>'I16b', :width=>2) xy = box(752, 515, 5) # Bell button TkcOval.new(@canvas, xy, :fill=>'black', :outline=>'black', :tag=>'I16b') @@ -1329,24 +1329,24 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3) xy = [664, 523, 717, 549] # Body - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :style=>:chord, :start=>128, :extent=>260, :tag=>'I17') xy = [709, 554, 690, 543] # Paw - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = [657, 544, 676, 555] - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, :tag=>'I17') xy = box(660, 535, 15) # Lower face - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, :start=>150, :extent=>240, :tag=>'I17_') - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:chord, :start=>150, :extent=>240, :tag=>'I17_') xy = [674, 529, 670, 513, 662, 521, 658, 521, 650, 513, 647, 529] # Ears TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') - TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, + TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, :tag=>['I17_', 'I17_c']) xy = [652, 542, 628, 539] # Whiskers TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') @@ -1356,23 +1356,23 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [668, 543, 687, 538] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 544, 688, 546] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [668, 547, 688, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>['I17_', 'I17_w']) xy = [649, 530, 654, 538, 659, 530] # Left eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [671, 530, 666, 538, 661, 530] # Right eye - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') xy = [655, 543, 660, 551, 665, 543] # Mouth - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :smooth=>true, :tag=>'I17') end @@ -1385,10 +1385,10 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = box(654, 530, 4) # Left eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') xy = box(666, 530, 4) # Right eye - TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', + TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', :tag=>'I17_') @canvas.move('I17_', 0, -20) # Move face up @@ -1398,19 +1398,19 @@ class TkGoldberg_Demo TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [ # Body - 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, - 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, + 675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, + 716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, 668, 527, 668, 527, 675, 522, 676, 517, 677, 512 ] - TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), - :outline=>@C['fg'], :width=>3, :smooth=>true, + TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), + :outline=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') xy = [716, 514, 716, 554] # Back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [694, 532, 694, 554] # 2nd back leg TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_') xy = [715, 514, 718, 506, 719, 495, 716, 488] # Tail - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :smooth=>true, :tag=>'I17_') @canvas.raise('I17w') # Make whiskers visible @@ -1439,14 +1439,14 @@ class TkGoldberg_Demo step = get_step(18, step) pos = [ - [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], + [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], [136, 506], [16, 506], [-100, -100] ] b = [] b[0] = [490, 502, 719, 507, 524, 512] # Band collapsing b[1] = [ - 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, + 491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, 553, 536, 538, 534, 532, 519, 529, 499 ] b[2] = [ @@ -1477,54 +1477,54 @@ class TkGoldberg_Demo color = @C['19'] xx = [[249, 181], [155, 118], [86, 55], [22, 0]] xx.each{|x1, x2| - TkcRectangle.new(@canvas, x1, 453, x2, 467, + TkcRectangle.new(@canvas, x1, 453, x2, 467, :fill=>color, :outline=>'', :tag=>'I19') - TkcLine.new(@canvas, x1, 453, x2, 453, + TkcLine.new(@canvas, x1, 453, x2, 453, :fill=>@C['fg'], :width=>1) # Pipe top - TkcLine.new(@canvas, x1, 467, x2, 467, + TkcLine.new(@canvas, x1, 467, x2, 467, :fill=>@C['fg'], :width=>1) # Pipe bottom } @canvas.raise('I11i') xy = box(168, 460, 16) # Bulge by the joint TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>21, :extent=>136) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>-21, :extent=>-130) xy = [249, 447, 255, 473] # First joint 26x6 TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1) xy = box(257, 433, 34) # Bend up - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>-91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 433, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>-92) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>-90) xy = box(257, 421, 34) # Bend left - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>0, :extent=>91) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(257, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>0, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>0, :extent=>90) xy = box(243, 421, 34) # Bend down - TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = box(243, 421, 20) - TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, :style=>:pie, :start=>90, :extent=>90) - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, :start=>90, :extent=>90) xy = [270, 427, 296, 433] # 2nd joint bottom @@ -1566,7 +1566,7 @@ class TkGoldberg_Demo pos = [451, 462, 473, 484, 496, 504, 513, 523, 532] freq = [20, 40, 40, 40, 40, 40, 40, 40, 40] pos = [ - [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], + [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], [504, 40], [513, 40], [523, 40], [532, 40, :x] ] return 0 if step >= pos.length @@ -1583,11 +1583,11 @@ class TkGoldberg_Demo color = @C['20'] @canvas.delete('I20') - sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], + sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], :width=>3, :fill=>color, :smooth=>true) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20a']) - TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, + TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, :fill=>color, :smooth=>1, :tag=>['I20', 'I20b']) @canvas.move('I20a', 8, 0) @canvas.move('I20b', 16, 0) @@ -1603,18 +1603,18 @@ class TkGoldberg_Demo xy = [245, 490, 237, 535] # Right side xy2 = [189, 535, 181, 490] # Left side - TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', + TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', :tag=>['I21', 'I21f']) TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21') TkcLine.new(@canvas, xy2, :fill=>@C['fg'], :width=>2, :tag=>'I21') xy = [182, 486, 244, 498] # Top - TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, :tag=>['I21', 'I21f']) - TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21t']) xy = [189, 532, 237, 540] # Bottom - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, :tag=>['I21', 'I21b']) end @@ -1637,7 +1637,7 @@ class TkGoldberg_Demo @canvas.itemconfigure('I21b', :fill=>@C['20']) @canvas.delete('I21w') - TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, + TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, :tag=>['I21', 'I21w'], :outline=>'', :fill=>@C['20']) @canvas.lower('I21w', 'I21') @canvas.raise('I21b') @@ -1673,21 +1673,21 @@ class TkGoldberg_Demo color3 = @C['23c'] xy = [185, 623, 253, 650] # Block - TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], + TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], :width=>2, :tag=>'I23a') xy = [187, 592, 241, 623] # Balloon TkcOval.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') - TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', + TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', :style=>:arc, :start=>12, :extent=>336) xy = [239, 604, 258, 589, 258, 625, 239, 610] # Balloon nozzle TkcPolygon.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b') TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23b') xy = [285, 611, 250, 603] # Dart body - TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 596, 249, 618, 264, 607, 249, 596] # Dart tail - TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], + TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], :width=>3, :tag=>'I23d') xy = [249, 607, 268, 607] # Dart detail TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d') @@ -1699,7 +1699,7 @@ class TkGoldberg_Demo step = get_step(23, step) pos = [ - [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], + [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], [487, 607], [587, 607], [687, 607], [787, 607], [-100, -100] ] @@ -1719,7 +1719,7 @@ class TkGoldberg_Demo def draw24 color = @C['24a'] xy = [366, 518, 462, 665] # Balloon - TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], + TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>3, :tag=>'I24') xy = [414, 666, 414, 729] # String TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I24') @@ -1728,16 +1728,16 @@ class TkGoldberg_Demo :width=>3, :tag=>'I24') xy = [387, 567, 390, 549, 404, 542] # Reflections - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [395, 568, 399, 554, 413, 547] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [403, 570, 396, 555, 381, 553] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') xy = [408, 564, 402, 547, 386, 545] - TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, + TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, :width=>2, :tag=>'I24') end @@ -1750,16 +1750,16 @@ class TkGoldberg_Demo if step == 0 @canvas.delete('I24') # Exploding balloon xy = [ - 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, - 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, - 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, - 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, + 347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, + 259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, + 436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, + 548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, 431, 441, 431, 440, 400, 502, 347, 465, 347, 465 ] - TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], + TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], :outline=>@C['24a'], :width=>10, :smooth=>true) msg = Tk.subst(@S['message'].value) - TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], + TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], :justify=>:center, :font=>['Times Roman', 18, :bold]) return 1 end @@ -1790,9 +1790,9 @@ class TkGoldberg_Demo if step >= 3 @canvas.delete('I24', 'I26') - TkcText.new(@canvas, 430, 735, :anchor=>:s, :tag=>'I26', - #:text=>'click to continue', - :text=>'クリックでリセットします', + TkcText.new(@canvas, 430, 735, :anchor=>:s, :tag=>'I26', + #:text=>'click to continue', + :text=>'クリックでリセットします', :font=>['Times Roman', 20, :bold]) @canvas.bind('1', proc{reset}) return 4 @@ -1972,11 +1972,11 @@ class TkGoldberg_Demo def sparkle(oxy, tag) xy = [ - [299, 283], [298, 302], [295, 314], [271, 331], + [299, 283], [298, 302], [295, 314], [271, 331], [239, 310], [242, 292], [256, 274], [281, 273] ] xy.each{|x, y| - TkcLine.new(@canvas, 271, 304, x, y, + TkcLine.new(@canvas, 271, 304, x, y, :fill=>'white', :width=>3, :tag=>tag) } move_abs(tag, oxy) |