[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing a picture


Thank you very much for all your help. I can now print geta-grapher output
to a pict using the oou package on Cambridge. The following saves a picture
of the entire window contents to a pict file. 
Thanks again.

Michael Young

Adapted from geta-grapher code by by Gilles Serasset and Mathieu Lafourcade:

    The geta-grapher package (available on cambridge.apple.com)
   provides a set of classes which
  allows you to graphically display any data structure
  which can be expressed as a tree or DAG (directed
  acyclic graph).
    It is based on the grapher.lisp file from Apple Computer 
  and on the grapher.lisp file from Bill Anderson (University
  of Maryland).

     Gilles Serasset                       Mathieu Lafourcade

     GETA-Imag                             GETA-Imag
     150, rue de la Chimie                 150, rue de la Chimie
     BP 53,                                BP 53, 
     38041 Grenoble Cedex 9                38041 Grenoble Cedex 9
     FRANCE                                FRANCE

     phone : (33)              phone : (33)
     e-mail : Gilles.Serasset@imag.fr      e-mail :
Mathieu.Lafourcade@imag.fr (Internet)

oodles-of-utils:brutal-utils:PICT-u.lisp must be loaded.

oodles-of-utils (available on cambridge.apple.com) 
is a large collection of MCL code to help access the
Mac ToolBox and create user interfaces. It requires MCL 2.0p1
or later. To learn more about them, read the documention.

 Mike Engber
 1585 Ridge Ave
 Evanston, IL 60201

  from InterNet: engber@ils.nwu.edu
 from AppleLink: engber@ils.nwu.edu@INTERNET#
from CompuServe: >INTERNET:engber@ils.nwu.edu


(defmethod save-graph-to-pict ((self geta-grapher-window) &optional
(show-dialog? T))
  (declare (optimize (speed 3) (safety 0) (compilation-speed 0) (space 0)))
  (declare (ignore show-dialog?))

  ;; On defini une variable pour contenir le dessin.
     (grapher-scroll-position (view-scroll-position (ccl::my-scroller self)))
     (grapher-window-size (view-size self)))
    (window-hide self)
    (set-view-size self (add-points #@(20 20) (compute-field-size self)))
    (set-view-scroll-position (ccl::my-scroller self) #@(0 0))

    (setf (slot-value (slot-value self  'ccl::my-scroller) 'view-size)
          (compute-field-size self))  

    ;; On regarde ce qui est dessine dans le scroller de la fenetre.
    (start-picture (slot-value self  'ccl::my-scroller) ) 
    ;; On dessine.
    (with-focused-view (slot-value self  'ccl::my-scroller)
      (node-print (slot-value self 'root-node)))
    ;; On recupere le dessin.
    (setf *geta-grapher-picture* (get-picture (slot-value self 
    ;; On l'imprime.
    (oou::write-picture-to-file *geta-grapher-picture* (choose-new-file-dialog))

    ;; On restaure les settings.
    (set-view-size self grapher-window-size)
    (set-view-scroll-position (ccl::my-scroller self) grapher-scroll-position)
    (window-select self)

    ;; Et enfin, on le libere.
    (kill-picture *geta-grapher-picture*)))