[comp.windows.x] Tgif-1.18

william@oahu.cs.ucla.edu (William Cheng) (11/08/90)

I've just put tgif-1.18 in the following places for anonymous ftp:

	expo.lcs.mit.edu	contrib/tgif-1.18.tar.Z
	cs.ucla.edu		pub/tgif-1.18.tar.Z

Here's a short list of added features/bug fixes.

1) Fix rotated text.  On some servers it doesn't work.  (Should use
   ZPixmap instead of XYPixmap when calling XGetImage ().)
2) There was this problem that after a new symbol file is saved and
   one tries to save it again (with ^s), tgif thinks the file name
   is /symbolfilename.  This bug is fixed.
3) If fonts of certain dots-per-inch can not be found and an
   alternative fonts with different dots-per-inch can be found,
   the file status should be set to 'MODIFIED'.
4) If the symbol path contains a ".", then whenever a directory is
   changed, the symbol name cache should be updated.

Due to the SMALL size of this patch, the patch file is posted in this
newsgroup.

The following is the patch to take tgif from version 1.17 to 1.18.
---------------------------------> cut here <---------------------------------
*** file.c.orig	Wed Nov  7 10:25:37 1990
--- file.c	Wed Nov  7 10:25:39 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/file.c,v 1.41 90/11/03 12:43:47 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/file.c,v 1.42 90/11/07 01:44:21 william Exp $";
  #endif
  
***************
*** 285,289 ****
     strcpy (tmp_str, curDir);
     SetCurDir (new_full_name);
-    *curSymDir = '\0';
     curFileDefined = TRUE;
  
--- 285,288 ----
***************
*** 291,298 ****
     {
        case 0:
           if ((strcmp (tmp_str, curDir) != 0) || (!NameInCurDir (curFileName)))
              UpdateDirInfo ();
           break;
!       case 1: if (!DirInCurPath (curDir)) UpdateSymInfo (); break;
     }
  
--- 290,301 ----
     {
        case 0:
+          *curSymDir = '\0';
           if ((strcmp (tmp_str, curDir) != 0) || (!NameInCurDir (curFileName)))
              UpdateDirInfo ();
           break;
!       case 1:
!          strcpy (curSymDir, curDir);
!          if (!DirInSymPath (curDir)) UpdateSymInfo ();
!          break;
     }
  
***************
*** 747,753 ****
     struct ObjRec	* obj_ptr;
     char 		file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
!    char 		full_name[MAXPATHLENGTH];
     FILE			* fp;
  
     if (SelectFileName ("Please select a file to OPEN ...",file_name) == INVALID)
        return;
--- 750,757 ----
     struct ObjRec	* obj_ptr;
     char 		file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
!    char 		full_name[MAXPATHLENGTH], saved_cur_dir[MAXPATHLENGTH];
     FILE			* fp;
  
+    strcpy (saved_cur_dir, curDir);
     if (SelectFileName ("Please select a file to OPEN ...",file_name) == INVALID)
        return;
***************
*** 789,792 ****
--- 793,799 ----
     *curSymDir = '\0';
     curFileDefined = TRUE;
+ 
+    if (strcmp (saved_cur_dir, curDir) != 0 && DirInSymPath ("."))
+       UpdateSymInfo ();
  
     sprintf (s, "Current file is '%s'.", file_name);
*** names.c.orig	Wed Nov  7 10:26:20 1990
--- names.c	Wed Nov  7 10:26:22 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.c,v 1.14 90/11/03 12:31:10 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.c,v 1.17 90/11/07 02:03:18 william Exp $";
  #endif
  
***************
*** 144,147 ****
--- 144,149 ----
     {
        strcpy (path, symPath[path_index]);
+       if (strcmp (".", path) == 0) strcpy (path, curDir);
+ 
        if ((dirp = opendir (path)) == NULL)
           continue;
***************
*** 1356,1360 ****
  }
  
! int DirInCurPath (DirName)
     char	* DirName;
  {
--- 1358,1362 ----
  }
  
! int DirInSymPath (DirName)
     char	* DirName;
  {
*** stk.c.orig	Wed Nov  7 10:26:29 1990
--- stk.c	Wed Nov  7 10:26:30 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/stk.c,v 1.10 90/10/27 15:09:07 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/stk.c,v 1.11 90/11/06 16:42:39 william Exp $";
  #endif
  
***************
*** 125,128 ****
--- 125,129 ----
     CleanUpDrawingWindow ();
     XClearWindow (mainDisplay, drawWindow);
+    SetFileModified (FALSE);
  
     while (ReadObj (fp, &obj_ptr, FALSE))
***************
*** 146,150 ****
     curFileDefined = TRUE;
  
-    SetFileModified (FALSE);
     sprintf (s, "Current file is '%s'.", file_name);
     Msg (s);
--- 147,150 ----
*** text.c.orig	Wed Nov  7 10:27:08 1990
--- text.c	Wed Nov  7 10:27:10 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/text.c,v 1.20 90/11/03 12:29:43 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/text.c,v 1.21 90/11/06 16:42:12 william Exp $";
  #endif
  
***************
*** 125,128 ****
--- 125,129 ----
  static Pixmap	textBackingPixmap;
  static int	textBackingPixmapSize = INVALID;
+ static GC	rotateGC = NULL;
  
  void CleanUpText ()
***************
*** 133,136 ****
--- 134,138 ----
        textBackingPixmapSize = INVALID;
     }
+    if (rotateGC != NULL) XFreeGC (mainDisplay, rotateGC);
  }
  
***************
*** 265,278 ****
              textBackingPixmapSize = max(w,h);
           }
  
!          XSetForeground (mainDisplay, defaultGC, 0);
!          XFillRectangle (mainDisplay, textBackingPixmap, defaultGC, 0, 0, w, h);
!          XSetForeground (mainDisplay, defaultGC, myFgPixel);
  
!          XSetFont (mainDisplay, revDefaultGC, canvasFontPtr->fid);
!          XDrawImageString (mainDisplay, textBackingPixmap, revDefaultGC, 0,
                 canvasFontAsc, Str, len);
           from_image = XGetImage (mainDisplay, textBackingPixmap, 0, 0, w, h, 1,
!                XYPixmap);
  
           values.foreground = colorPixels[ColorIndex];
--- 267,290 ----
              textBackingPixmapSize = max(w,h);
           }
+          if (rotateGC == NULL)
+          {
+             values.foreground = 1;
+             values.background = 0;
+             values.fill_style = FillSolid;
+             values.function = GXcopy;
+             rotateGC = XCreateGC (mainDisplay, drawWindow,
+                   GCForeground | GCBackground | GCFillStyle | GCFunction,
+                   &values);
+          }
  
!          XSetForeground (mainDisplay, rotateGC, 0);
!          XFillRectangle (mainDisplay, textBackingPixmap, rotateGC, 0, 0, w, h);
!          XSetForeground (mainDisplay, rotateGC, 1);
  
!          XSetFont (mainDisplay, rotateGC, canvasFontPtr->fid);
!          XDrawString (mainDisplay, textBackingPixmap, rotateGC, 0,
                 canvasFontAsc, Str, len);
           from_image = XGetImage (mainDisplay, textBackingPixmap, 0, 0, w, h, 1,
!                ZPixmap);
  
           values.foreground = colorPixels[ColorIndex];
*** version.c.orig	Wed Nov  7 10:27:16 1990
--- version.c	Wed Nov  7 10:27:17 1990
***************
*** 6,11 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/version.c,v 1.21 90/11/01 13:34:15 william Exp $";
  #endif
  
! char	* version_string = "1.17";
--- 6,11 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/version.c,v 1.22 90/11/07 02:48:01 william Exp $";
  #endif
  
! char	* version_string = "1.18";
*** names.e.orig	Wed Nov  7 10:27:21 1990
--- names.e	Wed Nov  7 10:27:22 1990
***************
*** 4,8 ****
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.e,v 1.15 90/11/02 12:49:25 william Exp $
   */
  
--- 4,8 ----
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.e,v 1.17 90/11/07 01:26:37 william Exp $
   */
  
***************
*** 22,25 ****
  extern void	SetCurDir ();
  extern int	NameInCurDir ();
! extern int	DirInCurPath ();
  extern int	GetSymbolPath ();
--- 22,25 ----
  extern void	SetCurDir ();
  extern int	NameInCurDir ();
! extern int	DirInSymPath ();
  extern int	GetSymbolPath ();
*** Makefile.noimake.orig	Wed Nov  7 10:27:27 1990
--- Makefile.noimake	Wed Nov  7 10:27:28 1990
***************
*** 4,8 ****
  # Copyright (C) 1990, William Cheng.
  #
! # @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Makefile.noimake,v 1.27 90/11/03 12:48:06 william Exp $
  #
  
--- 4,8 ----
  # Copyright (C) 1990, William Cheng.
  #
! # @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Makefile.noimake,v 1.28 90/11/07 02:48:15 william Exp $
  #
  
***************
*** 10,14 ****
  LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
  
! TGIFVERSION	= 1.17
  INSTALLDIR	= /u/tangram/$(MACHINE)/bin
  
--- 10,14 ----
  LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
  
! TGIFVERSION	= 1.18
  INSTALLDIR	= /u/tangram/$(MACHINE)/bin
  
***************
*** 179,184 ****
  		choice.e color.e cursor.e drawing.e font.e mainloop.e menu.e \
  		names.e raster.e ruler.e scroll.e stk.e
- spline.o:	const.h types.h \
- 		poly.e raster.e rect.e setup.e
  special.o:	const.h types.h \
  		animate.e attr.e choice.e color.e cursor.e dialog.e drawing.e \
--- 179,182 ----
***************
*** 185,188 ****
--- 183,188 ----
  		dup.e file.e grid.e group.e mark.e msg.e move.e names.e \
  		obj.e raster.e select.e setup.e stk.e
+ spline.o:	const.h types.h \
+ 		poly.e raster.e rect.e setup.e
  stk.o:		const.h types.h \
  		align.e button.e choice.e color.e dup.e file.e font.e grid.e \
*** Imakefile.orig	Wed Nov  7 10:27:36 1990
--- Imakefile	Wed Nov  7 10:27:37 1990
***************
*** 4,11 ****
  /**/# Copyright (C) 1990, William Cheng.
  /**/#
! /**/# @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Imakefile,v 1.32 90/11/06 02:12:24 william Exp $
  /**/#
  
! TGIFVERSION	= 1.17
  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.33 90/11/07 02:49:55 william Exp $
  /**/#
  
! TGIFVERSION	= 1.18
  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