fta/slideshow/examples/fr-test1.ss
(module fr-test1 (lib "slideshow.ss" "fta" "slideshow")
 
  (set-dc-for-text-size)

  
  
  (current-slide-assembler
   (lambda (s v-sep c)
     (let ([rest-of-page (ct-superimpose
                          c               
                          (cbl-superimpose
                           (if s
                               (blank 800 620)
                               (blank 800 735))
                           (hbl-append 750
                                       (text "NEPLS 2005")
                                       (scale (bitmap (build-path 
                                                       (collection-path "icons") 
                                                       "plt.gif"))
                                              .3))))])
       (if s
           (vc-append v-sep 
                      ;; left-aligns the title:
                      (vl-append
                       20
                       (page-para (text s 'default 37))
                       (hline 600 1)) 
                      rest-of-page)
           rest-of-page
            ))))
  
  (define tab (blank 150 1))
  
  
  (slide/title "Revamping Existing Presentations"
               (t "the following slides contain")
               (t "some slides from the mztake talk"))
  
  (slide/title "A Dataflow Language For Scripted Debugging"
               (vl-append 30
                (vl-append 
                 (t "Guillaume Marceau,")
                 (t "Greg Cooper,")
                 (t "Jono Spiro,")
                 (t "Shriram Krishnamurthi,")
                 (t "Steven Reiss"))
                (hc-append tab (tt "Brown University"))
                (blank)
                (t "John Clements")
                (hc-append tab (tt "Northeastern University"))))
  
  (define graph-space 80)
  (define graph-node (colorize (disk 70) "light blue"))
  
  (define down-line (pip-line (* 2 graph-space)
                              graph-space
                              (expt (* 2 graph-space graph-space) .5)))
  
  (define up-line (pip-line (* 2 graph-space)
                            (- graph-space )
                            (expt (* 2 graph-space graph-space) .5)))
  
  (define horiz-line (pip-line (* 1.6 graph-space) 0 10))
  
  (define (add-up-line gr-node cost)
    (rt-superimpose (cc-superimpose gr-node 
                                    (rt-superimpose (blank 50 50) up-line) 
                                    (blank (* 2 graph-space) (* 2 graph-space)))
                    (text (number->string cost) 'default 20)))
  
  (define (add-down-line gr-node cost)
    (rb-superimpose (cc-superimpose gr-node 
                                    (rb-superimpose (blank 50 50) down-line) 
                                    (blank (* 2 graph-space) (* 2 graph-space)))
                    (text (number->string cost) 'default 20)))
  
  (define (add-both-lines gr-node cost-up cost-down)
    (add-up-line (add-down-line gr-node cost-down) cost-up))
  
  

  
  (define (add-horiz-line gr-node cost)
    (cc-superimpose
     (rc-superimpose (blank 70 70) horiz-line)
     (rc-superimpose
      (rt-superimpose
       (blank 50 50)
       (text (number->string cost) 'default 20))
      (space-node gr-node))))

  
  (define (space-node node)
    (cc-superimpose node 
                    (blank (* 2 graph-space)
                           (* 2 graph-space))))
  
  
  (define path-delay 370)
  
  (define (delay-add-tag depth tag)
    (transition/delay
     graph-node
     (* depth path-delay)
     (cc-superimpose
      graph-node
      (t tag))))
  
  (define (generate-diagram)
      (hc-append 
       (/ graph-space 2)
       (add-both-lines
        (delay-add-tag 1 "0")
        1 6)
       (vc-append (/ graph-space 2)
                  (add-both-lines (delay-add-tag 1 "1") 10 6)
                  (add-both-lines (delay-add-tag 6 "6") 1 3))
       (vc-append (/ graph-space 2)
                  (add-down-line (delay-add-tag 11 "11") 9)
                  (add-both-lines (delay-add-tag 7 "7") 3 6)
                  (add-up-line (delay-add-tag 9 "9") 6))
       (vc-append (/ graph-space 2)
                  (add-horiz-line (delay-add-tag 10 "10") 8)
                  (add-horiz-line (delay-add-tag 13 "13") 2))
       (vc-append (/ graph-space 2)
                  (space-node (delay-add-tag 18 "18"))
                  (space-node (delay-add-tag 15 "15")))))

  
  (slide/title "Shortest Path"
               (make-reactive (generate-diagram)))
  


  
  (define (t/reg s)
    (text s 'default 18))
  (define (t/small s)
    (text s 'default 14))
  
  (define blank-width 200)
  

  
 
  (define (tag-node lbl)
    (cc-superimpose graph-node (t lbl)))
  
  (define (bad-tag-node lbl)
    (cc-superimpose
     (colorize (disk 70)
               (scale-color 
                (+ .7 (* 2 (/ (add1 (sin (* 2 pi (wave 2)))) 2)))
                "red"))
     (t lbl)))
  
 
  
  (slide/title "Shortest Path"
               (blank 1 200)
               (make-reactive
                (hc-append
                20
                (transition/delay (blank)
                                  path-delay
                                  (tag-node "1"))
                (transition/delay (blank)
                                  (* 2 path-delay)
                                  (tag-node "6"))
                (transition/delay (blank)
                                  (* 3 path-delay)
                                  (tag-node "7"))
                (transition/delay (blank)
                                  (* 4 path-delay)
                                  (tag-node "9"))
                (transition/delay (blank)
                                  (* 5 path-delay)
                                  (tag-node "11"))
                (transition/delay (blank)
                                  (* 6 path-delay)
                                  (tag-node "13"))
                (transition/new-time
                 (blank)
                 (* 7 path-delay)
                 (lambda () (transition/delay
                             (tag-node "10")
                             (* 7 path-delay)
                             (bad-tag-node "10"))))
                (transition/delay (blank)
                                  (* 8 path-delay)
                                  (tag-node "15"))
                (transition/delay (blank)
                                  (* 9 path-delay)
                                  (tag-node "18")))))
  
  ;(slide/title/center "Try Moving the mouse!" (make-reactive (filled-ellipse (min (0 . until . mouse-x) 800) 200)))
  
 
  )