william@CS.UCLA.EDU (William Cheng) (02/13/91)
Submitted-by: william@CS.UCLA.EDU (William Cheng) Posting-number: Volume 11, Issue 64 Archive-name: tgif/patch6.02 Patch-To: Volume 7, Issue 56-76 (original: tgif-1.2) Patch-To: Volume 8, Issue 46-48 (Patch1: tgif-1.2 => tgif-1.9) Patch-To: Volume 8, Issue 58-60 (Patch2: tgif-1.9 => tgif-1.12) Patch-To: Volume 8, Issue 87-89 (Patch3: tgif-1.12 => tgif-1.13) Patch-To: Volume 8, Issue 94 (Patch4: tgif-1.13 => tgif-1.14) Patch-To: Volume 8, Issue 95 (Patch5: tgif-1.14 => tgif-1.15) ---------------------------------> cut here <--------------------------------- *** file.c.orig Wed Dec 12 14:34:23 1990 --- file.c Wed Dec 12 14:34:30 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.43 90/11/10 13:51:37 william Exp $"; #endif *************** *** 46,52 **** #include "text.e" ! #define CUR_VERSION 8 #define START_HAVING_ATTRS 8 char curFileName[MAXPATHLENGTH]; int curFileDefined = FALSE; --- 46,54 ---- #include "text.e" ! #define CUR_VERSION 9 #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'; } *************** *** 104,108 **** fprintf (FP, "%1d,%1d,%1d,%1d,", curSpline, lineStyle, objFill, penPat); fprintf (FP, "%1d,%1d,%1d,%1d,", textJust, curFont, curStyle, curSize); ! fprintf (FP, "%1d).\n", curFontDPI); } --- 107,111 ---- fprintf (FP, "%1d,%1d,%1d,%1d,", curSpline, lineStyle, objFill, penPat); fprintf (FP, "%1d,%1d,%1d,%1d,", textJust, curFont, curStyle, curSize); ! fprintf (FP, "%1d,%1d).\n", curFontDPI, curDash); } *************** *** 184,188 **** { char new_file_name[MAXPATHLENGTH], s[MAXPATHLENGTH]; ! char new_full_name[MAXPATHLENGTH]; FILE * fp; int count = 0, len; --- 187,192 ---- { char new_file_name[MAXPATHLENGTH], s[MAXPATHLENGTH]; ! char new_full_name[MAXPATHLENGTH], tmp_str[MAXPATHLENGTH]; ! char name_without_ext[MAXPATHLENGTH]; FILE * fp; int count = 0, len; *************** *** 207,211 **** --- 211,223 ---- } else if (strcmp (&new_file_name[len-4], ".obj") != 0) + { + strcpy (name_without_ext, new_file_name); strcat (new_file_name, ".obj"); + } + else + { + strcpy (name_without_ext, new_file_name); + name_without_ext[len-4] = '\0'; + } if (strlen (new_file_name) == 4) *************** *** 216,220 **** --- 228,235 ---- } else + { + strcpy (name_without_ext, new_file_name); strcat (new_file_name, ".obj"); + } break; case 1: *************** *** 227,231 **** --- 242,254 ---- } else if (strcmp (&new_file_name[len-4], ".sym") != 0) + { + strcpy (name_without_ext, new_file_name); strcat (new_file_name, ".sym"); + } + else + { + strcpy (name_without_ext, new_file_name); + name_without_ext[len-4] = '\0'; + } if (strlen (new_file_name) == 4) *************** *** 236,240 **** --- 259,266 ---- } else + { + strcpy (name_without_ext, new_file_name); strcat (new_file_name, ".sym"); + } break; default: *************** *** 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; --- 269,276 ---- } ! if (*new_file_name == '/') ! strcat (new_full_name, new_file_name); ! else ! sprintf (new_full_name, "%s/%s", curDir, 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); --- 283,308 ---- } ! strcpy (tmp_str, curDir); ! SetCurDir (new_full_name); curFileDefined = TRUE; ! ! switch (count) ! { ! case 0: ! *curSymDir = '\0'; ! if ((strcmp (tmp_str, curDir) != 0) || (!NameInCurDir (curFileName))) ! UpdateDirInfo (); ! break; ! case 1: ! strcpy (curSymDir, curDir); ! if (!DirInSymPath (curDir)) UpdateSymInfo (); ! break; ! } ! ! 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; --- 356,367 ---- } ! if (strcmp (ext, "sym") == 0) ! sprintf (full_name, "%s/%s", curSymDir, curFileName); ! else if (strcmp (ext, "obj") == 0) ! sprintf (full_name, "%s/%s", curDir, 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); --- 368,372 ---- } ! sprintf (s, "Saving '%s' ...", full_name); Msg (s); *************** *** 330,334 **** fclose (fp); ! sprintf (s, "File '%s' saved.", curFileName); Msg (s); SetFileModified (FALSE); --- 374,378 ---- fclose (fp); ! sprintf (s, "File '%s' saved.", full_name); Msg (s); SetFileModified (FALSE); *************** *** 339,347 **** { register char * s = Str, * l = Left; ! while (*s != '\0' && *s != C) *l++ = *s++; if (*s == C) s++; *l = '\0'; return (s); } --- 383,403 ---- { register char * s = Str, * l = Left; + register int len = 0; ! while (*s != '\0' && *s != C) ! { ! *l++ = *s++; ! len++; ! } if (*s == C) s++; *l = '\0'; + + while (len >= 2 && *Left == '\'' && *(l-1) == '\'') + { + *(--l) = '\0'; + strcpy (Left, &Left[1]); + len -= 2; + } return (s); } *************** *** 402,405 **** --- 458,462 ---- curSpline = LT_STRAIGHT; curFontDPI = FONT_DPI_75; + curDash = 0; } else if (fileVersion <= 7) *************** *** 412,417 **** &curStyle, &curSize); curFontDPI = FONT_DPI_75; } ! else { sscanf (s, "%d , %d , %d , %d , %d , %d , %d , %d , %d , \ --- 469,475 ---- &curStyle, &curSize); curFontDPI = FONT_DPI_75; + curDash = 0; } ! else if (fileVersion <= 8) { sscanf (s, "%d , %d , %d , %d , %d , %d , %d , %d , %d , \ *************** *** 421,428 **** &lineStyle, &objFill, &penPat, &textJust, &curFont, &curStyle, &curSize, &curFontDPI); } if (colorIndex >= maxColors) { ! printf ("Can not find color `%s', use `%s' instead.\n", s, colorMenuItems[defaultColorIndex]); colorIndex = defaultColorIndex; --- 479,496 ---- &lineStyle, &objFill, &penPat, &textJust, &curFont, &curStyle, &curSize, &curFontDPI); + curDash = 0; } + else + { + sscanf (s, "%d , %d , %d , %d , %d , %d , %d , %d , %d , \ + %d , %d , %d , %d , %d , %d , %d , %d , %d , %d", + &drawOrigX, &drawOrigY, &zoomScale, &xyGrid, &gridOn, + &colorIndex, &horiAlign, &vertAlign, &lineWidth, &curSpline, + &lineStyle, &objFill, &penPat, &textJust, &curFont, + &curStyle, &curSize, &curFontDPI, &curDash); + } if (colorIndex >= maxColors) { ! printf ("Can not find color #%1d, use '%s' instead.\n", colorIndex, 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); ! } } --- 683,704 ---- 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); --- 707,719 ---- 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); *************** *** 717,732 **** struct ObjRec * obj_ptr; char file_name[MAXPATHLENGTH], s[MAXPATHLENGTH]; ! char full_name[MAXPATHLENGTH]; 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); --- 762,775 ---- struct ObjRec * obj_ptr; char file_name[MAXPATHLENGTH], s[MAXPATHLENGTH]; ! char full_name[MAXPATHLENGTH], saved_cur_dir[MAXPATHLENGTH]; FILE * fp; ! strcpy (saved_cur_dir, curDir); ! if (SelectFileName ("Please select a file to OPEN ...",file_name) == INVALID) ! return; strcat (file_name, ".obj"); ! if ((fp = fopen (file_name, "r")) == NULL) { sprintf (s, "Can not open '%s'.", file_name); *************** *** 737,740 **** --- 780,784 ---- TieLooseEnds (); CleanUpDrawingWindow (); + SetFileModified (FALSE); sprintf (s, "Loading '%s' ...", file_name); Msg (s); *************** *** 758,765 **** fclose (fp); ! strcpy (curFileName, file_name); curFileDefined = TRUE; ! SetFileModified (FALSE); sprintf (s, "Current file is '%s'.", file_name); Msg (s); --- 802,812 ---- fclose (fp); ! SetCurDir (file_name); ! *curSymDir = '\0'; curFileDefined = TRUE; ! if (strcmp (saved_cur_dir, curDir) != 0 && DirInSymPath (".")) ! UpdateSymInfo (); ! sprintf (s, "Current file is '%s'.", file_name); Msg (s); *************** *** 780,783 **** --- 827,831 ---- fprintf (FP, "gsave\n"); + fprintf (FP, " 0 setgray\n"); fprintf (FP, " [4 4] 0 setdash\n"); fprintf (FP, " newpath\n %1d %1d moveto\n", ltx, lty); *************** *** 903,910 **** { if (PRTGIF) ! printf ("Can not create $s, print aborted.", tmp_file); else { ! sprintf (tmp_str, "Can not create %s, print aborted.", tmp_file); Msg (tmp_str); } --- 951,958 ---- { if (PRTGIF) ! printf ("Can not create '%s', print aborted.", tmp_file); else { ! sprintf (tmp_str, "Can not create '%s', print aborted.", tmp_file); Msg (tmp_str); } *************** *** 912,916 **** } ! if (PRTGIF) printf ("Writing to %s ...\n", tmp_file); fprintf (fp, "%%!\n"); --- 960,964 ---- } ! if (PRTGIF) printf ("Writing to '%s' ...\n", tmp_file); fprintf (fp, "%%!\n"); *************** *** 920,927 **** { if (PRTGIF) ! printf ("Can not find %s, print aborted.\n", ps_file); else { ! sprintf (message, "Can not find %s, print aborted.", ps_file); Msg (message); } --- 968,975 ---- { if (PRTGIF) ! printf ("Can not find '%s', print aborted.\n", ps_file); else { ! sprintf (message, "Can not find '%s', print aborted.", ps_file); Msg (message); } *************** *** 1012,1018 **** } ! strcpy (ps_file, curDomainName); ! if (*curDomainName != '\0') strcat (ps_file, "/"); ! strcat (ps_file, curFileName); len = strlen (ps_file); for (i = len-1; ps_file[i] != '.'; i--) ; --- 1060,1064 ---- } ! sprintf (ps_file, "%s/%s", curDir, curFileName); len = strlen (ps_file); for (i = len-1; ps_file[i] != '.'; i--) ; *** font.c.orig Wed Dec 12 14:34:53 1990 --- font.c Wed Dec 12 14:34:56 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.13 90/11/03 12:30:45 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; *************** *** 337,345 **** register int dpi_index, font_index, size_index, style_index; { - /* if (font_index == FONT_SYM) */ - /* return (FIndex(font_index,size_index,0)); */ - /* else */ - /* return (FIndex(font_index,size_index,style_index)); */ - if (font_index == FONT_SYM) return (size_index+MAXFONTSIZES*(MAXFONTSTYLES*font_index) + --- 344,347 ---- *************** *** 352,359 **** void SetCanvasFont () { ! register int index; ! canvasFontIndex = index = FontIndex (curFontDPI, curFont, curSize, curStyle); ! if (!myFontInfo[index].valid) { --- 354,360 ---- void SetCanvasFont () { ! register int index, old_index; ! index = FontIndex (curFontDPI, curFont, curSize, curStyle); if (!myFontInfo[index].valid) { *************** *** 361,365 **** XLoadQueryFont (mainDisplay, fontNameStr[index])) == NULL) { ! printf ("Can not open %s. Abort.\n\n", fontNameStr[index]); exit (-1); } myFontInfo[index].valid = TRUE; --- 362,378 ---- XLoadQueryFont (mainDisplay, fontNameStr[index])) == NULL) { ! old_index = index; ! curFontDPI = (curFontDPI==FONT_DPI_75) ? FONT_DPI_100 : FONT_DPI_75; ! index = FontIndex (curFontDPI, curFont, curSize, curStyle); ! if ((myFontInfo[index].xfs = ! XLoadQueryFont (mainDisplay, fontNameStr[index])) == NULL) ! { ! printf ("Can not open '%s' nor\n\t'%s'! Tgif aborted!\n\n", ! fontNameStr[old_index], fontNameStr[index]); ! exit (-1); ! } ! printf ("Warning: can not open '%s' font,\n\tuse '%s' instead.\n", ! fontNameStr[old_index], fontNameStr[index]); ! SetFileModified (TRUE); } myFontInfo[index].valid = TRUE; *************** *** 366,369 **** --- 379,384 ---- } + canvasFontIndex = index; + canvasFontPtr = myFontInfo[index].xfs; canvasFontAsc = canvasFontPtr->max_bounds.ascent; *************** *** 382,404 **** { register int i; - pointSize = (curFontDPI==FONT_DPI_75) ? pointSize75 : pointSize100; - sizeMenuStr = (curFontDPI==FONT_DPI_75) ? sizeMenuStr75 : sizeMenuStr100; - 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; --- 397,451 ---- { register int i; + int ruler_index, default_index; + int old_ruler_index, old_default_index; for (i = 0; i < FONTTABLESIZE; i++) myFontInfo[i].valid = FALSE; ! curFont = FONT_COU; ! curStyle = STYLE_NR; ! curSize = 4; ! curFontDPI = FONT_DPI_75; ! default_index = FontIndex(curFontDPI, curFont, curSize, curStyle); ! if ((myFontInfo[default_index].xfs = ! XLoadQueryFont (mainDisplay, fontNameStr[default_index])) == NULL) ! { ! old_default_index = default_index; ! curSize = 2; ! curFontDPI = FONT_DPI_100; ! default_index = FontIndex(curFontDPI, curFont, curSize, curStyle); ! if ((myFontInfo[default_index].xfs = ! XLoadQueryFont (mainDisplay, fontNameStr[default_index])) == NULL) ! { ! printf ("Can not open '%s' nor\n\t'%s'! Tgif aborted!\n\n", ! fontNameStr[old_default_index], fontNameStr[default_index]); ! exit (-1); ! } ! } ! myFontInfo[default_index].valid = TRUE; ! ruler_index = FontIndex(FONT_DPI_75, curFont, 1, curStyle); ! if ((myFontInfo[ruler_index].xfs = ! XLoadQueryFont (mainDisplay, fontNameStr[ruler_index])) == NULL) ! { ! old_ruler_index = ruler_index; ! ruler_index = FontIndex(FONT_DPI_100, curFont, 0, curStyle); ! if ((myFontInfo[ruler_index].xfs = ! XLoadQueryFont (mainDisplay, fontNameStr[ruler_index])) == NULL) ! { ! printf ("Can not open '%s' nor\n\t'%s'! Tgif aborted!\n\n", ! fontNameStr[old_ruler_index], fontNameStr[ruler_index]); ! exit (-1); ! } ! } ! 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; *************** *** 406,414 **** 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; } --- 453,458 ---- rulerFontHeight = rulerFontAsc + rulerFontDes; ! pointSize = (curFontDPI==FONT_DPI_75) ? pointSize75 : pointSize100; ! sizeMenuStr = (curFontDPI==FONT_DPI_75) ? sizeMenuStr75 : sizeMenuStr100; } *** frontend.c.orig Wed Dec 12 14:35:00 1990 --- frontend.c Wed Dec 12 14:35:01 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; *** grid.c.orig Wed Dec 12 14:35:07 1990 --- grid.c Wed Dec 12 14:35:09 1990 *************** *** 6,10 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/grid.c,v 1.7 90/08/20 13:56:57 william Exp $"; #endif --- 6,10 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/grid.c,v 1.8 90/11/01 08:42:51 william Exp $"; #endif *************** *** 167,172 **** #define LAYOUT_SLIDELAND 10 #define LAYOUT_SLIDEPORT 11 ! #define LAYOUT_TO_LPR 12 ! #define LAYOUT_TO_TEXFIG 13 #define MAXLAYOUTMENUS 14 --- 167,172 ---- #define LAYOUT_SLIDELAND 10 #define LAYOUT_SLIDEPORT 11 ! #define LAYOUT_TOGGLE_WHERE_TO_PRINT 12 ! #define LAYOUT_TOGGLE_COLOR_PS 13 #define MAXLAYOUTMENUS 14 *************** *** 186,197 **** "SlidePort", "Printer", ! "LaTeX-Figure" }; #define MAX_LAYOUT_STR 13 /* longest string length in layoutMenuStr[] */ ! static char showGridStr[] = "ShowGrid #G"; ! static char hideGridStr[] = "HideGrid #G"; ! static char snapOnStr[] = "SnapOn ^#G"; ! static char snapOffStr[] = "SnapOff ^#G"; void IncGrid () --- 186,201 ---- "SlidePort", "Printer", ! "ColorPS" }; #define MAX_LAYOUT_STR 13 /* longest string length in layoutMenuStr[] */ ! static char showGridStr[] = "ShowGrid #G"; ! static char hideGridStr[] = "HideGrid #G"; ! static char snapOnStr[] = "SnapOn ^#G"; ! static char snapOffStr[] = "SnapOff ^#G"; ! static char printerStr[] = "Printer ^#X"; ! static char latexFigStr[] = "LaTeXFig ^#X"; ! static char bwPostScriptStr[] = "BlkWhtPS ^#K"; ! static char colorPostScriptStr[] = "ColorPS ^#K"; void IncGrid () *************** *** 237,240 **** --- 241,265 ---- } + void ToggleColorPostScript () + { + colorDump = !colorDump; + if (colorDump) + Msg ("PostScript file will print in color."); + else + Msg ("PostScript file will print in black-and-white."); + ShowWhereToPrint (); + } + + void ToggleWhereToPrint () + { + whereToPrint = !whereToPrint; + switch (whereToPrint) + { + case PRINTER: Msg ("Print device set to printer."); break; + case LATEX_FIG: Msg ("Print device set to LaTeX-Figure file."); break; + } + ShowWhereToPrint (); + } + void ZoomIn () { *************** *** 454,457 **** --- 479,490 ---- else strcpy (menu_strings[LAYOUT_SNAP], snapOnStr); + if (whereToPrint == PRINTER) + strcpy (menu_strings[LAYOUT_TOGGLE_WHERE_TO_PRINT], latexFigStr); + else + strcpy (menu_strings[LAYOUT_TOGGLE_WHERE_TO_PRINT], printerStr); + if (colorDump) + strcpy (menu_strings[LAYOUT_TOGGLE_COLOR_PS], bwPostScriptStr); + else + strcpy (menu_strings[LAYOUT_TOGGLE_COLOR_PS], colorPostScriptStr); DefaultColorArrays (MAXLAYOUTMENUS, &fore_colors, &valid); *************** *** 547,566 **** } break; ! case LAYOUT_TO_LPR: ! if (whereToPrint != PRINTER) ! { ! whereToPrint = PRINTER; ! ShowWhereToPrint (); ! Msg ("Print device set to printer."); ! } ! break; ! case LAYOUT_TO_TEXFIG: ! if (whereToPrint != LATEX_FIG) ! { ! whereToPrint = LATEX_FIG; ! ShowWhereToPrint (); ! Msg ("Print device set to LaTeX-Figure file."); ! } ! break; } } --- 580,585 ---- } break; ! case LAYOUT_TOGGLE_WHERE_TO_PRINT: ToggleWhereToPrint (); break; ! case LAYOUT_TOGGLE_COLOR_PS: ToggleColorPostScript (); break; } } *** mainloop.c.orig Wed Dec 12 14:35:17 1990 --- mainloop.c Wed Dec 12 14:35:19 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.22 90/11/03 12:42:48 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 *************** *** 51,58 **** char s[255]; ! strcpy (s, "xterm -bd red -e "); ! strcat (s, CmdName); ! strcat (s, " "); ! strcat (s, FileName); pid = fork (); if (pid == 0) --- 51,55 ---- char s[255]; ! sprintf (s, "xterm -bd red -e %s %s", CmdName, FileName); pid = fork (); if (pid == 0) *************** *** 150,155 **** { XEvent input, ev; ! char * c_ptr, file_name[256], s[256]; ! int shorthand_rc, draw_rc; struct ObjRec * obj_ptr; FILE * fp; --- 147,153 ---- { XEvent input, ev; ! char * c_ptr, file_name[MAXPATHLENGTH], s[MAXPATHLENGTH]; ! char full_name[MAXPATHLENGTH]; ! int shorthand_rc, draw_rc, len; struct ObjRec * obj_ptr; FILE * fp; *************** *** 183,190 **** if (FileName[0] != '\0') { ! sprintf (file_name, "%s.obj", FileName); if ((fp = fopen (file_name, "r")) == NULL) { ! sprintf (s, "CAN NOT OPEN %s.", file_name); Msg (s); } --- 181,193 ---- if (FileName[0] != '\0') { ! len = strlen (FileName); ! if (len >= 4 && strcmp (&FileName[len-4], ".obj") == 0) ! strcpy (file_name, FileName); ! else ! sprintf (file_name, "%s.obj", FileName); ! if ((fp = fopen (file_name, "r")) == NULL) { ! sprintf (s, "Can not open '%s'.", file_name); Msg (s); } *************** *** 199,203 **** fclose (fp); ! strcpy (curFileName, file_name); curFileDefined = TRUE; --- 202,213 ---- fclose (fp); ! ! if (*file_name == '/') ! strcat (full_name, file_name); ! else ! sprintf (full_name, "%s/%s", curDir, file_name); ! ! SetCurDir (full_name); ! *curSymDir = '\0'; curFileDefined = TRUE; *************** *** 207,210 **** --- 217,221 ---- } } + UpdateDirInfo (); } SaveDrawWinInfo (); *************** *** 544,551 **** MyFormat(attr_ptr->s); if (attr_ptr->nameshown) ! { ! strcpy (s, attr_ptr->name); ! strcat (s, attr_ptr->s); ! } else strcpy (s, attr_ptr->s); --- 555,559 ---- MyFormat(attr_ptr->s); if (attr_ptr->nameshown) ! sprintf (s, "%s%s", attr_ptr->name, attr_ptr->s); else strcpy (s, attr_ptr->s); *** menu.c.orig Wed Dec 12 14:35:31 1990 --- menu.c Wed Dec 12 14:35:33 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.15 90/11/01 13:21:34 william Exp $"; #endif *************** *** 42,46 **** static int savedZoomScale = 0, savedDrawOrigX = 0, savedDrawOrigY = 0; ! static int savedDrawWinW = 0, savedDrawWinH = 0; static GC textMenuGC; --- 42,46 ---- static int savedZoomScale = 0, savedDrawOrigX = 0, savedDrawOrigY = 0; ! static int savedDrawWinW = 0, savedDrawWinH = 0, savedFileModified = FALSE; static GC textMenuGC; *************** *** 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]"); *************** *** 625,628 **** --- 627,631 ---- savedDrawWinW = drawWinW; savedDrawWinH = drawWinH; + savedFileModified = fileModified; } *************** *** 639,642 **** --- 642,646 ---- drawWinW = savedDrawWinW; drawWinH = savedDrawWinH; + fileModified = savedFileModified; UpdDrawWinBBox (); XMapWindow (mainDisplay, mainWindow); *** move.c.orig Wed Dec 12 14:35:40 1990 --- move.c Wed Dec 12 14:35:42 1990 *************** *** 7,11 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/move.c,v 1.7 90/08/11 00:14:18 william Exp $"; #endif #include <stdio.h> --- 7,11 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/move.c,v 1.9 90/10/31 11:38:53 william Exp $"; #endif #include <stdio.h> *************** *** 207,211 **** case OBJ_BOX: case OBJ_TEXT: ! SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy); break; case OBJ_OVAL: --- 207,212 ---- case OBJ_BOX: case OBJ_TEXT: ! SelBox (drawWindow, revDefaultGC, ! ltx+dx, lty+dy, rbx+dx, rby+dy); break; case OBJ_OVAL: ---------------------------------> 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 -- Dan Heller ------------------------------------------------ O'Reilly && Associates Zyrcom Inc Senior Writer President argv@ora.com argv@zipcode.com