smith@canon.UUCP (Mark Smith) (04/12/90)
Possibly Stupid Question #1: What's the easiest way to get command line arguments to a NeWS application written entirely in PostScript? Given that the first line of the application file is "#! /usr/openwin/bin/psh", I'd like to be able to invoke it as application arg1 arg2 ... Since the man entry for psh says all args to it are files sent to the server, I can't see an obvious way to make this work. Am I missing something obvious? Probably Not So Stupid Question #2: Has anyone seen any documentation for the protocol for supporting the drag&drop stuff from the File Manager to application windows? Again, I'd like to support this in a PostScript-only application. The only (maybe) reference I can find is the ACTION_DRAG_LOAD event in back of the XView manual. Is there a corresponding event in the NeWS input model? I have RTFM(s), honest. +-----------------------------------+------------------------------+ | Mark Smith | tel: +44 483 574 325 | | Canon Research Centre Europe Ltd. | fax: +44 483 574 360 | | 19 Frederick Sanger Road +------------------------------+ | Surrey Research Park | inet: smith@canon.co.uk | | Guildford Surrey UK GU2 5YD | uucp: ukc!uos-ee!canon!smith | +-----------------------------------+------------------------------+
naughton@wind.eng.sun.com (Patrick Naughton) (04/12/90)
In article <9004111746.AA02461@hagen.canon>, smith@canon.UUCP (Mark Smith) writes: > Possibly Stupid Question #1: > > What's the easiest way to get command line arguments to a NeWS application > written entirely in PostScript? Given that the first line of the application > file is "#! /usr/openwin/bin/psh", I'd like to be able to invoke it as > > application arg1 arg2 ... > > Since the man entry for psh says all args to it are files sent to the server, > I can't see an obvious way to make this work. Am I missing something obvious? > The trick is to not use the #!/usr/openwin/bin/psh hack, but rather to use the Bourne shell. psh(1) does not do commandline substitution. Here is a small program using TNT 1.0 which takes a Sun rasterfile(5) on the command line and displays it in a window. #!/bin/sh # @(#)bitwin 1.1 90/04/11 if [ $# -ne 1 ]; then echo "usage: `basename $0` rasterfile" 1>&2 exit 1; fi pwd=`pwd` abspath () { case $1 in /*) echo $1 ;; *) echo $pwd/$1 ;; esac } checkfile () { if [ ! -f $1 ] ; then if [ ! -f $1.Z ] ; then echo "`basename $0`: can't open $1" 1>&2 exit 1 fi fi } checkfile $1 file=`abspath $1` base=`basename $1` psh << -eof- /win [ClassCanvas] [] framebuffer /newdefault ClassBaseFrame send def /can ($file) readcanvas def /ican 64 64 8 [] null buildimage def ican setcanvas can imagecanvas { gsave clippath pathbbox scale pop pop can imagecanvas grestore } /setpaintproc /client win send send { gsave 64 64 scale ican imagecanvas grestore } /seticon win send null /seticonlabel win send ($base) /setlabel win send /preferredsize [ can setcanvas matrix currentmatrix dup 0 get exch 5 get framebuffer setcanvas ] cvx /installmethod /client win send send /place win send /activate win send /map win send /flipiconic win send newprocessgroup currentfile closefile -eof- > Probably Not So Stupid Question #2: > > Has anyone seen any documentation for the protocol for supporting the drag&drop > stuff from the File Manager to application windows? Again, I'd like to support > this in a PostScript-only application. The only (maybe) reference I can find is the > ACTION_DRAG_LOAD event in back of the XView manual. Is there a corresponding event > in the NeWS input model? I have RTFM(s), honest. > > | Mark Smith | tel: +44 483 574 325 | Drag and Drop from the XView filemgr to a NeWS window is not supported in any released version of OpenWindows. It is being seriously looked at for the next release. ______________________________________________________________________ Patrick J. Naughton ARPA: naughton@sun.com Window Systems Group UUCP: ...!sun!naughton Sun Microsystems, Inc. AT&T: (415) 336 - 1080