[racket] slideshow, footer

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Fri Apr 13 16:19:10 EDT 2012

On Fri, Apr 13, 2012 at 3:48 PM, Geoffrey S. Knauth <geoff at knauth.org> wrote:
> Is there a standard way that people use to add a footer and/or image to each slideshow slide?  I'm sure I can roll my own, but I was wondering if there were examples in the wild so I don't reinvent the wheel.

current-slide-assembler can also do what you want:
http://docs.racket-lang.org/slideshow/Configuration.html?q=assembler#(def._((lib._slideshow/base..rkt)._current-slide-assembler))


Here's the example code from the tutorial (collects/slideshow/tutorial.rkt)

;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 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)]
                       [draw-one
                        (lambda (i)
                          (send dc draw-rectangle
                                (+ x i) (+ y i)
                                (- w (* 2 i)) (- h (* 2 i))))])
                   (send dc set-brush trans)
                   (color-series
                    dc margin 1
                    (make-object color% "black")
                    (make-object color% "white")
                    draw-one
                    #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
(current-slide-assembler
 (lambda (s v-sep c)
   (lt-superimpose
    fade-bg
    (let ([c (colorize c "darkred")])
      (if s
          (vc-append v-sep
                     ;; left-aligns the title:
                     (para (titlet s))
                     c)
          c)))))

(outline 'background)

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

(current-slide-assembler orig-assembler)







>
> (I'm giving a CAP safety briefing tomorrow morning, and while I could do it in PowerPoint, which is what everyone does, the briefing involves looking at actual aviation maps and weather graphics real-time, which made me think of Racket Slideshow.)
>
> Geoff
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users


Posted on the users mailing list.