home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume8 / tgif / patch1.02 < prev    next >
Internet Message Format  |  1990-07-08  |  62KB

  1. Path: uunet!cs.utexas.edu!sun-barr!newstop!sun!CS.UCLA.EDU
  2. From: william@CS.UCLA.EDU (William Cheng)
  3. Newsgroups: comp.sources.x
  4. Subject: v08i047: tgif 1.9, Patch1, Part02/03
  5. Message-ID: <138563@sun.Eng.Sun.COM>
  6. Date: 9 Jul 90 07:22:15 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 1989
  9. Approved: argv@sun.com
  10.  
  11. Submitted-by: william@CS.UCLA.EDU (William Cheng)
  12. Posting-number: Volume 8, Issue 47
  13. Archive-name: tgif/patch2.02
  14. Patch-To: tgif: Volume 7, Issue 56-76
  15.  
  16.  
  17. Here is part 02 of the patch that takes tgif from version 1.2 to 1.9.
  18. The most recent version is available for anonymous ftp at the following places.
  19.  
  20.         expo.lcs.mit.edu        contrib/tgif-1.9.tar.Z
  21.         rye.cs.ucla.edu         pub/tgif-1.9.tar.Z
  22.  
  23. --Bill
  24. ---------------------------------> cut here <---------------------------------
  25. *** menu.c.orig    Wed Jun 27 13:28:30 1990
  26. --- menu.c    Wed Jun 27 13:28:32 1990
  27. ***************
  28. *** 6,10 ****
  29.   #ifndef lint
  30.   static char RCSid[] =
  31. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/menu.c,v 1.3 90/05/15 09:26:57 william Exp $";
  32.   #endif
  33.   
  34. --- 6,10 ----
  35.   #ifndef lint
  36.   static char RCSid[] =
  37. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/menu.c,v 1.10 90/06/25 23:58:20 william Exp $";
  38.   #endif
  39.   
  40. ***************
  41. *** 34,37 ****
  42. --- 34,38 ----
  43.   #include "special.e"
  44.   #include "text.e"
  45. + #include "version.e"
  46.   
  47.   int    iconWindowCreated = FALSE;
  48. ***************
  49. *** 55,59 ****
  50.      int        * len, dsp_w, dsp_h, menu_w, menu_h;
  51.      unsigned int    status;
  52. !    int        brdr_pixel, bg_pixel, root_x, root_y;
  53.      XGCValues    values;
  54.      XEvent    input;
  55. --- 56,60 ----
  56.      int        * len, dsp_w, dsp_h, menu_w, menu_h;
  57.      unsigned int    status;
  58. !    int        root_x, root_y;
  59.      XGCValues    values;
  60.      XEvent    input;
  61. ***************
  62. *** 77,89 ****
  63.         OrigY = dsp_h - 1 - 2*brdrW - menu_h;
  64.   
  65. -    brdr_pixel = myWhitePixel;
  66. -    bg_pixel = myBlackPixel;
  67.      if ((window = XCreateSimpleWindow (mainDisplay, rootWindow, OrigX, OrigY,
  68. !          menu_w, menu_h, 2*brdrW, brdr_pixel, bg_pixel)) == 0)
  69.      { printf ("Could not create desired menu window!\n"); exit (-1); }
  70.   
  71.      win_attrs.save_under = True;
  72. !    XChangeWindowAttributes (mainDisplay, window, CWSaveUnder, &win_attrs);
  73.   
  74.      old_selected = INVALID;
  75. --- 78,89 ----
  76.         OrigY = dsp_h - 1 - 2*brdrW - menu_h;
  77.   
  78.      if ((window = XCreateSimpleWindow (mainDisplay, rootWindow, OrigX, OrigY,
  79. !          menu_w, menu_h, 2*brdrW, myBorderPixel, myBgPixel)) == 0)
  80.      { printf ("Could not create desired menu window!\n"); exit (-1); }
  81.   
  82.      win_attrs.save_under = True;
  83. !    win_attrs.override_redirect = True;
  84. !    XChangeWindowAttributes (mainDisplay, window,
  85. !          CWSaveUnder | CWOverrideRedirect, &win_attrs);
  86.   
  87.      old_selected = INVALID;
  88. ***************
  89. *** 92,96 ****
  90. --- 92,99 ----
  91.      XMapWindow (mainDisplay, window);
  92.      XSelectInput (mainDisplay, window, ExposureMask);
  93. +    XWarpPointer (mainDisplay, None, rootWindow, 0, 0, 0, 0, OrigX-2, OrigY-2);
  94.   
  95. +    XSync (mainDisplay, False);
  96.      XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
  97.            &root_y, &x, &y, &status);
  98. ***************
  99. *** 98,133 ****
  100.         while (XCheckWindowEvent (mainDisplay, window, ExposureMask, &input)) ;
  101.    
  102. !    while (menuing)
  103.      {
  104. !       if (XPending (mainDisplay) != 0)
  105.         {
  106. !          XNextEvent (mainDisplay, &input);
  107. !          if (input.type == Expose)
  108. !          {
  109. !             y = defaultFontAsc;
  110. !             if (MultiColor)
  111. !             {
  112. !                for (i = 0; i < Entries; i++, y += defaultFontHeight)
  113. !                {
  114. !                   XSetForeground (mainDisplay, textMenuGC, ForeColors[i]);
  115. !                   XDrawString (mainDisplay, window, textMenuGC, 0, y,
  116. !                         Strings[i], len[i]);
  117. !                }
  118. !             }
  119. !             else
  120. !             {
  121. !                XSetForeground (mainDisplay, textMenuGC, ForeColors[0]);
  122. !                for (i = 0; i < Entries; i++, y += defaultFontHeight)
  123. !                   XDrawString (mainDisplay, window, textMenuGC, 0, y,
  124. !                         Strings[i], len[i]);
  125. !             }
  126. !             XGrabPointer (mainDisplay, window, FALSE, ButtonReleaseMask,
  127. !                   GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
  128. !             XWarpPointer (mainDisplay, None, rootWindow, 0, 0, 0, 0, OrigX-2,
  129. !                   OrigY-2);
  130. !             continue;
  131. !          }
  132.         }
  133.   
  134.         XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
  135.               &root_y, &x, &y, &status);
  136. --- 101,126 ----
  137.         while (XCheckWindowEvent (mainDisplay, window, ExposureMask, &input)) ;
  138.    
  139. !    y = defaultFontAsc;
  140. !    if (MultiColor)
  141.      {
  142. !       for (i = 0; i < Entries; i++, y += defaultFontHeight)
  143.         {
  144. !          XSetForeground (mainDisplay, textMenuGC, ForeColors[i]);
  145. !          XDrawString (mainDisplay, window, textMenuGC, 0, y,
  146. !                Strings[i], len[i]);
  147.         }
  148. +    }
  149. +    else
  150. +    {
  151. +       XSetForeground (mainDisplay, textMenuGC, ForeColors[0]);
  152. +       for (i = 0; i < Entries; i++, y += defaultFontHeight)
  153. +          XDrawString (mainDisplay, window, textMenuGC, 0, y,
  154. +                Strings[i], len[i]);
  155. +    }
  156. +    XGrabPointer (mainDisplay, window, FALSE, None,
  157. +          GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
  158.   
  159. +    while (menuing)
  160. +    {
  161.         XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
  162.               &root_y, &x, &y, &status);
  163. ***************
  164. *** 152,156 ****
  165.               if (old_selected != INVALID && Valid[old_selected])
  166.               {
  167. !                XSetForeground (mainDisplay, textMenuGC, bg_pixel);
  168.                  XFillRectangle (mainDisplay, window, textMenuGC, 0,
  169.                        old_selected*defaultFontHeight, menu_w, defaultFontHeight);
  170. --- 145,149 ----
  171.               if (old_selected != INVALID && Valid[old_selected])
  172.               {
  173. !                XSetForeground (mainDisplay, textMenuGC, myBgPixel);
  174.                  XFillRectangle (mainDisplay, window, textMenuGC, 0,
  175.                        old_selected*defaultFontHeight, menu_w, defaultFontHeight);
  176. ***************
  177. *** 167,171 ****
  178.                  XFillRectangle (mainDisplay, window, textMenuGC, 0,
  179.                        new_selected*defaultFontHeight, menu_w, defaultFontHeight);
  180. !                XSetForeground (mainDisplay, textMenuGC, bg_pixel);
  181.                  XDrawString (mainDisplay, window, textMenuGC, 0,
  182.                        defaultFontAsc+new_selected*defaultFontHeight,
  183. --- 160,164 ----
  184.                  XFillRectangle (mainDisplay, window, textMenuGC, 0,
  185.                        new_selected*defaultFontHeight, menu_w, defaultFontHeight);
  186. !                XSetForeground (mainDisplay, textMenuGC, myBgPixel);
  187.                  XDrawString (mainDisplay, window, textMenuGC, 0,
  188.                        defaultFontAsc+new_selected*defaultFontHeight,
  189. ***************
  190. *** 179,183 ****
  191.            if (Valid[old_selected])
  192.            {
  193. !             XSetForeground (mainDisplay, textMenuGC, bg_pixel);
  194.               XFillRectangle (mainDisplay, window, textMenuGC, 0,
  195.                     old_selected*defaultFontHeight, menu_w, defaultFontHeight);
  196. --- 172,176 ----
  197.            if (Valid[old_selected])
  198.            {
  199. !             XSetForeground (mainDisplay, textMenuGC, myBgPixel);
  200.               XFillRectangle (mainDisplay, window, textMenuGC, 0,
  201.                     old_selected*defaultFontHeight, menu_w, defaultFontHeight);
  202. ***************
  203. *** 210,214 ****
  204.      int        rc = INVALID, old_i, old_j, k, toggle = 0, dsp_w, dsp_h;
  205.      unsigned int    status;
  206. !    int        brdr_pixel, bg_pixel, root_x, root_y;
  207.      XGCValues    values;
  208.      XEvent    input;
  209. --- 203,207 ----
  210.      int        rc = INVALID, old_i, old_j, k, toggle = 0, dsp_w, dsp_h;
  211.      unsigned int    status;
  212. !    int        root_x, root_y;
  213.      XGCValues    values;
  214.      XEvent    input;
  215. ***************
  216. *** 226,238 ****
  217.         OrigY = dsp_h - 1 - 2*brdrW - menu_h;
  218.   
  219. -    brdr_pixel = myWhitePixel;
  220. -    bg_pixel = myBlackPixel;
  221.      if ((window = XCreateSimpleWindow (mainDisplay, rootWindow, OrigX, OrigY,
  222. !          menu_w, menu_h, 2*brdrW, brdr_pixel, bg_pixel)) == 0)
  223.      { printf ("Could not create desired menu window!\n"); exit (-1); }
  224.   
  225.      win_attrs.save_under = True;
  226. !    XChangeWindowAttributes (mainDisplay, window, CWSaveUnder, &win_attrs);
  227.   
  228.      old_selected = INVALID;
  229. --- 219,230 ----
  230.         OrigY = dsp_h - 1 - 2*brdrW - menu_h;
  231.   
  232.      if ((window = XCreateSimpleWindow (mainDisplay, rootWindow, OrigX, OrigY,
  233. !          menu_w, menu_h, 2*brdrW, myBorderPixel, myBgPixel)) == 0)
  234.      { printf ("Could not create desired menu window!\n"); exit (-1); }
  235.   
  236.      win_attrs.save_under = True;
  237. !    win_attrs.override_redirect = True;
  238. !    XChangeWindowAttributes (mainDisplay, window,
  239. !          CWSaveUnder | CWOverrideRedirect, &win_attrs);
  240.   
  241.      old_selected = INVALID;
  242. ***************
  243. *** 241,245 ****
  244. --- 233,240 ----
  245.      XMapWindow (mainDisplay, window);
  246.      XSelectInput (mainDisplay, window, ExposureMask);
  247. +    XWarpPointer (mainDisplay, None, rootWindow, 0, 0, 0, 0, OrigX-2, OrigY-2);
  248.   
  249. +    XSync (mainDisplay, False);
  250.      XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
  251.            &root_y, &x, &y, &status);
  252. ***************
  253. *** 247,288 ****
  254.         while (XCheckWindowEvent (mainDisplay, window, ExposureMask, &input)) ;
  255.   
  256. !    while (menuing)
  257. !    {
  258. !       if (XPending (mainDisplay) != 0)
  259.         {
  260. !          XNextEvent (mainDisplay, &input);
  261. !          if (input.type == Expose)
  262.            {
  263. !             for (i = 0; i < Rows; i++)
  264. !                for (j = 0; j < Cols; j++)
  265. !                {
  266. !                   k = i + j * Rows;
  267. !                   if (MultiColor)
  268. !                   {
  269. !                      if (k >= Entries)
  270. !                         values.foreground = myBlackPixel;
  271. !                      else
  272. !                         values.foreground = ForeColors[k];
  273. !                      values.stipple = patPixmap[1];
  274. !                      XChangeGC (mainDisplay, rasterGC,
  275. !                            GCForeground | GCStipple, &values);
  276. !                      XFillRectangle (mainDisplay, window, rasterGC,
  277. !                            j*W, i*H, W, H);
  278. !                   }
  279. !                   else
  280. !                   {
  281. !                      XSetStipple (mainDisplay, rasterGC, PxMp[k]);
  282. !                      XFillRectangle (mainDisplay, window, rasterGC,
  283. !                            j*W, i*H, W, H);
  284. !                   }
  285. !                }
  286. !             XGrabPointer (mainDisplay, window, FALSE, ButtonReleaseMask,
  287. !                   GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
  288. !             XWarpPointer (mainDisplay, None, rootWindow, 0, 0, 0, 0, OrigX-2,
  289. !                   OrigY-2);
  290. !             continue;
  291.            }
  292.         }
  293.   
  294.         XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
  295.               &root_y, &x, &y, &status);
  296. --- 242,272 ----
  297.         while (XCheckWindowEvent (mainDisplay, window, ExposureMask, &input)) ;
  298.   
  299. !    for (i = 0; i < Rows; i++)
  300. !       for (j = 0; j < Cols; j++)
  301.         {
  302. !          k = i + j * Rows;
  303. !          if (MultiColor)
  304.            {
  305. !             if (k >= Entries)
  306. !                values.foreground = myBgPixel;
  307. !             else
  308. !                values.foreground = ForeColors[k];
  309. !             values.stipple = patPixmap[1];
  310. !             XChangeGC (mainDisplay, rasterGC,
  311. !                   GCForeground | GCStipple, &values);
  312. !             XFillRectangle (mainDisplay, window, rasterGC, j*W, i*H, W, H);
  313.            }
  314. +          else
  315. +          {
  316. +             XSetStipple (mainDisplay, rasterGC, PxMp[k]);
  317. +             XFillRectangle (mainDisplay, window, rasterGC, j*W, i*H, W, H);
  318. +          }
  319.         }
  320.   
  321. +    XGrabPointer (mainDisplay, window, FALSE, ButtonReleaseMask,
  322. +          GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
  323. +    while (menuing)
  324. +    {
  325.         XQueryPointer (mainDisplay, window, &root_win, &child_win, &root_x,
  326.               &root_y, &x, &y, &status);
  327. ***************
  328. *** 314,318 ****
  329.                  {
  330.                     if (old_selected >= Entries)
  331. !                      values.foreground = myBlackPixel;
  332.                     else
  333.                        values.foreground = ForeColors[old_selected];
  334. --- 298,302 ----
  335.                  {
  336.                     if (old_selected >= Entries)
  337. !                      values.foreground = myBgPixel;
  338.                     else
  339.                        values.foreground = ForeColors[old_selected];
  340. ***************
  341. *** 325,329 ****
  342.                  else
  343.                  {
  344. !                   values.foreground = myWhitePixel;
  345.                     values.stipple = PxMp[old_selected];
  346.                     XChangeGC (mainDisplay, rasterGC,
  347. --- 309,313 ----
  348.                  else
  349.                  {
  350. !                   values.foreground = myFgPixel;
  351.                     values.stipple = PxMp[old_selected];
  352.                     XChangeGC (mainDisplay, rasterGC,
  353. ***************
  354. *** 353,357 ****
  355.            {
  356.               if (old_selected >= Entries)
  357. !                values.foreground = myBlackPixel;
  358.               else
  359.                  values.foreground = ForeColors[old_selected];
  360. --- 337,341 ----
  361.            {
  362.               if (old_selected >= Entries)
  363. !                values.foreground = myBgPixel;
  364.               else
  365.                  values.foreground = ForeColors[old_selected];
  366. ***************
  367. *** 364,368 ****
  368.            else
  369.            {
  370. !             values.foreground = myWhitePixel;
  371.               values.stipple = PxMp[old_selected];
  372.               XChangeGC (mainDisplay, rasterGC,
  373. --- 348,352 ----
  374.            else
  375.            {
  376. !             values.foreground = myFgPixel;
  377.               values.stipple = PxMp[old_selected];
  378.               XChangeGC (mainDisplay, rasterGC,
  379. ***************
  380. *** 374,378 ****
  381.         }
  382.      }
  383. !    values.foreground = myWhitePixel;
  384.      XChangeGC (mainDisplay, rasterGC, GCForeground, &values);
  385.   
  386. --- 358,362 ----
  387.         }
  388.      }
  389. !    values.foreground = myFgPixel;
  390.      XChangeGC (mainDisplay, rasterGC, GCForeground, &values);
  391.   
  392. ***************
  393. *** 457,468 ****
  394.   {
  395.      int    y, len, amount, left;
  396. !    char    file_name[80], s[256];
  397.   
  398. !    len = strlen (TOOL_NAME);
  399.      amount = defaultFontWidth * len;
  400.      left = (titleWindowW - amount) / 2;
  401.   
  402. !    XDrawString (mainDisplay, titleWindow, defaultGC, left,
  403. !          defaultFontAsc+2, TOOL_NAME, len);
  404.   
  405.      for (y = 4; y < titleWindowH/2-4; y += 2)
  406. --- 441,456 ----
  407.   {
  408.      int    y, len, amount, left;
  409. !    char    file_name[MAXPATHLENGTH], s[MAXPATHLENGTH];
  410.   
  411. !    strcpy (s, TOOL_NAME);
  412. !    strcat (s, "-");
  413. !    strcat (s, version_string);
  414. !    len = strlen (s);
  415.      amount = defaultFontWidth * len;
  416.      left = (titleWindowW - amount) / 2;
  417.   
  418. !    XDrawString (mainDisplay, titleWindow, defaultGC, left, defaultFontAsc+2, s,
  419. !          len);
  420.   
  421.      for (y = 4; y < titleWindowH/2-4; y += 2)
  422. ***************
  423. *** 474,477 ****
  424. --- 462,466 ----
  425.      }
  426.   
  427. +    s[0] = '\0';
  428.      XClearArea (mainDisplay, titleWindow, 0, titleWindowH/2, titleWindowW,
  429.            titleWindowH/2, FALSE);
  430. ***************
  431. *** 482,493 ****
  432.         if (*curDomainName != '\0') strcat (s, "/");
  433.         strcat (s, file_name);
  434. !       len = strlen(s);
  435. !       left = 2+(len+1)*defaultFontWidth;
  436.   
  437.         XDrawString (mainDisplay, titleWindow, defaultGC, 2,
  438.               titleWindowH/2+defaultFontAsc+2, s, len);
  439.      }
  440. -    else
  441. -       left = 2;
  442.   }
  443.   
  444. --- 471,484 ----
  445.         if (*curDomainName != '\0') strcat (s, "/");
  446.         strcat (s, file_name);
  447. !    }
  448.   
  449. +    if (fileModified) strcat (s, " [Modified]");
  450. +    if (s[0] != '\0')
  451. +    {
  452. +       len = strlen (s);
  453.         XDrawString (mainDisplay, titleWindow, defaultGC, 2,
  454.               titleWindowH/2+defaultFontAsc+2, s, len);
  455.      }
  456.   }
  457.   
  458. ***************
  459. *** 508,512 ****
  460.   {
  461.      struct ObjRec    * obj_ptr;
  462. !    char            s[256], * c_ptr;
  463.      FILE            * fp;
  464.      int            ltx = 0, lty = 0, rbx = 0, rby = 0, seen_obj = FALSE;
  465. --- 499,503 ----
  466.   {
  467.      struct ObjRec    * obj_ptr;
  468. !    char            s[MAXPATHLENGTH], * c_ptr;
  469.      FILE            * fp;
  470.      int            ltx = 0, lty = 0, rbx = 0, rby = 0, seen_obj = FALSE;
  471. ***************
  472. *** 591,596 ****
  473.      XGCValues    values;
  474.   
  475. !    values.foreground = myWhitePixel;
  476. !    values.background = myBlackPixel;
  477.      values.fill_style = FillSolid;
  478.      values.font = defaultFontPtr->fid;
  479. --- 582,587 ----
  480.      XGCValues    values;
  481.   
  482. !    values.foreground = myFgPixel;
  483. !    values.background = myBgPixel;
  484.      values.fill_style = FillSolid;
  485.      values.font = defaultFontPtr->fid;
  486. ***************
  487. *** 673,681 ****
  488.         if ((iconBaseWindow = XCreateSimpleWindow (mainDisplay, rootWindow,
  489.               sizehints.x, sizehints.y, iconWindowW+2*brdrW, iconWindowH+2*brdrW,
  490. !             brdrW, myWhitePixel, myBlackPixel)) == 0)
  491.         { printf ("Could not create icon window!\n"); exit(1); }
  492.   
  493.         if ((iconWindow = XCreateSimpleWindow (mainDisplay, iconBaseWindow, 0, 0,
  494. !             iconWindowW, iconWindowH, brdrW, myWhitePixel, myBlackPixel)) == 0)
  495.         { printf ("Could not create icon window!\n"); exit(1); }
  496.   
  497. --- 664,672 ----
  498.         if ((iconBaseWindow = XCreateSimpleWindow (mainDisplay, rootWindow,
  499.               sizehints.x, sizehints.y, iconWindowW+2*brdrW, iconWindowH+2*brdrW,
  500. !             brdrW, myBorderPixel, myBgPixel)) == 0)
  501.         { printf ("Could not create icon window!\n"); exit(1); }
  502.   
  503.         if ((iconWindow = XCreateSimpleWindow (mainDisplay, iconBaseWindow, 0, 0,
  504. !             iconWindowW, iconWindowH, brdrW, myBorderPixel, myBgPixel)) == 0)
  505.         { printf ("Could not create icon window!\n"); exit(1); }
  506.   
  507. *** move.c.orig    Wed Jun 27 13:28:40 1990
  508. --- move.c    Wed Jun 27 13:28:42 1990
  509. ***************
  510. *** 7,11 ****
  511.   #ifndef lint
  512.   static char RCSid[] =
  513. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/move.c,v 1.2 90/05/17 09:17:01 william Exp $";
  514.   #endif
  515.   #include <stdio.h>
  516. --- 7,11 ----
  517.   #ifndef lint
  518.   static char RCSid[] =
  519. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/move.c,v 1.5 90/06/26 00:11:08 william Exp $";
  520.   #endif
  521.   #include <stdio.h>
  522. ***************
  523. *** 124,135 ****
  524.      struct PolygonRec    * polygon_ptr;
  525.      struct BBRec        bbox, o_bbox;
  526. -    Window        root_win, child_win;
  527. -    int            root_x, root_y;
  528.      XPoint        * v;
  529. -    unsigned int        status;
  530. -    XButtonEvent        input;
  531.      int             ltx, lty, rbx, rby, sel_ltx, sel_lty, sel_rbx, sel_rby;
  532.      int            x, y, moving = TRUE, dx, dy;
  533. !    int            grid_x = OrigX, grid_y = OrigY, new_grid_x, new_grid_y;
  534.   
  535.      sel_ltx = OFFSET_X(selLtX) - 1; sel_lty = OFFSET_Y(selLtY) - 1;
  536. --- 124,132 ----
  537.      struct PolygonRec    * polygon_ptr;
  538.      struct BBRec        bbox, o_bbox;
  539.      XPoint        * v;
  540.      int             ltx, lty, rbx, rby, sel_ltx, sel_lty, sel_rbx, sel_rby;
  541.      int            x, y, moving = TRUE, dx, dy;
  542. !    int            grid_x = OrigX, grid_y = OrigY;
  543. !    XEvent        input;
  544.   
  545.      sel_ltx = OFFSET_X(selLtX) - 1; sel_lty = OFFSET_Y(selLtY) - 1;
  546. ***************
  547. *** 188,193 ****
  548.      }
  549.   
  550. !    XGrabPointer (mainDisplay, drawWindow, FALSE, ButtonReleaseMask,
  551. !          GrabModeAsync, GrabModeAsync, None, defaultCursor, CurrentTime);
  552.   
  553.      dx = dy = 0;
  554. --- 185,191 ----
  555.      }
  556.   
  557. !    XGrabPointer (mainDisplay, drawWindow, FALSE,
  558. !          PointerMotionMask | ButtonReleaseMask,
  559. !          GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
  560.   
  561.      dx = dy = 0;
  562. ***************
  563. *** 195,255 ****
  564.      while (moving)
  565.      {
  566. !       XQueryPointer (mainDisplay, drawWindow, &root_win, &child_win,
  567. !             &root_x, &root_y, &x, &y, &status);
  568. !       GridXY (x, y, &new_grid_x, &new_grid_y);
  569. !       if (new_grid_x==grid_x && new_grid_y==grid_y && (status & Button1Mask)!=0)
  570. !          continue;
  571. !       grid_x = new_grid_x;
  572. !       grid_y = new_grid_y;
  573. !       switch (ObjPtr->type)
  574.         {
  575. -          case OBJ_BOX:
  576. -          case OBJ_TEXT:
  577. -             SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
  578. -             break;
  579. -          case OBJ_OVAL:
  580. -             o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy;
  581. -             o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy;
  582. -             MyOval (drawWindow, revDefaultGC, o_bbox);
  583. -             break;
  584. -          case OBJ_POLY:
  585. -          case OBJ_POLYGON:
  586. -             for (i = 0; i < num_pts; i++)
  587. -             {
  588. -                v[i].x += dx;
  589. -                v[i].y += dy;
  590. -             }
  591. -             XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts,
  592. -                   CoordModeOrigin);
  593. -             for (i = 0; i < num_pts; i++)
  594. -             {
  595. -                v[i].x -= dx;
  596. -                v[i].y -= dy;
  597. -             }
  598. -             break;
  599. -          case OBJ_GROUP:
  600. -          case OBJ_SYM:
  601. -          case OBJ_ICON:
  602. -             SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
  603. -             break;
  604. -       }
  605. -       SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx,
  606. -             sel_rby+dy);
  607. -       dx = grid_x - OrigX;
  608. -       dy = grid_y - OrigY;
  609. -       if ((status & Button1Mask) == 0)
  610. -       {
  611. -          /* mouse is up */
  612.            XUngrabPointer (mainDisplay, CurrentTime);
  613.            MarkRulers (grid_x, grid_y);
  614.            moving = FALSE;
  615.            switch (ObjPtr->type)
  616.            {
  617.               case OBJ_POLY:
  618.               case OBJ_POLYGON: cfree(v); break;
  619.            }
  620. --- 193,244 ----
  621.      while (moving)
  622.      {
  623. !       XNextEvent (mainDisplay, &input);
  624. !       if (input.type == ButtonRelease)
  625.         {
  626.            XUngrabPointer (mainDisplay, CurrentTime);
  627.            MarkRulers (grid_x, grid_y);
  628.            moving = FALSE;
  629.            switch (ObjPtr->type)
  630.            {
  631. +             case OBJ_BOX:
  632. +             case OBJ_TEXT:
  633. +                SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
  634. +                break;
  635. +             case OBJ_OVAL:
  636. +                o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy;
  637. +                o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy;
  638. +                MyOval (drawWindow, revDefaultGC, o_bbox);
  639. +                break;
  640.               case OBJ_POLY:
  641. +             case OBJ_POLYGON:
  642. +                for (i = 0; i < num_pts; i++)
  643. +                {
  644. +                   v[i].x += dx;
  645. +                   v[i].y += dy;
  646. +                }
  647. +                XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts,
  648. +                      CoordModeOrigin);
  649. +                for (i = 0; i < num_pts; i++)
  650. +                {
  651. +                   v[i].x -= dx;
  652. +                   v[i].y -= dy;
  653. +                }
  654. +                break;
  655. +             case OBJ_GROUP:
  656. +             case OBJ_SYM:
  657. +             case OBJ_ICON:
  658. +                SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
  659. +                break;
  660. +          }
  661. +          SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx,
  662. +                sel_rby+dy);
  663. +          dx = grid_x - OrigX;
  664. +          dy = grid_y - OrigY;
  665. +          switch (ObjPtr->type)
  666. +          {
  667. +             case OBJ_POLY:
  668.               case OBJ_POLYGON: cfree(v); break;
  669.            }
  670. ***************
  671. *** 271,279 ****
  672.                  dupDy += dy;
  673.               }
  674. !             fileModified = TRUE;
  675.            }
  676.         }
  677. !       else
  678.         {
  679.            MarkRulers (grid_x, grid_y);
  680.            SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx,
  681. --- 260,310 ----
  682.                  dupDy += dy;
  683.               }
  684. !             SetFileModified (TRUE);
  685.            }
  686.         }
  687. !       else if (input.type == MotionNotify)
  688.         {
  689. +          x = input.xmotion.x;
  690. +          y = input.xmotion.y;
  691. +          GridXY (x, y, &grid_x, &grid_y);
  692. +          switch (ObjPtr->type)
  693. +          {
  694. +             case OBJ_BOX:
  695. +             case OBJ_TEXT:
  696. +                SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
  697. +                break;
  698. +             case OBJ_OVAL:
  699. +                o_bbox.ltx = bbox.ltx + dx; o_bbox.lty = bbox.lty + dy;
  700. +                o_bbox.rbx = bbox.rbx + dx; o_bbox.rby = bbox.rby + dy;
  701. +                MyOval (drawWindow, revDefaultGC, o_bbox);
  702. +                break;
  703. +             case OBJ_POLY:
  704. +             case OBJ_POLYGON:
  705. +                for (i = 0; i < num_pts; i++)
  706. +                {
  707. +                   v[i].x += dx;
  708. +                   v[i].y += dy;
  709. +                }
  710. +                XDrawLines (mainDisplay, drawWindow, revDefaultGC, v, num_pts,
  711. +                      CoordModeOrigin);
  712. +                for (i = 0; i < num_pts; i++)
  713. +                {
  714. +                   v[i].x -= dx;
  715. +                   v[i].y -= dy;
  716. +                }
  717. +                break;
  718. +             case OBJ_GROUP:
  719. +             case OBJ_SYM:
  720. +             case OBJ_ICON:
  721. +                SelBox (drawWindow, revDefaultGC, ltx+dx, lty+dy, rbx+dx, rby+dy);
  722. +                break;
  723. +          }
  724. +          SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx,
  725. +                sel_rby+dy);
  726. +          dx = grid_x - OrigX;
  727. +          dy = grid_y - OrigY;
  728.            MarkRulers (grid_x, grid_y);
  729.            SelBox (drawWindow, revDefaultGC, sel_ltx+dx, sel_lty+dy, sel_rbx+dx,
  730. *** names.c.orig    Wed Jun 27 13:28:49 1990
  731. --- names.c    Wed Jun 27 13:28:51 1990
  732. ***************
  733. *** 6,10 ****
  734.   #ifndef lint
  735.   static char RCSid[] =
  736. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.c,v 1.1 90/04/01 22:16:26 william Exp $";
  737.   #endif
  738.   
  739. --- 6,10 ----
  740.   #ifndef lint
  741.   static char RCSid[] =
  742. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/names.c,v 1.4 90/05/22 15:49:54 william Exp $";
  743.   #endif
  744.   
  745. ***************
  746. *** 57,62 ****
  747.      XGCValues    values;
  748.   
  749. !    values.foreground = myWhitePixel;
  750. !    values.background = myBlackPixel;
  751.      values.fill_style = FillSolid;
  752.      values.font = defaultFontPtr->fid;
  753. --- 57,62 ----
  754.      XGCValues    values;
  755.   
  756. !    values.foreground = myFgPixel;
  757. !    values.background = myBgPixel;
  758.      values.fill_style = FillSolid;
  759.      values.font = defaultFontPtr->fid;
  760. ***************
  761. *** 64,69 ****
  762.            GCForeground | GCBackground | GCFillStyle | GCFont, &values);
  763.   
  764. !    values.foreground = myBlackPixel;
  765. !    values.background = myWhitePixel;
  766.      revNameGC = XCreateGC (mainDisplay, rootWindow,
  767.            GCForeground | GCBackground | GCFillStyle | GCFont, &values);
  768. --- 64,69 ----
  769.            GCForeground | GCBackground | GCFillStyle | GCFont, &values);
  770.   
  771. !    values.foreground = myBgPixel;
  772. !    values.background = myFgPixel;
  773.      revNameGC = XCreateGC (mainDisplay, rootWindow,
  774.            GCForeground | GCBackground | GCFillStyle | GCFont, &values);
  775. ***************
  776. *** 105,125 ****
  777.      block_h = (int)(nameScrollAreaH * frac); /* number of pixels */
  778.   
  779. !    values.foreground = myBlackPixel;
  780. !    values.background = myWhitePixel;
  781.      values.function = GXcopy;
  782.      values.fill_style = FillSolid;
  783.      XChangeGC (mainDisplay, scrollGC,
  784. !          GCForeground | GCBackground | GCFunction | GCFillStyle,
  785. !          &values);
  786.      XFillRectangle (mainDisplay, nameScrollWin, scrollGC, 0, scrollBarW,
  787.            scrollBarW, nameScrollAreaH);
  788.   
  789. !    values.foreground = myWhitePixel;
  790. !    values.background = myBlackPixel;
  791.      values.fill_style = FillOpaqueStippled;
  792.      values.stipple = patPixmap[SCROLLPAT];
  793.      XChangeGC (mainDisplay, scrollGC,
  794. !          GCForeground | GCBackground | GCFillStyle | GCStipple,
  795. !          &values);
  796.      XFillRectangle (mainDisplay, nameScrollWin, scrollGC, 0,
  797.            scrollBarW+block_start, scrollBarW, block_h);
  798. --- 105,123 ----
  799.      block_h = (int)(nameScrollAreaH * frac); /* number of pixels */
  800.   
  801. !    values.foreground = myBgPixel;
  802. !    values.background = myFgPixel;
  803.      values.function = GXcopy;
  804.      values.fill_style = FillSolid;
  805.      XChangeGC (mainDisplay, scrollGC,
  806. !          GCForeground | GCBackground | GCFunction | GCFillStyle, &values);
  807.      XFillRectangle (mainDisplay, nameScrollWin, scrollGC, 0, scrollBarW,
  808.            scrollBarW, nameScrollAreaH);
  809.   
  810. !    values.foreground = myFgPixel;
  811. !    values.background = myBgPixel;
  812.      values.fill_style = FillOpaqueStippled;
  813.      values.stipple = patPixmap[SCROLLPAT];
  814.      XChangeGC (mainDisplay, scrollGC,
  815. !          GCForeground | GCBackground | GCFillStyle | GCStipple, &values);
  816.      XFillRectangle (mainDisplay, nameScrollWin, scrollGC, 0,
  817.            scrollBarW+block_start, scrollBarW, block_h);
  818. ***************
  819. *** 174,178 ****
  820.   
  821.   static
  822. ! void RedrawNameBaseWindow (Str, str_start, button_start)
  823.      char    * Str;
  824.      int    str_start, button_start;
  825. --- 172,176 ----
  826.   
  827.   static
  828. ! void RedrawNameBaseWindow (Str, str_start, button_start, W, H)
  829.      char    * Str;
  830.      int    str_start, button_start;
  831. ***************
  832. *** 180,183 ****
  833. --- 178,182 ----
  834.      int    top = defaultFontAsc+2;
  835.   
  836. +    XDrawRectangle (mainDisplay, nameBaseWin, nameGC, 0, 0, W-1, H-1);
  837.      XDrawString (mainDisplay, nameBaseWin, nameGC, str_start,
  838.            ROW_HEIGHT+top, Str, strlen(Str));
  839. ***************
  840. *** 365,369 ****
  841.   
  842.      if ((nameBaseWin = XCreateSimpleWindow (mainDisplay, rootWindow,
  843. !          win_x, win_y, w, h, brdrW, myWhitePixel, myBlackPixel)) == 0)
  844.      { printf ("Could not create desired popup window!\n"); exit (-1); }
  845.   
  846. --- 364,368 ----
  847.   
  848.      if ((nameBaseWin = XCreateSimpleWindow (mainDisplay, rootWindow,
  849. !          win_x, win_y, w, h, brdrW, myBorderPixel, myBgPixel)) == 0)
  850.      { printf ("Could not create desired popup window!\n"); exit (-1); }
  851.   
  852. ***************
  853. *** 371,376 ****
  854.   
  855.      if ((nameDspWin = XCreateSimpleWindow (mainDisplay, nameBaseWin, graph_start,
  856. !          3*ROW_HEIGHT, nameDspW, nameDspH, brdrW, myWhitePixel,
  857. !          myBlackPixel)) == 0)
  858.      { printf ("Could not create desired popup window!\n"); exit (-1); }
  859.   
  860. --- 370,375 ----
  861.   
  862.      if ((nameDspWin = XCreateSimpleWindow (mainDisplay, nameBaseWin, graph_start,
  863. !          3*ROW_HEIGHT, nameDspW, nameDspH, brdrW, myBorderPixel,
  864. !          myBgPixel)) == 0)
  865.      { printf ("Could not create desired popup window!\n"); exit (-1); }
  866.   
  867. ***************
  868. *** 377,381 ****
  869.      if ((nameScrollWin = XCreateSimpleWindow (mainDisplay, nameBaseWin,
  870.            graph_start+nameDspWinW, 3*ROW_HEIGHT, scrollBarW, nameDspH,
  871. !          brdrW, myWhitePixel, myBlackPixel)) == 0)
  872.      { printf ("Could not create desired popup scroll window!\n"); exit (-1); }
  873.   
  874. --- 376,380 ----
  875.      if ((nameScrollWin = XCreateSimpleWindow (mainDisplay, nameBaseWin,
  876.            graph_start+nameDspWinW, 3*ROW_HEIGHT, scrollBarW, nameDspH,
  877. !          brdrW, myBorderPixel, myBgPixel)) == 0)
  878.      { printf ("Could not create desired popup scroll window!\n"); exit (-1); }
  879.   
  880. ***************
  881. *** 403,407 ****
  882.         {
  883.            if (input.xany.window == nameBaseWin)
  884. !             RedrawNameBaseWindow (Str, str_start, button_start);
  885.            else if (input.xany.window == nameScrollWin)
  886.               RedrawNameScrollWin ();
  887. --- 402,406 ----
  888.         {
  889.            if (input.xany.window == nameBaseWin)
  890. !             RedrawNameBaseWindow (Str, str_start, button_start, w, h);
  891.            else if (input.xany.window == nameScrollWin)
  892.               RedrawNameScrollWin ();
  893. ***************
  894. *** 513,517 ****
  895.      struct direct    * d;
  896.      int            len, ext_len, count = 0;
  897. !    char            ext[80];
  898.   
  899.      if (*Path == '\0')
  900. --- 512,516 ----
  901.      struct direct    * d;
  902.      int            len, ext_len, count = 0;
  903. !    char            ext[MAXPATHLENGTH];
  904.   
  905.      if (*Path == '\0')
  906. ***************
  907. *** 572,576 ****
  908.   {
  909.      register int    i, index;
  910. !    char        s[80], full_name[MAXPATHLENGTH];
  911.      DspList    * dsp_ptr;
  912.   
  913. --- 571,575 ----
  914.   {
  915.      register int    i, index;
  916. !    char        s[MAXPATHLENGTH], full_name[MAXPATHLENGTH];
  917.      DspList    * dsp_ptr;
  918.   
  919. ***************
  920. *** 673,677 ****
  921.   {
  922.      register int        i, index;
  923. !    char            s[80];
  924.      DspList        * dsp_ptr;
  925.   
  926. --- 672,676 ----
  927.   {
  928.      register int        i, index;
  929. !    char            s[MAXPATHLENGTH];
  930.      DspList        * dsp_ptr;
  931.   
  932. *** oval.c.orig    Wed Jun 27 13:28:59 1990
  933. --- oval.c    Wed Jun 27 13:29:00 1990
  934. ***************
  935. *** 6,10 ****
  936.   #ifndef lint
  937.   static char RCSid[] =
  938. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/oval.c,v 1.2 90/05/16 08:30:59 william Exp $";
  939.   #endif
  940.   
  941. --- 6,10 ----
  942.   #ifndef lint
  943.   static char RCSid[] =
  944. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/oval.c,v 1.5 90/06/26 08:52:36 william Exp $";
  945.   #endif
  946.   
  947. ***************
  948. *** 175,179 ****
  949.      if (fill != 0)
  950.      {
  951. !       values.foreground = (fill == 2) ? myBlackPixel : pixel;
  952.         values.function = GXcopy;
  953.         values.fill_style = FillOpaqueStippled;
  954. --- 175,179 ----
  955.      if (fill != 0)
  956.      {
  957. !       values.foreground = (fill == 2) ? myBgPixel : pixel;
  958.         values.function = GXcopy;
  959.         values.fill_style = FillOpaqueStippled;
  960. ***************
  961. *** 186,190 ****
  962.      if (pen != 0)
  963.      {
  964. !       values.foreground = (pen == 2) ? myBlackPixel : pixel;
  965.         values.function = GXcopy;
  966.         values.fill_style = FillOpaqueStippled;
  967. --- 186,190 ----
  968.      if (pen != 0)
  969.      {
  970. !       values.foreground = (pen == 2) ? myBgPixel : pixel;
  971.         values.function = GXcopy;
  972.         values.fill_style = FillOpaqueStippled;
  973. ***************
  974. *** 301,305 ****
  975.         DrawOvalObj (drawWindow, drawOrigX, drawOrigY, topObj);
  976.         ovalDrawn = TRUE;
  977. !       fileModified = TRUE;
  978.      }
  979.   }
  980. --- 301,305 ----
  981.         DrawOvalObj (drawWindow, drawOrigX, drawOrigY, topObj);
  982.         ovalDrawn = TRUE;
  983. !       SetFileModified (TRUE);
  984.      }
  985.   }
  986. *** pattern.c.orig    Wed Jun 27 13:29:07 1990
  987. --- pattern.c    Wed Jun 27 13:29:09 1990
  988. ***************
  989. *** 6,10 ****
  990.   #ifndef lint
  991.   static char RCSid[] =
  992. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/pattern.c,v 1.1 90/04/01 22:16:30 william Exp $";
  993.   #endif
  994.   
  995. --- 6,10 ----
  996.   #ifndef lint
  997.   static char RCSid[] =
  998. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/pattern.c,v 1.2 90/06/26 00:11:14 william Exp $";
  999.   #endif
  1000.   
  1001. ***************
  1002. *** 147,151 ****
  1003.      if (changed)
  1004.      {
  1005. !       fileModified = TRUE;
  1006.         HighLightReverse ();
  1007.         RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
  1008. --- 147,151 ----
  1009.      if (changed)
  1010.      {
  1011. !       SetFileModified (TRUE);
  1012.         HighLightReverse ();
  1013.         RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
  1014. ***************
  1015. *** 239,243 ****
  1016.      if (changed)
  1017.      {
  1018. !       fileModified = TRUE;
  1019.         HighLightReverse ();
  1020.         ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
  1021. --- 239,243 ----
  1022.      if (changed)
  1023.      {
  1024. !       SetFileModified (TRUE);
  1025.         HighLightReverse ();
  1026.         ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
  1027. ***************
  1028. *** 360,364 ****
  1029.      if (changed)
  1030.      {
  1031. !       fileModified = TRUE;
  1032.         HighLightReverse ();
  1033.         ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
  1034. --- 360,364 ----
  1035.      if (changed)
  1036.      {
  1037. !       SetFileModified (TRUE);
  1038.         HighLightReverse ();
  1039.         ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
  1040. ***************
  1041. *** 493,497 ****
  1042.      if (changed)
  1043.      {
  1044. !       fileModified = TRUE;
  1045.         HighLightReverse ();
  1046.         ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
  1047. --- 493,497 ----
  1048.      if (changed)
  1049.      {
  1050. !       SetFileModified (TRUE);
  1051.         HighLightReverse ();
  1052.         ltx = selLtX; lty = selLtY; rbx = selRbX; rby = selRbY;
  1053. ***************
  1054. *** 642,646 ****
  1055.      if (changed)
  1056.      {
  1057. !       fileModified = TRUE;
  1058.         HighLightReverse ();
  1059.         RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
  1060. --- 642,646 ----
  1061.      if (changed)
  1062.      {
  1063. !       SetFileModified (TRUE);
  1064.         HighLightReverse ();
  1065.         RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
  1066. *** poly.c.orig    Wed Jun 27 13:29:17 1990
  1067. --- poly.c    Wed Jun 27 13:29:19 1990
  1068. ***************
  1069. *** 6,10 ****
  1070.   #ifndef lint
  1071.   static char RCSid[] =
  1072. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/poly.c,v 1.2 90/05/17 09:17:31 william Exp $";
  1073.   #endif
  1074.   
  1075. --- 6,10 ----
  1076.   #ifndef lint
  1077.   static char RCSid[] =
  1078. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/poly.c,v 1.4 90/06/26 00:11:18 william Exp $";
  1079.   #endif
  1080.   
  1081. ***************
  1082. *** 249,253 ****
  1083.      else if (P != 0)
  1084.      {
  1085. !       values.foreground = (P == 2) ? myBlackPixel : Pix;
  1086.         values.function = GXcopy;
  1087.         values.fill_style = FillOpaqueStippled;
  1088. --- 249,253 ----
  1089.      else if (P != 0)
  1090.      {
  1091. !       values.foreground = (P == 2) ? myBgPixel : Pix;
  1092.         values.function = GXcopy;
  1093.         values.fill_style = FillOpaqueStippled;
  1094. ***************
  1095. *** 421,425 ****
  1096.                  topObj->bbox.rby+(1<<zoomScale));
  1097.         polyDrawn = TRUE;
  1098. !       fileModified = TRUE;
  1099.      }
  1100.   }
  1101. --- 421,425 ----
  1102.                  topObj->bbox.rby+(1<<zoomScale));
  1103.         polyDrawn = TRUE;
  1104. !       SetFileModified (TRUE);
  1105.      }
  1106.   }
  1107. ***************
  1108. *** 649,653 ****
  1109.            }
  1110.            v[n].x = v[0].x; v[n].y = v[0].y;
  1111. !          values.foreground = (fill == BACKPAT) ? myBlackPixel : pixel;
  1112.            values.function = GXcopy;
  1113.            values.fill_style = FillOpaqueStippled;
  1114. --- 649,653 ----
  1115.            }
  1116.            v[n].x = v[0].x; v[n].y = v[0].y;
  1117. !          values.foreground = (fill == BACKPAT) ? myBgPixel : pixel;
  1118.            values.function = GXcopy;
  1119.            values.fill_style = FillOpaqueStippled;
  1120. *** polygon.c.orig    Wed Jun 27 13:29:28 1990
  1121. --- polygon.c    Wed Jun 27 13:29:30 1990
  1122. ***************
  1123. *** 6,10 ****
  1124.   #ifndef lint
  1125.   static char RCSid[] =
  1126. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/polygon.c,v 1.1 90/04/01 22:16:34 william Exp $";
  1127.   #endif
  1128.   
  1129. --- 6,10 ----
  1130.   #ifndef lint
  1131.   static char RCSid[] =
  1132. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/polygon.c,v 1.3 90/06/26 00:11:22 william Exp $";
  1133.   #endif
  1134.   
  1135. ***************
  1136. *** 211,215 ****
  1137.         if (fill != 0)
  1138.         {
  1139. !          values.foreground = (fill == 2) ? myBlackPixel : pixel;
  1140.            values.function = GXcopy;
  1141.            values.fill_style = FillOpaqueStippled;
  1142. --- 211,215 ----
  1143.         if (fill != 0)
  1144.         {
  1145. !          values.foreground = (fill == 2) ? myBgPixel : pixel;
  1146.            values.function = GXcopy;
  1147.            values.fill_style = FillOpaqueStippled;
  1148. ***************
  1149. *** 223,227 ****
  1150.         if (pen != 0)
  1151.         {
  1152. !          values.foreground = (pen == 2) ? myBlackPixel : pixel;
  1153.            values.function = GXcopy;
  1154.            values.fill_style = FillOpaqueStippled;
  1155. --- 223,227 ----
  1156.         if (pen != 0)
  1157.         {
  1158. !          values.foreground = (pen == 2) ? myBgPixel : pixel;
  1159.            values.function = GXcopy;
  1160.            values.fill_style = FillOpaqueStippled;
  1161. ***************
  1162. *** 354,358 ****
  1163.            if (penPat != 0 && (button_ev->button == Button1 || num_pts != 1))
  1164.            {
  1165. !             values.foreground = (penPat == 2) ? myBlackPixel : pixel;
  1166.               values.function = GXcopy;
  1167.               values.fill_style = FillOpaqueStippled;
  1168. --- 354,358 ----
  1169.            if (penPat != 0 && (button_ev->button == Button1 || num_pts != 1))
  1170.            {
  1171. !             values.foreground = (penPat == 2) ? myBgPixel : pixel;
  1172.               values.function = GXcopy;
  1173.               values.fill_style = FillOpaqueStippled;
  1174. ***************
  1175. *** 401,405 ****
  1176.                     }
  1177.   
  1178. !                   values.foreground = (penPat == 2) ? myBlackPixel : pixel;
  1179.                     values.function = GXcopy;
  1180.                     values.fill_style = FillOpaqueStippled;
  1181. --- 401,405 ----
  1182.                     }
  1183.   
  1184. !                   values.foreground = (penPat == 2) ? myBgPixel : pixel;
  1185.                     values.function = GXcopy;
  1186.                     values.fill_style = FillOpaqueStippled;
  1187. ***************
  1188. *** 456,460 ****
  1189.   
  1190.            polygonDrawn = TRUE;
  1191. !          fileModified = TRUE;
  1192.            break;
  1193.      }
  1194. --- 456,460 ----
  1195.   
  1196.            polygonDrawn = TRUE;
  1197. !          SetFileModified (TRUE);
  1198.            break;
  1199.      }
  1200. *** prtgif.c.orig    Wed Jun 27 13:29:41 1990
  1201. --- prtgif.c    Wed Jun 27 13:29:42 1990
  1202. ***************
  1203. *** 6,10 ****
  1204.   #ifndef lint
  1205.   static char RCSid[] =
  1206. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/prtgif.c,v 1.1 90/05/02 08:23:04 william Exp $";
  1207.   #endif
  1208.   
  1209. --- 6,10 ----
  1210.   #ifndef lint
  1211.   static char RCSid[] =
  1212. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/prtgif.c,v 1.9 90/06/05 10:09:52 william Exp $";
  1213.   #endif
  1214.   
  1215. ***************
  1216. *** 32,36 ****
  1217.   extern int    PDrawReadObj ();
  1218.   
  1219. ! static char    drawPath[256];
  1220.   static short    pDrawCursorH[] =
  1221.   {
  1222. --- 32,36 ----
  1223.   extern int    PDrawReadObj ();
  1224.   
  1225. ! static char    drawPath[MAXSTRING];
  1226.   static short    pDrawCursorH[] =
  1227.   {
  1228. ***************
  1229. *** 293,297 ****
  1230.      struct StrRec    * s_ptr;
  1231.      struct TextRec    * text_ptr;
  1232. !    char            color_str[20], * s, tmp_str[80], inbuf[255];
  1233.      int            num_lines, x, y, font, style, size;
  1234.      int            text_just, rotate, pen;
  1235. --- 293,298 ----
  1236.      struct StrRec    * s_ptr;
  1237.      struct TextRec    * text_ptr;
  1238. !    char            color_str[80], * s;
  1239. !    char            tmp_str[MAXSTRING+1], inbuf[MAXSTRING+1];
  1240.      int            num_lines, x, y, font, style, size;
  1241.      int            text_just, rotate, pen;
  1242. ***************
  1243. *** 328,332 ****
  1244.      for (i = 0; i < num_lines; i++)
  1245.      {
  1246. !       fgets (inbuf, 255, FP);
  1247.         strcpy(tmp_str, FindChar ('"', inbuf));
  1248.         s = FindChar ('"', tmp_str);
  1249. --- 329,333 ----
  1250.      for (i = 0; i < num_lines; i++)
  1251.      {
  1252. !       fgets (inbuf, MAXSTRING, FP);
  1253.         strcpy(tmp_str, FindChar ('"', inbuf));
  1254.         s = FindChar ('"', tmp_str);
  1255. ***************
  1256. *** 430,437 ****
  1257.   {
  1258.      struct ObjRec    * TextObj;
  1259. !    char            inbuf[255], * s, name[80], value[80];
  1260.      int            len, shown, nameshown, inherited;
  1261.    
  1262. !    fgets (inbuf, 255, FP); 
  1263.   
  1264.      if (inbuf[0] == ']')  return (FALSE);
  1265. --- 431,439 ----
  1266.   {
  1267.      struct ObjRec    * TextObj;
  1268. !    char            inbuf[MAXSTRING+1], * s;
  1269. !    char            name[MAXSTRING+1], value[MAXSTRING+1];
  1270.      int            len, shown, nameshown, inherited;
  1271.    
  1272. !    fgets (inbuf, MAXSTRING, FP); 
  1273.   
  1274.      if (inbuf[0] == ']')  return (FALSE);
  1275. ***************
  1276. *** 472,480 ****
  1277.      struct ObjRec    * * ObjPtr;
  1278.   {
  1279. !    char            inbuf[255], obj_name[10], tmp_str[80], * s, * s1;
  1280.      int            len, id;
  1281.      struct AttrRec       * top_attr = NULL, * bot_attr = NULL, * attr_ptr;
  1282.   
  1283. !    while (fgets (inbuf, 255, FP) != NULL)
  1284.      {
  1285.         if (inbuf[0] == ']') return (FALSE);
  1286. --- 474,483 ----
  1287.      struct ObjRec    * * ObjPtr;
  1288.   {
  1289. !    char            inbuf[MAXSTRING+1], obj_name[10], tmp_str[MAXSTRING+1];
  1290. !    char            * s, * s1;
  1291.      int            len, id;
  1292.      struct AttrRec       * top_attr = NULL, * bot_attr = NULL, * attr_ptr;
  1293.   
  1294. !    while (fgets (inbuf, MAXSTRING, FP) != NULL)
  1295.      {
  1296.         if (inbuf[0] == ']') return (FALSE);
  1297. ***************
  1298. *** 571,575 ****
  1299.            PDrawReadGroupObj (FP, ObjPtr);
  1300.            (*ObjPtr)->type = OBJ_ICON;
  1301. !          if (fgets (inbuf, 255, FP) == NULL) return (FALSE);
  1302.   
  1303.            strcpy(tmp_str, FindChar ('"', inbuf));
  1304. --- 574,578 ----
  1305.            PDrawReadGroupObj (FP, ObjPtr);
  1306.            (*ObjPtr)->type = OBJ_ICON;
  1307. !          if (fgets (inbuf, MAXSTRING, FP) == NULL) return (FALSE);
  1308.   
  1309.            strcpy(tmp_str, FindChar ('"', inbuf));
  1310. ***************
  1311. *** 643,660 ****
  1312.   {
  1313.      register struct ObjRec    * obj_ptr;
  1314. !    char                cmd[256];
  1315. !    FILE                * fp;
  1316.   
  1317.      if (botObj == NULL) { printf ("No object to print."); return; }
  1318.   
  1319. !    system ("rm -f /tmp/DRAW.PS /tmp/DUMP.PS");
  1320. !    if ((fp = fopen ("/tmp/DUMP.PS", "w")) == NULL)
  1321.      {
  1322. !       Msg ("Can not create /tmp/DUMP.PS, print aborted.");
  1323.         return;
  1324.      }
  1325.   
  1326. !    printf ("Writing to /tmp/DRAW.PS ...\n");
  1327.   
  1328.      for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev)
  1329.         PDrawDumpAllObj (fp, obj_ptr);
  1330. --- 646,692 ----
  1331.   {
  1332.      register struct ObjRec    * obj_ptr;
  1333. !    char                cmd[MAXSTRING+1], tmp_str[MAXSTRING+1];
  1334. !    char                tmp_file[MAXSTRING+1], ps_file[MAXSTRING+1];
  1335. !    FILE                * fp, * fps;
  1336.   
  1337.      if (botObj == NULL) { printf ("No object to print."); return; }
  1338.   
  1339. !    strcpy (tmp_file, "/tmp/TgifXXXXXX");
  1340. !    mktemp (tmp_file);
  1341. !    unlink (tmp_file);
  1342. !    if ((fp = fopen (tmp_file, "w")) == NULL)
  1343.      {
  1344. !       printf ("Can not create $s, print aborted.", tmp_file);
  1345.         return;
  1346.      }
  1347.   
  1348. !    printf ("Writing to %s ...\n", tmp_file);
  1349.   
  1350. +    fprintf (fp, "%%!\n");
  1351. +    DumpBBox (fp);
  1352. +    sprintf(ps_file, "%s/.psmac", drawPath);
  1353. +    if ((fps = fopen (ps_file, "r")) == NULL)
  1354. +    {
  1355. +       printf ("Can not find %s, print aborted.\n", ps_file);
  1356. +       fclose (fp);
  1357. +       unlink (tmp_file);
  1358. +       return;
  1359. +    }
  1360. +    while (fgets (tmp_str, 256, fps) != NULL) /* copy the header file */
  1361. +       fputs (tmp_str, fp);
  1362. +    fprintf (fp, "gsave\n\n");
  1363. +    switch (pageStyle)
  1364. +    {
  1365. +       case LANDSCAPE:
  1366. +       case HIGHLAND:
  1367. +       case SLIDELAND: fprintf (fp, "90 rotate\n"); break;
  1368. +    }
  1369. +    fprintf (fp, "%1d %s mul %1d %s mul translate\n", psDotsPerInch,
  1370. +          psXOffStr[pageStyle], psDotsPerInch, psYOffStr[pageStyle]);
  1371. +    fprintf (fp, "%s -%s scale\n\n",
  1372. +          psScaleStr[pageStyle], psScaleStr[pageStyle]);
  1373.      for (obj_ptr = botObj; obj_ptr != NULL; obj_ptr = obj_ptr->prev)
  1374.         PDrawDumpAllObj (fp, obj_ptr);
  1375. ***************
  1376. *** 664,700 ****
  1377.      fclose (fp);
  1378.   
  1379. !    switch (pageStyle)
  1380.      {
  1381. !       case PORTRAIT:
  1382. !          sprintf (cmd, "cat %s/.psmac %s/.port /tmp/DUMP.PS > /tmp/DRAW.PS",
  1383. !                drawPath, drawPath);
  1384. !          break;
  1385. !       case LANDSCAPE:
  1386. !          sprintf (cmd, "cat %s/.psmac %s/.land /tmp/DUMP.PS > /tmp/DRAW.PS",
  1387. !                drawPath, drawPath);
  1388. !          break;
  1389. !       case HIGHPORT:
  1390. !          sprintf (cmd, "cat %s/.psmac %s/.hiport /tmp/DUMP.PS > /tmp/DRAW.PS",
  1391. !                drawPath, drawPath);
  1392. !          break;
  1393. !       case HIGHLAND:
  1394. !          sprintf (cmd, "cat %s/.psmac %s/.hiland /tmp/DUMP.PS > /tmp/DRAW.PS",
  1395. !                drawPath, drawPath);
  1396. !          break;
  1397. !       case SLIDEPORT:
  1398. !          sprintf (cmd, "cat %s/.psmac %s/.slideport /tmp/DUMP.PS > /tmp/DRAW.PS",
  1399. !                drawPath, drawPath);
  1400. !          break;
  1401. !       case SLIDELAND:
  1402. !          sprintf (cmd, "cat %s/.psmac %s/.slideland /tmp/DUMP.PS > /tmp/DRAW.PS",
  1403. !                drawPath, drawPath);
  1404. !          break;
  1405.      }
  1406. !    system (cmd);
  1407. !    chmod ("/tmp/DRAW.PS", 0777);
  1408. !    chmod ("/tmp/DUMP.PS", 0777);
  1409. !    system ("lpr /tmp/DRAW.PS");
  1410.   
  1411. !    printf ("/tmp/DRAW.PS printed.\n\n");
  1412.   }
  1413.   
  1414. --- 696,712 ----
  1415.      fclose (fp);
  1416.   
  1417. !    sprintf (cmd, "lpr %s 2>&1", tmp_file);
  1418. !    if ((fp = popen (cmd, "r")) == NULL)
  1419.      {
  1420. !       printf ("Can not execute '%s', print aborted.\n", cmd);
  1421. !       unlink (tmp_file);
  1422. !       return;
  1423.      }
  1424. !    while (fgets (tmp_str, 256, fp) != NULL) sleep (5);
  1425.   
  1426. !    pclose (fp);
  1427. !    unlink (tmp_file);
  1428. !    printf ("%s printed.\n\n", tmp_file);
  1429.   }
  1430.   
  1431. ***************
  1432. *** 703,707 ****
  1433.      char    * argv[];
  1434.   {
  1435. !    char    inbuf[256];
  1436.      char    * c_ptr;
  1437.   
  1438. --- 715,719 ----
  1439.      char    * argv[];
  1440.   {
  1441. !    char    inbuf[MAXSTRING+1];
  1442.      char    * c_ptr;
  1443.   
  1444. ***************
  1445. *** 709,717 ****
  1446.   
  1447.      if ((c_ptr = getenv ("TGIFPATH")) == NULL)
  1448. !       strcpy (drawPath, "/u/tangram/u/william/X11/TGIF");
  1449.      else
  1450. !       if (strlen (c_ptr) >= 255)
  1451.            /* must be an error */
  1452. !          strcpy (drawPath, "/u/tangram/u/william/X11/TGIF");
  1453.         else
  1454.            strcpy (drawPath, c_ptr);
  1455. --- 721,729 ----
  1456.   
  1457.      if ((c_ptr = getenv ("TGIFPATH")) == NULL)
  1458. !       strcpy (drawPath, TGIF_PATH);
  1459.      else
  1460. !       if (strlen (c_ptr) >= MAXSTRING)
  1461.            /* must be an error */
  1462. !          strcpy (drawPath, TGIF_PATH);
  1463.         else
  1464.            strcpy (drawPath, c_ptr);
  1465. ***************
  1466. *** 721,725 ****
  1467.         case 1:
  1468.            printf ("\nDraw File Name to Print> ");
  1469. !          while (fgets (inbuf, 255, stdin) != NULL)
  1470.            {
  1471.               PDrawLoad (inbuf);
  1472. --- 733,737 ----
  1473.         case 1:
  1474.            printf ("\nDraw File Name to Print> ");
  1475. !          while (fgets (inbuf, MAXSTRING, stdin) != NULL)
  1476.            {
  1477.               PDrawLoad (inbuf);
  1478. *** raster.c.orig    Wed Jun 27 13:29:49 1990
  1479. --- raster.c    Wed Jun 27 13:29:51 1990
  1480. ***************
  1481. *** 6,10 ****
  1482.   #ifndef lint
  1483.   static char RCSid[] =
  1484. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/raster.c,v 1.2 90/05/07 15:28:20 william Exp $";
  1485.   #endif
  1486.   
  1487. --- 6,10 ----
  1488.   #ifndef lint
  1489.   static char RCSid[] =
  1490. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/raster.c,v 1.3 90/05/22 14:16:44 william Exp $";
  1491.   #endif
  1492.   
  1493. ***************
  1494. *** 129,134 ****
  1495.      XGCValues    values;
  1496.   
  1497. !    values.foreground = myWhitePixel;
  1498. !    values.background = myBlackPixel;
  1499.      values.fill_style = FillOpaqueStippled;
  1500.   
  1501. --- 129,134 ----
  1502.      XGCValues    values;
  1503.   
  1504. !    values.foreground = myFgPixel;
  1505. !    values.background = myBgPixel;
  1506.      values.fill_style = FillOpaqueStippled;
  1507.   
  1508. ***************
  1509. *** 141,145 ****
  1510.   
  1511.      values.join_style = JoinBevel;
  1512. !    values.background = myBlackPixel;
  1513.      drawGC = XCreateGC (mainDisplay, mainWindow,
  1514.            GCBackground | GCJoinStyle, &values);
  1515. --- 141,145 ----
  1516.   
  1517.      values.join_style = JoinBevel;
  1518. !    values.background = myBgPixel;
  1519.      drawGC = XCreateGC (mainDisplay, mainWindow,
  1520.            GCBackground | GCJoinStyle, &values);
  1521. *** rect.c.orig    Wed Jun 27 13:29:56 1990
  1522. --- rect.c    Wed Jun 27 13:29:57 1990
  1523. ***************
  1524. *** 6,10 ****
  1525.   #ifndef lint
  1526.   static char RCSid[] =
  1527. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/rect.c,v 1.1 90/04/01 22:16:37 william Exp $";
  1528.   #endif
  1529.   
  1530. --- 6,10 ----
  1531.   #ifndef lint
  1532.   static char RCSid[] =
  1533. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/rect.c,v 1.2 90/06/15 01:13:58 william Exp $";
  1534.   #endif
  1535.   
  1536. ***************
  1537. *** 166,170 ****
  1538.      if (rx >= ry)
  1539.      {  /* flat oval */
  1540. !       tmp_y = sqrt ((double)(ry*ry*(1-(X-cx)*(X-cx)/rx/rx)));
  1541.         y1 = cy - tmp_y;
  1542.         y2 = cy + tmp_y;
  1543. --- 166,170 ----
  1544.      if (rx >= ry)
  1545.      {  /* flat oval */
  1546. !       tmp_y = sqrt (fabs ((double)(ry*ry*(1-(X-cx)*(X-cx)/rx/rx))));
  1547.         y1 = cy - tmp_y;
  1548.         y2 = cy + tmp_y;
  1549. ***************
  1550. *** 173,177 ****
  1551.      else
  1552.      {  /* tall oval */
  1553. !       tmp_x = sqrt ((double)(rx*rx*(1-(Y-cy)*(Y-cy)/ry/ry)));
  1554.         x1 = cx - tmp_x;
  1555.         x2 = cx + tmp_x;
  1556. --- 173,177 ----
  1557.      else
  1558.      {  /* tall oval */
  1559. !       tmp_x = sqrt (fabs ((double)(rx*rx*(1-(Y-cy)*(Y-cy)/ry/ry))));
  1560.         x1 = cx - tmp_x;
  1561.         x2 = cx + tmp_x;
  1562. *** ruler.c.orig    Wed Jun 27 13:30:05 1990
  1563. --- ruler.c    Wed Jun 27 13:30:06 1990
  1564. ***************
  1565. *** 6,10 ****
  1566.   #ifndef lint
  1567.   static char RCSid[] =
  1568. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/ruler.c,v 1.1 90/04/01 22:16:38 william Exp $";
  1569.   #endif
  1570.   
  1571. --- 6,10 ----
  1572.   #ifndef lint
  1573.   static char RCSid[] =
  1574. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/ruler.c,v 1.3 90/05/22 16:59:40 william Exp $";
  1575.   #endif
  1576.   
  1577. ***************
  1578. *** 32,37 ****
  1579.      XGCValues    values;
  1580.   
  1581. !    values.foreground = myWhitePixel;
  1582. !    values.background = myBlackPixel;
  1583.      values.fill_style = FillSolid;
  1584.      values.font = rulerFontPtr->fid;
  1585. --- 32,37 ----
  1586.      XGCValues    values;
  1587.   
  1588. !    values.foreground = myFgPixel;
  1589. !    values.background = myBgPixel;
  1590.      values.fill_style = FillSolid;
  1591.      values.font = rulerFontPtr->fid;
  1592. ***************
  1593. *** 58,63 ****
  1594.      while (XCheckWindowEvent (mainDisplay, hRuleWindow, ExposureMask, &ev)) ;
  1595.   
  1596. !    inc = (gridOn) ? xyGrid : DEFAULT_GRID;
  1597. !    abs_inc = (gridOn) ? (xyGrid<<zoomScale) : (DEFAULT_GRID<<zoomScale);
  1598.   
  1599.      start = ((int)(drawOrigX / inc)) * inc;
  1600. --- 58,63 ----
  1601.      while (XCheckWindowEvent (mainDisplay, hRuleWindow, ExposureMask, &ev)) ;
  1602.   
  1603. !    inc = xyGrid;
  1604. !    abs_inc = (xyGrid<<zoomScale);
  1605.   
  1606.      start = ((int)(drawOrigX / inc)) * inc;
  1607. ***************
  1608. *** 108,113 ****
  1609.      while (XCheckWindowEvent (mainDisplay, vRuleWindow, ExposureMask, &ev)) ;
  1610.   
  1611. !    inc = (gridOn) ? xyGrid : DEFAULT_GRID;
  1612. !    abs_inc = (gridOn) ? (xyGrid<<zoomScale) : (DEFAULT_GRID<<zoomScale);
  1613.   
  1614.      start = ((int)(drawOrigY / inc)) * inc;
  1615. --- 108,113 ----
  1616.      while (XCheckWindowEvent (mainDisplay, vRuleWindow, ExposureMask, &ev)) ;
  1617.   
  1618. !    inc = xyGrid;
  1619. !    abs_inc = (xyGrid<<zoomScale);
  1620.   
  1621.      start = ((int)(drawOrigY / inc)) * inc;
  1622. *** scroll.c.orig    Wed Jun 27 13:30:12 1990
  1623. --- scroll.c    Wed Jun 27 13:30:13 1990
  1624. ***************
  1625. *** 6,10 ****
  1626.   #ifndef lint
  1627.   static char RCSid[] =
  1628. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/scroll.c,v 1.1 90/04/01 22:16:39 william Exp $";
  1629.   #endif
  1630.   
  1631. --- 6,10 ----
  1632.   #ifndef lint
  1633.   static char RCSid[] =
  1634. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/scroll.c,v 1.3 90/05/22 14:20:12 william Exp $";
  1635.   #endif
  1636.   
  1637. ***************
  1638. *** 53,58 ****
  1639.      scrollPixmap = XCreatePixmap (mainDisplay, mainWindow, scrollBarW,
  1640.            scrollBarW, mainDepth);
  1641. !    values.foreground = myWhitePixel;
  1642. !    values.background = myBlackPixel;
  1643.      values.fill_style = FillTiled;
  1644.      values.tile = scrollPixmap;
  1645. --- 53,58 ----
  1646.      scrollPixmap = XCreatePixmap (mainDisplay, mainWindow, scrollBarW,
  1647.            scrollBarW, mainDepth);
  1648. !    values.foreground = myFgPixel;
  1649. !    values.background = myBgPixel;
  1650.      values.fill_style = FillTiled;
  1651.      values.tile = scrollPixmap;
  1652. ***************
  1653. *** 86,91 ****
  1654.      block_h = (int)(scrollAreaH * frac);
  1655.   
  1656. !    values.foreground = myBlackPixel;
  1657. !    values.background = myWhitePixel;
  1658.      values.function = GXcopy;
  1659.      values.fill_style = FillSolid;
  1660. --- 86,91 ----
  1661.      block_h = (int)(scrollAreaH * frac);
  1662.   
  1663. !    values.foreground = myBgPixel;
  1664. !    values.background = myFgPixel;
  1665.      values.function = GXcopy;
  1666.      values.fill_style = FillSolid;
  1667. ***************
  1668. *** 96,101 ****
  1669.            scrollBarW, scrollAreaH);
  1670.   
  1671. !    values.foreground = myWhitePixel;
  1672. !    values.background = myBlackPixel;
  1673.      values.fill_style = FillOpaqueStippled;
  1674.      values.stipple = patPixmap[SCROLLPAT];
  1675. --- 96,101 ----
  1676.            scrollBarW, scrollAreaH);
  1677.   
  1678. !    values.foreground = myFgPixel;
  1679. !    values.background = myBgPixel;
  1680.      values.fill_style = FillOpaqueStippled;
  1681.      values.stipple = patPixmap[SCROLLPAT];
  1682. ***************
  1683. *** 135,140 ****
  1684.      block_w = (int)(scrollAreaW * frac);
  1685.   
  1686. !    values.foreground = myBlackPixel;
  1687. !    values.background = myWhitePixel;
  1688.      values.function = GXcopy;
  1689.      values.fill_style = FillSolid;
  1690. --- 135,140 ----
  1691.      block_w = (int)(scrollAreaW * frac);
  1692.   
  1693. !    values.foreground = myBgPixel;
  1694. !    values.background = myFgPixel;
  1695.      values.function = GXcopy;
  1696.      values.fill_style = FillSolid;
  1697. ***************
  1698. *** 145,150 ****
  1699.            scrollAreaW, scrollBarW);
  1700.   
  1701. !    values.foreground = myWhitePixel;
  1702. !    values.background = myBlackPixel;
  1703.      values.fill_style = FillOpaqueStippled;
  1704.      values.stipple = patPixmap[SCROLLPAT];
  1705. --- 145,150 ----
  1706.            scrollAreaW, scrollBarW);
  1707.   
  1708. !    values.foreground = myFgPixel;
  1709. !    values.background = myBgPixel;
  1710.      values.fill_style = FillOpaqueStippled;
  1711.      values.stipple = patPixmap[SCROLLPAT];
  1712. ***************
  1713. *** 169,172 ****
  1714. --- 169,204 ----
  1715.   }
  1716.   
  1717. + void ScrollUp ()
  1718. + {
  1719. +    if (drawOrigY != 0)
  1720. +    {
  1721. +       drawOrigY -= HALF_INCH;
  1722. +       RedrawVScrollWindow ();
  1723. +       UpdDrawWinBBox ();
  1724. +       AdjSplineVs ();
  1725. +       AdjustCurText (0, HALF_INCH);
  1726. +       ClearAndRedrawDrawWindow ();
  1727. +       XClearWindow (mainDisplay, vRuleWindow);
  1728. +       RedrawVRuler ();
  1729. +    }
  1730. + }
  1731. + void ScrollDown ()
  1732. + {
  1733. +    if (paperHeight <= drawWinH) return;
  1734. +    if (drawOrigY+drawWinH < paperHeight)
  1735. +    {
  1736. +       drawOrigY += HALF_INCH;
  1737. +       RedrawVScrollWindow ();
  1738. +       UpdDrawWinBBox ();
  1739. +       AdjSplineVs ();
  1740. +       AdjustCurText (0, -HALF_INCH);
  1741. +       ClearAndRedrawDrawWindow ();
  1742. +       XClearWindow (mainDisplay, vRuleWindow);
  1743. +       RedrawVRuler ();
  1744. +    }
  1745. + }
  1746.   static
  1747.   void VSBarHandler (button_ev)
  1748. ***************
  1749. *** 179,215 ****
  1750.      {
  1751.         if (button_ev->y < scrollBarW)
  1752. !       {
  1753. !          /* clicked in the uparrow */
  1754. !          if (drawOrigY != 0)
  1755. !          {
  1756. !             drawOrigY -= HALF_INCH;
  1757. !             RedrawVScrollWindow ();
  1758. !             UpdDrawWinBBox ();
  1759. !             AdjSplineVs ();
  1760. !             AdjustCurText (0, HALF_INCH);
  1761. !             ClearAndRedrawDrawWindow ();
  1762. !             XClearWindow (mainDisplay, vRuleWindow);
  1763. !             RedrawVRuler ();
  1764. !             return;
  1765. !          }
  1766. !       }
  1767.         else if (button_ev->y >= scrollBarW+scrollAreaH)
  1768. !       {
  1769. !          /* clicked in the downarrow */
  1770. !          if (paperHeight <= drawWinH) return;
  1771. !          if (drawOrigY+drawWinH < paperHeight)
  1772. !          {
  1773. !             drawOrigY += HALF_INCH;
  1774. !             RedrawVScrollWindow ();
  1775. !             UpdDrawWinBBox ();
  1776. !             AdjSplineVs ();
  1777. !             AdjustCurText (0, -HALF_INCH);
  1778. !             ClearAndRedrawDrawWindow ();
  1779. !             XClearWindow (mainDisplay, vRuleWindow);
  1780. !             RedrawVRuler ();
  1781. !             return;
  1782. !          }
  1783. !       }
  1784.         else /* clicked in the middle region */
  1785.         {
  1786. --- 211,217 ----
  1787.      {
  1788.         if (button_ev->y < scrollBarW)
  1789. !          ScrollUp (); /* clicked in the uparrow */
  1790.         else if (button_ev->y >= scrollBarW+scrollAreaH)
  1791. !          ScrollDown (); /* clicked in the downarrow */
  1792.         else /* clicked in the middle region */
  1793.         {
  1794. ***************
  1795. *** 257,260 ****
  1796. --- 259,294 ----
  1797.   }
  1798.   
  1799. + void ScrollLeft ()
  1800. + {
  1801. +    if (drawOrigX != 0)
  1802. +    {
  1803. +       drawOrigX -= HALF_INCH;
  1804. +       RedrawHScrollWindow ();
  1805. +       UpdDrawWinBBox ();
  1806. +       AdjSplineVs ();
  1807. +       AdjustCurText (HALF_INCH, 0);
  1808. +       ClearAndRedrawDrawWindow ();
  1809. +       XClearWindow (mainDisplay, hRuleWindow);
  1810. +       RedrawHRuler ();
  1811. +    }
  1812. + }
  1813. + void ScrollRight ()
  1814. + {
  1815. +    if (paperWidth <= drawWinW) return;
  1816. +    if (drawOrigX+drawWinW < paperWidth)
  1817. +    {
  1818. +       drawOrigX += HALF_INCH;
  1819. +       RedrawHScrollWindow ();
  1820. +       UpdDrawWinBBox ();
  1821. +       AdjSplineVs ();
  1822. +       AdjustCurText (-HALF_INCH, 0);
  1823. +       ClearAndRedrawDrawWindow ();
  1824. +       XClearWindow (mainDisplay, hRuleWindow);
  1825. +       RedrawHRuler ();
  1826. +    }
  1827. + }
  1828.   static
  1829.   void HSBarHandler (button_ev)
  1830. ***************
  1831. *** 267,303 ****
  1832.      {
  1833.         if (button_ev->x < scrollBarW)
  1834. !       {
  1835. !          /* clicked in the leftarrow */
  1836. !          if (drawOrigX != 0)
  1837. !          {
  1838. !             drawOrigX -= HALF_INCH;
  1839. !             RedrawHScrollWindow ();
  1840. !             UpdDrawWinBBox ();
  1841. !             AdjSplineVs ();
  1842. !             AdjustCurText (HALF_INCH, 0);
  1843. !             ClearAndRedrawDrawWindow ();
  1844. !             XClearWindow (mainDisplay, hRuleWindow);
  1845. !             RedrawHRuler ();
  1846. !             return;
  1847. !          }
  1848. !       }
  1849.         else if (button_ev->x >= scrollBarW+scrollAreaW)
  1850. !       {
  1851. !          /* clicked in the rightarrow */
  1852. !          if (paperWidth <= drawWinW) return;
  1853. !          if (drawOrigX+drawWinW < paperWidth)
  1854. !          {
  1855. !             drawOrigX += HALF_INCH;
  1856. !             RedrawHScrollWindow ();
  1857. !             UpdDrawWinBBox ();
  1858. !             AdjSplineVs ();
  1859. !             AdjustCurText (-HALF_INCH, 0);
  1860. !             ClearAndRedrawDrawWindow ();
  1861. !             XClearWindow (mainDisplay, hRuleWindow);
  1862. !             RedrawHRuler ();
  1863. !             return;
  1864. !          }
  1865. !       }
  1866.         else /* clicked in the middle region */
  1867.         {
  1868. --- 301,307 ----
  1869.      {
  1870.         if (button_ev->x < scrollBarW)
  1871. !          ScrollLeft (); /* clicked in the leftarrow */
  1872.         else if (button_ev->x >= scrollBarW+scrollAreaW)
  1873. !          ScrollRight (); /* clicked in the rightarrow */
  1874.         else /* clicked in the middle region */
  1875.         {
  1876. ***************
  1877. *** 349,353 ****
  1878.   {
  1879.      int        row_offset, len, index, x, y, func, level;
  1880. -    char        new_file_name[80];
  1881.      XButtonEvent    * button_ev;
  1882.   
  1883. --- 353,356 ----
  1884. *** select.c.orig    Wed Jun 27 13:30:25 1990
  1885. --- select.c    Wed Jun 27 13:30:27 1990
  1886. ***************
  1887. *** 6,10 ****
  1888.   #ifndef lint
  1889.   static char RCSid[] =
  1890. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/select.c,v 1.1 90/04/01 22:16:40 william Exp $";
  1891.   #endif
  1892.   
  1893. --- 6,10 ----
  1894.   #ifndef lint
  1895.   static char RCSid[] =
  1896. !       "@(#)$Header: /n/kona/u/tangram/u/william/X11/TGIF/RCS/select.c,v 1.4 90/06/26 00:11:25 william Exp $";
  1897.   #endif
  1898.   
  1899. ***************
  1900. *** 354,358 ****
  1901.      unsigned int    status;
  1902.      int         end_x, end_y;
  1903. -    XButtonEvent    input;
  1904.      int         done = FALSE, ltx, lty, rbx, rby, dx, dy;
  1905.      int         new_end_x, new_end_y;
  1906. --- 354,357 ----
  1907. ***************
  1908. *** 362,366 ****
  1909.   
  1910.      SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
  1911. !    XGrabPointer (mainDisplay, drawWindow, FALSE, ButtonReleaseMask,
  1912.            GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
  1913.      
  1914. --- 361,365 ----
  1915.   
  1916.      SelBox (drawWindow, revDefaultGC, XOff, YOff, end_x, end_y);
  1917. !    XGrabPointer (mainDisplay, drawWindow, False, None,
  1918.            GrabModeAsync, GrabModeAsync, None, handCursor, CurrentTime);
  1919.      
  1920. ***************
  1921. *** 613,617 ****
  1922.      HighLightForward ();
  1923.      SetCurChoice (NOTHING);
  1924. !    fileModified = TRUE;
  1925.      justDupped = FALSE;
  1926.   }
  1927. --- 612,616 ----
  1928.      HighLightForward ();
  1929.      SetCurChoice (NOTHING);
  1930. !    SetFileModified (TRUE);
  1931.      justDupped = FALSE;
  1932.   }
  1933. ***************
  1934. *** 632,636 ****
  1935.      RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
  1936.            selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
  1937. !    fileModified = TRUE;
  1938.      justDupped = FALSE;
  1939.   }
  1940. --- 631,635 ----
  1941.      RedrawAnArea (botObj, selLtX-(1<<zoomScale), selLtY-(1<<zoomScale),
  1942.            selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
  1943. !    SetFileModified (TRUE);
  1944.      justDupped = FALSE;
  1945.   }
  1946. ***************
  1947. *** 656,660 ****
  1948.            selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
  1949.      HighLightForward ();
  1950. !    fileModified = TRUE;
  1951.      justDupped = FALSE;
  1952.   }
  1953. --- 655,659 ----
  1954.            selRbX+(1<<zoomScale), selRbY+(1<<zoomScale));
  1955.      HighLightForward ();
  1956. !    SetFileModified (TRUE);
  1957.      justDupped = FALSE;
  1958.   }
  1959. ---------------------------------> cut here <---------------------------------
  1960. --
  1961.  
  1962. -- Bill Cheng // UCLA Computer Science Department // (213) 206-7135
  1963.    3277 Boelter Hall // Los Angeles, California 90024 // USA
  1964.    william@CS.UCLA.EDU      ...!{uunet|ucbvax}!cs.ucla.edu!william
  1965.  
  1966. dan
  1967. ----------------------------------------------------
  1968. O'Reilly && Associates   argv@sun.com / argv@ora.com
  1969. Opinions expressed reflect those of the author only.
  1970.