;; This example slideshow code is meant to be read while
;;  running the example show.

(module tutorial-show (lib "slideshow.ss" "fta" "slideshow")
  (require (lib "symbol.ss" "texpict"))
  ;(require (lib "fratpac.ss" "fta"))
  ;; The first few slides are not to be read
  ;; until you have seen the rest of the tutorial,
  ;; so we put them in a separate file
  (require "initial-ones.ss")

  ;; The rest is meant for reading, as you view the slides

  ;; The first slide that's meant to be read
   (t "Part I: Basic Concepts"))

  ;; The second slide
   (t "This slide shows how four picts")
   (t "get vertically appended by the")
   (tt "slide")
   (t "function to create and install a slide"))
  ;; Etc.
   (t "See how the")
   (tt "t")
   (t "function takes a string and")
   (t "produces a pict with a normal sans-serif font, but")
   (tt "tt")
   (t "produces a pict with a fixed-width font?"))

   (page-para "Breaking up text into lines is painful, so"
              "the" (tt "page-para")
              "function takes a mixture of strings and"
              "picts and puts them into a pagaraph")
   (page-para "It doesn't matter how strings are broken into"
              "parts in the code")
   (page-para "The" (tt "page-para") "function puts space"
              "between separate strings"
              ", but not before punctuation" "!"))
   (page-para "The" (tt "slide/center") "function centers"
              "the slide body vertically")
   (page-para "All of the" (tt "slide") "functions center"
              "the body picts horizontally, but" (tt "page-para")
              "makes a slide-width picture with left-aligned text")
   (frame (page-para "The" (tt "frame") "function wraps a frame"
                     "around a pict to create a new pict,"
                     "so you can easily see this individual pict")))
   (page-para "The" (tt "slide/title") "function takes a"
              "title string before the content picts"))
   "Titles and Centering"
   (page-para "The" (tt "slide/title/center") "function centers the slide body vertically"))
   "More Centering"
    (page-para/c "The" (tt "page-para/c") "function generates"
                 "a paragraph with centered lines of text"))
    (page-para* "This line uses the" (tt "page-para*") "function"))
   (page-para "The" (tt "page-para*") "function creates a paragraph"
              "that is wrapped to fit the slide, but it allows"
              "the resulting pict to be more narrow than the slide"))

  (let ([apply-page-para-to-example
	 (lambda (page-para...)
	    "And there's" (tt "page-para*/r") ", which is different"
	    "from" (tt "page-para*") "or" (tt "page-para*/c")
	    "only if the paragraph takes multiple lines"))])
     "More Alignment"
      (page-para/r "Of course, there's also" (tt "page-para/r")))
     (frame (apply-page-para-to-example page-para*/r))
     (page-para "For comparision, the same text using" (tt "page-para/r") ":")
     (frame (apply-page-para-to-example page-para/r))
     (page-para "Unless your font happens to make the" (tt "page-para*/r")
		"box exactly as wide as this slide, the last box will be slightly"
		"wider with extra space to the left")))
   (page-para "The" (tt "slide") "functions insert space"
              "between each body pict")
   (page-para "The amount of space is" (number->string gap-size)
              ", which is the value of" (tt "gap-size")))
   "Controlling Space"
   (vc-append line-sep
              (page-para "If you want to control the space,"
                         "simply append the picts yourself to create"
                         "one body pict")
              (page-para "The first argument to" (tt "vc-append")
                         "determines the space between pictures")
              (page-para "If the first argument is a pict instead of"
                         "a number, then 0 is used")
              (page-para "For text in one paragraph, the"
                         (tt "page-para") "function uses" (tt "line-sep")
                         ", which is" (number->string line-sep))))

   "Appending Picts"
   (vl-append line-sep (frame (t "This is")) (frame (tt "vl-append")))
   (vc-append line-sep (frame (t "This is")) (frame (tt "vc-append")))
   (vr-append line-sep (frame (t "This is")) (frame (tt "vr-append"))))
   "Horizontal Appending"
   (hc-append (frame (t "This is")) (frame (vr-append (tt "hc-append")
                                                      (t "obviously"))))
   (ht-append (frame (t "This is")) (frame (vr-append (tt "ht-append")
                                                      (t "obviously"))))
   (hb-append (frame (t "This is")) (frame (vr-append (tt "hb-append")
                                                      (t "obviously")))))
   "Text Alignment"
   (hbl-append (frame (scale (tt "hbl-append") 1.5))
               (frame (t "aligns text baselines")))
   (page-para "It's especially useful for font mixtures")
   (hbl-append (frame (scale (tt "htl-append") 1.5))
               (frame (t "is the same for single lines")))
   (page-para "The difference between" (tt "htl-append")
              "and" (tt "hbl-append") "shows up with multiple lines:")
   (hbl-append (frame (scale (t "bottom lines align") 1.5))
               (frame (vl-append (t "when using") (tt "hbl-append"))))
   (htl-append (frame (scale (t "top lines align") 1.5))
               (frame (vl-append (t "when using") (tt "htl-append")))))
   (cc-superimpose (t "X") (t "O"))
   (page-para "The" (tt "cc-superimpose") 
              "function puts picts on top of each other, centered")
   (page-para "Each of" (tt "l") "," (tt "r") ", and" (tt "c")
              "is matched with each of"
              (tt "t") "," (tt "b") "," (tt "c") "," (tt "bl") ", and" (tt "tl")
              "in all combinations with" (tt "-superimpose"))
   (page-para "For example," (tt "cbl-superimpose") ":")
   (cbl-superimpose (frame (scale (t "one line") 1.5))
                     (colorize (vl-append (t "two")
                                          (t "lines"))
    (frame (blank client-w client-h))
    (vc-append gap-size
               (t "By definition, the screen is 1024 x 768 units")
               (t "If you have more or less pixels, the image is scaled")
                "There's a margin, so the \"client\" area is"
                (number->string client-w) "x" (number->string client-h))
               (page-para* "The font size is" (number->string font-size)))))
   "Titled Client Area"
     (frame titleless-page)
     (page-para* "If you use a title, then" (tt "titleless-page")
                 "is the same size as the area left for the body"))
    (t "It's useful")))
   "More on Paragraphs"
   (page-para "The" (tt "page-") "in" (tt "page-para")
              "makes the paragraph take the width of the slide")
   (para 300 
         "The" (tt "para") "function requires an explicit size"
         "for the width of the paragraph, 300 in this case")
   (para client-w "So" (tt "page-para") "is a shorthand for"
         (tt "para") "with" (tt "client-w"))
   (para*/c 500 "Naturally, there is" (tt "para*") ","
            (tt "para*/c") ", and" (tt "para*/r")))
   "Text and Styles"
   (page-para "Functions exist for" (bt "bold") ","
              (it "italic") ", and even" (bit "bold-italic") "text")
   (page-para "The" (tt "text") "function gives you more direct control over the"
              (text "font" '(italic . modern) font-size) ","
              (text "size" main-font 24) ", and even"
              (text "angle" main-font font-size (/ 3.14159 4))))
  (require (lib "code.ss" "fta" "slideshow"))
   "Scheme Code"
   (page-para "For Scheme code, the" (code (lib "code.ss" "fta" "slideshow"))
              "library provides a handy" (code code) "macro for"
              "typesetting literal code")
   (page-para "The" (code code) "macro uses source-location information"
              "to indent code")
   (code (define (length l)
             [(null? l) 0]
             [else (+ 1 (length (cdr l)))]))))

   (page-para "Use the" (colorize (tt "colorize") "blue")
              "function to color most things, including text")
    (colorize (page-para "A" (code colorize)
                         "applies only to sub-picts that do not"
                         "already have a" (colorize (t "color") "green"))
  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; Part II starts here

  (define outline 
    (let ([sub-para (lambda l
		      (apply para (* 3/4 client-w) l))])
       'one "Part I: Basic Concepts" 
       'two "Part II: Practical Slides" 
       (lambda (tag)
	 (sub-para "Using" (code make-outline) "and more..."))
       'three "Part III: Fancy Picts" 
       (lambda (tag)
	 (sub-para "Creating interesting graphics"))
       'four "Part IV: Advanced Slides" 
       (lambda (tag)
	 (sub-para "Beyond" (code 'next) "and" (code 'alts)))
       'background "Part V: Controlling the Background"
       (lambda (tag)
	 (sub-para "Changing the overall look of your talk"))

       'printing "Part VI: Printing"
       (lambda (tag)
	 (sub-para "Exporting slides as PostScript"))

       'end "Conclusion" 
       (lambda (tag)
	 (sub-para "This is the end")))))

  (outline 'two)
   (page-item "Bulleted sequences are common in slides")
   (page-item "The" (code page-item) "function makes a bulleted"
              "paragraph that is as wide as the slide")
   (page-item/bullet (colorize (tt "+") "green")
                     "You can set the bullet, if you like, by using"
                     (code page-item/bullet))
   (page-subitem "Naturally, there is also" (code page-subitem)))
   (page-para "You could write" (code page-item) "yourself:")
   (code (define (page-item . l)
            (/ gap-size 2)
            (apply para 
                   (- client-w (pict-width bullet) 
                      (/ gap-size 2))
   (page-para "where" (code bullet) "is a constant pict:" bullet))
   "Grouping and Space"
   (page-para "Sometimes you want to group items on a slide")
   (page-item "A bullet goes with a statement")
   (page-item "And another does, too")
   (page-para "Creating a zero-sized pict with" (code (blank))
              "effectively doubles the gap, making a space that"
	      "often looks right"))
   (page-item "Suppose you want to show only one item at a time")
   (page-item "In addition to body picts, the" (code slide) 
	      "functions recognize certain staging symbols")
   (page-item "Use" (code 'next) "in a sequence of" (code slide)
              "arguments to create multiple slides, one"
              "containing only the preceding content, and another"
              "with the remainder")
    (page-para* (code 'next) "is not tied to" (code page-item)
                ", though it's often used with items")
   (page-para "Steps can break up a linear slide, but sometimes"
              "you need to replace one thing with something else")
   (list (list 
          (page-para* "For example, replace this..."))
          (page-para* "... with something else")
          (page-item "An" (code 'alts) "in a sequence"
                     "must be followed by a list of lists")
          (page-item "Each list is a sequence, a different conclusion for the slide's sequence")))
   (page-item "Anything after the list of lists is folded into the last alternative")
   (page-para "Of course, you can mix" (code 'alts) "and"
              (code 'next) "in interesting ways"))
  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; Part III starts here
  (outline 'three)

   "Fancy Picts"
   (page-para "In part I, we saw some basic pict constructors:" 
	      (code t) "," (code vl-append) ", etc.")
   (page-para "The libraries")
    (code (lib "mrpict.ss" "fta" "texpict"))
    (page-para* "and" (code (lib "utils.ss" "fta" "texpict"))))
   (page-para "provide many more functions for creating picts")
   (page-para "Slideshow re-exports all of those functions, so you"
	      "can just use them"))

   (page-para "For example, the" (code bitmap) "function loads a bitmap to display")
   (bitmap (build-path (collection-path "icons") "plt.gif")))

  ;(require (lib "symbol.ss" "fta" "texpict"))
   (page-para "The" (code (lib "symbol.ss" "fta" "texpict")) "library"
	      "provides various symbol constants, such as")
   (page-para* sym:in (code sym:in))
   (page-para* sym:rightarrow (code sym:rightarrow))
   (page-para* sym:infinity (code sym:infinity))
   (page-para "Slideshow does not re-export this library, so you"
	      "must" (code require) "it to use"
	      (code sym:in) ", etc.")
   (page-para "Unless otherwise stated in the following slides, however,"
	      "all definitions are provided by Slideshow"))

  (require (all-except (lib "mred.ss" "mred") send-event)) ; for message-box
   (page-para "The" (code clickback)
	      "function attaches an arbitrary thunk to a pict"
	      "for interactive slides")
   (clickback (frame (t "Click Me"))
	      (lambda ()
		(message-box "Clicked" "Thanks!"))))

  (define (note . l)
    (colorize (apply page-para/r l) "blue"))

   (page-para "The" (code table) "function makes rows and columns")
     (table 3 ; three columns
	    (list (t "First") (standard-fish (* 2 gap-size) gap-size) (code cons)
		  (t "Second") (jack-o-lantern (* 4 gap-size)) (code car)
		  (t "Third") (cloud (* 3 gap-size) gap-size) (code cdr)
		  (t "Fourth") (file-icon (* 2 gap-size) (* 3 gap-size) #t) (code null?))
	    (list* lc-superimpose  ; left-align first column
		   cc-superimpose) ; h-center the rest
	    cc-superimpose ; v-center all rows
	    gap-size  ; separate all columns by gap-size
	    gap-size) ; separate all rows by gap-size
   (note "The above also uses" (code standard-fish) ","
	 (code jack-o-lantern) "," (code cloud) ", and"
	 (code file-icon)))
  (require (lib "math.ss")) ; to get pi
  (define orientations 
    (map (lambda (x) (* pi x)) '(0 1/4 1/2 3/4 1 5/4 6/4 7/4)))
  (define (show-arrows code-arrow t-arrow arrow)
     (page-para "The" code-arrow "function creates an"
		t-arrow "of a given size and orientation (in radians)")
     (page-para "Simple: " (arrow gap-size pi))
     (page-para "Fun:")
      (map (lambda (shift)
	      (apply hc-append gap-size (map (lambda (o) 
					       ;; Here's the other use of arrow
					       (arrow gap-size (+ o (* shift pi 1/32))))
	      (scale-color (add1 shift) "green")))
	   '(0 1 2 3 4 5 6 7)))
     (note "(That's 64 uses of " code-arrow ")")))
  (show-arrows (code arrow) (t "arrow") arrow)
  (show-arrows (code arrowhead) (t "arrowhead") arrowhead)

  ;(require (lib "face.ss" "fta" "texpict"))
   (page-para "The" (code (lib "face.ss" "fta" "texpict"))
	      "library makes faces")
    (* 3 gap-size)
    (face 'happy "yellow")
    (face 'badly-embarassed)))

  (require (lib "class.ss")) ; to demonstrate dc
   "Arbitrary Drawing"
   (page-para "The" (code dc) "function provides an escape hatch to the underlying"
              "MrEd toolkit")
   (page-para "For example," (code (disk 100)) "is the same as")
    (dc (lambda (dc dx dy)
          (send dc draw-ellipse dx dy 100 100))
        100 100 0 0))
   (dc (lambda (dc dx dy)
         (send dc draw-ellipse dx dy 100 100))
       100 100 0 0)
   (disk 100))

   (page-item "As we've already seen, the" (code frame)
	      "function wraps a" (frame (t "frame"))
	      "around a pict")
   (page-item "The" (code color-frame)
	      "function wraps a" (color-frame (t "colored frame") "red")
	      "; compare to" (code frame) "followed by" (code colorize)
	      "," (colorize (frame (t "like this")) "red"))
   (page-item "One way to increase the" (linewidth 3 (frame (t "line thickness")))
	      "is to use" (code linewidth))
   (page-item "It's often useful to" (frame (inset (t "add space") 3))
	      "around a pict with" (code inset) "before framing it"))

  (define (bound-frame p)
    (color-frame p "green"))

   "Lines and Pict Dimensions"
   (page-item "The" (code hline) "function creates a horizontal line, given a bounding width and height:")
   (bound-frame (hline (* 2 gap-size) gap-size))
   (note "(The" (code hline) "result is framed in green above)")
   (page-item "Naturally, there's also" (code vline) ":")
   (bound-frame (vline (* 2 gap-size) gap-size))
   (page-item "To" (let ([p (t "underline")])
		     (vc-append p (hline (pict-width p) 1)))
	      "a pict, get its width using" (code pict-width)
	      ", then use" (code hline) "and" (code vc-append))
   (page-item "If the pict is text, you can restore the"
	      (let ([p (t "baseline")])
		 (vc-append p (hline (pict-width p) 1))
	      "using" (code refocus)))

   "Placing Picts"
   (page-item "Another" (let ([p (t "underline strategy")])
			  (pin-over p 0 (pict-height p) (hline (pict-width p) 1)))
	      "is to use" (code pin-over) ", which places one pict on"
	      "top of another to generate a new pict")
   (page-item "The new pict has the"
	       (let ([p (t "original")])
		 (pin-over p 0 (pict-height p) (hline (pict-width p) 1))))
	      "pict's bounding box and baselines")
   (note "(The green frame is the \"bounding box\" of the result)")
   #;(page-item "The" (code pin-over) "function is useful with" (code pt-arrow-line)
	      "to draw an"
	      (let ([p (bound-frame (inset (t "outgoing arrow") 2))])
		(pin-over p (/ (pict-width p) 2)  (/ (pict-height p) 2) 
			  ;; pt-arrow-line creates a pict where the
			  ;; "bounding box" corresponds to the non-arrow end
			  (linewidth 3 (colorize (pt-arrow-line 50 50 gap-size) "orange"))))
	      "without changing the layout"))

  (define blue-fish (standard-fish (* 3 gap-size) (* 2 gap-size) 'right "blue" "white"))
  (define plain-file (file-icon (* 2 gap-size) (* 3 gap-size) #t))
  (define fish-file-scene (bound-frame 
			   (inset (ht-append (* 4 gap-size) 
					     (inset plain-file 0 (* 2 gap-size) 0 0))

   "Finding Picts"
   (page-para "Typically, an arrow needs to go from one pict to another")
   (page-para "Functions like" (code rc-find) "locate a point of a pict (such as \"right center\") inside a larger pict")
   #;(let-values ([(fdx fdy) (rc-find fish-file-scene blue-fish)]
		[(adx ady) (lt-find fish-file-scene plain-file)])
     (pin-over fish-file-scene
	       fdx fdy
		(pt-arrow-line (- adx fdx) (- ady fdy) gap-size)
   (page-para "There's a" (code -find) "function for every combination of"
	      (code l) "," (code c) ", and" (code r)
	      "with" (code t) "," (code c) "," (code b)
	      "," (code bl) ", and" (code tl)))
   "Connecting with Arrows"
   (page-para "Actually, straight-arrow combinations are so common that"
	      "Slideshow provides"
	      (code pin-arrow-line))
   (pin-arrow-line gap-size fish-file-scene
		   blue-fish rc-find
		   plain-file lt-find
		   1 "orange"))
  ;(require (lib "balloon.ss" "fta" "texpict"))
   (page-para "The" (code (lib "balloon.ss" "fta" "texpict"))
	      "library provides cartoon balloons" sym:emdash
	      "another reason to use" (code -find) "functions")
   (let* ([orig fish-file-scene]
	  [w/fish (pin-balloon (wrap-balloon (t "Fish") 'ne 0 (- gap-size))
			       orig blue-fish cb-find)]
	  [w/file (pin-balloon (wrap-balloon (t "File") 'nw (* -2 gap-size) 0)
			       plain-file rc-find)])
   (page-para "The" (code ghost) "function turns a picture invisible")
   (page-para "For example, the figure on the left and the"
              "figure on the right are the same size, because the"
	      "right one uses the" (code ghost) "of the left one")
   (let ([big-circle (circle 350)]
         [small-circle (circle 200)])
      (bound-frame big-circle)
	   (ghost big-circle)))))))))

  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; Utilities for running additional examples
  (define (link s)
    (let ([p (t s)])
       (pin-over p 0 (pict-height p)
		 (linewidth 2 (hline (pict-width p) 2)))

  #;(define (run-example-talk f)
    (let ([c (make-custodian)])
      (parameterize ([current-namespace (make-namespace-with-mred)]
		      (vector (build-path (collection-path "slideshow")
		     [current-custodian c]
		     [exit-handler (lambda (v)
				     (custodian-shutdown-all c))]
		     [current-directory (build-path (collection-path "slideshow")
	(parameterize ([current-eventspace (make-eventspace)])
	   (lambda () (dynamic-require '(lib "slideshow.ss" "slideshow") #f)))))))

  (require (lib "edit.ss" "mred"))
  (define (show-example-code f)
    (new-text-frame (build-path (collection-path "slideshow")

  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; Part IV
  (outline 'four)
  (define (in-picture-slide show-fish show-file show-link)
     "In-Picture Sequences"
     (page-para "Although" (code 'next) "and" (code 'alts)
		"can create simple sequences, use procedure"
		"abstraction and" (code ghost) "to create"
		"complex sequences inside pict assemblies")
     (let* ([orig fish-file-scene]
	    [w/fish (pin-balloon (wrap-balloon (t "Fish") 'ne 0 (- gap-size))
				 (ghost orig) blue-fish cb-find)]
	    [w/file (pin-balloon (wrap-balloon (t "File") 'nw (* -2 gap-size) 0)
				 (ghost w/fish) plain-file rc-find)])
       (cc-superimpose orig
		       (show-fish w/fish)
		       (show-file w/file)))
      (page-para/r "Larger example:" 
		   (clickback (link "run")
			      (lambda ()
				(run-example-talk "interlocking-components.scm")))
		   (clickback (link "code")
			      (lambda ()
				(show-example-code "interlocking-components.scm")))))))

  (define (ident x) x)
  (in-picture-slide ghost ghost ghost)
  (in-picture-slide ident ghost ghost)
  (in-picture-slide ident ident ident)

  (define (encloud p)
      (cloud (* 9/8 (pict-width p))
	     (* 3/2 (pict-height p))
	     "light gray")

  (require (lib "step.ss" "fta" "slideshow"))
   (intro basic-stx example-steps with-vonly with-vafter the-rest)
    "Named Steps"
    (page-para "The" (code (lib "step.ss" "fta" "slideshow"))
	       "library provides a" (code with-steps)
	       "form to better express complex sequences")
     ((vonly basic-stx)
      (code (with-steps
	     (_step-name ...)
     ((vonly example-steps)
      (code (with-steps
	     (intro detail conclusion)
     ((vafter with-vonly)
      (code (with-steps
	     (intro detail conclusion)
		 ((vonly with-vonly)
		  (code ((vonly intro)
			 (t "For a start..."))))
		 ((vafter with-vafter)
		  (code ((vafter detail)
			 (t "like this"))))))))))
     ((vonly basic-stx)
      (page-para "A" (code with-steps) "form has a sequences of step names"
		 "followed by an expression to evaluate once for each step"))
     ((vonly example-steps)
      (page-para "For example, the above has three steps:"
		 (code intro) "," (code detail)
		 ", and" (code conclusion)))
     ((vonly with-vonly)
       (page-para "In the body expression, use"
		  (code ((vonly _step-name) _pict-expr))
		  "to make" (code _pict-expr)
		  "visible only during" (code _step-name))
       (page-para "The expression" (code (vonly _step-name))
		  "produces either" (code ghost)
		  "or the identity function")))
     ((vonly with-vafter)
      (page-para "Use"
		 (code ((vafter _step-name) _pict-expr))
		 "to make" (code _pict-expr)
		 "visible after" (code _step-name)))
     ((vonly the-rest)
      (page-para "There's also" (code vbefore) "," (code vbetween) ", and more")))))

  (define smiley (face 'happy))
  (define desc (page-para "The" (code scroll-transition)
			  "function scrolls some part of the current slide"
			  "before shifting to the next slide."))
  (define (scroll-slide right?)
     "Transition Animations"
      (* 3 gap-size)
      ((if right? ghost values) smiley)
      ((if right? values ghost) smiley))
     ((if right? values ghost) (page-para "The face should have moved from left to right"))))
  (scroll-slide #f)
  ;; We really need a better way to do this!
  (let ([x (/ (- client-w (* 3 gap-size) (* 2 (pict-width smiley))) 2)]
	[y (+ (pict-height (titlet "Anything")) (* 2 gap-size)
	      (pict-height desc) gap-size)])
    (scroll-transition x y
		       (pict-width smiley) (pict-height smiley)
		       (+ (pict-width smiley) (* 3 gap-size)) 0
		       0.5 20))
  (scroll-slide #t)

  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; Background

  ;; A pict to use behind the main content
  (define fade-bg
    (let ([w (+ (* 2 margin) client-w)]
	  [h (+ (* 2 margin) client-h)]
	  [trans (make-object brush% "white" 'transparent)]
	  [inside (make-object brush% "white" 'solid)])
      (inset (dc (lambda (dc x y)
		   (let ([b (send dc get-brush)]
			 [p (send dc get-pen)]
			  (lambda (i)
			    (send dc draw-rectangle
				  (+ x i) (+ y i)
				  (- w (* 2 i)) (- h (* 2 i))))])
		     (send dc set-brush trans)
		      dc margin 1
		      (make-object color% "black")
		      (make-object color% "white")
		      #t #t)
		     (send dc set-brush inside)
		     (draw-one margin)
		     (send dc set-pen p)
		     (send dc set-brush b)))
		 w h 0 0)
	     (- margin))))

  (define orig-assembler (current-slide-assembler))

  ;; Normally, you'd set the slide assembler at the beginning
  ;;  of a talk and never change it
   (lambda (s v-sep c)
      (let ([c (colorize c "darkred")])
	(if s
	    (vc-append v-sep 
		       ;; left-aligns the title:
		       (page-para (titlet s)) 

  (outline 'background)

   "Controlling the Background"
   (page-para "The" (code current-slide-assembler)
	      "parameter lets you change the overall look of a slide")
   (page-para "For this slide and the previous one, the assembler")
   (page-item "Colorizes the uncolored content as dark red")
   (page-item "Left-aligns the title")
   (page-item "Draws a fading box around the slide"))

  (current-slide-assembler orig-assembler)

  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; Printing and Condensing
  (outline 'printing)

   (page-para "To export a set of slides as PostScript, "
	      "use the" (tt "slideshow") "command-line program:")
   (tt "slideshow --print myttalk.scm")
   (page-para "Slideshow steps through slides while producing PostScript pages")
   (page-para "The slides will look bad on the screen" sym:emdash "because"
	      "text is measured for printing instead of screen display"
	      sym:emdash "but the PostScript will be fine"))

   (page-para "Often, it makes sense to eliminate" (code 'step)
	      "staging when printing slides:")
   (tt "slideshow --print --condense myttalk.scm")
   (page-para "You can also condense without printing")
   (tt "slideshow --condense myttalk.scm")
   (page-para "For example, in condensed form, this slide appears"
	      "without steps"))
   "Steps and Condensing"
   (page-para "If you condense these slides,"
              "the previous slide's steps will be skipped")
   (page-para "Not this slide's steps, because it uses" (code 'next!)))
   "Condensing Alternatives"
   (page-para "Condensing" (it "does not") "merge" (code 'alts) "alternatives")
   (page-para "But sometimes you want condensing to just use the last alternative")
   (list (list (t "um..."))
         (list (page-para
                (code 'alts~) "creates alternatives where only the last one"
                "is used when condensing"))))

   "Condensing Steps"
   (page-para "The" (code (lib "step.ss" "fta" "slideshow"))
	      "provides" (code with-steps~)
	      "where only the last step is included when condensing")
   (page-para "Also, a" (code with-steps) "step name that"
	      "ends with" (code ~) "is skipped when condensing"))

   "Printing and Condensing Your Own Abstractions"
   (page-para "You can customize your slides using" (code printing?)
	      "and" (code condensing?))
   (page-para "This particular slide is"
	      (if printing? "printed" "not printed")
	      (if condense? "condensed" "not condensed"))
   (page-para "When you skip a whole slide, use"
	      (code skip-slides) "to keep page numbers in sync"))
  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; Conclusion starts here
  (outline 'end)

   "Your Own Slides"
   (page-para "A Slideshow presentation is a Scheme program in a module,"
              "so to make your own:")
   (scale/improve-new-text ; a macro that improves font selection
    (code (module mytalk (lib "slideshow.ss" "fta" "slideshow")
	    ... #,(it "your code here") ...))
   (page-para "For further information, search for"
	      (tt "slideshow") "and" (tt "texpict")
	      "in Help Desk"))