home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!agate!stanford.edu!apple!cambridge.apple.com!nrb!keunen@relay.EU.net
- From: nrb!keunen@relay.EU.net (Vincent Keunen)
- Newsgroups: comp.lang.lisp.mcl
- Subject: printing in CLIM - summary
- Message-ID: <19921218082349.1.KEUNEN@nrbmi1.ia.nrb.be>
- Date: 18 Dec 92 08:23:00 GMT
- Sender: info-mcl-request@cambridge.apple.com
- Reply-To: nrb!keunen@relay.EU.net
- Lines: 206
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
-
- Thanks to all that replied to my request. I must say that I am *very*
- impressed by clim's abilities to print. Boy, what a difference with
- other systems!!! That's what I call a well tought, easy to use and
- reliable way to do things. I had *no* problem.
-
- If someone wants to create a clim FAQ, this can be inserted in it.
-
- Here is the original request:
-
-
- I'd like to print the content of what has been accumulated in a stream
- (part of a pane of a frame).
-
- When the content is only text, it's easy, I just do:
-
-
- (define-nanesse-history-command
- (com-print-history :name t :menu t)
- ()
- (with-open-file (output-file "nanesse:to-print;history.text"
- :direction :output
- :if-exists :new-version)
- (clim:copy-textual-output-history
- (frame-standard-output clim:*application-frame*) output-file))
- (cp:execute-command "hardcopy file" "nanesse:to-print;history.text"))
-
-
- But when it's general clim drawing functions, I guess I must use
- with-output-to-postscript-stream and somehow replay the history of my
- pane (from the parent output-record, right?) in the new postscript
- stream.
-
- Does someone have a nice and easy example of this to help me out?
-
- vk
-
-
- Here are the replies (I think they are all useful in understanding the problem):
-
- 1----------------
- Date: Mon, 14 Dec 92 18:48:33 +0100
- From: Oliver Christ <oli@adler.ims.uni-stuttgart.de>
- Message-Id: <9212141748.AA20718@adler.ims.uni-stuttgart.de>
- Received: by milan.ims.uni-stuttgart.de
- id AA00441; Mon, 14 Dec 92 18:48:33 +0100
- To: keunen@nrb.be
- In-Reply-To: Vincent Keunen's message of Mon, 14 Dec 1992 17:33+0200 <19921214153325.9.KEUNEN@nrbmi1.ia.nrb.be>
- Subject: printing a clim stream
- Reply-To: oli@ims.uni-stuttgart.de
-
- Hi Vincent,
-
- I have been using something like
-
-
- (with-open-file (psfile <<<filename>>> :direction :output :if-exists :supersede)
- (clim:with-output-to-postscript-stream (stream psfile :multi-page t)
- (clim:replay (slot-value (clim:get-frame-pane clim:*application-frame*
- '<<<pane-name>>>)
- 'clim::output-record)
- stream)))
-
- but it isn't as nice as redoing the whole output (call a redisplay function)
- with output to PostScript.
-
- Greetings,
-
- Oli
-
-
- 2----------------
- Date: Mon, 14 Dec 1992 13:57-0500
- From: Scott McKay <SWM@STONY-BROOK.SCRC.Symbolics.COM>
- Subject: printing a clim stream
- To: nrb!keunen, clim@nrbmi2.ia.nrb.be
- In-Reply-To: <19921214153325.9.KEUNEN@nrbmi1.ia.nrb.be>
- Message-Id: <19921214185711.9.SWM@SUMMER.SCRC.Symbolics.COM>
-
-
- There is no such "nice and easy example", because it is not nice and
- easy. Moving output records from one display device to another is not
- easy because text and graphics can have different sizes on different
- output devices. Thus, using FORMATTING-TABLE on some window to format a
- table full of text can produce output records that no good for some
- postscript printer, because the alignment is all wrong.
-
- The only way to reliably get good output for multiple display devices is
- to generate it freshly for each display device.
-
-
- 3----------------
- Date: Mon, 14 Dec 1992 14:54-0500
- From: Mark Nahabedian <naha@RIVERSIDE.SCRC.Symbolics.COM>
- Subject: printing a clim stream
- To: nrb!keunen, keunen@nrb.be, clim@nrbmi2.ia.nrb.be
- In-Reply-To: <19921214153325.9.KEUNEN@nrbmi1.ia.nrb.be>
- Message-Id: <19921214195452.5.NAHA@LILIKOI.SCRC.Symbolics.COM>
-
- Actually what you should do is re-execute the code which did the
- drawing, this time doing the output to a PostScript stream instead of to
- the window where you drew it before. Output histories are specific to
- the window they were created for and should not be used in conjunction
- with a different output stream.
-
-
- 4----------------
- Date: Mon, 14 Dec 1992 17:28:36 -0700
- From: Brent Reeves <brentr@sigi.cs.colorado.edu>
- Message-Id: <199212150028.AA27368@sigi.cs.colorado.edu>
- To: nrb!keunen
- In-Reply-To: Vincent Keunen's message of 14 Dec 1992 17:33+0200
- Subject: printing a clim stream
-
-
- since the draw-work-area (below, in the com-ps command) function
- takes a stream as input, it is easy to redirect this stream to
- the postscript stream. Notice in this command there is
- strangeness going on... after I create the postscript stream, I
- read it back in and delete a "setrgbcolor" line. This oughtn't
- have to be done, but for me [Genera 8.1 CLIM 1.1] it is the only
- way I can get it to work. Also, I print the file from a UNIX
- box; "hardcopy file" does not work. Others have not trouble
- with postscript and "hardcopy file", so it may work fine like in
- your example above.
-
- (define-indy-command (com-ps :name t :menu nil)
- ((scale 'float))
- (with-open-file
- (file-stream
- "sigi:/homes/brentr/indy/src/testing/todel.ps"
- :direction :output)
- (clim:with-output-to-postscript-stream
- (stream file-stream
- :multi-page t)
- (with-scaling (stream scale scale)
- (draw-work-area *af* stream))))
- ;;
- ;; now remove the offending " 1.00 1.00 1.00 setrgbcolor" line
- ;;
- (let ((eof '|EOF|)
- line)
- (with-open-file
- (input
- "sigi:/homes/brentr/indy/src/testing/todel.ps"
- :direction :input)
- (with-open-file
- (output
- "sigi:/homes/brentr/indy/src/testing/indy.ps"
- :direction :output)
- (block exit
- (loop do
- (progn
- (multiple-value-setq
- (line nil)
- (read-line input nil eof))
- (when
- (equal line eof)
- (return-from exit nil))
- (unless
- (string-equal " 1.00 1.00 1.00 setrgbcolor" line)
- (format output "~&~a" line))))))))
- (com-replay-history)
- (audit "~&Postscript file is
- sigi:/homes/brentr/indy/src/testing/indy.ps"))
-
-
-
- ----------------
- And here is the code I now use to print:
-
- The code inside clim:with-output-to-postscript-stream is exactly the
- code used to draw the map on the screen. Note that the last form is
- only valid on Genera machine.
-
- (defun print-network-map ()
- (let ((frame (nanesse-frame)))
- (with-open-file (the-file "nanesse:to-print;network-map.ps"
- :direction :output
- :if-exists :new-version)
- (clim:with-output-to-postscript-stream (stream the-file :multi-page t)
- (vk-1dessine-villes0 stream)
- (1initialise-coordonnees-noeuds0 (noeuds-a-afficher frame))
- (initialise-elements-graphiques-a-afficher)
- (ansi-loop::loop for one-node in (noeuds-a-afficher frame)
- do
- (clim:present one-node
- `((network-point)
- :up-or-down ,(up-or-down one-node)
- :selected ,(selected one-node))
- ;;(clos:class-name (clos:class-of one-node))
- :view clim:+iconic-view+ :single-box t
- :stream stream)))))
- (cp:execute-command "hardcopy file"
- "nanesse:to-print;network-map.ps"))
-
- Thanks all for your help. Hope this summary is useful.
-
- vk
- --
- Never trust a pretty header: use keunen@nrb.be to reply
- --
- Keunen Vincent Network Research Belgium
- R&D, Software Engineer Parc Industriel des Hauts-Sarts
- keunen@nrb.be 2e Avenue, 65
- tel: +32 41 407282 B-4040 Herstal
- fax: +32 41 481170 Belgium
-