[comp.windows.x] Tgif-1.16

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

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

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

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

1) Fix bugs related makeing a grouped object iconic.  Used to have the
   wrong file name.
2) Remove the restriction of just being able to edit files under the
   current directory.
3) New implementation of domains.  Now a domain specifies a search path
   for the .sym files.  The mechanism is very similar as the csh PATH
   environment variable.  Please read the man pages for details (grep
   for the string "domain" or "Domain" in 'tgif.man').

I've talked to some people about putting in support for color PostScript
and dash patterns and I can't get them done yet.  They will be in the
next release.  I appologize for my delay.

The following is the patch to take tgif from version 1.15 to 1.16.
---------------------------------> cut here <---------------------------------
*** box.c.orig	Sat Oct 27 17:47:20 1990
--- box.c	Sat Oct 27 17:47:21 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/box.c,v 1.7 90/08/13 09:23:32 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/box.c,v 1.8 90/10/27 15:09:43 william Exp $";
  #endif
  
*** choice.c.orig	Sat Oct 27 17:47:26 1990
--- choice.c	Sat Oct 27 17:47:27 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/choice.c,v 1.8 90/08/21 15:55:15 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/choice.c,v 1.9 90/10/27 15:12:25 william Exp $";
  #endif
  
***************
*** 224,227 ****
--- 224,240 ----
     XFillRectangle (mainDisplay, choiceWindow, rasterGC, 3*choiceImageW, 0,
           choiceImageW, choiceImageH);
+ 
+ /* XGCValues	values;
+ 
+    XClearArea (mainDisplay, choiceWindow, 3*choiceImageW, 0,
+          choiceImageW, choiceImageH, FALSE);
+    if (curDash != 0)
+       XSetDashes (mainDisplay, rasterGC, 0, dashList[curDash],
+             dashListLength[curDash]);
+    values.line_width = widthOfLine[lineWidth];
+    XChangeGC (mainDisplay, rasterGC, GCLineWidth, &values);
+    XDrawLine (mainDisplay, choiceWindow, rasterGC,
+          3*choiceImageW+3, (int)(choiceImageH/2), 4*choiceImageW-3,
+          (int)(choiceImageH/2)); */
  }
  
*** color.c.orig	Sat Oct 27 17:47:33 1990
--- color.c	Sat Oct 27 17:47:34 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/color.c,v 1.11 90/07/31 15:11:08 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/color.c,v 1.14 90/10/27 16:29:54 william Exp $";
  #endif
  
***************
*** 28,31 ****
--- 28,34 ----
  int	* xorColorPixels = NULL;
  char	* * colorMenuItems = NULL;
+ XColor	* tgifColors;
+ int	maxRGB = 0;
+ int	colorDump = FALSE;
  
  static char	* defaultColorMenuItems[MAXCOLORS] =
***************
*** 63,67 ****
     if (i == maxColors)
     {
!       printf ("Can not find color `%s', use `%s' instead.\n", s,
              colorMenuItems[defaultColorIndex]);
        return (defaultColorIndex);
--- 66,70 ----
     if (i == maxColors)
     {
!       printf ("Can not find color '%s', use '%s' instead.\n", s,
              colorMenuItems[defaultColorIndex]);
        return (defaultColorIndex);
***************
*** 77,80 ****
--- 80,84 ----
     int		num, color_in_x_default = FALSE;
     int		bg_allocated=FALSE, fg_allocated=FALSE, brdr_allocated=FALSE;
+    int		tmp_max, white_allocated=FALSE, black_allocated=TRUE;
  
     if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "ReverseVideo")) != NULL)
***************
*** 148,151 ****
--- 152,157 ----
     colorMenuItems = (char * *) calloc (maxColors, sizeof (char *));
  
+    tgifColors = (XColor *) calloc (maxColors, sizeof (XColor));
+ 
     if (color_in_x_default)
     {
***************
*** 176,179 ****
--- 182,189 ----
                 &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)
***************
*** 248,251 ****
--- 258,269 ----
        colorIndex = 0;
     }
+    XAllocNamedColor(mainDisplay, mainColormap, "black", &color, &exact_def);
+    tmp_max = max(color.red,max(color.green,color.blue));
+    if (tmp_max > maxRGB) maxRGB = tmp_max;
+    XAllocNamedColor(mainDisplay, mainColormap, "white", &color, &exact_def);
+    tmp_max = max(color.red,max(color.green,color.blue));
+    if (tmp_max > maxRGB) maxRGB = tmp_max;
+    if (tmp_max == 0)
+       printf ("Warning:  Unexpected maximum RGB intensity 0.");
  }
  
*** copypaste.c.orig	Sat Oct 27 17:47:39 1990
--- copypaste.c	Sat Oct 27 17:47:40 1990
***************
*** 7,11 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/copypaste.c,v 1.8 90/08/25 17:26:51 william Exp $";
  #endif
  
--- 7,11 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/copypaste.c,v 1.10 90/09/04 07:26:02 william Exp $";
  #endif
  
***************
*** 219,225 ****
        return;
     }
- #ifdef KANJI
-       myPasteKanji (cut_buffer, len);
- #endif
     cut_buffer++;
     len--;
--- 219,222 ----
*** cursor.c.orig	Sat Oct 27 17:47:45 1990
--- cursor.c	Sat Oct 27 17:47:46 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/cursor.c,v 1.5 90/07/16 10:31:01 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/cursor.c,v 1.6 90/09/04 17:59:03 william Exp $";
  #endif
  
***************
*** 17,20 ****
--- 17,21 ----
  #include "setup.e"
  
+ #include "bitmaps/null.bm"
  #include "bitmaps/nullmask.bm"
  #include "bitmaps/text_cur_image.bm"
***************
*** 29,32 ****
--- 30,34 ----
  static Pixmap	textPixmap;
  static Pixmap	nullPixmap;
+ static Pixmap	nullMaskPixmap;
  
  static XImage	* textCursorImage;
***************
*** 85,91 ****
     handCursor = XCreateFontCursor (mainDisplay, XC_hand2);
  
!    nullPixmap = XCreatePixmap (mainDisplay, mainWindow, nullmask_width,
           nullmask_height, 1);
!    nullCursor = XCreatePixmapCursor (mainDisplay, nullPixmap, nullPixmap,
           &color, &color, 0, 0);
  }
--- 87,95 ----
     handCursor = XCreateFontCursor (mainDisplay, XC_hand2);
  
!    nullPixmap = XCreatePixmap (mainDisplay, mainWindow, null_width,
!          null_height, 1);
!    nullMaskPixmap = XCreatePixmap (mainDisplay, mainWindow, nullmask_width,
           nullmask_height, 1);
!    nullCursor = XCreatePixmapCursor (mainDisplay, nullPixmap, nullMaskPixmap,
           &color, &color, 0, 0);
  }
***************
*** 112,115 ****
--- 116,120 ----
  
     XFreePixmap (mainDisplay, nullPixmap);
+    XFreePixmap (mainDisplay, nullMaskPixmap);
     XFreeCursor (mainDisplay, nullCursor);
  }
*** file.c.orig	Sat Oct 27 17:48:07 1990
--- file.c	Sat Oct 27 17:48:08 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/file.c,v 1.32 90/08/15 16:00:43 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/file.c,v 1.38 90/10/27 15:07:35 william Exp $";
  #endif
  
***************
*** 49,52 ****
--- 49,54 ----
  #define START_HAVING_ATTRS 8
  
+ extern char	* getenv ();
+ 
  char	curFileName[MAXPATHLENGTH];
  int	curFileDefined = FALSE;
***************
*** 67,70 ****
--- 69,73 ----
     curFileName[0] = '\0';
     curFileDefined = FALSE;
+    *curSymDir = '\0';
  }
  
***************
*** 184,188 ****
  {
     char			new_file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
!    char			new_full_name[MAXPATHLENGTH];
     FILE			* fp;
     int			count = 0, len;
--- 187,191 ----
  {
     char			new_file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
!    char			new_full_name[MAXPATHLENGTH], tmp_str[MAXPATHLENGTH];
     FILE			* fp;
     int			count = 0, len;
***************
*** 243,249 ****
     }
  
!    strcpy (new_full_name, curDomainName);
!    if (*curDomainName != '\0') strcat (new_full_name, "/");
!    strcat (new_full_name, new_file_name);
  
     if (!OkayToCreateFile (new_full_name)) return;
--- 246,257 ----
     }
  
!    if (*new_file_name == '/')
!       strcat (new_full_name, new_file_name);
!    else
!    {
!       strcpy (new_full_name, curDir);
!       strcat (new_full_name, "/");
!       strcat (new_full_name, new_file_name);
!    }
  
     if (!OkayToCreateFile (new_full_name)) return;
***************
*** 256,266 ****
     }
  
!    strcpy (curFileName, new_file_name);
     curFileDefined = TRUE;
!    sprintf (s, "Saving '%s' ...", new_file_name);
     Msg (s);
     Save (fp, botObj, 0);
     fclose (fp);
!    sprintf (s, "File '%s' saved.", new_file_name);
     Msg (s);
     SetFileModified (FALSE);
--- 264,279 ----
     }
  
!    strcpy (tmp_str, curDir);
!    SetCurDir (new_full_name);
!    *curSymDir = '\0';
     curFileDefined = TRUE;
! 
!    if (strcmp (tmp_str, curDir) != 0) UpdateDirInfo ();
! 
!    sprintf (s, "Saving '%s/%s' ...", curDir, curFileName);
     Msg (s);
     Save (fp, botObj, 0);
     fclose (fp);
!    sprintf (s, "File '%s/%s' saved.", curDir, curFileName);
     Msg (s);
     SetFileModified (FALSE);
***************
*** 314,323 ****
     }
  
!    strcpy (full_name, curDomainName);
!    if (*curDomainName != '\0') strcat (full_name, "/");
!    strcat (full_name, curFileName);
     if ((fp = fopen (full_name, "w")) == NULL)
     {
!       sprintf (s, "Can not open %s, file not saved.", curFileName);
        Msg (s);
        return;
--- 327,346 ----
     }
  
!    if (strcmp (ext, "sym") == 0)
!    {
!       strcpy (full_name, curSymDir);
!       strcat (full_name, "/");
!       strcat (full_name, curFileName);
!    }
!    else if (strcmp (ext, "obj") == 0)
!    {
!       strcpy (full_name, curDir);
!       strcat (full_name, "/");
!       strcat (full_name, curFileName);
!    }
! 
     if ((fp = fopen (full_name, "w")) == NULL)
     {
!       sprintf (s, "Can not open '%s', file not saved.", full_name);
        Msg (s);
        return;
***************
*** 324,328 ****
     }
  
!    sprintf (s, "Saving '%s' ...", curFileName);
     Msg (s);
  
--- 347,351 ----
     }
  
!    sprintf (s, "Saving '%s' ...", full_name);
     Msg (s);
  
***************
*** 330,334 ****
  
     fclose (fp);
!    sprintf (s, "File '%s' saved.", curFileName);
     Msg (s);
     SetFileModified (FALSE);
--- 353,357 ----
  
     fclose (fp);
!    sprintf (s, "File '%s' saved.", full_name);
     Msg (s);
     SetFileModified (FALSE);
***************
*** 424,428 ****
           if (colorIndex >= maxColors)
           {
!             printf ("Can not find color `%s', use `%s' instead.\n", s,
                    colorMenuItems[defaultColorIndex]);
              colorIndex = defaultColorIndex;
--- 447,451 ----
           if (colorIndex >= maxColors)
           {
!             printf ("Can not find color '%s', use `%s' instead.\n", s,
                    colorMenuItems[defaultColorIndex]);
              colorIndex = defaultColorIndex;
***************
*** 615,656 ****
  void ChangeDomain ()
  {
-    char 	domain_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
     register int	i;
  
     if (SelectDomain (domain_name) == INVALID) return;
  
!    if (strcmp (domain_name, "..") == 0)
!    {
!       if (*curDomainName == '\0')
!          Msg ("Already at the top.  Domain not changed.");
!       else
!       {
!          i = strlen (curDomainName) - 1;
!          for ( ; i >= 0 && curDomainName[i] != '/'; i--) ;
!          if (i >= 0)
!          {
!             curDomainName[i] = '\0';
!             sprintf (s, "Current domain is %s.", curDomainName);
!             Msg (s);
!          }
!          else
!          {
!             curDomainName[0] = '\0';
!             Msg ("At the top of the domain hierarchy.");
!          }
!       }
!    }
!    else if (strcmp (domain_name, ".") == 0)
!    {
!       sprintf (s, "Current domain is %s.", curDomainName);
!       Msg (s);
!    }
     else
!    {
!       if (*curDomainName != '\0') strcat (curDomainName, "/");
!       strcat (curDomainName, domain_name);
!       sprintf (s, "Current domain is %s.", curDomainName);
!       Msg (s);
!    }
  }
  
--- 638,659 ----
  void ChangeDomain ()
  {
     register int	i;
+    char 	domain_name[MAXPATHLENGTH], env_str[MAXPATHLENGTH];
+    char 	s[MAXSTRING], s1[MAXSTRING], * c_ptr;
  
     if (SelectDomain (domain_name) == INVALID) return;
  
!    sprintf (env_str, "TGIF_%s", domain_name);
!    if ((c_ptr = getenv (env_str)) == NULL)
!       ParseSymPath (".");
     else
!       ParseSymPath (c_ptr);
! 
!    UpdateSymInfo ();
! 
!    strcpy (curDomainName, domain_name);
!    sprintf (s, "Current domain is '%s'.", curDomainName);
!    sprintf (s1, "Symbol path set to '%s'.", curDomainPath);
!    TwoLineMsg (s, s1);
  }
  
***************
*** 659,674 ****
     struct ObjRec	* obj_ptr, * saved_top_obj, * saved_bot_obj;
     char 		file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
-    char 		full_name[MAXPATHLENGTH];
     FILE			* fp;
  
!    if (SelectFileName ("obj", "Please Select A File To IMPORT ...",
!          file_name) == INVALID) return;
  
     strcat (file_name, ".obj");
-    strcpy (full_name, curDomainName);
-    if (*curDomainName != '\0') strcat (full_name, "/");
-    strcat (full_name, file_name);
  
!    if ((fp = fopen (full_name, "r")) == NULL)
     {
        sprintf (s, "Can not import '%s'.", file_name);
--- 662,674 ----
     struct ObjRec	* obj_ptr, * saved_top_obj, * saved_bot_obj;
     char 		file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
     FILE			* fp;
  
!    if (SelectFileName ("Please select a file to IMPORT ...", file_name)
!          == INVALID)
!       return;
  
     strcat (file_name, ".obj");
  
!    if ((fp = fopen (file_name, "r")) == NULL)
     {
        sprintf (s, "Can not import '%s'.", file_name);
***************
*** 720,732 ****
     FILE			* fp;
  
!    if (SelectFileName ("obj", "Please Select A File To OPEN ...",
!          file_name) == INVALID) return;
  
     strcat (file_name, ".obj");
-    strcpy (full_name, curDomainName);
-    if (*curDomainName != '\0') strcat (full_name, "/");
-    strcat (full_name, file_name);
  
!    if ((fp = fopen (full_name, "r")) == NULL)
     {
        sprintf (s, "Can not open '%s'.", file_name);
--- 720,729 ----
     FILE			* fp;
  
!    if (SelectFileName ("Please select a file to OPEN ...",file_name) == INVALID)
!       return;
  
     strcat (file_name, ".obj");
  
!    if ((fp = fopen (file_name, "r")) == NULL)
     {
        sprintf (s, "Can not open '%s'.", file_name);
***************
*** 758,762 ****
  
     fclose (fp);
!    strcpy (curFileName, file_name);
     curFileDefined = TRUE;
  
--- 755,760 ----
  
     fclose (fp);
!    SetCurDir (file_name);
!    *curSymDir = '\0';
     curFileDefined = TRUE;
  
***************
*** 1012,1017 ****
              }
  
!             strcpy (ps_file, curDomainName);
!             if (*curDomainName != '\0') strcat (ps_file, "/");
              strcat (ps_file, curFileName);
              len = strlen (ps_file);
--- 1010,1015 ----
              }
  
!             strcpy (ps_file, curDir);
!             strcat (ps_file, "/");
              strcat (ps_file, curFileName);
              len = strlen (ps_file);
*** font.c.orig	Sat Oct 27 17:48:30 1990
--- font.c	Sat Oct 27 17:48:31 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/font.c,v 1.9 90/08/16 15:44:24 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/font.c,v 1.11 90/10/27 15:45:24 william Exp $";
  #endif
  
***************
*** 25,35 ****
  #include "text.e"
  
- #define COUR8R  24
- #define COUR10R 25
- #define COUR12R 26
- #define COUR14R 27
- #define COUR18R 28
- #define COUR24R 29
- 
  #define FONTS_PER_DPI (((MAXFONTS-1)*MAXFONTSTYLES+1)*MAXFONTSIZES)
  #define FONTTABLESIZE (MAXFONTDPIS*FONTS_PER_DPI)
--- 25,28 ----
***************
*** 37,40 ****
--- 30,47 ----
  /* #define FONTTABLESIZE (MAXFONTSIZES*MAXFONTSTYLES*MAXFONTS) */
  
+ #define COUR8R_75  FontIndex(FONT_DPI_75,FONT_COU,0,STYLE_NR)
+ #define COUR10R_75 FontIndex(FONT_DPI_75,FONT_COU,1,STYLE_NR)
+ #define COUR12R_75 FontIndex(FONT_DPI_75,FONT_COU,2,STYLE_NR)
+ #define COUR14R_75 FontIndex(FONT_DPI_75,FONT_COU,3,STYLE_NR)
+ #define COUR18R_75 FontIndex(FONT_DPI_75,FONT_COU,4,STYLE_NR)
+ #define COUR24R_75 FontIndex(FONT_DPI_75,FONT_COU,5,STYLE_NR)
+ 
+ #define COUR11R_100 FontIndex(FONT_DPI_100,FONT_COU,0,STYLE_NR)
+ #define COUR14R_100 FontIndex(FONT_DPI_100,FONT_COU,1,STYLE_NR)
+ #define COUR17R_100 FontIndex(FONT_DPI_100,FONT_COU,2,STYLE_NR)
+ #define COUR20R_100 FontIndex(FONT_DPI_100,FONT_COU,3,STYLE_NR)
+ #define COUR25R_100 FontIndex(FONT_DPI_100,FONT_COU,4,STYLE_NR)
+ #define COUR34R_100 FontIndex(FONT_DPI_100,FONT_COU,5,STYLE_NR)
+ 
  struct MyFontRec {
     XFontStruct	* xfs;
***************
*** 382,385 ****
--- 389,393 ----
  {
     register int	i;
+    int		ruler_index, default_index;
  
     pointSize = (curFontDPI==FONT_DPI_75) ? pointSize75 : pointSize100;
***************
*** 388,404 ****
     for (i = 0; i < FONTTABLESIZE; i++) myFontInfo[i].valid = FALSE;
  
!    if ((myFontInfo[COUR18R].xfs =
!          XLoadQueryFont (mainDisplay, fontNameStr[COUR18R])) == NULL)
!    { printf ("Can not open %s.  Abort.\n\n", fontNameStr[COUR18R]); exit (-1); }
  
!    myFontInfo[COUR18R].valid = TRUE;
  
!    if ((myFontInfo[COUR10R].xfs =
!          XLoadQueryFont (mainDisplay, fontNameStr[COUR10R])) == NULL)
!    { printf ("Can not open %s.  Abort.\n\n", fontNameStr[COUR10R]); exit (-1); }
  
!    myFontInfo[COUR10R].valid = TRUE;
! 
!    rulerFontPtr = myFontInfo[COUR10R].xfs;
     rulerFontWidth = rulerFontPtr->max_bounds.width;
     rulerFontAsc = rulerFontPtr->max_bounds.ascent;
--- 396,445 ----
     for (i = 0; i < FONTTABLESIZE; i++) myFontInfo[i].valid = FALSE;
  
!    default_index = COUR18R_75;
!    if ((myFontInfo[default_index].xfs =
!          XLoadQueryFont (mainDisplay, fontNameStr[default_index])) == NULL)
!    {
!       default_index = COUR17R_100;
!       if ((myFontInfo[default_index].xfs =
!             XLoadQueryFont (mainDisplay, fontNameStr[default_index])) == NULL)
!       {
!          printf ("Can not open %s or %s.  Abort.\n\n",
!                fontNameStr[COUR18R_75], fontNameStr[COUR17R_100]);
!          exit (-1);
!       }
!    }
!    myFontInfo[default_index].valid = TRUE;
  
!    if (default_index == COUR18R_75)
!    {
!       ruler_index = COUR10R_75;
!       if ((myFontInfo[ruler_index].xfs =
!             XLoadQueryFont (mainDisplay, fontNameStr[ruler_index])) == NULL)
!       {
!          printf ("Can not open %s.  Abort.\n\n", fontNameStr[ruler_index]);
!          exit (-1);
!       }
!       curFontDPI = FONT_DPI_75;
!    }
!    else
!    {
!       ruler_index = COUR11R_100;
!       if ((myFontInfo[ruler_index].xfs =
!             XLoadQueryFont (mainDisplay, fontNameStr[ruler_index])) == NULL)
!       {
!          printf ("Can not open %s.  Abort.\n\n", fontNameStr[ruler_index]);
!          exit (-1);
!       }
!       curFontDPI = FONT_DPI_100;
!    }
!    myFontInfo[ruler_index].valid = TRUE;
  
!    defaultFontPtr = myFontInfo[default_index].xfs;
!    defaultFontWidth = defaultFontPtr->max_bounds.width;
!    defaultFontAsc = defaultFontPtr->max_bounds.ascent;
!    defaultFontDes = defaultFontPtr->max_bounds.descent;
!    defaultFontHeight = defaultFontAsc + defaultFontDes;
  
!    rulerFontPtr = myFontInfo[ruler_index].xfs;
     rulerFontWidth = rulerFontPtr->max_bounds.width;
     rulerFontAsc = rulerFontPtr->max_bounds.ascent;
***************
*** 405,414 ****
     rulerFontDes = rulerFontPtr->max_bounds.descent;
     rulerFontHeight = rulerFontAsc + rulerFontDes;
- 
-    defaultFontPtr = myFontInfo[COUR18R].xfs;
-    defaultFontWidth = defaultFontPtr->max_bounds.width;
-    defaultFontAsc = defaultFontPtr->max_bounds.ascent;
-    defaultFontDes = defaultFontPtr->max_bounds.descent;
-    defaultFontHeight = defaultFontAsc + defaultFontDes;
  }
  
--- 446,449 ----
*** frontend.c.orig	Sat Oct 27 17:48:35 1990
--- frontend.c	Sat Oct 27 17:48:36 1990
***************
*** 0 ****
--- 1,13 ----
+ /*
+  * Author:	William Chia-Wei Cheng (william@cs.ucla.edu)
+  *
+  * Copyright (C) 1990, William Cheng.
+  */
+ #ifndef lint
+ static char RCSid[] =
+       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/frontend.c,v 1.1 90/08/28 09:56:33 william Exp $";
+ #endif
+ 
+ int	lastFile;
+ short	* pDrawFontAsc;
+ short	* pDrawFontDes;
*** mainloop.c.orig	Sat Oct 27 17:48:42 1990
--- mainloop.c	Sat Oct 27 17:48:43 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/mainloop.c,v 1.15 90/08/16 09:35:09 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/mainloop.c,v 1.20 90/10/25 15:02:22 william Exp $";
  #endif
  
***************
*** 42,46 ****
  char	initMsg1[80], initMsg2[80];
  
! static quitDraw = TRUE;
  
  static
--- 42,46 ----
  char	initMsg1[80], initMsg2[80];
  
! static int	quitDraw = TRUE;
  
  static
***************
*** 150,154 ****
  {
     XEvent		input, ev;
!    char			* c_ptr, file_name[256], s[256];
     int			shorthand_rc, draw_rc;
     struct ObjRec	* obj_ptr;
--- 150,155 ----
  {
     XEvent		input, ev;
!    char			* c_ptr, file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
!    char			full_name[MAXPATHLENGTH];
     int			shorthand_rc, draw_rc;
     struct ObjRec	* obj_ptr;
***************
*** 199,203 ****
  
              fclose (fp);
!             strcpy (curFileName, file_name);
              curFileDefined = TRUE;
  
--- 200,214 ----
  
              fclose (fp);
! 
!             if (*file_name == '/')
!                strcat (full_name, file_name);
!             else
!             {
!                strcpy (full_name, curDir);
!                strcat (full_name, "/");
!                strcat (full_name, file_name);
!             }
!             SetCurDir (full_name);
!             *curSymDir = '\0';
              curFileDefined = TRUE;
  
***************
*** 207,210 ****
--- 218,222 ----
           }
        }
+       UpdateDirInfo ();
     }
     SaveDrawWinInfo ();
*** menu.c.orig	Sat Oct 27 17:48:53 1990
--- menu.c	Sat Oct 27 17:48:55 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/menu.c,v 1.12 90/08/15 16:00:27 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/menu.c,v 1.14 90/10/25 14:58:18 william Exp $";
  #endif
  
***************
*** 485,493 ****
     if (curFileDefined)
     {
!       strcpy (file_name, curFileName);
!       strcpy (s, curDomainName);
!       if (*curDomainName != '\0') strcat (s, "/");
!       strcat (s, file_name);
     }
  
     if (fileModified) strcat (s, " [Modified]");
--- 485,495 ----
     if (curFileDefined)
     {
!       if (*curSymDir == '\0')
!          sprintf (s, "%s:%s/%s", curDomainName, curDir, curFileName);
!       else
!          sprintf (s, "%s:%s/%s", curDomainName, curSymDir, curFileName);
     }
+    else
+       sprintf (s, "%s:[Unnamed]", curDomainName);
  
     if (fileModified) strcat (s, " [Modified]");
*** names.c.orig	Sat Oct 27 17:49:07 1990
--- names.c	Sat Oct 27 17:49:08 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.c,v 1.6 90/07/27 14:39:29 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.c,v 1.10 90/10/26 15:40:34 william Exp $";
  #endif
  
***************
*** 20,23 ****
--- 20,24 ----
  #include "button.e"
  #include "cursor.e"
+ #include "file.e"
  #include "font.e"
  #include "mainloop.e"
***************
*** 33,37 ****
--- 34,50 ----
  #define ROW_HEIGHT (defaultFontHeight+1)
  
+ typedef struct _DspList {
+    char			itemstr[MAXPATHLENGTH+1];
+    char			pathstr[MAXPATHLENGTH+1];
+    int			directory;
+    struct _DspList	* next;
+ } DspList;
+ 
+ extern char	* getenv ();
+ 
  char	curDomainName[MAXPATHLENGTH];
+ char	curDomainPath[MAXPATHLENGTH];
+ char	curDir[MAXPATHLENGTH];
+ char	curSymDir[MAXPATHLENGTH];
  
  static Window		nameBaseWin;
***************
*** 55,61 ****
  static GC	revNameGC;
  
  void InitNames ()
  {
!    char		* c_ptr;
     XGCValues	values;
  
--- 68,342 ----
  static GC	revNameGC;
  
+ static DspList	* symbolList = NULL;
+ static int	numSymbols;
+ static DspList	* dirList = NULL;
+ static int	numDirEntries;
+ 
+ static DspList	* topOfSymLinkList = NULL;
+ static DspList	* topOfDirLinkList = NULL;
+ 
+ static
+ char * ReadPath (path_str, dir_str)
+    char * path_str, * dir_str;
+ {
+    register char        * s1, * s2;
+ 
+    s1 = path_str;
+    if (*s1 == '~')
+    {
+       strcpy (dir_str, homeDir);
+       s2 = &dir_str[strlen(dir_str)];
+       s1++;
+    }
+    else
+       s2 = dir_str;
+ 
+    for ( ; *s1 != '\0' && *s1 != ':'; s1++)
+       if (*s1 == '\\')
+          strcpy (s1, s1+1);
+       else
+          *s2++ = *s1;
+ 
+    *s2 = '\0';
+    if (*s1 == ':') s1++;
+    return (s1);
+ }
+ 
+ void ParseSymPath (path_str)
+    char * path_str;
+ {
+    register char        * s, c;
+    register int         i;
+    char                 dir_str[MAXPATHLENGTH];
+ 
+    for (i = 0, s = path_str; *s != '\0'; )
+    {
+       s = ReadPath (s, dir_str);
+       if (dir_str != '\0') i++;
+    }
+    symPath = (char * *) calloc (i, sizeof (char *));
+    symPathNumEntries = i;
+    for (i = 0, s = path_str; *s != '\0'; )
+    {
+       s = ReadPath (s, dir_str);
+       if (dir_str != '\0')
+       {
+          symPath[i] = (char *) calloc (MAXPATHLENGTH, sizeof (char));
+          strcpy (symPath[i], dir_str);
+          i++;
+       }
+    }
+    strcpy (curDomainPath, path_str);
+ }
+ 
+ static
+ DspList * SymbolListing ()
+ {
+    int			i, len, path_index, count = 0, reject;
+    char			path[MAXPATHLENGTH], s[MAXPATHLENGTH];
+    DspList		* dsp_ptr = NULL, * head_ptr, * tail_ptr, * p, * p1;
+    DIR			* dirp;
+    struct direct	* d;
+    struct stat		stat_buf;
+ 
+    head_ptr = tail_ptr = NULL;
+    for (path_index = 0; path_index < symPathNumEntries; path_index++)
+    {
+       strcpy (path, symPath[path_index]);
+       if ((dirp = opendir (path)) == NULL)
+          continue;
+ 
+       while ((d = readdir (dirp)) != NULL)
+       {
+          len = strlen (d->d_name);
+          if (len > 4 && (strcmp (".sym", &d->d_name[len-4]) == 0))
+             d->d_name[len-4] = '\0';
+          else
+             continue;
+ 
+          if (head_ptr == NULL)
+          {
+             head_ptr = tail_ptr = (DspList *) calloc (1, sizeof(DspList));
+             strcpy (head_ptr->itemstr, d->d_name);
+             strcpy (head_ptr->pathstr, path);
+          }
+          else
+          {
+             p1 = NULL;
+             reject = FALSE;
+             for (p = head_ptr; p != NULL; p = p->next)
+             {
+                if (strcmp (d->d_name, p->itemstr) == 0)
+                {
+                   reject = TRUE;
+                   break;
+                }
+                else if (LargerStr (d->d_name, p->itemstr))
+                   p1 = p;
+                else
+                {
+                   dsp_ptr = (DspList *) calloc (1, sizeof(DspList));
+                   strcpy (dsp_ptr->itemstr, d->d_name);
+                   strcpy (dsp_ptr->pathstr, path);
+                   break;
+                }
+             }
+             if (reject) continue;
+    
+             dsp_ptr = (DspList *) calloc (1, sizeof(DspList));
+             dsp_ptr->next = p;
+             strcpy (dsp_ptr->itemstr, d->d_name);
+             strcpy (dsp_ptr->pathstr, path);
+ 
+             if (p == NULL)
+             {  /* dsp_ptr has the largest element */
+                tail_ptr->next = dsp_ptr;
+                tail_ptr = dsp_ptr;
+             }
+             else if (p1 == NULL)
+                head_ptr = dsp_ptr;
+             else
+                p1->next = dsp_ptr;
+          }
+          count++;
+       }
+       closedir (dirp);
+    }
+    numSymbols = count;
+    return (head_ptr);
+ }
+ 
+ static
+ void BuildSymbolList ()
+ {
+    register int		i;
+    register DspList	* dsp_ptr;
+ 
+    if (symbolList != NULL) cfree (symbolList);
+ 
+    symbolList = (DspList *) calloc (numSymbols, sizeof (DspList));
+    dsp_ptr = topOfSymLinkList;
+    for (i = 0; i < numSymbols; i++, dsp_ptr = dsp_ptr->next)
+    {
+       strcpy (symbolList[i].itemstr, dsp_ptr->itemstr);
+       strcpy (symbolList[i].pathstr, dsp_ptr->pathstr);
+       symbolList[i].next = &symbolList[i+1];
+       cfree (dsp_ptr);
+    }
+    symbolList[numSymbols].next = NULL;
+    topOfSymLinkList = NULL;
+ }
+ 
+ static
+ DspList * DirListing (Path)
+    char	* Path;
+ {
+    DspList		* dsp_ptr = NULL, * head_ptr, * tail_ptr, * p, * p1;
+    DIR			* dirp;
+    struct direct	* d;
+    int			len, count = 0;
+    char			path[MAXPATHLENGTH], s[MAXPATHLENGTH];
+    struct stat		stat_buf;
+ 
+    if (*Path == '\0')
+    {
+       strcpy (path, "/");
+       if ((dirp = opendir (path)) == NULL) return (NULL);
+    }
+    else
+    {
+       strcpy (path, Path);
+       if ((dirp = opendir (path)) == NULL) return (NULL);
+       strcat (path, "/");
+    }
+ 
+    head_ptr = tail_ptr = NULL;
+ 
+    while ((d = readdir (dirp)) != NULL)
+    {
+       len = strlen (d->d_name);
+       if (len > 4 && (strcmp (".obj", &d->d_name[len-4]) == 0))
+       {
+          d->d_name[len-4] = '\0';
+          dsp_ptr = (DspList *) calloc (1, sizeof(DspList));
+          dsp_ptr->directory = FALSE;
+          strcpy (dsp_ptr->itemstr, d->d_name);
+       }
+       else if (strcmp (d->d_name, ".") == 0)
+          continue;
+       else
+       {
+          strcpy (s, path);
+          strcat (s, d->d_name);
+          stat (s, &stat_buf);
+          if (stat_buf.st_mode & S_IFDIR)
+          {
+             dsp_ptr = (DspList *) calloc (1, sizeof(DspList));
+             dsp_ptr->directory = TRUE;
+             strcat (d->d_name, "/");
+             strcpy (dsp_ptr->itemstr, d->d_name);
+          }
+          else
+             continue;
+       }
+       if (head_ptr == NULL)
+          head_ptr = tail_ptr = dsp_ptr;
+       else
+       {
+          p1 = NULL;
+          for (p = head_ptr; p != NULL; p = p->next)
+             if (LargerStr (d->d_name, p->itemstr))
+                p1 = p;
+             else
+                break;
+ 
+          dsp_ptr->next = p;
+          if (p == NULL)
+          {  /* dsp_ptr has the largest element */
+             tail_ptr->next = dsp_ptr;
+             tail_ptr = dsp_ptr;
+          }
+          else if (p1 == NULL)
+             head_ptr = dsp_ptr;
+          else
+             p1->next = dsp_ptr;
+       }
+       count++;
+    }
+ 
+    closedir (dirp);
+    numDirEntries = count;
+    return (head_ptr);
+ }
+ 
+ static
+ void BuildDirList ()
+ {
+    register int		i;
+    register DspList	* dsp_ptr;
+ 
+    if (topOfDirLinkList != NULL)
+    {
+       if (dirList != NULL) cfree (dirList);
+ 
+       dirList = (DspList *) calloc (numDirEntries, sizeof (DspList));
+       dsp_ptr = topOfDirLinkList;
+       for (i = 0; i < numDirEntries; i++, dsp_ptr = dsp_ptr->next)
+       {
+          strcpy (dirList[i].itemstr, dsp_ptr->itemstr);
+          strcpy (dirList[i].pathstr, dsp_ptr->pathstr);
+          dirList[i].directory = dsp_ptr->directory;
+          dirList[i].next = &dirList[i+1];
+          cfree (dsp_ptr);
+       }
+       dirList[numDirEntries].next = NULL;
+       topOfDirLinkList = NULL;
+    }
+ }
+ 
  void InitNames ()
  {
!    int		default_found = FALSE;
!    char		* c_ptr, domain_str[20], sym_path[80];
     XGCValues	values;
  
***************
*** 79,82 ****
--- 360,366 ----
  
     *curDomainName = '\0';
+    *curDomainPath = '\0';
+    *curSymDir = '\0';
+    strcpy (curDir, bootDir);
  
     if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "DoubleClickInterval")) !=
***************
*** 85,90 ****
--- 369,407 ----
     else
        doubleClickInterval = 300;
+ 
+    if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "DefaultDomain")) != NULL)
+    {
+       sprintf (domain_str, "Domain%s", c_ptr);
+       if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, domain_str)) != NULL)
+       {
+          if (*c_ptr != '\0')
+          {
+             strcpy (curDomainName, c_ptr);
+             sprintf (sym_path, "TGIF_%s", c_ptr);
+             default_found = TRUE;
+          }
+       }
+    }
+ 
+    if (!default_found || (c_ptr = getenv (sym_path)) == NULL)
+       ParseSymPath (".");
+    else
+       if (strlen (c_ptr) >= MAXPATHLENGTH-1)
+          ParseSymPath (".");
+       else 
+          ParseSymPath (c_ptr);
+    if ((topOfSymLinkList = SymbolListing ()) != NULL) BuildSymbolList ();
  }
  
+ void UpdateDirInfo ()
+ {
+    if ((topOfDirLinkList = DirListing (curDir)) != NULL) BuildDirList ();
+ }
+ 
+ void UpdateSymInfo ()
+ {
+    if ((topOfSymLinkList = SymbolListing ()) != NULL) BuildSymbolList ();
+ }
+ 
  void CleanUpNames ()
  {
***************
*** 91,94 ****
--- 408,414 ----
     XFreeGC (mainDisplay, nameGC);
     XFreeGC (mainDisplay, revNameGC);
+ 
+    if (symbolList != NULL) cfree (symbolList);
+    if (dirList != NULL) cfree (dirList);
  }
  
***************
*** 145,149 ****
     register int	i;
     int		top, len, end, pixel;
-    DspItem	* diptr;
     XGCValues	values;
  
--- 465,468 ----
***************
*** 181,188 ****
  
  static
! void RedrawNameBaseWindow (Str, str_start, button_start, W, H)
!    char	* Str;
!    int	str_start, button_start;
  {
     int	top = defaultFontAsc+2;
  
--- 500,536 ----
  
  static
! void RedrawNamePath (Path, X, Y)
!    char	* Path;
!    int	X, Y;
  {
+    int	len = strlen (Path), cursor_x, cursor_y;
+    char	* c_ptr;
+ 
+    cursor_y = Y-defaultFontAsc;
+ 
+    XClearArea (mainDisplay, nameBaseWin, X, Y-defaultFontAsc,
+          ITEM_LEN*defaultFontWidth+4, defaultFontHeight+4, False);
+    XDrawRectangle (mainDisplay, nameBaseWin, nameGC, X, cursor_y-2,
+          ITEM_LEN*defaultFontWidth+8, defaultFontHeight+4);
+ 
+    if (len > ITEM_LEN)
+    {
+       c_ptr = &(Path[len-ITEM_LEN]);
+       len = ITEM_LEN;
+    }
+    else
+       c_ptr = Path;
+ 
+    cursor_x = X+2+len*defaultFontWidth;
+    XDrawString (mainDisplay, nameBaseWin, nameGC, X+2, Y, c_ptr, len);
+    XDrawLine (mainDisplay, nameBaseWin, nameGC, cursor_x,
+          cursor_y, cursor_x, cursor_y+defaultFontHeight);
+ }
+ 
+ static
+ void RedrawNameBaseWindow (Str, Path, str_start, path_start, button_start, W, H)
+    char	* Str, * Path;
+    int	str_start, path_start, button_start, W, H;
+ {
     int	top = defaultFontAsc+2;
  
***************
*** 190,199 ****
     XDrawString (mainDisplay, nameBaseWin, nameGC, str_start,
           ROW_HEIGHT+top, Str, strlen(Str));
  
!    buttonBBox[0].lty = buttonBBox[1].lty = (ITEM_DSPED+4) * ROW_HEIGHT;
     buttonBBox[0].ltx = button_start;
!    DisplayButton (nameBaseWin, "OK", 8, &buttonBBox[0], BUTTON_NORMAL);
     buttonBBox[1].ltx = buttonBBox[CONFIRM_YES].rbx + 1 + defaultFontWidth;
!    DisplayButton (nameBaseWin, "CANCEL", 8, &buttonBBox[1],
           BUTTON_NORMAL);
  }
--- 538,548 ----
     XDrawString (mainDisplay, nameBaseWin, nameGC, str_start,
           ROW_HEIGHT+top, Str, strlen(Str));
+    RedrawNamePath (Path, path_start, 3*ROW_HEIGHT+top);
  
!    buttonBBox[0].lty = buttonBBox[1].lty = (ITEM_DSPED+6) * ROW_HEIGHT;
     buttonBBox[0].ltx = button_start;
!    DisplayButton (nameBaseWin, "OK", 8, &(buttonBBox[0]), BUTTON_NORMAL);
     buttonBBox[1].ltx = buttonBBox[CONFIRM_YES].rbx + 1 + defaultFontWidth;
!    DisplayButton (nameBaseWin, "CANCEL", 8, &(buttonBBox[1]),
           BUTTON_NORMAL);
  }
***************
*** 213,221 ****
        dsp_ptr[i] = c_ptr;
        len = strlen (DLPtr->itemstr);
!       for (j = len; j >= 0 && DLPtr->itemstr[j] != '/'; j--) ;
!       if (j >= 0)
!          strcpy (c_ptr, (&DLPtr->itemstr[j])+1);
        else
           strcpy (c_ptr, DLPtr->itemstr);
        c_ptr += MAXPATHLENGTH;
     }
--- 562,576 ----
        dsp_ptr[i] = c_ptr;
        len = strlen (DLPtr->itemstr);
!       if (!DLPtr->directory)
!       {
!          for (j = len; j >= 0 && DLPtr->itemstr[j] != '/'; j--) ;
!          if (j >= 0)
!             strcpy (c_ptr, (&(DLPtr->itemstr[j]))+1);
!          else
!             strcpy (c_ptr, DLPtr->itemstr);
!       }
        else
           strcpy (c_ptr, DLPtr->itemstr);
+ 
        c_ptr += MAXPATHLENGTH;
     }
***************
*** 343,362 ****
  
  static
! int Names (Str)
!    char	* Str;
  {
!    int		x, y, pixel, button_widths, str_width, graph_width, w, h;
!    int		str_start, button_start, graph_start, index;
!    int		dsp_w, dsp_h;
!    XEvent	input, ev;
!    int		i, len, looping = TRUE, grabbed = FALSE;
!    char		buf[80];
!    XKeyEvent	* key_ev;
!    XButtonEvent	* button_ev;
!    KeySym	key_sym;
     XComposeStatus	c_stat;
     XSetWindowAttributes	win_attrs;
!    int		win_x, win_y, win_w, win_h, win_d, win_brdr_w;
!    Window	root_win;
  
     dsp_w = DisplayWidth (mainDisplay, mainScreen);
--- 698,729 ----
  
  static
! int LargerStr (S1, S2)
!    register char	* S1, * S2;
!    /* returns TRUE if S1 > S2 */
  {
!    while (*S1 == *S2 && *S1 != '\0' && *S2 != '\0') { S1++; S2++; }
! 
!    return (*S1 > *S2);
! }
! 
! static
! int DirNames (TopStr, SelStr)
!    char	* TopStr, * SelStr;
! {
!    int			pixel, button_widths, str_width, graph_width;
!    int			str_start, button_start, graph_start, index;
!    int			dsp_w, dsp_h, x, y, w, h, i, len, exposure = 0;
!    XEvent		input, ev;
!    int			looping = TRUE, changing, grabbed = FALSE, name_index;
!    char			buf[80], name[MAXPATHLENGTH], full_name[MAXPATHLENGTH];
!    char			dir_name[MAXPATHLENGTH], sel_str[MAXPATHLENGTH];
!    XKeyEvent		* key_ev;
!    XButtonEvent		* button_ev;
!    KeySym		key_sym;
     XComposeStatus	c_stat;
     XSetWindowAttributes	win_attrs;
!    int			win_x, win_y, win_w, win_h, win_d, win_brdr_w;
!    Window		root_win;
!    DspList		* dsp_ptr, * head_dsp_ptr;
  
     dsp_w = DisplayWidth (mainDisplay, mainScreen);
***************
*** 365,369 ****
     button_widths = ButtonWidth("OK", 8) + ButtonWidth("CANCEL", 8) +
           defaultFontWidth;
!    str_width = defaultFontWidth * strlen (Str);
     graph_width = nameDspWinW + scrollBarW + 2 * brdrW;
  
--- 732,736 ----
     button_widths = ButtonWidth("OK", 8) + ButtonWidth("CANCEL", 8) +
           defaultFontWidth;
!    str_width = defaultFontWidth * strlen (TopStr);
     graph_width = nameDspWinW + scrollBarW + 2 * brdrW;
  
***************
*** 381,385 ****
     }
     button_start = (w - button_widths) / 2;
!    h = (6 + ITEM_DSPED) * ROW_HEIGHT;
  
     win_x = (w > dsp_w) ? 0 : (dsp_w - w)/2;
--- 748,752 ----
     }
     button_start = (w - button_widths) / 2;
!    h = (8 + ITEM_DSPED) * ROW_HEIGHT;
  
     win_x = (w > dsp_w) ? 0 : (dsp_w - w)/2;
***************
*** 393,397 ****
  
     if ((nameDspWin = XCreateSimpleWindow (mainDisplay, nameBaseWin, graph_start,
!          3*ROW_HEIGHT, nameDspW, nameDspH, brdrW, myBorderPixel,
           myBgPixel)) == 0)
     { printf ("Could not create desired popup window!\n"); exit (-1); }
--- 760,764 ----
  
     if ((nameDspWin = XCreateSimpleWindow (mainDisplay, nameBaseWin, graph_start,
!          5*ROW_HEIGHT, nameDspW, nameDspH, brdrW, myBorderPixel,
           myBgPixel)) == 0)
     { printf ("Could not create desired popup window!\n"); exit (-1); }
***************
*** 398,402 ****
  
     if ((nameScrollWin = XCreateSimpleWindow (mainDisplay, nameBaseWin,
!          graph_start+nameDspWinW, 3*ROW_HEIGHT, scrollBarW, nameDspH,
           brdrW, myBorderPixel, myBgPixel)) == 0)
     { printf ("Could not create desired popup scroll window!\n"); exit (-1); }
--- 765,769 ----
  
     if ((nameScrollWin = XCreateSimpleWindow (mainDisplay, nameBaseWin,
!          graph_start+nameDspWinW, 5*ROW_HEIGHT, scrollBarW, nameDspH,
           brdrW, myBorderPixel, myBgPixel)) == 0)
     { printf ("Could not create desired popup scroll window!\n"); exit (-1); }
***************
*** 419,425 ****
--- 786,1122 ----
           KeyPressMask | ButtonPressMask | ExposureMask);
  
+    strcpy (dir_name, curDir);
+ 
     justClicked = FALSE;
     while (looping)
     {
+       nameEntries = numDirEntries;
+       if (topOfDirLinkList == NULL)
+          nameDspPtr = MakeNameDspItemArray (nameEntries, dirList);
+       else
+          nameDspPtr = MakeNameDspItemArray (nameEntries, topOfDirLinkList);
+       nameFirst = 0;
+       nameMarked = 0;
+ 
+       strcpy (full_name, dir_name);
+       strcat (full_name, "/");
+       name[0] = '\0';
+       name_index = 0;
+ 
+       if (exposure >= 3)
+       {
+          XClearWindow (mainDisplay, nameBaseWin);
+          XClearWindow (mainDisplay, nameDspWin);
+          XClearWindow (mainDisplay, nameScrollWin);
+          RedrawNameBaseWindow (TopStr, full_name, str_start, graph_start,
+                button_start, w, h);
+          RedrawNameScrollWin ();
+          RedrawDspWindow ();
+       }
+ 
+       changing = TRUE;
+       while (changing)
+       {
+          XNextEvent (mainDisplay, &input);
+          if (input.type == Expose)
+          {
+             if (input.xany.window == nameBaseWin)
+             {
+                RedrawNameBaseWindow (TopStr, full_name, str_start, graph_start,
+                      button_start, w, h);
+                exposure++;
+             }
+             else if (input.xany.window == nameScrollWin)
+             {
+                RedrawNameScrollWin ();
+                exposure++;
+             }
+             else if (input.xany.window == nameDspWin)
+             {
+                RedrawDspWindow ();
+                exposure++;
+             }
+ 
+ /*          if (!grabbed)
+             {
+                XGrabKeyboard (mainDisplay, nameBaseWin, False,
+                      GrabModeAsync, GrabModeAsync, CurrentTime);
+                grabbed = TRUE;
+             } */
+ 
+             continue;
+          }
+          else if (input.type == KeyPress)
+          {
+             key_ev = &(input.xkey);
+             XLookupString (key_ev, buf, 80, &key_sym, &c_stat);
+ 
+             if ((buf[0]=='\r' && (key_sym & 0xff)=='\r') ||
+                 (buf[0]=='\n' && (key_sym & 0xff)=='\n'))
+             {
+                changing = FALSE;
+                index = nameMarked;
+             }
+             else if (buf[0]=='\033' && (key_sym & 0xff)=='\033')
+             {
+                looping = FALSE;
+                changing = FALSE;
+                index = INVALID;
+             }
+             else if (buf[0] == '\b' || buf[0] == '\177')
+             {
+                if (name_index != 0)
+                {
+                   name[--name_index] = '\0';
+                   strcpy (full_name, dir_name);
+                   strcat (full_name, "/");
+                   strcat (full_name, name);
+                   for (i = 0; i < nameEntries; i++)
+                      if (strncmp (nameDspPtr[i], name, name_index) == 0)
+                         break;
+ 
+                   if (i < nameEntries)
+                   {
+                      if (i < nameFirst)
+                         nameFirst = i;
+                      else if (i >= nameFirst+ITEM_DSPED)
+                      {
+                         if (i < nameEntries-ITEM_DSPED)
+                            nameFirst = i;
+                         else
+                            nameFirst = nameEntries-ITEM_DSPED;
+                      }
+                      nameMarked = i;
+                      RedrawNamePath (full_name, graph_start,
+                            3*ROW_HEIGHT+defaultFontAsc+2);
+                      RedrawNameScrollWin ();
+                      RedrawDspWindow ();
+                   }
+                }
+             }
+             else if (key_sym>='\040' && key_sym<='\177')
+             {
+                if (buf[0] == '$')
+                {
+                   i = (nameEntries == 0) ? 0 : nameEntries-1;
+                   strcpy (name, nameDspPtr[i]);
+                }
+                else
+                {
+                   name[name_index++] = buf[0];
+                   name[name_index] = '\0';
+                   for (i = 0; i < nameEntries; i++)
+                      if (strncmp (nameDspPtr[i], name, name_index) == 0)
+                         break;
+                }
+ 
+                if (i < nameEntries)
+                {
+                   if (i < nameFirst)
+                      nameFirst = i;
+                   else if (i >= nameFirst+ITEM_DSPED)
+                   {
+                      if (i < nameEntries-ITEM_DSPED)
+                         nameFirst = i;
+                      else
+                         nameFirst = nameEntries-ITEM_DSPED;
+                   }
+                   nameMarked = i;
+ 
+                   strcpy (full_name, dir_name);
+                   strcat (full_name, "/");
+                   strcat (full_name, name);
+                   RedrawNamePath (full_name, graph_start,
+                         3*ROW_HEIGHT+defaultFontAsc+2);
+                   RedrawNameScrollWin ();
+                   RedrawDspWindow ();
+                }
+                else
+                   name[--name_index] = '\0';
+             }
+          }
+          else if (input.type == ButtonPress)
+          {
+             button_ev = &(input.xbutton);
+             if (button_ev->window == nameBaseWin)
+             {
+                if (PointInBBox (button_ev->x, button_ev->y, buttonBBox[0]))
+                {
+                   changing = FALSE;
+                   index = nameMarked;
+                }
+                else if (PointInBBox (button_ev->x, button_ev->y, buttonBBox[1]))
+                {
+                   looping = FALSE;
+                   changing = FALSE;
+                   index = INVALID;
+                }
+             }
+             else if (button_ev->window == nameScrollWin)
+                NameScrollHandler (button_ev);
+             else if (button_ev->window == nameDspWin)
+             {
+                if (NameDspHandler (button_ev) != INVALID)
+                {
+                   changing = FALSE;
+                   index = nameMarked;
+                }
+                else if (nameMarked != INVALID)
+                {
+                   strcpy (name, nameDspPtr[nameMarked]);
+                   strcpy (full_name, dir_name);
+                   strcat (full_name, "/");
+                   strcat (full_name, name);
+                   RedrawNamePath (full_name, graph_start,
+                         3*ROW_HEIGHT+defaultFontAsc+2);
+                }
+             }
+          }
+       }
+ 
+       if (index != INVALID) strcpy (sel_str, nameDspPtr[index]);
+ 
+       cfree (*nameDspPtr);
+       cfree (nameDspPtr);
+ 
+       if (index == INVALID) break;
+ 
+       if (sel_str[strlen(sel_str)-1] == '/')
+       {
+          sel_str[strlen(sel_str)-1] = '\0';
+          if (strcmp (sel_str, "..") == 0)
+          {
+             for (i = strlen(dir_name)-1; i>=0 && dir_name[i]!='/'; i--) ;
+             if (i < 0)
+                dir_name[0] = '\0';
+             else
+                dir_name[i] = '\0';
+          }
+          else
+          {
+             strcat (dir_name, "/");
+             strcat (dir_name, sel_str);
+          }
+ 
+          dsp_ptr = topOfDirLinkList;
+          for ( ; dsp_ptr != NULL; dsp_ptr = dsp_ptr->next) cfree (dsp_ptr);
+          topOfDirLinkList = NULL;
+ 
+          Msg ("Generating list of file names, please wait ...");
+          if ((topOfDirLinkList = DirListing (dir_name)) == NULL)
+          {
+             *sel_str = '\0';
+             break;
+          }
+          Msg ("");
+       }
+       else
+          break;
+    }
+    if (grabbed) XUngrabKeyboard (mainDisplay, CurrentTime);
+ 
+    strcpy (SelStr, dir_name);
+    strcat (SelStr, "/");
+    strcat (SelStr, sel_str);
+ 
+    if (index == INVALID)
+       DisplayButton (nameBaseWin, okCancelStr[1], 8, &buttonBBox[1],
+             BUTTON_INVERT);
+    else
+       DisplayButton (nameBaseWin, okCancelStr[0], 8, &buttonBBox[0],
+             BUTTON_INVERT);
+ 
+    XDestroyWindow (mainDisplay, nameBaseWin);
+    XSync (mainDisplay, FALSE);
+    while (XCheckMaskEvent (mainDisplay, ExposureMask, &input)) ;
+    return (index);
+ }
+ 
+ static
+ int ChooseAName (TopStr, SelStr)
+    char	* TopStr, * SelStr;
+ {
+    int			button_widths, str_width, graph_width;
+    int			str_start, button_start, graph_start, index;
+    int			dsp_w, dsp_h, x, y, w, h, i, len;
+    XEvent		input, ev;
+    int			changing = TRUE, grabbed = FALSE, name_index;
+    char			buf[80], name[MAXPATHLENGTH];
+    XKeyEvent		* key_ev;
+    XButtonEvent		* button_ev;
+    KeySym		key_sym;
+    XComposeStatus	c_stat;
+    XSetWindowAttributes	win_attrs;
+    int			win_x, win_y, win_w, win_h, win_d, win_brdr_w;
+ 
+    dsp_w = DisplayWidth (mainDisplay, mainScreen);
+    dsp_h = DisplayHeight (mainDisplay, mainScreen);
+ 
+    button_widths = ButtonWidth("OK", 8) + ButtonWidth("CANCEL", 8) +
+          defaultFontWidth;
+    str_width = defaultFontWidth * strlen (TopStr);
+    graph_width = nameDspWinW + scrollBarW + 2 * brdrW;
+ 
+    if (str_width > graph_width)
+    {
+       w = str_width + 4 * defaultFontWidth;
+       str_start = 2 * defaultFontWidth;
+       graph_start = (w - graph_width) / 2;
+    }
+    else
+    {
+       w = graph_width + 4 * defaultFontWidth;
+       str_start = (w - str_width) / 2;
+       graph_start = 2 * defaultFontWidth;
+    }
+    button_start = (w - button_widths) / 2;
+    h = (8 + ITEM_DSPED) * ROW_HEIGHT;
+ 
+    win_x = (w > dsp_w) ? 0 : (dsp_w - w)/2;
+    win_y = (h > dsp_h) ? 0 : (dsp_h - h)/3;
+ 
+    if ((nameBaseWin = XCreateSimpleWindow (mainDisplay, rootWindow,
+          win_x, win_y, w, h, brdrW, myBorderPixel, myBgPixel)) == 0)
+    { printf ("Could not create desired popup window!\n"); exit (-1); }
+ 
+    XDefineCursor (mainDisplay, nameBaseWin, defaultCursor);
+ 
+    if ((nameDspWin = XCreateSimpleWindow (mainDisplay, nameBaseWin, graph_start,
+          5*ROW_HEIGHT, nameDspW, nameDspH, brdrW, myBorderPixel,
+          myBgPixel)) == 0)
+    { printf ("Could not create desired popup window!\n"); exit (-1); }
+ 
+    if ((nameScrollWin = XCreateSimpleWindow (mainDisplay, nameBaseWin,
+          graph_start+nameDspWinW, 5*ROW_HEIGHT, scrollBarW, nameDspH,
+          brdrW, myBorderPixel, myBgPixel)) == 0)
+    { printf ("Could not create desired popup scroll window!\n"); exit (-1); }
+ 
+    win_attrs.save_under = True;
+    XChangeWindowAttributes (mainDisplay, nameBaseWin, CWSaveUnder, &win_attrs);
+ 
+    XSetTransientForHint (mainDisplay, nameBaseWin, mainWindow);
+ 
+    XMapWindow (mainDisplay, nameBaseWin);
+    XSelectInput (mainDisplay, nameBaseWin,
+          KeyPressMask | ButtonPressMask | ExposureMask);
+ 
+    XMapWindow (mainDisplay, nameDspWin);
+    XSelectInput (mainDisplay, nameDspWin,
+          KeyPressMask | ButtonPressMask | ExposureMask);
+ 
+    XMapWindow (mainDisplay, nameScrollWin);
+    XSelectInput (mainDisplay, nameScrollWin,
+          KeyPressMask | ButtonPressMask | ExposureMask);
+ 
+    justClicked = FALSE;
+ 
+    Msg ("");
+ 
+    name[0] = '\0';
+    name_index = 0;
+    nameMarked = INVALID;
+ 
+    while (changing)
+    {
        XNextEvent (mainDisplay, &input);
        if (input.type == Expose)
***************
*** 426,430 ****
        {
           if (input.xany.window == nameBaseWin)
!             RedrawNameBaseWindow (Str, str_start, button_start, w, h);
           else if (input.xany.window == nameScrollWin)
              RedrawNameScrollWin ();
--- 1123,1128 ----
        {
           if (input.xany.window == nameBaseWin)
!             RedrawNameBaseWindow (TopStr, name, str_start, graph_start,
!                   button_start, w, h);
           else if (input.xany.window == nameScrollWin)
              RedrawNameScrollWin ();
***************
*** 432,436 ****
              RedrawDspWindow ();
  
!          if (!grabbed)
           {
              XGrabKeyboard (mainDisplay, nameBaseWin, False,
--- 1130,1134 ----
              RedrawDspWindow ();
  
! /*       if (!grabbed)
           {
              XGrabKeyboard (mainDisplay, nameBaseWin, False,
***************
*** 437,441 ****
                    GrabModeAsync, GrabModeAsync, CurrentTime);
              grabbed = TRUE;
!          }
  
           continue;
--- 1135,1139 ----
                    GrabModeAsync, GrabModeAsync, CurrentTime);
              grabbed = TRUE;
!          } */
  
           continue;
***************
*** 446,466 ****
           XLookupString (key_ev, buf, 80, &key_sym, &c_stat);
  
!          if (buf[0] == '\r' || buf[0] == '\n')
           {
!             looping = FALSE;
              index = nameMarked;
           }
!          else if (buf[0] == '\033')
           {
!             looping = FALSE;
              index = INVALID;
           }
           else if (key_sym>='\040' && key_sym<='\177')
           {
              if (buf[0] == '$')
                 i = (nameEntries == 0) ? 0 : nameEntries-1;
              else
                 for (i = 0; i < nameEntries; i++)
!                   if (*nameDspPtr[i] == buf[0]) break;
              if (i < nameEntries)
              {
--- 1144,1202 ----
           XLookupString (key_ev, buf, 80, &key_sym, &c_stat);
  
!          if ((buf[0]=='\r' && (key_sym & 0xff)=='\r') ||
!              (buf[0]=='\n' && (key_sym & 0xff)=='\n'))
           {
!             changing = FALSE;
              index = nameMarked;
           }
!          else if (buf[0]=='\033' && (key_sym & 0xff)=='\033')
           {
!             changing = FALSE;
              index = INVALID;
           }
+          else if (buf[0] == '\b' || buf[0] == '\177')
+          {
+             if (name_index != 0)
+             {
+                name[--name_index] = '\0';
+                for (i = 0; i < nameEntries; i++)
+                   if (strncmp (nameDspPtr[i], name, name_index) == 0)
+                      break;
+ 
+                if (i < nameEntries)
+                {
+                   if (i < nameFirst)
+                      nameFirst = i;
+                   else if (i >= nameFirst+ITEM_DSPED)
+                   {
+                      if (i < nameEntries-ITEM_DSPED)
+                         nameFirst = i;
+                      else
+                         nameFirst = nameEntries-ITEM_DSPED;
+                   }
+                   nameMarked = i;
+                   RedrawNamePath (name, graph_start,
+                         3*ROW_HEIGHT+defaultFontAsc+2);
+                   RedrawNameScrollWin ();
+                   RedrawDspWindow ();
+                }
+             }
+          }
           else if (key_sym>='\040' && key_sym<='\177')
           {
              if (buf[0] == '$')
+             {
                 i = (nameEntries == 0) ? 0 : nameEntries-1;
+                strcpy (name, nameDspPtr[i]);
+             }
              else
+             {
+                name[name_index++] = buf[0];
+                name[name_index] = '\0';
                 for (i = 0; i < nameEntries; i++)
!                   if (strncmp (nameDspPtr[i], name, name_index) == 0)
!                      break;
!             }
! 
              if (i < nameEntries)
              {
***************
*** 475,481 ****
--- 1211,1222 ----
                 }
                 nameMarked = i;
+ 
+                RedrawNamePath (name, graph_start,
+                      3*ROW_HEIGHT+defaultFontAsc+2);
                 RedrawNameScrollWin ();
                 RedrawDspWindow ();
              }
+             else
+                name[--name_index] = '\0';
           }
        }
***************
*** 487,491 ****
              if (PointInBBox (button_ev->x, button_ev->y, buttonBBox[0]))
              {
!                looping = FALSE;
                 index = nameMarked;
              }
--- 1228,1232 ----
              if (PointInBBox (button_ev->x, button_ev->y, buttonBBox[0]))
              {
!                changing = FALSE;
                 index = nameMarked;
              }
***************
*** 492,496 ****
              else if (PointInBBox (button_ev->x, button_ev->y, buttonBBox[1]))
              {
!                looping = FALSE;
                 index = INVALID;
              }
--- 1233,1237 ----
              else if (PointInBBox (button_ev->x, button_ev->y, buttonBBox[1]))
              {
!                changing = FALSE;
                 index = INVALID;
              }
***************
*** 502,508 ****
              if (NameDspHandler (button_ev) != INVALID)
              {
!                looping = FALSE;
                 index = nameMarked;
              }
           }
        }
--- 1243,1256 ----
              if (NameDspHandler (button_ev) != INVALID)
              {
!                changing = FALSE;
                 index = nameMarked;
              }
+             else if (nameMarked != INVALID)
+             {
+                strcpy (name, nameDspPtr[nameMarked]);
+                name_index = strlen (name);
+                RedrawNamePath (name, graph_start,
+                      3*ROW_HEIGHT+defaultFontAsc+2);
+             }
           }
        }
***************
*** 514,519 ****
--- 1262,1270 ----
              BUTTON_INVERT);
     else
+    {
+       strcpy (SelStr, nameDspPtr[index]);
        DisplayButton (nameBaseWin, okCancelStr[0], 8, &buttonBBox[0],
              BUTTON_INVERT);
+    }
  
     XDestroyWindow (mainDisplay, nameBaseWin);
***************
*** 523,698 ****
  }
  
! static
! int	LargerStr (S1, S2)
!    register char	* S1, * S2;
!    /* returns TRUE if S1 > S2 */
  {
!    while (*S1 == *S2 && *S1 != '\0' && *S2 != '\0') { S1++; S2++; }
  
!    return (*S1 > *S2);
! }
! 
! static
! DspList * DirListing (Path, Extension, Entries)
!    char	* Path, * Extension;
!    int	* Entries;
! {
!    DspList		* dsp_ptr = NULL, * head_ptr, * tail_ptr, * p, * p1;
!    DIR			* dirp;
!    struct direct	* d;
!    int			len, ext_len, count = 0;
!    char			ext[MAXPATHLENGTH];
! 
!    if (*Path == '\0')
     {
!       if ((dirp = opendir (".")) == NULL) return (NULL);
!    }
!    else
!    {
!       if ((dirp = opendir (Path)) == NULL) return (NULL);
!    }
  
!    strcpy (ext, ".");
!    strcat (ext, Extension);
!    ext_len = strlen (ext);
!    head_ptr = tail_ptr = NULL;
! 
!    while ((d = readdir (dirp)) != NULL)
!    {
!       len = strlen (d->d_name);
!       if (len > ext_len && (strcmp (ext, &d->d_name[len-ext_len]) == 0))
!       {
!          d->d_name[len-ext_len] = '\0';
!          dsp_ptr = (DspList *) calloc (1, sizeof(DspList));
!          strcpy (dsp_ptr->itemstr, d->d_name);
!          if (head_ptr == NULL)
!             head_ptr = tail_ptr = dsp_ptr;
!          else
!          {
!             p1 = NULL;
!             for (p = head_ptr; p != NULL; p = p->next)
!                if (LargerStr (d->d_name, p->itemstr))
!                   p1 = p;
!                else
!                   break;
! 
!             dsp_ptr->next = p;
!             if (p == NULL)
!             {  /* dsp_ptr has the largest element */
!                tail_ptr->next = dsp_ptr;
!                tail_ptr = dsp_ptr;
!             }
!             else if (p1 == NULL)
!                head_ptr = dsp_ptr;
!             else
!                p1->next = dsp_ptr;
!          }
!          count++;
!       }
     }
! 
!    closedir (dirp);
!    *Entries = count;
!    return (head_ptr);
  }
  
! int SelectFileName (Extension, Str, SelStr)
!    char	* Extension, * Str, * SelStr;
  {
!    register int	i, index;
!    char		s[MAXPATHLENGTH], full_name[MAXPATHLENGTH];
     DspList	* dsp_ptr;
  
!    sprintf (s, "Generating list of file names, please wait ...");
     Msg (s);
-    strcpy (full_name, curDomainName);
  
!    if ((dsp_ptr = DirListing (curDomainName, Extension, &nameEntries)) == NULL)
!    {
!       strcpy (s, "No appropriate files to select from.");
!       Msg (s);
!       *SelStr = '\0';
!       return (INVALID);
!    }
  
!    nameDspPtr = MakeNameDspItemArray (nameEntries, dsp_ptr);
     nameFirst = 0;
     nameMarked = 0;
  
!    if ((index = Names (Str)) == INVALID)
!       *SelStr = '\0';
     else
!       strcpy (SelStr, nameDspPtr[index]);
! 
!    for ( ; dsp_ptr != NULL; dsp_ptr = dsp_ptr->next) cfree (dsp_ptr);
!    cfree (nameDspPtr[0]);
     cfree (nameDspPtr);
  
!    s[0] = '\0';
!    Msg (s);
! 
     return (index);
  }
  
  static
! DspList * DomainListing (Path, Entries)
!    char	* Path;
     int	* Entries;
  {
!    DspList		* dsp_ptr = NULL, * head_ptr, * tail_ptr, * p, * p1;
!    DIR			* dirp, * dp;
!    struct direct	* d;
!    struct stat		stat_buf;
!    int			count = 0;
!    char			path[255], s[255];
  
!    if (*Path == '\0')
!       strcpy (path, ".");
!    else
!       strcpy (path, Path);
  
!    if ((dirp = opendir (path)) == NULL) return (NULL);
  
-    strcat (path, "/");
     head_ptr = tail_ptr = NULL;
! 
!    while ((d = readdir (dirp)) != NULL)
     {
!       strcpy (s, path);
!       strcat (s, d->d_name);
! 
!       stat (s, &stat_buf);
!       if (stat_buf.st_mode & S_IFDIR)
        {
!          dsp_ptr = (DspList *) calloc (1, sizeof(DspList));
!          strcpy (dsp_ptr->itemstr, d->d_name);
!          if (head_ptr == NULL)
!             head_ptr = tail_ptr = dsp_ptr;
!          else
!          {
!             p1 = NULL;
!             for (p = head_ptr; p != NULL; p = p->next)
!                if (LargerStr (d->d_name, p->itemstr))
!                   p1 = p;
!                else
!                   break;
  
!             dsp_ptr->next = p;
!             if (p == NULL)
!             {  /* dsp_ptr has the largest element */
!                tail_ptr->next = dsp_ptr;
!                tail_ptr = dsp_ptr;
!             }
!             else if (p1 == NULL)
!                head_ptr = dsp_ptr;
              else
!                p1->next = dsp_ptr;
           }
!          count++;
        }
     }
- 
-    closedir (dirp);
-    *Entries = count;
     return (head_ptr);
  }
--- 1274,1406 ----
  }
  
! int SelectFileName (MsgStr, SelStr)
!    char	* MsgStr, * SelStr;
  {
!    int		index = INVALID, saved_num_dir_entries;
!    DspList	* dsp_ptr;
  
!    saved_num_dir_entries = numDirEntries;
!    if ((index = DirNames (MsgStr, SelStr)) == INVALID)
     {
!       numDirEntries = saved_num_dir_entries;
!       dsp_ptr = topOfDirLinkList;
!       for ( ; dsp_ptr != NULL; dsp_ptr = dsp_ptr->next) cfree (dsp_ptr);
!       topOfDirLinkList = NULL;
  
!       *SelStr = '\0';
!       return (INVALID);
     }
!    BuildDirList ();
!    Msg ("");
!    return (index);
  }
  
! int SelectSymbolName (SelSymName, PathName)
!    char	* SelSymName, * PathName;
  {
!    register int	i, index = INVALID;
!    char		s[MAXPATHLENGTH], msg[MAXSTRING];
     DspList	* dsp_ptr;
  
!    sprintf (s,
!          "Generating a list of symbol names in '%s' domain, please wait ...",
!          curDomainName);
     Msg (s);
  
! /* if ((topOfSymLinkList = SymbolListing ()) == NULL) */
! /* { */
! /*    Msg ("No symbol found!"); */
! /*    SelSymName[0] = '\0'; */
! /*    PathName[0] = '\0'; */
! /*    return (INVALID); */
! /* } */
! /* BuildSymbolList (); */
  
!    nameEntries = numSymbols;
!    nameDspPtr = MakeNameDspItemArray (nameEntries, symbolList);
     nameFirst = 0;
     nameMarked = 0;
  
!    sprintf (msg, "Please select a symbol to INSTANTIATE in the '%s' domain ...",
!          curDomainName);
!    if ((index = ChooseAName (msg, SelSymName)) == INVALID)
!    {
!       *SelSymName = '\0';
!       *PathName = '\0';
!    }
     else
!    {
!       strcpy (SelSymName, nameDspPtr[index]);
!       strcpy (PathName, symbolList[index].pathstr);
!    }
!    cfree (*nameDspPtr);
     cfree (nameDspPtr);
  
!    Msg ("");
     return (index);
  }
  
+ int GetSymbolPath (SymName, PathName)
+    char	* SymName, * PathName;
+ {
+    register int	i;
+ 
+    for (i = 0; i < numSymbols; i++)
+       if (strcmp (SymName, symbolList[i].itemstr) == 0)
+       {
+          strcpy (PathName, symbolList[i].pathstr);
+          return (TRUE);
+       }
+    return (FALSE);
+ }
+ 
  static
! DspList * DomainListing (Entries)
     int	* Entries;
  {
!    register int	i, default_index = 0;
!    char		s[MAXSTRING], * c_ptr;
!    DspList	* dsp_ptr = NULL, * head_ptr, * tail_ptr, * p, * p1;
  
!    if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "MaxDomains")) == NULL)
!       return (NULL);
  
!    *Entries = atoi (c_ptr);
  
     head_ptr = tail_ptr = NULL;
!    for (i = 0; i < *Entries; i++)
     {
!       sprintf (s, "Domain%1d", i);
!       if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, s)) == NULL)
        {
!          for ( ; head_ptr != NULL; head_ptr = head_ptr->next) cfree (head_ptr);
!          return (NULL);
!       }
  
!       dsp_ptr = (DspList *) calloc (1, sizeof(DspList));
!       strcpy (dsp_ptr->itemstr, c_ptr);
!       if (head_ptr == NULL)
!          head_ptr = tail_ptr = dsp_ptr;
!       else
!       {
!          p1 = NULL;
!          for (p = head_ptr; p != NULL; p = p->next)
!             if (LargerStr (dsp_ptr->itemstr, p->itemstr))
!                p1 = p;
              else
!                break;
! 
!          dsp_ptr->next = p;
!          if (p == NULL)
!          {  /* dsp_ptr has the largest element */
!             tail_ptr->next = dsp_ptr;
!             tail_ptr = dsp_ptr;
           }
!          else if (p1 == NULL)
!             head_ptr = dsp_ptr;
!          else
!             p1->next = dsp_ptr;
        }
     }
     return (head_ptr);
  }
***************
*** 701,712 ****
     char	* SelStr;
  {
!    register int		i, index;
!    char			s[MAXPATHLENGTH];
!    DspList		* dsp_ptr;
  
     Msg ("Generating list of domain names, please wait ...");
  
!    if ((dsp_ptr = DomainListing (curDomainName, &nameEntries)) == NULL)
     {
        *SelStr = '\0';
        return (INVALID);
--- 1409,1421 ----
     char	* SelStr;
  {
!    int		index;
!    char		s[MAXPATHLENGTH];
!    DspList	* dsp_ptr;
  
     Msg ("Generating list of domain names, please wait ...");
  
!    if ((dsp_ptr = DomainListing (&nameEntries)) == NULL)
     {
+       Msg ("No domain names found.");
        *SelStr = '\0';
        return (INVALID);
***************
*** 717,721 ****
     nameMarked = 0;
  
!    if ((index = Names ("PLEASE SELECT NEW DOMAIN ...")) == INVALID)
        *SelStr = '\0';
     else
--- 1426,1430 ----
     nameMarked = 0;
  
!    if ((index = ChooseAName ("Please select a new DOMAIN ...", "")) == INVALID)
        *SelStr = '\0';
     else
***************
*** 730,732 ****
--- 1439,1465 ----
  
     return (index);
+ }
+ 
+ void SetCurDir (FileName)
+    char	* FileName;
+ {
+    register int	i;
+    char		file_name[MAXPATHLENGTH];
+ 
+    if (*FileName != '/')
+       strcpy (file_name, bootDir);
+    else
+       strcpy (file_name, FileName);
+ 
+    for (i = strlen(file_name)-1; i>=0 && file_name[i]!='/'; i--) ;
+ 
+    if (i < 0)
+       TwoLineMsg ("Error:  No '/' found in SetCurDir ().",
+                   "        curDir and curFileName not set.");
+    else
+    {
+       strcpy (curFileName, &file_name[i+1]);
+       file_name[i] = '\0';
+       strcpy (curDir, file_name);
+    }
  }
*** oval.c.orig	Sat Oct 27 17:49:16 1990
--- oval.c	Sat Oct 27 17:49:17 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/oval.c,v 1.7 90/08/13 09:23:35 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/oval.c,v 1.8 90/10/27 15:10:00 william Exp $";
  #endif
  
*** pattern.c.orig	Sat Oct 27 17:49:27 1990
--- pattern.c	Sat Oct 27 17:49:28 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/pattern.c,v 1.3 90/07/11 21:30:41 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/pattern.c,v 1.4 90/10/27 15:40:34 william Exp $";
  #endif
  
***************
*** 30,33 ****
--- 30,34 ----
  int     penPat = SOLIDPAT;
  int     curSpline = LT_STRAIGHT;
+ int     curDash = 0;
  
  void ModeMenu (X, Y)
***************
*** 505,508 ****
--- 506,624 ----
  }
  
+ static
+ int ChangeObjDashes (ObjPtr, DashIndex)
+    struct ObjRec	* ObjPtr;
+    int			DashIndex;
+ {
+    register struct ObjRec	* obj_ptr;
+    int				changed = FALSE;
+ 
+    for (obj_ptr = ObjPtr; obj_ptr != NULL; obj_ptr = obj_ptr->prev)
+       switch (obj_ptr->type)
+       {
+          case OBJ_POLY:
+             if (obj_ptr->detail.p->dash != DashIndex)
+             {
+                obj_ptr->detail.p->dash = DashIndex;
+                changed = TRUE;
+             }
+             break;
+          case OBJ_BOX:
+             if (obj_ptr->detail.b->dash != DashIndex)
+             {
+                obj_ptr->detail.b->dash = DashIndex;
+                changed = TRUE;
+             }
+             break;
+          case OBJ_OVAL:
+             if (obj_ptr->detail.o->dash != DashIndex)
+             {
+                obj_ptr->detail.o->dash = DashIndex;
+                changed = TRUE;
+             }
+             break;
+          case OBJ_POLYGON:
+             if (obj_ptr->detail.g->dash != DashIndex)
+             {
+                obj_ptr->detail.g->dash = DashIndex;
+                changed = TRUE;
+             }
+             break;
+ 
+          case OBJ_GROUP:
+          case OBJ_SYM:
+             if (ChangeObjLineWidth (obj_ptr->detail.r->last, DashIndex))
+                changed = TRUE;
+             break;
+       }
+    return (changed);
+ }
+ 
+ void ChangeAllSelDashes (DashIndex)
+    int	DashIndex;
+ {
+    register struct SelRec	* sel_ptr;
+    register struct ObjRec	* obj_ptr;
+    int				changed = FALSE;
+ 
+    if (topSel == NULL)
+    {
+       curDash = DashIndex;
+       ShowLineWidth ();
+       return;
+    }
+ 
+    for (sel_ptr = botSel; sel_ptr != NULL; sel_ptr = sel_ptr->prev)
+    {
+       obj_ptr = sel_ptr->obj;
+       switch (obj_ptr->type)
+       {
+          case OBJ_POLY:
+             if (obj_ptr->detail.p->dash != DashIndex)
+             {
+                obj_ptr->detail.p->dash = DashIndex;
+                changed = TRUE;
+             }
+             break;
+          case OBJ_BOX:
+             if (obj_ptr->detail.b->dash != DashIndex)
+             {
+                obj_ptr->detail.b->dash = DashIndex;
+                changed = TRUE;
+             }
+             break;
+          case OBJ_OVAL:
+             if (obj_ptr->detail.o->dash != DashIndex)
+             {
+                obj_ptr->detail.o->dash = DashIndex;
+                changed = TRUE;
+             }
+             break;
+          case OBJ_POLYGON:
+             if (obj_ptr->detail.g->dash != DashIndex)
+             {
+                obj_ptr->detail.g->dash = DashIndex;
+                changed = TRUE;
+             }
+             break;
+ 
+          case OBJ_GROUP:
+          case OBJ_SYM:
+             if (ChangeObjDashes (obj_ptr->detail.r->last, DashIndex))
+                changed = TRUE;
+             break;
+       }
+    }
+ 
+    if (changed)
+    {
+       SetFileModified (TRUE);
+       HighLightReverse ();
+       RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
+             selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
+       HighLightForward ();
+    }
+ }
+ 
  void LineStyleMenu (X, Y)
     int	X, Y;
***************
*** 518,521 ****
--- 634,645 ----
           fore_colors, lineStylePixmap, SINGLECOLOR);
     if (index == INVALID) return;
+ /* DefaultColorArrays (MAXLINEWIDTHS+MAXLINETYPES+MAXDASHES+MAXLINESTYLES, */
+ /*       &fore_colors, &valid); */
+ /* cfree (valid); */
+ /* index = PxMpMenuLoop (X, Y, menuImageW, menuImageH, */
+ /*       MAXLINEWIDTHS+MAXLINETYPES+MAXDASHES+MAXLINESTYLES, 1, */
+ /*       MAXLINEWIDTHS+MAXLINETYPES+MAXDASHES+MAXLINESTYLES, */
+ /*       fore_colors, lineStylePixmap, SINGLECOLOR); */
+ /* if (index == INVALID) return; */
  
     if (index < MAXLINEWIDTHS)
***************
*** 523,526 ****
--- 647,654 ----
     else if (index < MAXLINEWIDTHS+MAXLINETYPES)
        ChangeAllSelLineType (index - MAXLINEWIDTHS);
+ /* else if (index < MAXLINEWIDTHS+MAXLINETYPES+MAXDASHES) */
+ /*    ChangeAllSelDashes (index - MAXLINEWIDTHS - MAXLINETYPES); */
+ /* else */
+ /*    ChangeAllSelLineStyle (index - MAXLINEWIDTHS - MAXLINETYPES - MAXDASHES); */
     else
        ChangeAllSelLineStyle (index - MAXLINEWIDTHS - MAXLINETYPES);
*** poly.c.orig	Sat Oct 27 17:49:47 1990
--- poly.c	Sat Oct 27 17:49:49 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/poly.c,v 1.6 90/08/13 09:23:49 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/poly.c,v 1.7 90/10/27 15:10:15 william Exp $";
  #endif
  
*** polygon.c.orig	Sat Oct 27 17:49:59 1990
--- polygon.c	Sat Oct 27 17:50:01 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/polygon.c,v 1.5 90/08/13 09:23:36 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/polygon.c,v 1.6 90/10/27 15:10:32 william Exp $";
  #endif
  
*** raster.c.orig	Sat Oct 27 17:50:07 1990
--- raster.c	Sat Oct 27 17:50:08 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/raster.c,v 1.5 90/07/16 10:51:23 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/raster.c,v 1.7 90/10/27 16:09:36 william Exp $";
  #endif
  
***************
*** 78,81 ****
--- 78,86 ----
  #include "bitmaps/ls3.bm"
  
+ #include "bitmaps/ld0.bm"
+ #include "bitmaps/ld1.bm"
+ #include "bitmaps/ld2.bm"
+ #include "bitmaps/ld3.bm"
+ 
  #include "bitmaps/lw0s.bm"
  #include "bitmaps/lw1s.bm"
***************
*** 94,97 ****
--- 99,107 ----
  #include "bitmaps/ls3s.bm"
  
+ #include "bitmaps/ld0s.bm"
+ #include "bitmaps/ld1s.bm"
+ #include "bitmaps/ld2s.bm"
+ #include "bitmaps/ld3s.bm"
+ 
  #include "bitmaps/printer.bm"
  #include "bitmaps/latex.bm"
***************
*** 109,113 ****
  Pixmap	lineWidthPixmap[MAXLINEWIDTHS];
  Pixmap	lineTypePixmap[MAXLINETYPES];
! Pixmap	lineStylePixmap[MAXLINEWIDTHS+MAXLINETYPES+MAXLINESTYLES];
  Pixmap	justPixmap[MAXJUSTS];
  Pixmap	alignHoriPixmap[MAXALIGNS];
--- 119,124 ----
  Pixmap	lineWidthPixmap[MAXLINEWIDTHS];
  Pixmap	lineTypePixmap[MAXLINETYPES];
! Pixmap	dashPixmap[MAXDASHES];
! Pixmap	lineStylePixmap[MAXLINEWIDTHS+MAXLINETYPES+MAXDASHES+MAXLINESTYLES];
  Pixmap	justPixmap[MAXJUSTS];
  Pixmap	alignHoriPixmap[MAXALIGNS];
***************
*** 117,125 ****
  Pixmap	shortLineTypePixmap[MAXLINETYPES];
  Pixmap	shortLineStylePixmap[MAXLINESTYLES];
  
- char	* patData[MAXPATTERNS+1];
- 
  int	pat_w[MAXPATTERNS+1], pat_h[MAXPATTERNS+1];
  
  void InitPattern ()
  {
--- 128,139 ----
  Pixmap	shortLineTypePixmap[MAXLINETYPES];
  Pixmap	shortLineStylePixmap[MAXLINESTYLES];
+ Pixmap	shortDashPixmap[MAXDASHES];
  
  int	pat_w[MAXPATTERNS+1], pat_h[MAXPATTERNS+1];
+ int	dashListLength[MAXDASHES] = { 0, 2, 2, 4 };
+ char	* dashList[MAXDASHES] = {"","\004\004","\006\002","\012\002\002\002"};
  
+ static char	* patData[MAXPATTERNS+1];
+ 
  void InitPattern ()
  {
***************
*** 224,227 ****
--- 238,250 ----
           lt1_bits, lt1_width, lt1_height);
  
+ /* dashPixmap[0] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld0_bits, ld0_width, ld0_height); */
+ /* dashPixmap[1] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld1_bits, ld1_width, ld1_height); */
+ /* dashPixmap[2] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld2_bits, ld2_width, ld2_height); */
+ /* dashPixmap[3] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld3_bits, ld3_width, ld3_height); */
+ 
     lineStylePixmap[0] = XCreateBitmapFromData (mainDisplay, mainWindow,
           lw0_bits, lw0_width, lw0_height);
***************
*** 244,247 ****
--- 267,288 ----
           lt1_bits, lt1_width, lt1_height);
  
+ /* lineStylePixmap[9] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld0_bits, ld0_width, ld0_height); */
+ /* lineStylePixmap[10] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld1_bits, ld1_width, ld1_height); */
+ /* lineStylePixmap[11] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld2_bits, ld2_width, ld2_height); */
+ /* lineStylePixmap[12] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld3_bits, ld3_width, ld3_height); */
+ 
+ /* lineStylePixmap[13] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ls0_bits, ls0_width, ls0_height); */
+ /* lineStylePixmap[14] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ls1_bits, ls1_width, ls1_height); */
+ /* lineStylePixmap[15] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ls2_bits, ls2_width, ls2_height); */
+ /* lineStylePixmap[16] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ls3_bits, ls3_width, ls3_height); */
+ 
     lineStylePixmap[9] = XCreateBitmapFromData (mainDisplay, mainWindow,
           ls0_bits, ls0_width, ls0_height);
***************
*** 272,275 ****
--- 313,325 ----
           lt1s_bits, lt1s_width, lt1s_height);
  
+ /* shortDashPixmap[0] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld0s_bits, ld0s_width, ld0s_height); */
+ /* shortDashPixmap[1] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld1s_bits, ld1s_width, ld1s_height); */
+ /* shortDashPixmap[2] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld2s_bits, ld2s_width, ld2s_height); */
+ /* shortDashPixmap[3] = XCreateBitmapFromData (mainDisplay, mainWindow, */
+ /*       ld3s_bits, ld3s_width, ld3s_height); */
+ 
     shortLineWidthPixmap[0] = XCreateBitmapFromData (mainDisplay, mainWindow,
           lw0s_bits, lw0s_width, lw0s_height);
***************
*** 329,332 ****
--- 379,384 ----
     for (i = 0; i < MAXLINETYPES; i++)
        XFreePixmap (mainDisplay, lineTypePixmap[i]);
+ /* for (i = 0; i < MAXDASHES; i++) */
+ /*    XFreePixmap (mainDisplay, dashPixmap[i]); */
     for (i = 0; i < MAXJUSTS; i++) XFreePixmap (mainDisplay, justPixmap[i]);
     XFreePixmap (mainDisplay, alignHoriPixmap[0]);
***************
*** 343,346 ****
--- 395,400 ----
     for (i = 0; i < MAXLINESTYLES; i++)
        XFreePixmap (mainDisplay, shortLineStylePixmap[i]);
+ /* for (i = 0; i < MAXDASHES; i++) */
+ /*    XFreePixmap (mainDisplay, shortDashPixmap[i]); */
  
     XFreeGC (mainDisplay, rasterGC);
*** setup.c.orig	Sat Oct 27 17:50:15 1990
--- setup.c	Sat Oct 27 17:50:16 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/setup.c,v 1.12 90/08/17 09:32:53 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/setup.c,v 1.14 90/10/22 10:21:53 william Exp $";
  #endif
  
***************
*** 25,28 ****
--- 25,29 ----
  #include "ruler.e"
  #include "scroll.e"
+ #include "stk.e"
  
  extern	char	* getenv ();
***************
*** 110,115 ****
  int	reverseVideo = FALSE;
  
! char	drawPath[255];
  
  int	initDrawWinW, initDrawWinH;
  
--- 111,121 ----
  int	reverseVideo = FALSE;
  
! char	drawPath[MAXPATHLENGTH];
! char	bootDir[MAXPATHLENGTH];
! char	homeDir[MAXPATHLENGTH];
  
+ int	symPathNumEntries = INVALID;
+ char	* * symPath;
+ 
  int	initDrawWinW, initDrawWinH;
  
***************
*** 233,236 ****
--- 239,258 ----
           strcpy (drawPath, c_ptr);
  
+    if ((c_ptr = getenv ("HOME")) == NULL)
+       strcpy (homeDir, "/");
+    else
+       if (strlen (c_ptr) >= MAXPATHLENGTH-1)
+          strcpy (homeDir, "/");
+       else
+          strcpy (homeDir, c_ptr);
+ 
+    if ((c_ptr = getenv ("PWD")) == NULL)
+       strcpy (bootDir, ".");
+    else
+       if (strlen (c_ptr) >= MAXPATHLENGTH-1)
+          strcpy (bootDir, ".");
+       else
+          strcpy (bootDir, c_ptr);
+ 
     sizehints.flags = PPosition | PSize | PMinSize;
     sizehints.x = 0;
***************
*** 305,308 ****
--- 327,331 ----
     InitMenu ();
     InitNames ();
+    InitStk ();
  
     if ((titleWindow = XCreateSimpleWindow (mainDisplay, mainWindow, 0, 0,
*** special.c.orig	Sat Oct 27 17:50:22 1990
--- special.c	Sat Oct 27 17:50:23 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/special.c,v 1.10 90/08/17 13:40:34 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/special.c,v 1.13 90/10/25 14:57:35 william Exp $";
  #endif
  
***************
*** 174,183 ****
  void Instantiate ()
  {
!    char			file_name[MAXPATHLENGTH], sym_name[MAXPATHLENGTH], full_name[MAXPATHLENGTH];
     struct ObjRec	* obj_ptr;
     FILE			* fp;
  
!    if (SelectFileName ("sym", "PLEASE SELECT A SYMBOL TO INSTANTIATE ...",
!          sym_name) == INVALID) return;
  
     TieLooseEnds ();
--- 174,183 ----
  void Instantiate ()
  {
!    char			file_name[MAXPATHLENGTH], full_name[MAXPATHLENGTH];
!    char			sym_name[MAXPATHLENGTH], path_name[MAXPATHLENGTH];
     struct ObjRec	* obj_ptr;
     FILE			* fp;
  
!    if (SelectSymbolName (sym_name, path_name) == INVALID) return;
  
     TieLooseEnds ();
***************
*** 184,192 ****
     SetCurChoice (NOTHING);
  
!    sprintf (file_name, "%s.sym", sym_name);
!    strcpy (full_name, curDomainName);
!    if (*curDomainName != '\0') strcat (full_name, "/");
!    strcat (full_name, file_name);
!    if ((fp = fopen (full_name, "r")) == NULL)
     { printf ("Can not open %s\n", file_name); return; }
  
--- 184,189 ----
     SetCurChoice (NOTHING);
  
!    sprintf (file_name, "%s/%s.sym", path_name, sym_name);
!    if ((fp = fopen (file_name, "r")) == NULL)
     { printf ("Can not open %s\n", file_name); return; }
  
***************
*** 281,285 ****
  {
     char 		icon_name[MAXPATHLENGTH], file_name[MAXPATHLENGTH];
!    char 		s[MAXPATHLENGTH];
     FILE			* fp;
     struct ObjRec	* saved_obj_ptr;
--- 278,282 ----
  {
     char 		icon_name[MAXPATHLENGTH], file_name[MAXPATHLENGTH];
!    char 		s[MAXPATHLENGTH], icon_full_name[MAXPATHLENGTH];
     FILE			* fp;
     struct ObjRec	* saved_obj_ptr;
***************
*** 304,310 ****
           }
           else if (strcmp (&icon_name[len-4], ".sym") != 0)
!             strcat (icon_name, ".sym");
  
!          if (strlen (icon_name) == 4)
           {
              Msg ("No file name specified.  File not saved.");
--- 301,310 ----
           }
           else if (strcmp (&icon_name[len-4], ".sym") != 0)
!          {
!             strcpy (icon_full_name, icon_name);
!             strcat (icon_full_name, ".sym");
!          }
  
!          if (strlen (icon_full_name) == 4)
           {
              Msg ("No file name specified.  File not saved.");
***************
*** 313,322 ****
        }
        else
!          strcat (icon_name, ".sym");
  
        if (*curDomainName != '\0')
!          sprintf (file_name, "%s/%s", curDomainName, icon_name);
        else
!          sprintf (file_name, "%s", icon_name);
        if (!OkayToCreateFile (file_name)) return;
        if ((fp = fopen (file_name, "w")) == NULL)
--- 313,325 ----
        }
        else
!       {
!          strcpy (icon_full_name, icon_name);
!          strcat (icon_full_name, ".sym");
!       }
  
        if (*curDomainName != '\0')
!          sprintf (file_name, "%s/%s", curDomainName, icon_full_name);
        else
!          sprintf (file_name, "%s", icon_full_name);
        if (!OkayToCreateFile (file_name)) return;
        if ((fp = fopen (file_name, "w")) == NULL)
*** stk.c.orig	Sat Oct 27 17:50:28 1990
--- stk.c	Sat Oct 27 17:50:29 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/stk.c,v 1.6 90/08/15 16:00:13 william Exp $";
  #endif
  
--- 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
  
***************
*** 45,48 ****
--- 45,53 ----
  }
  
+ void InitStk ()
+ {
+    curSymDir[0] = '\0';
+ }
+ 
  void PushIcon ()
  {
***************
*** 49,54 ****
     struct StkRec	* stk_ptr;
     struct ObjRec	* obj_ptr;
     char			file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
-    char			full_name[MAXPATHLENGTH];
     FILE			* fp;
  
--- 54,59 ----
     struct StkRec	* stk_ptr;
     struct ObjRec	* obj_ptr;
+    char			sym_name[MAXPATHLENGTH], path_name[MAXPATHLENGTH];
     char			file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
     FILE			* fp;
  
***************
*** 59,68 ****
     }
  
!    sprintf (file_name, "%s.sym", topSel->obj->detail.r->s);
!    strcpy (full_name, curDomainName);
!    if (*curDomainName != '\0') strcat (full_name, "/");
!    strcat (full_name, file_name);
  
!    if ((fp = fopen (full_name, "r")) == NULL)
     {
        sprintf (s, "Can not open '%s', icon not pushed into.", file_name);
--- 64,79 ----
     }
  
!    strcpy (sym_name, topSel->obj->detail.r->s);
!    if (!GetSymbolPath (sym_name, path_name))
!    {
!       sprintf (s, "Can not find '%s.sym' in %s", sym_name, curDomainPath);
!       Msg (s);
!       return;
!    }
  
!    strcat (sym_name, ".sym");
!    sprintf (file_name, "%s/%s", path_name, sym_name);
! 
!    if ((fp = fopen (file_name, "r")) == NULL)
     {
        sprintf (s, "Can not open '%s', icon not pushed into.", file_name);
***************
*** 101,107 ****
  
     topObj = botObj = NULL;
     if (stk_ptr->name_valid = curFileDefined)
!       strcpy (stk_ptr->name, curFileName);
     strcpy (stk_ptr->domain, curDomainName);
     topStk = stk_ptr;
  
--- 112,122 ----
  
     topObj = botObj = NULL;
+ 
+    strcpy (stk_ptr->dir, curDir);
     if (stk_ptr->name_valid = curFileDefined)
!       strcat (stk_ptr->name, curFileName);
!    strcpy (stk_ptr->sym_dir, curSymDir);
     strcpy (stk_ptr->domain, curDomainName);
+ 
     topStk = stk_ptr;
  
***************
*** 127,131 ****
  
     fclose (fp);
!    strcpy (curFileName, file_name);
     curFileDefined = TRUE;
  
--- 142,147 ----
  
     fclose (fp);
!    strcpy (curFileName, sym_name);
!    strcpy (curSymDir, path_name);
     curFileDefined = TRUE;
  
***************
*** 179,186 ****
     topObj = topStk->first;
     botObj = topStk->last;
     if (curFileDefined = topStk->name_valid)
     {
        strcpy (curFileName, topStk->name);
!       sprintf (dummy, "Poping back to '%s'.", curFileName);
        Msg (dummy);
     }
--- 195,207 ----
     topObj = topStk->first;
     botObj = topStk->last;
+    strcpy (curDomainName, topStk->domain);
+    strcpy (curSymDir, topStk->sym_dir);
     if (curFileDefined = topStk->name_valid)
     {
        strcpy (curFileName, topStk->name);
!       if (*curSymDir == '\0')
!          sprintf (dummy, "Poping back to '%s/%s'.", topStk->dir, curFileName);
!       else
!          sprintf (dummy, "Poping back to '%s/%s'.", curSymDir, curFileName);
        Msg (dummy);
     }
***************
*** 190,194 ****
        Msg (dummy);
     }
!    strcpy (curDomainName, topStk->domain);
     topSel = botSel = (struct SelRec *) calloc (1, sizeof(struct SelRec));
     topSel->next = NULL;
--- 211,222 ----
        Msg (dummy);
     }
!    if (strcmp (curDir, topStk->dir) != 0)
!    {
!       strcpy (curDir, topStk->dir);
!       UpdateDirInfo ();
!    }
!    else
!       strcpy (curDir, topStk->dir);
! 
     topSel = botSel = (struct SelRec *) calloc (1, sizeof(struct SelRec));
     topSel->next = NULL;
***************
*** 222,224 ****
--- 250,253 ----
        cfree (topStk);
     }
+    curSymDir[0] = '\0';
  }
*** tgif.c.orig	Sat Oct 27 17:50:34 1990
--- tgif.c	Sat Oct 27 17:50:35 1990
***************
*** 6,10 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/tgif.c,v 1.8 90/08/21 15:52:54 william Exp $";
  #endif
  
--- 6,10 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/tgif.c,v 1.10 90/08/30 13:32:13 william Exp $";
  #endif
  
***************
*** 91,98 ****
     while (TRUE)
     {
-       DeallocStrings (&func_strp,&sp[0],&sp[1],&sp[2],&sp[3],&sp[4],&sp[5]);
- 
        strcpy (s, func_strp);
        s[4] = '\0';
        if (strcmp (s, "Quit") == 0)
        {
--- 91,99 ----
     while (TRUE)
     {
        strcpy (s, func_strp);
        s[4] = '\0';
+ 
+       DeallocStrings (&func_strp,&sp[0],&sp[1],&sp[2],&sp[3],&sp[4],&sp[5]);
+ 
        if (strcmp (s, "Quit") == 0)
        {
*** version.c.orig	Sat Oct 27 17:50:38 1990
--- version.c	Sat Oct 27 17:50:39 1990
***************
*** 6,11 ****
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/version.c,v 1.19 90/08/27 10:32:54 william Exp $";
  #endif
  
! char	* version_string = "1.15";
--- 6,11 ----
  #ifndef lint
  static char RCSid[] =
!       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/version.c,v 1.20 90/10/27 15:40:59 william Exp $";
  #endif
  
! char	* version_string = "1.16";
*** choice.e.orig	Sat Oct 27 17:50:43 1990
--- choice.e	Sat Oct 27 17:50:44 1990
***************
*** 4,8 ****
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/choice.e,v 1.2 90/08/14 18:04:06 william Exp $
   */
  
--- 4,8 ----
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/choice.e,v 1.4 90/10/26 18:35:33 william Exp $
   */
  
*** color.e.orig	Sat Oct 27 17:50:49 1990
--- color.e	Sat Oct 27 17:50:49 1990
***************
*** 4,8 ****
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/color.e,v 1.6 90/07/15 17:42:49 william Exp $
   */
  
--- 4,8 ----
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/color.e,v 1.9 90/10/27 16:29:44 william Exp $
   */
  
***************
*** 13,16 ****
--- 13,19 ----
  extern int	* colorPixels;
  extern int	* xorColorPixels;
+ extern XColor	* tgifColors;
+ extern int	maxRGB;
+ extern int	colorDump;
  
  extern void	DefaultColorArrays ();
*** names.e.orig	Sat Oct 27 17:50:55 1990
--- names.e	Sat Oct 27 17:50:55 1990
***************
*** 4,14 ****
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.e,v 1.1 90/04/01 22:17:11 william Exp $
   */
  
  extern char	curDomainName[];
  
  extern void	InitNames ();
  extern void	CleanUpNames ();
  extern int	SelectFileName ();
  extern int	SelectDomain ();
--- 4,23 ----
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.e,v 1.12 90/10/25 14:58:59 william Exp $
   */
  
  extern char	curDomainName[];
+ extern char	curDomainPath[];
+ extern char	curDir[];
+ extern char	curSymDir[];
  
+ extern void	ParseSymPath ();
  extern void	InitNames ();
+ extern void	UpdateSymInfo ();
+ extern void	UpdateDirInfo ();
  extern void	CleanUpNames ();
  extern int	SelectFileName ();
+ extern int	SelectSymbolName ();
  extern int	SelectDomain ();
+ extern void	SetCurDir ();
+ extern int	GetSymbolPath ();
*** pattern.e.orig	Sat Oct 27 17:50:59 1990
--- pattern.e	Sat Oct 27 17:51:00 1990
***************
*** 4,15 ****
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/pattern.e,v 1.3 90/07/11 21:25:59 william Exp $
   */
  
! extern int     objFill;
! extern int     lineStyle;
! extern int     lineWidth;
! extern int     penPat;
! extern int     curSpline;
  
  extern void	ChangeAllSelFill ();
--- 4,16 ----
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/pattern.e,v 1.4 90/10/26 18:33:32 william Exp $
   */
  
! extern int	objFill;
! extern int	lineStyle;
! extern int	lineWidth;
! extern int	penPat;
! extern int	curSpline;
! extern int	curDash;
  
  extern void	ChangeAllSelFill ();
***************
*** 17,20 ****
--- 18,22 ----
  extern void	ChangeAllSelLineType ();
  extern void	ChangeAllSelLineWidth ();
+ extern void	ChangeAllSelDashes ();
  extern void	ChangeAllSelPen ();
  extern void	ToggleAllSelLineType ();
*** raster.e.orig	Sat Oct 27 17:51:04 1990
--- raster.e	Sat Oct 27 17:51:05 1990
***************
*** 4,8 ****
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/raster.e,v 1.2 90/07/16 09:10:17 william Exp $
   */
  
--- 4,8 ----
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/raster.e,v 1.4 90/10/26 18:17:39 william Exp $
   */
  
***************
*** 19,33 ****
  extern Pixmap	patPixmap[];
  extern Pixmap	lineWidthPixmap[];
- extern Pixmap	lineStylePixmap[];
  extern Pixmap	lineTypePixmap[];
  extern Pixmap	justPixmap[];
  extern Pixmap	alignHoriPixmap[];
  extern Pixmap	alignVertPixmap[];
- extern Pixmap	shortLineWidthPixmap[];
  extern Pixmap	whereToPrintPixmap[];
! extern Pixmap	shortLineTypePixmap[];
  extern Pixmap	shortLineStylePixmap[];
  
  extern int	pat_w[], pat_h[];
  
  extern void	InitPattern ();
--- 19,37 ----
  extern Pixmap	patPixmap[];
  extern Pixmap	lineWidthPixmap[];
  extern Pixmap	lineTypePixmap[];
+ extern Pixmap	dashPixmap[];
+ extern Pixmap	lineStylePixmap[];
  extern Pixmap	justPixmap[];
  extern Pixmap	alignHoriPixmap[];
  extern Pixmap	alignVertPixmap[];
  extern Pixmap	whereToPrintPixmap[];
! extern Pixmap	shortLineWidthPixmap[];
  extern Pixmap	shortLineStylePixmap[];
+ extern Pixmap	shortLineTypePixmap[];
+ extern Pixmap	shortDashPixmap[];
  
  extern int	pat_w[], pat_h[];
+ extern int	*dashListLength[];
+ extern char	*dashList[];
  
  extern void	InitPattern ();
*** setup.e.orig	Sat Oct 27 17:51:09 1990
--- setup.e	Sat Oct 27 17:51:10 1990
***************
*** 4,8 ****
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/setup.e,v 1.6 90/06/25 23:44:35 william Exp $
   */
  
--- 4,8 ----
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/setup.e,v 1.8 90/09/05 08:46:03 william Exp $
   */
  
***************
*** 74,77 ****
--- 74,82 ----
  
  extern char	drawPath[];
+ extern char	bootDir[];
+ extern char	homeDir[];
+ 
+ extern int	symPathNumEntries;
+ extern char	* * symPath;
  
  extern int	initDrawWinW;
*** stk.e.orig	Sat Oct 27 17:51:14 1990
--- stk.e	Sat Oct 27 17:51:15 1990
***************
*** 4,11 ****
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/stk.e,v 1.2 90/07/16 09:30:53 william Exp $
   */
  
  extern int	AncesterModified ();
  extern void	PushIcon ();
  extern void	PopIcon ();
--- 4,12 ----
   * Copyright (C) 1989, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/stk.e,v 1.6 90/10/23 10:41:48 william Exp $
   */
  
  extern int	AncesterModified ();
+ extern void	InitStk ();
  extern void	PushIcon ();
  extern void	PopIcon ();
*** const.h.orig	Sat Oct 27 17:51:19 1990
--- const.h	Sat Oct 27 17:51:20 1990
***************
*** 4,8 ****
   * Copyright (C) 1990, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/const.h,v 1.7 90/08/15 11:41:10 william Exp $
   */
  
--- 4,8 ----
   * Copyright (C) 1990, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/const.h,v 1.8 90/10/26 17:51:55 william Exp $
   */
  
***************
*** 90,93 ****
--- 90,95 ----
  
  #define MAXLINESTYLES 4
+ 
+ #define MAXDASHES 4
  
  #define NOCONT (FALSE)
*** types.h.orig	Sat Oct 27 17:51:25 1990
--- types.h	Sat Oct 27 17:51:26 1990
***************
*** 4,8 ****
   * Copyright (C) 1990, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/types.h,v 1.7 90/08/14 17:32:37 william Exp $
   */
  
--- 4,8 ----
   * Copyright (C) 1990, William Cheng.
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/types.h,v 1.13 90/10/26 17:45:15 william Exp $
   */
  
***************
*** 55,59 ****
     int			sn;	/* number of points in the spline polyline */
     XPoint		* svlist;
!    int			style, width, pen, curved, fill;
  } * PolyRecPtr;
  
--- 55,59 ----
     int			sn;	/* number of points in the spline polyline */
     XPoint		* svlist;
!    int			style, width, pen, curved, fill, dash;
  } * PolyRecPtr;
  
***************
*** 63,75 ****
     int		sn;	/* number of points in the spline polygon */
     XPoint	* svlist;
!    int		fill, width, pen, curved;
  } * PolygonRecPtr;
  
  typedef struct BoxRec {
!    int	fill, width, pen;
  } * BoxRecPtr;
  
  typedef struct OvalRec {
!    int	fill, width, pen;
  } * OvalRecPtr;
  
--- 63,75 ----
     int		sn;	/* number of points in the spline polygon */
     XPoint	* svlist;
!    int		fill, width, pen, curved, dash;
  } * PolygonRecPtr;
  
  typedef struct BoxRec {
!    int	fill, width, pen, dash;
  } * BoxRecPtr;
  
  typedef struct OvalRec {
!    int	fill, width, pen, dash;
  } * OvalRecPtr;
  
***************
*** 98,111 ****
     int			orig_x, orig_y, zoom, grid, grid_on;
     int			color, h_align, v_align, line_w, line_s;
!    int			fill, pen, just, font, f_style, f_size, f_dpi;
     char			name[MAXPATHLENGTH+1], domain[MAXPATHLENGTH+1];
  } * StkRecPtr;
- 
- typedef struct _DspItem {
-    char		s[MAXPATHLENGTH+1];
- } DspItem;
- 
- typedef struct _DspList {
-    char			itemstr[MAXPATHLENGTH+1];
-    struct _DspList	* next;
- } DspList;
--- 98,103 ----
     int			orig_x, orig_y, zoom, grid, grid_on;
     int			color, h_align, v_align, line_w, line_s;
!    int			fill, pen, dash, just, font, f_style, f_size, f_dpi;
     char			name[MAXPATHLENGTH+1], domain[MAXPATHLENGTH+1];
+    char			dir[MAXPATHLENGTH+1], sym_dir[MAXPATHLENGTH+1];
  } * StkRecPtr;
*** Makefile.noimake.orig	Sat Oct 27 17:51:31 1990
--- Makefile.noimake	Sat Oct 27 17:51:32 1990
***************
*** 4,8 ****
  # Copyright (C) 1990, William Cheng.
  #
! # @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Makefile.noimake,v 1.25 90/08/27 11:29:48 william Exp $
  #
  
--- 4,8 ----
  # Copyright (C) 1990, William Cheng.
  #
! # @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Makefile.noimake,v 1.26 90/10/27 15:44:10 william Exp $
  #
  
***************
*** 10,14 ****
  LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
  
! TGIFVERSION	= 1.15
  INSTALLDIR	= /u/tangram/bin
  
--- 10,14 ----
  LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
  
! TGIFVERSION	= 1.16
  INSTALLDIR	= /u/tangram/bin
  
***************
*** 46,49 ****
--- 46,51 ----
  	bitmaps/lw4.bm bitmaps/lw4s.bm bitmaps/lw5.bm bitmaps/lw5s.bm \
  	bitmaps/lw6.bm bitmaps/lw6s.bm \
+ 	bitmaps/ld0.bm bitmaps/ld0s.bm bitmaps/ld1.bm bitmaps/ld1s.bm \
+ 	bitmaps/ld2.bm bitmaps/ld2s.bm bitmaps/ld3.bm bitmaps/ld3s.bm \
  	bitmaps/oval.bm bitmaps/pat0.bm bitmaps/pat1.bm bitmaps/pat10.bm \
  	bitmaps/pat11.bm bitmaps/pat12.bm bitmaps/pat13.bm bitmaps/pat14.bm \
***************
*** 59,63 ****
  	bitmaps/leftarrow.bm
  
! CURSOR_BM = bitmaps/nullmask.bm bitmaps/text_cur_image.bm
  
  OBJS = tgif.o $(OBJ1)
--- 61,65 ----
  	bitmaps/leftarrow.bm
  
! CURSOR_BM = bitmaps/null.bm bitmaps/nullmask.bm bitmaps/text_cur_image.bm
  
  OBJS = tgif.o $(OBJ1)
***************
*** 141,146 ****
  msg.o:		const.h types.h font.e raster.e setup.e
  names.o:	const.h types.h $(NAMES_BM) \
! 		box.e button.e cursor.e font.e mainloop.e raster.e scroll.e \
! 		setup.e
  obj.o:		const.h types.h \
  		attr.e box.e group.e oval.e poly.e polygon.e setup.e spline.e \
--- 143,148 ----
  msg.o:		const.h types.h font.e raster.e setup.e
  names.o:	const.h types.h $(NAMES_BM) \
! 		box.e button.e cursor.e file.e font.e mainloop.e raster.e \
! 		scroll.e setup.e
  obj.o:		const.h types.h \
  		attr.e box.e group.e oval.e poly.e polygon.e setup.e spline.e \
***************
*** 172,176 ****
  setup.o:	const.h types.h \
  		choice.e color.e cursor.e drawing.e font.e mainloop.e menu.e \
! 		names.e raster.e ruler.e scroll.e
  spline.o:	const.h types.h \
  		poly.e raster.e rect.e setup.e
--- 174,178 ----
  setup.o:	const.h types.h \
  		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
*** Imakefile.orig	Sat Oct 27 17:51:36 1990
--- Imakefile	Sat Oct 27 17:51:37 1990
***************
*** 4,14 ****
  /**/# Copyright (C) 1990, William Cheng.
  /**/#
! /**/# @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Imakefile,v 1.28 90/08/27 11:29:39 william Exp $
  /**/#
  
! TGIFVERSION	= 1.15
  PROGRAMS	= tgif prtgif tgif2ps frontend11.o
  /**/#CDEBUGFLAGS= -g
! /**/#BINDIR	= /u/tangram/bin
  /**/#MANPATH	= /u/tangram/man
  /**/#TGIFDIR	= /u/tangram/lib/tgif
--- 4,14 ----
  /**/# Copyright (C) 1990, William Cheng.
  /**/#
! /**/# @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/Imakefile,v 1.29 90/10/27 15:42:31 william Exp $
  /**/#
  
! TGIFVERSION	= 1.16
  PROGRAMS	= tgif prtgif tgif2ps frontend11.o
  /**/#CDEBUGFLAGS= -g
! /**/#BINDIR	= /u/tangram/$(MACHINE)/bin
  /**/#MANPATH	= /u/tangram/man
  /**/#TGIFDIR	= /u/tangram/lib/tgif
***************
*** 38,41 ****
--- 38,42 ----
  OBJS2 = prtgif.o $(OBJ1)
  OBJS3 = tgif2ps.o
+ FRONTENDOBJS = frontend.o $(OBJ1)
  
  SRCS1 = .//**/*.c
***************
*** 47,51 ****
  ComplexProgramTarget_3(tgif2ps,,)
  
! NormalRelocatableTarget(frontend11,$(OBJ1))
  
  MakeDirectories(install,$(TGIFDIR))
--- 48,52 ----
  ComplexProgramTarget_3(tgif2ps,,)
  
! NormalRelocatableTarget(frontend11,$(FRONTENDOBJS))
  
  MakeDirectories(install,$(TGIFDIR))
*** tgif.man.orig	Sat Oct 27 17:51:46 1990
--- tgif.man	Sat Oct 27 17:51:48 1990
***************
*** 1,3 ****
! .\"@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/tgif.man,v 1.11 90/08/16 15:30:15 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.13 90/10/27 17:28:39 william Exp $
  .TH TGIF 1 "Version 1.13 and Above" "Tgif"
  .SH NAME
***************
*** 367,371 ****
  .I Tgif*MaxColors: NUMBER
  This specified the maximum number of colors.  Color0 through ColorMax,
! where Max is NUMBER-1 must all exist in .Xdefaults.
  .TP
  .I Tgif*DefaultColorIndex: NUMBER
--- 367,371 ----
  .I Tgif*MaxColors: NUMBER
  This specified the maximum number of colors.  Color0 through ColorMax,
! where Max is NUMBER-1, and they all must exist in .Xdefaults.
  .TP
  .I Tgif*DefaultColorIndex: NUMBER
***************
*** 385,388 ****
--- 385,401 ----
  between two clicked to be recognized as one double-click.
  Default is 300.
+ .TP
+ .I Tgif*MaxDomains: NUMBER
+ This specified the maximum number of domains.  Domain0 through DomainMax,
+ where Max is NUMBER-1, and they all must exist in .Xdefaults.
+ .TP
+ .I Tgif*Domain#: DOMAINSTRING
+ This specified the correspondance between the domain number and a domain name.
+ See the \fBENVIRONMENT\fR section to see how to specify a path associated
+ with a domain.
+ .TP
+ .I Tgif*DefaultDomain: NUMBER
+ This specified the default domain when tgif starts up.
+ Default is 0 if not specified.
  .SH ENVIRONMENT
  .TP
***************
*** 397,400 ****
--- 410,428 ----
  If it starts with a / character, absolute path is used; otherwise,
  the icon file is assumed to be $TGIFPATH/$TGIFICON.
+ .TP
+ .I TGIF_[Domain]
+ For each \fIDomain\fR name defined in the X defaults, \fITGIF_Domain\fR
+ specifies a search path for the symbol files.  Each search path
+ should have the same format as the \fIPATH\fR csh environment variable.
+ For example, to specify the symbol path for domain \fIDEFAULT\fR
+ to look for symbol files in the library directory /tmp/tgif/symbols
+ then in the current directory,
+ the following command should be executed in csh.
+ .br
+ .DS
+ setenv TGIF_DEFAULT /tmp/tgif/symbols:.
+ .br
+ .DE
+ .br
  .SH FILES
  $TGIFPATH/tgificon.obj
***************
*** 417,421 ****
  .SH SEE ALSO
  \fBlatex\fR(1L), \fBlpr\fR(1), \fBenv\fR(1), \fBX\fR(1), \fBtgif2ps\fR(1),
! \fBdvips\fR(1)
  .SH IDIOSYNCHRASIES
  When any of the ``escape to Prolog'' commands are accidentally
--- 445,449 ----
  .SH SEE ALSO
  \fBlatex\fR(1L), \fBlpr\fR(1), \fBenv\fR(1), \fBX\fR(1), \fBtgif2ps\fR(1),
! \fBdvips\fR(1), \fBcsh\fR(1)
  .SH IDIOSYNCHRASIES
  When any of the ``escape to Prolog'' commands are accidentally
***************
*** 432,439 ****
  settings are ignored.
  .SH BUGS
- The directory where tgif is started is considerd the root
- directory of the tgif session.  The user is not allowed to
- change directory beyond the root.
- .PP
  Text does not have a background fill pattern.
  .PP
--- 460,463 ----
*** README.orig	Sat Oct 27 17:51:52 1990
--- README	Sat Oct 27 17:51:53 1990
***************
*** 2,6 ****
   * Author:	William Chia-Wei Cheng (william@cs.ucla.edu)
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/README,v 1.3 90/05/25 14:34:11 william Exp $
   */
  
--- 2,6 ----
   * Author:	William Chia-Wei Cheng (william@cs.ucla.edu)
   *
!  * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/README,v 1.4 90/10/27 17:22:25 william Exp $
   */
  
***************
*** 22,28 ****
  	cp Makefile.noimake Makefile
  	make tgif
!    If you have imake, do the following, (note that the config directory
! 		should be set to wherever you can find Imake.tmpl)
! 	imake -DUseInstalled -I/usr/local/libdata/X11/config -s
  	make tgif
  
--- 22,34 ----
  	cp Makefile.noimake Makefile
  	make tgif
! 
!    If you have imake and xmkmf, do the following,
! 	xmkmf
! 	make tgif
! 
!    If you have imake but don't have xmkmf, do the following,
! 		(note that the config directory should be set to
! 		wherever you can find Imake.tmpl)
! 	imake -DUseInstalled -I/usr/local/libdata/X11/config
  	make tgif
  
---------------------------------> 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