[comp.windows.x] Tgif-1.7

william@oahu.cs.ucla.edu (William Cheng) (06/16/90)

I've just put tgif-1.7 in the `contrib' directory of `expo.lcs.ucla.edu'
and the `pub' directory of `rye.cs.ucla.edu'.  Here's a short list of
added features/bug fixes.

1) Fix bug related to displaying current font in the panel window when
   text is rotated on a black and white screen.
2) Make the version number show up in the top of the tool.
3) Fix bug related to the sqrt() DOMAIN error.

Following is a patch file to bring tgif from release 1.6 to 1.7.
-------------------------------> cut here <-----------------------------------
*** choice.c.orig	Fri Jun 15 19:33:56 1990
--- choice.c	Fri Jun 15 19:33:57 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/choice.c,v 1.3 90/05/22 14:07:29 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/choice.c,v 1.4 90/06/13 09:51:55 william Exp $";
  #endif
  
***************
*** 39,44 ****
     XGCValues	values;
  
!    values.foreground = myFgPixel;
!    values.background = myBgPixel;
     values.font = defaultFontPtr->fid;
     choiceGC = XCreateGC (mainDisplay, choiceWindow,
--- 39,44 ----
     XGCValues	values;
  
!    values.foreground = 1;
!    values.background = 0;
     values.font = defaultFontPtr->fid;
     choiceGC = XCreateGC (mainDisplay, choiceWindow,
***************
*** 107,110 ****
--- 107,111 ----
     XRectangle	recs[1];
     XImage	* image;
+    XGCValues	values;
  
     recs[0].x = 2*choiceImageW;
***************
*** 159,163 ****
--- 160,173 ----
     {
        XSetClipRectangles (mainDisplay, choiceGC, 0, 0, recs, 1, YXBanded);
+ 
+       values.foreground = myFgPixel;
+       values.background = myBgPixel;
+       XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values);
+ 
        XDrawString (mainDisplay, choiceWindow, choiceGC, x, y, "W", 1);
+ 
+       values.foreground = 1;
+       values.background = 0;
+       XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values);
     }
     else
***************
*** 168,178 ****
              XYPixmap);
        XSetClipRectangles (mainDisplay, choiceGC, 0, 0, recs, 1, YXBanded);
        saved_x = x;
        saved_y = y;
        for (i = 0; i < w; i++)
-       {
           for (j = 0; j < h; j++)
!          {
!             if (XGetPixel (image, i, j) == 0)
              {
                 switch (curRotate)
--- 178,191 ----
              XYPixmap);
        XSetClipRectangles (mainDisplay, choiceGC, 0, 0, recs, 1, YXBanded);
+ 
+       values.foreground = myFgPixel;
+       values.background = myBgPixel;
+       XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values);
+ 
        saved_x = x;
        saved_y = y;
        for (i = 0; i < w; i++)
           for (j = 0; j < h; j++)
!             if (XGetPixel (image, i, j) == 1)
              {
                 switch (curRotate)
***************
*** 183,191 ****
                 }
  /*             XDrawPoint (mainDisplay, choiceWindow, defaultGC, x, y); */
!                /* Hack to run on RTs -- stupid IBM */
!                XDrawLine (mainDisplay, choiceWindow, defaultGC, x, y, x, y);
              }
!          }
!       }
     }
  
--- 196,206 ----
                 }
  /*             XDrawPoint (mainDisplay, choiceWindow, defaultGC, x, y); */
! /*                Hack to run on RTs -- crash server on RTs             */
!                XDrawLine (mainDisplay,choiceWindow,defaultGC,x,y,x,y);
              }
! 
!       values.foreground = 1;
!       values.background = 0;
!       XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values);
     }
  
*** grid.c.orig	Fri Jun 15 19:34:06 1990
--- grid.c	Fri Jun 15 19:34:07 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/grid.c,v 1.2 90/05/22 14:11:37 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/grid.c,v 1.3 90/06/13 09:48:14 william Exp $";
  #endif
  
***************
*** 44,48 ****
     for (x = XStart; x < XEnd; x += 8)
  /*    XDrawPoint (mainDisplay, Win, defaultGC, x, Y); */
! /* Hack to run on RTs -- stupid IBM */
        XDrawLine (mainDisplay, Win, defaultGC, x, Y, x, Y);
  }
--- 44,48 ----
     for (x = XStart; x < XEnd; x += 8)
  /*    XDrawPoint (mainDisplay, Win, defaultGC, x, Y); */
! /*       Hack to run on RTs -- crash server on RTs    */
        XDrawLine (mainDisplay, Win, defaultGC, x, Y, x, Y);
  }
***************
*** 56,60 ****
     for (y = YStart; y < YEnd; y += 8)
  /*    XDrawPoint (mainDisplay, Win, defaultGC, X, y); */
! /* Hack to run on RTs -- stupid IBM */
        XDrawLine (mainDisplay, Win, defaultGC, X, y, X, y);
  }
--- 56,60 ----
     for (y = YStart; y < YEnd; y += 8)
  /*    XDrawPoint (mainDisplay, Win, defaultGC, X, y); */
! /*       Hack to run on RTs -- crash server on RTs    */
        XDrawLine (mainDisplay, Win, defaultGC, X, y, X, y);
  }
*** menu.c.orig	Fri Jun 15 19:34:11 1990
--- menu.c	Fri Jun 15 19:34:12 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/menu.c,v 1.8 90/05/25 13:37:15 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/menu.c,v 1.9 90/06/13 14:31:57 william Exp $";
  #endif
  
***************
*** 34,37 ****
--- 34,38 ----
  #include "special.e"
  #include "text.e"
+ #include "version.e"
  
  int	iconWindowCreated = FALSE;
***************
*** 442,451 ****
     char	file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
  
!    len = strlen (TOOL_NAME);
     amount = defaultFontWidth * len;
     left = (titleWindowW - amount) / 2;
  
!    XDrawString (mainDisplay, titleWindow, defaultGC, left,
!          defaultFontAsc+2, TOOL_NAME, len);
  
     for (y = 4; y < titleWindowH/2-4; y += 2)
--- 443,456 ----
     char	file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
  
!    strcpy (s, TOOL_NAME);
!    strcat (s, "-");
!    strcat (s, version_string);
! 
!    len = strlen (s);
     amount = defaultFontWidth * len;
     left = (titleWindowW - amount) / 2;
  
!    XDrawString (mainDisplay, titleWindow, defaultGC, left, defaultFontAsc+2, s,
!          len);
  
     for (y = 4; y < titleWindowH/2-4; y += 2)
*** move.c.orig	Fri Jun 15 19:34:16 1990
--- move.c	Fri Jun 15 19:34:17 1990
***************
*** 7,11 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/move.c,v 1.3 90/05/30 02:03:52 william Exp $";
  #endif
  #include <stdio.h>
--- 7,11 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/move.c,v 1.4 90/06/15 12:47:03 william Exp $";
  #endif
  #include <stdio.h>
***************
*** 187,191 ****
     XGrabPointer (mainDisplay, drawWindow, FALSE,
           PointerMotionMask | ButtonReleaseMask,
!          GrabModeAsync, GrabModeAsync, None, defaultCursor, CurrentTime);
  
     dx = dy = 0;
--- 187,191 ----
     XGrabPointer (mainDisplay, drawWindow, FALSE,
           PointerMotionMask | ButtonReleaseMask,
!          GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
  
     dx = dy = 0;
*** rect.c.orig	Fri Jun 15 19:34:21 1990
--- rect.c	Fri Jun 15 19:34:22 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/rect.c,v 1.1 90/04/01 22:16:37 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/rect.c,v 1.2 90/06/15 01:13:58 william Exp $";
  #endif
  
***************
*** 166,170 ****
     if (rx >= ry)
     {  /* flat oval */
!       tmp_y = sqrt ((double)(ry*ry*(1-(X-cx)*(X-cx)/rx/rx)));
        y1 = cy - tmp_y;
        y2 = cy + tmp_y;
--- 166,170 ----
     if (rx >= ry)
     {  /* flat oval */
!       tmp_y = sqrt (fabs ((double)(ry*ry*(1-(X-cx)*(X-cx)/rx/rx))));
        y1 = cy - tmp_y;
        y2 = cy + tmp_y;
***************
*** 173,177 ****
     else
     {  /* tall oval */
!       tmp_x = sqrt ((double)(rx*rx*(1-(Y-cy)*(Y-cy)/ry/ry)));
        x1 = cx - tmp_x;
        x2 = cx + tmp_x;
--- 173,177 ----
     else
     {  /* tall oval */
!       tmp_x = sqrt (fabs ((double)(rx*rx*(1-(Y-cy)*(Y-cy)/ry/ry))));
        x1 = cx - tmp_x;
        x2 = cx + tmp_x;
*** select.c.orig	Fri Jun 15 19:34:25 1990
--- select.c	Fri Jun 15 19:34:26 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/select.c,v 1.1 90/04/01 22:16:40 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/select.c,v 1.2 90/06/15 01:16:11 william Exp $";
  #endif
  
***************
*** 350,360 ****
     /* XOff and YOff are screen offsets, and they are not on grid */
  {
-    Window	root_win, child_win;
-    int		root_x, root_y;
-    unsigned int	status;
     int 		end_x, end_y;
-    XButtonEvent	input;
     int 		done = FALSE, ltx, lty, rbx, rby, dx, dy;
!    int 		new_end_x, new_end_y;
  
     end_x = XOff;
--- 350,356 ----
     /* XOff and YOff are screen offsets, and they are not on grid */
  {
     int 		end_x, end_y;
     int 		done = FALSE, ltx, lty, rbx, rby, dx, dy;
!    XEvent	input;
  
     end_x = XOff;
***************
*** 362,366 ****
  
     SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
!    XGrabPointer (mainDisplay, drawWindow, FALSE, ButtonReleaseMask,
           GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
     
--- 358,363 ----
  
     SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
!    XGrabPointer (mainDisplay, drawWindow, False,
!          PointerMotionMask | ButtonReleaseMask,
           GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
     
***************
*** 367,390 ****
     while (!done)
     {
!       XQueryPointer (mainDisplay, drawWindow, &root_win, &child_win,
!             &root_x, &root_y, &new_end_x, &new_end_y, &status);
! 
!       if (new_end_x==end_x && new_end_y==end_y && (status & Button1Mask)!=0)
!          continue;
! 
        SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
!       end_x = new_end_x; end_y = new_end_y;
! 
!       SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
! 
!       if ((status & Button1Mask) == 0)
        {
           XUngrabPointer (mainDisplay, CurrentTime);
           MarkRulers (end_x, end_y);
-          SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
           done = TRUE;
        }
!       else
!          MarkRulers (end_x, end_y);
     }
  
--- 364,382 ----
     while (!done)
     {
!       XNextEvent (mainDisplay, &input);
        SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
!       if (input.type == ButtonRelease)
        {
           XUngrabPointer (mainDisplay, CurrentTime);
           MarkRulers (end_x, end_y);
           done = TRUE;
        }
!       else if (input.type == MotionNotify)
!       {
!          end_x = input.xmotion.x;
!          end_y = input.xmotion.y;
!          SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
!       }
!       MarkRulers (end_x, end_y);
     }
  
*** text.c.orig	Fri Jun 15 19:34:33 1990
--- text.c	Fri Jun 15 19:34:35 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/text.c,v 1.4 90/05/30 08:28:48 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/text.c,v 1.5 90/06/13 14:16:46 william Exp $";
  #endif
  
***************
*** 265,271 ****
           }
  
!          values.function = GXcopy;
!          values.font = canvasFontPtr->fid;
!          XChangeGC (mainDisplay, revDefaultGC, GCFunction | GCFont, &values);
           XDrawImageString (mainDisplay, textBackingPixmap, revDefaultGC, 0,
                 canvasFontAsc, Str, len);
--- 265,269 ----
           }
  
!          XSetFont (mainDisplay, revDefaultGC, canvasFontPtr->fid);
           XDrawImageString (mainDisplay, textBackingPixmap, revDefaultGC, 0,
                 canvasFontAsc, Str, len);
***************
*** 272,276 ****
           from_image = XGetImage (mainDisplay, textBackingPixmap, 0, 0, w, h, 1,
                 XYPixmap);
-          XSetFunction (mainDisplay, revDefaultGC, GXxor);
  
           values.foreground = colorPixels[ColorIndex];
--- 270,273 ----
***************
*** 289,293 ****
                       case ROTATE90:
  /*                      XDrawPoint (mainDisplay, Win, gc, XOff-j, YOff+i); */
!                         /* Hack to run on RTs -- crash server on RTs */
                          XDrawLine (mainDisplay, Win, gc, XOff-j, YOff+i,
                                XOff-j, YOff+i);
--- 286,290 ----
                       case ROTATE90:
  /*                      XDrawPoint (mainDisplay, Win, gc, XOff-j, YOff+i); */
! /*                         Hack to run on RTs -- crash server on RTs       */
                          XDrawLine (mainDisplay, Win, gc, XOff-j, YOff+i,
                                XOff-j, YOff+i);
***************
*** 295,299 ****
                       case ROTATE180:
  /*                      XDrawPoint (mainDisplay, Win, gc, XOff-i, YOff-j); */
!                         /* Hack to run on RTs -- crash server on RTs */
                          XDrawLine (mainDisplay, Win, gc, XOff-i, YOff-j,
                                XOff-i, YOff-j);
--- 292,296 ----
                       case ROTATE180:
  /*                      XDrawPoint (mainDisplay, Win, gc, XOff-i, YOff-j); */
! /*                         Hack to run on RTs -- crash server on RTs       */
                          XDrawLine (mainDisplay, Win, gc, XOff-i, YOff-j,
                                XOff-i, YOff-j);
***************
*** 301,305 ****
                       case ROTATE270:
  /*                      XDrawPoint (mainDisplay, Win, gc, XOff+j, YOff-i); */
!                         /* Hack to run on RTs -- crash server on RTs */
                          XDrawLine (mainDisplay, Win, gc, XOff+j, YOff-i,
                                XOff+j, YOff-i);
--- 298,302 ----
                       case ROTATE270:
  /*                      XDrawPoint (mainDisplay, Win, gc, XOff+j, YOff-i); */
! /*                         Hack to run on RTs -- crash server on RTs       */
                          XDrawLine (mainDisplay, Win, gc, XOff+j, YOff-i,
                                XOff+j, YOff-i);
*** version.c.orig	Fri Jun 15 19:34:40 1990
--- version.c	Fri Jun 15 19:34:41 1990
***************
*** 6,11 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/version.c,v 1.9 90/06/05 10:32:28 william Exp $";
  #endif
  
! char	* version_string = "1.6";
--- 6,11 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/version.c,v 1.10 90/06/13 14:33:07 william Exp $";
  #endif
  
! char	* version_string = "1.7";
*** Makefile.noimake.orig	Fri Jun 15 19:34:44 1990
--- Makefile.noimake	Fri Jun 15 19:34:45 1990
***************
*** 4,8 ****
  # Copyright (C) 1990, William Cheng.
  #
! # @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Makefile.noimake,v 1.8 90/05/25 14:32:13 william Exp $
  #
  
--- 4,8 ----
  # Copyright (C) 1990, William Cheng.
  #
! # @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Makefile.noimake,v 1.10 90/06/13 14:32:34 william Exp $
  #
  
***************
*** 13,17 ****
  
  CC = cc
! CFLAGS = -g -DTGIF_PATH=\"/u/tangram/u/william/X11/TGIF\" -I/usr/local/include
  LFLAGS = -lX11 -lm
  
--- 13,18 ----
  
  CC = cc
! CFLAGS = -g -DTGIF_PATH=\"/u/tangram/u/william/X11/TGIF\" -DPSFILE_MOD=\"664\" \
! 		-I/usr/local/include
  LFLAGS = -lX11 -lm
  
***************
*** 128,132 ****
  		box.e choice.e color.e cursor.e dialog.e drawing.e edit.e \
  		file.e font.e grid.e msg.e names.e obj.e pattern.e raster.e \
! 		select.e setup.e special.e text.e
  move.o:		const.h types.h \
  		attr.e cursor.e drawing.e dup.e grid.e obj.e oval.e \
--- 129,133 ----
  		box.e choice.e color.e cursor.e dialog.e drawing.e edit.e \
  		file.e font.e grid.e msg.e names.e obj.e pattern.e raster.e \
! 		select.e setup.e special.e text.e version.e
  move.o:		const.h types.h \
  		attr.e cursor.e drawing.e dup.e grid.e obj.e oval.e \
*** Imakefile.orig	Fri Jun 15 19:34:49 1990
--- Imakefile	Fri Jun 15 19:34:50 1990
***************
*** 4,11 ****
  /**/# Copyright (C) 1990, William Cheng.
  /**/#
! /**/# @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Imakefile,v 1.13 90/06/05 10:32:37 william Exp $
  /**/#
  
! TGIFVERSION	= 1.6
  PROGRAMS	= tgif prtgif tgif2ps frontend11.o
  CDEBUGFLAGS	= -g
--- 4,11 ----
  /**/# Copyright (C) 1990, William Cheng.
  /**/#
! /**/# @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Imakefile,v 1.14 90/06/13 14:32:56 william Exp $
  /**/#
  
! TGIFVERSION	= 1.7
  PROGRAMS	= tgif prtgif tgif2ps frontend11.o
  CDEBUGFLAGS	= -g
-------------------------------> cut here <-----------------------------------
--

-- Bill Cheng // UCLA Computer Science Department // (213) 206-7135
   3277 Boelter Hall // Los Angeles, California 90024 // USA
   william@CS.UCLA.EDU      ...!{uunet|ucbvax}!cs.ucla.edu!william