slideshow: add `slide->pict'

This commit is contained in:
Matthew Flatt 2012-05-21 12:07:45 -06:00
parent 1eec136c3f
commit 5962e542f7
5 changed files with 20 additions and 7 deletions

View File

@ -239,10 +239,16 @@ Returns @racket[#t] if @racket[v] is a comment produced by
@section{Slide Registration}
@defproc[(slide? [v any/c]) boolean?]{
Returns @racket[#t] if @racket[v] is a slide produced by
@racket[most-recent-slide] or @racket[retract-most-recent-slide].}
@defproc[(most-recent-slide) slide?]{
Returns a slide structure that be supplied @racket[re-slide] to make a
copy of the slide.}
copy of the slide or @racket[slide->pict] to re-extract the entire
slide as a pict.}
@defproc[(retract-most-recent-slide) slide?]{
@ -256,10 +262,11 @@ structure that be supplied to @racket[re-slide] to restore the slide
Re-inserts a slide, @racket[lt-superimpose]ing the given additional
@racket[pict].}
@defproc[(slide? [v any/c]) boolean?]{
@defproc[(slide->pict [slide slide?])
pict?]{
Returns @racket[#t] if @racket[v] is a slide produced by
@racket[most-recent-slide] or @racket[retract-most-recent-slide].}
Converts a complete slide to a @racket[pict]. The bounding box of the
result corresponds to the slide within its margins.}
@; ------------------------------------------------------------------------

View File

@ -24,7 +24,7 @@
[sliderec? slide?]
[just-a-comment? comment?])
comment
most-recent-slide retract-most-recent-slide re-slide start-at-recent-slide
most-recent-slide retract-most-recent-slide re-slide slide->pict start-at-recent-slide
make-outline
(rename-out [item/kw item]
[subitem/kw subitem]

View File

@ -560,6 +560,12 @@
null
(sliderec-timeout s)))
(set! page-number (+ page-number 1))))
(define (slide->pict s)
(unless (sliderec? s)
(raise-type-error 'slide->pict "slide" s))
(let ([orig (sliderec-drawer s)])
(dc orig client-w client-h)))
(define (start-at-recent-slide)
(viewer:set-init-page! (max 0 (- page-number 2))))

View File

@ -55,7 +55,7 @@
slide/center/timeout
slide/title/center/timeout
most-recent-slide retract-most-recent-slide re-slide start-at-recent-slide
most-recent-slide retract-most-recent-slide re-slide slide->pict start-at-recent-slide
scroll-transition pause-transition
comment make-outline
item/kw item item* page-item page-item*

View File

@ -102,7 +102,7 @@
[rt (string? . -> . pict?)]
[tt* (() () #:rest (listof string?) . ->* . pict?)])
(provide slide/kw
most-recent-slide retract-most-recent-slide re-slide start-at-recent-slide
most-recent-slide retract-most-recent-slide re-slide slide->pict start-at-recent-slide
scroll-transition pause-transition
make-outline
item item* page-item page-item*