v08i047: tgif 1.9, Patch1, Part02/03
William Cheng
william at CS.UCLA.EDU
Mon Jul 9 17:22:15 AEST 1990
Submitted-by: william at CS.UCLA.EDU (William Cheng)
Posting-number: Volume 8, Issue 47
Archive-name: tgif/patch2.02
Patch-To: tgif: Volume 7, Issue 56-76
Here is part 02 of the patch that 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 <---------------------------------
*** menu.c.orig Wed Jun 27 13:28:30 1990
--- menu.c Wed Jun 27 13:28:32 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/menu.c,v 1.3 90/05/15 09:26:57 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/menu.c,v 1.10 90/06/25 23:58:20 william Exp $";
#endif
***************
*** 34,37 ****
--- 34,38 ----
#include "special.e"
#include "text.e"
+ #include "version.e"
int iconWindowCreated = FALSE;
***************
*** 55,59 ****
int * len, dsp_w, dsp_h, menu_w, menu_h;
unsigned int status;
! int brdr_pixel, bg_pixel, root_x, root_y;
XGCValues values;
XEvent input;
--- 56,60 ----
int * len, dsp_w, dsp_h, menu_w, menu_h;
unsigned int status;
! int root_x, root_y;
XGCValues values;
XEvent input;
***************
*** 77,89 ****
OrigY = dsp_h - 1 - 2*brdrW - menu_h;
- brdr_pixel = myWhitePixel;
- bg_pixel = myBlackPixel;
-
if ((window = XCreateSimpleWindow (mainDisplay, rootWindow, OrigX, OrigY,
! menu_w, menu_h, 2*brdrW, brdr_pixel, bg_pixel)) == 0)
{ printf ("Could not create desired menu window!\n"); exit (-1); }
win_attrs.save_under = True;
! XChangeWindowAttributes (mainDisplay, window, CWSaveUnder, &win_attrs);
old_selected = INVALID;
--- 78,89 ----
OrigY = dsp_h - 1 - 2*brdrW - menu_h;
if ((window = XCreateSimpleWindow (mainDisplay, rootWindow, OrigX, OrigY,
! menu_w, menu_h, 2*brdrW, myBorderPixel, myBgPixel)) == 0)
{ printf ("Could not create desired menu window!\n"); exit (-1); }
win_attrs.save_under = True;
! win_attrs.override_redirect = True;
! XChangeWindowAttributes (mainDisplay, window,
! CWSaveUnder | CWOverrideRedirect, &win_attrs);
old_selected = INVALID;
***************
*** 92,96 ****
--- 92,99 ----
XMapWindow (mainDisplay, window);
XSelectInput (mainDisplay, window, ExposureMask);
+ XWarpPointer (mainDisplay, None, rootWindow, 0, 0, 0, 0, OrigX-2, OrigY-2);
+ XSync (mainDisplay, False);
+
XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
&root_y, &x, &y, &status);
***************
*** 98,133 ****
while (XCheckWindowEvent (mainDisplay, window, ExposureMask, &input)) ;
! while (menuing)
{
! if (XPending (mainDisplay) != 0)
{
! XNextEvent (mainDisplay, &input);
! if (input.type == Expose)
! {
! y = defaultFontAsc;
! if (MultiColor)
! {
! for (i = 0; i < Entries; i++, y += defaultFontHeight)
! {
! XSetForeground (mainDisplay, textMenuGC, ForeColors[i]);
! XDrawString (mainDisplay, window, textMenuGC, 0, y,
! Strings[i], len[i]);
! }
! }
! else
! {
! XSetForeground (mainDisplay, textMenuGC, ForeColors[0]);
! for (i = 0; i < Entries; i++, y += defaultFontHeight)
! XDrawString (mainDisplay, window, textMenuGC, 0, y,
! Strings[i], len[i]);
! }
! XGrabPointer (mainDisplay, window, FALSE, ButtonReleaseMask,
! GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
! XWarpPointer (mainDisplay, None, rootWindow, 0, 0, 0, 0, OrigX-2,
! OrigY-2);
! continue;
! }
}
XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
&root_y, &x, &y, &status);
--- 101,126 ----
while (XCheckWindowEvent (mainDisplay, window, ExposureMask, &input)) ;
! y = defaultFontAsc;
! if (MultiColor)
{
! for (i = 0; i < Entries; i++, y += defaultFontHeight)
{
! XSetForeground (mainDisplay, textMenuGC, ForeColors[i]);
! XDrawString (mainDisplay, window, textMenuGC, 0, y,
! Strings[i], len[i]);
}
+ }
+ else
+ {
+ XSetForeground (mainDisplay, textMenuGC, ForeColors[0]);
+ for (i = 0; i < Entries; i++, y += defaultFontHeight)
+ XDrawString (mainDisplay, window, textMenuGC, 0, y,
+ Strings[i], len[i]);
+ }
+ XGrabPointer (mainDisplay, window, FALSE, None,
+ GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
+ while (menuing)
+ {
XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
&root_y, &x, &y, &status);
***************
*** 152,156 ****
if (old_selected != INVALID && Valid[old_selected])
{
! XSetForeground (mainDisplay, textMenuGC, bg_pixel);
XFillRectangle (mainDisplay, window, textMenuGC, 0,
old_selected*defaultFontHeight, menu_w, defaultFontHeight);
--- 145,149 ----
if (old_selected != INVALID && Valid[old_selected])
{
! XSetForeground (mainDisplay, textMenuGC, myBgPixel);
XFillRectangle (mainDisplay, window, textMenuGC, 0,
old_selected*defaultFontHeight, menu_w, defaultFontHeight);
***************
*** 167,171 ****
XFillRectangle (mainDisplay, window, textMenuGC, 0,
new_selected*defaultFontHeight, menu_w, defaultFontHeight);
! XSetForeground (mainDisplay, textMenuGC, bg_pixel);
XDrawString (mainDisplay, window, textMenuGC, 0,
defaultFontAsc+new_selected*defaultFontHeight,
--- 160,164 ----
XFillRectangle (mainDisplay, window, textMenuGC, 0,
new_selected*defaultFontHeight, menu_w, defaultFontHeight);
! XSetForeground (mainDisplay, textMenuGC, myBgPixel);
XDrawString (mainDisplay, window, textMenuGC, 0,
defaultFontAsc+new_selected*defaultFontHeight,
***************
*** 179,183 ****
if (Valid[old_selected])
{
! XSetForeground (mainDisplay, textMenuGC, bg_pixel);
XFillRectangle (mainDisplay, window, textMenuGC, 0,
old_selected*defaultFontHeight, menu_w, defaultFontHeight);
--- 172,176 ----
if (Valid[old_selected])
{
! XSetForeground (mainDisplay, textMenuGC, myBgPixel);
XFillRectangle (mainDisplay, window, textMenuGC, 0,
old_selected*defaultFontHeight, menu_w, defaultFontHeight);
***************
*** 210,214 ****
int rc = INVALID, old_i, old_j, k, toggle = 0, dsp_w, dsp_h;
unsigned int status;
! int brdr_pixel, bg_pixel, root_x, root_y;
XGCValues values;
XEvent input;
--- 203,207 ----
int rc = INVALID, old_i, old_j, k, toggle = 0, dsp_w, dsp_h;
unsigned int status;
! int root_x, root_y;
XGCValues values;
XEvent input;
***************
*** 226,238 ****
OrigY = dsp_h - 1 - 2*brdrW - menu_h;
- brdr_pixel = myWhitePixel;
- bg_pixel = myBlackPixel;
-
if ((window = XCreateSimpleWindow (mainDisplay, rootWindow, OrigX, OrigY,
! menu_w, menu_h, 2*brdrW, brdr_pixel, bg_pixel)) == 0)
{ printf ("Could not create desired menu window!\n"); exit (-1); }
win_attrs.save_under = True;
! XChangeWindowAttributes (mainDisplay, window, CWSaveUnder, &win_attrs);
old_selected = INVALID;
--- 219,230 ----
OrigY = dsp_h - 1 - 2*brdrW - menu_h;
if ((window = XCreateSimpleWindow (mainDisplay, rootWindow, OrigX, OrigY,
! menu_w, menu_h, 2*brdrW, myBorderPixel, myBgPixel)) == 0)
{ printf ("Could not create desired menu window!\n"); exit (-1); }
win_attrs.save_under = True;
! win_attrs.override_redirect = True;
! XChangeWindowAttributes (mainDisplay, window,
! CWSaveUnder | CWOverrideRedirect, &win_attrs);
old_selected = INVALID;
***************
*** 241,245 ****
--- 233,240 ----
XMapWindow (mainDisplay, window);
XSelectInput (mainDisplay, window, ExposureMask);
+ XWarpPointer (mainDisplay, None, rootWindow, 0, 0, 0, 0, OrigX-2, OrigY-2);
+ XSync (mainDisplay, False);
+
XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
&root_y, &x, &y, &status);
***************
*** 247,288 ****
while (XCheckWindowEvent (mainDisplay, window, ExposureMask, &input)) ;
! while (menuing)
! {
! if (XPending (mainDisplay) != 0)
{
! XNextEvent (mainDisplay, &input);
! if (input.type == Expose)
{
! for (i = 0; i < Rows; i++)
! for (j = 0; j < Cols; j++)
! {
! k = i + j * Rows;
! if (MultiColor)
! {
! if (k >= Entries)
! values.foreground = myBlackPixel;
! else
! values.foreground = ForeColors[k];
! values.stipple = patPixmap[1];
! XChangeGC (mainDisplay, rasterGC,
! GCForeground | GCStipple, &values);
! XFillRectangle (mainDisplay, window, rasterGC,
! j*W, i*H, W, H);
! }
! else
! {
! XSetStipple (mainDisplay, rasterGC, PxMp[k]);
! XFillRectangle (mainDisplay, window, rasterGC,
! j*W, i*H, W, H);
! }
! }
! XGrabPointer (mainDisplay, window, FALSE, ButtonReleaseMask,
! GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
! XWarpPointer (mainDisplay, None, rootWindow, 0, 0, 0, 0, OrigX-2,
! OrigY-2);
! continue;
}
}
XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
&root_y, &x, &y, &status);
--- 242,272 ----
while (XCheckWindowEvent (mainDisplay, window, ExposureMask, &input)) ;
! for (i = 0; i < Rows; i++)
! for (j = 0; j < Cols; j++)
{
! k = i + j * Rows;
! if (MultiColor)
{
! if (k >= Entries)
! values.foreground = myBgPixel;
! else
! values.foreground = ForeColors[k];
! values.stipple = patPixmap[1];
! XChangeGC (mainDisplay, rasterGC,
! GCForeground | GCStipple, &values);
! XFillRectangle (mainDisplay, window, rasterGC, j*W, i*H, W, H);
}
+ else
+ {
+ XSetStipple (mainDisplay, rasterGC, PxMp[k]);
+ XFillRectangle (mainDisplay, window, rasterGC, j*W, i*H, W, H);
+ }
}
+ XGrabPointer (mainDisplay, window, FALSE, ButtonReleaseMask,
+ GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
+
+ while (menuing)
+ {
XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
&root_y, &x, &y, &status);
***************
*** 314,318 ****
{
if (old_selected >= Entries)
! values.foreground = myBlackPixel;
else
values.foreground = ForeColors[old_selected];
--- 298,302 ----
{
if (old_selected >= Entries)
! values.foreground = myBgPixel;
else
values.foreground = ForeColors[old_selected];
***************
*** 325,329 ****
else
{
! values.foreground = myWhitePixel;
values.stipple = PxMp[old_selected];
XChangeGC (mainDisplay, rasterGC,
--- 309,313 ----
else
{
! values.foreground = myFgPixel;
values.stipple = PxMp[old_selected];
XChangeGC (mainDisplay, rasterGC,
***************
*** 353,357 ****
{
if (old_selected >= Entries)
! values.foreground = myBlackPixel;
else
values.foreground = ForeColors[old_selected];
--- 337,341 ----
{
if (old_selected >= Entries)
! values.foreground = myBgPixel;
else
values.foreground = ForeColors[old_selected];
***************
*** 364,368 ****
else
{
! values.foreground = myWhitePixel;
values.stipple = PxMp[old_selected];
XChangeGC (mainDisplay, rasterGC,
--- 348,352 ----
else
{
! values.foreground = myFgPixel;
values.stipple = PxMp[old_selected];
XChangeGC (mainDisplay, rasterGC,
***************
*** 374,378 ****
}
}
! values.foreground = myWhitePixel;
XChangeGC (mainDisplay, rasterGC, GCForeground, &values);
--- 358,362 ----
}
}
! values.foreground = myFgPixel;
XChangeGC (mainDisplay, rasterGC, GCForeground, &values);
***************
*** 457,468 ****
{
int y, len, amount, left;
! char file_name[80], s[256];
! len = strlen (TOOL_NAME);
amount = defaultFontWidth * len;
left = (titleWindowW - amount) / 2;
! XDrawString (mainDisplay, titleWindow, defaultGC, left,
! defaultFontAsc+2, TOOL_NAME, len);
for (y = 4; y < titleWindowH/2-4; y += 2)
--- 441,456 ----
{
int y, len, amount, left;
! char file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
! strcpy (s, TOOL_NAME);
! strcat (s, "-");
! strcat (s, version_string);
!
! len = strlen (s);
amount = defaultFontWidth * len;
left = (titleWindowW - amount) / 2;
! XDrawString (mainDisplay, titleWindow, defaultGC, left, defaultFontAsc+2, s,
! len);
for (y = 4; y < titleWindowH/2-4; y += 2)
***************
*** 474,477 ****
--- 462,466 ----
}
+ s[0] = '\0';
XClearArea (mainDisplay, titleWindow, 0, titleWindowH/2, titleWindowW,
titleWindowH/2, FALSE);
***************
*** 482,493 ****
if (*curDomainName != '\0') strcat (s, "/");
strcat (s, file_name);
! len = strlen(s);
! left = 2+(len+1)*defaultFontWidth;
XDrawString (mainDisplay, titleWindow, defaultGC, 2,
titleWindowH/2+defaultFontAsc+2, s, len);
}
- else
- left = 2;
}
--- 471,484 ----
if (*curDomainName != '\0') strcat (s, "/");
strcat (s, file_name);
! }
+ if (fileModified) strcat (s, " [Modified]");
+
+ if (s[0] != '\0')
+ {
+ len = strlen (s);
XDrawString (mainDisplay, titleWindow, defaultGC, 2,
titleWindowH/2+defaultFontAsc+2, s, len);
}
}
***************
*** 508,512 ****
{
struct ObjRec * obj_ptr;
! char s[256], * c_ptr;
FILE * fp;
int ltx = 0, lty = 0, rbx = 0, rby = 0, seen_obj = FALSE;
--- 499,503 ----
{
struct ObjRec * obj_ptr;
! char s[MAXPATHLENGTH], * c_ptr;
FILE * fp;
int ltx = 0, lty = 0, rbx = 0, rby = 0, seen_obj = FALSE;
***************
*** 591,596 ****
XGCValues values;
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.fill_style = FillSolid;
values.font = defaultFontPtr->fid;
--- 582,587 ----
XGCValues values;
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.fill_style = FillSolid;
values.font = defaultFontPtr->fid;
***************
*** 673,681 ****
if ((iconBaseWindow = XCreateSimpleWindow (mainDisplay, rootWindow,
sizehints.x, sizehints.y, iconWindowW+2*brdrW, iconWindowH+2*brdrW,
! brdrW, myWhitePixel, myBlackPixel)) == 0)
{ printf ("Could not create icon window!\n"); exit(1); }
if ((iconWindow = XCreateSimpleWindow (mainDisplay, iconBaseWindow, 0, 0,
! iconWindowW, iconWindowH, brdrW, myWhitePixel, myBlackPixel)) == 0)
{ printf ("Could not create icon window!\n"); exit(1); }
--- 664,672 ----
if ((iconBaseWindow = XCreateSimpleWindow (mainDisplay, rootWindow,
sizehints.x, sizehints.y, iconWindowW+2*brdrW, iconWindowH+2*brdrW,
! brdrW, myBorderPixel, myBgPixel)) == 0)
{ printf ("Could not create icon window!\n"); exit(1); }
if ((iconWindow = XCreateSimpleWindow (mainDisplay, iconBaseWindow, 0, 0,
! iconWindowW, iconWindowH, brdrW, myBorderPixel, myBgPixel)) == 0)
{ printf ("Could not create icon window!\n"); exit(1); }
*** move.c.orig Wed Jun 27 13:28:40 1990
--- move.c Wed Jun 27 13:28:42 1990
***************
*** 7,11 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/move.c,v 1.2 90/05/17 09:17:01 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.5 90/06/26 00:11:08 william Exp $";
#endif
#include <stdio.h>
***************
*** 124,135 ****
struct PolygonRec * polygon_ptr;
struct BBRec bbox, o_bbox;
- Window root_win, child_win;
- int root_x, root_y;
XPoint * v;
- unsigned int status;
- XButtonEvent input;
int ltx, lty, rbx, rby, sel_ltx, sel_lty, sel_rbx, sel_rby;
int x, y, moving = TRUE, dx, dy;
! int grid_x = OrigX, grid_y = OrigY, new_grid_x, new_grid_y;
sel_ltx = OFFSET_X(selLtX) - 1; sel_lty = OFFSET_Y(selLtY) - 1;
--- 124,132 ----
struct PolygonRec * polygon_ptr;
struct BBRec bbox, o_bbox;
XPoint * v;
int ltx, lty, rbx, rby, sel_ltx, sel_lty, sel_rbx, sel_rby;
int x, y, moving = TRUE, dx, dy;
! int grid_x = OrigX, grid_y = OrigY;
! XEvent input;
sel_ltx = OFFSET_X(selLtX) - 1; sel_lty = OFFSET_Y(selLtY) - 1;
***************
*** 188,193 ****
}
! XGrabPointer (mainDisplay, drawWindow, FALSE, ButtonReleaseMask,
! GrabModeAsync, GrabModeAsync, None, defaultCursor, CurrentTime);
dx = dy = 0;
--- 185,191 ----
}
! XGrabPointer (mainDisplay, drawWindow, FALSE,
! PointerMotionMask | ButtonReleaseMask,
! GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
dx = dy = 0;
***************
*** 195,255 ****
while (moving)
{
! XQueryPointer (mainDisplay, drawWindow, &root_win, &child_win,
! &root_x, &root_y, &x, &y, &status);
!
! GridXY (x, y, &new_grid_x, &new_grid_y);
! if (new_grid_x==grid_x && new_grid_y==grid_y && (status & Button1Mask)!=0)
! continue;
!
! grid_x = new_grid_x;
! grid_y = new_grid_y;
!
! switch (ObjPtr->type)
{
- case OBJ_BOX:
- case OBJ_TEXT:
- SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
- break;
- case OBJ_OVAL:
- o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy;
- o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy;
- MyOval (drawWindow, revDefaultGC, o_bbox);
- break;
- case OBJ_POLY:
- case OBJ_POLYGON:
- for (i = 0; i < num_pts; i++)
- {
- v[i].x += dx;
- v[i].y += dy;
- }
- XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts,
- CoordModeOrigin);
- for (i = 0; i < num_pts; i++)
- {
- v[i].x -= dx;
- v[i].y -= dy;
- }
- break;
- case OBJ_GROUP:
- case OBJ_SYM:
- case OBJ_ICON:
- SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
- break;
- }
- SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx,
- sel_rby+dy);
-
- dx = grid_x - OrigX;
- dy = grid_y - OrigY;
-
- if ((status & Button1Mask) == 0)
- {
- /* mouse is up */
XUngrabPointer (mainDisplay, CurrentTime);
MarkRulers (grid_x, grid_y);
moving = FALSE;
switch (ObjPtr->type)
{
case OBJ_POLY:
case OBJ_POLYGON: cfree(v); break;
}
--- 193,244 ----
while (moving)
{
! XNextEvent (mainDisplay, &input);
! if (input.type == ButtonRelease)
{
XUngrabPointer (mainDisplay, CurrentTime);
MarkRulers (grid_x, grid_y);
moving = FALSE;
+
switch (ObjPtr->type)
{
+ case OBJ_BOX:
+ case OBJ_TEXT:
+ SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
+ break;
+ case OBJ_OVAL:
+ o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy;
+ o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy;
+ MyOval (drawWindow, revDefaultGC, o_bbox);
+ break;
case OBJ_POLY:
+ case OBJ_POLYGON:
+ for (i = 0; i < num_pts; i++)
+ {
+ v[i].x += dx;
+ v[i].y += dy;
+ }
+ XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts,
+ CoordModeOrigin);
+ for (i = 0; i < num_pts; i++)
+ {
+ v[i].x -= dx;
+ v[i].y -= dy;
+ }
+ break;
+ case OBJ_GROUP:
+ case OBJ_SYM:
+ case OBJ_ICON:
+ SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
+ break;
+ }
+ SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx,
+ sel_rby+dy);
+
+ dx = grid_x - OrigX;
+ dy = grid_y - OrigY;
+
+ switch (ObjPtr->type)
+ {
+ case OBJ_POLY:
case OBJ_POLYGON: cfree(v); break;
}
***************
*** 271,279 ****
dupDy += dy;
}
! fileModified = TRUE;
}
}
! else
{
MarkRulers (grid_x, grid_y);
SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx,
--- 260,310 ----
dupDy += dy;
}
! SetFileModified (TRUE);
}
}
! else if (input.type == MotionNotify)
{
+ x = input.xmotion.x;
+ y = input.xmotion.y;
+ GridXY (x, y, &grid_x, &grid_y);
+
+ switch (ObjPtr->type)
+ {
+ case OBJ_BOX:
+ case OBJ_TEXT:
+ SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
+ break;
+ case OBJ_OVAL:
+ o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy;
+ o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy;
+ MyOval (drawWindow, revDefaultGC, o_bbox);
+ break;
+ case OBJ_POLY:
+ case OBJ_POLYGON:
+ for (i = 0; i < num_pts; i++)
+ {
+ v[i].x += dx;
+ v[i].y += dy;
+ }
+ XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts,
+ CoordModeOrigin);
+ for (i = 0; i < num_pts; i++)
+ {
+ v[i].x -= dx;
+ v[i].y -= dy;
+ }
+ break;
+ case OBJ_GROUP:
+ case OBJ_SYM:
+ case OBJ_ICON:
+ SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
+ break;
+ }
+ SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx,
+ sel_rby+dy);
+
+ dx = grid_x - OrigX;
+ dy = grid_y - OrigY;
+
MarkRulers (grid_x, grid_y);
SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx,
*** names.c.orig Wed Jun 27 13:28:49 1990
--- names.c Wed Jun 27 13:28:51 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.c,v 1.1 90/04/01 22:16:26 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.c,v 1.4 90/05/22 15:49:54 william Exp $";
#endif
***************
*** 57,62 ****
XGCValues values;
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.fill_style = FillSolid;
values.font = defaultFontPtr->fid;
--- 57,62 ----
XGCValues values;
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.fill_style = FillSolid;
values.font = defaultFontPtr->fid;
***************
*** 64,69 ****
GCForeground | GCBackground | GCFillStyle | GCFont, &values);
! values.foreground = myBlackPixel;
! values.background = myWhitePixel;
revNameGC = XCreateGC (mainDisplay, rootWindow,
GCForeground | GCBackground | GCFillStyle | GCFont, &values);
--- 64,69 ----
GCForeground | GCBackground | GCFillStyle | GCFont, &values);
! values.foreground = myBgPixel;
! values.background = myFgPixel;
revNameGC = XCreateGC (mainDisplay, rootWindow,
GCForeground | GCBackground | GCFillStyle | GCFont, &values);
***************
*** 105,125 ****
block_h = (int)(nameScrollAreaH * frac); /* number of pixels */
! values.foreground = myBlackPixel;
! values.background = myWhitePixel;
values.function = GXcopy;
values.fill_style = FillSolid;
XChangeGC (mainDisplay, scrollGC,
! GCForeground | GCBackground | GCFunction | GCFillStyle,
! &values);
XFillRectangle (mainDisplay, nameScrollWin, scrollGC, 0, scrollBarW,
scrollBarW, nameScrollAreaH);
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.fill_style = FillOpaqueStippled;
values.stipple = patPixmap[SCROLLPAT];
XChangeGC (mainDisplay, scrollGC,
! GCForeground | GCBackground | GCFillStyle | GCStipple,
! &values);
XFillRectangle (mainDisplay, nameScrollWin, scrollGC, 0,
scrollBarW+block_start, scrollBarW, block_h);
--- 105,123 ----
block_h = (int)(nameScrollAreaH * frac); /* number of pixels */
! values.foreground = myBgPixel;
! values.background = myFgPixel;
values.function = GXcopy;
values.fill_style = FillSolid;
XChangeGC (mainDisplay, scrollGC,
! GCForeground | GCBackground | GCFunction | GCFillStyle, &values);
XFillRectangle (mainDisplay, nameScrollWin, scrollGC, 0, scrollBarW,
scrollBarW, nameScrollAreaH);
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.fill_style = FillOpaqueStippled;
values.stipple = patPixmap[SCROLLPAT];
XChangeGC (mainDisplay, scrollGC,
! GCForeground | GCBackground | GCFillStyle | GCStipple, &values);
XFillRectangle (mainDisplay, nameScrollWin, scrollGC, 0,
scrollBarW+block_start, scrollBarW, block_h);
***************
*** 174,178 ****
static
! void RedrawNameBaseWindow (Str, str_start, button_start)
char * Str;
int str_start, button_start;
--- 172,176 ----
static
! void RedrawNameBaseWindow (Str, str_start, button_start, W, H)
char * Str;
int str_start, button_start;
***************
*** 180,183 ****
--- 178,182 ----
int top = defaultFontAsc+2;
+ XDrawRectangle (mainDisplay, nameBaseWin, nameGC, 0, 0, W-1, H-1);
XDrawString (mainDisplay, nameBaseWin, nameGC, str_start,
ROW_HEIGHT+top, Str, strlen(Str));
***************
*** 365,369 ****
if ((nameBaseWin = XCreateSimpleWindow (mainDisplay, rootWindow,
! win_x, win_y, w, h, brdrW, myWhitePixel, myBlackPixel)) == 0)
{ printf ("Could not create desired popup window!\n"); exit (-1); }
--- 364,368 ----
if ((nameBaseWin = XCreateSimpleWindow (mainDisplay, rootWindow,
! win_x, win_y, w, h, brdrW, myBorderPixel, myBgPixel)) == 0)
{ printf ("Could not create desired popup window!\n"); exit (-1); }
***************
*** 371,376 ****
if ((nameDspWin = XCreateSimpleWindow (mainDisplay, nameBaseWin, graph_start,
! 3*ROW_HEIGHT, nameDspW, nameDspH, brdrW, myWhitePixel,
! myBlackPixel)) == 0)
{ printf ("Could not create desired popup window!\n"); exit (-1); }
--- 370,375 ----
if ((nameDspWin = XCreateSimpleWindow (mainDisplay, nameBaseWin, graph_start,
! 3*ROW_HEIGHT, nameDspW, nameDspH, brdrW, myBorderPixel,
! myBgPixel)) == 0)
{ printf ("Could not create desired popup window!\n"); exit (-1); }
***************
*** 377,381 ****
if ((nameScrollWin = XCreateSimpleWindow (mainDisplay, nameBaseWin,
graph_start+nameDspWinW, 3*ROW_HEIGHT, scrollBarW, nameDspH,
! brdrW, myWhitePixel, myBlackPixel)) == 0)
{ printf ("Could not create desired popup scroll window!\n"); exit (-1); }
--- 376,380 ----
if ((nameScrollWin = XCreateSimpleWindow (mainDisplay, nameBaseWin,
graph_start+nameDspWinW, 3*ROW_HEIGHT, scrollBarW, nameDspH,
! brdrW, myBorderPixel, myBgPixel)) == 0)
{ printf ("Could not create desired popup scroll window!\n"); exit (-1); }
***************
*** 403,407 ****
{
if (input.xany.window == nameBaseWin)
! RedrawNameBaseWindow (Str, str_start, button_start);
else if (input.xany.window == nameScrollWin)
RedrawNameScrollWin ();
--- 402,406 ----
{
if (input.xany.window == nameBaseWin)
! RedrawNameBaseWindow (Str, str_start, button_start, w, h);
else if (input.xany.window == nameScrollWin)
RedrawNameScrollWin ();
***************
*** 513,517 ****
struct direct * d;
int len, ext_len, count = 0;
! char ext[80];
if (*Path == '\0')
--- 512,516 ----
struct direct * d;
int len, ext_len, count = 0;
! char ext[MAXPATHLENGTH];
if (*Path == '\0')
***************
*** 572,576 ****
{
register int i, index;
! char s[80], full_name[MAXPATHLENGTH];
DspList * dsp_ptr;
--- 571,575 ----
{
register int i, index;
! char s[MAXPATHLENGTH], full_name[MAXPATHLENGTH];
DspList * dsp_ptr;
***************
*** 673,677 ****
{
register int i, index;
! char s[80];
DspList * dsp_ptr;
--- 672,676 ----
{
register int i, index;
! char s[MAXPATHLENGTH];
DspList * dsp_ptr;
*** oval.c.orig Wed Jun 27 13:28:59 1990
--- oval.c Wed Jun 27 13:29:00 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/oval.c,v 1.2 90/05/16 08:30:59 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/oval.c,v 1.5 90/06/26 08:52:36 william Exp $";
#endif
***************
*** 175,179 ****
if (fill != 0)
{
! values.foreground = (fill == 2) ? myBlackPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 175,179 ----
if (fill != 0)
{
! values.foreground = (fill == 2) ? myBgPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
***************
*** 186,190 ****
if (pen != 0)
{
! values.foreground = (pen == 2) ? myBlackPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 186,190 ----
if (pen != 0)
{
! values.foreground = (pen == 2) ? myBgPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
***************
*** 301,305 ****
DrawOvalObj (drawWindow, drawOrigX, drawOrigY, topObj);
ovalDrawn = TRUE;
! fileModified = TRUE;
}
}
--- 301,305 ----
DrawOvalObj (drawWindow, drawOrigX, drawOrigY, topObj);
ovalDrawn = TRUE;
! SetFileModified (TRUE);
}
}
*** pattern.c.orig Wed Jun 27 13:29:07 1990
--- pattern.c Wed Jun 27 13:29:09 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/pattern.c,v 1.1 90/04/01 22:16:30 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/pattern.c,v 1.2 90/06/26 00:11:14 william Exp $";
#endif
***************
*** 147,151 ****
if (changed)
{
! fileModified = TRUE;
HighLightReverse ();
RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
--- 147,151 ----
if (changed)
{
! SetFileModified (TRUE);
HighLightReverse ();
RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
***************
*** 239,243 ****
if (changed)
{
! fileModified = TRUE;
HighLightReverse ();
ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
--- 239,243 ----
if (changed)
{
! SetFileModified (TRUE);
HighLightReverse ();
ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
***************
*** 360,364 ****
if (changed)
{
! fileModified = TRUE;
HighLightReverse ();
ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
--- 360,364 ----
if (changed)
{
! SetFileModified (TRUE);
HighLightReverse ();
ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
***************
*** 493,497 ****
if (changed)
{
! fileModified = TRUE;
HighLightReverse ();
ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
--- 493,497 ----
if (changed)
{
! SetFileModified (TRUE);
HighLightReverse ();
ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
***************
*** 642,646 ****
if (changed)
{
! fileModified = TRUE;
HighLightReverse ();
RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
--- 642,646 ----
if (changed)
{
! SetFileModified (TRUE);
HighLightReverse ();
RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
*** poly.c.orig Wed Jun 27 13:29:17 1990
--- poly.c Wed Jun 27 13:29:19 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/poly.c,v 1.2 90/05/17 09:17:31 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/poly.c,v 1.4 90/06/26 00:11:18 william Exp $";
#endif
***************
*** 249,253 ****
else if (P != 0)
{
! values.foreground = (P == 2) ? myBlackPixel : Pix;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 249,253 ----
else if (P != 0)
{
! values.foreground = (P == 2) ? myBgPixel : Pix;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
***************
*** 421,425 ****
topObj->bbox.rby+(1<<zoomScale));
polyDrawn = TRUE;
! fileModified = TRUE;
}
}
--- 421,425 ----
topObj->bbox.rby+(1<<zoomScale));
polyDrawn = TRUE;
! SetFileModified (TRUE);
}
}
***************
*** 649,653 ****
}
v[n].x = v[0].x; v[n].y = v[0].y;
! values.foreground = (fill == BACKPAT) ? myBlackPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 649,653 ----
}
v[n].x = v[0].x; v[n].y = v[0].y;
! values.foreground = (fill == BACKPAT) ? myBgPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
*** polygon.c.orig Wed Jun 27 13:29:28 1990
--- polygon.c Wed Jun 27 13:29:30 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/polygon.c,v 1.1 90/04/01 22:16:34 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/polygon.c,v 1.3 90/06/26 00:11:22 william Exp $";
#endif
***************
*** 211,215 ****
if (fill != 0)
{
! values.foreground = (fill == 2) ? myBlackPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 211,215 ----
if (fill != 0)
{
! values.foreground = (fill == 2) ? myBgPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
***************
*** 223,227 ****
if (pen != 0)
{
! values.foreground = (pen == 2) ? myBlackPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 223,227 ----
if (pen != 0)
{
! values.foreground = (pen == 2) ? myBgPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
***************
*** 354,358 ****
if (penPat != 0 && (button_ev->button == Button1 || num_pts != 1))
{
! values.foreground = (penPat == 2) ? myBlackPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 354,358 ----
if (penPat != 0 && (button_ev->button == Button1 || num_pts != 1))
{
! values.foreground = (penPat == 2) ? myBgPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
***************
*** 401,405 ****
}
! values.foreground = (penPat == 2) ? myBlackPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
--- 401,405 ----
}
! values.foreground = (penPat == 2) ? myBgPixel : pixel;
values.function = GXcopy;
values.fill_style = FillOpaqueStippled;
***************
*** 456,460 ****
polygonDrawn = TRUE;
! fileModified = TRUE;
break;
}
--- 456,460 ----
polygonDrawn = TRUE;
! SetFileModified (TRUE);
break;
}
*** prtgif.c.orig Wed Jun 27 13:29:41 1990
--- prtgif.c Wed Jun 27 13:29:42 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/prtgif.c,v 1.1 90/05/02 08:23:04 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/prtgif.c,v 1.9 90/06/05 10:09:52 william Exp $";
#endif
***************
*** 32,36 ****
extern int PDrawReadObj ();
! static char drawPath[256];
static short pDrawCursorH[] =
{
--- 32,36 ----
extern int PDrawReadObj ();
! static char drawPath[MAXSTRING];
static short pDrawCursorH[] =
{
***************
*** 293,297 ****
struct StrRec * s_ptr;
struct TextRec * text_ptr;
! char color_str[20], * s, tmp_str[80], inbuf[255];
int num_lines, x, y, font, style, size;
int text_just, rotate, pen;
--- 293,298 ----
struct StrRec * s_ptr;
struct TextRec * text_ptr;
! char color_str[80], * s;
! char tmp_str[MAXSTRING+1], inbuf[MAXSTRING+1];
int num_lines, x, y, font, style, size;
int text_just, rotate, pen;
***************
*** 328,332 ****
for (i = 0; i < num_lines; i++)
{
! fgets (inbuf, 255, FP);
strcpy(tmp_str, FindChar ('"', inbuf));
s = FindChar ('"', tmp_str);
--- 329,333 ----
for (i = 0; i < num_lines; i++)
{
! fgets (inbuf, MAXSTRING, FP);
strcpy(tmp_str, FindChar ('"', inbuf));
s = FindChar ('"', tmp_str);
***************
*** 430,437 ****
{
struct ObjRec * TextObj;
! char inbuf[255], * s, name[80], value[80];
int len, shown, nameshown, inherited;
! fgets (inbuf, 255, FP);
if (inbuf[0] == ']') return (FALSE);
--- 431,439 ----
{
struct ObjRec * TextObj;
! char inbuf[MAXSTRING+1], * s;
! char name[MAXSTRING+1], value[MAXSTRING+1];
int len, shown, nameshown, inherited;
! fgets (inbuf, MAXSTRING, FP);
if (inbuf[0] == ']') return (FALSE);
***************
*** 472,480 ****
struct ObjRec * * ObjPtr;
{
! char inbuf[255], obj_name[10], tmp_str[80], * s, * s1;
int len, id;
struct AttrRec * top_attr = NULL, * bot_attr = NULL, * attr_ptr;
! while (fgets (inbuf, 255, FP) != NULL)
{
if (inbuf[0] == ']') return (FALSE);
--- 474,483 ----
struct ObjRec * * ObjPtr;
{
! char inbuf[MAXSTRING+1], obj_name[10], tmp_str[MAXSTRING+1];
! char * s, * s1;
int len, id;
struct AttrRec * top_attr = NULL, * bot_attr = NULL, * attr_ptr;
! while (fgets (inbuf, MAXSTRING, FP) != NULL)
{
if (inbuf[0] == ']') return (FALSE);
***************
*** 571,575 ****
PDrawReadGroupObj (FP, ObjPtr);
(*ObjPtr)->type = OBJ_ICON;
! if (fgets (inbuf, 255, FP) == NULL) return (FALSE);
strcpy(tmp_str, FindChar ('"', inbuf));
--- 574,578 ----
PDrawReadGroupObj (FP, ObjPtr);
(*ObjPtr)->type = OBJ_ICON;
! if (fgets (inbuf, MAXSTRING, FP) == NULL) return (FALSE);
strcpy(tmp_str, FindChar ('"', inbuf));
***************
*** 643,660 ****
{
register struct ObjRec * obj_ptr;
! char cmd[256];
! FILE * fp;
if (botObj == NULL) { printf ("No object to print."); return; }
! 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;
}
! printf ("Writing to /tmp/DRAW.PS ...\n");
for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev)
PDrawDumpAllObj (fp, obj_ptr);
--- 646,692 ----
{
register struct ObjRec * obj_ptr;
! char cmd[MAXSTRING+1], tmp_str[MAXSTRING+1];
! char tmp_file[MAXSTRING+1], ps_file[MAXSTRING+1];
! FILE * fp, * fps;
if (botObj == NULL) { printf ("No object to print."); return; }
! strcpy (tmp_file, "/tmp/TgifXXXXXX");
! mktemp (tmp_file);
! unlink (tmp_file);
!
! if ((fp = fopen (tmp_file, "w")) == NULL)
{
! printf ("Can not create $s, print aborted.", tmp_file);
return;
}
! printf ("Writing to %s ...\n", tmp_file);
+ fprintf (fp, "%%!\n");
+ DumpBBox (fp);
+ sprintf(ps_file, "%s/.psmac", drawPath);
+ if ((fps = fopen (ps_file, "r")) == NULL)
+ {
+ printf ("Can not find %s, print aborted.\n", ps_file);
+ fclose (fp);
+ unlink (tmp_file);
+ return;
+ }
+ while (fgets (tmp_str, 256, 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)
PDrawDumpAllObj (fp, obj_ptr);
***************
*** 664,700 ****
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);
! system ("lpr /tmp/DRAW.PS");
! printf ("/tmp/DRAW.PS printed.\n\n");
}
--- 696,712 ----
fclose (fp);
! sprintf (cmd, "lpr %s 2>&1", tmp_file);
! if ((fp = popen (cmd, "r")) == NULL)
{
! printf ("Can not execute '%s', print aborted.\n", cmd);
! unlink (tmp_file);
! return;
}
! while (fgets (tmp_str, 256, fp) != NULL) sleep (5);
! pclose (fp);
! unlink (tmp_file);
!
! printf ("%s printed.\n\n", tmp_file);
}
***************
*** 703,707 ****
char * argv[];
{
! char inbuf[256];
char * c_ptr;
--- 715,719 ----
char * argv[];
{
! char inbuf[MAXSTRING+1];
char * c_ptr;
***************
*** 709,717 ****
if ((c_ptr = getenv ("TGIFPATH")) == NULL)
! strcpy (drawPath, "/u/tangram/u/william/X11/TGIF");
else
! if (strlen (c_ptr) >= 255)
/* must be an error */
! strcpy (drawPath, "/u/tangram/u/william/X11/TGIF");
else
strcpy (drawPath, c_ptr);
--- 721,729 ----
if ((c_ptr = getenv ("TGIFPATH")) == NULL)
! strcpy (drawPath, TGIF_PATH);
else
! if (strlen (c_ptr) >= MAXSTRING)
/* must be an error */
! strcpy (drawPath, TGIF_PATH);
else
strcpy (drawPath, c_ptr);
***************
*** 721,725 ****
case 1:
printf ("\nDraw File Name to Print> ");
! while (fgets (inbuf, 255, stdin) != NULL)
{
PDrawLoad (inbuf);
--- 733,737 ----
case 1:
printf ("\nDraw File Name to Print> ");
! while (fgets (inbuf, MAXSTRING, stdin) != NULL)
{
PDrawLoad (inbuf);
*** raster.c.orig Wed Jun 27 13:29:49 1990
--- raster.c Wed Jun 27 13:29:51 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/raster.c,v 1.2 90/05/07 15:28:20 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/raster.c,v 1.3 90/05/22 14:16:44 william Exp $";
#endif
***************
*** 129,134 ****
XGCValues values;
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.fill_style = FillOpaqueStippled;
--- 129,134 ----
XGCValues values;
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.fill_style = FillOpaqueStippled;
***************
*** 141,145 ****
values.join_style = JoinBevel;
! values.background = myBlackPixel;
drawGC = XCreateGC (mainDisplay, mainWindow,
GCBackground | GCJoinStyle, &values);
--- 141,145 ----
values.join_style = JoinBevel;
! values.background = myBgPixel;
drawGC = XCreateGC (mainDisplay, mainWindow,
GCBackground | GCJoinStyle, &values);
*** rect.c.orig Wed Jun 27 13:29:56 1990
--- rect.c Wed Jun 27 13:29:57 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/rect.c,v 1.1 90/04/01 22:16:37 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/rect.c,v 1.2 90/06/15 01:13:58 william Exp $";
#endif
***************
*** 166,170 ****
if (rx >= ry)
{ /* flat oval */
! tmp_y = sqrt ((double)(ry*ry*(1-(X-cx)*(X-cx)/rx/rx)));
y1 = cy - tmp_y;
y2 = cy + tmp_y;
--- 166,170 ----
if (rx >= ry)
{ /* flat oval */
! tmp_y = sqrt (fabs ((double)(ry*ry*(1-(X-cx)*(X-cx)/rx/rx))));
y1 = cy - tmp_y;
y2 = cy + tmp_y;
***************
*** 173,177 ****
else
{ /* tall oval */
! tmp_x = sqrt ((double)(rx*rx*(1-(Y-cy)*(Y-cy)/ry/ry)));
x1 = cx - tmp_x;
x2 = cx + tmp_x;
--- 173,177 ----
else
{ /* tall oval */
! tmp_x = sqrt (fabs ((double)(rx*rx*(1-(Y-cy)*(Y-cy)/ry/ry))));
x1 = cx - tmp_x;
x2 = cx + tmp_x;
*** ruler.c.orig Wed Jun 27 13:30:05 1990
--- ruler.c Wed Jun 27 13:30:06 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/ruler.c,v 1.1 90/04/01 22:16:38 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/ruler.c,v 1.3 90/05/22 16:59:40 william Exp $";
#endif
***************
*** 32,37 ****
XGCValues values;
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.fill_style = FillSolid;
values.font = rulerFontPtr->fid;
--- 32,37 ----
XGCValues values;
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.fill_style = FillSolid;
values.font = rulerFontPtr->fid;
***************
*** 58,63 ****
while (XCheckWindowEvent (mainDisplay, hRuleWindow, ExposureMask, &ev)) ;
! inc = (gridOn) ? xyGrid : DEFAULT_GRID;
! abs_inc = (gridOn) ? (xyGrid<<zoomScale) : (DEFAULT_GRID<<zoomScale);
start = ((int)(drawOrigX / inc)) * inc;
--- 58,63 ----
while (XCheckWindowEvent (mainDisplay, hRuleWindow, ExposureMask, &ev)) ;
! inc = xyGrid;
! abs_inc = (xyGrid<<zoomScale);
start = ((int)(drawOrigX / inc)) * inc;
***************
*** 108,113 ****
while (XCheckWindowEvent (mainDisplay, vRuleWindow, ExposureMask, &ev)) ;
! inc = (gridOn) ? xyGrid : DEFAULT_GRID;
! abs_inc = (gridOn) ? (xyGrid<<zoomScale) : (DEFAULT_GRID<<zoomScale);
start = ((int)(drawOrigY / inc)) * inc;
--- 108,113 ----
while (XCheckWindowEvent (mainDisplay, vRuleWindow, ExposureMask, &ev)) ;
! inc = xyGrid;
! abs_inc = (xyGrid<<zoomScale);
start = ((int)(drawOrigY / inc)) * inc;
*** scroll.c.orig Wed Jun 27 13:30:12 1990
--- scroll.c Wed Jun 27 13:30:13 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/scroll.c,v 1.1 90/04/01 22:16:39 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/scroll.c,v 1.3 90/05/22 14:20:12 william Exp $";
#endif
***************
*** 53,58 ****
scrollPixmap = XCreatePixmap (mainDisplay, mainWindow, scrollBarW,
scrollBarW, mainDepth);
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.fill_style = FillTiled;
values.tile = scrollPixmap;
--- 53,58 ----
scrollPixmap = XCreatePixmap (mainDisplay, mainWindow, scrollBarW,
scrollBarW, mainDepth);
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.fill_style = FillTiled;
values.tile = scrollPixmap;
***************
*** 86,91 ****
block_h = (int)(scrollAreaH * frac);
! values.foreground = myBlackPixel;
! values.background = myWhitePixel;
values.function = GXcopy;
values.fill_style = FillSolid;
--- 86,91 ----
block_h = (int)(scrollAreaH * frac);
! values.foreground = myBgPixel;
! values.background = myFgPixel;
values.function = GXcopy;
values.fill_style = FillSolid;
***************
*** 96,101 ****
scrollBarW, scrollAreaH);
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.fill_style = FillOpaqueStippled;
values.stipple = patPixmap[SCROLLPAT];
--- 96,101 ----
scrollBarW, scrollAreaH);
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.fill_style = FillOpaqueStippled;
values.stipple = patPixmap[SCROLLPAT];
***************
*** 135,140 ****
block_w = (int)(scrollAreaW * frac);
! values.foreground = myBlackPixel;
! values.background = myWhitePixel;
values.function = GXcopy;
values.fill_style = FillSolid;
--- 135,140 ----
block_w = (int)(scrollAreaW * frac);
! values.foreground = myBgPixel;
! values.background = myFgPixel;
values.function = GXcopy;
values.fill_style = FillSolid;
***************
*** 145,150 ****
scrollAreaW, scrollBarW);
! values.foreground = myWhitePixel;
! values.background = myBlackPixel;
values.fill_style = FillOpaqueStippled;
values.stipple = patPixmap[SCROLLPAT];
--- 145,150 ----
scrollAreaW, scrollBarW);
! values.foreground = myFgPixel;
! values.background = myBgPixel;
values.fill_style = FillOpaqueStippled;
values.stipple = patPixmap[SCROLLPAT];
***************
*** 169,172 ****
--- 169,204 ----
}
+ void ScrollUp ()
+ {
+ if (drawOrigY != 0)
+ {
+ drawOrigY -= HALF_INCH;
+ RedrawVScrollWindow ();
+ UpdDrawWinBBox ();
+ AdjSplineVs ();
+ AdjustCurText (0, HALF_INCH);
+ ClearAndRedrawDrawWindow ();
+ XClearWindow (mainDisplay, vRuleWindow);
+ RedrawVRuler ();
+ }
+ }
+
+ void ScrollDown ()
+ {
+ if (paperHeight <= drawWinH) return;
+
+ if (drawOrigY+drawWinH < paperHeight)
+ {
+ drawOrigY += HALF_INCH;
+ RedrawVScrollWindow ();
+ UpdDrawWinBBox ();
+ AdjSplineVs ();
+ AdjustCurText (0, -HALF_INCH);
+ ClearAndRedrawDrawWindow ();
+ XClearWindow (mainDisplay, vRuleWindow);
+ RedrawVRuler ();
+ }
+ }
+
static
void VSBarHandler (button_ev)
***************
*** 179,215 ****
{
if (button_ev->y < scrollBarW)
! {
! /* clicked in the uparrow */
! if (drawOrigY != 0)
! {
! drawOrigY -= HALF_INCH;
! RedrawVScrollWindow ();
! UpdDrawWinBBox ();
! AdjSplineVs ();
! AdjustCurText (0, HALF_INCH);
! ClearAndRedrawDrawWindow ();
! XClearWindow (mainDisplay, vRuleWindow);
! RedrawVRuler ();
! return;
! }
! }
else if (button_ev->y >= scrollBarW+scrollAreaH)
! {
! /* clicked in the downarrow */
! if (paperHeight <= drawWinH) return;
!
! if (drawOrigY+drawWinH < paperHeight)
! {
! drawOrigY += HALF_INCH;
! RedrawVScrollWindow ();
! UpdDrawWinBBox ();
! AdjSplineVs ();
! AdjustCurText (0, -HALF_INCH);
! ClearAndRedrawDrawWindow ();
! XClearWindow (mainDisplay, vRuleWindow);
! RedrawVRuler ();
! return;
! }
! }
else /* clicked in the middle region */
{
--- 211,217 ----
{
if (button_ev->y < scrollBarW)
! ScrollUp (); /* clicked in the uparrow */
else if (button_ev->y >= scrollBarW+scrollAreaH)
! ScrollDown (); /* clicked in the downarrow */
else /* clicked in the middle region */
{
***************
*** 257,260 ****
--- 259,294 ----
}
+ void ScrollLeft ()
+ {
+ if (drawOrigX != 0)
+ {
+ drawOrigX -= HALF_INCH;
+ RedrawHScrollWindow ();
+ UpdDrawWinBBox ();
+ AdjSplineVs ();
+ AdjustCurText (HALF_INCH, 0);
+ ClearAndRedrawDrawWindow ();
+ XClearWindow (mainDisplay, hRuleWindow);
+ RedrawHRuler ();
+ }
+ }
+
+ void ScrollRight ()
+ {
+ if (paperWidth <= drawWinW) return;
+
+ if (drawOrigX+drawWinW < paperWidth)
+ {
+ drawOrigX += HALF_INCH;
+ RedrawHScrollWindow ();
+ UpdDrawWinBBox ();
+ AdjSplineVs ();
+ AdjustCurText (-HALF_INCH, 0);
+ ClearAndRedrawDrawWindow ();
+ XClearWindow (mainDisplay, hRuleWindow);
+ RedrawHRuler ();
+ }
+ }
+
static
void HSBarHandler (button_ev)
***************
*** 267,303 ****
{
if (button_ev->x < scrollBarW)
! {
! /* clicked in the leftarrow */
! if (drawOrigX != 0)
! {
! drawOrigX -= HALF_INCH;
! RedrawHScrollWindow ();
! UpdDrawWinBBox ();
! AdjSplineVs ();
! AdjustCurText (HALF_INCH, 0);
! ClearAndRedrawDrawWindow ();
! XClearWindow (mainDisplay, hRuleWindow);
! RedrawHRuler ();
! return;
! }
! }
else if (button_ev->x >= scrollBarW+scrollAreaW)
! {
! /* clicked in the rightarrow */
! if (paperWidth <= drawWinW) return;
!
! if (drawOrigX+drawWinW < paperWidth)
! {
! drawOrigX += HALF_INCH;
! RedrawHScrollWindow ();
! UpdDrawWinBBox ();
! AdjSplineVs ();
! AdjustCurText (-HALF_INCH, 0);
! ClearAndRedrawDrawWindow ();
! XClearWindow (mainDisplay, hRuleWindow);
! RedrawHRuler ();
! return;
! }
! }
else /* clicked in the middle region */
{
--- 301,307 ----
{
if (button_ev->x < scrollBarW)
! ScrollLeft (); /* clicked in the leftarrow */
else if (button_ev->x >= scrollBarW+scrollAreaW)
! ScrollRight (); /* clicked in the rightarrow */
else /* clicked in the middle region */
{
***************
*** 349,353 ****
{
int row_offset, len, index, x, y, func, level;
- char new_file_name[80];
XButtonEvent * button_ev;
--- 353,356 ----
*** select.c.orig Wed Jun 27 13:30:25 1990
--- select.c Wed Jun 27 13:30:27 1990
***************
*** 6,10 ****
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/select.c,v 1.1 90/04/01 22:16:40 william Exp $";
#endif
--- 6,10 ----
#ifndef lint
static char RCSid[] =
! "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/select.c,v 1.4 90/06/26 00:11:25 william Exp $";
#endif
***************
*** 354,358 ****
unsigned int status;
int end_x, end_y;
- XButtonEvent input;
int done = FALSE, ltx, lty, rbx, rby, dx, dy;
int new_end_x, new_end_y;
--- 354,357 ----
***************
*** 362,366 ****
SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
! XGrabPointer (mainDisplay, drawWindow, FALSE, ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
--- 361,365 ----
SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
! XGrabPointer (mainDisplay, drawWindow, False, None,
GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
***************
*** 613,617 ****
HighLightForward ();
SetCurChoice (NOTHING);
! fileModified = TRUE;
justDupped = FALSE;
}
--- 612,616 ----
HighLightForward ();
SetCurChoice (NOTHING);
! SetFileModified (TRUE);
justDupped = FALSE;
}
***************
*** 632,636 ****
RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
! fileModified = TRUE;
justDupped = FALSE;
}
--- 631,635 ----
RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
! SetFileModified (TRUE);
justDupped = FALSE;
}
***************
*** 656,660 ****
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! fileModified = TRUE;
justDupped = FALSE;
}
--- 655,659 ----
selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
HighLightForward ();
! SetFileModified (TRUE);
justDupped = FALSE;
}
---------------------------------> cut here <---------------------------------
--
-- Bill Cheng // UCLA Computer Science Department // (213) 206-7135
3277 Boelter Hall // Los Angeles, California 90024 // USA
william at CS.UCLA.EDU ...!{uunet|ucbvax}!cs.ucla.edu!william
dan
----------------------------------------------------
O'Reilly && Associates argv at sun.com / argv at ora.com
Opinions expressed reflect those of the author only.
More information about the Comp.sources.x
mailing list