experiment with alpha setting in dc<%>, plus some slideshow experiments and other minor changes

svn: r7399

original commit: b9a0d860c07a1c58c46a60fdb1ce0541eca225d2
This commit is contained in:
Matthew Flatt 2007-09-22 13:48:22 +00:00
parent 8c9a88983e
commit 6dff582220
5 changed files with 30 additions and 25 deletions

View File

@ -0,0 +1,6 @@
(module main mzscheme
(require (lib "class.ss")
(lib "mred.ss" "mred"))
(provide (all-from mzscheme)
(all-from (lib "class.ss"))
(all-from (lib "mred.ss" "mred"))))

View File

@ -0,0 +1,4 @@
(module reader mzscheme
(require (lib "module-reader.ss" "syntax"))
(provide-module-reader (lib "main.ss" "mred" "lang")))

View File

@ -373,6 +373,8 @@
on-event
on-paint)
(define-private-class dc% dc<%> object% #f
get-alpha
set-alpha
glyph-exists?
end-page
end-doc

View File

@ -1,26 +1,5 @@
(module reader mzscheme
(provide (rename *read read)
(rename *read-syntax read-syntax))
(require (lib "module-reader.ss" "syntax"))
(define (*read in)
(wrap in read))
(provide-module-reader mzscheme))
(define (*read-syntax src in)
(wrap in (lambda (in)
(read-syntax src in))))
(define (wrap port read)
(let ([body
(let loop ([a null])
(let ([v (read port)])
(if (eof-object? v)
(reverse a)
(loop (cons v a)))))])
(let* ([p-name (object-name port)]
[name (if (path? p-name)
(let-values ([(base name dir?) (split-path p-name)])
(string->symbol (path->string (path-replace-suffix name #""))))
'page)]
[id 'doc])
`(module ,name mzscheme
. ,body)))))

View File

@ -204,6 +204,8 @@
[hp2 hp]
[hp2.5 hp0]
[hp3 hp]
[hp4 (new horizontal-panel% [parent vp]
[stretchable-height #f])]
[bb (make-object bitmap% (sys-path "bb.gif") 'gif)]
[return (let* ([bm (make-object bitmap% (sys-path "return.xbm") 'xbm)]
[dc (make-object bitmap-dc% bm)])
@ -220,7 +222,8 @@
[smoothing 'unsmoothed]
[save-filename #f]
[save-file-format #f]
[clip 'none])
[clip 'none]
[current-alpha 1.0])
(send hp0 stretchable-height #f)
(send hp stretchable-height #f)
(send hp2.5 stretchable-height #f)
@ -936,9 +939,13 @@
mem-dc)
(get-dc)))])
(when dc
(send dc clear)
(send dc start-doc "Draw Test")
(send dc start-page)
(send dc set-alpha current-alpha)
(if clip-pre-scale?
(begin
(send dc set-scale 1 1)
@ -1205,7 +1212,14 @@
(set! clock-start #f)
(set! clock-end #f)
(send canvas refresh))))])
(make-object button% "Clip Clock" hp3 (lambda (b e) (clock #t)))))
(make-object button% "Clip Clock" hp3 (lambda (b e) (clock #t)))
(make-object slider% "Alpha" 0 10 hp4
(lambda (s e)
(let ([a (/ (send s get-value) 10.0)])
(unless (= a current-alpha)
(set! current-alpha a)
(send canvas refresh))))
10 '(horizontal plain))))
(send f show #t))