Problems w/ CGI, SunView, and NCAR Graphics application

Mark J. Kilgard mjk at chinook.rice.edu
Fri May 12 14:52:49 AEST 1989


I am encountering a couple of problems in a SunView application I am
currently working on and I hope SunSpots readers can help me.  The
application is a SunView Fortran development environment.  This part of
the program is basically done though.

But I have been asked to help extend the program to allow easy use of the
NCAR Graphics 2.0 package (a library of graphics routines to create high
quality graphics for Fortran).  I want the user to be able to click a
Display button and have the outputted metafile be displayed on the screen
in a window.

The NCAR Graphics package includes a SunCGI application called ctrans
which allows the metafiles output by NCAR routines to be displayed on
SunView windows.  The program is what the SunView System Programmer's
Guide calls a "naive program" (p41, v3.5) in that it uses the GFX_WINDOW
environmental variable to determine what window it will display on.

----
As a sidenote, I would like to mention the following bug/annoyance fix
in ctrans for any other NCAR Graphics users.  The version of ctrans I
am working with did not work correctly on monochrome Suns.  This can be
fixed by commenting out the line in $NCARG_TOP_DIR/src/bin/ctrans/cgi.c
which says:

	device.cmapsize = 128;

The code works fine on color Suns as .  A real fix would determine what
type of screen is being used instead of simply assuming one or the
other.  See SunCGI manual (p14, v3.5) for details.
----

This is all good and well since I can simply set GFX_WINDOW to a canvas I
have set asside to display the image in and then fork off ctrans with the
proper arguments.This all works.

The difficulty is that SunCGI 's code for retained images doesn' t seem to
work.  ctrans's source code makes a note that the retaining code doesn't
work and #ifdef's the code out that would allow reatined windows.
Compiling in the retaining code shows that indeed SunCGI's retaining code
does not work.  The image gets redrawn but VERY incorrectly.

Even if you compile Sun's examples in the CGI manual and try to set it up
for a retained image, you get the same result.  Yuck.  I could not find
this bug listed in Sun's "bug list" but perhaps I missed it.  I am
assuming to use  all you do is say "device.retained = 1" when you set up
the Cvwsurf to pass to open_vws().

Preferably, I would like to be able use CGI's ability to do retained
images if there is a fix.  Does anyone know what it is?  The problem is
not corrected in 4.0 since I tried it on a 4.0 system and the same
incorrect behaviour occured.

I'm willing to concede though that Sun's code is simply wrong and live
with it though.  At least what I want to do then is simply clear the
window whenever the window needs to be redrawn (otherwise the remains of
the window above it stays in the window which is very confusing).  When
you kill the ctrans process, it clears the window so all I want to do is
kill ctrans whenever I need to redisplay an section of canvas.

The problem is my CANVAS_REPAINT_PROC doesn't seem to get called when
ctrans is using the window.  I assume ctrans must get the repaint requests
for that /dev/win instead of my SunView application.

I don't mind hacking ctrans to get it to die if it gets a repaint request.
But how do you do this?  The win man page says refer to the Programmer's
Reference Manual for SunWindows.  I have no such manual.

Do I have other options?  Can I get my CANVAS_REPAINT_PROC called
somehow?

Thanks for any help you can give me.  And if anyone might be interested in
the results of this project, a small-scale Fortran development environment
for SunView with optional extensions for NCAR Graphics use, send me mail
and I can provide more information.

- Mark Kilgard, ICSA, Rice Unversity 
  <mjk at rice.edu>



More information about the Comp.sys.sun mailing list