[comp.sys.sgi] more featureful popup

drb@eecg.toronto.edu (David R. Blythe) (02/22/91)

Available for anonymous ftp from bessel.clsc.utoronto.ca is a pop-up
menu implementation similar to the sgi pop-up, but with a few more frills
that I find useful.  Its in the subdirectory pub/clsc.  It has been tested
on a few different machines (GT/GTX) but not PI's and VGX's so caveat
emptor.  Comments and bug fixes are welcome.  The README file for it
appears below:

	drb

--------------------------------------------------------------------------
this is an implementation of an SGI dopup() compatible popup menu library.
for the most part it looks and feels like the standard gl/4Sight menu
but is written entirely in gl and has a few handy improvements that
I felt were desirable:

	optional ``state'' markers on menu items so you can use
	the same menu item to turn off and on some feature in your
	program and get a visual cue as to whether it is off or on.

	radio menu items - the ability to group a set of related
	but mutually exclusive menu items with a ``state'' marker to
	indicate which one is currently active.  (similar to radio buttons
	in various tool kits).  there can be more than one such group
	per menu (max 10).

	you can specify which button the menu is used with (i.e.
	LEFTMOUSE, MIDDLEMOUSE or RIGHTMOUSE).

	you can turn on an option to make the menu save which item
	was selected last and draw the menu with that item positioned
	under the cursor the next time the menu is drawn.

	you can call a routine to change a single menu item in
	an existing menu.

the remainder of the menu is plug compatible with the default gl library
(i.e. includes addtopup(), defpup(), newpup(), freepup(), dopup(), newpup() &
setpup()) and it completely replaces the SGI pup implementation (i.e. I use
the same routine names).  A caveat is that the FORTRAN binding is present,
but not quite correct (yet).  A lesser caveat is that appearance-wise it is
not a perfect imitation of the sgi pup, but its close enough.

	david blythe
	ontario centre for large scale computation
	drb@clsc.utoronto.ca

drb@eecg.toronto.edu (David R. Blythe) (02/23/91)

In article <1991Feb21.230936.9038@jarvis.csri.toronto.edu> drb@eecg.toronto.edu (David R. Blythe) writes:
>that I find useful.  Its in the subdirectory pub/clsc.  It has been tested
>on a few different machines (GT/GTX) but not PI's and VGX's so caveat
>emptor.  Comments and bug fixes are welcome.

It didn't take long to uncover the first PI bug.  Line drawing using the
cmov2i()/draw2i() combination on the 4D/25TG in PUPDRAW mode seems to cause some
random scribbling under 3.3.1.  I have changed the code to use
bgnline()/endline() and it appears to work properly (which I should have done
in the first place).  Thanks to David Serafini for bringing the bug to my
attention.  (He also tells me that it breaks on a 340VGX too - hopefully this
fixes it too - I don't have access to a VGX machine to test).  The ftp'able
version has been updated or you can patch it yourself (diffs follow).

	david blythe
	ontario centre for large scale computation
	drb@clsc.utoronto.ca


RCS file: RCS/pup.c,v
retrieving revision 1.2
diff -c -r1.2 pup.c
*** /tmp/,RCSt1a17071	Fri Feb 22 18:30:10 1991
--- pup.c	Fri Feb 22 18:29:43 1991
***************
*** 728,735 ****
  	    color(PUP_BLACK);
  	}
  	if (e->flags&F_ULINE) {
! 	    cmov2i(menu->ox, menu->cy+EL_SLOP - i*EL_HEIGHT-HILIGHT_FUDGE);
! 	    draw2i(menu->cx, menu->cy+EL_SLOP - i*EL_HEIGHT-HILIGHT_FUDGE);
  	}
      }
  }
--- 728,737 ----
  	    color(PUP_BLACK);
  	}
  	if (e->flags&F_ULINE) {
!             int v[2];
! 	    v[0] = menu->ox;
! 	    v[1] = menu->cy+EL_SLOP - i*EL_HEIGHT-HILIGHT_FUDGE;
! 	    bgnline(); v2i(v); v[0] = menu->cx; v2i(v); endline();
  	}
      }
  }

drb@eecg.toronto.edu (David R. Blythe) (02/23/91)

In article <1991Feb22.182844.16413@jarvis.csri.toronto.edu> drb@eecg.toronto.edu (David R. Blythe) writes:
>
>It didn't take long to uncover the first PI bug.  Line drawing using the
>cmov2i()/draw2i() combination on the 4D/25TG in PUPDRAW mode seems to cause some

My brain must be dead, (or somewhat impaired) the problem was the cmov2i() 
should be a move2i().  Anyway the posted fix was correct, my recognition of the
real bug was somewhat faulty.  cmov and move must do similar things on the GT
or I might have spotted it myself.
	red faced
	-drb