[plt-scheme] texpict: show-pict for big pictures
--- Carl Eastlund <carl.eastlund at gmail.com> wrote:
> I'm running some prototype code to generate pictures using texpict;
> right now I'm using show-pict to view the images. Some of them are
> too large for my screen and show-pict isn't putting in any helpful
> scrollbars. Is there a quick and easy way to throw together an
> image
> viewer with scrollbars? I'm hoping to avoid delving deep into the
> MrEd documentation for combinations of controls, canvases, and
> callbacks since my ultimate goal is output to postscript (but these
> initial images are also too big for a page). Anyone have a good
> scrollbarred-image recipe on hand?
Here's some MrEd magic that might help. It's possible that there's
already some class out there that does the on-paint refresh thing; I
just don't know about it.
HTH,
Ryan
;; Code:
(require (lib "mred.ss" "mred")
(lib "class.ss")
(lib "mrpict.ss" "texpict")
(lib "utils.ss" "texpict"))
(define the-big-pict (circle 2000))
;(show-pict the-pict) ;; very big window
(define pict-canvas%
(class canvas%
(init-field pict)
(inherit get-dc
init-auto-scrollbars)
(define/override (on-paint)
(super on-paint)
(draw-pict pict (get-dc) 0 0))
(super-new (style '(hscroll vscroll)))
(init-auto-scrollbars (pict-width pict) (pict-height pict) 0 0)))
(define frame (new frame% (label "pict") (width 200) (height 200)))
(define ec (new pict-canvas% (parent frame) (pict the-big-pict)))
(send frame show #t)
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs