home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
x
/
volume8
/
tgif
/
patch1.01
next >
Wrap
Internet Message Format
|
1990-07-08
|
61KB
Path: uunet!cs.utexas.edu!sun-barr!newstop!sun!CS.UCLA.EDU
From: william@CS.UCLA.EDU (William Cheng)
Newsgroups: comp.sources.x
Subject: v08i046: tgif 1.9, Patch1, Part01/03
Message-ID: <138562@sun.Eng.Sun.COM>
Date: 9 Jul 90 07:21:39 GMT
Sender: news@sun.Eng.Sun.COM
Lines: 2032
Approved: argv@sun.com
Submitted-by: william@CS.UCLA.EDU (William Cheng)
Posting-number: Volume 8, Issue 46
Archive-name: tgif/patch2.01
Patch-To: tgif: Volume 7, Issue 56-76
[ This is patch #1 because it is to be applied to the last full posting
of this software in Volume 7 --dan ]
This patch takes tgif from version 1.2 to 1.9. The most recent version
is available for anonymous ftp at the following places.
expo.lcs.mit.edu contrib/tgif-1.9.tar.Z
rye.cs.ucla.edu pub/tgif-1.9.tar.Z
--Bill
---------------------------------> cut here <---------------------------------
*** align.c.orig Wed Jun 27 13:25:05 1990
--- align.c Wed Jun 27 13:25:06 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/align.c,v 1.1 90/04/01 22:15:59 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/align.c,v 1.2 90/06/26 00:05:49 william Exp $";
#endif
***************
*** 79,83 ****
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! fileModified = TRUE;
justDupped = TRUE;
}
--- 79,83 ----
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! SetFileModified (TRUE);
justDupped = TRUE;
}
***************
*** 124,128 ****
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! fileModified = TRUE;
justDupped = TRUE;
}
--- 124,128 ----
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! SetFileModified (TRUE);
justDupped = TRUE;
}
*** attr.c.orig Wed Jun 27 13:25:13 1990
--- attr.c Wed Jun 27 13:25:15 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/attr.c,v 1.2 90/05/07 15:26:32 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/attr.c,v 1.4 90/06/26 00:03:55 william Exp $";
#endif
***************
*** 107,111 ****
static
short ParseAttrStr(Str, name, s)
! char Str[80], name[80], s[80];
{
char * eq_ptr, * str_ptr, * ptr;
--- 107,111 ----
static
short ParseAttrStr(Str, name, s)
! char * Str, * name, * s;
{
char * eq_ptr, * str_ptr, * ptr;
***************
*** 147,151 ****
/* and its ObjRec after an attribute was edited. */
{
! char s[80], name[80];
if (AttrPtr->nameshown)
--- 147,151 ----
/* and its ObjRec after an attribute was edited. */
{
! char s[MAXSTRING+1], name[MAXSTRING+1];
if (AttrPtr->nameshown)
***************
*** 305,309 ****
struct TextRec * text_ptr;
int found = FALSE;
! char name[80], value[80];
text_ptr = TextObjPtr->detail.t;
--- 305,309 ----
struct TextRec * text_ptr;
int found = FALSE;
! char name[MAXSTRING+1], value[MAXSTRING+1];
text_ptr = TextObjPtr->detail.t;
***************
*** 501,505 ****
{
struct ObjRec * TextObj;
! char inbuf[255], * s, name[80], value[80];
int len, shown, nameshown, inherited;
--- 501,506 ----
{
struct ObjRec * TextObj;
! char inbuf[MAXSTRING+1], * s;
! char name[MAXSTRING+1], value[MAXSTRING+1];
int len, shown, nameshown, inherited;
***************
*** 550,554 ****
struct AttrRec * attr_ptr;
int has_attr, picture_changed = FALSE, obj_changed;
! char * s;
for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next)
--- 551,556 ----
struct AttrRec * attr_ptr;
int has_attr, picture_changed = FALSE, obj_changed;
! int len1, len2;
! char * s, msg[80];
for (sel_ptr = topSel; sel_ptr != NULL; sel_ptr = sel_ptr->next)
***************
*** 573,576 ****
--- 575,589 ----
s = attr_ptr->obj->detail.t->first->s;
strcpy (s, attr_ptr->name);
+
+ len1 = strlen (attr_ptr->name);
+ len2 = strlen (attr_ptr->s);
+ if (len1+len2 >= MAXSTRING)
+ {
+ sprintf (msg, "String length exceeds %1d. String truncated.",
+ MAXSTRING);
+ Msg (msg);
+ attr_ptr->s[MAXSTRING-len1] = '\0';
+ }
+
strcat (s, attr_ptr->s);
attr_ptr->nameshown = TRUE;
***************
*** 594,598 ****
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! fileModified = TRUE;
}
}
--- 607,611 ----
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! SetFileModified (TRUE);
}
}
***************
*** 655,659 ****
sel_rbx+(1<<zoomScale), sel_rby+(1<<zoomScale));
HighLightForward ();
! fileModified = TRUE;
}
}
--- 668,672 ----
sel_rbx+(1<<zoomScale), sel_rby+(1<<zoomScale));
HighLightForward ();
! SetFileModified (TRUE);
}
}
***************
*** 665,669 ****
struct AttrRec * attr_ptr = ObjPtr->detail.r->fattr;
struct SelRec * new_sel_ptr;
! char * s;
for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next)
--- 678,683 ----
struct AttrRec * attr_ptr = ObjPtr->detail.r->fattr;
struct SelRec * new_sel_ptr;
! int len1, len2;
! char * s, msg[80];
for ( ; attr_ptr != NULL; attr_ptr = attr_ptr->next)
***************
*** 673,676 ****
--- 687,701 ----
s = attr_ptr->obj->detail.t->first->s;
strcpy (s, attr_ptr->name);
+
+ len1 = strlen (attr_ptr->name);
+ len2 = strlen (attr_ptr->s);
+ if (len1+len2 >= MAXSTRING)
+ {
+ sprintf (msg, "String length exceeds %1d. String truncated.",
+ MAXSTRING);
+ Msg (msg);
+ attr_ptr->s[MAXSTRING-len1] = '\0';
+ }
+
strcat (s, attr_ptr->s);
UpdTextBBox (attr_ptr->obj);
***************
*** 768,772 ****
RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
! fileModified = TRUE;
}
HighLightForward ();
--- 793,797 ----
RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
! SetFileModified (TRUE);
}
HighLightForward ();
***************
*** 777,783 ****
--- 802,822 ----
/* Update the text object's string value associated with AttrPtr */
{
+ int len1, len2;
+ char msg[80];
+
if (AttrPtr->nameshown)
{
strcpy (AttrPtr->obj->detail.t->first->s, AttrPtr->name);
+
+ len1 = strlen (AttrPtr->name);
+ len2 = strlen (AttrPtr->s);
+ if (len1+len2 >= MAXSTRING)
+ {
+ sprintf (msg, "String length exceeds %1d. String truncated.",
+ MAXSTRING);
+ Msg (msg);
+ AttrPtr->s[MAXSTRING-len1] = '\0';
+ }
+
strcat (AttrPtr->obj->detail.t->first->s, AttrPtr->s);
}
***************
*** 975,979 ****
int picture_changed, sel_ltx, sel_lty, sel_rbx, sel_rby;
int * fore_colors, * pixel_ptr, * valid, * flag_ptr;
! char * * attrStrs, * s, buf[256];
unsigned int button;
--- 1014,1019 ----
int picture_changed, sel_ltx, sel_lty, sel_rbx, sel_rby;
int * fore_colors, * pixel_ptr, * valid, * flag_ptr;
! int len1, len2;
! char * * attrStrs, * s, buf[256], msg[80];
unsigned int button;
***************
*** 1006,1012 ****
for (i = 0; i < num_attrs; i++, attr_ptr1 = attr_ptr1->next)
{
! s = (char *) calloc (80, sizeof(char));
attrStrs[i] = s;
strcpy (s, attr_ptr1->name);
strcat (s, attr_ptr1->s);
*pixel_ptr++ = colorPixels[attr_ptr1->obj->color];
--- 1046,1063 ----
for (i = 0; i < num_attrs; i++, attr_ptr1 = attr_ptr1->next)
{
! s = (char *) calloc (MAXSTRING, sizeof(char));
attrStrs[i] = s;
strcpy (s, attr_ptr1->name);
+
+ len1 = strlen (attr_ptr1->name);
+ len2 = strlen (attr_ptr1->s);
+ if (len1+len2 >= MAXSTRING)
+ {
+ sprintf (msg, "String length exceeds %1d. String truncated.",
+ MAXSTRING);
+ Msg (msg);
+ attr_ptr1->s[MAXSTRING-len1] = '\0';
+ }
+
strcat (s, attr_ptr1->s);
*pixel_ptr++ = colorPixels[attr_ptr1->obj->color];
***************
*** 1035,1039 ****
selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
! fileModified = TRUE;
HighLightForward ();
}
--- 1086,1090 ----
selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
! SetFileModified (TRUE);
HighLightForward ();
}
***************
*** 1049,1053 ****
selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
! fileModified = TRUE;
HighLightForward ();
}
--- 1100,1104 ----
selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
! SetFileModified (TRUE);
HighLightForward ();
}
*** box.c.orig Wed Jun 27 13:25:22 1990
--- box.c Wed Jun 27 13:25:24 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/box.c,v 1.2 90/05/16 08:30:24 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/box.c,v 1.4 90/06/26 00:04:27 william Exp $";
#endif
***************
*** 177,181 ****
if (fill != 0)
{
! values.foreground = (fill == 2) ? myBlackPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 177,181 ----
if (fill != 0)
{
! values.foreground = (fill == 2) ? myBgPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
***************
*** 188,192 ****
if (pen != 0)
{
! values.foreground = (pen == 2) ? myBlackPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 188,192 ----
if (pen != 0)
{
! values.foreground = (pen == 2) ? myBgPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
***************
*** 310,314 ****
DrawBoxObj (drawWindow, drawOrigX, drawOrigY, topObj);
boxDrawn = TRUE;
! fileModified = TRUE;
}
}
--- 310,314 ----
DrawBoxObj (drawWindow, drawOrigX, drawOrigY, topObj);
boxDrawn = TRUE;
! SetFileModified (TRUE);
}
}
*** button.c.orig Wed Jun 27 13:25:32 1990
--- button.c Wed Jun 27 13:25:33 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/button.c,v 1.1 90/04/01 22:16:04 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/button.c,v 1.5 90/05/22 16:57:56 william Exp $";
#endif
***************
*** 114,118 ****
if ((confirm_win = XCreateSimpleWindow (mainDisplay, rootWindow,
! win_x, win_y, w, h, brdrW, myWhitePixel, myBlackPixel)) == 0)
{ printf ("Could not create yes-no-okay window!\n"); exit (-1); }
--- 114,118 ----
if ((confirm_win = XCreateSimpleWindow (mainDisplay, rootWindow,
! win_x, win_y, w, h, brdrW, myBorderPixel, myBgPixel)) == 0)
{ printf ("Could not create yes-no-okay window!\n"); exit (-1); }
***************
*** 130,133 ****
--- 130,134 ----
if (input.type == Expose)
{
+ XDrawRectangle (mainDisplay, confirm_win, defaultGC, 0, 0, w-1, h-1);
XDrawString (mainDisplay, confirm_win, defaultGC, str_start,
defaultFontHeight+top, Str, strlen(Str));
*** choice.c.orig Wed Jun 27 13:25:39 1990
--- choice.c Wed Jun 27 13:25:40 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/choice.c,v 1.2 90/05/07 15:15:04 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/choice.c,v 1.5 90/06/26 15:22:27 william Exp $";
#endif
***************
*** 39,44 ****
XGCValues values;
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.font = defaultFontPtr->fid;
choiceGC = XCreateGC (mainDisplay, choiceWindow,
--- 39,44 ----
XGCValues values;
! values.foreground = 1;
! values.background = 0;
values.font = defaultFontPtr->fid;
choiceGC = XCreateGC (mainDisplay, choiceWindow,
***************
*** 107,110 ****
--- 107,111 ----
XRectangle recs[1];
XImage * image;
+ XGCValues values;
recs[0].x = 2*choiceImageW;
***************
*** 159,163 ****
--- 160,173 ----
{
XSetClipRectangles (mainDisplay, choiceGC, 0, 0, recs, 1, YXBanded);
+
+ values.foreground = myFgPixel;
+ values.background = myBgPixel;
+ XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values);
+
XDrawString (mainDisplay, choiceWindow, choiceGC, x, y, "W", 1);
+
+ values.foreground = 1;
+ values.background = 0;
+ XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values);
}
else
***************
*** 168,178 ****
XYPixmap);
XSetClipRectangles (mainDisplay, choiceGC, 0, 0, recs, 1, YXBanded);
saved_x = x;
saved_y = y;
for (i = 0; i < w; i++)
- {
for (j = 0; j < h; j++)
! {
! if (XGetPixel (image, i, j) == 0)
{
switch (curRotate)
--- 178,191 ----
XYPixmap);
XSetClipRectangles (mainDisplay, choiceGC, 0, 0, recs, 1, YXBanded);
+
+ values.foreground = myFgPixel;
+ values.background = myBgPixel;
+ XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values);
+
saved_x = x;
saved_y = y;
for (i = 0; i < w; i++)
for (j = 0; j < h; j++)
! if (XGetPixel (image, i, j) == 1)
{
switch (curRotate)
***************
*** 183,191 ****
}
/* XDrawPoint (mainDisplay, choiceWindow, defaultGC, x, y); */
! /* Hack to run on RTs -- stupid IBM */
! XDrawLine (mainDisplay, choiceWindow, defaultGC, x, y, x, y);
}
! }
! }
}
--- 196,206 ----
}
/* XDrawPoint (mainDisplay, choiceWindow, defaultGC, x, y); */
! /* Hack to run on RTs -- crash server on RTs */
! XDrawLine (mainDisplay,choiceWindow,defaultGC,x,y,x,y);
}
!
! values.foreground = 1;
! values.background = 0;
! XChangeGC (mainDisplay, choiceGC, GCForeground | GCBackground, &values);
}
***************
*** 229,234 ****
XGCValues values;
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 244,249 ----
XGCValues values;
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
***************
*** 246,251 ****
XGCValues values;
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 261,266 ----
XGCValues values;
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
*** color.c.orig Wed Jun 27 13:25:45 1990
--- color.c Wed Jun 27 13:25:46 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/color.c,v 1.6 90/05/17 08:21:55 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/color.c,v 1.9 90/06/26 00:04:37 william Exp $";
#endif
***************
*** 41,45 ****
register int i, * fore_pixels, pixel, * valid;
! pixel = myWhitePixel;
*ForePixels = fore_pixels = (int *) calloc (Entries, sizeof(int));
*Valid = valid = (int *) calloc (Entries, sizeof(int));
--- 41,45 ----
register int i, * fore_pixels, pixel, * valid;
! pixel = myFgPixel;
*ForePixels = fore_pixels = (int *) calloc (Entries, sizeof(int));
*Valid = valid = (int *) calloc (Entries, sizeof(int));
***************
*** 74,109 ****
register int i;
XColor color, exact_def;
! char buf[80], * c_ptr;
int num, color_in_x_default = FALSE;
! int black_allocated = FALSE, white_allocated = FALSE;
! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "MaxColors")) != NULL)
{
! color_in_x_default = TRUE;
! maxColors = atoi (c_ptr);
! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "DefaultColorIndex")) !=
! NULL)
{
! num = atoi (c_ptr);
! if (num < maxColors)
! defaultColorIndex = num;
! else
{
! printf ("Warning: DefaultColorIndex >= MaxColors, ");
! printf ("Use 0 for DefaultColorIndex\n");
! defaultColorIndex = 0;
}
}
else
! defaultColorIndex = 0;
}
else
{
! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "DefaultColorIndex")) !=
! NULL)
{
! num = atoi (c_ptr);
! if (num < maxColors) defaultColorIndex = num;
}
}
--- 74,143 ----
register int i;
XColor color, exact_def;
! char buf[80], * c_ptr, fg_color[80], bg_color[80], brdr_color[80];
int num, color_in_x_default = FALSE;
! int bg_allocated=FALSE, fg_allocated=FALSE, brdr_allocated=FALSE;
! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "ReverseVideo")) != NULL)
! reverseVideo = (strcmp (c_ptr, "on") == 0);
!
! if (colorDisplay)
{
! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "Foreground")) != NULL)
! strcpy (fg_color, c_ptr);
! else
! strcpy (fg_color, "white");
! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "Background")) != NULL)
! strcpy (bg_color, c_ptr);
! else
! strcpy (bg_color, "black");
! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "BorderColor")) != NULL)
! strcpy (brdr_color, c_ptr);
! else
! strcpy (fg_color, "white");
!
! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "MaxColors")) != NULL)
{
! color_in_x_default = TRUE;
! maxColors = atoi (c_ptr);
! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "DefaultColorIndex"))
! != NULL)
{
! num = atoi (c_ptr);
! if (num < maxColors)
! defaultColorIndex = num;
! else
! {
! printf ("Warning: DefaultColorIndex >= MaxColors, ");
! printf ("Use 0 for DefaultColorIndex\n");
! defaultColorIndex = 0;
! }
}
+ else
+ defaultColorIndex = 0;
}
else
! {
! if ((c_ptr = XGetDefault (mainDisplay, TOOL_NAME, "DefaultColorIndex"))
! != NULL)
! {
! num = atoi (c_ptr);
! if (num < maxColors) defaultColorIndex = num;
! }
! }
}
else
{
! if (reverseVideo)
{
! strcpy (fg_color, "white");
! strcpy (bg_color, "black");
! strcpy (brdr_color, "white");
}
+ else
+ {
+ strcpy (fg_color, "black");
+ strcpy (bg_color, "white");
+ strcpy (brdr_color, "black");
+ }
}
***************
*** 143,185 ****
colorPixels[i] = color.pixel;
! if (strcmp (colorMenuItems[i], "white") == 0)
{
! colorPixels[i] = myWhitePixel = color.pixel;
! white_allocated = TRUE;
}
! else if (strcmp (colorMenuItems[i], "black") == 0)
{
! colorPixels[i] = myBlackPixel = color.pixel;
! black_allocated = TRUE;
}
}
! if (!white_allocated)
{
! XAllocNamedColor(mainDisplay, mainColormap, "white", &color,
&exact_def);
! myWhitePixel = color.pixel;
}
! if (!black_allocated)
{
! XAllocNamedColor(mainDisplay, mainColormap, "black", &color,
&exact_def);
! myBlackPixel = color.pixel;
}
for (i = 0; i < maxColors; i++)
! xorColorPixels[i] = colorPixels[i] ^ myBlackPixel;
}
else
{
! XAllocNamedColor(mainDisplay, mainColormap, "white", &color, &exact_def);
! myWhitePixel = color.pixel;
! XAllocNamedColor(mainDisplay, mainColormap, "black", &color, &exact_def);
! myBlackPixel = color.pixel;
for (i = 0; i < maxColors; i++)
{
! colorPixels[i] = myWhitePixel;
! xorColorPixels[i] = myWhitePixel ^ myBlackPixel;
}
colorIndex = 0;
--- 177,248 ----
colorPixels[i] = color.pixel;
! if (strcmp (colorMenuItems[i], fg_color) == 0)
{
! if (reverseVideo)
! myBgPixel = color.pixel;
! else
! myFgPixel = color.pixel;
!
! fg_allocated = TRUE;
}
! if (strcmp (colorMenuItems[i], bg_color) == 0)
{
! if (reverseVideo)
! myFgPixel = color.pixel;
! else
! myBgPixel = color.pixel;
!
! bg_allocated = TRUE;
}
+ if (strcmp (colorMenuItems[i], brdr_color) == 0)
+ {
+ myBorderPixel = color.pixel;
+ brdr_allocated = TRUE;
+ }
}
! if (!fg_allocated)
{
! XAllocNamedColor(mainDisplay, mainColormap, fg_color, &color,
&exact_def);
! if (reverseVideo)
! myBgPixel = color.pixel;
! else
! myFgPixel = color.pixel;
}
! if (!bg_allocated)
{
! XAllocNamedColor(mainDisplay, mainColormap, bg_color, &color,
&exact_def);
! if (reverseVideo)
! myFgPixel = color.pixel;
! else
! myBgPixel = color.pixel;
}
+ if (!brdr_allocated)
+ {
+ XAllocNamedColor(mainDisplay, mainColormap, brdr_color, &color,
+ &exact_def);
+ myBorderPixel = color.pixel;
+ }
for (i = 0; i < maxColors; i++)
! xorColorPixels[i] = colorPixels[i] ^ myBgPixel;
}
else
{
! XAllocNamedColor(mainDisplay,mainColormap,fg_color,&color,&exact_def);
! myFgPixel = color.pixel;
+ XAllocNamedColor(mainDisplay,mainColormap,bg_color,&color,&exact_def);
+ myBgPixel = color.pixel;
+
+ XAllocNamedColor(mainDisplay,mainColormap,brdr_color,&color,&exact_def);
+ myBorderPixel = color.pixel;
+
for (i = 0; i < maxColors; i++)
{
! colorPixels[i] = myFgPixel;
! xorColorPixels[i] = myFgPixel ^ myBgPixel;
}
colorIndex = 0;
***************
*** 273,277 ****
{
HighLightReverse ();
! fileModified = TRUE;
RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
--- 336,340 ----
{
HighLightReverse ();
! SetFileModified (TRUE);
RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
*** cursor.c.orig Wed Jun 27 13:25:51 1990
--- cursor.c Wed Jun 27 13:25:53 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/cursor.c,v 1.1 90/04/01 22:16:09 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/cursor.c,v 1.2 90/05/22 14:08:44 william Exp $";
#endif
***************
*** 66,71 ****
text_cur_image_bits, text_cur_image_width, text_cur_image_height);
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.fill_style = FillOpaqueStippled;
values.stipple = textPixmap;
--- 66,71 ----
text_cur_image_bits, text_cur_image_width, text_cur_image_height);
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.fill_style = FillOpaqueStippled;
values.stipple = textPixmap;
*** dialog.c.orig Wed Jun 27 13:26:00 1990
--- dialog.c Wed Jun 27 13:26:03 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/dialog.c,v 1.1 90/04/01 22:16:10 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/dialog.c,v 1.4 90/05/25 13:36:58 william Exp $";
#endif
***************
*** 12,22 ****
#include <X11/Xutil.h>
#include "const.h"
- #include "setup.e"
- #include "cursor.e"
#include "box.e"
#include "font.e"
#include "mainloop.e"
#include "raster.e"
static int curX, curY;
--- 12,22 ----
#include <X11/Xutil.h>
#include "const.h"
#include "box.e"
+ #include "cursor.e"
#include "font.e"
#include "mainloop.e"
#include "raster.e"
+ #include "setup.e"
static int curX, curY;
***************
*** 51,55 ****
int w, h, str_w, left, top, fore_draw_pixel, fore_erase_pixel;
XEvent input;
- int brdr_pixel, bg_pixel;
int win_x, win_y;
int dialoging = TRUE, index = 0, dsp_w, dsp_h;
--- 51,54 ----
***************
*** 67,74 ****
top = 2 * defaultFontHeight;
! brdr_pixel = myWhitePixel;
! bg_pixel = myBlackPixel;
! fore_draw_pixel = myWhitePixel;
! fore_erase_pixel = myBlackPixel;
dsp_w = DisplayWidth (mainDisplay, mainScreen);
--- 66,71 ----
top = 2 * defaultFontHeight;
! fore_draw_pixel = myFgPixel;
! fore_erase_pixel = myBgPixel;
dsp_w = DisplayWidth (mainDisplay, mainScreen);
***************
*** 79,83 ****
if ((dialogWindow = XCreateSimpleWindow (mainDisplay, rootWindow, win_x,
! win_y, w, h, brdrW, brdr_pixel, bg_pixel)) == 0)
{ printf ("Could not create dialog window!\n"); exit (-1); }
--- 76,80 ----
if ((dialogWindow = XCreateSimpleWindow (mainDisplay, rootWindow, win_x,
! win_y, w, h, brdrW, myBorderPixel, myBgPixel)) == 0)
{ printf ("Could not create dialog window!\n"); exit (-1); }
***************
*** 97,100 ****
--- 94,98 ----
if (input.type == Expose)
{
+ XDrawRectangle (mainDisplay, dialogWindow, defaultGC, 0, 0, w-1, h-1);
MyBox (dialogWindow, defaultGC, 10, 10, w-9, h-9);
MyBox (dialogWindow, defaultGC, 11, 11, w-10, h-10);
*** drawing.c.orig Wed Jun 27 13:26:34 1990
--- drawing.c Wed Jun 27 13:26:36 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/drawing.c,v 1.1 90/04/01 22:16:11 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/drawing.c,v 1.3 90/05/22 14:10:35 william Exp $";
#endif
***************
*** 32,35 ****
--- 32,36 ----
#include "oval.e"
#include "obj.e"
+ #include "pattern.e"
#include "poly.e"
#include "polygon.e"
***************
*** 37,40 ****
--- 38,42 ----
#include "rect.e"
#include "ruler.e"
+ #include "scroll.e"
#include "select.e"
#include "setup.e"
***************
*** 113,117 ****
int ltx, lty, rbx, rby, x_start, x_end, y_start, y_end, pixel;
! pixel = myWhitePixel;
ltx = ((ObjPtr->obbox.ltx - XOff - QUARTER_INCH) >> zoomScale) + 1;
--- 115,119 ----
int ltx, lty, rbx, rby, x_start, x_end, y_start, y_end, pixel;
! pixel = myFgPixel;
ltx = ((ObjPtr->obbox.ltx - XOff - QUARTER_INCH) >> zoomScale) + 1;
***************
*** 174,178 ****
void DrawPaperBoundary ()
{
! register int x_end, y_end, pixel = myWhitePixel;
if (drawOrigX+drawWinW > paperWidth)
--- 176,180 ----
void DrawPaperBoundary ()
{
! register int x_end, y_end, pixel = myFgPixel;
if (drawOrigX+drawWinW > paperWidth)
***************
*** 480,483 ****
--- 482,487 ----
case '\031': /*^Y*/ break;
case '\032': /*^Z*/ return (AnimateProc ()); break;
+ case ',': /*^,*/ ScrollLeft (); break;
+ case '.': /*^.*/ ScrollRight (); break;
}
}
***************
*** 496,500 ****
case 'i': /*#I*/ IncGrid (); break;
case 'j': /*#J*/ HideAllAttrNames (); break;
! case 'k': /*#K*/ break;
case 'l': /*#L*/ CornerLoop (&x, &y); LineStyleMenu (x, y); break;
case 'm': /*#M*/ MoveAttr (); break;
--- 500,504 ----
case 'i': /*#I*/ IncGrid (); break;
case 'j': /*#J*/ HideAllAttrNames (); break;
! case 'k': /*#K*/ SetCurChoice (NOTHING); break;
case 'l': /*#L*/ CornerLoop (&x, &y); LineStyleMenu (x, y); break;
case 'm': /*#M*/ MoveAttr (); break;
***************
*** 518,521 ****
--- 522,527 ----
case '4': /*#4*/ ChangeFontSize (4); break;
case '5': /*#5*/ ChangeFontSize (5); break;
+ case ',': /*#,*/ ScrollUp (); break;
+ case '.': /*#.*/ ScrollDown (); break;
}
}
*** dup.c.orig Wed Jun 27 13:26:50 1990
--- dup.c Wed Jun 27 13:26:52 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/dup.c,v 1.1 90/04/01 22:16:13 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/dup.c,v 1.2 90/06/26 00:04:49 william Exp $";
#endif
***************
*** 305,308 ****
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! fileModified = TRUE;
}
--- 305,308 ----
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! SetFileModified (TRUE);
}
*** edit.c.orig Wed Jun 27 13:27:00 1990
--- edit.c Wed Jun 27 13:27:01 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/edit.c,v 1.1 90/04/01 22:16:14 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/edit.c,v 1.2 90/06/26 00:04:59 william Exp $";
#endif
***************
*** 69,73 ****
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! fileModified = TRUE;
}
}
--- 69,73 ----
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! SetFileModified (TRUE);
}
}
***************
*** 82,86 ****
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! fileModified = TRUE;
}
}
--- 82,86 ----
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! SetFileModified (TRUE);
}
}
*** file.c.orig Wed Jun 27 13:27:25 1990
--- file.c Wed Jun 27 13:27:29 1990
***************
*** 6,12 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/file.c,v 1.2 90/05/07 15:25:55 william Exp $";
#endif
#include <stdio.h>
#include <X11/Xlib.h>
--- 6,14 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/file.c,v 1.15 90/06/26 13:03:47 william Exp $";
#endif
+ #include <sys/types.h>
+ #include <sys/file.h>
#include <stdio.h>
#include <X11/Xlib.h>
***************
*** 43,50 ****
#define CUR_VERSION 6
! char curFileName[80];
int curFileDefined = FALSE;
int fileVersion = INVALID;
int importingFile = FALSE;
void ClearFileInfo ()
--- 45,61 ----
#define CUR_VERSION 6
! char curFileName[MAXPATHLENGTH];
int curFileDefined = FALSE;
int fileVersion = INVALID;
int importingFile = FALSE;
+ int psDotsPerInch = 72;
+ char *psXOffStr[MAXPAGESTYLES]={"0.55","0.4","0.28","0.2","0.565","0.4"};
+ float psXOff[MAXPAGESTYLES] = { 0.55, 0.4, 0.28, 0.2, 0.565, 0.4 };
+ char *psYOffStr[MAXPAGESTYLES]={"10.4","-0.6","10.7","-0.3","10.4","-0.6"};
+ float psYOff[MAXPAGESTYLES] = { 10.4, -0.6, 10.7, -0.3, 10.4, -0.6 };
+ char *psScaleStr[MAXPAGESTYLES]={"0.565","0.565","0.28","0.28","1.13","1.13"};
+ float psScale[MAXPAGESTYLES] = { 0.565, 0.565, 0.28, 0.28, 1.13, 1.13 };
+ float psPageWidthInInch[MAXPAGESTYLES] = { 7.5, 10, 15.5, 21, 3.75, 5 };
+ float psPageHeightInInch[MAXPAGESTYLES] = { 10, 7.5, 21, 15.5, 5, 3.75 };
void ClearFileInfo ()
***************
*** 57,63 ****
char * FileName;
{
! char s[256];
! if (fopen (FileName, "r") == NULL) return (TRUE);
switch (YesNoCancel ("File exists, okay to overwrite? [ync](y)"))
{
--- 68,76 ----
char * FileName;
{
! char s[MAXSTRING];
! FILE * fp;
! if ((fp = fopen (FileName, "r")) == NULL) return (TRUE);
! fclose (fp);
switch (YesNoCancel ("File exists, okay to overwrite? [ync](y)"))
{
***************
*** 66,71 ****
case CONFIRM_CANCEL: return (FALSE);
}
! sprintf (s, "rm -f %s", FileName);
! system (s);
return (TRUE);
}
--- 79,83 ----
case CONFIRM_CANCEL: return (FALSE);
}
! unlink (FileName);
return (TRUE);
}
***************
*** 125,129 ****
/* return TRUE if file successfully saved */
{
! char new_file_name[80], s[80];
FILE * fp;
int count = 0, status = INVALID;
--- 137,141 ----
/* return TRUE if file successfully saved */
{
! char new_file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
FILE * fp;
int count = 0, status = INVALID;
***************
*** 144,149 ****
}
! sprintf (s, "rm -f %s", new_file_name);
! system (s);
if ((fp = fopen (new_file_name, "w")) == NULL)
--- 156,160 ----
}
! unlink (new_file_name);
if ((fp = fopen (new_file_name, "w")) == NULL)
***************
*** 167,176 ****
void SaveNewFile ()
{
! char new_file_name[80], s[80], new_full_name[MAXPATHLENGTH];
FILE * fp;
! int count = 0;
struct ObjRec * obj_ptr;
Dialog ("Please Enter New File Name:", new_file_name);
if (*new_file_name == '\0') return;
--- 178,189 ----
void SaveNewFile ()
{
! char new_file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
! char new_full_name[MAXPATHLENGTH];
FILE * fp;
! int count = 0, len;
struct ObjRec * obj_ptr;
Dialog ("Please Enter New File Name:", new_file_name);
+ len = strlen (new_file_name);
if (*new_file_name == '\0') return;
***************
*** 180,185 ****
switch (count)
{
! case 0: strcat (new_file_name, ".obj"); break;
! case 1: strcat (new_file_name, ".sym"); break;
default:
Msg ("TOO MANY SYMBOLS! Symbol file not saved.");
--- 193,236 ----
switch (count)
{
! case 0:
! if (strlen (new_file_name) >= 4)
! {
! if (strcmp (&new_file_name[len-4], ".sym") == 0)
! {
! Msg ("Can not save as a .sym file, no symbol defined.");
! return;
! }
! else if (strcmp (&new_file_name[len-4], ".obj") != 0)
! strcat (new_file_name, ".obj");
!
! if (strlen (new_file_name) == 4)
! {
! Msg ("No file name specified. File not saved.");
! return;
! }
! }
! else
! strcat (new_file_name, ".obj");
! break;
! case 1:
! if (strlen (new_file_name) >= 4)
! {
! if (strcmp (&new_file_name[len-4], ".obj") == 0)
! {
! Msg ("Can not save as a .obj file, ther is a symbol defined.");
! return;
! }
! else if (strcmp (&new_file_name[len-4], ".sym") != 0)
! strcat (new_file_name, ".sym");
!
! if (strlen (new_file_name) == 4)
! {
! Msg ("No file name specified. File not saved.");
! return;
! }
! }
! else
! strcat (new_file_name, ".sym");
! break;
default:
Msg ("TOO MANY SYMBOLS! Symbol file not saved.");
***************
*** 208,212 ****
sprintf (s, "File '%s' saved.", new_file_name);
Msg (s);
! fileModified = FALSE;
RedrawTitleWindow ();
--- 259,263 ----
sprintf (s, "File '%s' saved.", new_file_name);
Msg (s);
! SetFileModified (FALSE);
RedrawTitleWindow ();
***************
*** 218,222 ****
struct ObjRec * obj_ptr;
FILE * fp;
! char ext[80], s[80], full_name[MAXPATHLENGTH];
if (!curFileDefined)
--- 269,274 ----
struct ObjRec * obj_ptr;
FILE * fp;
! char ext[MAXPATHLENGTH], s[MAXPATHLENGTH];
! char full_name[MAXPATHLENGTH];
if (!curFileDefined)
***************
*** 275,279 ****
sprintf (s, "File '%s' saved.", curFileName);
Msg (s);
! fileModified = FALSE;
}
--- 327,331 ----
sprintf (s, "File '%s' saved.", curFileName);
Msg (s);
! SetFileModified (FALSE);
}
***************
*** 371,376 ****
struct ObjRec * * ObjPtr;
{
! char inbuf[256], obj_name[10], tmp_str[256], * s, * s1;
! char * line = NULL, * c_ptr;
int len, id, old_len, cur_size, done = FALSE;
int allocated = FALSE;
--- 423,428 ----
struct ObjRec * * ObjPtr;
{
! char inbuf[MAXSTRING+1], obj_name[10], tmp_str[MAXSTRING+1];
! char * line = NULL, * c_ptr, * s, * s1;
int len, id, old_len, cur_size, done = FALSE;
int allocated = FALSE;
***************
*** 379,383 ****
struct AttrRec * top_attr = NULL, * bot_attr = NULL, * attr_ptr;
! while (fgets (inbuf, 256, FP) != NULL)
{
if (inbuf[0] == ']') return (FALSE);
--- 431,435 ----
struct AttrRec * top_attr = NULL, * bot_attr = NULL, * attr_ptr;
! while (fgets (inbuf, MAXSTRING, FP) != NULL)
{
if (inbuf[0] == ']') return (FALSE);
***************
*** 385,396 ****
len = strlen(inbuf);
if (inbuf[len-1] != '\r' && inbuf[len-1] != '\n')
! { /* line longer than 256 characters */
! /* inbuf[255] == '\0' and len == 255 now */
! cur_size = 510;
allocated = TRUE;
line = (char *) calloc (cur_size, sizeof(char));
strcpy (line, inbuf);
! c_ptr = &(line[255]);
! while (fgets (inbuf, 256, FP) != NULL && !done)
{
len = strlen(inbuf);
--- 437,448 ----
len = strlen(inbuf);
if (inbuf[len-1] != '\r' && inbuf[len-1] != '\n')
! { /* line longer than MAXSTRING characters */
! /* inbuf[MAXSTRING-1] == '\0' and len == MAXSTRING-1 now */
! cur_size = 2*(MAXSTRING-1);
allocated = TRUE;
line = (char *) calloc (cur_size, sizeof(char));
strcpy (line, inbuf);
! c_ptr = &(line[MAXSTRING-1]);
! while (fgets (inbuf, MAXSTRING, FP) != NULL && !done)
{
len = strlen(inbuf);
***************
*** 403,410 ****
else
{
! cur_size += 255;
line = (char *) realloc (line, cur_size);
strcpy (c_ptr, inbuf);
! c_ptr += 255;
}
}
--- 455,462 ----
else
{
! cur_size += MAXSTRING-1;
line = (char *) realloc (line, cur_size);
strcpy (c_ptr, inbuf);
! c_ptr += MAXSTRING-1;
}
}
***************
*** 517,521 ****
ReadGroupObj (FP, ObjPtr);
(*ObjPtr)->type = OBJ_ICON;
! if (fgets (line, 256, FP) == NULL)
{
if (allocated) cfree (line);
--- 569,573 ----
ReadGroupObj (FP, ObjPtr);
(*ObjPtr)->type = OBJ_ICON;
! if (fgets (line, MAXSTRING, FP) == NULL)
{
if (allocated) cfree (line);
***************
*** 568,572 ****
void ChangeDomain ()
{
! char domain_name[80], s[80];
register int i;
--- 620,624 ----
void ChangeDomain ()
{
! char domain_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
register int i;
***************
*** 611,615 ****
{
struct ObjRec * obj_ptr, * saved_top_obj, * saved_bot_obj;
! char file_name[80], s[80], full_name[MAXPATHLENGTH];
FILE * fp;
--- 663,668 ----
{
struct ObjRec * obj_ptr, * saved_top_obj, * saved_bot_obj;
! char file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
! char full_name[MAXPATHLENGTH];
FILE * fp;
***************
*** 645,649 ****
fclose (fp);
importingFile = FALSE;
! if (topObj != NULL) fileModified = TRUE;
RedrawDrawWindow (botObj);
--- 698,702 ----
fclose (fp);
importingFile = FALSE;
! if (topObj != NULL) SetFileModified (TRUE);
RedrawDrawWindow (botObj);
***************
*** 668,672 ****
{
struct ObjRec * obj_ptr;
! char file_name[80], s[80], full_name[MAXPATHLENGTH];
FILE * fp;
--- 721,726 ----
{
struct ObjRec * obj_ptr;
! char file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
! char full_name[MAXPATHLENGTH];
FILE * fp;
***************
*** 712,716 ****
curFileDefined = TRUE;
! fileModified = FALSE;
sprintf (s, "Current file is '%s'.", file_name);
Msg (s);
--- 766,770 ----
curFileDefined = TRUE;
! SetFileModified (FALSE);
sprintf (s, "Current file is '%s'.", file_name);
Msg (s);
***************
*** 777,786 ****
}
void Dump ()
{
register struct ObjRec * obj_ptr;
! char cmd[256], tmp_str[256];
int i, len;
! FILE * fp;
if (botObj == NULL) { Msg ("No object to print."); return; }
--- 831,886 ----
}
+ void DumpBBox (fp)
+ FILE * fp;
+ {
+ register struct ObjRec * obj_ptr;
+ int ltx, lty, rbx, rby;
+ double llx1, lly1, urx1, ury1, real_ps_dots_per_inch;
+
+ if ((obj_ptr = topObj) == NULL)
+ {
+ fprintf (fp, "%%%%BoundingBox: 0 0 0 0\n");
+ printf ("Warning: The PostScript bounding box is empty!\n");
+ Msg ("Warning: The PostScript bounding box is empty!\n");
+ return;
+ }
+
+ ltx = obj_ptr->bbox.ltx; lty = obj_ptr->bbox.lty;
+ rbx = obj_ptr->bbox.rbx; rby = obj_ptr->bbox.rby;
+
+ for (obj_ptr = topObj->next; obj_ptr != NULL; obj_ptr = obj_ptr->next)
+ {
+ if (obj_ptr->bbox.ltx < ltx) ltx = obj_ptr->bbox.ltx;
+ if (obj_ptr->bbox.lty < lty) lty = obj_ptr->bbox.lty;
+ if (obj_ptr->bbox.rbx > rbx) rbx = obj_ptr->bbox.rbx;
+ if (obj_ptr->bbox.rby > rby) rby = obj_ptr->bbox.rby;
+ }
+
+ switch (pageStyle)
+ {
+ case PORTRAIT: real_ps_dots_per_inch = psDotsPerInch; break;
+ case LANDSCAPE: real_ps_dots_per_inch = psDotsPerInch; break;
+ case HIGHPORT: real_ps_dots_per_inch = psDotsPerInch/2.0; break;
+ case HIGHLAND: real_ps_dots_per_inch = psDotsPerInch/2.0; break;
+ case SLIDEPORT: real_ps_dots_per_inch = psDotsPerInch*2.0; break;
+ case SLIDELAND: real_ps_dots_per_inch = psDotsPerInch*2.0; break;
+ }
+
+ llx1 = 1.0*ltx*real_ps_dots_per_inch/(PIX_PER_INCH);
+ lly1 = -1.0*rby*real_ps_dots_per_inch/(PIX_PER_INCH);
+ urx1 = 1.0*rbx*real_ps_dots_per_inch/(PIX_PER_INCH);
+ ury1 = -1.0*lty*real_ps_dots_per_inch/(PIX_PER_INCH);
+
+ fprintf (fp,"%%%%BoundingBox: %.3f %.3f %.3f %.3f\n",llx1,lly1,urx1,ury1);
+ }
+
void Dump ()
{
register struct ObjRec * obj_ptr;
! char * c_ptr, cmd[MAXSTRING+1], tmp_str[MAXSTRING+1];
! char tmp_file[MAXSTRING+1], ps_file[MAXSTRING+1];
! char message[MAXSTRING+1];
int i, len;
! FILE * fp, * fps;
if (botObj == NULL) { Msg ("No object to print."); return; }
***************
*** 787,841 ****
Msg ("Generating print file ...");
! system ("rm -f /tmp/DRAW.PS /tmp/DUMP.PS");
! if ((fp = fopen ("/tmp/DUMP.PS", "w")) == NULL)
{
! Msg ("Can not create /tmp/DUMP.PS, print aborted.");
return;
}
! for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev)
! DumpAllObj (fp, obj_ptr);
! fprintf (fp, "grestore\n\n");
! fprintf (fp, "showpage\n");
! fclose (fp);
!
switch (pageStyle)
{
- case PORTRAIT:
- sprintf (cmd, "cat %s/.psmac %s/.port /tmp/DUMP.PS > /tmp/DRAW.PS",
- drawPath, drawPath);
- break;
case LANDSCAPE:
- sprintf (cmd, "cat %s/.psmac %s/.land /tmp/DUMP.PS > /tmp/DRAW.PS",
- drawPath, drawPath);
- break;
- case HIGHPORT:
- sprintf (cmd, "cat %s/.psmac %s/.hiport /tmp/DUMP.PS > /tmp/DRAW.PS",
- drawPath, drawPath);
- break;
case HIGHLAND:
! sprintf (cmd, "cat %s/.psmac %s/.hiland /tmp/DUMP.PS > /tmp/DRAW.PS",
! drawPath, drawPath);
! break;
! case SLIDEPORT:
! sprintf (cmd, "cat %s/.psmac %s/.slideport /tmp/DUMP.PS > /tmp/DRAW.PS",
! drawPath, drawPath);
! break;
! case SLIDELAND:
! sprintf (cmd, "cat %s/.psmac %s/.slideland /tmp/DUMP.PS > /tmp/DRAW.PS",
! drawPath, drawPath);
! break;
}
! system (cmd);
! chmod ("/tmp/DRAW.PS", 0777);
! chmod ("/tmp/DUMP.PS", 0777);
switch (whereToPrint)
{
case PRINTER:
! system ("lpr /tmp/DRAW.PS &");
! Msg ("Printing in background.");
break;
case LATEX_FIG:
--- 887,955 ----
Msg ("Generating print file ...");
+ strcpy (tmp_file, "/tmp/TgifXXXXXX");
+ mktemp (tmp_file);
+ unlink (tmp_file);
! if ((fp = fopen (tmp_file, "w")) == NULL)
{
! sprintf (tmp_str, "Can not create %s, print aborted.", tmp_file);
! Msg (tmp_str);
return;
}
! fprintf (fp, "%%!\n");
! DumpBBox (fp);
! sprintf(ps_file, "%s/.psmac", drawPath);
! if ((fps = fopen (ps_file, "r")) == NULL)
! {
! sprintf (message, "Can not find %s, print aborted.", ps_file);
! Msg (message);
! fclose (fp);
! unlink (tmp_file);
! return;
! }
! while (fgets (tmp_str, MAXSTRING, fps) != NULL) /* copy the header file */
! fputs (tmp_str, fp);
! fprintf (fp, "gsave\n\n");
switch (pageStyle)
{
case LANDSCAPE:
case HIGHLAND:
! case SLIDELAND: fprintf (fp, "90 rotate\n"); break;
}
! fprintf (fp, "%1d %s mul %1d %s mul translate\n", psDotsPerInch,
! psXOffStr[pageStyle], psDotsPerInch, psYOffStr[pageStyle]);
! fprintf (fp, "%s -%s scale\n\n",
! psScaleStr[pageStyle], psScaleStr[pageStyle]);
+ for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev)
+ DumpAllObj (fp, obj_ptr);
+
+ fprintf (fp, "grestore\n\n");
+ fprintf (fp, "showpage\n");
+ fclose (fp);
+
switch (whereToPrint)
{
case PRINTER:
! if ((c_ptr = XGetDefault (mainDisplay,"Tgif","PrintCommand")) != NULL)
! sprintf (cmd, "%s %s 2>&1", c_ptr, tmp_file);
! else
! sprintf (cmd, "lpr %s 2>&1", tmp_file);
!
! if ((fp = popen (cmd, "r")) == NULL)
! {
! sprintf (message, "Can not execute '%s', print aborted.", cmd);
! Msg (message);
! unlink (tmp_file);
! return;
! }
! while (fgets (tmp_str, MAXSTRING, fp) != NULL)
! {
! Msg (tmp_str);
! sleep (5);
! }
! pclose (fp);
break;
case LATEX_FIG:
***************
*** 843,870 ****
{
Dialog ("No current file. Can not generate LaTeX output!", cmd);
return;
}
! strcpy (tmp_str, curDomainName);
! if (*curDomainName != '\0') strcat (tmp_str, "/");
! strcat (tmp_str, curFileName);
! len = strlen (tmp_str);
! for (i = len-1; tmp_str[i] != '.'; i--) ;
! strcpy (&tmp_str[i], ".ps");
! if ((fp = fopen (tmp_str, "w")) == NULL)
{
! sprintf (cmd, "Can not open %s, file not saved.", tmp_str);
! Msg (cmd);
return;
}
! fclose (fp);
! /* tmp_str[i] = '\0'; */
! sprintf (cmd, "Printing into '%s'.", tmp_str);
! Msg (cmd);
! sprintf (cmd, "rm -f %s; tgif2ps < /tmp/DRAW.PS > %s; chmod 660 %s",
! tmp_str, tmp_str, tmp_str);
! system (cmd);
break;
}
}
--- 957,990 ----
{
Dialog ("No current file. Can not generate LaTeX output!", cmd);
+ unlink (tmp_file);
return;
}
! 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--) ;
! strcpy (&ps_file[i], ".ps");
! sprintf (cmd, "Printing into '%s'.", ps_file);
! Msg (cmd);
! sprintf (cmd, "tgif2ps < %s 1> %s 2>&1; chmod %s %s", tmp_file,
! ps_file, PSFILE_MOD, ps_file);
! if ((fp = popen (cmd, "r")) == NULL)
{
! sprintf (message, "Can not execute '%s', file not saved.", cmd);
! Msg (message);
! unlink (tmp_file);
return;
}
! while (fgets(tmp_str, MAXSTRING, fp) != NULL)
! {
! Msg (tmp_str);
! sleep (5);
! }
! pclose (fp);
break;
}
+ unlink (tmp_file);
}
***************
*** 871,875 ****
void NewProc ()
{
! char s[80];
if (fileModified)
--- 991,995 ----
void NewProc ()
{
! char s[MAXPATHLENGTH];
if (fileModified)
***************
*** 881,885 ****
case CONFIRM_CANCEL: return;
}
! fileModified = FALSE;
}
CleanUpDrawingWindow ();
--- 1001,1005 ----
case CONFIRM_CANCEL: return;
}
! SetFileModified (FALSE);
}
CleanUpDrawingWindow ();
*** font.c.orig Wed Jun 27 13:27:40 1990
--- font.c Wed Jun 27 13:27:42 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/font.c,v 1.1 90/04/01 22:16:16 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/font.c,v 1.2 90/06/26 00:05:27 william Exp $";
#endif
***************
*** 398,402 ****
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale),
selRbY+(1<<zoomScale));
! fileModified = TRUE;
HighLightForward ();
}
--- 398,402 ----
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale),
selRbY+(1<<zoomScale));
! SetFileModified (TRUE);
HighLightForward ();
}
***************
*** 448,452 ****
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale),
selRbY+(1<<zoomScale));
! fileModified = TRUE;
HighLightForward ();
}
--- 448,452 ----
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale),
selRbY+(1<<zoomScale));
! SetFileModified (TRUE);
HighLightForward ();
}
***************
*** 565,569 ****
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale),
selRbY+(1<<zoomScale));
! fileModified = TRUE;
HighLightForward ();
}
--- 565,569 ----
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale),
selRbY+(1<<zoomScale));
! SetFileModified (TRUE);
HighLightForward ();
}
***************
*** 676,680 ****
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale),
selRbY+(1<<zoomScale));
! fileModified = TRUE;
HighLightForward ();
}
--- 676,680 ----
selLtY-(1<<zoomScale), selRbX+(1<<zoomScale),
selRbY+(1<<zoomScale));
! SetFileModified (TRUE);
HighLightForward ();
}
*** grid.c.orig Wed Jun 27 13:28:00 1990
--- grid.c Wed Jun 27 13:28:02 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/grid.c,v 1.1 90/04/01 22:16:18 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/grid.c,v 1.4 90/06/26 00:05:37 william Exp $";
#endif
***************
*** 44,48 ****
for (x = XStart; x < XEnd; x += 8)
/* XDrawPoint (mainDisplay, Win, defaultGC, x, Y); */
! /* Hack to run on RTs -- stupid IBM */
XDrawLine (mainDisplay, Win, defaultGC, x, Y, x, Y);
}
--- 44,48 ----
for (x = XStart; x < XEnd; x += 8)
/* XDrawPoint (mainDisplay, Win, defaultGC, x, Y); */
! /* Hack to run on RTs -- crash server on RTs */
XDrawLine (mainDisplay, Win, defaultGC, x, Y, x, Y);
}
***************
*** 56,60 ****
for (y = YStart; y < YEnd; y += 8)
/* XDrawPoint (mainDisplay, Win, defaultGC, X, y); */
! /* Hack to run on RTs -- stupid IBM */
XDrawLine (mainDisplay, Win, defaultGC, X, y, X, y);
}
--- 56,60 ----
for (y = YStart; y < YEnd; y += 8)
/* XDrawPoint (mainDisplay, Win, defaultGC, X, y); */
! /* Hack to run on RTs -- crash server on RTs */
XDrawLine (mainDisplay, Win, defaultGC, X, y, X, y);
}
***************
*** 64,68 ****
register int i, inc = HALF_INCH, abs_grid = HALF_INCH<<zoomScale;
int x_start, y_start, x_end, y_end, x_grid_start, y_grid_start;
! int pixel = myWhitePixel;
if (!gridShown) return;
--- 64,68 ----
register int i, inc = HALF_INCH, abs_grid = HALF_INCH<<zoomScale;
int x_start, y_start, x_end, y_end, x_grid_start, y_grid_start;
! int pixel = myFgPixel;
if (!gridShown) return;
***************
*** 102,106 ****
int x_start, y_start, x_end, y_end;
int x_grid_start, y_grid_start, x_grid_end, y_grid_end;
! int pixel = myWhitePixel;
if (!gridShown) return;
--- 102,106 ----
int x_start, y_start, x_end, y_end;
int x_grid_start, y_grid_start, x_grid_end, y_grid_end;
! int pixel = myFgPixel;
if (!gridShown) return;
***************
*** 475,479 ****
}
RedrawRulers ();
! fileModified = TRUE;
Msg ("Page style changed to Landscape.");
}
--- 475,479 ----
}
RedrawRulers ();
! SetFileModified (TRUE);
Msg ("Page style changed to Landscape.");
}
***************
*** 488,492 ****
}
RedrawRulers ();
! fileModified = TRUE;
Msg ("Page style changed to Portrait.");
}
--- 488,492 ----
}
RedrawRulers ();
! SetFileModified (TRUE);
Msg ("Page style changed to Portrait.");
}
***************
*** 501,505 ****
}
RedrawRulers ();
! fileModified = TRUE;
Msg ("Page style changed to HighLand.");
}
--- 501,505 ----
}
RedrawRulers ();
! SetFileModified (TRUE);
Msg ("Page style changed to HighLand.");
}
***************
*** 514,518 ****
}
RedrawRulers ();
! fileModified = TRUE;
Msg ("Page style changed to HighPort.");
}
--- 514,518 ----
}
RedrawRulers ();
! SetFileModified (TRUE);
Msg ("Page style changed to HighPort.");
}
***************
*** 527,531 ****
}
RedrawRulers ();
! fileModified = TRUE;
Msg ("Page style changed to SlideLand.");
}
--- 527,531 ----
}
RedrawRulers ();
! SetFileModified (TRUE);
Msg ("Page style changed to SlideLand.");
}
***************
*** 540,544 ****
}
RedrawRulers ();
! fileModified = TRUE;
Msg ("Page style changed to SlidePort.");
}
--- 540,544 ----
}
RedrawRulers ();
! SetFileModified (TRUE);
Msg ("Page style changed to SlidePort.");
}
*** group.c.orig Wed Jun 27 13:28:09 1990
--- group.c Wed Jun 27 13:28:10 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/group.c,v 1.1 90/04/01 22:16:19 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/group.c,v 1.2 90/06/26 00:05:45 william Exp $";
#endif
***************
*** 238,242 ****
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! fileModified = TRUE;
justDupped = FALSE;
}
--- 238,242 ----
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! SetFileModified (TRUE);
justDupped = FALSE;
}
*** mainloop.c.orig Wed Jun 27 13:28:17 1990
--- mainloop.c Wed Jun 27 13:28:18 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/mainloop.c,v 1.2 90/05/07 15:15:33 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/mainloop.c,v 1.4 90/06/26 00:10:31 william Exp $";
#endif
***************
*** 183,187 ****
curFileDefined = TRUE;
! fileModified = FALSE;
sprintf (s, "Current file is '%s'.", file_name);
Msg (s);
--- 183,187 ----
curFileDefined = TRUE;
! SetFileModified (FALSE);
sprintf (s, "Current file is '%s'.", file_name);
Msg (s);
---------------------------------> 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
----------------------------------------------------
O'Reilly && Associates argv@sun.com / argv@ora.com
Opinions expressed reflect those of the author only.