slideshow: add current-gap-size' and some
#:gap-size' arguments
This commit is contained in:
parent
ed6c08f548
commit
1ee2b6a522
|
@ -74,9 +74,9 @@ Alt-q (or Meta-q) to end the slides. Here are more controls:
|
|||
|
||||
The @racket[slide] function accepts any number of arguments. Each
|
||||
argument is a pict to be centered on the slide. The picts are stacked
|
||||
vertically with @racket[gap-size] separation between each pict, and
|
||||
vertically with @racket[(current-gap-size)] separation between each pict, and
|
||||
the total result is centered (as long as there's a gap of at least
|
||||
@racket[(* 2 gap-size)] between the title and content).
|
||||
@racket[(* 2 (current-gap-size))] between the title and content).
|
||||
|
||||
@racketmod[
|
||||
slideshow
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
@defproc[(slide [#:title title (or/c #f string? pict?) #f]
|
||||
[#:name name (or/c #f string?) title]
|
||||
[#:layout layout (or/c 'auto 'center 'top 'tall) 'auto]
|
||||
[#:gap-size sep-gap-size real? (current-gap-size)]
|
||||
[#:inset inset slide-inset? (make-slide-inset 0 0 0 0)]
|
||||
[#:timeout secs (or/c #f real?) #f]
|
||||
[#:condense? condense? any/c (and timeout #t)]
|
||||
|
@ -33,8 +34,9 @@
|
|||
(listof (listof elem/c))))] ...)
|
||||
void?]{
|
||||
|
||||
Creates and registers a slide. See @secref["staging"] for information
|
||||
about @racket[element]s.
|
||||
Creates and registers a slide. See @secref["staging"] for
|
||||
information about @racket[element]s. Multiple @racket[element] picts are
|
||||
separated by @racket[sep-gap-size] vertical space.
|
||||
|
||||
When this function is first called in non-printing mode, then the
|
||||
viewer window is opened. Furthermore, each call to the function
|
||||
|
@ -46,13 +48,13 @@ slide. The @racket[name] is used in the slide-navigation dialog, and
|
|||
it defaults to @racket[title].
|
||||
|
||||
If @racket[layout] is @racket['top], then the content is top-aligned,
|
||||
with @racket[(* 2 gap-size)] space between the title and the
|
||||
with @racket[(* 2 sep-gap-size)] space between the title and the
|
||||
content. The @racket['tall] layout is similar, but with only
|
||||
@racket[gap-size]. The @racket['center] mode centers the content
|
||||
@racket[sep-gap-size] space. The @racket['center] mode centers the content
|
||||
(ignoring space consumed by the title). The @racket['auto] mode is
|
||||
like @racket['center], except when @racket[title] is non-@racket[#f]
|
||||
and when the space between the title and content would be less than
|
||||
@racket[(* 2 gap-size)], in which case it behaves like @racket['top].
|
||||
@racket[(* 2 sep-gap-size)], in which case it behaves like @racket['top].
|
||||
|
||||
The @racket[inset] argument supplies an inset that makes the
|
||||
slide-viewing window smaller when showing the slide. See
|
||||
|
@ -143,7 +145,8 @@ See the spacing between lines is determined by the
|
|||
|
||||
|
||||
@defproc[(item [#:width width real? (current-para-width)]
|
||||
[#:bullet blt pict? bullet]
|
||||
[#:gap-size sep-gap-size real? (current-gap-size)]
|
||||
[#:bullet blt pict? (scale bullet (/ sep-gap-size gap-size))]
|
||||
[#:align align (or/c 'left 'center 'right) 'left]
|
||||
[#:fill? fill? any/c #t]
|
||||
[#:decode? decode? any/c #t]
|
||||
|
@ -152,14 +155,15 @@ See the spacing between lines is determined by the
|
|||
pict?]{
|
||||
|
||||
Like @racket[para], but with @racket[blt] followed by @racket[(/
|
||||
gap-size 2)] space appended horizontally to the resulting paragraph,
|
||||
sep-gap-size 2)] space appended horizontally to the resulting paragraph,
|
||||
aligned with the top line. The paragraph width of @racket[blt] plus
|
||||
@racket[(/ gap-size 2)] is subtracted from the maximum width of the
|
||||
@racket[(/ sep-gap-size 2)] is subtracted from the maximum width of the
|
||||
paragraph.}
|
||||
|
||||
|
||||
@defproc[(subitem [#:width width real? (current-para-width)]
|
||||
[#:bullet blt pict? o-bullet]
|
||||
[#:gap-size sep-gap-size real? (current-gap-size)]
|
||||
[#:bullet blt pict? (scale o-bullet (/ sep-gap-size gap-size))]
|
||||
[#:align align (or/c 'left 'center 'right) 'left]
|
||||
[#:fill? fill? any/c #t]
|
||||
[#:decode? decode? any/c #t]
|
||||
|
@ -167,7 +171,7 @@ paragraph.}
|
|||
(or/c string? pict? (listof elem/c)))] ...)
|
||||
pict?]{
|
||||
|
||||
Like @racket[item], but an additional @racket[(* 2 gap-size)] is
|
||||
Like @racket[item], but an additional @racket[(* 2 sep-gap-size)] is
|
||||
subtracted from the paragraph width and added as space to the left of
|
||||
the pict. Also, @racket[o-bullet] is the default bullet, instead of
|
||||
@racket[bullet].}
|
||||
|
@ -314,6 +318,14 @@ argument.
|
|||
A width commonly used for layout.}
|
||||
|
||||
|
||||
@defparam[current-gap-size sep-gap-size real?]{
|
||||
|
||||
A parameter whose value is a width used for the separation between
|
||||
items by @racket[slide], the size and spacing of a bullet for
|
||||
@racket[item], the space between a slide title and content in
|
||||
@racket['tall] mode, etc. The default value is @racket[gap-size].}
|
||||
|
||||
|
||||
@defthing[bullet pict?]{
|
||||
|
||||
A filled bullet used by default by @racket[item].
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
(rename-out [item/kw item]
|
||||
[subitem/kw subitem]
|
||||
[para/kw para])
|
||||
gap-size current-font-size current-line-sep
|
||||
gap-size current-gap-size current-font-size current-line-sep
|
||||
current-main-font current-title-color
|
||||
size-in-pixels
|
||||
t it bt bit tt titlet tt* rt
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
(define font-size base-font-size)
|
||||
(define gap-size (* 3/4 font-size))
|
||||
(define current-gap-size (make-parameter gap-size))
|
||||
(define line-sep 2)
|
||||
(define title-size (+ font-size 4))
|
||||
(define main-font (if (and (not printing?)
|
||||
|
@ -268,7 +269,7 @@
|
|||
(define-struct name-only (title))
|
||||
(define-struct name+title (name title))
|
||||
|
||||
(define (one-slide/title/inset do-add-slide! use-assem? process v-sep skipped-pages s inset timeout . x)
|
||||
(define (one-slide/title/inset do-add-slide! use-assem? process v-sep skipped-pages s inset timeout a-gap-size . x)
|
||||
(let-values ([(x c)
|
||||
(let loop ([x x][c #f][r null])
|
||||
(cond
|
||||
|
@ -286,7 +287,7 @@
|
|||
s))
|
||||
v-sep
|
||||
(apply vc-append
|
||||
gap-size
|
||||
a-gap-size
|
||||
(map evenize-width (process x))))])
|
||||
(do-add-slide!
|
||||
content
|
||||
|
@ -308,7 +309,8 @@
|
|||
string
|
||||
args))
|
||||
|
||||
(define (do-slide/title/tall/inset do-add-slide! use-assem? skip-ok? skip-all? process v-sep s inset timeout . x)
|
||||
(define (do-slide/title/tall/inset do-add-slide! use-assem? skip-ok? skip-all? process v-sep s
|
||||
inset timeout a-gap-size . x)
|
||||
;; Check slides:
|
||||
(let loop ([l x][nested null])
|
||||
(or (null? l)
|
||||
|
@ -341,7 +343,8 @@
|
|||
(if skip-all?
|
||||
(add1 skipped)
|
||||
(begin
|
||||
(apply one-slide/title/inset do-add-slide! use-assem? process v-sep skipped s inset timeout (reverse r))
|
||||
(apply one-slide/title/inset do-add-slide! use-assem? process v-sep skipped s
|
||||
inset timeout a-gap-size (reverse r))
|
||||
0))]
|
||||
[(memq (car l) '(nothing))
|
||||
(loop (cdr l) r comment skip-all? skipped)]
|
||||
|
@ -350,7 +353,8 @@
|
|||
(let ([skipped (if skip?
|
||||
(add1 skipped)
|
||||
(begin
|
||||
(apply one-slide/title/inset do-add-slide! use-assem? process v-sep skipped s inset timeout (reverse r))
|
||||
(apply one-slide/title/inset do-add-slide! use-assem? process v-sep skipped s
|
||||
inset timeout a-gap-size (reverse r))
|
||||
0))])
|
||||
(loop (cdr l) r comment skip-all? skipped)))]
|
||||
[(memq (car l) '(alts alts~))
|
||||
|
@ -374,6 +378,7 @@
|
|||
#:timeout [timeout #f]
|
||||
#:layout [layout 'auto]
|
||||
#:condense? [condense-this? timeout]
|
||||
#:gap-size [a-gap-size (current-gap-size)]
|
||||
. body)
|
||||
(let ([t (if s
|
||||
(if (equal? name s)
|
||||
|
@ -392,19 +397,21 @@
|
|||
(apply do-slide/title/tall/inset
|
||||
do-add-slide! #t #t (and condense? condense-this?) values
|
||||
(if (eq? layout 'tall)
|
||||
gap-size
|
||||
(* 2 gap-size))
|
||||
a-gap-size
|
||||
(* 2 a-gap-size))
|
||||
t
|
||||
inset
|
||||
timeout
|
||||
inset
|
||||
timeout
|
||||
a-gap-size
|
||||
body)]
|
||||
[else ; center, auto
|
||||
(apply slide/title/center/inset/timeout
|
||||
(apply slide/title/center/inset/timeout/gap
|
||||
(or (not s) (eq? layout 'center))
|
||||
(and condense? condense-this?)
|
||||
t
|
||||
inset
|
||||
timeout
|
||||
a-gap-size
|
||||
body)]))
|
||||
(void))])
|
||||
slide))
|
||||
|
@ -413,7 +420,7 @@
|
|||
(make-sinset l t r b))
|
||||
|
||||
(define (slide/title/tall/inset/gap v-sep s inset . x)
|
||||
(apply do-slide/title/tall/inset do-add-slide! #t #t #f values v-sep s inset #f x))
|
||||
(apply do-slide/title/tall/inset do-add-slide! #t #t #f values v-sep s inset #f gap-size x))
|
||||
|
||||
(define (slide/title/tall/inset s inset . x)
|
||||
(apply slide/title/tall/inset/gap gap-size s inset x))
|
||||
|
@ -422,7 +429,7 @@
|
|||
(apply slide/title/tall/inset (make-name-only s) inset x))
|
||||
|
||||
(define (slide/title/tall/gap v-sep s timeout . x)
|
||||
(apply do-slide/title/tall/inset do-add-slide! #t #t #f values v-sep s zero-inset timeout x))
|
||||
(apply do-slide/title/tall/inset do-add-slide! #t #t #f values v-sep s zero-inset timeout gap-size x))
|
||||
|
||||
(define (slide/title/tall s . x)
|
||||
(apply slide/title/tall/gap gap-size s #f x))
|
||||
|
@ -452,10 +459,13 @@
|
|||
(apply slide/title/center/inset/timeout #t #f s inset #f x))
|
||||
|
||||
(define (slide/title/center/inset/timeout always-center? skip-all? s inset timeout . x)
|
||||
(apply slide/title/center/inset/timeout/gap always-center? skip-all? s inset timeout gap-size x))
|
||||
|
||||
(define (slide/title/center/inset/timeout/gap always-center? skip-all? s inset timeout a-gap-size . x)
|
||||
(let ([max-width 0]
|
||||
[max-height 0]
|
||||
[combine (lambda (x)
|
||||
(apply vc-append gap-size
|
||||
(apply vc-append a-gap-size
|
||||
(map
|
||||
evenize-width
|
||||
x)))])
|
||||
|
@ -468,11 +478,11 @@
|
|||
#f
|
||||
#f
|
||||
(lambda (x) (list (combine x)))
|
||||
0 #f inset timeout x)
|
||||
0 #f inset timeout a-gap-size x)
|
||||
(let ([center? (or always-center?
|
||||
(max-height . < . (- client-h
|
||||
(* 2
|
||||
(+ (* 2 gap-size)
|
||||
(+ (* 2 a-gap-size)
|
||||
title-h)))))])
|
||||
(apply do-slide/title/tall/inset
|
||||
do-add-slide!
|
||||
|
@ -490,8 +500,8 @@
|
|||
(blank max-width max-height)
|
||||
(combine x)))))
|
||||
values)
|
||||
(if center? 0 (* 2 gap-size))
|
||||
s inset timeout x))))
|
||||
(if center? 0 (* 2 a-gap-size))
|
||||
s inset timeout a-gap-size x))))
|
||||
|
||||
(define (slide/name/center/inset s inset . x)
|
||||
(apply slide/title/center/inset (make-name-only s) inset x))
|
||||
|
@ -831,17 +841,20 @@
|
|||
;; ----------------------------------------
|
||||
|
||||
(define item/kw
|
||||
(let ([item (lambda (#:bullet [bullet bullet]
|
||||
#:width [width (current-para-width)]
|
||||
#:align [align 'left]
|
||||
#:fill? [fill? #t]
|
||||
#:decode? [decode? #t]
|
||||
(let ([item (lambda (#:gap-size [a-gap-size (current-gap-size)]
|
||||
#:bullet [bullet (if (eq? a-gap-size gap-size)
|
||||
bullet
|
||||
(scale bullet (/ a-gap-size gap-size)))]
|
||||
#:width [width (current-para-width)]
|
||||
#:align [align 'left]
|
||||
#:fill? [fill? #t]
|
||||
#:decode? [decode? #t]
|
||||
. s)
|
||||
(htl-append (/ gap-size 2)
|
||||
(htl-append (/ a-gap-size 2)
|
||||
bullet
|
||||
(para/kw #:width (- width
|
||||
(pict-width bullet)
|
||||
(/ gap-size 2))
|
||||
(/ a-gap-size 2))
|
||||
#:align align
|
||||
#:fill? fill?
|
||||
#:decode? decode?
|
||||
|
@ -882,23 +895,26 @@
|
|||
;; ----------------------------------------
|
||||
|
||||
(define subitem/kw
|
||||
(let ([subitem (lambda (#:bullet [bullet o-bullet]
|
||||
#:width [width (current-para-width)]
|
||||
#:align [align 'left]
|
||||
#:fill? [fill? #t]
|
||||
#:decode? [decode? #t]
|
||||
. s)
|
||||
(inset (htl-append (/ gap-size 2)
|
||||
(let ([subitem (lambda (#:gap-size [a-gap-size (current-gap-size)]
|
||||
#:bullet [bullet (if (eq? gap-size a-gap-size)
|
||||
o-bullet
|
||||
(scale o-bullet (/ a-gap-size gap-size)))]
|
||||
#:width [width (current-para-width)]
|
||||
#:align [align 'left]
|
||||
#:fill? [fill? #t]
|
||||
#:decode? [decode? #t]
|
||||
. s)
|
||||
(inset (htl-append (/ a-gap-size 2)
|
||||
bullet
|
||||
(para/kw #:width (- width
|
||||
(* 2 gap-size)
|
||||
(* 2 a-gap-size)
|
||||
(pict-width bullet)
|
||||
(/ gap-size 2))
|
||||
(/ a-gap-size 2))
|
||||
#:align align
|
||||
#:fill? fill?
|
||||
#:decode? decode?
|
||||
s))
|
||||
(* 2 gap-size) 0 0 0))])
|
||||
(* 2 a-gap-size) 0 0 0))])
|
||||
subitem))
|
||||
|
||||
(define (subitem* w . s)
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
itemize itemize* page-itemize page-itemize*
|
||||
para/kw para para* page-para page-para*
|
||||
para/c para/r para*/c para*/r page-para/c page-para/r page-para*/c page-para*/r
|
||||
font-size gap-size current-font-size current-line-sep line-sep title-size
|
||||
font-size gap-size current-gap-size current-font-size current-line-sep line-sep title-size
|
||||
main-font current-main-font with-font current-title-color
|
||||
red green blue purple orange size-in-pixels
|
||||
t it bt bit tt titlet tt* rt
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
itemize itemize* page-itemize page-itemize*
|
||||
para para* page-para page-para*
|
||||
para/c para/r para*/c para*/r page-para/c page-para/r page-para*/c page-para*/r
|
||||
font-size gap-size current-font-size current-line-sep line-sep title-size
|
||||
font-size gap-size current-gap-size current-font-size current-line-sep line-sep title-size
|
||||
main-font current-main-font with-font current-title-color
|
||||
red green blue purple orange size-in-pixels
|
||||
bullet o-bullet
|
||||
|
|
|
@ -111,8 +111,9 @@
|
|||
#:title "Spacing"
|
||||
(para "The" (tt "slide") "functions insert space"
|
||||
"between each body pict")
|
||||
(para "The amount of space is" (number->string gap-size)
|
||||
", which is the value of" (tt "gap-size")))
|
||||
(para "The amount of space is" (number->string (current-gap-size))
|
||||
", which is the value of" (tt "(current-gap-size)")
|
||||
", which defaults to" (tt "gap-size")))
|
||||
|
||||
(slide
|
||||
#:title "Controlling Space"
|
||||
|
|
Loading…
Reference in New Issue
Block a user