Add frame options to show-pict

This commit is contained in:
James Swaine 2012-10-05 15:37:56 -05:00
parent b6b5043ff9
commit f38bd159d2
2 changed files with 19 additions and 4 deletions

View File

@ -1161,13 +1161,20 @@ repeated calls to @racket[draw-pict].}
@defproc[(show-pict [pict pict?]
[w (or/c #f exact-nonnegative-integer?) #f]
[h (or/c #f exact-nonnegative-integer?) #f])
[h (or/c #f exact-nonnegative-integer?) #f]
[#:frame-x frame-x (or/c (integer-in -10000 10000) #f)]
[#:frame-y frame-y (or/c (integer-in -10000 10000) #f)]
[#:frame-style frame-style (listof (or/c 'no-resize-border 'no-caption
'no-system-menu 'hide-menu-bar
'toolbar-button 'float 'metal))])
void?]{
Opens a frame that displays @racket[pict]. The frame adds one method,
@racket[set-pict], which takes a pict to display. The optional
@racket[w] and @racket[h] arguments specify a minimum size for the
frame's drawing area.}
frame's drawing area, and the @racket[frame-x], @racket[frame-y],
and @racket[frame-style] keyword arguments behave in the same manner as @racket[x],
@racket[y], and @racket[style] arguments for the @racket[frame%].}
@defparam[current-expected-text-scale scales (list real? real?)]{

View File

@ -15,7 +15,11 @@
texpict-common-setup^)
(define show-pict
(λ (p [w #f] [h #f])
(λ (p [w #f]
[h #f]
#:frame-style [frame-style '()]
#:frame-x [frame-x #f]
#:frame-y [frame-y #f])
(define the-pict p)
(define pict-drawer (make-pict-drawer the-pict))
(define no-redraw? #f)
@ -51,7 +55,11 @@
0)])
(pict-drawer dc xo yo)))))
(super-instantiate ())))
(define f (make-object pict-frame% "MrPict"))
(define f (new pict-frame%
[label "MrPict"]
[style frame-style]
[x frame-x]
[y frame-y]))
(define c (make-object pict-canvas% f))
(send (send c get-dc) set-smoothing 'aligned)
(send f set-pict p)