home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume3 / awm2 / part09 / StoreBox.c < prev   
Encoding:
C/C++ Source or Header  |  1989-02-20  |  5.1 KB  |  191 lines

  1.  
  2.  
  3.  
  4. #ifndef lint
  5. static char *rcsid_StoreBox_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/StoreBox.c,v 1.1 89/01/23 15:34:53 jkh Exp $";
  6. #endif    lint
  7.  
  8. #include "X11/copyright.h"
  9. /*
  10.  *
  11.  * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  12.  *
  13.  * Copyright 1987 by Jordan Hubbard.
  14.  *
  15.  *
  16.  *                         All Rights Reserved
  17.  *
  18.  * Permission to use, copy, modify, and distribute this software and its
  19.  * documentation for any purpose and without fee is hereby granted,
  20.  * provided that the above copyright notice appear in all copies and that
  21.  * both that copyright notice and this permission notice appear in
  22.  * supporting documentation, and that the name of Ardent Computer
  23.  * Corporation or Jordan Hubbard not be used in advertising or publicity
  24.  * pertaining to distribution of the software without specific, written
  25.  * prior permission.
  26.  *
  27.  */
  28.  
  29. /*
  30.  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  31.  *
  32.  *                         All Rights Reserved
  33.  *
  34.  * Permission to use, copy, modify, and distribute this software and its
  35.  * documentation for any purpose and without fee is hereby granted,
  36.  * provided that the above copyright notice appear in all copies and that
  37.  * both that copyright notice and this permission notice appear in
  38.  * supporting documentation, and that the name of Digital Equipment
  39.  * Corporation not be used in advertising or publicity pertaining to
  40.  * distribution of the software without specific, written prior permission.
  41.  *
  42.  *
  43.  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  44.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  45.  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  46.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  47.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  48.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  49.  * SOFTWARE.
  50.  */
  51.  
  52.  
  53.  
  54. /*
  55.  * MODIFICATION HISTORY
  56.  *
  57.  * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  58.  * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
  59.  Western Software Lab. Convert to X11.
  60.  * 002 -- Jordan Hubbard, Ardent Computer
  61.  *  Additional boxes for titled windows.
  62.  */
  63.  
  64. /*
  65.  *    StoreBox - This subroutine is used by the X Window Manager (xwm)
  66.  *    to store the vertices for the resize / movement box in a vertex list.
  67.  */
  68.  
  69. #include "awm.h"
  70.  
  71. /*
  72.  * Store the vertices for the resize movement box (on a titled window)
  73.  * in a vertex list.
  74.  */
  75. int StoreTitleBox(box, ulx, uly, lrx, lry)
  76. register XSegment box[];
  77. int ulx;            /* Upper left X coordinate. */
  78. int uly;            /* Upper left Y coordinate. */
  79. int lrx;            /* Lower right X coordinate. */
  80. int lry;            /* Lower right Y coordinate. */
  81. {
  82.      Entry("StoreTitleBox");
  83.      
  84.      /*
  85.       * Xor in.
  86.       */
  87.      
  88.      box[0].x1 = ulx; box[0].y1 = uly;
  89.      box[0].x2 = lrx; box[0].y2 = uly;
  90.  
  91.      box[1].x1 = ulx; box[1].y1 = uly + titleHeight + 2;
  92.      box[1].x2 = lrx; box[1].y2 = uly + titleHeight + 2;
  93.      
  94.      box[2].x1 = lrx; box[2].y1 = uly;
  95.      box[2].x2 = lrx; box[2].y2 = lry;
  96.      
  97.      box[3].x1 = lrx; box[3].y1 = lry;
  98.      box[3].x2 = ulx; box[3].y2 = lry;
  99.      
  100.      box[4].x1 = ulx; box[4].y1 = lry;
  101.      box[4].x2 = ulx; box[4].y2 = uly;
  102.  
  103.      
  104.      /*
  105.       * If we freeze the screen, don't bother to xor out.
  106.       */
  107.      if (Freeze)
  108.       Leave(5)
  109.      
  110.      /*
  111.       * Xor out.
  112.       */
  113.      box[4].x1 = ulx; box[4].y1 = uly;
  114.      box[4].x2 = lrx; box[4].y2 = uly;
  115.      
  116.      box[5].x1 = ulx; box[5].y1 = uly + titleHeight + 2;
  117.      box[5].x2 = lrx; box[5].y2 = uly + titleHeight + 2;
  118.      
  119.      box[6].x1 = lrx; box[6].y1 = uly;
  120.      box[6].x2 = lrx; box[6].y2 = lry;
  121.      
  122.      box[7].x1 = lrx; box[7].y1 = lry;
  123.      box[7].x2 = ulx; box[7].y2 = lry;
  124.      
  125.      box[8].x1 = ulx; box[8].y1 = lry;
  126.      box[8].x2 = ulx; box[8].y2 = uly;
  127.      
  128.      
  129.      /*
  130.       * Total number of vertices is 9.
  131.       */
  132.      Leave(9)
  133. }
  134.  
  135. /*
  136.  * Store the vertices for the resize movement box in a vertex list.
  137.  */
  138. int StoreBox(box, ulx, uly, lrx, lry)
  139. register XSegment box[];
  140. int ulx;            /* Upper left X coordinate. */
  141. int uly;            /* Upper left Y coordinate. */
  142. int lrx;            /* Lower right X coordinate. */
  143. int lry;            /* Lower right Y coordinate. */
  144. {
  145.      Entry("StoreBox");
  146.      
  147.      /*
  148.       * Xor in.
  149.       */
  150.      
  151.      box[0].x1 = ulx; box[0].y1 = uly;
  152.      box[0].x2 = lrx; box[0].y2 = uly;
  153.      
  154.      box[1].x1 = lrx; box[1].y1 = uly;
  155.      box[1].x2 = lrx; box[1].y2 = lry;
  156.      
  157.      box[2].x1 = lrx; box[2].y1 = lry;
  158.      box[2].x2 = ulx; box[2].y2 = lry;
  159.      
  160.      box[3].x1 = ulx; box[3].y1 = lry;
  161.      box[3].x2 = ulx; box[3].y2 = uly;
  162.      
  163.      
  164.      /*
  165.       * If we freeze the screen, don't bother to xor out.
  166.       */
  167.      if (Freeze)
  168.       Leave(4)
  169.      
  170.      /*
  171.       * Xor out.
  172.       */
  173.      box[4].x1 = ulx; box[4].y1 = uly;
  174.      box[4].x2 = lrx; box[4].y2 = uly;
  175.      
  176.      box[5].x1 = lrx; box[5].y1 = uly;
  177.      box[5].x2 = lrx; box[5].y2 = lry;
  178.      
  179.      box[6].x1 = lrx; box[6].y1 = lry;
  180.      box[6].x2 = ulx; box[6].y2 = lry;
  181.      
  182.      box[7].x1 = ulx; box[7].y1 = lry;
  183.      box[7].x2 = ulx; box[7].y2 = uly;
  184.      
  185.      
  186.      /*
  187.       * Total number of vertices is 8.
  188.       */
  189.      Leave(8)
  190. }
  191.