add pdf-dc%; make slideshow/pict depend on racket/draw, not racket/gui

original commit: 2edadd611303978255f6ff53efa5b691a0f7f0a5
This commit is contained in:
Matthew Flatt 2010-11-26 10:25:37 -07:00
parent 7789fcd827
commit f56c9fbe30
3 changed files with 17 additions and 11 deletions

View File

@ -143,6 +143,7 @@ open-output-text-editor
pane%
panel%
pasteboard%
pdf-dc%
pen%
pen-list%
play-sound

View File

@ -263,7 +263,7 @@
[on-paint
(case-lambda
[() (time (on-paint #f))]
[(ps?)
[(kind)
(let* ([can-dc (get-dc)]
[pen0s (make-object pen% "BLACK" 0 'solid)]
[pen1s (make-object pen% "BLACK" 1 'solid)]
@ -811,7 +811,7 @@
(send dc draw-rectangle 180 205 20 20)
(send dc set-brush brushs))))
(when (and pixel-copy? last? (not (or ps? (eq? dc can-dc))))
(when (and pixel-copy? last? (not (or kind (eq? dc can-dc))))
(let* ([x 100]
[y 170]
[x2 245] [y2 188]
@ -941,7 +941,7 @@
(send dc draw-rectangle 187 310 20 20)
(send dc set-pen p)))
(when (and last? (not (or ps? (eq? dc can-dc)))
(when (and last? (not (or kind (eq? dc can-dc)))
(send mem-dc get-bitmap))
(send can-dc draw-bitmap (send mem-dc get-bitmap) 0 0 'opaque)))
@ -950,10 +950,11 @@
(send (get-dc) set-scale 1 1)
(send (get-dc) set-origin 0 0)
(let ([dc (if ps?
(let ([dc (if (eq? ps? 'print)
(make-object printer-dc%)
(make-object post-script-dc%))])
(let ([dc (if kind
(let ([dc (case kind
[(print) (make-object printer-dc%)]
[(ps) (make-object post-script-dc%)]
[(pdf) (make-object pdf-dc%)])])
(and (send dc ok?) dc))
(if (and use-bitmap?)
(begin
@ -1112,7 +1113,7 @@
(let-values ([(w h) (send dc get-size)])
(unless (cond
[ps? #t]
[kind #t]
[use-bad? #t]
[use-bitmap? (and (= w (* xscale DRAW-WIDTH)) (= h (* yscale DRAW-HEIGHT)))]
[else (and (= w (* 2 DRAW-WIDTH)) (= h (* 2 DRAW-HEIGHT)))])
@ -1143,10 +1144,10 @@
'(horizontal))
(make-object button% "PS" hp
(lambda (self event)
(send canvas on-paint #t)))
(make-object button% "Print" hp
(send canvas on-paint 'ps)))
(make-object button% "PDF" hp
(lambda (self event)
(send canvas on-paint 'print)))
(send canvas on-paint 'pdf)))
(make-object choice% #f '("1" "*2" "/2" "1,*2" "*2,1") hp
(lambda (self event)
(send canvas set-scale
@ -1243,6 +1244,7 @@
(send canvas refresh))))])
(set! do-clock clock)
(make-object button% "Clip Clock" hp3 (lambda (b e) (clock #t)))
(make-object button% "Print" hp4 (lambda (self event) (send canvas on-paint 'print)))
(make-object button% "Print Setup" hp4 (lambda (b e) (let ([c (get-page-setup-from-user)])
(when c
(send (current-ps-setup) copy-from c)))))

View File

@ -112,6 +112,9 @@ that it is installed as a clipping region.
The old 'xor mode for pens and brushes is no longer available (since
it is not supported by Cairo).
The new `pdf-dc%' drawing context is like `post-script-dc%', but it
generates PDF output.
Editor Changes
--------------