[comp.sys.sun] SunView again and again

ISSTTH@NUSVM.BITNET (TNG TH) (11/23/88)

A few weeks back I posted a mail asking for help in using Sunview with
CGI, CORE, PHIGS... I received a few replys on using plain pr_rops alone
and on using CORE. pr_rops is fine but slow and not rich enough. I can't
even perform rectangle clipping. Then there were a few examples on linking
CORE with SunView. I couldn't make that work either.  What I need is the
ability to use SunView's buttons, panels, cycles, etc TOGETHER with a
graphics package without using extremely low level stuff.  I must be very
dumb 'cause I have read the CGI and CORE manuals and couldn't find out how
to do just that.  Is anyone listening? Or am I the odd ball out?  Are
there better ways? How on earth was FRAMEMAKER written in the first place?
With SunView?

vern@sequoia.ee.lbl.gov (Vern Paxson) (12/10/88)

In article <8811151426.AA27702@rice.edu> Sun-Spots@Rice.edu writes:
>X-Sun-Spots-Digest: Volume 7, Issue 25, message 5 of 16
>
>....What I need is the
>ability to use SunView's buttons, panels, cycles, etc TOGETHER with a
>graphics package without using extremely low level stuff.  I must be very
>dumb 'cause I have read the CGI and CORE manuals and couldn't find out how
>to do just that.  Is anyone listening? ....

Here's a sketch of the way I got this to work.  Use two separate programs,
one SunView and one SunCore, which communicate with each other via pipes
(or sockets).  The SunView program creates a canvas in which the SunCore
program writes, and the canvas' WIN_EVENT_PROC looks like:

        char canvas_name[WIN_NAMESIZE];

        win_fdtoname( (int) window_get( win, WIN_FD ), canvas_name );
        we_setgfxwindow( canvas_name );

	/* set up IPC here and fork the SunCore program.  If the graphics
	 * is only for output display, then a popen() is all that's needed.
	 * If the SunCore program does both input that needs to be
	 * communicated to the SunView program and output then either
	 * two pipes or a socket need to be created, followed by an exec().
	 */

When forked the SunCore program does a normal get_view_surface(), and then
uses the view surface struct's windowfd field along with the file
descriptor of its input pipe from the SunView program as arguments to
select() in order to listen to both activities like mouse motion and picks
in its window, and commands from the SunView program.  This approach
allows quite flexible interactions.  For example, if the SunCore program
gets a button down event it can send a message to the SunView program
telling it the location and the SunView program can pop up a menu at that
spot.  Or the SunView program can have a button labeled "Restore Zoom" and
when it's hit the SunView program sends an IPC message to the SunCore
program telling it to adjust its viewport accordingly.

		Vern

	Vern Paxson				vern@lbl-csam.arpa
	Real Time Systems			ucbvax!lbl-csam.arpa!vern
	Lawrence Berkeley Laboratory		(415) 486-6411

warsaw@cme.nbs.gov (Barry A. Warsaw) (12/12/88)

ISSTTH@NUSVM.BITNET (TNG TH):
>A few weeks back I posted a mail asking for help in using Sunview with
>CGI, CORE, PHIGS... I received a few replys on using plain pr_rops alone
>and on using CORE....I must be very dumb 'cause I have read the CGI and
>CORE manuals and couldn't find out how to do just that.  Is anyone
>listening? Or am I the odd ball out?...How on earth was FRAMEMAKER written
>in the first place?  With SunView?

I have not been able to link SunCore with SunView.  I've talked to various
people at Sun and while they seem to imply that it can be done, they make
a point of letting me know that it is not very easy to do.  Often when I
mentioned I was using SunCore, I got laughs on the other end.  The general
suggestion is to buy (at a hefty price) SunPHIGS, which I am doing.
SunPHIGS is supposed to be very cleanly interfaced to SunView and is
supposed to work even with this mythical Sun merged window system
(SunView/X/NeWS).  BTW, does anyone have any information on what this
merged window system will be like or when it will be available?

I have had better luck with getting SunCGI calls to work in a canvas.
This is fairly easy to do but the documentation is scarce and you sort of
have to do things in the right order.  Appendix F of the SunCGI manual
describes the cgipw_* calls which are used to make CGI draw into a pixwin
(and thus into a canvas).  For example, if you normally call "fill_color"
you'd call "cgipw_fill_color" instead.  This may take a little
experimentation to get working; I may be able to dig up some example code
if you're interested. 

Lastly, no FRAMEMAKER doesn't use the high level SunView calls.  Frame
Technology pretty much wrote their own user interface.  I've asked them
about the possibility of getting source to their interface, but they
decline.  I can't say that I really blame them, though.

-Barry

NAME: Barry A. Warsaw                USMAIL: National Institute of Standards
TELE: (301) 975-3460                         and Technology (formerly NBS)
UUCP: {...}!uunet!cme-durer!warsaw           Rm. B-124, Bldg. 220
ARPA: warsaw@cme.nbs.gov                     Gaithersburg, MD 20899
  or: warsaw@cme-durer.arpa