[comp.windows.x] Tgif-1.19

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

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

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

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

1) Fix a bug in names.c which cause segmentation faults on some machines.
2) If certain color can not be found, skip it, don't leave it blank.
3) Add explanations in tgif.man about how the alignments work.

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.18 to 1.19.
---------------------------------> cut here <---------------------------------
*** box.c.orig	Sat Nov 10 13:55:00 1990
--- box.c	Sat Nov 10 13:55:02 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/box.c,v 1.10 90/11/01 08:36:57 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/box.c,v 1.11 90/11/10 13:50:41 william Exp $";
  #endif
  
***************
*** 372,376 ****
     struct ObjRec	* ObjPtr;
  {
!    fprintf (FP, "box(%s,", colorMenuItems[ObjPtr->color]);
     fprintf (FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,", ObjPtr->obbox.ltx,
           ObjPtr->obbox.lty, ObjPtr->obbox.rbx, ObjPtr->obbox.rby,
--- 372,376 ----
     struct ObjRec	* ObjPtr;
  {
!    fprintf (FP, "box('%s',", colorMenuItems[ObjPtr->color]);
     fprintf (FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,", ObjPtr->obbox.ltx,
           ObjPtr->obbox.lty, ObjPtr->obbox.rbx, ObjPtr->obbox.rby,
*** color.c.orig	Sat Nov 10 13:55:08 1990
--- color.c	Sat Nov 10 13:55:10 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/color.c,v 1.15 90/10/31 11:39:17 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/color.c,v 1.16 90/11/10 13:47:29 william Exp $";
  #endif
  
***************
*** 22,25 ****
--- 22,27 ----
  #include "text.e"
  
+ #define COLORSTRLEN 80
+ 
  int	maxColors = MAXCOLORS;
  int	defaultColorIndex = 4;
***************
*** 32,35 ****
--- 34,39 ----
  int	colorDump = FALSE;
  
+ static int	allocatedMaxColors = MAXCOLORS;
+ 
  static char	* defaultColorMenuItems[MAXCOLORS] =
  {
***************
*** 75,79 ****
  void InitColor ()
  {
!    register int	i;
     XColor	color, exact_def;
     char		buf[80], * c_ptr, fg_color[80], bg_color[80], brdr_color[80];
--- 79,83 ----
  void InitColor ()
  {
!    register int	i, index;
     XColor	color, exact_def;
     char		buf[80], * c_ptr, fg_color[80], bg_color[80], brdr_color[80];
***************
*** 154,157 ****
--- 158,165 ----
     tgifColors = (XColor *) calloc (maxColors, sizeof (XColor));
  
+    allocatedMaxColors = maxColors;
+    for (i = 0; i < allocatedMaxColors; i++)
+       colorMenuItems[i] = (char *) calloc (COLORSTRLEN, sizeof(char));
+ 
     if (color_in_x_default)
     {
***************
*** 160,167 ****
           sprintf (buf, "Color%1d", i);
           if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, buf)) != NULL)
-          {
-             colorMenuItems[i] = (char *) calloc (strlen(c_ptr),sizeof(char));
              strcpy (colorMenuItems[i], c_ptr);
-          }
           else
           {
--- 168,172 ----
***************
*** 177,189 ****
     if (colorDisplay)
     {
        for (i = 0; i < maxColors; i++)
        {
!          XAllocNamedColor(mainDisplay, mainColormap, colorMenuItems[i], &color,
!                &exact_def);
!          colorPixels[i] = color.pixel;
  
!          tgifColors[i].red = color.red;
!          tgifColors[i].green = color.green;
!          tgifColors[i].blue = color.blue;
     
           if (strcmp (colorMenuItems[i], fg_color) == 0)
--- 182,199 ----
     if (colorDisplay)
     {
+       index = 0;
        for (i = 0; i < maxColors; i++)
        {
!          if (!XAllocNamedColor(mainDisplay, mainColormap, colorMenuItems[i],
!                &color, &exact_def))
!             continue;
  
!          if (i != index) strcpy (colorMenuItems[index], colorMenuItems[i]);
! 
!          colorPixels[index] = color.pixel;
! 
!          tgifColors[index].red = color.red;
!          tgifColors[index].green = color.green;
!          tgifColors[index].blue = color.blue;
     
           if (strcmp (colorMenuItems[i], fg_color) == 0)
***************
*** 210,215 ****
--- 220,228 ----
              brdr_allocated = TRUE;
           }
+          index++;
        }
  
+       maxColors = index;
+ 
        if (!fg_allocated)
        {
***************
*** 381,386 ****
     else
        w = (int)(maxColors / 10) + 1;
!    index = PxMpMenuLoop (X, Y, choiceImageW, choiceImageH, 10, w,
!          maxColors, fore_colors, pixmap, MULTICOLOR);
  
     if (index != INVALID) ChangeAllSelColor (index);
--- 394,403 ----
     else
        w = (int)(maxColors / 10) + 1;
!    if (maxColors <= 10)
!       index = PxMpMenuLoop (X, Y, choiceImageW, choiceImageH, maxColors, w,
!             maxColors, fore_colors, pixmap, MULTICOLOR);
!    else
!       index = PxMpMenuLoop (X, Y, choiceImageW, choiceImageH, 10, w,
!             maxColors, fore_colors, pixmap, MULTICOLOR);
  
     if (index != INVALID) ChangeAllSelColor (index);
***************
*** 394,398 ****
     cfree (colorPixels);
     cfree (xorColorPixels);
!    if (colorDisplay) for (i = 0; i < maxColors; i++) cfree (colorMenuItems[i]);
     cfree (colorMenuItems);
  
--- 411,415 ----
     cfree (colorPixels);
     cfree (xorColorPixels);
!    for (i = 0; i < allocatedMaxColors; i++) cfree (colorMenuItems[i]);
     cfree (colorMenuItems);
  
*** file.c.orig	Sat Nov 10 13:55:47 1990
--- file.c	Sat Nov 10 13:55:49 1990
***************
*** 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
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/file.c,v 1.43 90/11/10 13:51:37 william Exp $";
  #endif
  
***************
*** 383,391 ****
  {
     register char	* s = Str, * l = Left;
  
!    while (*s != '\0' && *s != C) *l++ = *s++;
  
     if (*s == C) s++;
     *l = '\0';
     return (s);
  }
--- 383,403 ----
  {
     register char	* s = Str, * l = Left;
+    register int		len = 0;
  
!    while (*s != '\0' && *s != C)
!    {
!       *l++ = *s++;
!       len++;
!    }
  
     if (*s == C) s++;
     *l = '\0';
+ 
+    while (len >= 2 && *Left == '\'' && *(l-1) == '\'')
+    {
+       *(--l) = '\0';
+       strcpy (Left, &Left[1]);
+       len -= 2;
+    }
     return (s);
  }
***************
*** 480,484 ****
           if (colorIndex >= maxColors)
           {
!             printf ("Can not find color '%s', use '%s' instead.\n", s,
                    colorMenuItems[defaultColorIndex]);
              colorIndex = defaultColorIndex;
--- 492,496 ----
           if (colorIndex >= maxColors)
           {
!             printf ("Can not find color #%1d, use '%s' instead.\n", colorIndex,
                    colorMenuItems[defaultColorIndex]);
              colorIndex = defaultColorIndex;
*** names.c.orig	Sat Nov 10 13:56:27 1990
--- names.c	Sat Nov 10 13:56:29 1990
***************
*** 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
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.c,v 1.18 90/11/09 15:06:52 william Exp $";
  #endif
  
***************
*** 226,230 ****
        cfree (dsp_ptr);
     }
!    symbolList[numSymbols].next = NULL;
     topOfSymLinkList = NULL;
  }
--- 226,230 ----
        cfree (dsp_ptr);
     }
!    symbolList[numSymbols-1].next = NULL;
     topOfSymLinkList = NULL;
  }
***************
*** 331,335 ****
           cfree (dsp_ptr);
        }
!       dirList[numDirEntries].next = NULL;
        topOfDirLinkList = NULL;
     }
--- 331,335 ----
           cfree (dsp_ptr);
        }
!       dirList[numDirEntries-1].next = NULL;
        topOfDirLinkList = NULL;
     }
*** oval.c.orig	Sat Nov 10 13:56:35 1990
--- oval.c	Sat Nov 10 13:56:36 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/oval.c,v 1.10 90/11/01 08:37:14 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/oval.c,v 1.11 90/11/10 13:51:00 william Exp $";
  #endif
  
***************
*** 365,369 ****
     struct ObjRec	* ObjPtr;
  {
!    fprintf (FP, "oval(%s,", colorMenuItems[ObjPtr->color]);
     fprintf (FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,", ObjPtr->obbox.ltx,
           ObjPtr->obbox.lty, ObjPtr->obbox.rbx, ObjPtr->obbox.rby,
--- 365,369 ----
     struct ObjRec	* ObjPtr;
  {
!    fprintf (FP, "oval('%s',", colorMenuItems[ObjPtr->color]);
     fprintf (FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,", ObjPtr->obbox.ltx,
           ObjPtr->obbox.lty, ObjPtr->obbox.rbx, ObjPtr->obbox.rby,
*** poly.c.orig	Sat Nov 10 13:56:55 1990
--- poly.c	Sat Nov 10 13:56:56 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/poly.c,v 1.9 90/11/01 08:37:08 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/poly.c,v 1.10 90/11/10 13:51:04 william Exp $";
  #endif
  
***************
*** 725,729 ****
  
     n = poly_ptr->n;
!    fprintf (FP, "poly(%s,%1d,[", colorMenuItems[ObjPtr->color], poly_ptr->n);
     for (i = 0; i < n-1; i++)
     {
--- 725,729 ----
  
     n = poly_ptr->n;
!    fprintf (FP, "poly('%s',%1d,[", colorMenuItems[ObjPtr->color], poly_ptr->n);
     for (i = 0; i < n-1; i++)
     {
*** polygon.c.orig	Sat Nov 10 13:57:08 1990
--- polygon.c	Sat Nov 10 13:57:09 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/polygon.c,v 1.8 90/11/01 08:38:24 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/polygon.c,v 1.9 90/11/10 13:51:09 william Exp $";
  #endif
  
***************
*** 524,528 ****
  
     n = polygon_ptr->n;
!    fprintf (FP, "polygon(%s,%1d,[", colorMenuItems[ObjPtr->color],
           polygon_ptr->n);
     for (i = 0; i < n-1; i++)
--- 524,528 ----
  
     n = polygon_ptr->n;
!    fprintf (FP, "polygon('%s',%1d,[", colorMenuItems[ObjPtr->color],
           polygon_ptr->n);
     for (i = 0; i < n-1; i++)
*** text.c.orig	Sat Nov 10 13:57:47 1990
--- text.c	Sat Nov 10 13:57:49 1990
***************
*** 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
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/text.c,v 1.22 90/11/10 13:51:14 william Exp $";
  #endif
  
***************
*** 1674,1678 ****
     register struct StrRec	* s_ptr;
  
!    fprintf (FP, "text(%s,", colorMenuItems[ObjPtr->color]);
     fprintf (FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,[\n",
           ObjPtr->x, ObjPtr->y, t_ptr->font, t_ptr->style, t_ptr->size,
--- 1674,1678 ----
     register struct StrRec	* s_ptr;
  
!    fprintf (FP, "text('%s',", colorMenuItems[ObjPtr->color]);
     fprintf (FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,[\n",
           ObjPtr->x, ObjPtr->y, t_ptr->font, t_ptr->style, t_ptr->size,
*** version.c.orig	Sat Nov 10 13:57:57 1990
--- version.c	Sat Nov 10 13:57:58 1990
***************
*** 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";
--- 6,11 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/version.c,v 1.23 90/11/10 13:53:37 william Exp $";
  #endif
  
! char	* version_string = "1.19";
*** Makefile.noimake.orig	Sat Nov 10 13:58:03 1990
--- Makefile.noimake	Sat Nov 10 13:58:04 1990
***************
*** 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 $
  #
  
--- 4,8 ----
  # Copyright (C) 1990, William Cheng.
  #
! # @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Makefile.noimake,v 1.29 90/11/10 13:53:48 william Exp $
  #
  
***************
*** 10,14 ****
  LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
  
! TGIFVERSION	= 1.18
  INSTALLDIR	= /u/tangram/$(MACHINE)/bin
  
--- 10,14 ----
  LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
  
! TGIFVERSION	= 1.19
  INSTALLDIR	= /u/tangram/$(MACHINE)/bin
  
*** Imakefile.orig	Sat Nov 10 13:58:09 1990
--- Imakefile	Sat Nov 10 13:58:10 1990
***************
*** 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
--- 4,11 ----
  /**/# Copyright (C) 1990, William Cheng.
  /**/#
! /**/# @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Imakefile,v 1.34 90/11/10 13:53:45 william Exp $
  /**/#
  
! TGIFVERSION	= 1.19
  PROGRAMS	= tgif prtgif tgif2ps frontend11.o
  /**/#CDEBUGFLAGS= -g
*** tgif.man.orig	Sat Nov 10 13:58:19 1990
--- tgif.man	Sat Nov 10 13:58:20 1990
***************
*** 1,3 ****
! .\"@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/tgif.man,v 1.16 90/11/06 02:33:54 william Exp $
  .TH TGIF 1 "Version 1.13 and Above" "Tgif"
  .SH NAME
--- 1,3 ----
! .\"@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/tgif.man,v 1.17 90/11/08 17:02:40 william Exp $
  .TH TGIF 1 "Version 1.13 and Above" "Tgif"
  .SH NAME
***************
*** 105,109 ****
  This is the window to the right of the message window.
  It displays the current choice (in top/bottom, left/right order) of the
! drawing mode, color, horizontal alignment, vertical alignment,
  text justification, font, text rotation, line width, line style,
  poly or spline, dash pattern, print mode,
--- 105,110 ----
  This is the window to the right of the message window.
  It displays the current choice (in top/bottom, left/right order) of the
! drawing mode, color, horizontal alignment (L C R -),
! vertical alignment (T M B -),
  text justification, font, text rotation, line width, line style,
  poly or spline, dash pattern, print mode,
***************
*** 120,123 ****
--- 121,133 ----
  is used; also, icon objects
  will not change because they should be thought of as ``bitmaps''.
+ .PP
+ The settings of the horizontal and vertical
+ alignments determine how objects align with
+ each other when the ^L keyboard command is issued, and they
+ determine how each individual object aligns with the grids
+ when the ^T keyboard command is issued.  The horizontal
+ alignments are left (L), center (C), right (R), and ignore (-).
+ The vertical alignments are top (T), middle (M), bottom (B), and
+ ignore (-).  The best way to understand them is to try them out.
  .RE
  .TP
---------------------------------> 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