william@CS.UCLA.EDU (William Cheng) (02/13/91)
Submitted-by: william@CS.UCLA.EDU (William Cheng) Posting-number: Volume 11, Issue 67 Archive-name: tgif/patch6.05 Patch-To: tgif: Volume 7, Issue 56-76 (original: tgif-1.2) Patch-To: tgif: Volume 8, Issue 46-48 (Patch1: tgif-1.2 => tgif-1.9) Patch-To: tgif: Volume 8, Issue 58-60 (Patch2: tgif-1.9 => tgif-1.12) Patch-To: tgif: Volume 8, Issue 87-89 (Patch3: tgif-1.12 => tgif-1.13) Patch-To: tgif: Volume 8, Issue 94 (Patch4: tgif-1.13 => tgif-1.14) Patch-To: tgif: Volume 8, Issue 95 (Patch5: tgif-1.14 => tgif-1.15) ---------------------------------> cut here <--------------------------------- *** raster.c.orig Wed Dec 12 14:37:26 1990 --- raster.c Wed Dec 12 14:37:29 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.8 90/11/01 08:44:35 william Exp $"; #endif *************** *** 78,81 **** --- 78,87 ---- #include "bitmaps/ls3.bm" + #include "bitmaps/ld0.bm" + #include "bitmaps/ld1.bm" + #include "bitmaps/ld2.bm" + #include "bitmaps/ld3.bm" + #include "bitmaps/ld4.bm" + #include "bitmaps/lw0s.bm" #include "bitmaps/lw1s.bm" *************** *** 94,100 **** --- 100,119 ---- #include "bitmaps/ls3s.bm" + #include "bitmaps/ld0s.bm" + #include "bitmaps/ld1s.bm" + #include "bitmaps/ld2s.bm" + #include "bitmaps/ld3s.bm" + #include "bitmaps/ld4s.bm" + #include "bitmaps/printer.bm" #include "bitmaps/latex.bm" + #include "bitmaps/file.bm" + #include "bitmaps/special.bm" + #include "bitmaps/rotate_0.bm" + #include "bitmaps/rotate_90.bm" + #include "bitmaps/rotate_180.bm" + #include "bitmaps/rotate_270.bm" + GC rasterGC; *************** *** 109,113 **** Pixmap lineWidthPixmap[MAXLINEWIDTHS]; Pixmap lineTypePixmap[MAXLINETYPES]; ! Pixmap lineStylePixmap[MAXLINEWIDTHS+MAXLINETYPES+MAXLINESTYLES]; Pixmap justPixmap[MAXJUSTS]; Pixmap alignHoriPixmap[MAXALIGNS]; --- 128,133 ---- Pixmap lineWidthPixmap[MAXLINEWIDTHS]; Pixmap lineTypePixmap[MAXLINETYPES]; ! Pixmap dashPixmap[MAXDASHES]; ! Pixmap lineStylePixmap[MAXLINEWIDTHS+MAXLINETYPES+MAXDASHES+MAXLINESTYLES]; Pixmap justPixmap[MAXJUSTS]; Pixmap alignHoriPixmap[MAXALIGNS]; *************** *** 114,125 **** Pixmap alignVertPixmap[MAXALIGNS]; Pixmap shortLineWidthPixmap[MAXLINEWIDTHS]; Pixmap whereToPrintPixmap[2]; Pixmap shortLineTypePixmap[MAXLINETYPES]; Pixmap shortLineStylePixmap[MAXLINESTYLES]; - char * patData[MAXPATTERNS+1]; - int pat_w[MAXPATTERNS+1], pat_h[MAXPATTERNS+1]; void InitPattern () { --- 134,152 ---- Pixmap alignVertPixmap[MAXALIGNS]; Pixmap shortLineWidthPixmap[MAXLINEWIDTHS]; + Pixmap filePixmap; + Pixmap specialPixmap; + Pixmap rotatePixmap[4]; Pixmap whereToPrintPixmap[2]; Pixmap shortLineTypePixmap[MAXLINETYPES]; Pixmap shortLineStylePixmap[MAXLINESTYLES]; + Pixmap shortDashPixmap[MAXDASHES]; int pat_w[MAXPATTERNS+1], pat_h[MAXPATTERNS+1]; + int dashListLength[MAXDASHES] = { 0, 2, 2, 2, 4 }; + char * dashList[MAXDASHES] = + {"","\004\014","\010\010","\014\004","\024\004\004\004"}; + static char * patData[MAXPATTERNS+1]; + void InitPattern () { *************** *** 224,227 **** --- 251,265 ---- 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); + dashPixmap[4] = XCreateBitmapFromData (mainDisplay, mainWindow, + ld4_bits, ld4_width, ld4_height); + lineStylePixmap[0] = XCreateBitmapFromData (mainDisplay, mainWindow, lw0_bits, lw0_width, lw0_height); *************** *** 245,254 **** lineStylePixmap[9] = XCreateBitmapFromData (mainDisplay, mainWindow, ! ls0_bits, ls0_width, ls0_height); lineStylePixmap[10] = XCreateBitmapFromData (mainDisplay, mainWindow, ! ls1_bits, ls1_width, ls1_height); lineStylePixmap[11] = XCreateBitmapFromData (mainDisplay, mainWindow, ! ls2_bits, ls2_width, ls2_height); lineStylePixmap[12] = XCreateBitmapFromData (mainDisplay, mainWindow, ls3_bits, ls3_width, ls3_height); --- 283,303 ---- 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, + ld4_bits, ld4_width, ld4_height); + + lineStylePixmap[14] = XCreateBitmapFromData (mainDisplay, mainWindow, + ls0_bits, ls0_width, ls0_height); + lineStylePixmap[15] = XCreateBitmapFromData (mainDisplay, mainWindow, + ls1_bits, ls1_width, ls1_height); + lineStylePixmap[16] = XCreateBitmapFromData (mainDisplay, mainWindow, + ls2_bits, ls2_width, ls2_height); + lineStylePixmap[17] = XCreateBitmapFromData (mainDisplay, mainWindow, ls3_bits, ls3_width, ls3_height); *************** *** 262,265 **** --- 311,329 ---- ls3s_bits, ls3s_width, ls3s_height); + filePixmap = XCreateBitmapFromData (mainDisplay, mainWindow, + file_bits, file_width, file_height); + + specialPixmap = XCreateBitmapFromData (mainDisplay, mainWindow, + special_bits, special_width, special_height); + + rotatePixmap[0] = XCreateBitmapFromData (mainDisplay, mainWindow, + rotate_0_bits, rotate_0_width, rotate_0_height); + rotatePixmap[1] = XCreateBitmapFromData (mainDisplay, mainWindow, + rotate_90_bits, rotate_90_width, rotate_90_height); + rotatePixmap[2] = XCreateBitmapFromData (mainDisplay, mainWindow, + rotate_180_bits, rotate_180_width, rotate_180_height); + rotatePixmap[3] = XCreateBitmapFromData (mainDisplay, mainWindow, + rotate_270_bits, rotate_270_width, rotate_270_height); + whereToPrintPixmap[PRINTER] = XCreateBitmapFromData (mainDisplay, mainWindow, printer_bits, printer_width, printer_height); *************** *** 272,275 **** --- 336,350 ---- 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); + shortDashPixmap[4] = XCreateBitmapFromData (mainDisplay, mainWindow, + ld4s_bits, ld4s_width, ld4s_height); + shortLineWidthPixmap[0] = XCreateBitmapFromData (mainDisplay, mainWindow, lw0s_bits, lw0s_width, lw0s_height); *************** *** 304,308 **** { ShowMode (); ! ShowColor (); ShowHoriAlign (); ShowVertAlign (); --- 379,383 ---- { ShowMode (); ! ShowColor (FALSE); ShowHoriAlign (); ShowVertAlign (); *************** *** 309,316 **** ShowJust (); ShowCurFont (); ShowLineWidth (); - ShowWhereToPrint (); - ShowLineType (); ShowLineStyle (); ShowFill (); ShowPen (); --- 384,395 ---- ShowJust (); ShowCurFont (); + ShowRotate (); + ShowSpecial (); ShowLineWidth (); ShowLineStyle (); + ShowLineType (); + ShowDash (); + ShowWhereToPrint (); + ShowFile (); ShowFill (); ShowPen (); *************** *** 329,332 **** --- 408,413 ---- 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]); *************** *** 337,340 **** --- 418,425 ---- for (i = 0; i < MAXLINEWIDTHS; i++) XFreePixmap (mainDisplay, shortLineWidthPixmap[i]); + XFreePixmap (mainDisplay, filePixmap); + XFreePixmap (mainDisplay, specialPixmap); + for (i = 0; i < 4; i++) + XFreePixmap (mainDisplay, rotatePixmap[i]); for (i = 0; i < 2; i++) XFreePixmap (mainDisplay, whereToPrintPixmap[i]); *************** *** 343,346 **** --- 428,433 ---- for (i = 0; i < MAXLINESTYLES; i++) XFreePixmap (mainDisplay, shortLineStylePixmap[i]); + for (i = 0; i < MAXDASHES; i++) + XFreePixmap (mainDisplay, shortDashPixmap[i]); XFreeGC (mainDisplay, rasterGC); *** select.c.orig Wed Dec 12 14:37:41 1990 --- select.c Wed Dec 12 14:37:45 1990 *************** *** 6,10 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/select.c,v 1.7 90/07/27 14:37:59 william Exp $"; #endif --- 6,10 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/select.c,v 1.9 90/11/01 18:08:44 william Exp $"; #endif *************** *** 624,639 **** } ! void CopySelToCut () { ! register struct SelRec * sel_ptr, * top_cut_ptr, * bot_cut_ptr; ! struct SelRec * top_sel_ptr, * bot_sel_ptr; - if (topSel == NULL) return; - - JustDupSelObj (&top_sel_ptr, &bot_sel_ptr); - top_cut_ptr = (struct SelRec *) calloc (2, sizeof (struct SelRec)); bot_cut_ptr = &top_cut_ptr[1]; ! top_cut_ptr->next = top_sel_ptr; bot_cut_ptr->next = bot_sel_ptr; top_cut_ptr->prev = topCutSel; bot_cut_ptr->prev = botCutSel; topCutSel = top_cut_ptr; botCutSel = bot_cut_ptr; --- 624,635 ---- } ! void PushToCutBuffer (TopSelPtr, BotSelPtr) ! struct SelRec * TopSelPtr, * BotSelPtr; { ! register struct SelRec * top_cut_ptr, * bot_cut_ptr; top_cut_ptr = (struct SelRec *) calloc (2, sizeof (struct SelRec)); bot_cut_ptr = &top_cut_ptr[1]; ! top_cut_ptr->next = TopSelPtr; bot_cut_ptr->next = BotSelPtr; top_cut_ptr->prev = topCutSel; bot_cut_ptr->prev = botCutSel; topCutSel = top_cut_ptr; botCutSel = bot_cut_ptr; *************** *** 640,649 **** } ! void DelAllSelObj () { ! register struct SelRec * sel_ptr, * top_cut_ptr, * bot_cut_ptr; if (topSel == NULL) return; HighLightReverse (); tmpTopObj = tmpBotObj = NULL; --- 636,653 ---- } ! void CopySelToCut () { ! struct SelRec * top_sel_ptr, * bot_sel_ptr; if (topSel == NULL) return; + JustDupSelObj (&top_sel_ptr, &bot_sel_ptr); + PushToCutBuffer (top_sel_ptr, bot_sel_ptr); + } + + void DelAllSelObj () + { + if (topSel == NULL) return; + HighLightReverse (); tmpTopObj = tmpBotObj = NULL; *************** *** 650,658 **** BreakSel (); ! top_cut_ptr = (struct SelRec *) calloc (2, sizeof (struct SelRec)); ! bot_cut_ptr = &top_cut_ptr[1]; ! top_cut_ptr->next = topSel; bot_cut_ptr->next = botSel; ! top_cut_ptr->prev = topCutSel; bot_cut_ptr->prev = botCutSel; ! topCutSel = top_cut_ptr; botCutSel = bot_cut_ptr; topSel = botSel = NULL; --- 654,658 ---- BreakSel (); ! PushToCutBuffer (topSel, botSel); topSel = botSel = NULL; *** setup.c.orig Wed Dec 12 14:37:52 1990 --- setup.c Wed Dec 12 14:37:53 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.16 90/11/02 09:20:33 william Exp $"; #endif *************** *** 25,28 **** --- 25,29 ---- #include "ruler.e" #include "scroll.e" + #include "stk.e" extern char * getenv (); *************** *** 38,42 **** #define DRAW_WINDOW_W (5*PIX_PER_INCH) #define DRAW_WINDOW_H (5*PIX_PER_INCH) ! #define CHOICE_WINDOW_W (6*CHOICE_IMAGE_W) #define CHOICE_WINDOW_H (2*CHOICE_IMAGE_H) #define VSBAR_H (DRAW_WINDOW_H+RULER_W+2*BRDR_W) --- 39,43 ---- #define DRAW_WINDOW_W (5*PIX_PER_INCH) #define DRAW_WINDOW_H (5*PIX_PER_INCH) ! #define CHOICE_WINDOW_W (8*CHOICE_IMAGE_W) #define CHOICE_WINDOW_H (2*CHOICE_IMAGE_H) #define VSBAR_H (DRAW_WINDOW_H+RULER_W+2*BRDR_W) *************** *** 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,252 ---- 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 (getwd (bootDir) == NULL) strcpy (bootDir, "."); + sizehints.flags = PPosition | PSize | PMinSize; sizehints.x = 0; *************** *** 305,308 **** --- 321,325 ---- InitMenu (); InitNames (); + InitStk (); if ((titleWindow = XCreateSimpleWindow (mainDisplay, mainWindow, 0, 0, *** special.c.orig Wed Dec 12 14:38:01 1990 --- special.c Wed Dec 12 14:38:03 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.14 90/11/01 18:09:43 william Exp $"; #endif *************** *** 102,105 **** --- 102,127 ---- } + struct ObjRec * GetObjRepresentation (PathName, SymName) + char * PathName, * SymName; + { + char file_name[MAXPATHLENGTH]; + struct ObjRec * obj_ptr; + FILE * fp; + + sprintf (file_name, "%s/%s.sym", PathName, SymName); + if ((fp = fopen (file_name, "r")) == NULL) + { printf ("Can not open '%s'\n", file_name); return (NULL); } + + if ((obj_ptr = ReadSymbol (fp)) != NULL) + { + obj_ptr->id = objId++; + obj_ptr->dirty = FALSE; + strcpy (obj_ptr->detail.r->s, SymName); + AdjObjBBox (obj_ptr); + } + fclose (fp); + return (obj_ptr); + } + void PlaceTopObj () { *************** *** 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 (); --- 196,205 ---- 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; } --- 206,211 ---- 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; --- 300,304 ---- { 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."); --- 323,332 ---- } 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) --- 335,347 ---- } 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) *** spline.c.orig Wed Dec 12 14:38:14 1990 --- spline.c Wed Dec 12 14:38:16 1990 *************** *** 6,10 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/spline.c,v 1.3 90/07/16 10:58:15 william Exp $"; #endif --- 6,10 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/spline.c,v 1.5 90/11/01 08:41:00 william Exp $"; #endif *************** *** 164,170 **** static XPoint arrow_v[4]; ! void DrawSplinePolyObj (Win, XOff, YOff, Fill, Width, Pen, Pixel, PolyPtr) Window Win; ! int XOff, YOff, Fill, Width, Pen, Pixel; struct PolyRec * PolyPtr; { --- 164,170 ---- static XPoint arrow_v[4]; ! void DrawSplinePolyObj (Win, XOff, YOff, Fill, Width, Pen, Dash, Pixel, PolyPtr) Window Win; ! int XOff, YOff, Fill, Width, Pen, Dash, Pixel; struct PolyRec * PolyPtr; { *************** *** 199,205 **** values.stipple = patPixmap[Pen]; values.line_width = widthOfLine[Width] >> zoomScale; XChangeGC (mainDisplay, drawGC, ! GCForeground | GCFunction | GCFillStyle | GCStipple | GCLineWidth, ! &values); XDrawLines (mainDisplay, Win, drawGC, sv, sn, CoordModeOrigin); --- 199,213 ---- values.stipple = patPixmap[Pen]; values.line_width = widthOfLine[Width] >> zoomScale; + if (Dash != 0) + { + XSetDashes (mainDisplay, drawGC, 0, dashList[Dash], + dashListLength[Dash]); + values.line_style = LineOnOffDash; + } + else + values.line_style = LineSolid; XChangeGC (mainDisplay, drawGC, ! GCForeground | GCFunction | GCFillStyle | GCStipple | GCLineWidth | ! GCLineStyle, &values); XDrawLines (mainDisplay, Win, drawGC, sv, sn, CoordModeOrigin); *************** *** 280,286 **** } ! void DrawSplinePolygonObj (Win, XOff, YOff, Fill, Width, Pen, Pixel, PolygonPtr) Window Win; ! int XOff, YOff, Fill, Width, Pen, Pixel; struct PolygonRec * PolygonPtr; { --- 288,294 ---- } ! void DrawSplinePolygonObj (Win,XOff,YOff,Fill,Width,Pen,Dash,Pixel,PolygonPtr) Window Win; ! int XOff, YOff, Fill, Width, Pen, Dash, Pixel; struct PolygonRec * PolygonPtr; { *************** *** 308,314 **** values.stipple = patPixmap[Pen]; values.line_width = widthOfLine[Width] >> zoomScale; XChangeGC (mainDisplay, drawGC, ! GCForeground | GCFunction | GCFillStyle | GCStipple | GCLineWidth, ! &values); XDrawLines (mainDisplay, Win, drawGC, sv, sn, CoordModeOrigin); --- 316,330 ---- values.stipple = patPixmap[Pen]; values.line_width = widthOfLine[Width] >> zoomScale; + if (Dash != 0) + { + XSetDashes (mainDisplay, drawGC, 0, dashList[Dash], + dashListLength[Dash]); + values.line_style = LineOnOffDash; + } + else + values.line_style = LineSolid; XChangeGC (mainDisplay, drawGC, ! GCForeground | GCFunction | GCFillStyle | GCStipple | GCLineWidth | ! GCLineStyle, &values); XDrawLines (mainDisplay, Win, drawGC, sv, sn, CoordModeOrigin); *** stk.c.orig Wed Dec 12 14:38:22 1990 --- stk.c Wed Dec 12 14:38:23 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.11 90/11/06 16:42:39 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; *************** *** 110,113 **** --- 125,129 ---- CleanUpDrawingWindow (); XClearWindow (mainDisplay, drawWindow); + SetFileModified (FALSE); while (ReadObj (fp, &obj_ptr, FALSE)) *************** *** 127,134 **** fclose (fp); ! strcpy (curFileName, file_name); curFileDefined = TRUE; - SetFileModified (FALSE); sprintf (s, "Current file is '%s'.", file_name); Msg (s); --- 143,150 ---- fclose (fp); ! strcpy (curFileName, sym_name); ! strcpy (curSymDir, path_name); curFileDefined = TRUE; sprintf (s, "Current file is '%s'.", file_name); Msg (s); *************** *** 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'; } *** text.c.orig Wed Dec 12 14:39:40 1990 --- text.c Wed Dec 12 14:39:46 1990 *************** *** 6,10 **** #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/text.c,v 1.18 90/08/21 16:24:22 william Exp $"; #endif --- 6,10 ---- #ifndef lint static char RCSid[] = ! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/text.c,v 1.22 90/11/10 13:51:14 william Exp $"; #endif *************** *** 125,128 **** --- 125,129 ---- static Pixmap textBackingPixmap; static int textBackingPixmapSize = INVALID; + static GC rotateGC = NULL; void CleanUpText () *************** *** 133,136 **** --- 134,138 ---- textBackingPixmapSize = INVALID; } + if (rotateGC != NULL) XFreeGC (mainDisplay, rotateGC); } *************** *** 265,278 **** textBackingPixmapSize = max(w,h); } ! XSetForeground (mainDisplay, defaultGC, 0); ! XFillRectangle (mainDisplay, textBackingPixmap, defaultGC, 0, 0, w, h); ! XSetForeground (mainDisplay, defaultGC, myFgPixel); ! XSetFont (mainDisplay, revDefaultGC, canvasFontPtr->fid); ! XDrawImageString (mainDisplay, textBackingPixmap, revDefaultGC, 0, canvasFontAsc, Str, len); from_image = XGetImage (mainDisplay, textBackingPixmap, 0, 0, w, h, 1, ! XYPixmap); values.foreground = colorPixels[ColorIndex]; --- 267,290 ---- textBackingPixmapSize = max(w,h); } + if (rotateGC == NULL) + { + values.foreground = 1; + values.background = 0; + values.fill_style = FillSolid; + values.function = GXcopy; + rotateGC = XCreateGC (mainDisplay, drawWindow, + GCForeground | GCBackground | GCFillStyle | GCFunction, + &values); + } ! XSetForeground (mainDisplay, rotateGC, 0); ! XFillRectangle (mainDisplay, textBackingPixmap, rotateGC, 0, 0, w, h); ! XSetForeground (mainDisplay, rotateGC, 1); ! XSetFont (mainDisplay, rotateGC, canvasFontPtr->fid); ! XDrawString (mainDisplay, textBackingPixmap, rotateGC, 0, canvasFontAsc, Str, len); from_image = XGetImage (mainDisplay, textBackingPixmap, 0, 0, w, h, 1, ! ZPixmap); values.foreground = colorPixels[ColorIndex]; *************** *** 592,596 **** PopCurFont (); ShowJust (); ! ShowColor (); ShowCurFont (); editingText = FALSE; --- 604,608 ---- PopCurFont (); ShowJust (); ! ShowColor (FALSE); ShowCurFont (); editingText = FALSE; *************** *** 674,678 **** PopCurFont (); ShowJust (); ! ShowColor (); ShowCurFont (); editingText = FALSE; --- 686,690 ---- PopCurFont (); ShowJust (); ! ShowColor (FALSE); ShowCurFont (); editingText = FALSE; *************** *** 811,815 **** ShowPen (); colorIndex = obj_ptr->color; ! ShowColor (); ShowCurFont (); --- 823,827 ---- ShowPen (); colorIndex = obj_ptr->color; ! ShowColor (FALSE); ShowCurFont (); *************** *** 1375,1379 **** int PRTGIF; { ! int x, y, font_size, xinc, yinc; struct StrRec * s_ptr; struct TextRec * text_ptr = ObjPtr->detail.t; --- 1387,1391 ---- int PRTGIF; { ! int x, y, font_size, xinc, yinc, color_index; struct StrRec * s_ptr; struct TextRec * text_ptr = ObjPtr->detail.t; *************** *** 1406,1409 **** --- 1418,1430 ---- y = ObjPtr->y; + if (colorDump) + { + color_index = ObjPtr->color; + fprintf (FP, "%.3f %.3f %.3f setrgbcolor\n", + ((float)tgifColors[color_index].red/maxRGB), + ((float)tgifColors[color_index].green/maxRGB), + ((float)tgifColors[color_index].blue/maxRGB)); + } + if (curFont == FONT_SYM) { *************** *** 1555,1558 **** --- 1576,1580 ---- } + if (curFontDPI != text_ptr->dpi) text_ptr->dpi = curFontDPI; RestoreCurFont (); } *************** *** 1652,1656 **** register struct StrRec * s_ptr; ! fprintf (FP, "text(%s,", colorMenuItems[ObjPtr->color]); fprintf (FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,[\n", ObjPtr->x, ObjPtr->y, t_ptr->font, t_ptr->style, t_ptr->size, --- 1674,1678 ---- register struct StrRec * s_ptr; ! fprintf (FP, "text('%s',", colorMenuItems[ObjPtr->color]); fprintf (FP, "%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,%1d,[\n", ObjPtr->x, ObjPtr->y, t_ptr->font, t_ptr->style, t_ptr->size, *************** *** 1793,1797 **** (*ObjPtr)->detail.t = text_ptr; ! if (!PRTGIF) RestoreCurFont (); } --- 1815,1823 ---- (*ObjPtr)->detail.t = text_ptr; ! if (!PRTGIF) ! { ! if (curFontDPI != text_ptr->dpi) text_ptr->dpi = curFontDPI; ! RestoreCurFont (); ! } } *************** *** 1806,1810 **** PopCurFont (); ShowJust (); ! ShowColor (); ShowCurFont (); } --- 1832,1836 ---- PopCurFont (); ShowJust (); ! ShowColor (FALSE); ShowCurFont (); } *** tgif.c.orig Wed Dec 12 14:39:56 1990 --- tgif.c Wed Dec 12 14:39:57 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 Wed Dec 12 14:40:02 1990 --- version.c Wed Dec 12 14:40:03 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.23 90/11/10 13:53:37 william Exp $"; #endif ! char * version_string = "1.19"; *** choice.e.orig Wed Dec 12 14:40:08 1990 --- choice.e Wed Dec 12 14:40:09 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.6 90/10/30 16:35:47 william Exp $ */ *************** *** 18,21 **** --- 18,25 ---- extern void ShowCurFont (); extern void ShowCurFontDPI (); + extern void ShowDash (); + extern void ShowFile (); + extern void ShowSpecial (); + extern void ShowRotate (); extern void ShowLineWidth (); extern void ShowWhereToPrint (); *** color.e.orig Wed Dec 12 14:40:13 1990 --- color.e Wed Dec 12 14:40:14 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 (); *** edit.e.orig Wed Dec 12 14:40:18 1990 --- edit.e Wed Dec 12 14:40:19 1990 *************** *** 4,8 **** * Copyright (C) 1989, William Cheng. * ! * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/edit.e,v 1.2 90/07/04 21:07:20 william Exp $ */ --- 4,8 ---- * Copyright (C) 1989, William Cheng. * ! * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/edit.e,v 1.3 90/11/01 15:19:52 william Exp $ */ *************** *** 13,14 **** --- 13,15 ---- extern void BackProc (); extern void ArrangeMenu (); + extern void UpdateSymbols (); *** font.e.orig Wed Dec 12 14:40:22 1990 --- font.e Wed Dec 12 14:40:23 1990 *************** *** 4,8 **** * Copyright (C) 1989, William Cheng. * ! * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/font.e,v 1.4 90/08/15 16:58:35 william Exp $ */ --- 4,8 ---- * Copyright (C) 1989, William Cheng. * ! * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/font.e,v 1.5 90/10/30 19:33:51 william Exp $ */ *************** *** 46,49 **** --- 46,51 ---- extern void ChangeFont (); extern void FontMenu (); + extern void ChangeFontDPI (); + extern void FontDPIMenu (); extern void SaveCurFont (); extern void RestoreCurFont (); *** grid.e.orig Wed Dec 12 14:40:28 1990 --- grid.e Wed Dec 12 14:40:28 1990 *************** *** 4,8 **** * Copyright (C) 1989, William Cheng. * ! * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/grid.e,v 1.3 90/07/16 10:18:50 william Exp $ */ --- 4,8 ---- * Copyright (C) 1989, William Cheng. * ! * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/grid.e,v 1.7 90/10/30 16:07:25 william Exp $ */ *************** *** 20,23 **** --- 20,25 ---- extern void ToggleGridShown (); extern void ToggleSnapOn (); + extern void ToggleWhereToPrint (); + extern void ToggleColorPostScript (); extern void ZoomIn (); extern void ZoomOut (); *** names.e.orig Wed Dec 12 14:40:35 1990 --- names.e Wed Dec 12 14:40:36 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,25 ---- * Copyright (C) 1989, William Cheng. * ! * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.e,v 1.17 90/11/07 01:26:37 william Exp $ */ 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 NameInCurDir (); + extern int DirInSymPath (); + extern int GetSymbolPath (); *** pattern.e.orig Wed Dec 12 14:40:40 1990 --- pattern.e Wed Dec 12 14:40:41 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 Wed Dec 12 14:40:46 1990 --- raster.e Wed Dec 12 14:40:47 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.7 90/10/30 16:31:15 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,40 ---- 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 filePixmap; ! extern Pixmap specialPixmap; ! extern Pixmap rotatePixmap[]; 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 (); *** select.e.orig Wed Dec 12 14:40:51 1990 --- select.e Wed Dec 12 14:40:52 1990 *************** *** 4,8 **** * Copyright (C) 1989, William Cheng. * ! * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/select.e,v 1.2 90/07/06 18:02:44 william Exp $ */ --- 4,8 ---- * Copyright (C) 1989, William Cheng. * ! * @(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/select.e,v 1.3 90/11/01 16:42:13 william Exp $ */ *************** *** 23,26 **** --- 23,27 ---- extern void DelAllCutSel (); extern void UndoDelete (); + extern void PushToCutBuffer (); extern void CopySelToCut (); extern void DelAllSelObj (); ---------------------------------> 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