~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to ext/tk/sample/demos-en/goldberg.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2010-07-31 17:08:39 UTC
  • mfrom: (1.1.4 upstream) (8.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100731170839-j034dmpdqt1cc4p6
Tags: 1.9.2~svn28788-1
* New release based on upstream snapshot from the 1.9.2 branch,
  after 1.9.2 RC2. That branch is (supposed to be) binary-compatible
  with the 1.9.1 branch.
  + Builds fine on i386. Closes: #580852.
* Upgrade to Standards-Version: 3.9.1. No changes needed.
* Updated generated incs.
* Patches that still need work:
  + Unclear status, need more investigation:
   090729_fix_Makefile_deps.dpatch
   090803_exclude_rdoc.dpatch
   203_adjust_base_of_search_path.dpatch
   902_define_YAML_in_yaml_stringio.rb.dpatch
   919_common.mk_tweaks.dpatch
   931_libruby_suffix.dpatch
   940_test_thread_mutex_sync_shorter.dpatch
  + Maybe not needed anymore, keeping but not applying.
   102_skip_test_copy_stream.dpatch (test doesn't block anymore?)
   104_skip_btest_io.dpatch (test doesn't block anymore?)
   201_gem_prelude.dpatch (we don't use that rubygems anyway?)
   202_gem_default_dir.dpatch (we don't use that rubygems anyway?)
   940_test_file_exhaustive_fails_as_root.dpatch
   940_test_priority_fails.dpatch
   100518_load_libc_libm.dpatch
* Add disable-tests.diff: disable some tests that cause failures on FreeBSD.
  Closes: #590002, #543805, #542927.
* However, many new failures on FreeBSD. Since that version is still an
  improvement, add the check that makes test suite failures non-fatal on
  FreeBSD again. That still needs to be investigated.
* Re-add 903_skip_base_ruby_check.dpatch
* Add build-dependency on ruby1.8 and drop all pre-generated files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#>># lots of canvas create and move calls.
44
44
 
45
45
if defined?($goldberg_demo) && $goldberg_demo
46
 
  $goldberg_demo.destroy 
 
46
  $goldberg_demo.destroy
47
47
  $goldberg_demo = nil
48
48
end
49
49
 
101
101
    @S['pause']   = TkVariable.new
102
102
    @S['details'] = TkVariable.new(true)
103
103
 
104
 
    @S['mode'] = TkVariable.new(:MSTART, :symbol) 
 
104
    @S['mode'] = TkVariable.new(:MSTART, :symbol)
105
105
    #            :MSTART, :MGO, :MPAUSE, :MSSTEP, :MBSTEP, :MDONE, :MDEBUG
106
106
 
107
107
    #         0,  1,  2,  3,  4,  5,   6,   7,   8,   9,  10
132
132
    @XY = {}
133
133
 
134
134
    @XY6 = {
135
 
      '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192], 
 
135
      '-1'=>[366, 207], '-2'=>[349, 204], '-3'=>[359, 193], '-4'=>[375, 192],
136
136
      '-5'=>[340, 190], '-6'=>[349, 177], '-7'=>[366, 177], '-8'=>[380, 176],
137
 
      '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164], 
138
 
      '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151], 
139
 
      '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219], 
140
 
      '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324], 
141
 
      '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346], 
142
 
      '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391], 
143
 
      '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456], 
144
 
      '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443], 
145
 
      '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437], 
146
 
      '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424], 
147
 
      '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412], 
 
137
      '-9'=>[332, 172], '-10'=>[342, 161], '-11'=>[357, 164],
 
138
      '-12'=>[372, 163], '-13'=>[381, 149], '-14'=>[364, 151],
 
139
      '-15'=>[349, 146], '-16'=>[333, 148], '0'=>[357, 219],
 
140
      '1'=>[359, 261], '2'=>[359, 291], '3'=>[359, 318], '4'=>[361, 324],
 
141
      '5'=>[365, 329], '6'=>[367, 334], '7'=>[367, 340], '8'=>[366, 346],
 
142
      '9'=>[364, 350], '10'=>[361, 355], '11'=>[359, 370], '12'=>[359, 391],
 
143
      '13,0'=>[360, 456], '13,1'=>[376, 456], '13,2'=>[346, 456],
 
144
      '13,3'=>[330, 456], '13,4'=>[353, 444], '13,5'=>[368, 443],
 
145
      '13,6'=>[339, 442], '13,7'=>[359, 431], '13,8'=>[380, 437],
 
146
      '13,9'=>[345, 428], '13,10'=>[328, 434], '13,11'=>[373, 424],
 
147
      '13,12'=>[331, 420], '13,13'=>[360, 417], '13,14'=>[345, 412],
148
148
      '13,15'=>[376, 410], '13,16'=>[360, 403]
149
149
    }
150
150
 
161
161
 
162
162
  def do_display()
163
163
    @ctrl = TkFrame.new(@parent, :relief=>:ridge, :bd=>2, :padx=>5, :pady=>5)
164
 
    @screen = TkFrame.new(@parent, :bd=>2, 
165
 
                         :relief=>:raised).pack(:side=>:left, :fill=>:both, 
 
164
    @screen = TkFrame.new(@parent, :bd=>2,
 
165
                         :relief=>:raised).pack(:side=>:left, :fill=>:both,
166
166
                                                :expand=>true)
167
167
 
168
 
    @canvas = TkCanvas.new(@parent, :width=>850, :height=>700, 
 
168
    @canvas = TkCanvas.new(@parent, :width=>850, :height=>700,
169
169
                          :bg=>@C['bg'], :highlightthickness=>0){
170
170
      scrollregion([0, 0, 1000, 1000]) # Kludge to move everything up
171
171
      yview_moveto(0.05)
204
204
      command proc{showCode 'goldberg'}
205
205
    }.pack('side'=>'left', 'padx'=>5)
206
206
 
207
 
    # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl}, 
208
 
    @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl}, 
 
207
    # @show = TkButton.new(frame, :text=>'>>', :command=>proc{show_ctrl},
 
208
    @show = Tk::Button.new(frame, :text=>'>>', :command=>proc{show_ctrl},
209
209
                         :bg=>@C['bg'], :activebackground=>@C['bg'])
210
210
    @show.pack('side'=>'left')
211
211
    frame.place(:in=>@canvas, :relx=>1, :rely=>0, :anchor=>:ne)
214
214
  end
215
215
 
216
216
  def do_ctrl_frame
217
 
    @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6, 
 
217
    @start = Tk::Button.new(@parent, :text=>'Start', :bd=>6,
218
218
                          :command=>proc{do_button(0)})
219
219
    if font = @start['font']
220
220
      @start.font(font.weight('bold'))
221
221
    end
222
222
 
223
 
    @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font, 
224
 
                               :command=>proc{do_button(1)}, :relief=>:raised, 
 
223
    @pause = TkCheckbutton.new(@parent, :text=>'Pause', :font=>font,
 
224
                               :command=>proc{do_button(1)}, :relief=>:raised,
225
225
                               :variable=>@S['pause'])
226
226
 
227
 
    @step  = TkButton.new(@parent, :text=>'Single Step', :font=>font, 
 
227
    @step  = TkButton.new(@parent, :text=>'Single Step', :font=>font,
228
228
                          :command=>proc{do_button(2)})
229
 
    @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font, 
 
229
    @bstep = TkButton.new(@parent, :text=>'Big Step', :font=>font,
230
230
                          :command=>proc{do_button(4)})
231
 
    @reset = TkButton.new(@parent, :text=>'Reset', :font=>font, 
 
231
    @reset = TkButton.new(@parent, :text=>'Reset', :font=>font,
232
232
                          :command=>proc{do_button(3)})
233
233
 
234
234
    @details = TkFrame.new(@parent, :bd=>2, :relief=>:ridge)
235
 
    @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font, 
 
235
    @detail = TkCheckbutton.new(@parent, :text=>'Details', :font=>font,
236
236
                               :relief=>:raised, :variable=>@S['details'])
237
237
 
238
 
    @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'], 
 
238
    @msg_entry = TkEntry.new(@parent, :textvariable=>@S['message'],
239
239
                             :justify=>:center)
240
 
    @speed_scale = TkScale.new(@parent, :orient=>:horizontal, 
241
 
                               :from=>1, :to=>10, :font=>font, 
242
 
                               :variable=>@S['speed'], :bd=>2, 
 
240
    @speed_scale = TkScale.new(@parent, :orient=>:horizontal,
 
241
                               :from=>1, :to=>10, :font=>font,
 
242
                               :variable=>@S['speed'], :bd=>2,
243
243
                               :relief=>:ridge, :showvalue=>false)
244
 
    @about = TkButton.new(@parent, :text=>'About', 
 
244
    @about = TkButton.new(@parent, :text=>'About',
245
245
                          :command=>proc{about}, :font=>font)
246
246
 
247
247
    Tk.grid(@start, :in=>@ctrl, :row=>0, :sticky=>:ew)
269
269
  def do_detail_frame
270
270
    @f_details = TkFrame.new(@details)
271
271
 
272
 
    @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'], 
 
272
    @label = TkLabel.new(@f_details, :textvariable=>@S['cnt'],
273
273
                         :bd=>1, :relief=>:solid, :bg=>'white')
274
274
    Tk.grid(@label, '-', '-', '-', :sticky=>:ew, :row=>0)
275
275
 
276
276
    idx = 1
277
277
    loop {
278
278
      break unless respond_to?("move#{idx}")
279
 
      l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e, 
 
279
      l = TkLabel.new(@f_details, :text=>idx, :anchor=>:e,
280
280
                      :width=>2, :bd=>1, :relief=>:solid, :bg=>'white')
281
281
      @STEP[idx] = 0
282
 
      ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx), 
 
282
      ll = TkLabel.new(@f_details, :textvariable=>@STEP.ref(idx),
283
283
                       :width=>5, :bd=>1, :relief=>:solid, :bg=>'white')
284
284
      row = (idx + 1)/2
285
285
      col = ((idx + 1) & 1) * 2
383
383
      who = who.to_i
384
384
      n = send("move#{who}")
385
385
      if (n & 1).nonzero?          # This guy still alive
386
 
        alive << who 
 
386
        alive << who
387
387
      end
388
388
      if (n & 2).nonzero?          # Next guy is active
389
389
        alive << (who + 1)
416
416
  # START HERE! banner
417
417
  def draw0
418
418
    color = @C['0']
419
 
    TkcText.new(@canvas, [579, 119], :text=>'START HERE!', 
420
 
                :fill=>color, :anchor=>:w, 
 
419
    TkcText.new(@canvas, [579, 119], :text=>'START HERE!',
 
420
                :fill=>color, :anchor=>:w,
421
421
                :tag=>'I0', :font=>['Times Roman', 12, :italic, :bold])
422
 
    TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color, 
 
422
    TkcLine.new(@canvas, [719, 119, 763, 119], :tag=>'I0', :fill=>color,
423
423
                :width=>5, :arrow=>:last, :arrowshape=>[18, 18, 5])
424
424
    @canvas.itembind('I0', '1'){ start }
425
425
  end
433
433
    end
434
434
 
435
435
    pos = [
436
 
      [673, 119], [678, 119], [683, 119], [688, 119], 
 
436
      [673, 119], [678, 119], [683, 119], [688, 119],
437
437
      [693, 119], [688, 119], [683, 119], [678, 119]
438
438
    ]
439
439
    step = step % pos.length
445
445
  def draw1
446
446
    color = @C['1a']
447
447
    color2 = @C['1b']
448
 
    TkcPolygon.new(@canvas, 
449
 
                   [ 844, 133, 800, 133, 800, 346, 820, 346, 
450
 
                     820, 168, 844, 168, 844, 133 ], 
451
 
                   :width=>3, :fill=>color, :outline=>'')
452
 
    TkcPolygon.new(@canvas, 
453
 
                   [ 771, 133, 685, 133, 685, 168, 751, 168, 
454
 
                     751, 346, 771, 346, 771, 133 ], 
455
 
                   :width=>3, :fill=>color, :outline=>'')
456
 
    TkcOval.new(@canvas, box(812, 122, 9), 
 
448
    TkcPolygon.new(@canvas,
 
449
                   [ 844, 133, 800, 133, 800, 346, 820, 346,
 
450
                     820, 168, 844, 168, 844, 133 ],
 
451
                   :width=>3, :fill=>color, :outline=>'')
 
452
    TkcPolygon.new(@canvas,
 
453
                   [ 771, 133, 685, 133, 685, 168, 751, 168,
 
454
                     751, 346, 771, 346, 771, 133 ],
 
455
                   :width=>3, :fill=>color, :outline=>'')
 
456
    TkcOval.new(@canvas, box(812, 122, 9),
457
457
                :tag=>'I1', :fill=>color2, :outline=>'')
458
458
 
459
459
    @canvas.itembind('I1', '1'){ start }
462
462
  def move1(step = nil)
463
463
    step = get_step(1, step)
464
464
    pos = [
465
 
      [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153], 
466
 
      [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438], 
467
 
      [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601], 
 
465
      [807, 122], [802, 122], [797, 123], [793, 124], [789, 129], [785, 153],
 
466
      [785, 203], [785, 278, :x], [785, 367], [810, 392], [816, 438],
 
467
      [821, 503], [824, 585, :y], [838, 587], [848, 593], [857, 601],
468
468
      [-100, -100]
469
469
    ]
470
470
    return 0 if step >= pos.length
480
480
    color = @C['2']
481
481
 
482
482
    # Fulcrum
483
 
    TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392], 
 
483
    TkcPolygon.new(@canvas, [750, 369, 740, 392, 760, 392],
484
484
                   :fill=>@C['fg'], :outline=>@C['fg'])
485
485
 
486
486
    # Strike box
487
 
    TkcRectangle.new(@canvas, [628, 335, 660, 383], 
 
487
    TkcRectangle.new(@canvas, [628, 335, 660, 383],
488
488
                     :fill=>'', :outline=>@C['fg'])
489
489
    (0..2).each{|y|
490
490
      yy = 335 + y*16
491
 
      TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25', 
 
491
      TkcBitmap.new(@canvas, [628, yy], :bitmap=>'gray25',
492
492
                    :anchor=>:nw, :foreground=>@C['fg'])
493
 
      TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25', 
 
493
      TkcBitmap.new(@canvas, [644, yy], :bitmap=>'gray25',
494
494
                    :anchor=>:nw, :foreground=>@C['fg'])
495
495
    }
496
496
 
497
497
    # Lever
498
 
    TkcLine.new(@canvas, [702, 366, 798, 366], 
 
498
    TkcLine.new(@canvas, [702, 366, 798, 366],
499
499
                :fill=>@C['fg'], :width=>6, :tag=>'I2_0')
500
500
 
501
501
    # R strap
502
 
    TkcLine.new(@canvas, [712, 363, 712, 355], 
 
502
    TkcLine.new(@canvas, [712, 363, 712, 355],
503
503
                :fill=>@C['fg'], :width=>3, :tag=>'I2_1')
504
504
 
505
505
    # L strap
506
 
    TkcLine.new(@canvas, [705, 363, 705, 355], 
 
506
    TkcLine.new(@canvas, [705, 363, 705, 355],
507
507
                :fill=>@C['fg'], :width=>3, :tag=>'I2_2')
508
508
 
509
509
    # Match stick
510
 
    TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356], 
 
510
    TkcLine.new(@canvas, [679, 356, 679, 360, 717, 360, 717, 356, 679, 356],
511
511
                :fill=>@C['fg'], :width=>3, :tag=>'I2_3')
512
512
 
513
513
    # Match head
514
 
    TkcPolygon.new(@canvas, 
515
 
                   [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1, 
516
 
                     671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ], 
 
514
    TkcPolygon.new(@canvas,
 
515
                   [ 671, 352, 677.4, 353.9, 680, 358.5, 677.4, 363.1,
 
516
                     671, 365, 664.6, 363.1, 662, 358.5, 664.6, 353.9 ],
517
517
                   :fill=>color, :outline=>color, :tag=>'I2_4')
518
518
  end
519
519
 
523
523
    stages = [0, 0, 1, 2, 0, 2, 1, 0, 1, 2, 0, 2, 1]
524
524
    xy = []
525
525
    xy[0] = [
526
 
      686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307, 
 
526
      686, 333, 692, 323, 682, 316, 674, 309, 671, 295, 668, 307,
527
527
      662, 318, 662, 328, 671, 336
528
528
    ]
529
529
    xy[1] = [
530
 
      687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311, 
 
530
      687, 331, 698, 322, 703, 295, 680, 320, 668, 297, 663, 311,
531
531
      661, 327, 671, 335
532
532
    ]
533
533
    xy[2] = [
534
 
      686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298, 
 
534
      686, 331, 704, 322, 688, 300, 678, 283, 678, 283, 674, 298,
535
535
      666, 309, 660, 324, 672, 336
536
536
    ]
537
537
 
542
542
 
543
543
    if step == 0  # Rotate the match
544
544
      beta = 20
545
 
      
 
545
 
546
546
      ox, oy = anchor('I2_0', :s)  # Where to pivot
547
547
 
548
548
      i = 0
567
567
 
568
568
    xy = [ [602, 296], [577, 174], [518, 174] ]
569
569
    xy.each{|x, y| # 3 Pulleys
570
 
      TkcOval.new(@canvas, box(x, y, 13), 
 
570
      TkcOval.new(@canvas, box(x, y, 13),
571
571
                  :fill=>color, :outline=>@C['fg'], :width=>3)
572
572
      TkcOval.new(@canvas, box(x, y, 2), :fill=>@C['fg'], :outline=>@C['fg'])
573
573
    }
574
574
 
575
575
    # Wall to flame
576
 
    TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s', 
 
576
    TkcLine.new(@canvas, [750, 309, 670, 309], :tag=>'I3_s',
577
577
                :width=>3, :fill=>@C['fg'], :smooth=>true)
578
578
 
579
579
    # Flame to pulley 1
580
 
    TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0', 
 
580
    TkcLine.new(@canvas, [670, 309, 650, 309], :tag=>'I3_0',
581
581
                :width=>3, :fill=>@C['fg'], :smooth=>true)
582
 
    TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1', 
 
582
    TkcLine.new(@canvas, [650, 309, 600, 309], :tag=>'I3_1',
583
583
                :width=>3, :fill=>@C['fg'], :smooth=>true)
584
584
 
585
585
    # Pulley 1 half way to 2
586
 
    TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2', 
 
586
    TkcLine.new(@canvas, [589, 296, 589, 235], :tag=>'I3_2',
587
587
                :width=>3, :fill=>@C['fg'])
588
588
 
589
589
    # Pulley 1 other half to 2
593
593
    TkcLine.new(@canvas, [577, 161, 518, 161], :width=>3, :fill=>@C['fg'])
594
594
 
595
595
    # Down to weight
596
 
    TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w', 
 
596
    TkcLine.new(@canvas, [505, 174, 505, 205], :tag=>'I3_w',
597
597
                :width=>3, :fill=>@C['fg'])
598
598
 
599
599
    # Draw the weight as 2 circles, two rectangles and 1 rounded rectangle
600
600
    x1, y1, x2, y2 = [515, 207, 495, 207]
601
 
    TkcOval.new(@canvas, box(x1, y1, 6), 
602
 
                :tag=>'I3_', :fill=>color2, :outline=>color2)
603
 
    TkcOval.new(@canvas, box(x2, y2, 6), 
604
 
                :tag=>'I3_', :fill=>color2, :outline=>color2)
605
 
    TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6, 
 
601
    TkcOval.new(@canvas, box(x1, y1, 6),
 
602
                :tag=>'I3_', :fill=>color2, :outline=>color2)
 
603
    TkcOval.new(@canvas, box(x2, y2, 6),
 
604
                :tag=>'I3_', :fill=>color2, :outline=>color2)
 
605
    TkcRectangle.new(@canvas, x1, y1 - 6, x2, y2 + 6,
606
606
                     :tag=>'I3_', :fill=>color2, :outline=>color2)
607
 
    
608
 
    TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15), 
 
607
 
 
608
    TkcPolygon.new(@canvas, round_rect([492, 220, 518, 263], 15),
609
609
                   :smooth=>true, :tag=>'I3_', :fill=>color2, :outline=>color2)
610
610
 
611
 
    TkcLine.new(@canvas, [500, 217, 511, 217], 
 
611
    TkcLine.new(@canvas, [500, 217, 511, 217],
612
612
                :tag=>'I3_', :fill=>color2, :width=>10)
613
613
 
614
614
    # Bottom weight target
615
 
    TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465], 
 
615
    TkcLine.new(@canvas, [502, 393, 522, 393, 522, 465],
616
616
                :tag=>'I3__', :fill=>@C['fg'], :joinstyle=>:miter, :width=>10)
617
617
  end
618
618
 
655
655
    }
656
656
 
657
657
    # Swing gate
658
 
    TkcLine.new(@canvas, [518, 464, 518, 428], 
 
658
    TkcLine.new(@canvas, [518, 464, 518, 428],
659
659
                :tag=>'I4', :fill=>color, :width=>1)
660
660
  end
661
661
 
682
682
    TkcPolygon.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], :width=>3)
683
683
 
684
684
    xy = [
685
 
      534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446, 
 
685
      534.5, 445.5, 541, 440, 552, 436, 560, 436, 569, 440, 574, 446,
686
686
      575, 452, 574, 454, 566, 456, 554, 456, 545, 456, 537, 454, 530, 452
687
687
    ]
688
688
    TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_0'], :fill=>color)
692
692
 
693
693
    xy = box(540, 446, 2)   # Eye
694
694
    xy = [540, 444, 541, 445, 541, 447, 540, 448, 538, 447, 538, 445]
695
 
    TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'], 
 
695
    TkcPolygon.new(@canvas, xy, :tag=>['I5', 'I5_2'], :fill=>@C['bg'],
696
696
                   :outline=>'', :smooth=>true)
697
697
 
698
698
    xy = [538, 454, 535, 461] # Front leg
712
712
    step = get_step(5, step)
713
713
 
714
714
    pos = [
715
 
      [553, 452], [533, 452], [513, 452], [493, 452], [473, 452], 
716
 
      [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414], 
717
 
      [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294], 
 
715
      [553, 452], [533, 452], [513, 452], [493, 452], [473, 452],
 
716
      [463, 442, 30], [445.5, 441.5, 30], [425.5, 434.5, 30], [422, 414],
 
717
      [422, 394], [422, 374], [422, 354], [422, 334], [422, 314], [422, 294],
718
718
      [422, 274, -30], [422, 260.5, -30, :x], [422.5, 248.5, -28], [425, 237]
719
719
    ]
720
720
 
735
735
    color = @C['6']
736
736
    xy = [324, 130, 391, 204] # Ball holder
737
737
    xy = round_rect(xy, 10)
738
 
    TkcPolygon.new(@canvas, xy, :smooth=>true, 
 
738
    TkcPolygon.new(@canvas, xy, :smooth=>true,
739
739
                   :outline=>@C['fg'], :width=>3, :fill=>color)
740
740
    xy = [339, 204, 376, 253] # Below the ball holder
741
 
    TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3, 
 
741
    TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>3,
742
742
                     :fill=>color, :tag=>'I6c')
743
743
    xy = box(346, 339, 28)
744
744
    TkcOval.new(@canvas, xy, :fill=>color, :outline=>'') # Roter
745
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, 
 
745
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc,
746
746
               :start=>80, :extent=>205)
747
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc, 
 
747
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>2, :style=>:arc,
748
748
               :start=>-41, :extent=>85)
749
749
 
750
750
    xy = box(346, 339, 15) # Center of rotor
759
759
    TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>'')
760
760
 
761
761
    xy = [
762
 
      368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403, 
 
762
      368, 356, 368, 403, 389, 403, 389, 464, 320, 464, 320, 403,
763
763
      352, 403, 352, 366
764
764
    ]
765
 
    TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', 
 
765
    TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'',
766
766
                   :width=>2) # Below rotor
767
767
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2)
768
768
    xy = box(275, 342, 7) # On/off rotor
787
787
      loc = -i
788
788
      color = colors[i]
789
789
      x, y = @XY6["#{loc}"]
790
 
      TkcOval.new(@canvas, box(x, y, 5), 
 
790
      TkcOval.new(@canvas, box(x, y, 5),
791
791
                  :fill=>color, :outline=>color, :tag=>"I6_b#{i}")
792
792
    }
793
793
    draw6a(12) # The wheel
813
813
      @canvas.move('I6_', -7, 0)
814
814
      if step == 1  # Poke a hole
815
815
        xy = [348, 226, 365, 240]
816
 
        TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill), 
 
816
        TkcRectangle.new(@canvas, xy, :fill=>@canvas.itemcget('I6c', :fill),
817
817
                         :outline=>'')
818
818
      end
819
819
      return 1
853
853
  def draw7
854
854
    color = @C['7']
855
855
    xy = [198, 306, 277, 374]  # Box
856
 
    TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2, 
 
856
    TkcRectangle.new(@canvas, xy, :outline=>@C['fg'], :width=>2,
857
857
                     :fill=>color, :tag=>'I7z')
858
858
    @canvas.lower('I7z')
859
859
    xy = [275, 343, 230, 349]
860
 
    TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last, 
 
860
    TkcLine.new(@canvas, xy, :tag=>'I7', :fill=>@C['fg'], :arrow=>:last,
861
861
                :arrowshape=>[23, 23, 8], :width=>6)
862
862
    xy = [225, 324]  # On button
863
863
    x, y = xy
864
864
    TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg'])
865
865
    xy = [218, 323]  # On text
866
866
    font = ['Times Roman', 8]
867
 
    TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e, 
 
867
    TkcText.new(@canvas, xy, :text=>'on', :anchor=>:e,
868
868
                :fill=>@C['fg'], :font=>font)
869
869
    xy = [225, 350]  # Off button
870
870
    x, y = xy
871
871
    TkcOval.new(@canvas, box(x, y, 3), :fill=>@C['fg'], :outline=>@C['fg'])
872
872
    xy = [218, 349]  # Off text
873
 
    TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e, 
 
873
    TkcText.new(@canvas, xy, :text=>'off', :anchor=>:e,
874
874
                :fill=>@C['fg'], :font=>font)
875
875
  end
876
876
 
915
915
    xy = [280, 209, 296, 248]
916
916
    TkcOval.new(@canvas, xy, :outline=>color, :fill=>color)
917
917
    xy = [
918
 
      288, 249, 252, 249, 260, 240, 280, 234, 
 
918
      288, 249, 252, 249, 260, 240, 280, 234,
919
919
      296, 234, 316, 240, 324, 249, 288, 249
920
920
    ]
921
921
    TkcPolygon.new(@canvas, xy, :fill=>color, :smooth=>true)
924
924
    TkcPolygon.new(@canvas, xy, :fill=>color)
925
925
 
926
926
    xy = [255, 206, 265, 234]  # Fan blades
927
 
    TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], 
 
927
    TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
928
928
                :width=>3, :tag=>'I9_0')
929
929
    xy = [255, 176, 265, 204]
930
 
    TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], 
 
930
    TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
931
931
                :width=>3, :tag=>'I9_0')
932
932
    xy = [255, 206, 265, 220]
933
 
    TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], 
 
933
    TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
934
934
                :width=>1, :tag=>'I9_1')
935
935
    xy = [255, 190, 265, 204]
936
 
    TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], 
 
936
    TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'],
937
937
                :width=>1, :tag=>'I9_1')
938
938
  end
939
939
 
958
958
    color  = @C['10a']
959
959
    color2 = @C['10b']
960
960
    xy = [191, 230, 233, 230, 233, 178, 191, 178]  # Sail
961
 
    TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'], 
 
961
    TkcPolygon.new(@canvas, xy, :fill=>color, :width=>3, :outline=>@C['fg'],
962
962
                   :tag=>'I10')
963
963
    xy = box(209, 204, 31)  # Front
964
 
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie, 
 
964
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :style=>:pie,
965
965
               :start=>120, :extent=>120, :tag=>'I10')
966
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, 
 
966
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
967
967
               :start=>120, :extent=>120, :tag=>'I10')
968
968
    xy = box(249, 204, 31)  # Back
969
 
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3, 
 
969
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>3,
970
970
               :style=>:pie, :start=>120, :extent=>120, :tag=>'I10')
971
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, 
 
971
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
972
972
               :start=>120, :extent=>120, :tag=>'I10')
973
973
 
974
974
    xy = [200, 171, 200, 249]  # Mast
988
988
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
989
989
 
990
990
    xy = box(239, 262, 17)
991
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, 
 
991
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
992
992
               :start=>95, :extent=>103)
993
993
    xy = box(76, 266, 21)
994
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, 
 
994
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
995
995
               :extent=>190)
996
996
  end
997
997
 
999
999
    step = get_step(10, step)
1000
1000
 
1001
1001
    pos = [
1002
 
      [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212], 
1003
 
      [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212], 
1004
 
      [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212], 
 
1002
      [195, 212], [193, 212], [190, 212], [186, 212], [181, 212], [176, 212],
 
1003
      [171, 212], [166, 212], [161, 212], [156, 212], [151, 212], [147, 212],
 
1004
      [142, 212], [137, 212], [132, 212, :x], [127, 212], [121, 212],
1005
1005
      [116, 212], [111, 212]
1006
1006
    ]
1007
1007
 
1028
1028
    xy = [55, 504, 55, 591]  # Bottom right side
1029
1029
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
1030
1030
    xy = box(71, 460, 48)    # Outer loop
1031
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, 
 
1031
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
1032
1032
               :start=>110, :extent=>-290, :tag=>'I11i')
1033
1033
    xy = box(71, 460, 16)    # Inner loop
1034
 
    TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'', 
 
1034
    TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>'',
1035
1035
                :width=>3, :tag=>'I11i')
1036
1036
    TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>@C['bg'], :width=>3)
1037
1037
 
1038
1038
    xy = [23, 264, 23, 591]  # Left side
1039
1039
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
1040
1040
    xy = box(1, 266, 23)     # Top left curve
1041
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, 
 
1041
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3,
1042
1042
               :style=>:arc, :extent=>90)
1043
1043
 
1044
1044
    xy = box(75, 235, 9)     # The ball
1045
 
    TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'', 
 
1045
    TkcOval.new(@canvas, xy, :fill=>color2, :outline=>'',
1046
1046
                :width=>3, :tag=>'I11')
1047
1047
  end
1048
1048
 
1050
1050
    step = get_step(11, step)
1051
1051
 
1052
1052
    pos = [
1053
 
      [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266], 
1054
 
      [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472], 
 
1053
      [75, 235], [70, 235], [65, 237], [56, 240], [46, 247], [38, 266],
 
1054
      [38, 296], [38, 333], [38, 399], [38, 475], [74, 496], [105, 472],
1055
1055
      [100, 437], [65, 423], [-100, -100], [38, 505], [38, 527, :x], [38, 591]
1056
1056
    ]
1057
1057
 
1065
1065
  # Hand
1066
1066
  def draw12
1067
1067
    xy = [
1068
 
      20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590, 
 
1068
      20, 637, 20, 617, 20, 610, 20, 590, 40, 590, 40, 590,
1069
1069
      60, 590, 60, 610, 60, 610
1070
1070
    ]
1071
1071
    xy.concat([60, 610, 65, 620, 60, 631])  # Thumb
1072
 
    xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669, 
 
1072
    xy.concat([60, 631, 60, 637, 60, 662, 60, 669, 52, 669,
1073
1073
                56, 669, 50, 669, 50, 662, 50, 637])
1074
1074
 
1075
1075
    y0 = 637  # Bumps for fingers
1079
1079
      x2 = x - 10
1080
1080
      xy << x << y0 << x1 << y1 << x2 << y0
1081
1081
    }
1082
 
    TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'], 
 
1082
    TkcPolygon.new(@canvas, xy, :fill=>@C['12'], :outline=>@C['fg'],
1083
1083
                   :smooth=>true, :tag=>'I12', :width=>3)
1084
1084
  end
1085
1085
 
1103
1103
    ]
1104
1104
    radii = [2, 9, 9, 8, 5, 5, 2]
1105
1105
 
1106
 
    round_poly(@canvas, xy, radii, :width=>3, 
 
1106
    round_poly(@canvas, xy, radii, :width=>3,
1107
1107
               :outline=>@C['fg'], :fill=>color)
1108
 
    round_poly(@canvas, xy2, radii, :width=>3, 
 
1108
    round_poly(@canvas, xy2, radii, :width=>3,
1109
1109
               :outline=>@C['fg'], :fill=>color)
1110
1110
 
1111
1111
    xy = [56, 677]
1112
1112
    x, y = xy
1113
 
    TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], 
 
1113
    TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'],
1114
1114
                     :width=>3, :tag=>'I13')
1115
1115
    xy = [809, 677]
1116
1116
    x, y = xy
1117
 
    TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'], 
 
1117
    TkcRectangle.new(@canvas, box(x, y, 4), :fill=>'', :outline=>@C['fg'],
1118
1118
                     :width=>3, :tag=>'I13R')
1119
1119
 
1120
1120
    xy = [112, 687]  # Label
1121
 
    TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], 
 
1121
    TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'],
1122
1122
                :font=>['Times Roman', 12, :bold])
1123
1123
    xy = [762, 687]
1124
 
    TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'], 
 
1124
    TkcText.new(@canvas, xy, :text=>'FAX', :fill=>@C['fg'],
1125
1125
                :font=>['Times Roman', 12, :bold])
1126
1126
 
1127
1127
    xy = [138, 663, 148, 636, 178, 636]  # Paper guide
1129
1129
    xy = [732, 663, 722, 636, 692, 636]
1130
1130
    TkcLine.new(@canvas, xy, :smooth=>true, :fill=>@C['fg'], :width=>3)
1131
1131
 
1132
 
    sine([149, 688, 720, 688], 5, 15, 
 
1132
    sine([149, 688, 720, 688], 5, 15,
1133
1133
         :tag=>'I13_s', :fill=>@C['fg'],  :width=>3)
1134
1134
  end
1135
1135
 
1159
1159
  def draw14
1160
1160
    color = @C['14']
1161
1161
    xy = [102, 661, 113, 632, 130, 618]  # Left paper edge
1162
 
    TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, 
 
1162
    TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
1163
1163
                :width=>3, :tag=>'I14L_0')
1164
1164
    xy = [148, 629, 125, 640, 124, 662]  # Right paper edge
1165
 
    TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, 
 
1165
    TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
1166
1166
                :width=>3, :tag=>'I14L_1')
1167
1167
    draw14a('L')
1168
1168
 
1169
1169
    xy = [
1170
1170
      768.0, 662.5, 767.991316225, 662.433786215, 767.926187912, 662.396880171
1171
1171
    ]
1172
 
    TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, 
 
1172
    TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
1173
1173
                :width=>3, :tag=>'I14R_0')
1174
1174
    @canvas.lower('I14R_0')
1175
1175
    # NB. these numbers are VERY sensitive, you must start with final size
1177
1177
    xy = [
1178
1178
      745.947897349, 662.428358855, 745.997829056, 662.452239237, 746.0, 662.5
1179
1179
    ]
1180
 
    TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color, 
 
1180
    TkcLine.new(@canvas, xy, :smooth=>true, :fill=>color,
1181
1181
                :width=>3, :tag=>'I14R_1')
1182
1182
    @canvas.lower('I14R_1')
1183
1183
  end
1190
1190
    x3, y3, x4, y4, x5, y5 = xy2
1191
1191
 
1192
1192
    zz = [
1193
 
      x0, y0, x0, y0, xy, x2, y2, x2, y2, 
 
1193
      x0, y0, x0, y0, xy, x2, y2, x2, y2,
1194
1194
      x3, y3, x3, y3, xy2, x5, y5, x5, y5
1195
1195
    ].flatten
1196
1196
    @canvas.delete("I14#{side}")
1197
 
    TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true, 
 
1197
    TkcPolygon.new(@canvas, zz, :tag=>"I14#{side}", :smooth=>true,
1198
1198
                   :fill=>color, :outline=>color, :width=>3)
1199
1199
    @canvas.lower("I14#{side}")
1200
1200
  end
1247
1247
    xy = [765, 557, 784, 583]
1248
1248
    TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2)
1249
1249
 
1250
 
    sine([658, 580, 765, 580], 3, 15, 
 
1250
    sine([658, 580, 765, 580], 3, 15,
1251
1251
         :tag=>'I15_s', :fill=>@C['fg'], :width=>3)
1252
1252
  end
1253
1253
 
1286
1286
    xy = [722, 485, 791, 556]
1287
1287
    TkcRectangle.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>3)
1288
1288
    xy = box(752, 515, 25)  # Bell
1289
 
    TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black', 
 
1289
    TkcOval.new(@canvas, xy, :fill=>color, :outline=>'black',
1290
1290
                :tag=>'I16b', :width=>2)
1291
1291
    xy = box(752, 515, 5)   # Bell button
1292
1292
    TkcOval.new(@canvas, xy, :fill=>'black', :outline=>'black', :tag=>'I16b')
1325
1325
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3)
1326
1326
 
1327
1327
    xy = [664, 523, 717, 549]  # Body
1328
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3, 
 
1328
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, :width=>3,
1329
1329
               :style=>:chord, :start=>128, :extent=>260, :tag=>'I17')
1330
1330
 
1331
1331
    xy = [709, 554, 690, 543]  # Paw
1332
 
    TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, 
 
1332
    TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color,
1333
1333
                :width=>3, :tag=>'I17')
1334
1334
    xy = [657, 544, 676, 555]
1335
 
    TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color, 
 
1335
    TkcOval.new(@canvas, xy, :outline=>@C['fg'], :fill=>color,
1336
1336
                :width=>3, :tag=>'I17')
1337
1337
 
1338
1338
    xy = box(660, 535, 15)     # Lower face
1339
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc, 
 
1339
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :style=>:arc,
1340
1340
               :start=>150, :extent=>240, :tag=>'I17_')
1341
 
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, 
 
1341
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
1342
1342
               :style=>:chord, :start=>150, :extent=>240, :tag=>'I17_')
1343
1343
    xy = [674, 529, 670, 513, 662, 521, 658, 521, 650, 513, 647, 529]  # Ears
1344
1344
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
1345
 
    TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1, 
 
1345
    TkcPolygon.new(@canvas, xy, :fill=>color, :outline=>'', :width=>1,
1346
1346
                   :tag=>['I17_', 'I17_c'])
1347
1347
    xy = [652, 542, 628, 539]  # Whiskers
1348
1348
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
1352
1352
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
1353
1353
 
1354
1354
    xy = [668, 543, 687, 538]
1355
 
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, 
 
1355
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
1356
1356
                :tag=>['I17_', 'I17_w'])
1357
1357
    xy = [668, 544, 688, 546]
1358
 
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, 
 
1358
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
1359
1359
                :tag=>['I17_', 'I17_w'])
1360
1360
    xy = [668, 547, 688, 553]
1361
 
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, 
 
1361
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
1362
1362
                :tag=>['I17_', 'I17_w'])
1363
1363
 
1364
1364
    xy = [649, 530, 654, 538, 659, 530]  # Left eye
1365
 
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, 
 
1365
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
1366
1366
                :smooth=>true, :tag=>'I17')
1367
1367
    xy = [671, 530, 666, 538, 661, 530]  # Right eye
1368
 
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, 
 
1368
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
1369
1369
                :smooth=>true, :tag=>'I17')
1370
1370
    xy = [655, 543, 660, 551, 665, 543]  # Mouth
1371
 
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, 
 
1371
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2,
1372
1372
                :smooth=>true, :tag=>'I17')
1373
1373
  end
1374
1374
 
1381
1381
      TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
1382
1382
                  :smooth=>true, :tag=>'I17_')
1383
1383
      xy = box(654, 530, 4)  # Left eye
1384
 
      TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', 
 
1384
      TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'',
1385
1385
                  :tag=>'I17_')
1386
1386
      xy = box(666, 530, 4)  # Right eye
1387
 
      TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'', 
 
1387
      TkcOval.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :fill=>'',
1388
1388
                  :tag=>'I17_')
1389
1389
 
1390
1390
      @canvas.move('I17_', 0, -20) # Move face up
1394
1394
      TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
1395
1395
 
1396
1396
      xy = [ # Body
1397
 
        675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525, 
1398
 
        716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527, 
 
1397
        675, 506, 694, 489, 715, 513, 715, 513, 715, 513, 716, 525,
 
1398
        716, 525, 716, 525, 706, 530, 695, 530, 679, 535, 668, 527,
1399
1399
        668, 527, 668, 527, 675, 522, 676, 517, 677, 512
1400
1400
      ]
1401
 
      TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill), 
1402
 
                     :outline=>@C['fg'], :width=>3, :smooth=>true, 
 
1401
      TkcPolygon.new(@canvas, xy, :fill=>@canvas.itemcget('I17_c', :fill),
 
1402
                     :outline=>@C['fg'], :width=>3, :smooth=>true,
1403
1403
                     :tag=>'I17_')
1404
1404
      xy = [716, 514, 716, 554]  # Back leg
1405
1405
      TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
1406
1406
      xy = [694, 532, 694, 554]  # 2nd back leg
1407
1407
      TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I17_')
1408
1408
      xy = [715, 514, 718, 506, 719, 495, 716, 488]  # Tail
1409
 
      TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, 
 
1409
      TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3,
1410
1410
                  :smooth=>true, :tag=>'I17_')
1411
1411
 
1412
1412
      @canvas.raise('I17w')       # Make whiskers visible
1435
1435
    step = get_step(18, step)
1436
1436
 
1437
1437
    pos = [
1438
 
      [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x], 
 
1438
      [587, 506], [537, 506], [466, 506], [376, 506], [266, 506, :x],
1439
1439
      [136, 506], [16, 506], [-100, -100]
1440
1440
    ]
1441
1441
 
1442
1442
    b = []
1443
1443
    b[0] = [490, 502, 719, 507, 524, 512]  # Band collapsing
1444
1444
    b[1] = [
1445
 
      491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525, 
 
1445
      491, 503, 524, 557, 563, 505, 559, 496, 546, 506, 551, 525,
1446
1446
      553, 536, 538, 534, 532, 519, 529, 499
1447
1447
    ]
1448
1448
    b[2] = [
1473
1473
    color = @C['19']
1474
1474
    xx = [[249, 181], [155, 118], [86, 55], [22, 0]]
1475
1475
    xx.each{|x1, x2|
1476
 
      TkcRectangle.new(@canvas, x1, 453, x2, 467, 
 
1476
      TkcRectangle.new(@canvas, x1, 453, x2, 467,
1477
1477
                       :fill=>color, :outline=>'', :tag=>'I19')
1478
 
      TkcLine.new(@canvas, x1, 453, x2, 453, 
 
1478
      TkcLine.new(@canvas, x1, 453, x2, 453,
1479
1479
                  :fill=>@C['fg'], :width=>1) # Pipe top
1480
 
      TkcLine.new(@canvas, x1, 467, x2, 467, 
 
1480
      TkcLine.new(@canvas, x1, 467, x2, 467,
1481
1481
                  :fill=>@C['fg'], :width=>1) # Pipe bottom
1482
1482
    }
1483
1483
    @canvas.raise('I11i')
1484
1484
 
1485
1485
    xy = box(168, 460, 16)  # Bulge by the joint
1486
1486
    TkcOval.new(@canvas, xy, :fill=>color, :outline=>'')
1487
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, 
 
1487
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc,
1488
1488
               :start=>21, :extent=>136)
1489
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc, 
 
1489
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, :style=>:arc,
1490
1490
               :start=>-21, :extent=>-130)
1491
1491
 
1492
1492
    xy = [249, 447, 255, 473]  # First joint 26x6
1493
1493
    TkcRectangle.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>1)
1494
1494
 
1495
1495
    xy = box(257, 433, 34)     # Bend up
1496
 
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, 
 
1496
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
1497
1497
               :style=>:pie, :start=>0, :extent=>-91)
1498
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, 
 
1498
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
1499
1499
               :style=>:arc, :start=>0, :extent=>-90)
1500
1500
    xy = box(257, 433, 20)
1501
 
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, 
 
1501
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
1502
1502
               :style=>:pie, :start=>0, :extent=>-92)
1503
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, 
 
1503
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
1504
1504
               :style=>:arc, :start=>0, :extent=>-90)
1505
1505
    xy = box(257, 421, 34)     # Bend left
1506
 
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, 
 
1506
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
1507
1507
               :style=>:pie, :start=>0, :extent=>91)
1508
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, 
 
1508
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
1509
1509
               :style=>:arc, :start=>0, :extent=>90)
1510
1510
    xy = box(257, 421, 20)
1511
 
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, 
 
1511
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
1512
1512
               :style=>:pie, :start=>0, :extent=>90)
1513
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, 
 
1513
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
1514
1514
               :style=>:arc, :start=>0, :extent=>90)
1515
1515
    xy = box(243, 421, 34)     # Bend down
1516
 
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1, 
 
1516
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>color, :width=>1,
1517
1517
               :style=>:pie, :start=>90, :extent=>90)
1518
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, 
 
1518
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
1519
1519
               :style=>:arc, :start=>90, :extent=>90)
1520
1520
    xy = box(243, 421, 20)
1521
 
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1, 
 
1521
    TkcArc.new(@canvas, xy, :outline=>'', :fill=>@C['bg'], :width=>1,
1522
1522
               :style=>:pie, :start=>90, :extent=>90)
1523
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1, 
 
1523
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>1,
1524
1524
               :style=>:arc, :start=>90, :extent=>90)
1525
1525
 
1526
1526
    xy = [270, 427, 296, 433]  # 2nd joint bottom
1562
1562
    pos  = [451, 462, 473, 484, 496, 504, 513, 523, 532]
1563
1563
    freq  = [20,  40,  40,  40,  40,  40,  40,  40,  40]
1564
1564
    pos = [
1565
 
      [451, 20], [462, 40], [473, 40], [484, 40], [496, 40], 
 
1565
      [451, 20], [462, 40], [473, 40], [484, 40], [496, 40],
1566
1566
      [504, 40], [513, 40], [523, 40], [532, 40, :x]
1567
1567
    ]
1568
1568
    return 0 if step >= pos.length
1579
1579
    color = @C['20']
1580
1580
    @canvas.delete('I20')
1581
1581
 
1582
 
    sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'], 
 
1582
    sine([208, 428, 208, y], 4, f, :tag=>['I20', 'I20s'],
1583
1583
         :width=>3, :fill=>color, :smooth=>true)
1584
 
    TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, 
 
1584
    TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3,
1585
1585
                :fill=>color, :smooth=>1, :tag=>['I20', 'I20a'])
1586
 
    TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3, 
 
1586
    TkcLine.new(@canvas, @canvas.coords('I20s'), :width=>3,
1587
1587
                :fill=>color, :smooth=>1, :tag=>['I20', 'I20b'])
1588
1588
    @canvas.move('I20a', 8, 0)
1589
1589
    @canvas.move('I20b', 16, 0)
1599
1599
 
1600
1600
    xy = [245, 490, 237, 535]  # Right side
1601
1601
    xy2 = [189, 535, 181, 490] # Left side
1602
 
    TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'', 
 
1602
    TkcPolygon.new(@canvas, xy + xy2, :fill=>color, :outline=>'',
1603
1603
                   :tag=>['I21', 'I21f'])
1604
1604
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>2, :tag=>'I21')
1605
1605
    TkcLine.new(@canvas, xy2, :fill=>@C['fg'], :width=>2, :tag=>'I21')
1606
1606
 
1607
1607
    xy = [182, 486, 244, 498]  # Top
1608
 
    TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2, 
 
1608
    TkcOval.new(@canvas, xy, :fill=>color, :outline=>'', :width=>2,
1609
1609
                :tag=>['I21', 'I21f'])
1610
 
    TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2, 
 
1610
    TkcOval.new(@canvas, xy, :fill=>'', :outline=>@C['fg'], :width=>2,
1611
1611
                :tag=>['I21', 'I21t'])
1612
1612
    xy = [189, 532, 237, 540]  # Bottom
1613
 
    TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2, 
 
1613
    TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], :width=>2,
1614
1614
                :tag=>['I21', 'I21b'])
1615
1615
  end
1616
1616
 
1633
1633
 
1634
1634
    @canvas.itemconfigure('I21b', :fill=>@C['20'])
1635
1635
    @canvas.delete('I21w')
1636
 
    TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1, 
 
1636
    TkcPolygon.new(@canvas, x2, y2, x1, y1, xx1, yy1, xx2, yy1,
1637
1637
                   :tag=>['I21', 'I21w'], :outline=>'', :fill=>@C['20'])
1638
1638
    @canvas.lower('I21w', 'I21')
1639
1639
    @canvas.raise('I21b')
1669
1669
    color3 = @C['23c']
1670
1670
 
1671
1671
    xy = [185, 623, 253, 650]  # Block
1672
 
    TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'], 
 
1672
    TkcRectangle.new(@canvas, xy, :fill=>'black', :outline=>@C['fg'],
1673
1673
                     :width=>2, :tag=>'I23a')
1674
1674
    xy = [187, 592, 241, 623]  # Balloon
1675
1675
    TkcOval.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b')
1676
 
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b', 
 
1676
    TkcArc.new(@canvas, xy, :outline=>@C['fg'], :width=>3, :tag=>'I23b',
1677
1677
               :style=>:arc, :start=>12, :extent=>336)
1678
1678
    xy = [239, 604, 258, 589, 258, 625, 239, 610]  # Balloon nozzle
1679
1679
    TkcPolygon.new(@canvas, xy, :outline=>'', :fill=>color, :tag=>'I23b')
1680
1680
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23b')
1681
1681
 
1682
1682
    xy = [285, 611, 250, 603]  # Dart body
1683
 
    TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'], 
 
1683
    TkcOval.new(@canvas, xy, :fill=>color2, :outline=>@C['fg'],
1684
1684
                :width=>3, :tag=>'I23d')
1685
1685
    xy = [249, 596, 249, 618, 264, 607, 249, 596]  # Dart tail
1686
 
    TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'], 
 
1686
    TkcPolygon.new(@canvas, xy, :fill=>color3, :outline=>@C['fg'],
1687
1687
                   :width=>3, :tag=>'I23d')
1688
1688
    xy = [249, 607, 268, 607]  # Dart detail
1689
1689
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I23d')
1695
1695
    step = get_step(23, step)
1696
1696
 
1697
1697
    pos = [
1698
 
      [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607], 
 
1698
      [277, 607], [287, 607], [307, 607, :x], [347, 607], [407, 607],
1699
1699
      [487, 607], [587, 607], [687, 607], [787, 607], [-100, -100]
1700
1700
    ]
1701
1701
 
1715
1715
  def draw24
1716
1716
    color = @C['24a']
1717
1717
    xy = [366, 518, 462, 665]  # Balloon
1718
 
    TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'], 
 
1718
    TkcOval.new(@canvas, xy, :fill=>color, :outline=>@C['fg'],
1719
1719
                :width=>3, :tag=>'I24')
1720
1720
    xy = [414, 666, 414, 729]  # String
1721
1721
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :width=>3, :tag=>'I24')
1724
1724
                   :width=>3, :tag=>'I24')
1725
1725
 
1726
1726
    xy = [387, 567, 390, 549, 404, 542]  # Reflections
1727
 
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, 
 
1727
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
1728
1728
                :width=>2, :tag=>'I24')
1729
1729
    xy = [395, 568, 399, 554, 413, 547]
1730
 
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, 
 
1730
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
1731
1731
                :width=>2, :tag=>'I24')
1732
1732
    xy = [403, 570, 396, 555, 381, 553]
1733
 
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, 
 
1733
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
1734
1734
                :width=>2, :tag=>'I24')
1735
1735
    xy = [408, 564, 402, 547, 386, 545]
1736
 
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true, 
 
1736
    TkcLine.new(@canvas, xy, :fill=>@C['fg'], :smooth=>true,
1737
1737
                :width=>2, :tag=>'I24')
1738
1738
  end
1739
1739
 
1746
1746
    if step == 0
1747
1747
      @canvas.delete('I24')  # Exploding balloon
1748
1748
      xy = [
1749
 
        347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594, 
1750
 
        259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738, 
1751
 
        436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613, 
1752
 
        548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508, 
 
1749
        347, 465, 361, 557, 271, 503, 272, 503, 342, 574, 259, 594,
 
1750
        259, 593, 362, 626, 320, 737, 320, 740, 398, 691, 436, 738,
 
1751
        436, 739, 476, 679, 528, 701, 527, 702, 494, 627, 548, 613,
 
1752
        548, 613, 480, 574, 577, 473, 577, 473, 474, 538, 445, 508,
1753
1753
        431, 441, 431, 440, 400, 502, 347, 465, 347, 465
1754
1754
      ]
1755
 
      TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'], 
 
1755
      TkcPolygon.new(@canvas, xy, :tag=>'I24', :fill=>@C['24b'],
1756
1756
                     :outline=>@C['24a'], :width=>10, :smooth=>true)
1757
1757
      msg = Tk.subst(@S['message'].value)
1758
 
      TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'], 
 
1758
      TkcText.new(@canvas, centroid('I24'), :text=>msg, :tag=>['I24', 'I24t'],
1759
1759
                  :justify=>:center, :font=>['Times Roman', 18, :bold])
1760
1760
      return 1
1761
1761
    end
1786
1786
 
1787
1787
    if step >= 3
1788
1788
      @canvas.delete('I24', 'I26')
1789
 
      TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26', 
1790
 
                  :text=>'click to continue', 
 
1789
      TkcText.new(@canvas, 430, 740, :anchor=>:s, :tag=>'I26',
 
1790
                  :text=>'click to continue',
1791
1791
                  :font=>['Times Roman', 24, :bold])
1792
1792
      @canvas.bind('1', proc{reset})
1793
1793
      return 4
1967
1967
 
1968
1968
  def sparkle(oxy, tag)
1969
1969
    xy = [
1970
 
      [299, 283], [298, 302], [295, 314], [271, 331], 
 
1970
      [299, 283], [298, 302], [295, 314], [271, 331],
1971
1971
      [239, 310], [242, 292], [256, 274], [281, 273]
1972
1972
    ]
1973
1973
    xy.each{|x, y|
1974
 
      TkcLine.new(@canvas, 271, 304, x, y, 
 
1974
      TkcLine.new(@canvas, 271, 304, x, y,
1975
1975
                  :fill=>'white', :width=>3, :tag=>tag)
1976
1976
    }
1977
1977
    move_abs(tag, oxy)